+ NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
+ NSPoint topleftbase;
+ NSPoint topleftscreen;
+ NSRect new_frame;
+ const vout_display_cfg_t *cfg;
+
+ id o_window = [sys->glView window];
+ if (!o_window)
+ return VLC_SUCCESS; // this is okay, since the event will occur again when we have a window
+ NSRect windowFrame = [o_window frame];
+ NSRect glViewFrame = [sys->glView frame];
+ NSSize windowMinSize = [o_window minSize];
+
+ topleftbase.x = 0;
+ topleftbase.y = windowFrame.size.height;
+ topleftscreen = [o_window convertBaseToScreen: topleftbase];
+ cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *);
+ int i_width = cfg->display.width;
+ int i_height = cfg->display.height;
+
+ /* Calculate the window's new size, if it is larger than our minimal size */
+ if (i_width < windowMinSize.width)
+ i_width = windowMinSize.width;
+ if (i_height < windowMinSize.height)
+ i_height = windowMinSize.height;
+
+ if( i_height != glViewFrame.size.height || i_width != glViewFrame.size.width )
+ {
+ new_frame.size.width = windowFrame.size.width - glViewFrame.size.width + i_width;
+ new_frame.size.height = windowFrame.size.height - glViewFrame.size.height + i_height;
+
+ new_frame.origin.x = topleftscreen.x;
+ new_frame.origin.y = topleftscreen.y - new_frame.size.height;
+
+ [sys->glView performSelectorOnMainThread:@selector(setWindowFrameWithValue:) withObject:[NSValue valueWithRect:new_frame] waitUntilDone:NO];
+ }
+ [o_pool release];
+ return VLC_SUCCESS;