Mouse events (#344)
* Explicit mouse-related DeviceEvents This makes the API more intuitive for common use-cases and allows us to better propagate platform knowledge of motion semantics. * Improve event naming consistency * Clarify axis event forwards-compatibility * Rename WindowEvent::MouseMoved/Entered/Left to CursorMoved/... This emphasizes the difference between motion of the host GUI cursor, as used for clicking on things, and raw mouse(-like) input data, as used for first-person controls. * Add support for windows and OSX, fix merging * Fix warnings and errors on Linux * Remove unnecessary breaking changes * Add MouseWheel events to windows and OSX * Fix bad push call. * Fix docs, naming, and x11 events * Remove mutability warning * Add changelog entry
This commit is contained in:
parent
c61f9b75f8
commit
cfd087d9a5
8 changed files with 117 additions and 41 deletions
|
|
@ -41,13 +41,13 @@ pub fn pointer_implementation() -> wl_pointer::Implementation<PointerIData> {
|
|||
idata.mouse_focus = Some(wid);
|
||||
let mut guard = idata.sink.lock().unwrap();
|
||||
guard.send_event(
|
||||
Event::MouseEntered {
|
||||
Event::CursorEntered {
|
||||
device_id: ::DeviceId(::platform::DeviceId::Wayland(DeviceId)),
|
||||
},
|
||||
wid,
|
||||
);
|
||||
guard.send_event(
|
||||
Event::MouseMoved {
|
||||
Event::CursorMoved {
|
||||
device_id: ::DeviceId(::platform::DeviceId::Wayland(DeviceId)),
|
||||
position: (x, y),
|
||||
},
|
||||
|
|
@ -61,7 +61,7 @@ pub fn pointer_implementation() -> wl_pointer::Implementation<PointerIData> {
|
|||
if let Some(wid) = wid {
|
||||
let mut guard = idata.sink.lock().unwrap();
|
||||
guard.send_event(
|
||||
Event::MouseLeft {
|
||||
Event::CursorLeft {
|
||||
device_id: ::DeviceId(::platform::DeviceId::Wayland(DeviceId)),
|
||||
},
|
||||
wid,
|
||||
|
|
@ -71,7 +71,7 @@ pub fn pointer_implementation() -> wl_pointer::Implementation<PointerIData> {
|
|||
motion: |_, idata, _, _, x, y| {
|
||||
if let Some(wid) = idata.mouse_focus {
|
||||
idata.sink.lock().unwrap().send_event(
|
||||
Event::MouseMoved {
|
||||
Event::CursorMoved {
|
||||
device_id: ::DeviceId(::platform::DeviceId::Wayland(DeviceId)),
|
||||
position: (x, y)
|
||||
},
|
||||
|
|
@ -178,4 +178,4 @@ pub fn pointer_implementation() -> wl_pointer::Implementation<PointerIData> {
|
|||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue