river: Implement input_method and text_input

This commit is contained in:
praschke
2023-07-11 13:22:05 +01:00
committed by Isaac Freund
parent 3aba3abbcd
commit 2abab1e9c7
6 changed files with 456 additions and 3 deletions

View File

@ -31,6 +31,7 @@ const Cursor = @import("Cursor.zig");
const DragIcon = @import("DragIcon.zig");
const InputDevice = @import("InputDevice.zig");
const InputManager = @import("InputManager.zig");
const InputRelay = @import("InputRelay.zig");
const Keyboard = @import("Keyboard.zig");
const KeyboardGroup = @import("KeyboardGroup.zig");
const KeycodeSet = @import("KeycodeSet.zig");
@ -88,6 +89,9 @@ drag: enum {
touch,
} = .none,
/// Relay for communication between text_input and input_method.
relay: InputRelay = undefined,
request_set_selection: wl.Listener(*wlr.Seat.event.RequestSetSelection) =
wl.Listener(*wlr.Seat.event.RequestSetSelection).init(handleRequestSetSelection),
request_start_drag: wl.Listener(*wlr.Seat.event.RequestStartDrag) =
@ -110,6 +114,7 @@ pub fn init(self: *Self, name: [*:0]const u8) !void {
self.wlr_seat.data = @intFromPtr(self);
try self.cursor.init(self);
self.relay.init(self);
self.wlr_seat.events.request_set_selection.add(&self.request_set_selection);
self.wlr_seat.events.request_start_drag.add(&self.request_start_drag);
@ -260,6 +265,7 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
}
self.keyboardEnterOrLeave(target_surface);
self.relay.setSurfaceFocus(target_surface);
if (target_surface) |surface| {
const pointer_constraints = server.input_manager.pointer_constraints;