input-method: check that the input method is active when committing
This commit is contained in:
parent
18d4ccdd38
commit
8f497a3570
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user