Changed state attribs to direct access.

Changed the window states (focused, iconified and visible) to query the
system directly.

THIS IS A BREAKING CHANGE, although a fairly obscure one.  It affects
applications that both care about telling actual key events from
synthetic ones, and are implemented in a non-self-synchronizing way, and
that poll the GLFW_FOCUSED window attribute instead of using the window
focus callback.

If you maintain one of these, please feel free to drop me an email and
I'll help any way I can to transition your application to 3.1.

Fixes #189.
Fixes #204.
This commit is contained in:
Camilla Berglund
2014-12-26 12:25:48 +01:00
parent f9c1f85f02
commit 641761ddb0
8 changed files with 159 additions and 139 deletions
+15 -21
View File
@@ -226,25 +226,6 @@ static NSRect convertRectToBacking(_GLFWwindow* window, NSRect contentRect)
return NSTerminateCancel;
}
- (void)applicationDidHide:(NSNotification *)notification
{
_GLFWwindow* window;
for (window = _glfw.windowListHead; window; window = window->next)
_glfwInputWindowVisibility(window, GL_FALSE);
}
- (void)applicationDidUnhide:(NSNotification *)notification
{
_GLFWwindow* window;
for (window = _glfw.windowListHead; window; window = window->next)
{
if ([window->ns.object isVisible])
_glfwInputWindowVisibility(window, GL_TRUE);
}
}
- (void)applicationDidChangeScreenParameters:(NSNotification *) notification
{
_glfwInputMonitorChange();
@@ -1047,13 +1028,26 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
{
[window->ns.object orderFront:nil];
_glfwInputWindowVisibility(window, GL_TRUE);
}
void _glfwPlatformHideWindow(_GLFWwindow* window)
{
[window->ns.object orderOut:nil];
_glfwInputWindowVisibility(window, GL_FALSE);
}
int _glfwPlatformWindowFocused(_GLFWwindow* window)
{
return [window->ns.object isKeyWindow];
}
int _glfwPlatformWindowIconified(_GLFWwindow* window)
{
return [window->ns.object isMiniaturized];
}
int _glfwPlatformWindowVisible(_GLFWwindow* window)
{
return [window->ns.object isVisible];
}
void _glfwPlatformPollEvents(void)