Added window move handler to window delegate.

This commit is contained in:
Camilla Berglund 2010-09-17 00:25:09 +02:00
parent 03f20ef736
commit 5df4920184

View File

@ -74,6 +74,23 @@
window->windowSizeCallback(window, window->width, window->height); 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 - (void)windowDidMiniaturize:(NSNotification*)notification
{ {
window->iconified = GL_TRUE; window->iconified = GL_TRUE;