Keyboard: don't add virtual keyboards to group
Also don't set their keymap, the client handles that. This is the first step towards fixing a regression with fcitx5.
This commit is contained in:
@ -160,7 +160,7 @@ pub fn reconfigureDevices(input_manager: *InputManager) void {
|
|||||||
fn handleNewInput(listener: *wl.Listener(*wlr.InputDevice), wlr_device: *wlr.InputDevice) void {
|
fn handleNewInput(listener: *wl.Listener(*wlr.InputDevice), wlr_device: *wlr.InputDevice) void {
|
||||||
const input_manager: *InputManager = @fieldParentPtr("new_input", listener);
|
const input_manager: *InputManager = @fieldParentPtr("new_input", listener);
|
||||||
|
|
||||||
input_manager.defaultSeat().addDevice(wlr_device);
|
input_manager.defaultSeat().addDevice(wlr_device, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleNewVirtualPointer(
|
fn handleNewVirtualPointer(
|
||||||
@ -178,7 +178,7 @@ fn handleNewVirtualPointer(
|
|||||||
log.debug("Ignoring output suggestion from virtual pointer", .{});
|
log.debug("Ignoring output suggestion from virtual pointer", .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
input_manager.defaultSeat().addDevice(&event.new_pointer.pointer.base);
|
input_manager.defaultSeat().addDevice(&event.new_pointer.pointer.base, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleNewVirtualKeyboard(
|
fn handleNewVirtualKeyboard(
|
||||||
@ -186,7 +186,7 @@ fn handleNewVirtualKeyboard(
|
|||||||
virtual_keyboard: *wlr.VirtualKeyboardV1,
|
virtual_keyboard: *wlr.VirtualKeyboardV1,
|
||||||
) void {
|
) void {
|
||||||
const seat: *Seat = @alignCast(@ptrCast(virtual_keyboard.seat.data));
|
const seat: *Seat = @alignCast(@ptrCast(virtual_keyboard.seat.data));
|
||||||
seat.addDevice(&virtual_keyboard.keyboard.base);
|
seat.addDevice(&virtual_keyboard.keyboard.base, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleNewConstraint(
|
fn handleNewConstraint(
|
||||||
|
@ -88,7 +88,7 @@ pressed: Pressed = .{},
|
|||||||
key: wl.Listener(*wlr.Keyboard.event.Key) = wl.Listener(*wlr.Keyboard.event.Key).init(handleKey),
|
key: wl.Listener(*wlr.Keyboard.event.Key) = wl.Listener(*wlr.Keyboard.event.Key).init(handleKey),
|
||||||
modifiers: wl.Listener(*wlr.Keyboard) = wl.Listener(*wlr.Keyboard).init(handleModifiers),
|
modifiers: wl.Listener(*wlr.Keyboard) = wl.Listener(*wlr.Keyboard).init(handleModifiers),
|
||||||
|
|
||||||
pub fn init(keyboard: *Keyboard, seat: *Seat, wlr_device: *wlr.InputDevice) !void {
|
pub fn init(keyboard: *Keyboard, seat: *Seat, wlr_device: *wlr.InputDevice, virtual: bool) !void {
|
||||||
keyboard.* = .{
|
keyboard.* = .{
|
||||||
.device = undefined,
|
.device = undefined,
|
||||||
};
|
};
|
||||||
@ -98,6 +98,7 @@ pub fn init(keyboard: *Keyboard, seat: *Seat, wlr_device: *wlr.InputDevice) !voi
|
|||||||
const wlr_keyboard = keyboard.device.wlr_device.toKeyboard();
|
const wlr_keyboard = keyboard.device.wlr_device.toKeyboard();
|
||||||
wlr_keyboard.data = keyboard;
|
wlr_keyboard.data = keyboard;
|
||||||
|
|
||||||
|
if (!virtual) {
|
||||||
// wlroots will log a more detailed error if this fails.
|
// wlroots will log a more detailed error if this fails.
|
||||||
if (!wlr_keyboard.setKeymap(server.config.keymap)) return error.OutOfMemory;
|
if (!wlr_keyboard.setKeymap(server.config.keymap)) return error.OutOfMemory;
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ pub fn init(keyboard: *Keyboard, seat: *Seat, wlr_device: *wlr.InputDevice) !voi
|
|||||||
// wlroots will log an error on failure
|
// wlroots will log an error on failure
|
||||||
_ = seat.keyboard_group.addKeyboard(wlr_keyboard);
|
_ = seat.keyboard_group.addKeyboard(wlr_keyboard);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wlr_keyboard.setRepeatInfo(server.config.repeat_rate, server.config.repeat_delay);
|
wlr_keyboard.setRepeatInfo(server.config.repeat_rate, server.config.repeat_delay);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ pub fn init(seat: *Seat, name: [*:0]const u8) !void {
|
|||||||
try seat.cursor.init(seat);
|
try seat.cursor.init(seat);
|
||||||
seat.relay.init();
|
seat.relay.init();
|
||||||
|
|
||||||
try seat.tryAddDevice(&seat.keyboard_group.keyboard.base);
|
try seat.tryAddDevice(&seat.keyboard_group.keyboard.base, false);
|
||||||
|
|
||||||
seat.wlr_seat.events.request_set_selection.add(&seat.request_set_selection);
|
seat.wlr_seat.events.request_set_selection.add(&seat.request_set_selection);
|
||||||
seat.wlr_seat.events.request_start_drag.add(&seat.request_start_drag);
|
seat.wlr_seat.events.request_start_drag.add(&seat.request_start_drag);
|
||||||
@ -480,19 +480,19 @@ fn handleMappingRepeatTimeout(seat: *Seat) c_int {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addDevice(seat: *Seat, wlr_device: *wlr.InputDevice) void {
|
pub fn addDevice(seat: *Seat, wlr_device: *wlr.InputDevice, virtual: bool) void {
|
||||||
seat.tryAddDevice(wlr_device) catch |err| switch (err) {
|
seat.tryAddDevice(wlr_device, virtual) catch |err| switch (err) {
|
||||||
error.OutOfMemory => log.err("out of memory", .{}),
|
error.OutOfMemory => log.err("out of memory", .{}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tryAddDevice(seat: *Seat, wlr_device: *wlr.InputDevice) !void {
|
fn tryAddDevice(seat: *Seat, wlr_device: *wlr.InputDevice, virtual: bool) !void {
|
||||||
switch (wlr_device.type) {
|
switch (wlr_device.type) {
|
||||||
.keyboard => {
|
.keyboard => {
|
||||||
const keyboard = try util.gpa.create(Keyboard);
|
const keyboard = try util.gpa.create(Keyboard);
|
||||||
errdefer util.gpa.destroy(keyboard);
|
errdefer util.gpa.destroy(keyboard);
|
||||||
|
|
||||||
try keyboard.init(seat, wlr_device);
|
try keyboard.init(seat, wlr_device, virtual);
|
||||||
|
|
||||||
seat.wlr_seat.setKeyboard(keyboard.device.wlr_device.toKeyboard());
|
seat.wlr_seat.setKeyboard(keyboard.device.wlr_device.toKeyboard());
|
||||||
if (seat.wlr_seat.keyboard_state.focused_surface) |wlr_surface| {
|
if (seat.wlr_seat.keyboard_state.focused_surface) |wlr_surface| {
|
||||||
|
Reference in New Issue
Block a user