river: remove Seat.input_manager

This is no longer needed as server is global.
This commit is contained in:
Isaac Freund 2021-05-13 15:13:17 +02:00
parent 50cdcf3ee4
commit c8b1017923
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
6 changed files with 15 additions and 13 deletions

View file

@ -154,7 +154,7 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
// If this cursor belongs to the default seat, set the xcursor environment
// variables and the xwayland cursor theme.
if (self.seat == self.seat.input_manager.defaultSeat()) {
if (self.seat == server.input_manager.defaultSeat()) {
const size_str = try std.fmt.allocPrint0(util.gpa, "{}", .{size});
defer util.gpa.free(size_str);
if (c.setenv("XCURSOR_SIZE", size_str, 1) < 0) return error.OutOfMemory;
@ -586,7 +586,7 @@ fn leaveMode(self: *Self, event: *wlr.Pointer.event.Button) void {
}
fn processMotion(self: *Self, device: *wlr.InputDevice, time: u32, delta_x: f64, delta_y: f64, unaccel_dx: f64, unaccel_dy: f64) void {
self.seat.input_manager.relative_pointer_manager.sendRelativeMotion(
server.input_manager.relative_pointer_manager.sendRelativeMotion(
self.seat.wlr_seat,
@as(u64, time) * 1000,
delta_x,
@ -674,7 +674,7 @@ fn passthrough(self: *Self, time: u32) void {
// If input is allowed on the surface, send pointer enter and motion
// events. Note that wlroots won't actually send an enter event if
// the surface has already been entered.
if (self.seat.input_manager.inputAllowed(surface)) {
if (server.input_manager.inputAllowed(surface)) {
// The focus change must be checked before sending enter events
const focus_change = self.seat.wlr_seat.pointer_state.focused_surface != surface;

View file

@ -75,7 +75,7 @@ pub fn init(self: *Self) !void {
};
self.seats.prepend(seat_node);
try seat_node.data.init(self, default_seat_name);
try seat_node.data.init(default_seat_name);
if (build_options.xwayland) server.xwayland.setSeat(self.defaultSeat().wlr_seat);

View file

@ -46,7 +46,6 @@ const FocusTarget = union(enum) {
none: void,
};
input_manager: *InputManager,
wlr_seat: *wlr.Seat,
/// Multiple mice are handled by the same Cursor
@ -85,9 +84,8 @@ request_set_primary_selection: wl.Listener(*wlr.Seat.event.RequestSetPrimarySele
wl.Listener(*wlr.Seat.event.RequestSetPrimarySelection).init(handleRequestSetPrimarySelection),
// zig fmt: on
pub fn init(self: *Self, input_manager: *InputManager, name: [*:0]const u8) !void {
pub fn init(self: *Self, name: [*:0]const u8) !void {
self.* = .{
.input_manager = input_manager,
// This will be automatically destroyed when the display is destroyed
.wlr_seat = try wlr.Seat.create(server.wl_server, name),
.focused_output = &server.root.noop_output,
@ -194,7 +192,7 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
// 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_surface) |wlr_surface| self.input_manager.inputAllowed(wlr_surface) else true) {
if (if (target_surface) |wlr_surface| server.input_manager.inputAllowed(wlr_surface) else true) {
// First clear the current focus
if (self.focused == .view) {
self.focused.view.pending.focus -= 1;
@ -238,7 +236,7 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
self.wlr_seat.keyboardNotifyEnter(wlr_surface, null, 0, null);
}
if (self.input_manager.pointer_constraints.constraintForSurface(wlr_surface, self.wlr_seat)) |constraint| {
if (server.input_manager.pointer_constraints.constraintForSurface(wlr_surface, self.wlr_seat)) |constraint| {
@intToPtr(*PointerConstraint, constraint.data).setAsActive();
} else if (self.cursor.constraint) |constraint| {
PointerConstraint.warpToHint(&self.cursor);
@ -275,7 +273,7 @@ pub fn focusOutput(self: *Self, output: *Output) void {
}
pub fn handleActivity(self: Self) void {
self.input_manager.idle.notifyActivity(self.wlr_seat);
server.input_manager.idle.notifyActivity(self.wlr_seat);
}
/// Handle the unmapping of a view, removing it from the focus stack and

View file

@ -156,7 +156,7 @@ fn getView(seat: *Seat) ?*View {
if (view.pending.fullscreen) return null;
// Do not touch views which are the target of a cursor action
if (seat.input_manager.isCursorActionTarget(view)) return null;
if (server.input_manager.isCursorActionTarget(view)) return null;
return view;
}

View file

@ -17,6 +17,8 @@
const std = @import("std");
const server = &@import("../main.zig").server;
const Error = @import("../command.zig").Error;
const Seat = @import("../Seat.zig");
@ -43,7 +45,7 @@ pub fn toggleFloat(
if (view.pending.fullscreen) return;
// Don't modify views which are the target of a cursor action
if (seat.input_manager.isCursorActionTarget(view)) return;
if (server.input_manager.isCursorActionTarget(view)) return;
view.pending.float = !view.pending.float;
view.applyPending();

View file

@ -17,6 +17,8 @@
const std = @import("std");
const server = &@import("../main.zig").server;
const Box = @import("../Box.zig");
const Error = @import("../command.zig").Error;
const Seat = @import("../Seat.zig");
@ -34,7 +36,7 @@ pub fn toggleFullscreen(
const view = seat.focused.view;
// Don't modify views which are the target of a cursor action
if (seat.input_manager.isCursorActionTarget(view)) return;
if (server.input_manager.isCursorActionTarget(view)) return;
view.pending.fullscreen = !view.pending.fullscreen;
view.applyPending();