aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpraschke <stel@comfy.monster>2023-12-21 21:29:24 +0000
committerIsaac Freund <mail@isaacfreund.com>2024-01-01 23:02:55 -0600
commit8f497a35700081ea664a38c30e8c4ef4abefb697 (patch)
treefc92111fcd288c53f0a3b5f17a37810ac6fd800d
parent18d4ccdd383c198bc91d28641b45a342e558bd2f (diff)
downloadriver-8f497a35700081ea664a38c30e8c4ef4abefb697.tar.gz
river-8f497a35700081ea664a38c30e8c4ef4abefb697.tar.xz
input-method: check that the input method is active when committing
-rw-r--r--river/InputRelay.zig8
-rw-r--r--river/TextInput.zig2
2 files changed, 7 insertions, 3 deletions
diff --git a/river/InputRelay.zig b/river/InputRelay.zig
index 4e42e18..bdd1022 100644
--- a/river/InputRelay.zig
+++ b/river/InputRelay.zig
@@ -60,10 +60,11 @@ fn handleInputMethodCommit(
input_method: *wlr.InputMethodV2,
) void {
const self = @fieldParentPtr(Self, "input_method_commit", listener);
- const text_input = self.getFocusedTextInput() orelse return;
-
assert(input_method == self.input_method);
+ if (!input_method.client_active) return;
+ const text_input = self.getFocusedTextInput() orelse return;
+
if (input_method.current.preedit.text) |preedit_text| {
text_input.wlr_text_input.sendPreeditString(
preedit_text,
@@ -159,6 +160,7 @@ pub fn sendInputMethodState(self: *Self, wlr_text_input: *wlr.TextInputV3) void
const input_method = self.input_method orelse return;
// TODO: only send each of those if they were modified
+ // after activation, all supported features must be sent
if (wlr_text_input.active_features.surrounding_text) {
if (wlr_text_input.current.surrounding.text) |text| {
@@ -201,7 +203,7 @@ pub fn setSurfaceFocus(self: *Self, wlr_surface: ?*wlr.Surface) void {
text_input.relay.disableTextInput(text_input);
text_input.wlr_text_input.sendLeave();
} else {
- log.debug("IM relay setSurfaceFocus already focused", .{});
+ log.debug("input relay setSurfaceFocus already focused", .{});
continue;
}
}
diff --git a/river/TextInput.zig b/river/TextInput.zig
index bfd341b..2208184 100644
--- a/river/TextInput.zig
+++ b/river/TextInput.zig
@@ -70,6 +70,8 @@ fn handleEnable(listener: *wl.Listener(*wlr.TextInputV3), _: *wlr.TextInputV3) v
return;
}
+ // must send surrounding_text if supported
+ // must send content_type if supported
self.relay.sendInputMethodState(self.wlr_text_input);
}