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