From ddf35356d3c342c697e80f84cc3b220b6abc3c9b Mon Sep 17 00:00:00 2001 From: David Fuhrmann <david.fuhrmann@googlemail.com> Date: Sun, 4 Mar 2012 12:41:33 +0100 Subject: [PATCH] macosx vout: show complete window if we would resize beyond screen bounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure that if we would resize beyond the screen we set the origin values to ensure that the complete window is visible. Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org> (cherry picked from commit 06f57d2bd7dd633d1ba731107b7cfc7048fc7e03) --- modules/video_output/macosx.m | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m index b9b92d0900..c8afeaf3cd 100644 --- a/modules/video_output/macosx.m +++ b/modules/video_output/macosx.m @@ -355,7 +355,7 @@ static int Control (vout_display_t *vd, int query, va_list ap) 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 screenSize = [[o_window screen] visibleFrame].size; + NSRect screenFrame = [[o_window screen] visibleFrame]; NSSize windowMinSize = [o_window minSize]; topleftbase.x = 0; @@ -371,12 +371,6 @@ static int Control (vout_display_t *vd, int query, va_list ap) if (i_height < windowMinSize.height) i_height = windowMinSize.height; - /* make sure the window doesn't exceed the screen size the window is on */ - if (i_width > screenSize.width) - i_width = screenSize.width; - if (i_height > screenSize.height) - i_height = screenSize.height; - if( i_height != glViewFrame.size.height || i_width != glViewFrame.size.width ) { new_frame.size.width = windowFrame.size.width - glViewFrame.size.width + i_width; @@ -385,6 +379,18 @@ static int Control (vout_display_t *vd, int query, va_list ap) new_frame.origin.x = topleftscreen.x; new_frame.origin.y = topleftscreen.y - new_frame.size.height; + /* make sure the window doesn't exceed the screen size the window is on */ + if( new_frame.size.width > screenFrame.size.width ) + { + new_frame.size.width = screenFrame.size.width; + new_frame.origin.x = screenFrame.origin.x; + } + if( new_frame.size.height > screenFrame.size.height ) + { + new_frame.size.height = screenFrame.size.height; + new_frame.origin.y = screenFrame.origin.y; + } + [sys->glView performSelectorOnMainThread:@selector(setWindowFrameWithValue:) withObject:[NSValue valueWithRect:new_frame] waitUntilDone:NO]; } [o_pool release]; -- 2.25.4