aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/riverctl.1.scd4
-rw-r--r--river/Cursor.zig9
-rw-r--r--river/InputManager.zig58
-rw-r--r--river/Seat.zig79
4 files changed, 41 insertions, 109 deletions
diff --git a/doc/riverctl.1.scd b/doc/riverctl.1.scd
index d98aafe..5fb392e 100644
--- a/doc/riverctl.1.scd
+++ b/doc/riverctl.1.scd
@@ -157,8 +157,8 @@ are ignored by river.
Mappings are modal in river. Each mapping is associated with a mode and is
only active while in that mode. There are two special modes: "normal" and
"locked". The normal mode is the initial mode on startup. The locked mode
-is automatically entered while an input inhibitor (such as a lockscreen)
-is active. It cannot be entered or exited manually.
+is automatically entered while a lock screen is active. It cannot be entered
+or exited manually.
The following modifiers are available for use in mappings:
diff --git a/river/Cursor.zig b/river/Cursor.zig
index b885d2d..e0d7f5c 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -1064,13 +1064,8 @@ fn passthrough(self: *Self, time: u32) void {
assert(self.mode == .passthrough);
if (self.surfaceAt()) |result| {
- // 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 (server.input_manager.inputAllowed(result.surface)) {
- self.seat.wlr_seat.pointerNotifyEnter(result.surface, result.sx, result.sy);
- self.seat.wlr_seat.pointerNotifyMotion(time, result.sx, result.sy);
- }
+ self.seat.wlr_seat.pointerNotifyEnter(result.surface, result.sx, result.sy);
+ self.seat.wlr_seat.pointerNotifyMotion(time, result.sx, result.sy);
} else {
// There is either no surface under the cursor or input is disallowed
// Reset the cursor image to the default and clear focus.
diff --git a/river/InputManager.zig b/river/InputManager.zig
index 1c34239..08e3858 100644
--- a/river/InputManager.zig
+++ b/river/InputManager.zig
@@ -40,7 +40,6 @@ const log = std.log.scoped(.input_manager);
new_input: wl.Listener(*wlr.InputDevice) = wl.Listener(*wlr.InputDevice).init(handleNewInput),
idle: *wlr.Idle,
-input_inhibit_manager: *wlr.InputInhibitManager,
pointer_constraints: *wlr.PointerConstraintsV1,
relative_pointer_manager: *wlr.RelativePointerManagerV1,
virtual_pointer_manager: *wlr.VirtualPointerManagerV1,
@@ -52,10 +51,6 @@ seats: std.TailQueue(Seat) = .{},
exclusive_client: ?*wl.Client = null,
-inhibit_activate: wl.Listener(*wlr.InputInhibitManager) =
- wl.Listener(*wlr.InputInhibitManager).init(handleInhibitActivate),
-inhibit_deactivate: wl.Listener(*wlr.InputInhibitManager) =
- wl.Listener(*wlr.InputInhibitManager).init(handleInhibitDeactivate),
new_pointer_constraint: wl.Listener(*wlr.PointerConstraintV1) =
wl.Listener(*wlr.PointerConstraintV1).init(handleNewPointerConstraint),
new_virtual_pointer: wl.Listener(*wlr.VirtualPointerManagerV1.event.NewPointer) =
@@ -70,7 +65,6 @@ pub fn init(self: *Self) !void {
self.* = .{
// These are automatically freed when the display is destroyed
.idle = try wlr.Idle.create(server.wl_server),
- .input_inhibit_manager = try wlr.InputInhibitManager.create(server.wl_server),
.pointer_constraints = try wlr.PointerConstraintsV1.create(server.wl_server),
.relative_pointer_manager = try wlr.RelativePointerManagerV1.create(server.wl_server),
.virtual_pointer_manager = try wlr.VirtualPointerManagerV1.create(server.wl_server),
@@ -87,8 +81,6 @@ pub fn init(self: *Self) !void {
if (build_options.xwayland) server.xwayland.setSeat(self.defaultSeat().wlr_seat);
server.backend.events.new_input.add(&self.new_input);
- self.input_inhibit_manager.events.activate.add(&self.inhibit_activate);
- self.input_inhibit_manager.events.deactivate.add(&self.inhibit_deactivate);
self.pointer_constraints.events.new_constraint.add(&self.new_pointer_constraint);
self.virtual_pointer_manager.events.new_virtual_pointer.add(&self.new_virtual_pointer);
self.virtual_keyboard_manager.events.new_virtual_keyboard.add(&self.new_virtual_keyboard);
@@ -126,56 +118,6 @@ pub fn updateCursorState(self: Self) void {
while (it) |node| : (it = node.next) node.data.cursor.updateState();
}
-fn handleInhibitActivate(
- listener: *wl.Listener(*wlr.InputInhibitManager),
- _: *wlr.InputInhibitManager,
-) void {
- const self = @fieldParentPtr(Self, "inhibit_activate", listener);
-
- log.debug("input inhibitor activated", .{});
-
- var seat_it = self.seats.first;
- while (seat_it) |seat_node| : (seat_it = seat_node.next) {
- // Clear focus of all seats
- seat_node.data.setFocusRaw(.{ .none = {} });
-
- // Enter locked mode
- seat_node.data.prev_mode_id = seat_node.data.mode_id;
- seat_node.data.enterMode(1);
- }
-
- self.exclusive_client = self.input_inhibit_manager.active_client;
-}
-
-fn handleInhibitDeactivate(
- listener: *wl.Listener(*wlr.InputInhibitManager),
- _: *wlr.InputInhibitManager,
-) void {
- const self = @fieldParentPtr(Self, "inhibit_deactivate", listener);
-
- log.debug("input inhibitor deactivated", .{});
-
- self.exclusive_client = null;
-
- // Calling arrangeLayers() like this ensures that any top or overlay,
- // keyboard-interactive surfaces will re-grab focus.
- var output_it = server.root.outputs.first;
- while (output_it) |output_node| : (output_it = output_node.next) {
- output_node.data.arrangeLayers(.mapped);
- }
-
- // After ensuring that any possible layer surface focus grab has occured,
- // have each Seat handle focus and enter their previous mode.
- var seat_it = self.seats.first;
- while (seat_it) |seat_node| : (seat_it = seat_node.next) {
- const seat = &seat_node.data;
- seat.enterMode(seat.prev_mode_id);
- seat.focus(null);
- }
-
- server.root.startTransaction();
-}
-
fn handleNewInput(listener: *wl.Listener(*wlr.InputDevice), wlr_device: *wlr.InputDevice) void {
const self = @fieldParentPtr(Self, "new_input", listener);
diff --git a/river/Seat.zig b/river/Seat.zig
index 78981fc..482d57c 100644
--- a/river/Seat.zig
+++ b/river/Seat.zig
@@ -223,51 +223,46 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
.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_surface) |wlr_surface| server.input_manager.inputAllowed(wlr_surface) else true) {
- // First clear the current focus
- switch (self.focused) {
- .view => |view| {
- view.pending.focus -= 1;
- if (view.pending.focus == 0) view.setActivated(false);
- },
- .xwayland_override_redirect, .layer, .none => {},
- }
+ // First clear the current focus
+ switch (self.focused) {
+ .view => |view| {
+ view.pending.focus -= 1;
+ if (view.pending.focus == 0) view.setActivated(false);
+ },
+ .xwayland_override_redirect, .layer, .none => {},
+ }
- // Set the new focus
- switch (new_focus) {
- .view => |target_view| {
- assert(self.focused_output == target_view.output);
- if (target_view.pending.focus == 0) target_view.setActivated(true);
- target_view.pending.focus += 1;
- target_view.pending.urgent = false;
- },
- .layer => |target_layer| assert(self.focused_output == target_layer.output),
- .xwayland_override_redirect, .none => {},
+ // Set the new focus
+ switch (new_focus) {
+ .view => |target_view| {
+ assert(self.focused_output == target_view.output);
+ if (target_view.pending.focus == 0) target_view.setActivated(true);
+ target_view.pending.focus += 1;
+ target_view.pending.urgent = false;
+ },
+ .layer => |target_layer| assert(self.focused_output == target_layer.output),
+ .xwayland_override_redirect, .none => {},
+ }
+ self.focused = new_focus;
+
+ // Send keyboard enter/leave events and handle pointer constraints
+ if (target_surface) |wlr_surface| {
+ self.keyboardNotifyEnter(wlr_surface);
+
+ 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);
+ constraint.sendDeactivated();
+ self.cursor.constraint = null;
}
- self.focused = new_focus;
-
- // Send keyboard enter/leave events and handle pointer constraints
- if (target_surface) |wlr_surface| {
- self.keyboardNotifyEnter(wlr_surface);
-
- 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);
- constraint.sendDeactivated();
- self.cursor.constraint = null;
- }
- } else {
- self.wlr_seat.keyboardClearFocus();
+ } else {
+ self.wlr_seat.keyboardClearFocus();
- if (self.cursor.constraint) |constraint| {
- PointerConstraint.warpToHint(&self.cursor);
- constraint.sendDeactivated();
- self.cursor.constraint = null;
- }
+ if (self.cursor.constraint) |constraint| {
+ PointerConstraint.warpToHint(&self.cursor);
+ constraint.sendDeactivated();
+ self.cursor.constraint = null;
}
}