mirror of
https://github.com/glfw/glfw.git
synced 2026-09-19 23:43:15 +00:00
Added GLFW_VISIBLE window hint and parameter.
This commit is contained in:
@@ -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)
|
||||
|
||||
+19
-3
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user