mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update SetCursor behavior
This commit is contained in:
parent
07d1559141
commit
7858ede29f
3 changed files with 11 additions and 8 deletions
|
@ -191,6 +191,9 @@ pub struct IOCompositor<Window: WindowMethods> {
|
|||
|
||||
/// The coordinates of the native window, its view and the screen.
|
||||
embedder_coordinates: EmbedderCoordinates,
|
||||
|
||||
/// Current mouse cursor.
|
||||
cursor: Cursor,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
|
@ -291,6 +294,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
webrender_api: state.webrender_api,
|
||||
webvr_heartbeats: state.webvr_heartbeats,
|
||||
pending_paint_metrics: HashMap::new(),
|
||||
cursor: Cursor::None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -709,9 +713,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
|
||||
if let Some(cursor) = Cursor::from_u8(item.tag.1 as _) {
|
||||
let msg = ConstellationMsg::SetCursor(cursor);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
if cursor != self.cursor {
|
||||
self.cursor = cursor;
|
||||
let msg = ConstellationMsg::SetCursor(cursor);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue