TextInput: ignore enable requests without focus

This commit is contained in:
Isaac Freund 2024-05-15 12:21:22 +02:00
parent ba6023e38a
commit b35a40b9df
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -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.