Skip to content

Commit

Permalink
David MacCormack fixed a bug in window sizing with Windows menus
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 20, 2003
1 parent 5158ce2 commit 34342b6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/video/wincommon/SDL_sysevents.c
Expand Up @@ -396,6 +396,7 @@ LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
MINMAXINFO *info;
RECT size;
int x, y;
int style;
int width;
int height;

Expand Down Expand Up @@ -424,8 +425,19 @@ LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
size.bottom = 0;
size.right = 0;
}
AdjustWindowRect(&size, GetWindowLong(hwnd, GWL_STYLE),
FALSE);

/* DJM - according to the docs for GetMenu(), the
return value is undefined if hwnd is a child window.
Aparently it's too difficult for MS to check
inside their function, so I have to do it here.
*/
style = GetWindowLong(hwnd, GWL_STYLE);
AdjustWindowRect(
&size,
style,
style & WS_CHILDWINDOW ? FALSE
: GetMenu(hwnd) != NULL);

width = size.right - size.left;
height = size.bottom - size.top;

Expand Down

0 comments on commit 34342b6

Please sign in to comment.