view: forbid mode change if cursor target
Making a floating view tiled during a resize breaks things badly.
This commit is contained in:
parent
9f3ee76e51
commit
d87356c93a
@ -26,6 +26,7 @@ const util = @import("util.zig");
|
||||
|
||||
const Seat = @import("Seat.zig");
|
||||
const Server = @import("Server.zig");
|
||||
const View = @import("View.zig");
|
||||
|
||||
const default_seat_name = "default";
|
||||
|
||||
@ -101,6 +102,18 @@ pub fn inputAllowed(self: Self, wlr_surface: *c.wlr_surface) bool {
|
||||
true;
|
||||
}
|
||||
|
||||
pub fn isCursorActionTarget(self: Self, view: *View) bool {
|
||||
var it = self.seats.first;
|
||||
return while (it) |node| : (it = node.next) {
|
||||
const seat = &node.data;
|
||||
switch (seat.cursor.mode) {
|
||||
.passthrough => {},
|
||||
.move => |data| if (data.view == view) break true,
|
||||
.resize => |data| if (data.view == view) break true,
|
||||
}
|
||||
} else false;
|
||||
}
|
||||
|
||||
fn handleInhibitActivate(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
||||
const self = @fieldParentPtr(Self, "listen_inhibit_activate", listener.?);
|
||||
|
||||
|
@ -36,6 +36,9 @@ pub fn toggleFloat(
|
||||
// Don't float fullscreen views
|
||||
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 (!view.pending.float) view.pending.box = view.float_box;
|
||||
view.pending.float = !view.pending.float;
|
||||
view.output.root.arrange();
|
||||
|
@ -30,7 +30,12 @@ pub fn toggleFullscreen(
|
||||
if (args.len > 1) return Error.TooManyArguments;
|
||||
|
||||
if (seat.focused == .view) {
|
||||
seat.focused.view.setFullscreen(!seat.focused.view.pending.fullscreen);
|
||||
seat.focused.view.output.root.arrange();
|
||||
const view = seat.focused.view;
|
||||
|
||||
// Don't modify views which are the target of a cursor action
|
||||
if (seat.input_manager.isCursorActionTarget(view)) return;
|
||||
|
||||
view.setFullscreen(!seat.focused.view.pending.fullscreen);
|
||||
view.output.root.arrange();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user