David MacCormack fixed a bug in window sizing with Windows menus
authorSam Lantinga <slouken@libsdl.org>
Mon, 20 Jan 2003 00:17:01 +0000
changeset 5657d7e19b59866
parent 564 0da795da276c
child 566 d6e7d7006062
David MacCormack fixed a bug in window sizing with Windows menus
src/video/wincommon/SDL_sysevents.c
     1.1 --- a/src/video/wincommon/SDL_sysevents.c	Sun Jan 19 23:01:35 2003 +0000
     1.2 +++ b/src/video/wincommon/SDL_sysevents.c	Mon Jan 20 00:17:01 2003 +0000
     1.3 @@ -396,6 +396,7 @@
     1.4  			MINMAXINFO *info;
     1.5  			RECT        size;
     1.6  			int x, y;
     1.7 +			int style;
     1.8  			int width;
     1.9  			int height;
    1.10  
    1.11 @@ -424,8 +425,19 @@
    1.12  				size.bottom = 0;
    1.13  				size.right = 0;
    1.14  			}
    1.15 -			AdjustWindowRect(&size, GetWindowLong(hwnd, GWL_STYLE),
    1.16 -									FALSE);
    1.17 +
    1.18 +			/* DJM - according to the docs for GetMenu(), the
    1.19 +			   return value is undefined if hwnd is a child window.
    1.20 +			   Aparently it's too difficult for MS to check
    1.21 +			   inside their function, so I have to do it here.
    1.22 +          		 */
    1.23 +         		style = GetWindowLong(hwnd, GWL_STYLE);
    1.24 +         		AdjustWindowRect(
    1.25 +				&size,
    1.26 +				style,
    1.27 +            			style & WS_CHILDWINDOW ? FALSE
    1.28 +						       : GetMenu(hwnd) != NULL);
    1.29 +
    1.30  			width = size.right - size.left;
    1.31  			height = size.bottom - size.top;
    1.32