mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Changed MouseMoved((i32, i32)) to MouseMoved(i32, i32), breaking change
This commit is contained in:
parent
8ae2df68e1
commit
117069ef90
|
@ -35,7 +35,7 @@ fn main() {
|
||||||
|
|
||||||
Event::Closed => break,
|
Event::Closed => break,
|
||||||
|
|
||||||
a @ Event::MouseMoved(_) => {
|
a @ Event::MouseMoved(_, _) => {
|
||||||
println!("{:?}", a);
|
println!("{:?}", a);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -848,8 +848,8 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> {
|
||||||
let view_rect = NSView::frame(*window.view);
|
let view_rect = NSView::frame(*window.view);
|
||||||
let scale_factor = window.hidpi_factor();
|
let scale_factor = window.hidpi_factor();
|
||||||
|
|
||||||
Some(MouseMoved(((scale_factor * view_point.x as f32) as i32,
|
Some(MouseMoved((scale_factor * view_point.x as f32) as i32,
|
||||||
(scale_factor * (view_rect.size.height - view_point.y) as f32) as i32)))
|
(scale_factor * (view_rect.size.height - view_point.y) as f32) as i32))
|
||||||
},
|
},
|
||||||
NSKeyDown => {
|
NSKeyDown => {
|
||||||
let mut events = VecDeque::new();
|
let mut events = VecDeque::new();
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub fn translate_event(
|
||||||
if known_surfaces.contains(&surface) {
|
if known_surfaces.contains(&surface) {
|
||||||
focuses.pointer_on = Some(surface);
|
focuses.pointer_on = Some(surface);
|
||||||
focuses.pointer_at = Some((x, y));
|
focuses.pointer_at = Some((x, y));
|
||||||
Some((GlutinEvent::MouseMoved((x as i32, y as i32)), surface))
|
Some((GlutinEvent::MouseMoved(x as i32, y as i32), surface))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ pub fn translate_event(
|
||||||
WlPointerEvent::Motion(_, x, y) => {
|
WlPointerEvent::Motion(_, x, y) => {
|
||||||
if let Some(surface) = focuses.pointer_on {
|
if let Some(surface) = focuses.pointer_on {
|
||||||
focuses.pointer_at = Some((x, y));
|
focuses.pointer_at = Some((x, y));
|
||||||
Some((GlutinEvent::MouseMoved((x as i32, y as i32)), surface))
|
Some((GlutinEvent::MouseMoved(x as i32, y as i32), surface))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT,
|
||||||
let x = winapi::GET_X_LPARAM(lparam) as i32;
|
let x = winapi::GET_X_LPARAM(lparam) as i32;
|
||||||
let y = winapi::GET_Y_LPARAM(lparam) as i32;
|
let y = winapi::GET_Y_LPARAM(lparam) as i32;
|
||||||
|
|
||||||
send_event(window, MouseMoved((x, y)));
|
send_event(window, MouseMoved(x, y));
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
|
|
|
@ -241,7 +241,7 @@ impl XInputEventHandler {
|
||||||
let new_cursor_pos = (event_data.event_x, event_data.event_y);
|
let new_cursor_pos = (event_data.event_x, event_data.event_y);
|
||||||
if new_cursor_pos != self.current_state.cursor_pos {
|
if new_cursor_pos != self.current_state.cursor_pos {
|
||||||
self.current_state.cursor_pos = new_cursor_pos;
|
self.current_state.cursor_pos = new_cursor_pos;
|
||||||
Some(MouseMoved((new_cursor_pos.0 as i32, new_cursor_pos.1 as i32)))
|
Some(MouseMoved(new_cursor_pos.0 as i32, new_cursor_pos.1 as i32))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub enum Event {
|
||||||
/// The cursor has moved on the window.
|
/// The cursor has moved on the window.
|
||||||
///
|
///
|
||||||
/// The parameter are the (x,y) coords in pixels relative to the top-left corner of the window.
|
/// The parameter are the (x,y) coords in pixels relative to the top-left corner of the window.
|
||||||
MouseMoved((i32, i32)),
|
MouseMoved(i32, i32),
|
||||||
|
|
||||||
/// A mouse wheel movement or touchpad scroll occurred.
|
/// A mouse wheel movement or touchpad scroll occurred.
|
||||||
MouseWheel(MouseScrollDelta, TouchPhase),
|
MouseWheel(MouseScrollDelta, TouchPhase),
|
||||||
|
|
Loading…
Reference in a new issue