1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 15:04:36 +03:00

window: fix build for examples post mouse coords changes

This commit is contained in:
Wez Furlong 2019-11-23 16:46:46 -08:00
parent bbe9c6e14b
commit 10a0006eaf
2 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ use std::any::Any;
struct MyWindow {
allow_close: bool,
cursor_pos: (u16, u16),
cursor_pos: Point,
}
impl Drop for MyWindow {
@ -45,7 +45,7 @@ impl WindowCallbacks for MyWindow {
}
fn mouse_event(&mut self, event: &MouseEvent, ctx: &dyn WindowOps) {
self.cursor_pos = (event.x, event.y);
self.cursor_pos = event.coords;
ctx.invalidate();
ctx.set_cursor(Some(MouseCursor::Arrow));
@ -67,7 +67,7 @@ async fn spawn_window() -> Result<(), Box<dyn std::error::Error>> {
600,
Box::new(MyWindow {
allow_close: false,
cursor_pos: (100, 200),
cursor_pos: Point::new(100, 200),
}),
)?;

View File

@ -4,7 +4,7 @@ use std::any::Any;
struct MyWindow {
allow_close: bool,
cursor_pos: (u16, u16),
cursor_pos: Point,
}
impl Drop for MyWindow {
@ -51,7 +51,7 @@ impl WindowCallbacks for MyWindow {
context.draw_line(
Point::new(0, 0),
Point::new(self.cursor_pos.0 as isize, self.cursor_pos.1 as isize),
self.cursor_pos,
Color::rgb(0xff, 0xff, 0x80),
Operator::Over,
);
@ -69,7 +69,7 @@ impl WindowCallbacks for MyWindow {
fn mouse_event(&mut self, event: &MouseEvent, ctx: &dyn WindowOps) {
eprintln!("{:?}", event);
self.cursor_pos = (event.x, event.y);
self.cursor_pos = event.coords;
ctx.invalidate();
ctx.set_cursor(Some(MouseCursor::Arrow));
@ -91,7 +91,7 @@ fn spawn_window() -> Fallible<()> {
600,
Box::new(MyWindow {
allow_close: false,
cursor_pos: (100, 200),
cursor_pos: Point::new(100, 200),
}),
)?;