mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
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:
+13
-5
@@ -569,16 +569,24 @@ func (h *x11EventHandler) handleEvents() bool {
|
||||
case C.Button3:
|
||||
btn = pointer.ButtonSecondary
|
||||
case C.Button4:
|
||||
// scroll up
|
||||
ev.Type = pointer.Scroll
|
||||
ev.Scroll.Y = -scrollScale
|
||||
// scroll up or left (if shift is pressed).
|
||||
if ev.Modifiers == key.ModShift {
|
||||
ev.Scroll.X = -scrollScale
|
||||
} else {
|
||||
ev.Scroll.Y = -scrollScale
|
||||
}
|
||||
case C.Button5:
|
||||
// scroll down
|
||||
// scroll down or right (if shift is pressed).
|
||||
ev.Type = pointer.Scroll
|
||||
ev.Scroll.Y = +scrollScale
|
||||
if ev.Modifiers == key.ModShift {
|
||||
ev.Scroll.X = +scrollScale
|
||||
} else {
|
||||
ev.Scroll.Y = +scrollScale
|
||||
}
|
||||
case 6:
|
||||
// http://xahlee.info/linux/linux_x11_mouse_button_number.html
|
||||
// scroll left
|
||||
// scroll left.
|
||||
ev.Type = pointer.Scroll
|
||||
ev.Scroll.X = -scrollScale * 2
|
||||
case 7:
|
||||
|
||||
Reference in New Issue
Block a user