Added GLFW_AUTO_ICONIFY.

By default, full screen windows that lose focus will be iconified and
the video mode will be restored.  This makes it impossible to create
applications spanning multiple monitors.  The GLFW_AUTO_ICONIFY window
hint will allow users to disable this behavior.

Fixes #143.
This commit is contained in:
Camilla Berglund
2014-04-08 15:32:34 +02:00
parent 4fb5da75dc
commit 25e7ff1196
7 changed files with 43 additions and 18 deletions
+3
View File
@@ -152,6 +152,7 @@ struct _GLFWwndconfig
GLboolean resizable;
GLboolean visible;
GLboolean decorated;
GLboolean autoIconify;
_GLFWmonitor* monitor;
};
@@ -215,6 +216,7 @@ struct _GLFWwindow
GLboolean iconified;
GLboolean resizable;
GLboolean decorated;
GLboolean autoIconify;
GLboolean visible;
GLboolean closed;
void* userPointer;
@@ -319,6 +321,7 @@ struct _GLFWlibrary
GLboolean resizable;
GLboolean visible;
GLboolean decorated;
GLboolean autoIconify;
int samples;
GLboolean sRGB;
int refreshRate;
+2 -2
View File
@@ -436,7 +436,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->cursorMode != GLFW_CURSOR_NORMAL)
restoreCursor(window);
if (window->monitor)
if (window->monitor && window->autoIconify)
{
if (!iconified)
{
@@ -455,7 +455,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
if (window->cursorMode != GLFW_CURSOR_NORMAL)
_glfwPlatformApplyCursorMode(window);
if (window->monitor)
if (window->monitor && window->autoIconify)
_glfwSetVideoMode(window->monitor, &window->videoMode);
}
+13 -7
View File
@@ -173,6 +173,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
wndconfig.resizable = _glfw.hints.resizable ? GL_TRUE : GL_FALSE;
wndconfig.visible = _glfw.hints.visible ? GL_TRUE : GL_FALSE;
wndconfig.decorated = _glfw.hints.decorated ? GL_TRUE : GL_FALSE;
wndconfig.autoIconify = _glfw.hints.autoIconify ? GL_TRUE : GL_FALSE;
wndconfig.monitor = (_GLFWmonitor*) monitor;
// Set up desired context config
@@ -207,10 +208,11 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
window->videoMode.refreshRate = Max(_glfw.hints.refreshRate, 0);
}
window->monitor = wndconfig.monitor;
window->resizable = wndconfig.resizable;
window->decorated = wndconfig.decorated;
window->cursorMode = GLFW_CURSOR_NORMAL;
window->monitor = wndconfig.monitor;
window->resizable = wndconfig.resizable;
window->decorated = wndconfig.decorated;
window->autoIconify = wndconfig.autoIconify;
window->cursorMode = GLFW_CURSOR_NORMAL;
// Save the currently current context so it can be restored later
previous = _glfwPlatformGetCurrentContext();
@@ -267,9 +269,10 @@ void glfwDefaultWindowHints(void)
_glfw.hints.minor = 0;
// The default is a visible, resizable window with decorations
_glfw.hints.resizable = GL_TRUE;
_glfw.hints.visible = GL_TRUE;
_glfw.hints.decorated = GL_TRUE;
_glfw.hints.resizable = GL_TRUE;
_glfw.hints.visible = GL_TRUE;
_glfw.hints.decorated = GL_TRUE;
_glfw.hints.autoIconify = GL_TRUE;
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil
_glfw.hints.redBits = 8;
@@ -331,6 +334,9 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_DECORATED:
_glfw.hints.decorated = hint;
break;
case GLFW_AUTO_ICONIFY:
_glfw.hints.autoIconify = hint;
break;
case GLFW_VISIBLE:
_glfw.hints.visible = hint;
break;