]> git.mdlowis.com Git - proto/labwc.git/commitdiff
wlr-foreign: set all initial states correctly
authorJohn Lindgren <john@jlindgren.net>
Tue, 18 Nov 2025 03:53:53 +0000 (22:53 -0500)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Tue, 18 Nov 2025 06:06:07 +0000 (07:06 +0100)
Two were missing: "minimized" and "activated".

At least "minimized" can be set before map, so the initial state needs
to be read and set on the foreign-toplevel.

I think in the current code, the foreign-toplevel is always created
before a view is activated, but for future-proofing, let's not rely
on this, and set "activated" as well. There's no harm since wlroots
optimizes away any redundant state changes.

src/foreign-toplevel/wlr-foreign.c

index a84775f53d46468893f1ff471dc461d3febe8d1a..f5b5811001e841595cb08d914262f1b8494347a0 100644 (file)
@@ -199,9 +199,12 @@ wlr_foreign_toplevel_init(struct wlr_foreign_toplevel *wlr_toplevel,
        /* These states may be set before the initial map */
        handle_new_app_id(&wlr_toplevel->on_view.new_app_id, NULL);
        handle_new_title(&wlr_toplevel->on_view.new_title, NULL);
+       handle_new_outputs(&wlr_toplevel->on_view.new_outputs, NULL);
        handle_maximized(&wlr_toplevel->on_view.maximized, NULL);
+       handle_minimized(&wlr_toplevel->on_view.minimized, NULL);
        handle_fullscreened(&wlr_toplevel->on_view.fullscreened, NULL);
-       handle_new_outputs(&wlr_toplevel->on_view.new_outputs, NULL);
+       handle_activated(&wlr_toplevel->on_view.activated,
+               &(bool){view == view->server->active_view});
 
        /* Client side requests */
        CONNECT_SIGNAL(wlr_toplevel->handle, &wlr_toplevel->on, request_maximize);