Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32: fix maximize state with --border=no #13721

Merged
merged 1 commit into from May 5, 2024

Conversation

kasper93
Copy link
Contributor

WS_POPUP windows cannot be maximized, so instead of forcing it with unavoidable side-effects, change the window style before maximizing to make it work correctly.

@kasper93
Copy link
Contributor Author

@na-na-hi: What do you think we do something like this for --border=no? Not tested much, there is one thing when toggling title bar in runtime to fix, but the idea would be the same.

@na-na-hi
Copy link
Contributor

This is viable in principle as long as the states are correctly updated on state change request from both mpv and windows side. But currently it doesn't work and the title bar is shown when the window is maximized.

Interestingly, there are some inconsistencies here between unmaximizing from mpv and windows side. If I unmaximize the window from windows side, window snapping works afterwards even though it doesn't normally with --border=no. Seems exploitable to make window snapping work with --border=no.

@kasper93
Copy link
Contributor Author

This is viable in principle as long as the states are correctly updated on state change request from both mpv and windows side.

Yeah, this is already quite annoying for fullscreen and other states too.

Interestingly, there are some inconsistencies here between unmaximizing from mpv and windows side. If I unmaximize the window from windows side, window snapping works afterwards even though it doesn't normally with --border=no. Seems exploitable to make window snapping work with --border=no.

It is --border=yes --title-bar=no state or unmaximized window, that still is "maximized", that can happen, but is not valid state. Either way, I don't think it is usable.

@na-na-hi
Copy link
Contributor

It is --border=yes --title-bar=no state or unmaximized window, that still is "maximized", that can happen, but is not valid state.

Really? In this state, windows thinks it's unmaximized (any maximized state that got stuck for some reason goes away when I drag the window), mpv thinks it's unmaximized, and there are no corner rounding or borders at all (so not --border=yes --title-bar=no). This seems to be the result of mpv setting an unexpected window style that works this way.

@kasper93
Copy link
Contributor Author

IIRC it happens when you resize maximized WS_POPUP window. It doesn't unmaximize itself.

@kasper93 kasper93 marked this pull request as draft March 18, 2024 17:19
Copy link

github-actions bot commented Mar 18, 2024

Download the artifacts for this pull request:

Windows
macOS

@kasper93 kasper93 marked this pull request as ready for review April 27, 2024 02:16
@kasper93
Copy link
Contributor Author

But currently it doesn't work and the title bar is shown when the window is maximized.

ah, it still depended on --title-bar while it shouldn't. Now it should work correctly.

@kasper93 kasper93 added this to the Release v0.39.0 milestone Apr 27, 2024
@na-na-hi
Copy link
Contributor

The current version still has the symptom I described earlier, which you said wasn't a valid state:

If I unmaximize the window from windows side, window snapping works afterwards even though it doesn't normally with --border=no.

WS_POPUP windows cannot be maximized, so instead of forcing it with
unavoidable side-effects, change the window style before maximizing to
make it work correctly.
@kasper93
Copy link
Contributor Author

kasper93 commented May 3, 2024

@na-na-hi: needed to update style in WM_SIZE to account for external changes. Should be fine now.

Copy link
Contributor

@na-na-hi na-na-hi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works.

@kasper93 kasper93 merged commit 4cc9e6f into mpv-player:master May 5, 2024
15 checks passed
@kasper93 kasper93 deleted the w32_max branch May 5, 2024 12:03
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.

None yet

2 participants