Skip to content

WaylandBackend: re-send app_id and title after the toplevel is unmapped - #2447

Open
gonzalezerik wants to merge 1 commit into
ValveSoftware:masterfrom
gonzalezerik:wayland-remap-app-id
Open

gonzalezerik wants to merge 1 commit into
ValveSoftware:masterfrom
gonzalezerik:wayland-remap-app-id

Conversation

@gonzalezerik

Copy link
Copy Markdown

Fixes #2446.

When the connector goes invisible, CWaylandPlane::Present() unmaps the toplevel by attaching a NULL buffer. xdg-shell discards all toplevel attributes on unmap ("The xdg_toplevel returns to the state it had right after xdg_surface.get_toplevel"), so the remapped window has no app_id, and no title unless the app's title changed in the meantime, because libdecor_frame_set_title() skips a title it has already sent.

This re-sends both in LibDecor_Frame_Configure() when m_bUnmappedAwaitingConfigure is set, so they go out in the configure that follows the unmap, before the next buffer attach maps the toplevel. That's the spot @nilsenist pointed to in #2446. The title goes through xdg_toplevel_set_title() directly since libdecor would skip it.

Testing, nested in niri (Smithay resets the toplevel on unmap the same way wlroots does), RTX 5070 Ti, Flatpak Steam, Ghost of Tsushima launched with gamescope -W 5120 -H 2160 -r 165 -f --hdr-enabled -- %command%:

Before: after the startup unmap the window came back with no app_id, so a window rule on app_id gamescope stopped applying.
After: the window keeps app_id gamescope and the rule applies.

Built with the Flathub org.freedesktop.Platform.VulkanLayer.gamescope 26.08 manifest on 3.16.31 (current master, 6867f50), together with an unrelated local patch to the HDR metadata path. No new warnings at the project's warning_level=2.

When the connector goes invisible, the toplevel is unmapped by attaching a
NULL buffer. xdg_toplevel discards all of its attributes on unmap, so when
it maps again it has no app_id, and no title unless the app's title
changed meanwhile, since libdecor skips a title it has already sent. On
compositors that reset the toplevel as the spec says (wlroots- and
Smithay-based ones), window rules matching app_id "gamescope" stop
applying to the remapped window.

Send both again in the configure that follows the unmap, before the
toplevel maps.

Closes: ValveSoftware#2446
@matte-schwartz

Copy link
Copy Markdown
Collaborator

Since the app_id is only set in the configure callback, the compositor has already handled the initial commit without it, so rules that only apply when a window opens might still miss it. Could you re-send app_id and title right after the unmap instead? The icon gets dropped there too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

With Wayland backend app_id and title are not re-sent after a NULL-buffer unmap

2 participants