Make Seat a toplevel struct

This commit is contained in:
Isaac Freund 2020-05-02 16:35:15 +02:00
parent 4c97531860
commit 7ddcebbbab
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
19 changed files with 236 additions and 238 deletions

View file

@ -1,4 +1,4 @@
const Seat = @import("seat.zig").Seat; const Seat = @import("seat.zig");
pub const Direction = enum { pub const Direction = enum {
Next, Next,

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Close the focused view, if any. /// Close the focused view, if any.
pub fn close_view(seat: *Seat, arg: Arg) void { pub fn close_view(seat: *Seat, arg: Arg) void {

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Exit the compositor, terminating the wayland session. /// Exit the compositor, terminating the wayland session.
pub fn exitCompositor(seat: *Seat, arg: Arg) void { pub fn exitCompositor(seat: *Seat, arg: Arg) void {

View file

@ -3,7 +3,7 @@ const std = @import("std");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Output = @import("../output.zig").Output; const Output = @import("../output.zig").Output;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Focus either the next or the previous output, depending on the bool passed. /// Focus either the next or the previous output, depending on the bool passed.
/// Does nothing if there is only one output. /// Does nothing if there is only one output.

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Switch focus to the passed tags. /// Switch focus to the passed tags.
pub fn focusTags(seat: *Seat, arg: Arg) void { pub fn focusTags(seat: *Seat, arg: Arg) void {

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
const View = @import("../view.zig").View; const View = @import("../view.zig").View;
const ViewStack = @import("../view_stack.zig").ViewStack; const ViewStack = @import("../view_stack.zig").ViewStack;

View file

@ -2,7 +2,7 @@ const c = @import("../c.zig");
const std = @import("std"); const std = @import("std");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Modify the number of master views /// Modify the number of master views
pub fn modifyMasterCount(seat: *Seat, arg: Arg) void { pub fn modifyMasterCount(seat: *Seat, arg: Arg) void {

View file

@ -2,7 +2,7 @@ const c = @import("../c.zig");
const std = @import("std"); const std = @import("std");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Modify the percent of the width of the screen that the master views occupy. /// Modify the percent of the width of the screen that the master views occupy.
pub fn modifyMasterFactor(seat: *Seat, arg: Arg) void { pub fn modifyMasterFactor(seat: *Seat, arg: Arg) void {

View file

@ -3,7 +3,7 @@ const std = @import("std");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Output = @import("../output.zig").Output; const Output = @import("../output.zig").Output;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Send the focused view to the the next or the previous output, depending on /// Send the focused view to the the next or the previous output, depending on
/// the bool passed. Does nothing if there is only one output. /// the bool passed. Does nothing if there is only one output.

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Set the tags of the focused view. /// Set the tags of the focused view.
pub fn setViewTags(seat: *Seat, arg: Arg) void { pub fn setViewTags(seat: *Seat, arg: Arg) void {

View file

@ -3,7 +3,7 @@ const std = @import("std");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Log = @import("../log.zig").Log; const Log = @import("../log.zig").Log;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Spawn a program. /// Spawn a program.
pub fn spawn(seat: *Seat, arg: Arg) void { pub fn spawn(seat: *Seat, arg: Arg) void {

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Make the focused view float or stop floating, depending on its current /// Make the focused view float or stop floating, depending on its current
/// state. /// state.

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Toggle focus of the passsed tags. /// Toggle focus of the passsed tags.
pub fn toggleTags(seat: *Seat, arg: Arg) void { pub fn toggleTags(seat: *Seat, arg: Arg) void {

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
/// Toggle the passed tags of the focused view /// Toggle the passed tags of the focused view
pub fn toggleViewTags(seat: *Seat, arg: Arg) void { pub fn toggleViewTags(seat: *Seat, arg: Arg) void {

View file

@ -1,7 +1,7 @@
const c = @import("../c.zig"); const c = @import("../c.zig");
const Arg = @import("../command.zig").Arg; const Arg = @import("../command.zig").Arg;
const Seat = @import("../seat.zig").Seat; const Seat = @import("../seat.zig");
const View = @import("../view.zig").View; const View = @import("../view.zig").View;
const ViewStack = @import("../view_stack.zig").ViewStack; const ViewStack = @import("../view_stack.zig").ViewStack;

View file

@ -4,7 +4,7 @@ const c = @import("c.zig");
const LayerSurface = @import("layer_surface.zig").LayerSurface; const LayerSurface = @import("layer_surface.zig").LayerSurface;
const Log = @import("log.zig").Log; const Log = @import("log.zig").Log;
const Output = @import("output.zig").Output; const Output = @import("output.zig").Output;
const Seat = @import("seat.zig").Seat; const Seat = @import("seat.zig");
const View = @import("view.zig").View; const View = @import("view.zig").View;
const ViewStack = @import("view_stack.zig").ViewStack; const ViewStack = @import("view_stack.zig").ViewStack;

View file

@ -5,7 +5,7 @@ const std = @import("std");
const c = @import("c.zig"); const c = @import("c.zig");
const Log = @import("log.zig").Log; const Log = @import("log.zig").Log;
const Seat = @import("seat.zig").Seat; const Seat = @import("seat.zig");
const Server = @import("server.zig"); const Server = @import("server.zig");
const default_seat_name = "default"; const default_seat_name = "default";

View file

@ -2,7 +2,7 @@ const std = @import("std");
const c = @import("c.zig"); const c = @import("c.zig");
const Log = @import("log.zig").Log; const Log = @import("log.zig").Log;
const Seat = @import("seat.zig").Seat; const Seat = @import("seat.zig");
pub const Keyboard = struct { pub const Keyboard = struct {
const Self = @This(); const Self = @This();

View file

@ -1,3 +1,5 @@
const Self = @This();
const c = @import("c.zig"); const c = @import("c.zig");
const std = @import("std"); const std = @import("std");
@ -15,269 +17,265 @@ const FocusTarget = union(enum) {
none: void, none: void,
}; };
pub const Seat = struct { input_manager: *InputManager,
const Self = @This(); wlr_seat: *c.wlr_seat,
input_manager: *InputManager, /// Multiple mice are handled by the same Cursor
wlr_seat: *c.wlr_seat, cursor: Cursor,
/// Multiple mice are handled by the same Cursor /// Mulitple keyboards are handled separately
cursor: Cursor, keyboards: std.TailQueue(Keyboard),
/// Mulitple keyboards are handled separately /// Currently focused output, may be the noop output if no
keyboards: std.TailQueue(Keyboard), focused_output: *Output,
/// Currently focused output, may be the noop output if no /// Currently focused view if any
focused_output: *Output, focused_view: ?*View,
/// Currently focused view if any /// Stack of views in most recently focused order
focused_view: ?*View, /// If there is a currently focused view, it is on top.
focus_stack: ViewStack(*View),
/// Stack of views in most recently focused order /// Currently focused layer, if any. While this is non-null, no views may
/// If there is a currently focused view, it is on top. /// recieve focus.
focus_stack: ViewStack(*View), focused_layer: ?*LayerSurface,
/// Currently focused layer, if any. While this is non-null, no views may listen_request_set_selection: c.wl_listener,
/// recieve focus.
focused_layer: ?*LayerSurface,
listen_request_set_selection: c.wl_listener, pub fn init(self: *Self, input_manager: *InputManager, name: []const u8) !void {
self.input_manager = input_manager;
pub fn init(self: *Self, input_manager: *InputManager, name: []const u8) !void { // This will be automatically destroyed when the display is destroyed
self.input_manager = input_manager; self.wlr_seat = c.wlr_seat_create(input_manager.server.wl_display, name.ptr) orelse
return error.CantCreateWlrSeat;
// This will be automatically destroyed when the display is destroyed try self.cursor.init(self);
self.wlr_seat = c.wlr_seat_create(input_manager.server.wl_display, name.ptr) orelse errdefer self.cursor.destroy();
return error.CantCreateWlrSeat;
try self.cursor.init(self); self.keyboards = std.TailQueue(Keyboard).init();
errdefer self.cursor.destroy();
self.keyboards = std.TailQueue(Keyboard).init(); self.focused_output = &self.input_manager.server.root.noop_output;
self.focused_output = &self.input_manager.server.root.noop_output; self.focused_view = null;
self.focused_view = null; self.focus_stack.init();
self.focus_stack.init(); self.focused_layer = null;
self.focused_layer = null; self.listen_request_set_selection.notify = handleRequestSetSelection;
c.wl_signal_add(&self.wlr_seat.events.request_set_selection, &self.listen_request_set_selection);
}
self.listen_request_set_selection.notify = handleRequestSetSelection; pub fn deinit(self: *Self) void {
c.wl_signal_add(&self.wlr_seat.events.request_set_selection, &self.listen_request_set_selection); self.cursor.deinit();
while (self.keyboards.pop()) |node| {
self.input_manager.server.allocator.destroy(node);
} }
pub fn deinit(self: *Self) void { while (self.focus_stack.first) |node| {
self.cursor.deinit(); self.focus_stack.remove(node);
self.input_manager.server.allocator.destroy(node);
}
}
while (self.keyboards.pop()) |node| { /// Set the current focus. If a visible view is passed it will be focused.
self.input_manager.server.allocator.destroy(node); /// If null is passed, the first visible view in the focus stack will be focused.
} pub fn focus(self: *Self, _view: ?*View) void {
var view = _view;
while (self.focus_stack.first) |node| { // While a layer surface is focused, views may not recieve focus
self.focus_stack.remove(node); if (self.focused_layer != null) {
self.input_manager.server.allocator.destroy(node); std.debug.assert(self.focused_view == null);
} return;
} }
/// Set the current focus. If a visible view is passed it will be focused. // If view is null or not currently visible
/// If null is passed, the first visible view in the focus stack will be focused. if (if (view) |v|
pub fn focus(self: *Self, _view: ?*View) void { v.output != self.focused_output or
var view = _view; v.current_tags & self.focused_output.current_focused_tags == 0
else
// While a layer surface is focused, views may not recieve focus true) {
if (self.focused_layer != null) { // Set view to the first currently visible view on in the focus stack if any
std.debug.assert(self.focused_view == null); var it = ViewStack(*View).iterator(
return; self.focus_stack.first,
} self.focused_output.current_focused_tags,
);
// If view is null or not currently visible view = while (it.next()) |node| {
if (if (view) |v| if (node.view.output == self.focused_output) {
v.output != self.focused_output or break node.view;
v.current_tags & self.focused_output.current_focused_tags == 0
else
true) {
// Set view to the first currently visible view on in the focus stack if any
var it = ViewStack(*View).iterator(
self.focus_stack.first,
self.focused_output.current_focused_tags,
);
view = while (it.next()) |node| {
if (node.view.output == self.focused_output) {
break node.view;
}
} else null;
}
if (view) |view_to_focus| {
// Find or allocate a new node in the focus stack for the target view
var it = self.focus_stack.first;
while (it) |node| : (it = node.next) {
// If the view is found, move it to the top of the stack
if (node.view == view_to_focus) {
const new_focus_node = self.focus_stack.remove(node);
self.focus_stack.push(node);
break;
}
} else {
// The view is not in the stack, so allocate a new node and prepend it
const new_focus_node = self.input_manager.server.allocator.create(
ViewStack(*View).Node,
) catch unreachable;
new_focus_node.view = view_to_focus;
self.focus_stack.push(new_focus_node);
} }
} else null;
// Focus the target view
self.setFocusRaw(.{ .view = view_to_focus });
} else {
// Otherwise clear the focus
self.setFocusRaw(.{ .none = {} });
}
} }
/// Switch focus to the target, handling unfocus and input inhibition if (view) |view_to_focus| {
/// properly. This should only be called directly if dealing with layers. // Find or allocate a new node in the focus stack for the target view
pub fn setFocusRaw(self: *Self, focus_target: FocusTarget) void {
// If the target is already focused, do nothing
if (switch (focus_target) {
.view => |target_view| target_view == self.focused_view,
.layer => |target_layer| target_layer == self.focused_layer,
.none => false,
}) {
return;
}
// Obtain the target wlr_surface
const target_wlr_surface = switch (focus_target) {
.view => |target_view| target_view.wlr_surface.?,
.layer => |target_layer| target_layer.wlr_layer_surface.surface.?,
.none => null,
};
// If input is not allowed on the target surface (e.g. due to an active
// input inhibitor) do not set focus. If there is no target surface we
// still clear the focus.
if (if (target_wlr_surface) |wlr_surface|
self.input_manager.inputAllowed(wlr_surface)
else
true) {
// First clear the current focus
if (self.focused_view) |current_focus| {
std.debug.assert(self.focused_layer == null);
current_focus.setFocused(false);
self.focused_view = null;
}
if (self.focused_layer) |current_focus| {
std.debug.assert(self.focused_view == null);
self.focused_layer = null;
}
c.wlr_seat_keyboard_clear_focus(self.wlr_seat);
// Set the new focus
switch (focus_target) {
.view => |target_view| {
std.debug.assert(self.focused_output == target_view.output);
target_view.setFocused(true);
self.focused_view = target_view;
},
.layer => |target_layer| blk: {
std.debug.assert(self.focused_output == target_layer.output);
self.focused_layer = target_layer;
},
.none => {},
}
// Tell wlroots to send the new keyboard focus if we have a target
if (target_wlr_surface) |wlr_surface| {
const keyboard: *c.wlr_keyboard = c.wlr_seat_get_keyboard(self.wlr_seat);
c.wlr_seat_keyboard_notify_enter(
self.wlr_seat,
wlr_surface,
&keyboard.keycodes,
keyboard.num_keycodes,
&keyboard.modifiers,
);
}
}
}
/// Handle the unmapping of a view, removing it from the focus stack and
/// setting the focus if needed.
pub fn handleViewUnmap(self: *Self, view: *View) void {
// Remove the node from the focus stack and destroy it.
var it = self.focus_stack.first; var it = self.focus_stack.first;
while (it) |node| : (it = node.next) { while (it) |node| : (it = node.next) {
if (node.view == view) { // If the view is found, move it to the top of the stack
self.focus_stack.remove(node); if (node.view == view_to_focus) {
self.input_manager.server.allocator.destroy(node); const new_focus_node = self.focus_stack.remove(node);
self.focus_stack.push(node);
break; break;
} }
} else {
// The view is not in the stack, so allocate a new node and prepend it
const new_focus_node = self.input_manager.server.allocator.create(
ViewStack(*View).Node,
) catch unreachable;
new_focus_node.view = view_to_focus;
self.focus_stack.push(new_focus_node);
} }
// If the unmapped view is focused, choose a new focus // Focus the target view
self.setFocusRaw(.{ .view = view_to_focus });
} else {
// Otherwise clear the focus
self.setFocusRaw(.{ .none = {} });
}
}
/// Switch focus to the target, handling unfocus and input inhibition
/// properly. This should only be called directly if dealing with layers.
pub fn setFocusRaw(self: *Self, focus_target: FocusTarget) void {
// If the target is already focused, do nothing
if (switch (focus_target) {
.view => |target_view| target_view == self.focused_view,
.layer => |target_layer| target_layer == self.focused_layer,
.none => false,
}) {
return;
}
// Obtain the target wlr_surface
const target_wlr_surface = switch (focus_target) {
.view => |target_view| target_view.wlr_surface.?,
.layer => |target_layer| target_layer.wlr_layer_surface.surface.?,
.none => null,
};
// If input is not allowed on the target surface (e.g. due to an active
// input inhibitor) do not set focus. If there is no target surface we
// still clear the focus.
if (if (target_wlr_surface) |wlr_surface|
self.input_manager.inputAllowed(wlr_surface)
else
true) {
// First clear the current focus
if (self.focused_view) |current_focus| { if (self.focused_view) |current_focus| {
if (current_focus == view) { std.debug.assert(self.focused_layer == null);
self.focus(null); current_focus.setFocused(false);
} self.focused_view = null;
}
if (self.focused_layer) |current_focus| {
std.debug.assert(self.focused_view == null);
self.focused_layer = null;
}
c.wlr_seat_keyboard_clear_focus(self.wlr_seat);
// Set the new focus
switch (focus_target) {
.view => |target_view| {
std.debug.assert(self.focused_output == target_view.output);
target_view.setFocused(true);
self.focused_view = target_view;
},
.layer => |target_layer| blk: {
std.debug.assert(self.focused_output == target_layer.output);
self.focused_layer = target_layer;
},
.none => {},
}
// Tell wlroots to send the new keyboard focus if we have a target
if (target_wlr_surface) |wlr_surface| {
const keyboard: *c.wlr_keyboard = c.wlr_seat_get_keyboard(self.wlr_seat);
c.wlr_seat_keyboard_notify_enter(
self.wlr_seat,
wlr_surface,
&keyboard.keycodes,
keyboard.num_keycodes,
&keyboard.modifiers,
);
}
}
}
/// Handle the unmapping of a view, removing it from the focus stack and
/// setting the focus if needed.
pub fn handleViewUnmap(self: *Self, view: *View) void {
// Remove the node from the focus stack and destroy it.
var it = self.focus_stack.first;
while (it) |node| : (it = node.next) {
if (node.view == view) {
self.focus_stack.remove(node);
self.input_manager.server.allocator.destroy(node);
break;
} }
} }
/// Handle any user-defined keybinding for the passed keysym and modifiers // If the unmapped view is focused, choose a new focus
/// Returns true if the key was handled if (self.focused_view) |current_focus| {
pub fn handleKeybinding(self: *Self, keysym: c.xkb_keysym_t, modifiers: u32) bool { if (current_focus == view) {
for (self.input_manager.server.config.keybinds.items) |keybind| { self.focus(null);
if (modifiers == keybind.modifiers and keysym == keybind.keysym) {
// Execute the bound command
keybind.command(self, keybind.arg);
return true;
}
} }
return false;
} }
}
/// Add a newly created input device to the seat and update the reported /// Handle any user-defined keybinding for the passed keysym and modifiers
/// capabilities. /// Returns true if the key was handled
pub fn addDevice(self: *Self, device: *c.wlr_input_device) !void { pub fn handleKeybinding(self: *Self, keysym: c.xkb_keysym_t, modifiers: u32) bool {
switch (device.type) { for (self.input_manager.server.config.keybinds.items) |keybind| {
.WLR_INPUT_DEVICE_KEYBOARD => self.addKeyboard(device) catch unreachable, if (modifiers == keybind.modifiers and keysym == keybind.keysym) {
.WLR_INPUT_DEVICE_POINTER => self.addPointer(device), // Execute the bound command
else => {}, keybind.command(self, keybind.arg);
return true;
} }
}
return false;
}
// We need to let the wlr_seat know what our capabilities are, which is /// Add a newly created input device to the seat and update the reported
// communiciated to the client. We always have a cursor, even if /// capabilities.
// there are no pointer devices, so we always include that capability. pub fn addDevice(self: *Self, device: *c.wlr_input_device) !void {
var caps = @intCast(u32, c.WL_SEAT_CAPABILITY_POINTER); switch (device.type) {
// if list not empty .WLR_INPUT_DEVICE_KEYBOARD => self.addKeyboard(device) catch unreachable,
if (self.keyboards.len > 0) { .WLR_INPUT_DEVICE_POINTER => self.addPointer(device),
caps |= @intCast(u32, c.WL_SEAT_CAPABILITY_KEYBOARD); else => {},
}
c.wlr_seat_set_capabilities(self.wlr_seat, caps);
} }
fn addKeyboard(self: *Self, device: *c.wlr_input_device) !void { // We need to let the wlr_seat know what our capabilities are, which is
c.wlr_seat_set_keyboard(self.wlr_seat, device); // communiciated to the client. We always have a cursor, even if
// there are no pointer devices, so we always include that capability.
const node = try self.keyboards.allocateNode(self.input_manager.server.allocator); var caps = @intCast(u32, c.WL_SEAT_CAPABILITY_POINTER);
try node.data.init(self, device); // if list not empty
self.keyboards.append(node); if (self.keyboards.len > 0) {
caps |= @intCast(u32, c.WL_SEAT_CAPABILITY_KEYBOARD);
} }
c.wlr_seat_set_capabilities(self.wlr_seat, caps);
}
fn addPointer(self: Self, device: *c.struct_wlr_input_device) void { fn addKeyboard(self: *Self, device: *c.wlr_input_device) !void {
// We don't do anything special with pointers. All of our pointer handling c.wlr_seat_set_keyboard(self.wlr_seat, device);
// is proxied through wlr_cursor. On another compositor, you might take this
// opportunity to do libinput configuration on the device to set
// acceleration, etc.
c.wlr_cursor_attach_input_device(self.cursor.wlr_cursor, device);
}
fn handleRequestSetSelection(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void { const node = try self.keyboards.allocateNode(self.input_manager.server.allocator);
const self = @fieldParentPtr(Self, "listen_request_set_selection", listener.?); try node.data.init(self, device);
const event = @ptrCast( self.keyboards.append(node);
*c.wlr_seat_request_set_selection_event, }
@alignCast(@alignOf(*c.wlr_seat_request_set_selection_event), data),
); fn addPointer(self: Self, device: *c.struct_wlr_input_device) void {
c.wlr_seat_set_selection(self.wlr_seat, event.source, event.serial); // We don't do anything special with pointers. All of our pointer handling
} // is proxied through wlr_cursor. On another compositor, you might take this
}; // opportunity to do libinput configuration on the device to set
// acceleration, etc.
c.wlr_cursor_attach_input_device(self.cursor.wlr_cursor, device);
}
fn handleRequestSetSelection(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
const self = @fieldParentPtr(Self, "listen_request_set_selection", listener.?);
const event = @ptrCast(
*c.wlr_seat_request_set_selection_event,
@alignCast(@alignOf(*c.wlr_seat_request_set_selection_event), data),
);
c.wlr_seat_set_selection(self.wlr_seat, event.source, event.serial);
}