summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-12 00:38:18 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-12 00:38:18 +0200
commitf652e84187336c8bdd9bee32c0afeda7b14796b3 (patch)
treea63bbdffb2062954b5e00c5066c04dada053a4e9 /native
parent4b0cc178ddadcb93b1912928631327c3a23c24b5 (diff)
downloadiced-f652e84187336c8bdd9bee32c0afeda7b14796b3.tar.gz
iced-f652e84187336c8bdd9bee32c0afeda7b14796b3.tar.bz2
iced-f652e84187336c8bdd9bee32c0afeda7b14796b3.zip
Make cursor unavailable on leave in `iced_winit`
For now, we just set the cursor position to some negative coordinates. This is a temporary hack until we are able to encode cursor availability. Layers and/or multi-window support will make this apparent.
Diffstat (limited to 'native')
-rw-r--r--native/src/user_interface.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs
index 5d9221e9..88ffd6d6 100644
--- a/native/src/user_interface.rs
+++ b/native/src/user_interface.rs
@@ -188,8 +188,15 @@ where
let mut messages = Vec::new();
for event in events {
- if let Event::Mouse(mouse::Event::CursorMoved { x, y }) = event {
- self.cursor_position = Point::new(x, y);
+ match event {
+ Event::Mouse(mouse::Event::CursorMoved { x, y }) => {
+ self.cursor_position = Point::new(x, y);
+ }
+ Event::Mouse(mouse::Event::CursorLeft) => {
+ // TODO: Encode cursor availability
+ self.cursor_position = Point::new(-1.0, -1.0);
+ }
+ _ => {}
}
self.root.widget.on_event(