changeset 35091:9fcfc9c5f038

gl OSX backend: Detect and pass on resize events
author reimar
date Thu, 13 Sep 2012 20:28:30 +0000
parents bfc7f38d3008
children cc8276116e95
files libvo/osx_objc_common.h libvo/osx_objc_common.m libvo/vo_corevideo.m
diffstat 3 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/osx_objc_common.h	Thu Sep 13 20:12:23 2012 +0000
+++ b/libvo/osx_objc_common.h	Thu Sep 13 20:28:30 2012 +0000
@@ -49,6 +49,8 @@
 	//timestamps for disabling screensaver and mouse hiding
 	int lastMouseHide;
 	int lastScreensaverUpdate;
+
+	int event_flags;
 @public
 	float winSizeMult;
 }
@@ -60,6 +62,7 @@
 //window & rendering
 - (void) preinit;
 - (void) config:(uint32_t)width:(uint32_t)height:(uint32_t)flags;
+- (void) reshape;
 
 //vo control
 - (void) fullscreen: (BOOL) animate;
@@ -81,7 +84,7 @@
 - (void) otherMouseUp: (NSEvent *) theEvent;
 - (void) scrollWheel: (NSEvent *) theEvent;
 - (void) mouseEvent: (NSEvent *) theEvent;
-- (void) check_events;
+- (int) check_events;
 
 - (void) update_screen_info;
 @end
--- a/libvo/osx_objc_common.m	Thu Sep 13 20:12:23 2012 +0000
+++ b/libvo/osx_objc_common.m	Thu Sep 13 20:28:30 2012 +0000
@@ -88,8 +88,7 @@
 
 int vo_osx_check_events(void)
 {
-    [oglv check_events];
-    return 0;
+    return [oglv check_events];
 }
 
 void vo_osx_update_xinerama_info(void)
@@ -211,6 +210,14 @@
 		[window makeKeyAndOrderFront:self];
 }
 
+- (void)reshape
+{
+	NSRect frame = [self frame];
+	vo_dwidth  = frame.size.width;
+	vo_dheight = frame.size.height;
+	event_flags |= VO_EVENT_RESIZE;
+}
+
 /*
 	Init Menu
 */
@@ -430,7 +437,7 @@
 /*
 	Check event for new event
 */
-- (void) check_events
+- (int) check_events
 {
 	NSEvent *event;
 	int curTime = TickCount()/60;
@@ -454,9 +461,10 @@
 		lastScreensaverUpdate = curTime;
 	}
 
+	event_flags = 0;
 	event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSEventTrackingRunLoopMode dequeue:YES];
 	if (event == nil)
-		return;
+		return event_flags;
 	[NSApp sendEvent:event];
 	// Without SDL's bootstrap code (include SDL.h in mplayer.c),
 	// on Leopard, we have trouble to get the play window automatically focused
@@ -468,6 +476,7 @@
 		[window makeKeyAndOrderFront:self];
 	}
 #endif
+	return event_flags;
 }
 
 /*
--- a/libvo/vo_corevideo.m	Thu Sep 13 20:12:23 2012 +0000
+++ b/libvo/vo_corevideo.m	Thu Sep 13 20:28:30 2012 +0000
@@ -481,9 +481,7 @@
 {
 	int d_width, d_height;
 
-	NSRect frame = [self frame];
-	vo_dwidth  = frame.size.width;
-	vo_dheight = frame.size.height;
+	[super reshape];
 
 	glViewport(0, 0, vo_dwidth, vo_dheight);
 	glMatrixMode(GL_PROJECTION);