constellation: notify embedder when events are hit-tested to browsers (#30841)

* constellation: notify embedder when events are hit-tested to browsers

* fix compile error in libsimpleservo

* impl From<&CompositorEvent> for CompositorEventVariant

* remove msg temporaries in Constellation::forward_event

* use single wildcard arm in EventDelivered case in handle_servo_events
This commit is contained in:
Delan Azabani 2023-12-12 14:36:27 +08:00 committed by GitHub
parent 676c170b07
commit 8a226fdb19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 10 deletions

View file

@ -14,8 +14,8 @@ use keyboard_types::{Key, KeyboardEvent, Modifiers, ShortcutMatcher};
use log::{debug, error, info, trace, warn};
use servo::compositing::windowing::{EmbedderEvent, WebRenderDebugOption};
use servo::embedder_traits::{
ContextMenuResult, EmbedderMsg, FilterPattern, PermissionPrompt, PermissionRequest,
PromptDefinition, PromptOrigin, PromptResult,
CompositorEventVariant, ContextMenuResult, EmbedderMsg, FilterPattern, PermissionPrompt,
PermissionRequest, PromptDefinition, PromptOrigin, PromptResult,
};
use servo::msg::constellation_msg::{TopLevelBrowsingContextId as BrowserId, TraversalDirection};
use servo::script_traits::TouchEventType;
@ -545,6 +545,13 @@ where
EmbedderMsg::ReadyToPresent => {
need_present = true;
},
EmbedderMsg::EventDelivered(event) => match (browser_id, event) {
(Some(browser_id), CompositorEventVariant::MouseButtonEvent) => {
// TODO Focus browser and/or raise to top if needed.
trace!("{}: Got a mouse button event", browser_id);
},
(_, _) => {},
},
}
}