summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.zig5
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;