[vlc-commits] vout_macosx: implemented support for resize, zoom, etc. events
Felix Paul Kühne
git at videolan.org
Mon Aug 8 20:52:47 CEST 2011
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Aug 8 20:52:43 2011 +0200| [4cfebf253b9bc0f7b0ffc35bfc153ec0c3781063] | committer: Felix Paul Kühne
vout_macosx: implemented support for resize, zoom, etc. events
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4cfebf253b9bc0f7b0ffc35bfc153ec0c3781063
---
modules/video_output/macosx.m | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 920f1ed..4034858 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -289,17 +289,51 @@ static int Control (vout_display_t *vd, int query, va_list ap)
{
case VOUT_DISPLAY_CHANGE_FULLSCREEN:
case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
+ {
+ /* todo */
+ return VLC_EGENERIC;
+ }
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
case VOUT_DISPLAY_CHANGE_ZOOM:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
- /* todo */
- return VLC_EGENERIC;
+ NSPoint topleftbase;
+ NSPoint topleftscreen;
+ NSRect new_frame;
+ const vout_display_cfg_t *cfg;
+ topleftbase.x = 0;
+ topleftbase.y = [[sys->glView window] frame].size.height;
+ topleftscreen = [[sys->glView 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 < [[sys->glView window] minSize].width)
+ i_width = [[sys->glView window] minSize].width;
+ if (i_height < [[sys->glView window] minSize].height)
+ i_height = [[sys->glView window] minSize].height;
+
+ if( i_height != [sys->glView frame].size.height || i_width != [sys->glView frame].size.width )
+ {
+ new_frame.size.width = [[sys->glView window] frame].size.width - [sys->glView frame].size.width + i_width;
+ new_frame.size.height = [[sys->glView window] frame].size.height - [sys->glView frame].size.height + i_height;
+
+ new_frame.origin.x = topleftscreen.x;
+ new_frame.origin.y = topleftscreen.y - new_frame.size.height;
+
+ [[sys->glView window] setFrame:new_frame display:YES animate:YES];
+ }
+ return VLC_SUCCESS;
}
+
case VOUT_DISPLAY_HIDE_MOUSE:
+ {
+ [NSCursor setHiddenUntilMouseMoves: YES];
return VLC_SUCCESS;
+ }
case VOUT_DISPLAY_GET_OPENGL:
{
More information about the vlc-commits
mailing list