From 37b29ac10c8c6131bdc18593409d90b7635e58b8 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Sat, 7 Mar 2009 03:13:38 +0100 Subject: [PATCH] [320/906] fix position and content rect --- gst-libs/gst/gl/gstglwindow_cocoa.m | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/gstglwindow_cocoa.m b/gst-libs/gst/gl/gstglwindow_cocoa.m index bd77bd08f6..16c32423a8 100644 --- a/gst-libs/gst/gl/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/gstglwindow_cocoa.m @@ -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;