diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 14:20:10 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | 17c0d06618085de8d0bbf8152750ffa862db0080 (patch) | |
| tree | 71a2d33dcf14e4e95387f3aa556e9952135de894 /src/gui/gui.zig | |
| parent | b546b578baadbd8fdd15b42988ad4d66c9c8ff21 (diff) | |
| download | pardes-17c0d06618085de8d0bbf8152750ffa862db0080.tar.gz pardes-17c0d06618085de8d0bbf8152750ffa862db0080.zip | |
A program that asked for focus reports (1004) hears CSI I when its pane takes the keyboard and CSI O when it gives it up, to another pane, a tag or another window
The core has a window-focus event now, from SDL's window focus and from
the tty's own focus reports (vaxis turns 1004 on outside); the detached
wire carries it: version 10. The test shell's ESC]777;mouse;focus;<1|0>
fakes the window's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 590d749d..81b68afd 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -3172,6 +3172,9 @@ const StdinFeed = struct { sev.wheel.integer_y = @intFromFloat(@trunc(amount)); sev.wheel.mouse_x = x; sev.wheel.mouse_y = y; + } else if (std.mem.eql(u8, kind, "focus")) { + // ESC]777;mouse;focus;<1 gained, 0 lost>;0;0BEL + sev.type = if (button != 0) c.SDL_EVENT_WINDOW_FOCUS_GAINED else c.SDL_EVENT_WINDOW_FOCUS_LOST; } else if (std.mem.eql(u8, kind, "motion")) { sev.type = c.SDL_EVENT_MOUSE_MOTION; sev.motion.x = x; @@ -3469,6 +3472,8 @@ fn dispatch(g: *Gui, in: *Input, sev: *const c.SDL_Event) void { } switch (sev.type) { c.SDL_EVENT_QUIT, c.SDL_EVENT_WINDOW_CLOSE_REQUESTED => in.close(), + c.SDL_EVENT_WINDOW_FOCUS_GAINED => in.post(.{ .focus = true }), + c.SDL_EVENT_WINDOW_FOCUS_LOST => in.post(.{ .focus = false }), c.SDL_EVENT_WINDOW_MOUSE_LEAVE => { g.pointer_present = false; g.pointer_mapped = false; |
