mirror of
https://github.com/glfw/glfw.git
synced 2024-11-11 13:03:52 +00:00
Added window move handler to window delegate.
This commit is contained in:
parent
03f20ef736
commit
5df4920184
@ -74,6 +74,23 @@
|
||||
window->windowSizeCallback(window, window->width, window->height);
|
||||
}
|
||||
|
||||
- (void)windowDidMove:(NSNotification *)notification
|
||||
{
|
||||
[window->NSGL.context update];
|
||||
|
||||
NSRect contentRect =
|
||||
[window->NS.window contentRectForFrameRect:[window->NS.window frame]];
|
||||
|
||||
CGPoint mainScreenOrigin = CGDisplayBounds(CGMainDisplayID()).origin;
|
||||
double mainScreenHeight = CGDisplayBounds(CGMainDisplayID()).size.height;
|
||||
CGPoint flippedPos = CGPointMake(contentRect.origin.x - mainScreenOrigin.x,
|
||||
mainScreenHeight - contentRect.origin.y -
|
||||
mainScreenOrigin.y - window->height);
|
||||
|
||||
window->positionX = flippedPos.x;
|
||||
window->positionY = flippedPos.y;
|
||||
}
|
||||
|
||||
- (void)windowDidMiniaturize:(NSNotification*)notification
|
||||
{
|
||||
window->iconified = GL_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user