X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_window_mswin.c;h=7aef7a7715d5523e318477b79fe0ae6010ff00fe;hb=14a9bd8b0a7e13dfaffbe5e6c43f24d340fccf86;hp=069834957469f4eed60b3f948d4678ec68d226d8;hpb=c0a9c566efc4ca3c4ea170f9b538c6c16cb481ed;p=freeglut diff --git a/src/mswin/fg_window_mswin.c b/src/mswin/fg_window_mswin.c index 0698349..7aef7a7 100644 --- a/src/mswin/fg_window_mswin.c +++ b/src/mswin/fg_window_mswin.c @@ -85,13 +85,6 @@ typedef BOOL (WINAPI *pRegisterTouchWindow)(HWND,ULONG); static pRegisterTouchWindow fghRegisterTouchWindow = (pRegisterTouchWindow)0xDEADBEEF; #endif -/* - * Helper functions for getting client area from the window rect - * and the window rect from the client area given the style of the window - * (or a valid window pointer from which the style can be queried). - */ -extern void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* yBorderWidth); - /* * Setup the pixel format for a Win32 window @@ -378,6 +371,28 @@ void fgPlatformSetWindow ( SFG_Window *window ) } +/* Returns the width of the window borders based on the window's style. +*/ +void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* yBorderWidth) +{ + if (windowStyle & WS_THICKFRAME) + { + *xBorderWidth = GetSystemMetrics(SM_CXSIZEFRAME); + *yBorderWidth = GetSystemMetrics(SM_CYSIZEFRAME); + } + else if (windowStyle & WS_DLGFRAME) + { + *xBorderWidth = GetSystemMetrics(SM_CXFIXEDFRAME); + *yBorderWidth = GetSystemMetrics(SM_CYFIXEDFRAME); + } + else + { + *xBorderWidth = 0; + *yBorderWidth = 0; + } +} + + /* Computes position of corners of window Rect (outer position including * decorations) based on the provided client rect and based on the style @@ -394,10 +409,12 @@ void fghComputeWindowRectFromClientArea_UseStyle( const DWORD windowStyle, RECT /* If window has title bar, correct rect for it */ if (windowStyle & WS_MAXIMIZEBOX) /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */ + { if (posIsOutside) clientRect->bottom += GetSystemMetrics( SM_CYCAPTION ); else clientRect->top -= GetSystemMetrics( SM_CYCAPTION ); + } /* get width of window's borders (frame), correct rect for it. * Note, borders can be of zero width if style does not specify borders @@ -462,10 +479,12 @@ void fghComputeClientAreaFromWindowRect( const SFG_Window *window, RECT *windowR /* If window has title bar, correct rect for it */ if (windowStyle & WS_MAXIMIZEBOX) /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */ + { if (wantPosOutside) windowRect->bottom -= GetSystemMetrics( SM_CYCAPTION ); else windowRect->top += GetSystemMetrics( SM_CYCAPTION ); + } /* get width of window's borders (frame), correct rect for it. * Note, borders can be of zero width if style does not specify borders @@ -503,6 +522,8 @@ RECT fghGetClientArea( const SFG_Window *window, BOOL wantPosOutside ) /* * call GetWindowRect() * (this returns the pixel coordinates of the outside of the window) + * cannot use GetClientRect as it seems to return a rect relative to + * the top-left point of the client area (.top and .left are thus always 0) */ GetWindowRect( window->Window.Handle, &windowRect ); @@ -512,27 +533,6 @@ RECT fghGetClientArea( const SFG_Window *window, BOOL wantPosOutside ) return windowRect; } -/* Returns the width of the window borders based on the window's style. - */ -void fghGetBorderWidth(const DWORD windowStyle, int* xBorderWidth, int* yBorderWidth) -{ - if (windowStyle & WS_THICKFRAME) - { - *xBorderWidth = GetSystemMetrics(SM_CXSIZEFRAME); - *yBorderWidth = GetSystemMetrics(SM_CYSIZEFRAME); - } - else if (windowStyle & WS_DLGFRAME) - { - *xBorderWidth = GetSystemMetrics(SM_CXFIXEDFRAME); - *yBorderWidth = GetSystemMetrics(SM_CYFIXEDFRAME); - } - else - { - *xBorderWidth = 0; - *yBorderWidth = 0; - } -} - #if(WINVER >= 0x500) typedef struct { @@ -804,7 +804,6 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, UpdateWindow( window->Window.Handle ); ShowCursor( TRUE ); /* XXX Old comments say "hide cursor"! */ - } @@ -885,6 +884,8 @@ void fgPlatformGlutSetWindowTitle( const char* title ) /* * Set the current window's iconified title + * There really isn't a way to set the icon name separate from the + * windows name in Win32, so, just set the windows name. */ void fgPlatformGlutSetIconTitle( const char* title ) {