Send mouse position after focused/cursorenter events (#349)
* Update mouse pos after cursor enter event * Update mouse position on windows focus * Send device_id * Update other device id * Fix windows import * Remove deque for vec * Just send event * Use correct push_back method * Push correct event
This commit is contained in:
parent
fae10c6072
commit
0f14e63b34
3 changed files with 48 additions and 4 deletions
|
|
@ -460,8 +460,13 @@ impl EventsLoop {
|
|||
physical_device.reset_scroll_position(info);
|
||||
}
|
||||
}
|
||||
callback(Event::WindowEvent { window_id: mkwid(xev.event), event: CursorEntered { device_id: mkdid(xev.deviceid) } });
|
||||
|
||||
callback(Event::WindowEvent { window_id: mkwid(xev.event), event: CursorEntered { device_id: mkdid(xev.deviceid) } })
|
||||
let new_cursor_pos = (xev.event_x, xev.event_y);
|
||||
callback(Event::WindowEvent { window_id: wid, event: CursorMoved {
|
||||
device_id: mkdid(xev.deviceid),
|
||||
position: new_cursor_pos
|
||||
}})
|
||||
}
|
||||
ffi::XI_Leave => {
|
||||
let xev: &ffi::XILeaveEvent = unsafe { &*(xev.data as *const _) };
|
||||
|
|
@ -474,7 +479,13 @@ impl EventsLoop {
|
|||
let window_data = windows.get_mut(&WindowId(xev.event)).unwrap();
|
||||
(self.display.xlib.XSetICFocus)(window_data.ic);
|
||||
}
|
||||
callback(Event::WindowEvent { window_id: mkwid(xev.event), event: Focused(true) })
|
||||
callback(Event::WindowEvent { window_id: mkwid(xev.event), event: Focused(true) });
|
||||
|
||||
let new_cursor_pos = (xev.event_x, xev.event_y);
|
||||
callback(Event::WindowEvent { window_id: wid, event: CursorMoved {
|
||||
device_id: mkdid(xev.deviceid),
|
||||
position: new_cursor_pos
|
||||
}})
|
||||
}
|
||||
ffi::XI_FocusOut => {
|
||||
let xev: &ffi::XIFocusOutEvent = unsafe { &*(xev.data as *const _) };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue