Always set fullscreen views to fully opaque

This commit is contained in:
Leon Henrik Plickat 2020-10-08 18:12:31 +02:00 committed by Isaac Freund
parent d4ca5d7a88
commit 036f9a1cb9
2 changed files with 18 additions and 6 deletions

View File

@ -192,7 +192,7 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
// activated state. // activated state.
if (build_options.xwayland and self.focused.view.impl == .xwayland_view) 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); 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; 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. // activated state.
if (build_options.xwayland and target_view.impl == .xwayland_view) if (build_options.xwayland and target_view.impl == .xwayland_view)
c.wlr_xwayland_surface_activate(target_view.impl.xwayland_view.wlr_xwayland_surface, true); 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), .layer => |target_layer| std.debug.assert(self.focused_output == target_layer.output),
.none => {}, .none => {},

View File

@ -180,7 +180,9 @@ pub fn applyPending(self: *Self) void {
self.pending.box = self.float_box; self.pending.box = self.float_box;
// If switching to fullscreen set the dimensions to the full area of the output // 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) { 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); const layout_box = c.wlr_output_layout_get_box(self.output.root.wlr_output_layout, self.output.wlr_output);
self.pending.box = .{ self.pending.box = .{
.x = 0, .x = 0,
@ -190,10 +192,18 @@ pub fn applyPending(self: *Self) void {
}; };
} }
// If switching from fullscreen to layout, arrange the output to get if (self.current.fullscreen and !self.pending.fullscreen) {
// assigned the proper size. // If switching from fullscreen to layout, arrange the output to get
if (self.current.fullscreen and !self.pending.fullscreen and !self.pending.float) // assigned the proper size.
arrange_output = true; 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(); if (arrange_output) self.output.arrangeViews();