From bd994287664cf8738cb6991598888cc4225325c4 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Tue, 11 Aug 2020 22:32:32 +0200 Subject: [PATCH] view: handle setting fullscreen in configure() --- river/View.zig | 8 +------- river/VoidView.zig | 4 ---- river/XdgToplevel.zig | 5 +---- river/XwaylandView.zig | 5 +---- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/river/View.zig b/river/View.zig index 2b22808..8e102b8 100644 --- a/river/View.zig +++ b/river/View.zig @@ -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. diff --git a/river/VoidView.zig b/river/VoidView.zig index b212dd6..f1f1c7a 100644 --- a/river/VoidView.zig +++ b/river/VoidView.zig @@ -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; } diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig index 1b56df3..8d4c7b3 100644 --- a/river/XdgToplevel.zig +++ b/river/XdgToplevel.zig @@ -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); diff --git a/river/XwaylandView.zig b/river/XwaylandView.zig index 71412d9..b104b7e 100644 --- a/river/XwaylandView.zig +++ b/river/XwaylandView.zig @@ -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);