forked from joejulian/gio
app: [linux,windows,wasm] scroll horizontally when shift key is pressed
Adds support for horizontal scroll using mousewheel with a shift key. Support is added for windows, linux (wayland and x11), js (wasm). Fixes: https://todo.sr.ht/~eliasnaur/gio/398 Signed-off-by: Mearaj <mearajbhagad@gmail.com>
This commit is contained in:
+12
-2
@@ -953,7 +953,12 @@ func gio_onPointerAxis(data unsafe.Pointer, p *C.struct_wl_pointer, t, axis C.ui
|
||||
case C.WL_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
w.scroll.dist.X += v
|
||||
case C.WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
w.scroll.dist.Y += v
|
||||
// horizontal scroll if shift + mousewheel(up/down) pressed.
|
||||
if w.disp.xkb.Modifiers() == key.ModShift {
|
||||
w.scroll.dist.X += v
|
||||
} else {
|
||||
w.scroll.dist.Y += v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1003,7 +1008,12 @@ func gio_onPointerAxisDiscrete(data unsafe.Pointer, p *C.struct_wl_pointer, axis
|
||||
case C.WL_POINTER_AXIS_HORIZONTAL_SCROLL:
|
||||
w.scroll.steps.X += int(discrete)
|
||||
case C.WL_POINTER_AXIS_VERTICAL_SCROLL:
|
||||
w.scroll.steps.Y += int(discrete)
|
||||
// horizontal scroll if shift + mousewheel(up/down) pressed.
|
||||
if w.disp.xkb.Modifiers() == key.ModShift {
|
||||
w.scroll.steps.X += int(discrete)
|
||||
} else {
|
||||
w.scroll.steps.Y += int(discrete)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user