cursor: allow commands to override cursor operations
Now that we properly handle state changes during cursor operations, blocking these commands if the target view is the target of a cursor operation is unnecessary complexity. It is also inconsistent as we don't block changing the tags of the view.
This commit is contained in:
parent
969d7b0344
commit
f86291169e
@ -179,17 +179,13 @@ pub fn setTheme(self: *Self, theme: ?[*:0]const u8, _size: ?u32) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn isCursorActionTarget(self: Self, view: *const View) bool {
|
pub fn handleViewUnmap(self: *Self, view: *View) void {
|
||||||
return switch (self.mode) {
|
if (switch (self.mode) {
|
||||||
.passthrough => false,
|
.passthrough => false,
|
||||||
.down => |target_view| target_view == view,
|
.down => |target_view| target_view == view,
|
||||||
.move => |target_view| target_view == view,
|
.move => |target_view| target_view == view,
|
||||||
.resize => |data| data.view == view,
|
.resize => |data| data.view == view,
|
||||||
};
|
}) {
|
||||||
}
|
|
||||||
|
|
||||||
pub fn handleViewUnmap(self: *Self, view: *View) void {
|
|
||||||
if (self.isCursorActionTarget(view)) {
|
|
||||||
self.mode = .passthrough;
|
self.mode = .passthrough;
|
||||||
self.clearFocus();
|
self.clearFocus();
|
||||||
}
|
}
|
||||||
|
@ -178,13 +178,6 @@ pub fn inputAllowed(self: Self, wlr_surface: *wlr.Surface) bool {
|
|||||||
true;
|
true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn isCursorActionTarget(self: Self, view: *View) bool {
|
|
||||||
var it = self.seats.first;
|
|
||||||
return while (it) |node| : (it = node.next) {
|
|
||||||
if (node.data.cursor.isCursorActionTarget(view)) break true;
|
|
||||||
} else false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handleInhibitActivate(
|
fn handleInhibitActivate(
|
||||||
listener: *wl.Listener(*wlr.InputInhibitManager),
|
listener: *wl.Listener(*wlr.InputInhibitManager),
|
||||||
input_inhibit_manager: *wlr.InputInhibitManager,
|
input_inhibit_manager: *wlr.InputInhibitManager,
|
||||||
|
@ -155,8 +155,5 @@ fn getView(seat: *Seat) ?*View {
|
|||||||
// Do not touch fullscreen views
|
// Do not touch fullscreen views
|
||||||
if (view.pending.fullscreen) return null;
|
if (view.pending.fullscreen) return null;
|
||||||
|
|
||||||
// Do not touch views which are the target of a cursor action
|
|
||||||
if (server.input_manager.isCursorActionTarget(view)) return null;
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,6 @@ pub fn toggleFloat(
|
|||||||
// Don't float fullscreen views
|
// Don't float fullscreen views
|
||||||
if (view.pending.fullscreen) return;
|
if (view.pending.fullscreen) return;
|
||||||
|
|
||||||
// Don't modify views which are the target of a cursor action
|
|
||||||
if (server.input_manager.isCursorActionTarget(view)) return;
|
|
||||||
|
|
||||||
view.pending.float = !view.pending.float;
|
view.pending.float = !view.pending.float;
|
||||||
view.applyPending();
|
view.applyPending();
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,6 @@ pub fn toggleFullscreen(
|
|||||||
if (seat.focused == .view) {
|
if (seat.focused == .view) {
|
||||||
const view = seat.focused.view;
|
const view = seat.focused.view;
|
||||||
|
|
||||||
// Don't modify views which are the target of a cursor action
|
|
||||||
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 New Issue
Block a user