From 596132c3a1becceb0ba6d10991d52a85ba8f201c Mon Sep 17 00:00:00 2001
From: Riku Salminen
Date: Tue, 21 Aug 2012 21:01:57 +0300
Subject: [PATCH 01/10] Add glfwShowWindow, glfwHideWindow
Add glfwShowWindow and glfwHideWindow functions to allow explicit
control over show/hide window.
Remove platform specific show window code from _glfwPlatformCreateWindow
but call glfwShowWindow from glfwCreateWindow to avoid breaking things
(for now).
---
include/GL/glfw3.h | 2 +
src/cocoa_window.m | 20 +++++++-
src/internal.h | 2 +
src/win32_window.c | 114 +++++++++------------------------------------
src/window.c | 34 ++++++++++++++
src/x11_window.c | 26 +++++++++--
6 files changed, 101 insertions(+), 97 deletions(-)
diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h
index 050f0c30..79b6033a 100644
--- a/include/GL/glfw3.h
+++ b/include/GL/glfw3.h
@@ -540,6 +540,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow, int* xpos, int* ypos);
GLFWAPI void glfwSetWindowPos(GLFWwindow, int xpos, int ypos);
GLFWAPI void glfwIconifyWindow(GLFWwindow window);
GLFWAPI void glfwRestoreWindow(GLFWwindow window);
+GLFWAPI void glfwShowWindow(GLFWwindow window);
+GLFWAPI void glfwHideWindow(GLFWwindow window);
GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param);
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer);
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window);
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index d7764f92..db6d07b8 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -906,7 +906,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!createContext(window, wndconfig, fbconfig))
return GL_FALSE;
- [window->NS.object makeKeyAndOrderFront:nil];
[window->NSGL.context setView:[window->NS.object contentView]];
if (wndconfig->mode == GLFW_FULLSCREEN)
@@ -1030,6 +1029,25 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
}
+//========================================================================
+// Show window
+//========================================================================
+
+void _glfwPlatformShowWindow(_GLFWwindow* window)
+{
+ [window->NS.object makeKeyAndOrderFront:nil];
+}
+
+
+//========================================================================
+// Hide window
+//========================================================================
+
+void _glfwPlatformHideWindow(_GLFWwindow* window)
+{
+ [window->NS.object orderOut:nil];
+}
+
//========================================================================
// Write back window parameters into GLFW window structure
//========================================================================
diff --git a/src/internal.h b/src/internal.h
index 89ac48b2..1bad7483 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -302,6 +302,8 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y);
void _glfwPlatformIconifyWindow(_GLFWwindow* window);
void _glfwPlatformRestoreWindow(_GLFWwindow* window);
+void _glfwPlatformShowWindow(_GLFWwindow* window);
+void _glfwPlatformHideWindow(_GLFWwindow* window);
// Event management
void _glfwPlatformPollEvents(void);
diff --git a/src/win32_window.c b/src/win32_window.c
index 77b99026..ff6941ab 100644
--- a/src/win32_window.c
+++ b/src/win32_window.c
@@ -34,95 +34,6 @@
#include
#include
-
-//========================================================================
-// Enable/disable minimize/restore animations
-//========================================================================
-
-static int setMinMaxAnimations(int enable)
-{
- ANIMATIONINFO AI;
- int old_enable;
-
- // Get old animation setting
- AI.cbSize = sizeof(ANIMATIONINFO);
- SystemParametersInfo(SPI_GETANIMATION, AI.cbSize, &AI, 0);
- old_enable = AI.iMinAnimate;
-
- // If requested, change setting
- if (old_enable != enable)
- {
- AI.iMinAnimate = enable;
- SystemParametersInfo(SPI_SETANIMATION, AI.cbSize, &AI,
- SPIF_SENDCHANGE);
- }
-
- return old_enable;
-}
-
-
-//========================================================================
-// Focus the window and bring it to the top of the stack
-// Due to some nastiness with how XP handles SetForegroundWindow we have
-// to go through some really bizarre measures to achieve this
-//========================================================================
-
-static void setForegroundWindow(HWND hWnd)
-{
- int try_count = 0;
- int old_animate;
-
- // Try the standard approach first...
- BringWindowToTop(hWnd);
- SetForegroundWindow(hWnd);
-
- // If it worked, return now
- if (hWnd == GetForegroundWindow())
- {
- // Try to modify the system settings (since this is the foreground
- // process, we are allowed to do this)
- SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID) 0,
- SPIF_SENDCHANGE);
- return;
- }
-
- // For other Windows versions than 95 & NT4.0, the standard approach
- // may not work, so if we failed we have to "trick" Windows into
- // making our window the foureground window: Iconify and restore
- // again. It is ugly, but it seems to work (we turn off those annoying
- // zoom animations to make it look a bit better at least).
-
- // Turn off minimize/restore animations
- old_animate = setMinMaxAnimations(0);
-
- // We try this a few times, just to be on the safe side of things...
- do
- {
- // Iconify & restore
- ShowWindow(hWnd, SW_HIDE);
- ShowWindow(hWnd, SW_SHOWMINIMIZED);
- ShowWindow(hWnd, SW_SHOWNORMAL);
-
- // Try to get focus
- BringWindowToTop(hWnd);
- SetForegroundWindow(hWnd);
-
- // We do not want to keep going on forever, so we keep track of
- // how many times we tried
- try_count++;
- }
- while (hWnd != GetForegroundWindow() && try_count <= 3);
-
- // Restore the system minimize/restore animation setting
- setMinMaxAnimations(old_animate);
-
- // Try to modify the system settings (since this is now hopefully the
- // foreground process, we are probably allowed to do this)
- SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID) 0,
- SPIF_SENDCHANGE);
-}
-
-
//========================================================================
// Hide mouse cursor
//========================================================================
@@ -1071,9 +982,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
SWP_NOMOVE | SWP_NOSIZE);
}
- setForegroundWindow(window->Win32.handle);
- SetFocus(window->Win32.handle);
-
return GL_TRUE;
}
@@ -1193,6 +1101,28 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
}
+//========================================================================
+// Show or hide window
+//========================================================================
+
+void _glfwPlatformShowWindow(_GLFWwindow* window)
+{
+ ShowWindow(window->Win32.handle, SW_SHOWNORMAL);
+ BringWindowToTop(window->Win32.handle);
+ SetForegroundWindow(window->Win32.handle);
+ SetFocus(window->Win32.handle);
+}
+
+
+//========================================================================
+// Show or hide window
+//========================================================================
+
+void _glfwPlatformHideWindow(_GLFWwindow* window)
+{
+ ShowWindow(window->Win32.handle, SW_HIDE);
+}
+
//========================================================================
// Write back window parameters into GLFW window structure
//========================================================================
diff --git a/src/window.c b/src/window.c
index 4e95129a..efaa1572 100644
--- a/src/window.c
+++ b/src/window.c
@@ -318,6 +318,8 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
return GL_FALSE;
}
+ glfwShowWindow(window, 1); // TODO: consider if this is necessary!
+
// Cache the actual (as opposed to requested) window parameters
_glfwPlatformRefreshWindowParams(window);
@@ -623,6 +625,38 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow handle)
}
+//========================================================================
+// Window show
+//========================================================================
+
+GLFWAPI void glfwShowWindow(GLFWwindow window)
+{
+ if (!_glfwInitialized)
+ {
+ _glfwSetError(GLFW_NOT_INITIALIZED, NULL);
+ return;
+ }
+
+ _glfwPlatformShowWindow((_GLFWwindow*)window);
+}
+
+
+//========================================================================
+// Window hide
+//========================================================================
+
+GLFWAPI void glfwHideWindow(GLFWwindow window)
+{
+ if (!_glfwInitialized)
+ {
+ _glfwSetError(GLFW_NOT_INITIALIZED, NULL);
+ return;
+ }
+
+ _glfwPlatformHideWindow((_GLFWwindow*)window);
+}
+
+
//========================================================================
// Window un-iconification
//========================================================================
diff --git a/src/x11_window.c b/src/x11_window.c
index 442e76c0..90938ccb 100644
--- a/src/x11_window.c
+++ b/src/x11_window.c
@@ -230,10 +230,6 @@ static GLboolean createWindow(_GLFWwindow* window,
_glfwPlatformSetWindowTitle(window, wndconfig->title);
- // Make sure the window is mapped before proceeding
- XMapWindow(_glfwLibrary.X11.display, window->X11.handle);
- XFlush(_glfwLibrary.X11.display);
-
return GL_TRUE;
}
@@ -1099,6 +1095,28 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
}
+//========================================================================
+// Show window
+//========================================================================
+
+void _glfwPlatformShowWindow(_GLFWwindow* window)
+{
+ XMapRaised(_glfwLibrary.X11.display, window->X11.handle);
+ XFlush(_glfwLibrary.X11.display);
+}
+
+
+//========================================================================
+// Hide window
+//========================================================================
+
+void _glfwPlatformHideWindow(_GLFWwindow* window)
+{
+ XUnmapWindow(_glfwLibrary.X11.display, window->X11.handle);
+ XFlush(_glfwLibrary.X11.display);
+}
+
+
//========================================================================
// Read back framebuffer parameters from the context
//========================================================================
From a2ca095b869c0c8255cf678e354f44a4aac87120 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 21 Aug 2012 20:28:36 +0200
Subject: [PATCH 02/10] Renamed GLFW_WINDOW_RESIZABLE to GLFW_RESIZABLE.
This matches GLFW_ACTIVE and GLFW_ICONIFIED.
---
examples/heightmap.c | 2 +-
include/GL/glfw3.h | 14 +++++++-------
readme.html | 2 +-
src/window.c | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/examples/heightmap.c b/examples/heightmap.c
index fce8b8de..5139a493 100644
--- a/examples/heightmap.c
+++ b/examples/heightmap.c
@@ -581,7 +581,7 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE);
}
- glfwWindowHint(GLFW_WINDOW_RESIZABLE, GL_FALSE);
+ glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h
index 79b6033a..5472f8b1 100644
--- a/include/GL/glfw3.h
+++ b/include/GL/glfw3.h
@@ -405,18 +405,18 @@ extern "C" {
#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
#define GLFW_AUX_BUFFERS 0x0002100B
#define GLFW_STEREO 0x0002100C
-#define GLFW_WINDOW_RESIZABLE 0x0002100D
#define GLFW_FSAA_SAMPLES 0x0002100E
/* The following constants are used with both glfwGetWindowParam
* and glfwWindowHint
*/
-#define GLFW_OPENGL_VERSION_MAJOR 0x0002100F
-#define GLFW_OPENGL_VERSION_MINOR 0x00021010
-#define GLFW_OPENGL_FORWARD_COMPAT 0x00021011
-#define GLFW_OPENGL_DEBUG_CONTEXT 0x00021012
-#define GLFW_OPENGL_PROFILE 0x00021013
-#define GLFW_OPENGL_ROBUSTNESS 0x00021014
+#define GLFW_OPENGL_VERSION_MAJOR 0x00022000
+#define GLFW_OPENGL_VERSION_MINOR 0x00022001
+#define GLFW_OPENGL_FORWARD_COMPAT 0x00022002
+#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022003
+#define GLFW_OPENGL_PROFILE 0x00022004
+#define GLFW_OPENGL_ROBUSTNESS 0x00022005
+#define GLFW_RESIZABLE 0x00022006
/* GLFW_OPENGL_ROBUSTNESS mode tokens */
#define GLFW_OPENGL_NO_ROBUSTNESS 0x00000000
diff --git a/readme.html b/readme.html
index 39d0739b..580e21cd 100644
--- a/readme.html
+++ b/readme.html
@@ -296,7 +296,7 @@ version of GLFW.
Renamed glfw.h
to glfw3.h
to avoid conflicts with 2.x series
Renamed glfwOpenWindowHint
to glfwWindowHint
Renamed GLFW_WINDOW
token to GLFW_WINDOWED
- Renamed GLFW_WINDOW_NO_RESIZE
to GLFW_WINDOW_RESIZABLE
+ Renamed GLFW_WINDOW_NO_RESIZE
to GLFW_RESIZABLE
Renamed GLFW_BUILD_DLL
to _GLFW_BUILD_DLL
Renamed version
test to glfwinfo
Renamed GLFW_NO_GLU
to GLFW_INCLUDE_GLU
and made it disabled by default
diff --git a/src/window.c b/src/window.c
index efaa1572..81b0492c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -410,7 +410,7 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_STEREO:
_glfwLibrary.hints.stereo = hint;
break;
- case GLFW_WINDOW_RESIZABLE:
+ case GLFW_RESIZABLE:
_glfwLibrary.hints.resizable = hint;
break;
case GLFW_FSAA_SAMPLES:
@@ -705,7 +705,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
return window->closeRequested;
case GLFW_REFRESH_RATE:
return window->refreshRate;
- case GLFW_WINDOW_RESIZABLE:
+ case GLFW_RESIZABLE:
return window->resizable;
case GLFW_OPENGL_VERSION_MAJOR:
return window->glMajor;
From 3d2722dc4c638e7c3af9fea0c58a208cee1a3944 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 21 Aug 2012 20:32:44 +0200
Subject: [PATCH 03/10] Fixed broken call to glfwShowWindow.
---
src/window.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/window.c b/src/window.c
index 81b0492c..4f8a96e6 100644
--- a/src/window.c
+++ b/src/window.c
@@ -318,7 +318,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
return GL_FALSE;
}
- glfwShowWindow(window, 1); // TODO: consider if this is necessary!
+ glfwShowWindow(window);
// Cache the actual (as opposed to requested) window parameters
_glfwPlatformRefreshWindowParams(window);
From 8bb5c59d2d01ccc6e1247b5680e7d962fb81de80 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 21 Aug 2012 21:18:09 +0200
Subject: [PATCH 04/10] Added GLFW_VISIBLE window hint and parameter.
---
include/GL/glfw3.h | 1 +
readme.html | 1 +
src/cocoa_window.m | 16 ++++++++++++++++
src/internal.h | 4 ++++
src/win32_window.c | 6 ++++++
src/window.c | 22 +++++++++++++++++++---
src/x11_window.c | 2 ++
7 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h
index 5472f8b1..6f535408 100644
--- a/include/GL/glfw3.h
+++ b/include/GL/glfw3.h
@@ -417,6 +417,7 @@ extern "C" {
#define GLFW_OPENGL_PROFILE 0x00022004
#define GLFW_OPENGL_ROBUSTNESS 0x00022005
#define GLFW_RESIZABLE 0x00022006
+#define GLFW_VISIBLE 0x00022007
/* GLFW_OPENGL_ROBUSTNESS mode tokens */
#define GLFW_OPENGL_NO_ROBUSTNESS 0x00000000
diff --git a/readme.html b/readme.html
index 580e21cd..c6eedbf3 100644
--- a/readme.html
+++ b/readme.html
@@ -283,6 +283,7 @@ version of GLFW.
Added GLFW_OPENGL_ROBUSTNESS
window hint and associated strategy tokens for GL_ARB_robustness
support
Added GLFW_OPENGL_REVISION
window parameter to make up for removal of glfwGetGLVersion
Added GLFW_INCLUDE_GL3
macro for telling the GLFW header to include gl3.h
header instead of gl.h
+ Added GLFW_VISIBLE
window hint and parameter for controlling and polling window visibility
Added windows
simple multi-window test program
Added sharing
simple OpenGL object sharing test program
Added modes
video mode enumeration and setting test program
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index db6d07b8..0d62b0fa 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -131,6 +131,22 @@
return NSTerminateCancel;
}
+- (void)applicationDidHide:(NSNotification *)notification
+{
+ _GLFWwindow* window;
+
+ for (window = _glfwLibrary.windowListHead; window; window = window->next)
+ _glfwInputWindowVisibility(window, GL_FALSE);
+}
+
+- (void)applicationDidUnhide:(NSNotification *)notification
+{
+ _GLFWwindow* window;
+
+ for (window = _glfwLibrary.windowListHead; window; window = window->next)
+ _glfwInputWindowVisibility(window, GL_TRUE);
+}
+
@end
diff --git a/src/internal.h b/src/internal.h
index 1bad7483..8e923d50 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -109,6 +109,7 @@ struct _GLFWhints
int auxBuffers;
GLboolean stereo;
GLboolean resizable;
+ GLboolean visible;
int samples;
int glMajor;
int glMinor;
@@ -131,6 +132,7 @@ struct _GLFWwndconfig
const char* title;
int refreshRate;
GLboolean resizable;
+ GLboolean visible;
int glMajor;
int glMinor;
GLboolean glForward;
@@ -181,6 +183,7 @@ struct _GLFWwindow
int positionX, positionY;
int mode; // GLFW_WINDOW or GLFW_FULLSCREEN
GLboolean resizable; // GL_TRUE if user may resize this window
+ GLboolean visible; // GL_TRUE if this window is visible
int refreshRate; // monitor refresh rate
void* userPointer;
@@ -338,6 +341,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean activated);
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y);
void _glfwInputWindowSize(_GLFWwindow* window, int width, int height);
void _glfwInputWindowIconify(_GLFWwindow* window, int iconified);
+void _glfwInputWindowVisibility(_GLFWwindow* window, int visible);
void _glfwInputWindowDamage(_GLFWwindow* window);
void _glfwInputWindowCloseRequest(_GLFWwindow* window);
diff --git a/src/win32_window.c b/src/win32_window.c
index ff6941ab..b83d504a 100644
--- a/src/win32_window.c
+++ b/src/win32_window.c
@@ -418,6 +418,12 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
return 0;
}
+ case WM_SHOWWINDOW:
+ {
+ _glfwInputWindowVisibility(window, wParam ? GL_TRUE : GL_FALSE);
+ break;
+ }
+
case WM_SYSCOMMAND:
{
switch (wParam & 0xfff0)
diff --git a/src/window.c b/src/window.c
index 4f8a96e6..7e928cf2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -82,8 +82,9 @@ void _glfwSetDefaultWindowHints(void)
_glfwLibrary.hints.glMajor = 1;
_glfwLibrary.hints.glMinor = 0;
- // The default is to allow window resizing
+ // The default is to show the window and allow window resizing
_glfwLibrary.hints.resizable = GL_TRUE;
+ _glfwLibrary.hints.visible = GL_TRUE;
}
@@ -176,6 +177,16 @@ void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
}
+//========================================================================
+// Register window visibility events
+//========================================================================
+
+void _glfwInputWindowVisibility(_GLFWwindow* window, int visible)
+{
+ window->visible = visible;
+}
+
+
//========================================================================
// Register window damage events
//========================================================================
@@ -246,6 +257,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
wndconfig.title = title;
wndconfig.refreshRate = Max(_glfwLibrary.hints.refreshRate, 0);
wndconfig.resizable = _glfwLibrary.hints.resizable ? GL_TRUE : GL_FALSE;
+ wndconfig.visible = _glfwLibrary.hints.visible ? GL_TRUE : GL_FALSE;
wndconfig.glMajor = _glfwLibrary.hints.glMajor;
wndconfig.glMinor = _glfwLibrary.hints.glMinor;
wndconfig.glForward = _glfwLibrary.hints.glForward ? GL_TRUE : GL_FALSE;
@@ -318,8 +330,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
return GL_FALSE;
}
- glfwShowWindow(window);
-
// Cache the actual (as opposed to requested) window parameters
_glfwPlatformRefreshWindowParams(window);
@@ -353,6 +363,9 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
+ if (wndconfig.visible)
+ glfwShowWindow(window);
+
return window;
}
@@ -413,6 +426,9 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_RESIZABLE:
_glfwLibrary.hints.resizable = hint;
break;
+ case GLFW_VISIBLE:
+ _glfwLibrary.hints.visible = hint;
+ break;
case GLFW_FSAA_SAMPLES:
_glfwLibrary.hints.samples = hint;
break;
diff --git a/src/x11_window.c b/src/x11_window.c
index 90938ccb..b4d62605 100644
--- a/src/x11_window.c
+++ b/src/x11_window.c
@@ -736,6 +736,7 @@ static void processSingleEvent(void)
return;
}
+ _glfwInputWindowVisibility(window, GL_TRUE);
_glfwInputWindowIconify(window, GL_FALSE);
break;
}
@@ -750,6 +751,7 @@ static void processSingleEvent(void)
return;
}
+ _glfwInputWindowVisibility(window, GL_FALSE);
_glfwInputWindowIconify(window, GL_TRUE);
break;
}
From 85576bcb453762008f9c2e609ec310f3a3f85ebd Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 21 Aug 2012 21:19:30 +0200
Subject: [PATCH 05/10] Added credit.
---
readme.html | 3 +++
1 file changed, 3 insertions(+)
diff --git a/readme.html b/readme.html
index c6eedbf3..dd80672e 100644
--- a/readme.html
+++ b/readme.html
@@ -926,6 +926,9 @@ their skills. Special thanks go out to:
Arturo J. PĂ©rez, for a bug fix for cursor tracking on Mac OS X 10.6 Snow
Leopard
+ Riku Salminen, for the initial implementation of
+ glfwShowWindow
and glfwHideWindow
+
Douglas C. Schmidt and Irfan Pyarali, for their excellent article
Strategies for Implementing POSIX Condition Variables on Win32
From b665903e14df43f9ca0b9fa8835cabfc022b3bd4 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 21 Aug 2012 21:19:33 +0200
Subject: [PATCH 06/10] Added testing of glfwShowWindow and GLFW_VISIBLE.
---
tests/windows.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/windows.c b/tests/windows.c
index 894febeb..f4c74bfd 100644
--- a/tests/windows.c
+++ b/tests/windows.c
@@ -55,6 +55,8 @@ int main(void)
for (i = 0; i < 4; i++)
{
+ glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
+
windows[i] = glfwCreateWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
if (!windows[i])
{
@@ -71,6 +73,7 @@ int main(void)
0.f);
glfwSetWindowPos(windows[i], 100 + (i & 1) * 300, 100 + (i >> 1) * 300);
+ glfwShowWindow(windows[i]);
}
while (running)
From 0e63488b407f4f2f1d3ae99ea7b366fa647bcdec Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 21 Aug 2012 21:35:42 +0200
Subject: [PATCH 07/10] Cocoa window visibility fixes.
---
src/cocoa_window.m | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/cocoa_window.m b/src/cocoa_window.m
index 0d62b0fa..35bdd974 100644
--- a/src/cocoa_window.m
+++ b/src/cocoa_window.m
@@ -144,7 +144,10 @@
_GLFWwindow* window;
for (window = _glfwLibrary.windowListHead; window; window = window->next)
- _glfwInputWindowVisibility(window, GL_TRUE);
+ {
+ if ([window->NS.object isVisible])
+ _glfwInputWindowVisibility(window, GL_TRUE);
+ }
}
@end
@@ -1052,6 +1055,7 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
void _glfwPlatformShowWindow(_GLFWwindow* window)
{
[window->NS.object makeKeyAndOrderFront:nil];
+ _glfwInputWindowVisibility(window, GL_TRUE);
}
@@ -1062,6 +1066,7 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
[window->NS.object orderOut:nil];
+ _glfwInputWindowVisibility(window, GL_FALSE);
}
//========================================================================
From f6a1bbf782a0fd3e6e460997c3cea529bb85868f Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 21 Aug 2012 21:57:13 +0200
Subject: [PATCH 08/10] Added GLFW_VISIBLE to glfwWindowParam.
---
src/window.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/window.c b/src/window.c
index 7e928cf2..2507dd5c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -723,6 +723,8 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
return window->refreshRate;
case GLFW_RESIZABLE:
return window->resizable;
+ case GLFW_VISIBLE:
+ return window->visible;
case GLFW_OPENGL_VERSION_MAJOR:
return window->glMajor;
case GLFW_OPENGL_VERSION_MINOR:
From f5bfe41456d6f4bfbe4c1ac4c5eb0ef23cc545c7 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 28 Aug 2012 17:52:22 +0200
Subject: [PATCH 09/10] Moved GLFW_VISIBLE hint use to glfwinfo.
---
tests/glfwinfo.c | 2 ++
tests/windows.c | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c
index 90fd329f..0019bf66 100644
--- a/tests/glfwinfo.c
+++ b/tests/glfwinfo.c
@@ -207,6 +207,8 @@ int main(int argc, char** argv)
if (strategy)
glfwWindowHint(GLFW_OPENGL_ROBUSTNESS, strategy);
+ glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
+
// We assume here that we stand a better chance of success by leaving all
// possible details of pixel format selection to GLFW
diff --git a/tests/windows.c b/tests/windows.c
index f4c74bfd..894febeb 100644
--- a/tests/windows.c
+++ b/tests/windows.c
@@ -55,8 +55,6 @@ int main(void)
for (i = 0; i < 4; i++)
{
- glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
-
windows[i] = glfwCreateWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
if (!windows[i])
{
@@ -73,7 +71,6 @@ int main(void)
0.f);
glfwSetWindowPos(windows[i], 100 + (i & 1) * 300, 100 + (i >> 1) * 300);
- glfwShowWindow(windows[i]);
}
while (running)
From d5ede068593638647eae61ce3984f20403927bb5 Mon Sep 17 00:00:00 2001
From: Camilla Berglund
Date: Tue, 28 Aug 2012 21:37:07 +0200
Subject: [PATCH 10/10] Removed WS_VISIBLE from creation flags.
---
src/win32_window.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/win32_window.c b/src/win32_window.c
index 5a74955e..13096073 100644
--- a/src/win32_window.c
+++ b/src/win32_window.c
@@ -753,7 +753,7 @@ static int createWindow(_GLFWwindow* window,
WCHAR* wideTitle;
// Set common window styles
- dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
+ dwStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
dwExStyle = WS_EX_APPWINDOW;
// Set window style, depending on fullscreen mode