# HG changeset patch # User Sam Lantinga # Date 1043021821 0 # Node ID 7d7e19b59866a15a180940b992e293a96b8e5888 # Parent 0da795da276c27997b3154415bc261911cb6acd2 David MacCormack fixed a bug in window sizing with Windows menus diff -r 0da795da276c -r 7d7e19b59866 src/video/wincommon/SDL_sysevents.c --- a/src/video/wincommon/SDL_sysevents.c Sun Jan 19 23:01:35 2003 +0000 +++ b/src/video/wincommon/SDL_sysevents.c Mon Jan 20 00:17:01 2003 +0000 @@ -396,6 +396,7 @@ MINMAXINFO *info; RECT size; int x, y; + int style; int width; int height; @@ -424,8 +425,19 @@ 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;