diff options
Diffstat (limited to 'src/gui.zig')
| -rw-r--r-- | src/gui.zig | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui.zig b/src/gui.zig index 15631efa..60d9501f 100644 --- a/src/gui.zig +++ b/src/gui.zig @@ -1080,6 +1080,8 @@ const StdinFeed = struct { .right => .right, .wheel_up => .wheel_up, .wheel_down => .wheel_down, + .wheel_left => .wheel_left, + .wheel_right => .wheel_right, .none => .none, else => null, }; @@ -1266,16 +1268,22 @@ fn dispatch(g: *Gui, core: *pardes.Pardes, sev: *const c.SDL_Event) void { }, c.SDL_EVENT_MOUSE_WHEEL => { const w = sev.wheel; - if (w.y == 0) return; + if (w.y == 0 and w.x == 0) return; g.mouse_x = w.mouse_x; g.mouse_y = w.mouse_y; const mc = mouseCell(g, core, w.mouse_x, w.mouse_y); - core.update(.{ .mouse = .{ + if (w.y != 0) core.update(.{ .mouse = .{ .button = if (w.y > 0) .wheel_up else .wheel_down, .kind = .press, .col = mc.col, .row = mc.row, } }); + if (w.x != 0) core.update(.{ .mouse = .{ + .button = if (w.x > 0) .wheel_right else .wheel_left, + .kind = .press, + .col = mc.col, + .row = mc.row, + } }); }, c.SDL_EVENT_FINGER_DOWN, c.SDL_EVENT_FINGER_MOTION, c.SDL_EVENT_FINGER_UP, c.SDL_EVENT_FINGER_CANCELED => { const f = sev.tfinger; |
