core: Call focus handlers on every object
Before this patch, focus handlers were called from on_focus_changed, only for selected objects. It seems that they should be called for every object by default.
This commit is contained in:
parent
f5a0751557
commit
42c26f61d1
|
@ -610,12 +610,11 @@ impl<'gc> TInteractiveObject<'gc> for Avm1Button<'gc> {
|
|||
|
||||
fn on_focus_changed(
|
||||
&self,
|
||||
context: &mut UpdateContext<'_, 'gc>,
|
||||
_context: &mut UpdateContext<'_, 'gc>,
|
||||
focused: bool,
|
||||
other: Option<InteractiveObject<'gc>>,
|
||||
_other: Option<InteractiveObject<'gc>>,
|
||||
) {
|
||||
self.0.has_focus.set(focused);
|
||||
self.call_focus_handler(context, focused, other);
|
||||
}
|
||||
|
||||
fn tab_enabled_avm1(&self, context: &mut UpdateContext<'_, 'gc>) -> bool {
|
||||
|
|
|
@ -826,12 +826,11 @@ impl<'gc> TInteractiveObject<'gc> for Avm2Button<'gc> {
|
|||
|
||||
fn on_focus_changed(
|
||||
&self,
|
||||
context: &mut UpdateContext<'_, 'gc>,
|
||||
_context: &mut UpdateContext<'_, 'gc>,
|
||||
focused: bool,
|
||||
other: Option<InteractiveObject<'gc>>,
|
||||
_other: Option<InteractiveObject<'gc>>,
|
||||
) {
|
||||
self.0.has_focus.set(focused);
|
||||
self.call_focus_handler(context, focused, other);
|
||||
}
|
||||
|
||||
fn tab_enabled_avm2_default(&self, _context: &mut UpdateContext<'_, 'gc>) -> bool {
|
||||
|
|
|
@ -2457,7 +2457,7 @@ impl<'gc> TInteractiveObject<'gc> for EditText<'gc> {
|
|||
&self,
|
||||
context: &mut UpdateContext<'_, 'gc>,
|
||||
focused: bool,
|
||||
other: Option<InteractiveObject<'gc>>,
|
||||
_other: Option<InteractiveObject<'gc>>,
|
||||
) {
|
||||
let is_action_script_3 = self.movie().is_action_script_3();
|
||||
let mut text = self.0.write(context.gc_context);
|
||||
|
@ -2465,9 +2465,6 @@ impl<'gc> TInteractiveObject<'gc> for EditText<'gc> {
|
|||
if !focused && !is_action_script_3 {
|
||||
text.selection = None;
|
||||
}
|
||||
drop(text);
|
||||
|
||||
self.call_focus_handler(context, focused, other);
|
||||
}
|
||||
|
||||
fn is_highlightable(&self, _context: &mut UpdateContext<'_, 'gc>) -> bool {
|
||||
|
|
|
@ -3390,10 +3390,9 @@ impl<'gc> TInteractiveObject<'gc> for MovieClip<'gc> {
|
|||
&self,
|
||||
context: &mut UpdateContext<'_, 'gc>,
|
||||
focused: bool,
|
||||
other: Option<InteractiveObject<'gc>>,
|
||||
_other: Option<InteractiveObject<'gc>>,
|
||||
) {
|
||||
self.0.write(context.gc_context).has_focus = focused;
|
||||
self.call_focus_handler(context, focused, other);
|
||||
}
|
||||
|
||||
fn tab_enabled_avm1(&self, context: &mut UpdateContext<'_, 'gc>) -> bool {
|
||||
|
|
|
@ -99,9 +99,11 @@ impl<'gc> FocusTracker<'gc> {
|
|||
|
||||
if let Some(old) = old {
|
||||
old.on_focus_changed(context, false, new);
|
||||
old.call_focus_handler(context, false, new);
|
||||
}
|
||||
if let Some(new) = new {
|
||||
new.on_focus_changed(context, true, old);
|
||||
new.call_focus_handler(context, true, old);
|
||||
}
|
||||
|
||||
tracing::info!("Focus is now on {:?}", new);
|
||||
|
|
Loading…
Reference in New Issue