1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Made active window state global.

This commit is contained in:
Camilla Berglund 2010-09-11 15:14:57 +02:00
parent dc5ba0643d
commit ae57d13868
3 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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