[vlc-commits] macosx_vout: implemented a cleaner approach to limit the window size according to the screen it is displayed on (close #5875)

Felix Paul Kühne git at videolan.org
Sat Mar 3 13:03:47 CET 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Mar  3 13:02:36 2012 +0100| [7a5c65895f02d7fe127a64608677de716f0d8f55] | committer: Felix Paul Kühne

macosx_vout: implemented a cleaner approach to limit the window size according to the screen it is displayed on (close #5875)
(cherry picked from commit 68a4652d102431c548b700d89d04c6f567d245c6)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=7a5c65895f02d7fe127a64608677de716f0d8f55
---

 modules/video_output/macosx.m |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 214c1a1..b9b92d0 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -355,6 +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;
             NSSize windowMinSize = [o_window minSize];
 
             topleftbase.x = 0;
@@ -370,6 +371,12 @@ 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;



More information about the vlc-commits mailing list