From 096e175ceca0b0ce313da58cd2d00b189f5ac458 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 24 Dec 2022 03:06:53 +0100 Subject: [PATCH] View: honor fullscreen requests before map --- river/View.zig | 4 +--- river/XdgToplevel.zig | 6 ++---- river/XwaylandView.zig | 9 +++------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/river/View.zig b/river/View.zig index 61cecf4..40e4db4 100644 --- a/river/View.zig +++ b/river/View.zig @@ -510,9 +510,7 @@ pub fn map(self: *Self) !void { self.output.sendViewTags(); - if (!self.current.float) self.output.arrangeViews(); - - server.root.startTransaction(); + self.applyPending(); } /// Called by the impl when the surface will no longer be displayed diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig index 7c39823..1475464 100644 --- a/river/XdgToplevel.zig +++ b/river/XdgToplevel.zig @@ -216,15 +216,13 @@ fn handleMap(listener: *wl.Listener(void)) void { if (self.xdg_toplevel.parent != null or has_fixed_size) { // If the self.xdg_toplevel has a parent or has a fixed size make it float - view.current.float = true; view.pending.float = true; - view.pending.box = view.float_box; } else if (server.config.shouldFloat(view)) { - view.current.float = true; view.pending.float = true; - view.pending.box = view.float_box; } + self.view.pending.fullscreen = self.xdg_toplevel.requested.fullscreen; + // If the view has an app_id or title which is not configured to use client // side decorations, inform it that it is tiled. if (server.config.csdAllowed(view)) { diff --git a/river/XwaylandView.zig b/river/XwaylandView.zig index 04ed396..0eef7a4 100644 --- a/river/XwaylandView.zig +++ b/river/XwaylandView.zig @@ -43,7 +43,7 @@ xwayland_surface: *wlr.XwaylandSurface, /// The wlroots Xwayland implementation overwrites xwayland_surface.fullscreen /// immediately when the client requests it, so we track this state here to be /// able to match the XdgToplevel API. -last_set_fullscreen_state: bool, +last_set_fullscreen_state: bool = false, // Listeners that are always active over the view's lifetime destroy: wl.Listener(*wlr.XwaylandSurface) = wl.Listener(*wlr.XwaylandSurface).init(handleDestroy), @@ -71,7 +71,6 @@ pub fn create(output: *Output, xwayland_surface: *wlr.XwaylandSurface) error{Out view.init(output, .{ .xwayland_view = .{ .view = view, .xwayland_surface = xwayland_surface, - .last_set_fullscreen_state = xwayland_surface.fullscreen, } }); const self = &node.view.impl.xwayland_view; @@ -225,15 +224,13 @@ pub fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: if (self.xwayland_surface.parent != null or has_fixed_size) { // If the toplevel has a parent or has a fixed size make it float - view.current.float = true; view.pending.float = true; - view.pending.box = view.float_box; } else if (server.config.shouldFloat(view)) { - view.current.float = true; view.pending.float = true; - view.pending.box = view.float_box; } + view.pending.fullscreen = xwayland_surface.fullscreen; + view.map() catch { log.err("out of memory", .{}); surface.resource.getClient().postNoMemory();