input-inhibit: remove support for protocol
The only valid use-case for this as far as I'm concerned is lockscreens, which will now be supported through ext-session-lock-v1.
This commit is contained in:
parent
ba823ef96e
commit
78a46c316a
@ -157,8 +157,8 @@ are ignored by river.
|
|||||||
Mappings are modal in river. Each mapping is associated with a mode and is
|
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
|
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
|
"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 automatically entered while a lock screen is active. It cannot be entered
|
||||||
is active. It cannot be entered or exited manually.
|
or exited manually.
|
||||||
|
|
||||||
The following modifiers are available for use in mappings:
|
The following modifiers are available for use in mappings:
|
||||||
|
|
||||||
|
@ -1064,13 +1064,8 @@ fn passthrough(self: *Self, time: u32) void {
|
|||||||
assert(self.mode == .passthrough);
|
assert(self.mode == .passthrough);
|
||||||
|
|
||||||
if (self.surfaceAt()) |result| {
|
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.pointerNotifyEnter(result.surface, result.sx, result.sy);
|
||||||
self.seat.wlr_seat.pointerNotifyMotion(time, result.sx, result.sy);
|
self.seat.wlr_seat.pointerNotifyMotion(time, result.sx, result.sy);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// There is either no surface under the cursor or input is disallowed
|
// There is either no surface under the cursor or input is disallowed
|
||||||
// Reset the cursor image to the default and clear focus.
|
// Reset the cursor image to the default and clear focus.
|
||||||
|
@ -40,7 +40,6 @@ const log = std.log.scoped(.input_manager);
|
|||||||
new_input: wl.Listener(*wlr.InputDevice) = wl.Listener(*wlr.InputDevice).init(handleNewInput),
|
new_input: wl.Listener(*wlr.InputDevice) = wl.Listener(*wlr.InputDevice).init(handleNewInput),
|
||||||
|
|
||||||
idle: *wlr.Idle,
|
idle: *wlr.Idle,
|
||||||
input_inhibit_manager: *wlr.InputInhibitManager,
|
|
||||||
pointer_constraints: *wlr.PointerConstraintsV1,
|
pointer_constraints: *wlr.PointerConstraintsV1,
|
||||||
relative_pointer_manager: *wlr.RelativePointerManagerV1,
|
relative_pointer_manager: *wlr.RelativePointerManagerV1,
|
||||||
virtual_pointer_manager: *wlr.VirtualPointerManagerV1,
|
virtual_pointer_manager: *wlr.VirtualPointerManagerV1,
|
||||||
@ -52,10 +51,6 @@ seats: std.TailQueue(Seat) = .{},
|
|||||||
|
|
||||||
exclusive_client: ?*wl.Client = null,
|
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) =
|
new_pointer_constraint: wl.Listener(*wlr.PointerConstraintV1) =
|
||||||
wl.Listener(*wlr.PointerConstraintV1).init(handleNewPointerConstraint),
|
wl.Listener(*wlr.PointerConstraintV1).init(handleNewPointerConstraint),
|
||||||
new_virtual_pointer: wl.Listener(*wlr.VirtualPointerManagerV1.event.NewPointer) =
|
new_virtual_pointer: wl.Listener(*wlr.VirtualPointerManagerV1.event.NewPointer) =
|
||||||
@ -70,7 +65,6 @@ pub fn init(self: *Self) !void {
|
|||||||
self.* = .{
|
self.* = .{
|
||||||
// These are automatically freed when the display is destroyed
|
// These are automatically freed when the display is destroyed
|
||||||
.idle = try wlr.Idle.create(server.wl_server),
|
.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),
|
.pointer_constraints = try wlr.PointerConstraintsV1.create(server.wl_server),
|
||||||
.relative_pointer_manager = try wlr.RelativePointerManagerV1.create(server.wl_server),
|
.relative_pointer_manager = try wlr.RelativePointerManagerV1.create(server.wl_server),
|
||||||
.virtual_pointer_manager = try wlr.VirtualPointerManagerV1.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);
|
if (build_options.xwayland) server.xwayland.setSeat(self.defaultSeat().wlr_seat);
|
||||||
|
|
||||||
server.backend.events.new_input.add(&self.new_input);
|
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.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_pointer_manager.events.new_virtual_pointer.add(&self.new_virtual_pointer);
|
||||||
self.virtual_keyboard_manager.events.new_virtual_keyboard.add(&self.new_virtual_keyboard);
|
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();
|
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 {
|
fn handleNewInput(listener: *wl.Listener(*wlr.InputDevice), wlr_device: *wlr.InputDevice) void {
|
||||||
const self = @fieldParentPtr(Self, "new_input", listener);
|
const self = @fieldParentPtr(Self, "new_input", listener);
|
||||||
|
|
||||||
|
@ -223,10 +223,6 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
|
|||||||
.none => null,
|
.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
|
// First clear the current focus
|
||||||
switch (self.focused) {
|
switch (self.focused) {
|
||||||
.view => |view| {
|
.view => |view| {
|
||||||
@ -269,7 +265,6 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
|
|||||||
self.cursor.constraint = null;
|
self.cursor.constraint = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Inform any clients tracking status of the change
|
// Inform any clients tracking status of the change
|
||||||
var it = self.status_trackers.first;
|
var it = self.status_trackers.first;
|
||||||
|
Loading…
Reference in New Issue
Block a user