[320/906] fix position and content rect

This commit is contained in:
Julien Isorce 2009-03-07 03:13:38 +01:00 committed by Matthew Waters
parent b5778a90d7
commit 37b29ac10c

View file

@ -175,8 +175,8 @@ gst_gl_window_new (gint width, gint height)
pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
rect.origin.x = x;
rect.origin.y = y;
rect.origin.x = 0;
rect.origin.y = 0;
rect.size.width = width;
rect.size.height = height;
@ -184,6 +184,20 @@ gst_gl_window_new (gint width, gint height)
styleMask: (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask)
backing: NSBackingStoreBuffered defer: NO screen: nil gstWin: priv];
if (priv->internal_win_id) {
NSRect mainRect = [[NSScreen mainScreen] visibleFrame];
GST_DEBUG ("main screen rect: %d %d %d %d", (int) mainRect.origin.x, (int) mainRect.origin.y,
(int) mainRect.size.width, (int) mainRect.size.height);
NSRect windowRect = [priv->internal_win_id frame];
GST_DEBUG ("window rect: %d %d %d %d", (int) windowRect.origin.x, (int) windowRect.origin.y,
(int) windowRect.size.width, (int) windowRect.size.height);
windowRect.origin.x += x;
windowRect.origin.y += mainRect.size.height > y ? (mainRect.size.height - y) * 0.5 : y;
[priv->internal_win_id setFrame:windowRect display:NO];
}
[pool release];
return window;