config: allow setting per-device scroll wheel speed
This commit is contained in:
parent
50c87d6da7
commit
c0afc5cf2a
12 changed files with 78 additions and 16 deletions
|
|
@ -20,10 +20,11 @@ use {
|
|||
WHEEL_TILT_SINCE_VERSION,
|
||||
},
|
||||
zwp_relative_pointer_v1::ZwpRelativePointerV1,
|
||||
Dnd, SeatId, WlSeat, WlSeatGlobal, CHANGE_CURSOR_MOVED, PX_PER_SCROLL,
|
||||
Dnd, SeatId, WlSeat, WlSeatGlobal, CHANGE_CURSOR_MOVED,
|
||||
},
|
||||
wl_surface::{xdg_surface::xdg_popup::XdgPopup, WlSurface},
|
||||
},
|
||||
state::DeviceHandlerData,
|
||||
tree::{Direction, FloatNode, Node, ToplevelNode},
|
||||
utils::{bitflags::BitflagsExt, clonecell::CloneCell, smallmap::SmallMap},
|
||||
wire::WlDataOfferId,
|
||||
|
|
@ -166,7 +167,7 @@ impl NodeSeatState {
|
|||
}
|
||||
|
||||
impl WlSeatGlobal {
|
||||
pub fn event(self: &Rc<Self>, event: InputEvent) {
|
||||
pub fn event(self: &Rc<Self>, dev: &DeviceHandlerData, event: InputEvent) {
|
||||
match event {
|
||||
InputEvent::Key {
|
||||
time_usec,
|
||||
|
|
@ -196,7 +197,7 @@ impl WlSeatGlobal {
|
|||
InputEvent::Axis120 { dist, axis } => self.pointer_owner.axis_120(dist, axis),
|
||||
InputEvent::AxisSmooth { dist, axis } => self.pointer_owner.axis_smooth(dist, axis),
|
||||
InputEvent::AxisStop { axis } => self.pointer_owner.axis_stop(axis),
|
||||
InputEvent::AxisFrame { time_usec } => self.pointer_owner.frame(self, time_usec),
|
||||
InputEvent::AxisFrame { time_usec } => self.pointer_owner.frame(dev, self, time_usec),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +538,12 @@ impl WlSeatGlobal {
|
|||
|
||||
// Scroll callbacks
|
||||
impl WlSeatGlobal {
|
||||
pub fn scroll_surface(&self, surface: &WlSurface, event: &PendingScroll) {
|
||||
pub fn scroll_surface(
|
||||
&self,
|
||||
dev: &DeviceHandlerData,
|
||||
surface: &WlSurface,
|
||||
event: &PendingScroll,
|
||||
) {
|
||||
if let Some(source) = event.source.get() {
|
||||
let since = if source >= WHEEL_TILT {
|
||||
WHEEL_TILT_SINCE_VERSION
|
||||
|
|
@ -556,7 +562,7 @@ impl WlSeatGlobal {
|
|||
} else if p.seat.version >= AXIS_DISCRETE_SINCE_VERSION {
|
||||
p.send_axis_discrete(axis, delta / AXIS_120);
|
||||
}
|
||||
let px = (delta as f64 / AXIS_120 as f64) * PX_PER_SCROLL;
|
||||
let px = (delta as f64 / AXIS_120 as f64) * dev.px_per_scroll_wheel.get();
|
||||
p.send_axis(time, axis, Fixed::from_f64(px));
|
||||
} else if let Some(delta) = event.smooth[i].get() {
|
||||
p.send_axis(time, axis, delta);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use {
|
|||
wl_seat::{wl_pointer::PendingScroll, Dnd, DroppedDnd, WlSeatError, WlSeatGlobal},
|
||||
wl_surface::WlSurface,
|
||||
},
|
||||
state::DeviceHandlerData,
|
||||
tree::{FoundNode, Node},
|
||||
utils::{clonecell::CloneCell, smallmap::SmallMap},
|
||||
},
|
||||
|
|
@ -51,11 +52,11 @@ impl PointerOwnerHolder {
|
|||
self.pending_scroll.stop[axis as usize].set(true);
|
||||
}
|
||||
|
||||
pub fn frame(&self, seat: &Rc<WlSeatGlobal>, time_usec: u64) {
|
||||
pub fn frame(&self, dev: &DeviceHandlerData, seat: &Rc<WlSeatGlobal>, time_usec: u64) {
|
||||
self.pending_scroll.time_usec.set(time_usec);
|
||||
let pending = self.pending_scroll.take();
|
||||
if let Some(node) = self.owner.get().axis_node(seat) {
|
||||
node.node_on_axis_event(seat, &pending);
|
||||
node.node_on_axis_event(dev, seat, &pending);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use {
|
|||
object::Object,
|
||||
rect::{Rect, Region},
|
||||
render::Renderer,
|
||||
state::DeviceHandlerData,
|
||||
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelNode},
|
||||
utils::{
|
||||
buffd::{MsgParser, MsgParserError},
|
||||
|
|
@ -779,8 +780,13 @@ impl Node for WlSurface {
|
|||
seat.button_surface(&self, time_usec, button, state, serial);
|
||||
}
|
||||
|
||||
fn node_on_axis_event(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, event: &PendingScroll) {
|
||||
seat.scroll_surface(&*self, event);
|
||||
fn node_on_axis_event(
|
||||
self: Rc<Self>,
|
||||
dev: &DeviceHandlerData,
|
||||
seat: &Rc<WlSeatGlobal>,
|
||||
event: &PendingScroll,
|
||||
) {
|
||||
seat.scroll_surface(dev, &*self, event);
|
||||
}
|
||||
|
||||
fn node_on_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue