mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00: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 `glfwGetWindowFrameSize` for retrieving the size of the frame around
|
||||
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 *partial and experimental* support for Wayland
|
||||
- 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.
|
||||
|
||||
|
||||
@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
|
||||
|
||||
@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
|
||||
|
||||
The `GLFW_RESIZABLE` hint specifies whether the window will be resizable *by the
|
||||
user*. The window will still be resizable using the @ref glfwSetWindowSize
|
||||
function. This hint is ignored for full screen windows.
|
||||
The `GLFW_RESIZABLE` hint specifies whether the (windowed mode) window will be
|
||||
resizable *by the user*. The window will still be resizable using the @ref
|
||||
glfwSetWindowSize function. This hint is ignored for full screen windows.
|
||||
|
||||
The `GLFW_VISIBLE` hint specifies whether the window will be initially
|
||||
visible. This hint is ignored for full screen windows.
|
||||
The `GLFW_VISIBLE` hint specifies whether the (windowed mode) window will be
|
||||
initially visible. This hint is ignored for full screen windows.
|
||||
|
||||
The `GLFW_DECORATED` hint specifies whether the window will have window
|
||||
decorations such as a border, a close widget, etc. This hint is ignored for
|
||||
full screen windows. Note that even though a window may lack a close widget, it
|
||||
is usually still possible for the user to generate close events.
|
||||
The `GLFW_DECORATED` hint specifies whether the (windowed mode) window will have
|
||||
window decorations such as a border, a close widget, etc. This hint is ignored
|
||||
for full screen windows. Note that even though a window may lack a close
|
||||
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
|
||||
@ -196,6 +200,7 @@ a robustness strategy.
|
||||
| `GLFW_RESIZABLE` | `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_AUTO_ICONIFY` | `GL_TRUE` | `GL_TRUE` or `GL_FALSE` |
|
||||
| `GLFW_RED_BITS` | 8 | 0 to `INT_MAX` |
|
||||
| `GLFW_GREEN_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_VISIBLE 0x00020004
|
||||
#define GLFW_DECORATED 0x00020005
|
||||
#define GLFW_AUTO_ICONIFY 0x00020006
|
||||
|
||||
#define GLFW_RED_BITS 0x00021001
|
||||
#define GLFW_GREEN_BITS 0x00021002
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
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.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;
|
||||
|
Loading…
Reference in New Issue
Block a user