diff options
Diffstat (limited to 'dev/gui/gui.zig')
| -rw-r--r-- | dev/gui/gui.zig | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index 2756f69b..2e5dc5c2 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -1530,6 +1530,9 @@ const StdinFeed = struct { // window pixels, built as SDL would and run through dispatch, // so a driver exercises the real pointer path (pixel to cell, // tag and body hits). SGR mouse carries only cells. + // mouse;pointer;<SDL button, 0 for none>;<x>;<y>: a motion as + // `motion` builds it, pushed onto SDL's queue as a mouse's + // comes, for the window's wait to take with the rest. // finger;<kind>;<id>;<x>;<y>;<pressure> // close: the window's close button // One the read cut short, or what may yet begin one, waits for @@ -1558,7 +1561,7 @@ const StdinFeed = struct { // counts them: shift 4, meta (alt) 8, ctrl 16. const held = std.fmt.parseInt(u8, parts.next() orelse "0", 10) catch 0; var sev = std.mem.zeroes(c.SDL_Event); - const k = std.meta.stringToEnum(enum { wheel, focus, motion, down, up }, kind) orelse .up; + const k = std.meta.stringToEnum(enum { wheel, focus, motion, pointer, down, up }, kind) orelse .up; switch (k) { .wheel => { // ESC]777;mouse;wheel;<y, SDL's sign: up positive>;<x>;<y>BEL: @@ -1572,7 +1575,7 @@ const StdinFeed = struct { }, // ESC]777;mouse;focus;<1 gained, 0 lost>;0;0BEL .focus => sev.type = if (button != 0) c.SDL_EVENT_WINDOW_FOCUS_GAINED else c.SDL_EVENT_WINDOW_FOCUS_LOST, - .motion => { + .motion, .pointer => { sev.type = c.SDL_EVENT_MOUSE_MOTION; sev.motion.x = x; sev.motion.y = y; @@ -1586,6 +1589,11 @@ const StdinFeed = struct { sev.button.y = y; }, } + if (k == .pointer) { + sev.motion.windowID = c.SDL_GetWindowID(gp.window); + _ = c.SDL_PushEvent(&sev); + continue; + } const before = c.SDL_GetModState(); var mods: c.SDL_Keymod = 0; if (held & 4 != 0) mods |= c.SDL_KMOD_LSHIFT; |
