Commit 7a5c6589 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx_vout: implemented a cleaner approach to limit the window size according...

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 68a4652d)
parent 11804d91
...@@ -355,6 +355,7 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -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 return VLC_SUCCESS; // this is okay, since the event will occur again when we have a window
NSRect windowFrame = [o_window frame]; NSRect windowFrame = [o_window frame];
NSRect glViewFrame = [sys->glView frame]; NSRect glViewFrame = [sys->glView frame];
NSSize screenSize = [[o_window screen] visibleFrame].size;
NSSize windowMinSize = [o_window minSize]; NSSize windowMinSize = [o_window minSize];
topleftbase.x = 0; topleftbase.x = 0;
...@@ -370,6 +371,12 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -370,6 +371,12 @@ static int Control (vout_display_t *vd, int query, va_list ap)
if (i_height < windowMinSize.height) if (i_height < windowMinSize.height)
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 ) 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.width = windowFrame.size.width - glViewFrame.size.width + i_width;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment