view: handle setting fullscreen in configure()

This commit is contained in:
Isaac Freund 2020-08-11 22:32:32 +02:00
parent 2669a615b6
commit bd99428766
4 changed files with 3 additions and 19 deletions

View File

@ -167,16 +167,10 @@ pub fn applyPending(self: *Self) void {
self.pending.box = self.float_box;
// If switching to fullscreen set the dimensions to the full area of the output
if (!self.current.fullscreen and self.pending.fullscreen) {
if (!self.current.fullscreen and self.pending.fullscreen)
self.pending.box = Box.fromWlrBox(
c.wlr_output_layout_get_box(self.output.root.wlr_output_layout, self.output.wlr_output).*,
);
// TODO: move this to configure
switch (self.impl) {
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.setFullscreen(self.pending.fullscreen),
.xwayland_view => |xwayland_view| xwayland_view.setFullscreen(self.pending.fullscreen),
}
}
// If switching from fullscreen to layout, arrange the output to get
// assigned the proper size.

View File

@ -32,10 +32,6 @@ pub fn configure(self: Self) void {
unreachable;
}
pub fn setFullscreen(self: Self, fullscreen: bool) void {
unreachable;
}
pub fn close(self: Self) void {
unreachable;
}

View File

@ -82,6 +82,7 @@ pub fn needsConfigure(self: Self) bool {
pub fn configure(self: Self) void {
const state = &self.view.pending;
_ = c.wlr_xdg_toplevel_set_activated(self.wlr_xdg_surface, state.focus != 0);
_ = c.wlr_xdg_toplevel_set_fullscreen(self.wlr_xdg_surface, state.fullscreen);
self.view.pending_serial = c.wlr_xdg_toplevel_set_size(
self.wlr_xdg_surface,
state.box.width,
@ -89,10 +90,6 @@ pub fn configure(self: Self) void {
);
}
pub fn setFullscreen(self: Self, fullscreen: bool) void {
_ = c.wlr_xdg_toplevel_set_fullscreen(self.wlr_xdg_surface, fullscreen);
}
/// Close the view. This will lead to the unmap and destroy events being sent
pub fn close(self: Self) void {
c.wlr_xdg_toplevel_send_close(self.wlr_xdg_surface);

View File

@ -66,6 +66,7 @@ pub fn needsConfigure(self: Self) bool {
/// Apply pending state
pub fn configure(self: Self) void {
const state = &self.view.pending;
c.wlr_xwayland_surface_set_fullscreen(self.wlr_xwayland_surface, state.fullscreen);
c.wlr_xwayland_surface_configure(
self.wlr_xwayland_surface,
@intCast(i16, state.box.x),
@ -81,10 +82,6 @@ pub fn configure(self: Self) void {
self.view.pending_serial = 0x66666666;
}
pub fn setFullscreen(self: Self, fullscreen: bool) void {
c.wlr_xwayland_surface_set_fullscreen(self.wlr_xwayland_surface, fullscreen);
}
/// Close the view. This will lead to the unmap and destroy events being sent
pub fn close(self: Self) void {
c.wlr_xwayland_surface_close(self.wlr_xwayland_surface);