From 9706a1493090b6fc3a830725039ddbf5351e57ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristo=CC=81fer=20R?= Date: Mon, 25 Nov 2024 18:47:35 -0500 Subject: [PATCH] mouse: set maybe_last_handler when consuming event Follow-up to my previous patch; this fixes an issue where the mouse_leave event was never sent because maybe_last_handler was only set when there was already a maybe_last_handler widget set. The change here makes it so that every time an event is consumed libvaxis keeps track of which widget did that through the maybe_last_handler variable. In other words: we update maybe_last_handler every time an event is explcitly consumed. --- src/vxfw/App.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vxfw/App.zig b/src/vxfw/App.zig index b4408b7..797e49d 100644 --- a/src/vxfw/App.zig +++ b/src/vxfw/App.zig @@ -272,8 +272,8 @@ const MouseHandler = struct { self.maybe_last_handler = item.widget; try app.handleCommand(&ctx.cmds); } - self.maybe_last_handler = item.widget; } + self.maybe_last_handler = item.widget; return; } } @@ -294,8 +294,8 @@ const MouseHandler = struct { self.maybe_last_handler = target.widget; try app.handleCommand(&ctx.cmds); } - self.maybe_last_handler = target.widget; } + self.maybe_last_handler = target.widget; return; } } @@ -317,8 +317,8 @@ const MouseHandler = struct { self.maybe_last_handler = item.widget; try app.handleCommand(&ctx.cmds); } - self.maybe_last_handler = item.widget; } + self.maybe_last_handler = item.widget; return; } }