[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:02:59 CET 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Sat Mar  3 13:02:36 2012 +0100| [68a4652d102431c548b700d89d04c6f567d245c6] | 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)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=68a4652d102431c548b700d89d04c6f567d245c6
---

 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 1537325..5e7ddee 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