@ -257,86 +257,33 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, 
			
		
	
		
			
				
					            break ;   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        case  WM_ACTIVATE  :   
			
		
	
		
			
				
					        case  WM_SETFOCUS  :   
			
		
	
		
			
				
					        {   
			
		
	
		
			
				
					            // Window was (de)focused and/or (de)iconified
   
			
		
	
		
			
				
					            if  ( window - > cursorMode  ! =  GLFW_CURSOR_NORMAL )   
			
		
	
		
			
				
					                _glfwPlatformApplyCursorMode ( window ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            BOOL  focused  =  LOWORD ( wParam )  ! =  WA_INACTIVE ;   
			
		
	
		
			
				
					            BOOL  iconified  =  HIWORD ( wParam )  ?  TRUE  :  FALSE ;   
			
		
	
		
			
				
					            if  ( window - > monitor  & &  window - > autoIconify )   
			
		
	
		
			
				
					                enterFullscreenMode ( window )  ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( focused  & &  iconified )   
			
		
	
		
			
				
					            {   
			
		
	
		
			
				
					                if  ( window - > iconified  & &  _glfw . focusedWindow  ! =  window )   
			
		
	
		
			
				
					                {   
			
		
	
		
			
				
					                    // This is a workaround for window restoration using the
   
			
		
	
		
			
				
					                    // Win+D hot key leading to windows being told they're
   
			
		
	
		
			
				
					                    // focused and iconified and then never told they're
   
			
		
	
		
			
				
					                    // restored
   
			
		
	
		
			
				
					                    iconified  =  FALSE ;   
			
		
	
		
			
				
					                }   
			
		
	
		
			
				
					                else   
			
		
	
		
			
				
					                {   
			
		
	
		
			
				
					                    // This is a workaround for window iconification using the
   
			
		
	
		
			
				
					                    // taskbar leading to windows being told they're focused and
   
			
		
	
		
			
				
					                    // iconified and then never told they're defocused
   
			
		
	
		
			
				
					                    focused  =  FALSE ;   
			
		
	
		
			
				
					                }   
			
		
	
		
			
				
					            _glfwInputWindowFocus ( window ,  GL_TRUE ) ;   
			
		
	
		
			
				
					            return  0 ;   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( ! focused  & &  _glfw . focusedWindow  = =  window )    
			
		
	
		
			
				
					        case  WM_KILLFOCUS :   
			
		
	
		
			
				
					        {   
			
		
	
		
			
				
					                // The window was defocused (or iconified, see above)
   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( window - > cursorMode  ! =  GLFW_CURSOR_NORMAL )   
			
		
	
		
			
				
					                restoreCursor ( window ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( window - > monitor  & &  window - > autoIconify )   
			
		
	
		
			
				
					            {   
			
		
	
		
			
				
					                    if  ( ! iconified )   
			
		
	
		
			
				
					                    {   
			
		
	
		
			
				
					                        // Iconify the (on top, borderless, oddly positioned)
   
			
		
	
		
			
				
					                        // window or the user will be annoyed
   
			
		
	
		
			
				
					                _glfwPlatformIconifyWindow ( window ) ;   
			
		
	
		
			
				
					                    }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					                leaveFullscreenMode ( window ) ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					            else  if  ( focused  & &  _glfw . focusedWindow  ! =  window )   
			
		
	
		
			
				
					            {   
			
		
	
		
			
				
					                // The window was focused
   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					                if  ( window - > cursorMode  ! =  GLFW_CURSOR_NORMAL )   
			
		
	
		
			
				
					                    _glfwPlatformApplyCursorMode ( window ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					                if  ( window - > monitor  & &  window - > autoIconify )   
			
		
	
		
			
				
					                    enterFullscreenMode ( window ) ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            _glfwInputWindowFocus ( window ,  focused ) ;   
			
		
	
		
			
				
					            _glfwInputWindowIconify ( window ,  iconified ) ;   
			
		
	
		
			
				
					            return  0 ;   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        case  WM_ACTIVATEAPP :   
			
		
	
		
			
				
					        {   
			
		
	
		
			
				
					            if  ( ! wParam  & &  IsIconic ( hWnd ) )   
			
		
	
		
			
				
					            {   
			
		
	
		
			
				
					                // This is a workaround for full screen windows losing focus
   
			
		
	
		
			
				
					                // through Alt+Tab leading to windows being told they're
   
			
		
	
		
			
				
					                // unfocused and restored and then never told they're iconified
   
			
		
	
		
			
				
					                _glfwInputWindowIconify ( window ,  GL_TRUE ) ;   
			
		
	
		
			
				
					            }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            _glfwInputWindowFocus ( window ,  GL_FALSE ) ;   
			
		
	
		
			
				
					            return  0 ;   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        case  WM_SHOWWINDOW :   
			
		
	
		
			
				
					        {   
			
		
	
		
			
				
					            _glfwInputWindowVisibility ( window ,  wParam  ?  GL_TRUE  :  GL_FALSE ) ;   
			
		
	
		
			
				
					            break ;   
			
		
	
		
			
				
					        }   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        case  WM_SYSCOMMAND :   
			
		
	
		
			
				
					        {   
			
		
	
		
			
				
					            switch  ( wParam  &  0xfff0 )   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -560,6 +507,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, 
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					        case  WM_SIZE :   
			
		
	
		
			
				
					        {   
			
		
	
		
			
				
					            if  ( wParam  = =  SIZE_MINIMIZED )   
			
		
	
		
			
				
					                _glfwInputWindowIconify ( window ,  GL_TRUE ) ;   
			
		
	
		
			
				
					            else  if  ( wParam  = =  SIZE_RESTORED )   
			
		
	
		
			
				
					                _glfwInputWindowIconify ( window ,  GL_FALSE ) ;   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					            if  ( _glfw . focusedWindow  = =  window )   
			
		
	
		
			
				
					            {   
			
		
	
		
			
				
					                if  ( window - > cursorMode  = =  GLFW_CURSOR_DISABLED )   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -1041,6 +993,21 @@ void _glfwPlatformHideWindow(_GLFWwindow* window) 
			
		
	
		
			
				
					    ShowWindow ( window - > win32 . handle ,  SW_HIDE ) ;   
			
		
	
		
			
				
					}  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					int  _glfwPlatformWindowFocused ( _GLFWwindow *  window )  
			
		
	
		
			
				
					{  
			
		
	
		
			
				
					    return  window - > win32 . handle  = =  GetActiveWindow ( ) ;   
			
		
	
		
			
				
					}  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					int  _glfwPlatformWindowIconified ( _GLFWwindow *  window )  
			
		
	
		
			
				
					{  
			
		
	
		
			
				
					    return  IsIconic ( window - > win32 . handle ) ;   
			
		
	
		
			
				
					}  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					int  _glfwPlatformWindowVisible ( _GLFWwindow *  window )  
			
		
	
		
			
				
					{  
			
		
	
		
			
				
					    return  IsWindowVisible ( window - > win32 . handle ) ;   
			
		
	
		
			
				
					}  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					void  _glfwPlatformPollEvents ( void )  
			
		
	
		
			
				
					{  
			
		
	
		
			
				
					    MSG  msg ;   
			
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
				@ -1238,7 +1205,8 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) 
			
		
	
		
			
				
					    // the following condition is not met. That way it should be safe to destroy the
   
			
		
	
		
			
				
					    // cursor after calling glfwSetCursor(window, NULL) on all windows using the cursor.
   
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					    if  ( window - > cursorMode  = =  GLFW_CURSOR_NORMAL  & &  _glfw . focusedWindow  = =  window  & &   
			
		
	
		
			
				
					    if  ( _glfw . focusedWindow  = =  window  & &   
			
		
	
		
			
				
					        window - > cursorMode  = =  GLFW_CURSOR_NORMAL  & &   
			
		
	
		
			
				
					        window - > win32 . cursorInside )   
			
		
	
		
			
				
					    {   
			
		
	
		
			
				
					        if  ( cursor )