From 036f9a1cb90c54c8ce968adfa6f5e05fe364f98a Mon Sep 17 00:00:00 2001 From: Leon Henrik Plickat Date: Thu, 8 Oct 2020 18:12:31 +0200 Subject: [PATCH] Always set fullscreen views to fully opaque --- river/Seat.zig | 6 ++++-- river/View.zig | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/river/Seat.zig b/river/Seat.zig index e80368c..638954d 100644 --- a/river/Seat.zig +++ b/river/Seat.zig @@ -192,7 +192,7 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void { // activated state. if (build_options.xwayland and self.focused.view.impl == .xwayland_view) c.wlr_xwayland_surface_activate(self.focused.view.impl.xwayland_view.wlr_xwayland_surface, false); - if (self.focused.view.pending.focus == 0) { + if (self.focused.view.pending.focus == 0 and !self.focused.view.pending.fullscreen) { self.focused.view.pending.target_opacity = self.input_manager.server.config.view_opacity_unfocused; } } @@ -207,7 +207,9 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void { // activated state. if (build_options.xwayland and target_view.impl == .xwayland_view) c.wlr_xwayland_surface_activate(target_view.impl.xwayland_view.wlr_xwayland_surface, true); - target_view.pending.target_opacity = self.input_manager.server.config.view_opacity_focused; + if (!target_view.pending.fullscreen) { + target_view.pending.target_opacity = self.input_manager.server.config.view_opacity_focused; + } }, .layer => |target_layer| std.debug.assert(self.focused_output == target_layer.output), .none => {}, diff --git a/river/View.zig b/river/View.zig index df23d12..c8ce288 100644 --- a/river/View.zig +++ b/river/View.zig @@ -180,7 +180,9 @@ 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 + // and turn the view fully opaque if (!self.current.fullscreen and self.pending.fullscreen) { + self.pending.target_opacity = 1.0; const layout_box = c.wlr_output_layout_get_box(self.output.root.wlr_output_layout, self.output.wlr_output); self.pending.box = .{ .x = 0, @@ -190,10 +192,18 @@ pub fn applyPending(self: *Self) void { }; } - // If switching from fullscreen to layout, arrange the output to get - // assigned the proper size. - if (self.current.fullscreen and !self.pending.fullscreen and !self.pending.float) - arrange_output = true; + if (self.current.fullscreen and !self.pending.fullscreen) { + // If switching from fullscreen to layout, arrange the output to get + // assigned the proper size. + if (!self.pending.float) + arrange_output = true; + + // Restore configured opacity + self.pending.target_opacity = if (self.pending.focus > 0) + self.output.root.server.config.view_opacity_focused + else + self.output.root.server.config.view_opacity_unfocused; + } if (arrange_output) self.output.arrangeViews();