mirror of
https://github.com/glfw/glfw.git
synced 2024-11-11 13:03:52 +00:00
Added GLFW_VISIBLE window hint and parameter.
This commit is contained in:
parent
3d2722dc4c
commit
8bb5c59d2d
@ -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
|
||||
|
@ -283,6 +283,7 @@ version of GLFW.</p>
|
||||
<li>Added <code>GLFW_OPENGL_ROBUSTNESS</code> window hint and associated strategy tokens for <code>GL_ARB_robustness</code> support</li>
|
||||
<li>Added <code>GLFW_OPENGL_REVISION</code> window parameter to make up for removal of <code>glfwGetGLVersion</code></li>
|
||||
<li>Added <code>GLFW_INCLUDE_GL3</code> macro for telling the GLFW header to include <code>gl3.h</code> header instead of <code>gl.h</code></li>
|
||||
<li>Added <code>GLFW_VISIBLE</code> window hint and parameter for controlling and polling window visibility</li>
|
||||
<li>Added <code>windows</code> simple multi-window test program</li>
|
||||
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
||||
<li>Added <code>modes</code> video mode enumeration and setting test program</li>
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
22
src/window.c
22
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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user