git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit16a036409283f146e77ef1104070ff9c6985505e
parent83b397f289
authorIsaac Freund <[email protected]>
date2024-05-15 12:21
TextInput: ignore enable requests without focus

 river/TextInput.zig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/river/TextInput.zig b/river/TextInput.zig
index 2b6af49..d513758 100644
--- a/river/TextInput.zig
+++ b/river/TextInput.zig
@@ -66,6 +66,11 @@ fn handleEnable(listener: *wl.Listener(*wlr.TextInputV3), _: *wlr.TextInputV3) v
     const text_input = @fieldParentPtr(TextInput, "enable", listener);
     const seat: *Seat = @ptrFromInt(text_input.wlr_text_input.seat.data);
 
+    if (text_input.wlr_text_input.focused_surface == null) {
+        log.err("client requested to enable text input without focus, ignoring request", .{});
+        return;
+    }
+
     // The same text_input object may be enabled multiple times consecutively
     // without first disabling it. Enabling a different text input object without
     // first disabling the current one is disallowed by the protocol however.