XdgToplevel: validate move/resize request serial

Currently we only support interactive move/resize with the pointer,
touch and tablet tool support are TODO.

Validate the serial here to ensure we don't start a pointer move/resize
in response to the client attempting to start a move/resize with
touch/tablet tool.

This fixes an assertion failure that the pointer's cursor is not hidden
during move/resize, which is how the issue was discovered. Another win
for assertions :)
This commit is contained in:
Isaac Freund 2024-03-15 15:24:46 +01:00
parent 1b63c463a7
commit 0e7a692831
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -427,10 +427,13 @@ fn handleRequestMove(
if (view.pending.fullscreen) return; if (view.pending.fullscreen) return;
if (!(view.pending.float or view.pending.output.?.layout == null)) return; if (!(view.pending.float or view.pending.output.?.layout == null)) return;
// Moving windows with touch or tablet tool is not yet supported.
if (seat.wlr_seat.validatePointerGrabSerial(null, event.serial)) {
switch (seat.cursor.mode) { switch (seat.cursor.mode) {
.passthrough, .down => seat.cursor.startMove(view), .passthrough, .down => seat.cursor.startMove(view),
.move, .resize => {}, .move, .resize => {},
} }
}
} }
fn handleRequestResize(listener: *wl.Listener(*wlr.XdgToplevel.event.Resize), event: *wlr.XdgToplevel.event.Resize) void { fn handleRequestResize(listener: *wl.Listener(*wlr.XdgToplevel.event.Resize), event: *wlr.XdgToplevel.event.Resize) void {
@ -443,10 +446,13 @@ fn handleRequestResize(listener: *wl.Listener(*wlr.XdgToplevel.event.Resize), ev
if (view.pending.fullscreen) return; if (view.pending.fullscreen) return;
if (!(view.pending.float or view.pending.output.?.layout == null)) return; if (!(view.pending.float or view.pending.output.?.layout == null)) return;
// Resizing windows with touch or tablet tool is not yet supported.
if (seat.wlr_seat.validatePointerGrabSerial(null, event.serial)) {
switch (seat.cursor.mode) { switch (seat.cursor.mode) {
.passthrough, .down => seat.cursor.startResize(view, event.edges), .passthrough, .down => seat.cursor.startResize(view, event.edges),
.move, .resize => {}, .move, .resize => {},
} }
}
} }
/// Called when the client sets / updates its title /// Called when the client sets / updates its title