Skip to content

Commit

Permalink
win32: fix fit_window_on_screen to account for invisible borders
Browse files Browse the repository at this point in the history
Fixes too small initial window size.
  • Loading branch information
kasper93 committed Sep 21, 2023
1 parent 9daa2bb commit e4199f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions video/out/w32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,18 @@ static void fit_window_on_screen(struct vo_w32_state *w32)
if (w32->opts->border)
subtract_window_borders(w32, w32->window, &screen);

// Check for invisible borders and adjust the work area size
RECT frame, window;
if (GetWindowRect(w32->window, &window) &&
SUCCEEDED(DwmGetWindowAttribute(w32->window, DWMWA_EXTENDED_FRAME_BOUNDS,
&frame, sizeof(RECT))))
{
screen.left -= frame.left - window.left;
screen.top -= frame.top - window.top;
screen.right += window.right - frame.right;
screen.bottom += window.bottom - frame.bottom;
}

bool adjusted = fit_rect_size(&w32->windowrc, rect_w(screen), rect_h(screen));

if (w32->windowrc.top < screen.top) {
Expand Down

0 comments on commit e4199f4

Please sign in to comment.