diff options
| author | praschke <stel@comfy.monster> | 2023-12-06 15:08:43 +0000 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2024-01-01 23:02:55 -0600 |
| commit | 18d4ccdd383c198bc91d28641b45a342e558bd2f (patch) | |
| tree | b83f3da76c498838aa642ca8f3ce6bb09b5bd0f2 | |
| parent | 4af77f5ffb976749cfde7219763817b61e3c92dd (diff) | |
| download | river-18d4ccdd383c198bc91d28641b45a342e558bd2f.tar.gz river-18d4ccdd383c198bc91d28641b45a342e558bd2f.tar.xz | |
input-method: send text-input enter event after all leave events
| -rw-r--r-- | river/InputRelay.zig | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/river/InputRelay.zig b/river/InputRelay.zig index 59ae8bf..4e42e18 100644 --- a/river/InputRelay.zig +++ b/river/InputRelay.zig @@ -185,6 +185,8 @@ pub fn sendInputMethodState(self: *Self, wlr_text_input: *wlr.TextInputV3) void /// Update the current focused surface. Surface must belong to the same seat. pub fn setSurfaceFocus(self: *Self, wlr_surface: ?*wlr.Surface) void { + var new_text_input: ?*TextInput = null; + var it = self.text_inputs.first; while (it) |node| : (it = node.next) { const text_input = &node.data; @@ -203,14 +205,19 @@ pub fn setSurfaceFocus(self: *Self, wlr_surface: ?*wlr.Surface) void { continue; } } + if (wlr_surface) |surface| { if (text_input.wlr_text_input.resource.getClient() == surface.resource.getClient()) { - if (self.input_method != null) { - text_input.wlr_text_input.sendEnter(surface); - } else { - text_input.setPendingFocusedSurface(surface); - } + new_text_input = text_input; } } } + + if (new_text_input) |text_input| { + if (self.input_method != null) { + text_input.wlr_text_input.sendEnter(wlr_surface.?); + } else { + text_input.setPendingFocusedSurface(wlr_surface.?); + } + } } |
