Revision: 29119 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29119 Author: jesterking Date: 2010-06-01 08:18:17 +0200 (Tue, 01 Jun 2010)
Log Message: ----------- Fixes [#21791] Toggle Fullscreen (Alt + F11) returns to non-maximized window Applied patch provided by Elia Sarti Modified Paths: -------------- trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp trunk/blender/intern/ghost/intern/GHOST_WindowWin32.h trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp trunk/blender/intern/ghost/intern/GHOST_WindowX11.h Modified: trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp =================================================================== --- trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp 2010-06-01 06:07:22 UTC (rev 29118) +++ trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp 2010-06-01 06:18:17 UTC (rev 29119) @@ -64,6 +64,7 @@ LPCSTR GHOST_WindowWin32::s_windowClassName = "GHOST_WindowClass"; const int GHOST_WindowWin32::s_maxTitleLength = 128; HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL; +HDC GHOST_WindowWin32::s_firstHDC = NULL; static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd); static int EnumPixelFormats(HDC hdc); @@ -134,6 +135,7 @@ m_top(top), m_width(width), m_height(height), + m_normal_state(GHOST_kWindowStateNormal), m_stereo(stereoVisual), m_nextWindow(NULL) { @@ -202,6 +204,10 @@ // Store the device context m_hDC = ::GetDC(m_hWnd); + if(!s_firstHDC) { + s_firstHDC = m_hDC; + } + // Show the window int nCmdShow; switch (state) { @@ -308,10 +314,11 @@ m_customCursor = NULL; } + ::wglMakeCurrent(NULL, NULL); m_multisampleEnabled = GHOST_kFailure; m_multisample = 0; setDrawingContextType(GHOST_kDrawingContextTypeNone); - if (m_hDC) { + if (m_hDC && m_hDC != s_firstHDC) { ::ReleaseDC(m_hWnd, m_hDC); m_hDC = 0; } @@ -482,9 +489,13 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) { + GHOST_TWindowState curstate = getState(); WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); ::GetWindowPlacement(m_hWnd, &wp); + + if (state == GHOST_kWindowStateNormal) + state = m_normal_state; switch (state) { case GHOST_kWindowStateMinimized: wp.showCmd = SW_SHOWMINIMIZED; @@ -495,6 +506,8 @@ SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); break; case GHOST_kWindowStateFullScreen: + if (curstate != state && curstate != GHOST_kWindowStateMinimized) + m_normal_state = curstate; wp.showCmd = SW_SHOWMAXIMIZED; wp.ptMaxPosition.x = 0; wp.ptMaxPosition.y = 0; @@ -637,6 +650,7 @@ m_hGlRc = ::wglCreateContext(m_hDC); if (m_hGlRc) { if (s_firsthGLRc) { + ::wglCopyContext(s_firsthGLRc, m_hGlRc, GL_ALL_ATTRIB_BITS); wglShareLists(s_firsthGLRc, m_hGlRc); } else { s_firsthGLRc = m_hGlRc; Modified: trunk/blender/intern/ghost/intern/GHOST_WindowWin32.h =================================================================== --- trunk/blender/intern/ghost/intern/GHOST_WindowWin32.h 2010-06-01 06:07:22 UTC (rev 29118) +++ trunk/blender/intern/ghost/intern/GHOST_WindowWin32.h 2010-06-01 06:18:17 UTC (rev 29119) @@ -315,6 +315,8 @@ HGLRC m_hGlRc; /** The first created OpenGL context (for sharing display lists) */ static HGLRC s_firsthGLRc; + /** The first created device context handle. */ + static HDC s_firstHDC; /** Flag for if window has captured the mouse */ bool m_hasMouseCaptured; /** Count of number of pressed buttons */ @@ -351,6 +353,7 @@ GHOST_TInt32 m_top; GHOST_TUns32 m_width; GHOST_TUns32 m_height; + GHOST_TWindowState m_normal_state; bool m_stereo; /** The GHOST_System passes this to wm if this window is being replaced */ Modified: trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp =================================================================== --- trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp 2010-06-01 06:07:22 UTC (rev 29118) +++ trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp 2010-06-01 06:18:17 UTC (rev 29119) @@ -159,6 +159,7 @@ GHOST_Window(title,left,top,width,height,state,type,stereoVisual,numOfAASamples), m_context(NULL), m_display(display), + m_normal_state(GHOST_kWindowStateNormal), m_system (system), m_valid_setup (false), m_invalid_window(false), @@ -1036,6 +1037,9 @@ is_motif_full = motifIsFullScreen(); + if (state == GHOST_kWindowStateNormal) + state = m_normal_state; + if (state == GHOST_kWindowStateNormal) { if (is_max == True) netwmMaximized(False); @@ -1055,6 +1059,8 @@ if (cur_state == GHOST_kWindowStateMinimized) return (GHOST_kFailure); + m_normal_state = cur_state; + if (is_max == True) netwmMaximized(False); if (is_full == False) Modified: trunk/blender/intern/ghost/intern/GHOST_WindowX11.h =================================================================== --- trunk/blender/intern/ghost/intern/GHOST_WindowX11.h 2010-06-01 06:07:22 UTC (rev 29118) +++ trunk/blender/intern/ghost/intern/GHOST_WindowX11.h 2010-06-01 06:18:17 UTC (rev 29119) @@ -327,6 +327,7 @@ Window m_window; Display *m_display; XVisualInfo *m_visual; + GHOST_TWindowState m_normal_state; /** The first created OpenGL context (for sharing display lists) */ static GLXContext s_firstContext; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs