View: use last set fullscreen state in applyPending()
This avoids a race where the fullscreen set is e.g. set then unset before the transaction has been completed and the current state has been updated.
This commit is contained in:
@ -179,7 +179,7 @@ pub fn applyPending(self: *Self) void {
|
||||
self.pending.box = self.float_box;
|
||||
}
|
||||
|
||||
if (!self.current.fullscreen and self.pending.fullscreen) {
|
||||
if (!self.lastSetFullscreenState() and self.pending.fullscreen) {
|
||||
// If switching to fullscreen, set the dimensions to the full area of the output
|
||||
self.setFullscreen(true);
|
||||
self.post_fullscreen_box = self.current.box;
|
||||
@ -190,7 +190,7 @@ pub fn applyPending(self: *Self) void {
|
||||
.width = dimensions.width,
|
||||
.height = dimensions.height,
|
||||
};
|
||||
} else if (self.current.fullscreen and !self.pending.fullscreen) {
|
||||
} else if (self.lastSetFullscreenState() and !self.pending.fullscreen) {
|
||||
self.setFullscreen(false);
|
||||
self.pending.box = self.post_fullscreen_box;
|
||||
}
|
||||
@ -219,6 +219,13 @@ pub fn configure(self: *Self) void {
|
||||
}
|
||||
}
|
||||
|
||||
fn lastSetFullscreenState(self: Self) bool {
|
||||
return switch (self.impl) {
|
||||
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.lastSetFullscreenState(),
|
||||
.xwayland_view => |xwayland_view| xwayland_view.lastSetFullscreenState(),
|
||||
};
|
||||
}
|
||||
|
||||
pub fn sendFrameDone(self: Self) void {
|
||||
var now: os.timespec = undefined;
|
||||
os.clock_gettime(os.CLOCK.MONOTONIC, &now) catch @panic("CLOCK_MONOTONIC not supported");
|
||||
@ -330,11 +337,11 @@ pub fn setActivated(self: Self, activated: bool) void {
|
||||
}
|
||||
}
|
||||
|
||||
fn setFullscreen(self: Self, fullscreen: bool) void {
|
||||
fn setFullscreen(self: *Self, fullscreen: bool) void {
|
||||
if (self.foreign_toplevel_handle) |handle| handle.setFullscreen(fullscreen);
|
||||
switch (self.impl) {
|
||||
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.setFullscreen(fullscreen),
|
||||
.xwayland_view => |xwayland_view| xwayland_view.setFullscreen(fullscreen),
|
||||
.xwayland_view => |*xwayland_view| xwayland_view.setFullscreen(fullscreen),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user