mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 12:02:00 +00:00
Made active window state global.
This commit is contained in:
parent
dc5ba0643d
commit
ae57d13868
@ -153,7 +153,6 @@ typedef struct _GLFWwindow
|
||||
GLFWcharfun charCallback;
|
||||
|
||||
// Window settings and state
|
||||
GLboolean active; // GL_TRUE if this window is active
|
||||
GLboolean iconified; // GL_TRUE if this window is iconified
|
||||
GLboolean closed; // GL_TRUE if this window should be closed
|
||||
int width, height;
|
||||
@ -208,6 +207,7 @@ typedef struct _GLFWlibrary
|
||||
|
||||
_GLFWwindow* windowListHead;
|
||||
_GLFWwindow* currentWindow;
|
||||
_GLFWwindow* activeWindow;
|
||||
_GLFWwindow* cursorLockWindow;
|
||||
|
||||
_GLFW_PLATFORM_LIBRARY_STATE;
|
||||
|
@ -695,6 +695,9 @@ GLFWAPI void glfwCloseWindow(GLFWwindow window)
|
||||
if (window == _glfwLibrary.currentWindow)
|
||||
glfwMakeWindowCurrent(NULL);
|
||||
|
||||
if (window == _glfwLibrary.activeWindow)
|
||||
_glfwLibrary.activeWindow = NULL;
|
||||
|
||||
_glfwPlatformCloseWindow(window);
|
||||
|
||||
prev = &_glfwLibrary.windowListHead;
|
||||
@ -900,7 +903,7 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param)
|
||||
switch (param)
|
||||
{
|
||||
case GLFW_ACTIVE:
|
||||
return window->active;
|
||||
return window == _glfwLibrary.activeWindow;
|
||||
case GLFW_ICONIFIED:
|
||||
return window->iconified;
|
||||
case GLFW_ACCELERATED:
|
||||
|
@ -1321,7 +1321,7 @@ static void processSingleEvent(void)
|
||||
return;
|
||||
}
|
||||
|
||||
window->active = GL_TRUE;
|
||||
_glfwLibrary.activeWindow = window;
|
||||
|
||||
if (_glfwLibrary.cursorLockWindow == window)
|
||||
_glfwPlatformHideMouseCursor(window);
|
||||
@ -1339,7 +1339,9 @@ static void processSingleEvent(void)
|
||||
return;
|
||||
}
|
||||
|
||||
window->active = GL_FALSE;
|
||||
if (_glfwLibrary.activeWindow == window)
|
||||
_glfwLibrary.activeWindow = NULL;
|
||||
|
||||
_glfwInputDeactivation(window);
|
||||
|
||||
if (_glfwLibrary.cursorLockWindow == window)
|
||||
@ -1506,6 +1508,9 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window)
|
||||
if (window->mode == GLFW_FULLSCREEN)
|
||||
leaveFullscreenMode(window);
|
||||
|
||||
if (_glfwLibrary.activeWindow == window)
|
||||
_glfwLibrary.activeWindow = NULL;
|
||||
|
||||
if (window->GLX.context)
|
||||
{
|
||||
// Release and destroy the context
|
||||
|
Loading…
Reference in New Issue
Block a user