view: forbid mode change if cursor target

Making a floating view tiled during a resize breaks things badly.
This commit is contained in:
Isaac Freund
2020-07-29 16:54:46 +02:00
parent 9f3ee76e51
commit d87356c93a
3 changed files with 23 additions and 2 deletions

View File

@ -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.?);