X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmswin%2Ffg_main_mswin.c;h=1958755e254f1c090479700284c680066767266e;hb=ef2a902d5e7c706dad5a0e39fc8863b0e9eb2876;hp=61caf552617cd73e8fbac812c1434b79dada6aa3;hpb=a91c4e11d70265093dc3a7c15ed3f1b07883e9df;p=freeglut diff --git a/src/mswin/fg_main_mswin.c b/src/mswin/fg_main_mswin.c index 61caf55..1958755 100644 --- a/src/mswin/fg_main_mswin.c +++ b/src/mswin/fg_main_mswin.c @@ -1,5 +1,5 @@ /* - * freeglut_main_mswin.c + * fg_main_mswin.c * * The Windows-specific mouse cursor related stuff. * @@ -752,7 +752,9 @@ SFG_Window* fghWindowUnderCursor(SFG_Window *window) /* Get mouse position at time of message */ DWORD mouse_pos_dw = GetMessagePos(); - POINT mouse_pos = {GET_X_LPARAM(mouse_pos_dw), GET_Y_LPARAM(mouse_pos_dw)}; + POINT mouse_pos; + mouse_pos.x = GET_X_LPARAM(mouse_pos_dw); + mouse_pos.y = GET_Y_LPARAM(mouse_pos_dw); ScreenToClient( window->Window.Handle, &mouse_pos ); hwnd = ChildWindowFromPoint(window->Window.Handle, mouse_pos); @@ -872,7 +874,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR /* Update visibility state of the window */ if (wParam==SIZE_MINIMIZED) fghPlatformOnWindowStatusNotify(window,GL_FALSE,GL_FALSE); - else if (wParam==SIZE_RESTORED && !window->State.Visible) + else if ((wParam==SIZE_RESTORED || wParam == SIZE_MAXIMIZED) && !window->State.Visible) fghPlatformOnWindowStatusNotify(window,GL_TRUE,GL_FALSE); /* Check window visible, we don't want do anything when we get a WM_SIZE because the user or glutIconifyWindow minimized the window */ @@ -947,7 +949,9 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR /* For child window, we should return relative to upper-left * of parent's client area. */ - POINT topleft = {windowRect.left,windowRect.top}; + POINT topleft; + topleft.x = windowRect.left; + topleft.y = windowRect.top; ScreenToClient(window->Parent->Window.Handle,&topleft); windowRect.left = topleft.x; @@ -1539,6 +1543,16 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR break; } #endif + +#ifdef WM_INPUT + case WM_INPUT: + /* Added by Jinrong Xie for SpaceNavigator support on Windows. Dec 2014 */ + if (fgHasSpaceball()) + { + fgSpaceballHandleWinEvent(hWnd, wParam, lParam); + } + break; +#endif default: /* Handle unhandled messages */ lRet = DefWindowProc( hWnd, uMsg, wParam, lParam ); @@ -1636,8 +1650,7 @@ void fgPlatformPosResZordWork(SFG_Window* window, unsigned int workMask) /* For fullscreen mode, find the monitor that is covered the most * by the window and get its rect as the resize target. */ - GetWindowRect(window->Window.Handle, &rect); - hMonitor= MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST); + hMonitor= MonitorFromWindow(window->Window.Handle, MONITOR_DEFAULTTONEAREST); mi.cbSize = sizeof(mi); GetMonitorInfo(hMonitor, &mi); rect = mi.rcMonitor; @@ -1755,12 +1768,12 @@ void fgPlatformVisibilityWork(SFG_Window* window) win = win->Parent; break; case DesireNormalState: - if (win->IsMenu && (!fgStructure.GameModeWindow || win->ActiveMenu->ParentWindow != fgStructure.GameModeWindow)) - cmdShow = SW_SHOWNA; /* Just show, don't activate window if its a menu. Only exception is when the parent is a gamemode window as the menu would pop under it when we do this... */ + if (win->IsMenu && !fgStructure.GameModeWindow) + cmdShow = SW_SHOWNA; /* Just show, don't activate window if its a menu. Only exception is when there is a gamemode window as the menu would pop under it when we do this... */ else cmdShow = SW_SHOW; break; } ShowWindow( win->Window.Handle, cmdShow ); -} \ No newline at end of file +}