Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2010-06-01 10:18:17 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2010-06-01 10:18:17 +0400
commitb96a2c346c488bd520b1fa5637a3ed37ee5936b3 (patch)
treeeec2320d610be12c5b37424d6b47c42ead69cc11 /intern
parenteab7f6d3c2f1a2ecfce6976f2b6d50a5ea5d2fcb (diff)
Fixes [#21791] Toggle Fullscreen (Alt + F11) returns to non-maximized window
Applied patch provided by Elia Sarti
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp16
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.h3
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp6
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h1
4 files changed, 25 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 1da64850198..bbfa84dbae0 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -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 @@ GHOST_WindowWin32::GHOST_WindowWin32(
m_top(top),
m_width(width),
m_height(height),
+ m_normal_state(GHOST_kWindowStateNormal),
m_stereo(stereoVisual),
m_nextWindow(NULL)
{
@@ -202,6 +204,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(
// 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 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
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 @@ void GHOST_WindowWin32::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
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 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
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 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
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;
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 5e1f708f61c..a4d31f87ffa 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -315,6 +315,8 @@ protected:
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 @@ protected:
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 */
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 9be278706a8..b3b1c8ae0f7 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -159,6 +159,7 @@ GHOST_WindowX11(
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 @@ GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state)
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 @@ GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state)
if (cur_state == GHOST_kWindowStateMinimized)
return (GHOST_kFailure);
+ m_normal_state = cur_state;
+
if (is_max == True)
netwmMaximized(False);
if (is_full == False)
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index f2420c4c493..2f45378117d 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -327,6 +327,7 @@ private :
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;