mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-26 20:28:49 -05:00
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:
parent
4fb5da75dc
commit
25e7ff1196
|
@ -58,6 +58,8 @@ GLFW bundles a number of dependencies in the `deps/` directory.
|
||||||
- Added `empty` test program for verifying posting of empty events
|
- Added `empty` test program for verifying posting of empty events
|
||||||
- Added `glfwGetWindowFrameSize` for retrieving the size of the frame around
|
- Added `glfwGetWindowFrameSize` for retrieving the size of the frame around
|
||||||
the client area of a window
|
the client area of a window
|
||||||
|
- Added `GLFW_AUTO_ICONIFY` for controlling whether full screen windows
|
||||||
|
automatically iconify (and restore the previous video mode) on focus loss
|
||||||
- Added `GLFW_INCLUDE_ES31` for including the OpenGL ES 3.1 header
|
- Added `GLFW_INCLUDE_ES31` for including the OpenGL ES 3.1 header
|
||||||
- Added *partial and experimental* support for Wayland
|
- Added *partial and experimental* support for Wayland
|
||||||
- Bugfix: The debug context attribute was set from `GL_ARB_debug_output` even
|
- Bugfix: The debug context attribute was set from `GL_ARB_debug_output` even
|
||||||
|
|
|
@ -33,6 +33,14 @@ GLFW now supports querying the size, on each side, of the frame around the
|
||||||
client area of a window, with @ref glfwGetWindowFrameSize.
|
client area of a window, with @ref glfwGetWindowFrameSize.
|
||||||
|
|
||||||
|
|
||||||
|
@subsection news_31_autoiconify Multi-monitor installation support
|
||||||
|
|
||||||
|
GLFW now supports disabling auto-iconification of full screen windows with
|
||||||
|
[GLFW_AUTO_ICONIFY](@ref window_hints_wnd). This is intended for people
|
||||||
|
building multi-monitor installations, where you need windows to stay in full
|
||||||
|
screen despite losing focus.
|
||||||
|
|
||||||
|
|
||||||
@section news_30 New features in version 3.0
|
@section news_30 New features in version 3.0
|
||||||
|
|
||||||
@subsection news_30_cmake CMake build system
|
@subsection news_30_cmake CMake build system
|
||||||
|
|
|
@ -105,17 +105,21 @@ Hints that do not apply to a given type of window or context are ignored.
|
||||||
|
|
||||||
@subsection window_hints_wnd Window related hints
|
@subsection window_hints_wnd Window related hints
|
||||||
|
|
||||||
The `GLFW_RESIZABLE` hint specifies whether the window will be resizable *by the
|
The `GLFW_RESIZABLE` hint specifies whether the (windowed mode) window will be
|
||||||
user*. The window will still be resizable using the @ref glfwSetWindowSize
|
resizable *by the user*. The window will still be resizable using the @ref
|
||||||
function. This hint is ignored for full screen windows.
|
glfwSetWindowSize function. This hint is ignored for full screen windows.
|
||||||
|
|
||||||
The `GLFW_VISIBLE` hint specifies whether the window will be initially
|
The `GLFW_VISIBLE` hint specifies whether the (windowed mode) window will be
|
||||||
visible. This hint is ignored for full screen windows.
|
initially visible. This hint is ignored for full screen windows.
|
||||||
|
|
||||||
The `GLFW_DECORATED` hint specifies whether the window will have window
|
The `GLFW_DECORATED` hint specifies whether the (windowed mode) window will have
|
||||||
decorations such as a border, a close widget, etc. This hint is ignored for
|
window decorations such as a border, a close widget, etc. This hint is ignored
|
||||||
full screen windows. Note that even though a window may lack a close widget, it
|
for full screen windows. Note that even though a window may lack a close
|
||||||
is usually still possible for the user to generate close events.
|
widget, it is usually still possible for the user to generate close events.
|
||||||
|
|
||||||
|
The `GLFW_AUTO_ICONIFY` hint specifies whether the (full screen) window
|
||||||
|
will automatically iconify and restore the previous video mode on focus loss.
|
||||||
|
This hint is ignored for windowed mode windows.
|
||||||
|
|
||||||
|
|
||||||
@subsection window_hints_fb Framebuffer related hints
|
@subsection window_hints_fb Framebuffer related hints
|
||||||
|
@ -196,6 +200,7 @@ a robustness strategy.
|
||||||
| `GLFW_RESIZABLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
| `GLFW_RESIZABLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
||||||
| `GLFW_VISIBLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
| `GLFW_VISIBLE` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
||||||
| `GLFW_DECORATED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
| `GLFW_DECORATED` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
||||||
|
| `GLFW_AUTO_ICONIFY` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
||||||
| `GLFW_RED_BITS` | 8 | 0 to `INT_MAX` |
|
| `GLFW_RED_BITS` | 8 | 0 to `INT_MAX` |
|
||||||
| `GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` |
|
| `GLFW_GREEN_BITS` | 8 | 0 to `INT_MAX` |
|
||||||
| `GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` |
|
| `GLFW_BLUE_BITS` | 8 | 0 to `INT_MAX` |
|
||||||
|
|
|
@ -497,6 +497,7 @@ extern "C" {
|
||||||
#define GLFW_RESIZABLE 0x00020003
|
#define GLFW_RESIZABLE 0x00020003
|
||||||
#define GLFW_VISIBLE 0x00020004
|
#define GLFW_VISIBLE 0x00020004
|
||||||
#define GLFW_DECORATED 0x00020005
|
#define GLFW_DECORATED 0x00020005
|
||||||
|
#define GLFW_AUTO_ICONIFY 0x00020006
|
||||||
|
|
||||||
#define GLFW_RED_BITS 0x00021001
|
#define GLFW_RED_BITS 0x00021001
|
||||||
#define GLFW_GREEN_BITS 0x00021002
|
#define GLFW_GREEN_BITS 0x00021002
|
||||||
|
|
|
@ -152,6 +152,7 @@ struct _GLFWwndconfig
|
||||||
GLboolean resizable;
|
GLboolean resizable;
|
||||||
GLboolean visible;
|
GLboolean visible;
|
||||||
GLboolean decorated;
|
GLboolean decorated;
|
||||||
|
GLboolean autoIconify;
|
||||||
_GLFWmonitor* monitor;
|
_GLFWmonitor* monitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -215,6 +216,7 @@ struct _GLFWwindow
|
||||||
GLboolean iconified;
|
GLboolean iconified;
|
||||||
GLboolean resizable;
|
GLboolean resizable;
|
||||||
GLboolean decorated;
|
GLboolean decorated;
|
||||||
|
GLboolean autoIconify;
|
||||||
GLboolean visible;
|
GLboolean visible;
|
||||||
GLboolean closed;
|
GLboolean closed;
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
|
@ -319,6 +321,7 @@ struct _GLFWlibrary
|
||||||
GLboolean resizable;
|
GLboolean resizable;
|
||||||
GLboolean visible;
|
GLboolean visible;
|
||||||
GLboolean decorated;
|
GLboolean decorated;
|
||||||
|
GLboolean autoIconify;
|
||||||
int samples;
|
int samples;
|
||||||
GLboolean sRGB;
|
GLboolean sRGB;
|
||||||
int refreshRate;
|
int refreshRate;
|
||||||
|
|
|
@ -436,7 +436,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
||||||
restoreCursor(window);
|
restoreCursor(window);
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor && window->autoIconify)
|
||||||
{
|
{
|
||||||
if (!iconified)
|
if (!iconified)
|
||||||
{
|
{
|
||||||
|
@ -455,7 +455,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
if (window->cursorMode != GLFW_CURSOR_NORMAL)
|
||||||
_glfwPlatformApplyCursorMode(window);
|
_glfwPlatformApplyCursorMode(window);
|
||||||
|
|
||||||
if (window->monitor)
|
if (window->monitor && window->autoIconify)
|
||||||
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
_glfwSetVideoMode(window->monitor, &window->videoMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
src/window.c
20
src/window.c
|
@ -173,6 +173,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
|
||||||
wndconfig.resizable = _glfw.hints.resizable ? GL_TRUE : GL_FALSE;
|
wndconfig.resizable = _glfw.hints.resizable ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.visible = _glfw.hints.visible ? GL_TRUE : GL_FALSE;
|
wndconfig.visible = _glfw.hints.visible ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.decorated = _glfw.hints.decorated ? 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;
|
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
||||||
|
|
||||||
// Set up desired context config
|
// 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->videoMode.refreshRate = Max(_glfw.hints.refreshRate, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->monitor = wndconfig.monitor;
|
window->monitor = wndconfig.monitor;
|
||||||
window->resizable = wndconfig.resizable;
|
window->resizable = wndconfig.resizable;
|
||||||
window->decorated = wndconfig.decorated;
|
window->decorated = wndconfig.decorated;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->autoIconify = wndconfig.autoIconify;
|
||||||
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
|
|
||||||
// Save the currently current context so it can be restored later
|
// Save the currently current context so it can be restored later
|
||||||
previous = _glfwPlatformGetCurrentContext();
|
previous = _glfwPlatformGetCurrentContext();
|
||||||
|
@ -267,9 +269,10 @@ void glfwDefaultWindowHints(void)
|
||||||
_glfw.hints.minor = 0;
|
_glfw.hints.minor = 0;
|
||||||
|
|
||||||
// The default is a visible, resizable window with decorations
|
// The default is a visible, resizable window with decorations
|
||||||
_glfw.hints.resizable = GL_TRUE;
|
_glfw.hints.resizable = GL_TRUE;
|
||||||
_glfw.hints.visible = GL_TRUE;
|
_glfw.hints.visible = GL_TRUE;
|
||||||
_glfw.hints.decorated = 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
|
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil
|
||||||
_glfw.hints.redBits = 8;
|
_glfw.hints.redBits = 8;
|
||||||
|
@ -331,6 +334,9 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
||||||
case GLFW_DECORATED:
|
case GLFW_DECORATED:
|
||||||
_glfw.hints.decorated = hint;
|
_glfw.hints.decorated = hint;
|
||||||
break;
|
break;
|
||||||
|
case GLFW_AUTO_ICONIFY:
|
||||||
|
_glfw.hints.autoIconify = hint;
|
||||||
|
break;
|
||||||
case GLFW_VISIBLE:
|
case GLFW_VISIBLE:
|
||||||
_glfw.hints.visible = hint;
|
_glfw.hints.visible = hint;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user