Skip to content

wayland: parse toplevel states before geometry_configured check#17741

Open
andrewrabert wants to merge 1 commit intompv-player:masterfrom
andrewrabert:wayland-states-always
Open

wayland: parse toplevel states before geometry_configured check#17741
andrewrabert wants to merge 1 commit intompv-player:masterfrom
andrewrabert:wayland-states-always

Conversation

@andrewrabert
Copy link
Copy Markdown

Fix toplevel state being lost before geometry_configured is configured. Previously, for a KWin rule that set fullscreen (apply initially or forced) when a --geometry was also specified, mpv would render at --geometry size even though the compositor was treating it as fullscreen. This resulted in geometry-sized content anchored to the top-right without a titlebar. This mismatch of what mpv thinks and what actually is can also be seen similarly with a KWin rule that sets a maximize state.

With this change, mpv starts in fullscreen proper (ie --fullscreen). Exiting fullscreen then results in a window size as specified by the --geometry.

For the other states this handles, I'm honestly not sure as I wasn't able to force them. It should be fine based on what I see here and logically is correct as mpv's state should always match what the compositor informs it to be.

The bug was discovered during development of https://github.com/jellyfin/jellyfin-desktop and also confirmed to exist on the mpv master branch. I tested this manually on KWin and with a build of mpv master.

The change seems to be correct per my relatively newish understanding of the protocol specs. I acknowledge that I understand and can speak to this change I made. I disclose that an LLM (Claude) was used in tracking this down.


Testing examples: KWin rule with --geometry=1280x720

Force Maximize Force Fullscreen
Screenshot_20260412_162305 Screenshot_20260412_162346

Fix toplevel state being lost before geometry_configured is
configured. Previously, for a KWin rule that set fullscreen (apply
initially or forced) when a --geometry was also specified, mpv would
render at --geometry size even though the compositor was treating it as
fullscreen. This resulted in geometry-sized content anchored to the
top-right without a titlebar. This mismatch of what mpv thinks and what
actually is can also be seen similarly with a KWin rule that sets a
maximize state.

With this change, mpv starts in fullscreen _proper_ (ie --fullscreen).
Exiting fullscreen then results in a window size as specified by the
--geometry.

For the other states this handles, I'm honestly not sure as I wasn't
able to force them. It _should_ be fine based on what I see here and
_logically_ is correct as mpv's state should always match what the
compositor informs it to be.
@kasper93 kasper93 requested a review from Dudemanguy April 12, 2026 21:45
@Dudemanguy
Copy link
Copy Markdown
Member

I think this makes sense but I also want test this code path later and see if it can be simplified.

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.

2 participants