aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2024-01-01 09:31:15 -0600
committerIsaac Freund <mail@isaacfreund.com>2024-01-01 23:02:55 -0600
commit40920c7818af55f6c405ec1e6d39dd4d0eaafd37 (patch)
tree53e7eab52fab931b736c24fcf50214ceadeb13e4
parent6f311af3b3b571acf32bc390d892a6adcc8ed354 (diff)
downloadriver-40920c7818af55f6c405ec1e6d39dd4d0eaafd37.tar.gz
river-40920c7818af55f6c405ec1e6d39dd4d0eaafd37.tar.xz
TextInput: fix consecutive enable requests
The wording of the text-input-v3 protocol is quite confusing here but I'm pretty sure this is now correct.
-rw-r--r--river/TextInput.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/river/TextInput.zig b/river/TextInput.zig
index 56661b2..2b6af49 100644
--- a/river/TextInput.zig
+++ b/river/TextInput.zig
@@ -66,9 +66,14 @@ 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 (seat.relay.text_input != null) {
- log.err("client requested to enable more than one text input on a single seat, 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.
+ if (seat.relay.text_input) |currently_enabled| {
+ if (text_input != currently_enabled) {
+ log.err("client requested to enable more than one text input on a single seat, ignoring request", .{});
+ return;
+ }
}
seat.relay.text_input = text_input;