Skip to content

w32_common: fix video zoom reset on window restore from maximize (fixes #17695)#17708

Open
0xjah wants to merge 8 commits intompv-player:masterfrom
0xjah:fix/issue-17695-zoom-reset
Open

w32_common: fix video zoom reset on window restore from maximize (fixes #17695)#17708
0xjah wants to merge 8 commits intompv-player:masterfrom
0xjah:fix/issue-17695-zoom-reset

Conversation

@0xjah
Copy link
Copy Markdown

@0xjah 0xjah commented Apr 6, 2026

Fix issue #17695 where maximizing and restoring the player window would reset
the video to its original size, losing any custom zoom settings.

The window_resize() function was always applying a size_constraint set to 100%
of screen size. Now the constraint is only applied during initial setup or when
forcing position, preserving the user's video zoom level when restoring from maximize.

Fixes #17695

};

// Only apply size_constraint during initial setup or when forcing position.
// This prevents resetting video zoom when restoring from maximized state.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The constraint should only apply when video would be bigger than screen, and only when reset_size is true. I don't see how any of those conditions can be true when restoring.

@0xjah
Copy link
Copy Markdown
Author

0xjah commented Apr 8, 2026

Fixed in the new PR.

The constraint now only applies when both conditions are true:

  1. reset_size is active (via pending_reset_size or auto_window_resize detecting a size change)

  2. The unconstrained geometry would exceed the screen bounds

During a restore from maximized, neither condition is met pending_reset_size stays false and video size hasn't changed, so the constraint doesn't apply. The window restores to its saved size without the 100% limit, preserving zoom as intended.

@0xjah
Copy link
Copy Markdown
Author

0xjah commented Apr 8, 2026

@kasper93 is there anything else should i implement or fix

@0xjah 0xjah requested a review from kasper93 April 8, 2026 19:12
N-R-K and others added 5 commits April 8, 2026 23:49
env vars are case insensitive on windows so getenv should
compare them as such.

Fixes: mpv-player#17577 (comment)
Window controls are not clickable from the very top of the window, they
have a margin to the top that makes them harder to click. Make them
clickable also from the very top to make them easier to activate.

The close button with the default windowcontrols_alignment=right
specifically is already clickable from the rightmost part of the window.

Partial fix of mpv-player#9791 (other buttons also need to be updated).
There is an area between the 2 lines of bottombar and topbar that is not
clickable, e.g. between the menu and play_pause icons. Make it all
clickable so it's easier to click buttons.

This also allows clicking from the bottom in slimbottombar and from the
top in topbottombar.
@0xjah 0xjah force-pushed the fix/issue-17695-zoom-reset branch from a02fb2c to 881e75e Compare April 8, 2026 20:51
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.

Maximizing and/or restoring-down player resets video to original size

4 participants