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

@ -208,6 +208,21 @@ pub enum EmbedderMsg {
OnDevtoolsStarted(Result<u16, ()>, String),
/// Compositing done, but external code needs to present.
ReadyToPresent,
/// The given event was delivered to a pipeline in the given browser.
EventDelivered(CompositorEventVariant),
}
/// The variant of CompositorEvent that was delivered to a pipeline.
#[derive(Debug, Deserialize, Serialize)]
pub enum CompositorEventVariant {
ResizeEvent,
MouseButtonEvent,
MouseMoveEvent,
TouchEvent,
WheelEvent,
KeyboardEvent,
CompositionEvent,
IMEDismissedEvent,
}
impl Debug for EmbedderMsg {
@ -245,6 +260,7 @@ impl Debug for EmbedderMsg {
EmbedderMsg::OnDevtoolsStarted(..) => write!(f, "OnDevtoolsStarted"),
EmbedderMsg::ShowContextMenu(..) => write!(f, "ShowContextMenu"),
EmbedderMsg::ReadyToPresent => write!(f, "ReadyToPresent"),
EmbedderMsg::EventDelivered(..) => write!(f, "HitTestedEvent"),
}
}
}