input: implement wl_seat version 9
This commit is contained in:
parent
887e2b6cbc
commit
78b557b4a1
15 changed files with 91 additions and 20 deletions
|
|
@ -283,6 +283,7 @@ struct MetalInputDevice {
|
|||
events: SyncQueue<InputEvent>,
|
||||
cb: CloneCell<Option<Rc<dyn Fn()>>>,
|
||||
name: CloneCell<Rc<String>>,
|
||||
natural_scrolling: Cell<bool>,
|
||||
|
||||
// state
|
||||
pressed_keys: SmallMap<u32, (), 5>,
|
||||
|
|
@ -356,7 +357,7 @@ impl MetalInputDevice {
|
|||
dev.device().set_drag_lock_enabled(enabled);
|
||||
}
|
||||
if let Some(enabled) = self.natural_scrolling_enabled.get() {
|
||||
dev.device().set_natural_scrolling_enabled(enabled);
|
||||
self.do_set_natural_scrolling_enabled(&dev, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -377,6 +378,12 @@ impl MetalInputDevice {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn do_set_natural_scrolling_enabled(&self, dev: &RegisteredDevice, enabled: bool) {
|
||||
dev.device().set_natural_scrolling_enabled(enabled);
|
||||
self.natural_scrolling
|
||||
.set(dev.device().natural_scrolling_enabled());
|
||||
}
|
||||
}
|
||||
|
||||
impl InputDevice for MetalInputDevice {
|
||||
|
|
@ -473,7 +480,7 @@ impl InputDevice for MetalInputDevice {
|
|||
fn set_natural_scrolling_enabled(&self, enabled: bool) {
|
||||
self.natural_scrolling_enabled.set(Some(enabled));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
dev.device().set_natural_scrolling_enabled(enabled);
|
||||
self.do_set_natural_scrolling_enabled(&dev, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,11 +149,13 @@ impl MetalBackend {
|
|||
InputEvent::Axis120 {
|
||||
dist: scroll as _,
|
||||
axis,
|
||||
inverted: dev.natural_scrolling.get(),
|
||||
}
|
||||
} else {
|
||||
InputEvent::AxisPx {
|
||||
dist: Fixed::from_f64(scroll),
|
||||
axis,
|
||||
inverted: dev.natural_scrolling.get(),
|
||||
}
|
||||
};
|
||||
dev.event(ie);
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ impl MetalBackend {
|
|||
events: Default::default(),
|
||||
cb: Default::default(),
|
||||
name: Default::default(),
|
||||
natural_scrolling: Default::default(),
|
||||
pressed_keys: Default::default(),
|
||||
pressed_buttons: Default::default(),
|
||||
left_handed: Default::default(),
|
||||
|
|
@ -336,6 +337,8 @@ impl MetalBackend {
|
|||
};
|
||||
inputdev.device().set_slot(slot);
|
||||
dev.name.set(Rc::new(inputdev.device().name()));
|
||||
dev.natural_scrolling
|
||||
.set(inputdev.device().natural_scrolling_enabled());
|
||||
dev.inputdev.set(Some(inputdev));
|
||||
dev.apply_config();
|
||||
slf.state
|
||||
|
|
|
|||
|
|
@ -799,6 +799,7 @@ impl XBackend {
|
|||
seat.mouse_event(InputEvent::Axis120 {
|
||||
dist: val * AXIS_120,
|
||||
axis,
|
||||
inverted: false,
|
||||
});
|
||||
seat.mouse_event(InputEvent::AxisFrame {
|
||||
time_usec: now_usec(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue