view: fix xdg_toplevel fullscreen request handling
This commit is contained in:
parent
845fcad9e6
commit
ef4efbcadf
@ -215,10 +215,30 @@ pub fn setFocused(self: *Self, focused: bool) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the pending state to fullscren and inform the client. Should be
|
/// Set the pending state, set the size, and inform the client.
|
||||||
/// followed by starting a transaction to apply the pending state.
|
|
||||||
pub fn setFullscreen(self: *Self, fullscreen: bool) void {
|
pub fn setFullscreen(self: *Self, fullscreen: bool) void {
|
||||||
self.pending.fullscreen = fullscreen;
|
self.pending.fullscreen = fullscreen;
|
||||||
|
|
||||||
|
if (fullscreen) {
|
||||||
|
// If transitioning from float -> fullscreen, save the floating
|
||||||
|
// dimensions.
|
||||||
|
if (self.pending.float) self.float_box = self.current.box;
|
||||||
|
|
||||||
|
const output = self.output;
|
||||||
|
self.pending.box = Box.fromWlrBox(
|
||||||
|
c.wlr_output_layout_get_box(output.root.wlr_output_layout, output.wlr_output).*,
|
||||||
|
);
|
||||||
|
self.configure();
|
||||||
|
} else if (self.pending.float) {
|
||||||
|
// If transitioning from fullscreen -> float, return to the saved
|
||||||
|
// floating dimensions.
|
||||||
|
self.pending.box = self.float_box;
|
||||||
|
self.configure();
|
||||||
|
} else {
|
||||||
|
// Transitioning to layout, arrange and start a transaction
|
||||||
|
self.output.root.arrange();
|
||||||
|
}
|
||||||
|
|
||||||
switch (self.impl) {
|
switch (self.impl) {
|
||||||
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.setFullscreen(fullscreen),
|
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.setFullscreen(fullscreen),
|
||||||
.xwayland_view => |xwayland_view| xwayland_view.setFullscreen(fullscreen),
|
.xwayland_view => |xwayland_view| xwayland_view.setFullscreen(fullscreen),
|
||||||
|
@ -287,5 +287,4 @@ fn handleRequestFullscreen(listener: ?*c.wl_listener, data: ?*c_void) callconv(.
|
|||||||
const self = @fieldParentPtr(Self, "listen_request_fullscreen", listener.?);
|
const self = @fieldParentPtr(Self, "listen_request_fullscreen", listener.?);
|
||||||
const event = util.voidCast(c.wlr_xdg_toplevel_set_fullscreen_event, data.?);
|
const event = util.voidCast(c.wlr_xdg_toplevel_set_fullscreen_event, data.?);
|
||||||
self.view.setFullscreen(event.fullscreen);
|
self.view.setFullscreen(event.fullscreen);
|
||||||
self.view.output.root.arrange();
|
|
||||||
}
|
}
|
||||||
|
@ -39,25 +39,5 @@ pub fn toggleFullscreen(
|
|||||||
if (seat.input_manager.isCursorActionTarget(view)) return;
|
if (seat.input_manager.isCursorActionTarget(view)) return;
|
||||||
|
|
||||||
view.setFullscreen(!view.pending.fullscreen);
|
view.setFullscreen(!view.pending.fullscreen);
|
||||||
|
|
||||||
if (view.pending.fullscreen) {
|
|
||||||
// If transitioning from float -> fullscreen, save the floating
|
|
||||||
// dimensions.
|
|
||||||
if (view.pending.float) view.float_box = view.current.box;
|
|
||||||
|
|
||||||
const output = view.output;
|
|
||||||
view.pending.box = Box.fromWlrBox(
|
|
||||||
c.wlr_output_layout_get_box(output.root.wlr_output_layout, output.wlr_output).*,
|
|
||||||
);
|
|
||||||
view.configure();
|
|
||||||
} else if (view.pending.float) {
|
|
||||||
// If transitioning from fullscreen -> float, return to the saved
|
|
||||||
// floating dimensions.
|
|
||||||
view.pending.box = view.float_box;
|
|
||||||
view.configure();
|
|
||||||
} else {
|
|
||||||
// Transitioning to layout, arrange and start a transaction
|
|
||||||
view.output.root.arrange();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user