win32: apply geometry position to content instead of window

The docs specify that the +-X+-Y geometry values position the content.
This used to work correctly but got broken at 8fb4fd9a .
Geometry size is unaffected - this only concerns position.

Commit 8fb4fd9a made it center the window rather than the content by
taking the borders into account during positioning, but forgot to make
an exception when a position is specified explicitly.

This commit adds this exception, and now if a specific position is
requested then the borders are ignored, and the content is positioned
correctly.
This commit is contained in:
Avi Halachmi (:avih) 2022-02-01 08:22:35 +02:00 committed by avih
parent 8172c501ac
commit 555c15efba
1 changed files with 6 additions and 1 deletions

View File

@ -1419,8 +1419,13 @@ static void gui_thread_reconfig(void *ptr)
struct vo *vo = w32->vo;
RECT r = get_working_area(w32);
if (!w32->current_fs && !IsMaximized(w32->window) && w32->opts->border)
// for normal window which is auto-positioned (centered), center the window
// rather than the content (by subtracting the borders from the work area)
if (!w32->current_fs && !IsMaximized(w32->window) && w32->opts->border &&
!w32->opts->geometry.xy_valid /* specific position not requested */)
{
subtract_window_borders(w32, w32->window, &r);
}
struct mp_rect screen = { r.left, r.top, r.right, r.bottom };
struct vo_win_geometry geo;