From 6a379b195c36a039db45b9c39d99f5af9c91cddf Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Fri, 21 Jun 2024 13:05:32 +0200 Subject: [PATCH] avm2: Do not fire roll over events on focus change (yet) This patch bypasses AVM2 conditionally when firing roll over events triggered by a focus change until a proper support for AVM2 events is implemented. --- core/src/focus_tracker.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/focus_tracker.rs b/core/src/focus_tracker.rs index ff3ad3b3fed72..d08c863393074 100644 --- a/core/src/focus_tracker.rs +++ b/core/src/focus_tracker.rs @@ -158,6 +158,18 @@ impl<'gc> FocusTracker<'gc> { fn roll_over(context: &mut UpdateContext<'_, 'gc>, new: Option>) { let old = context.mouse_data.hovered; + + // TODO It seems that AVM2 has a slightly different behavior here. + // It may be related to the fact that AVM2 handles key and mouse focus differently. + // AVM2 is being bypassed here conditionally until + // a proper support for AVM2 events is implemented. + // See https://github.com/ruffle-rs/ruffle/issues/16789 + if new.is_some_and(|int| int.as_displayobject().movie().is_action_script_3()) + || old.is_some_and(|int| int.as_displayobject().movie().is_action_script_3()) + { + return; + } + context.mouse_data.hovered = new; if let Some(old) = old { old.handle_clip_event(context, ClipEvent::RollOut { to: new });