river: remove Seat.input_manager
This is no longer needed as server is global.
This commit is contained in:
parent
50cdcf3ee4
commit
c8b1017923
6 changed files with 15 additions and 13 deletions
|
@ -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
|
// If this cursor belongs to the default seat, set the xcursor environment
|
||||||
// variables and the xwayland cursor theme.
|
// 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});
|
const size_str = try std.fmt.allocPrint0(util.gpa, "{}", .{size});
|
||||||
defer util.gpa.free(size_str);
|
defer util.gpa.free(size_str);
|
||||||
if (c.setenv("XCURSOR_SIZE", size_str, 1) < 0) return error.OutOfMemory;
|
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 {
|
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,
|
self.seat.wlr_seat,
|
||||||
@as(u64, time) * 1000,
|
@as(u64, time) * 1000,
|
||||||
delta_x,
|
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
|
// If input is allowed on the surface, send pointer enter and motion
|
||||||
// events. Note that wlroots won't actually send an enter event if
|
// events. Note that wlroots won't actually send an enter event if
|
||||||
// the surface has already been entered.
|
// 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
|
// The focus change must be checked before sending enter events
|
||||||
const focus_change = self.seat.wlr_seat.pointer_state.focused_surface != surface;
|
const focus_change = self.seat.wlr_seat.pointer_state.focused_surface != surface;
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ pub fn init(self: *Self) !void {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.seats.prepend(seat_node);
|
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);
|
if (build_options.xwayland) server.xwayland.setSeat(self.defaultSeat().wlr_seat);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ const FocusTarget = union(enum) {
|
||||||
none: void,
|
none: void,
|
||||||
};
|
};
|
||||||
|
|
||||||
input_manager: *InputManager,
|
|
||||||
wlr_seat: *wlr.Seat,
|
wlr_seat: *wlr.Seat,
|
||||||
|
|
||||||
/// Multiple mice are handled by the same Cursor
|
/// 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),
|
wl.Listener(*wlr.Seat.event.RequestSetPrimarySelection).init(handleRequestSetPrimarySelection),
|
||||||
// zig fmt: on
|
// 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.* = .{
|
self.* = .{
|
||||||
.input_manager = input_manager,
|
|
||||||
// This will be automatically destroyed when the display is destroyed
|
// This will be automatically destroyed when the display is destroyed
|
||||||
.wlr_seat = try wlr.Seat.create(server.wl_server, name),
|
.wlr_seat = try wlr.Seat.create(server.wl_server, name),
|
||||||
.focused_output = &server.root.noop_output,
|
.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
|
// 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
|
// input inhibitor) do not set focus. If there is no target surface we
|
||||||
// still clear the focus.
|
// 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
|
// First clear the current focus
|
||||||
if (self.focused == .view) {
|
if (self.focused == .view) {
|
||||||
self.focused.view.pending.focus -= 1;
|
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);
|
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();
|
@intToPtr(*PointerConstraint, constraint.data).setAsActive();
|
||||||
} else if (self.cursor.constraint) |constraint| {
|
} else if (self.cursor.constraint) |constraint| {
|
||||||
PointerConstraint.warpToHint(&self.cursor);
|
PointerConstraint.warpToHint(&self.cursor);
|
||||||
|
@ -275,7 +273,7 @@ pub fn focusOutput(self: *Self, output: *Output) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handleActivity(self: Self) 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
|
/// Handle the unmapping of a view, removing it from the focus stack and
|
||||||
|
|
|
@ -156,7 +156,7 @@ fn getView(seat: *Seat) ?*View {
|
||||||
if (view.pending.fullscreen) return null;
|
if (view.pending.fullscreen) return null;
|
||||||
|
|
||||||
// Do not touch views which are the target of a cursor action
|
// 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;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
const server = &@import("../main.zig").server;
|
||||||
|
|
||||||
const Error = @import("../command.zig").Error;
|
const Error = @import("../command.zig").Error;
|
||||||
const Seat = @import("../Seat.zig");
|
const Seat = @import("../Seat.zig");
|
||||||
|
|
||||||
|
@ -43,7 +45,7 @@ pub fn toggleFloat(
|
||||||
if (view.pending.fullscreen) return;
|
if (view.pending.fullscreen) return;
|
||||||
|
|
||||||
// Don't modify views which are the target of a cursor action
|
// 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.pending.float = !view.pending.float;
|
||||||
view.applyPending();
|
view.applyPending();
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
const server = &@import("../main.zig").server;
|
||||||
|
|
||||||
const Box = @import("../Box.zig");
|
const Box = @import("../Box.zig");
|
||||||
const Error = @import("../command.zig").Error;
|
const Error = @import("../command.zig").Error;
|
||||||
const Seat = @import("../Seat.zig");
|
const Seat = @import("../Seat.zig");
|
||||||
|
@ -34,7 +36,7 @@ pub fn toggleFullscreen(
|
||||||
const view = seat.focused.view;
|
const view = seat.focused.view;
|
||||||
|
|
||||||
// Don't modify views which are the target of a cursor action
|
// 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.pending.fullscreen = !view.pending.fullscreen;
|
||||||
view.applyPending();
|
view.applyPending();
|
||||||
|
|
Loading…
Reference in a new issue