From 34342b6915e40e437a6287f09f8fb29e1c296be9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 20 Jan 2003 00:17:01 +0000 Subject: [PATCH] David MacCormack fixed a bug in window sizing with Windows menus --- src/video/wincommon/SDL_sysevents.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/video/wincommon/SDL_sysevents.c b/src/video/wincommon/SDL_sysevents.c index becb0a61d..84d2448d5 100644 --- a/src/video/wincommon/SDL_sysevents.c +++ b/src/video/wincommon/SDL_sysevents.c @@ -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; @@ -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;