changeset 35092:cc8276116e95

gl: support screen redraw on OSX. This is necessary to support e.g. the smooth fullscreen animations.
author reimar
date Thu, 13 Sep 2012 20:44:46 +0000
parents 9fcfc9c5f038
children 627492239a72
files libvo/osx_common.h libvo/osx_objc_common.h libvo/osx_objc_common.m libvo/vo_gl.c
diffstat 4 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/osx_common.h	Thu Sep 13 20:28:30 2012 +0000
+++ b/libvo/osx_common.h	Thu Sep 13 20:44:46 2012 +0000
@@ -24,6 +24,7 @@
 void config_movie_aspect(float config_aspect);
 void osx_foreground_hack(void);
 
+extern void (*vo_osx_redraw_func)(void);
 int vo_osx_init(void);
 int vo_osx_config(uint32_t, uint32_t, uint32_t);
 void vo_osx_uninit(void);
--- a/libvo/osx_objc_common.h	Thu Sep 13 20:28:30 2012 +0000
+++ b/libvo/osx_objc_common.h	Thu Sep 13 20:44:46 2012 +0000
@@ -62,6 +62,7 @@
 //window & rendering
 - (void) preinit;
 - (void) config:(uint32_t)width:(uint32_t)height:(uint32_t)flags;
+- (void) drawRect: (NSRect *) bounds;
 - (void) reshape;
 
 //vo control
--- a/libvo/osx_objc_common.m	Thu Sep 13 20:28:30 2012 +0000
+++ b/libvo/osx_objc_common.m	Thu Sep 13 20:44:46 2012 +0000
@@ -48,6 +48,8 @@
 static NSAutoreleasePool *autoreleasepool;
 static MPCommonOpenGLView *oglv;
 
+void (*vo_osx_redraw_func)(void);
+
 int vo_osx_init(void)
 {
     autoreleasepool = [[NSAutoreleasePool alloc] init];
@@ -210,6 +212,11 @@
 		[window makeKeyAndOrderFront:self];
 }
 
+- (void) drawRect: (NSRect *) bounds
+{
+	if (vo_osx_redraw_func) vo_osx_redraw_func();
+}
+
 - (void)reshape
 {
 	NSRect frame = [self frame];
--- a/libvo/vo_gl.c	Thu Sep 13 20:28:30 2012 +0000
+++ b/libvo/vo_gl.c	Thu Sep 13 20:44:46 2012 +0000
@@ -689,6 +689,14 @@
   return 0;
 }
 
+#ifdef CONFIG_GL_OSX
+static void osx_redraw(void)
+{
+  resize(vo_dwidth, vo_dheight);
+  redraw();
+}
+#endif
+
 /* connect to server, create and map window,
  * allocate colors and (shared) memory
  */
@@ -719,6 +727,9 @@
   }
   initGl(vo_dwidth, vo_dheight);
 
+#ifdef CONFIG_GL_OSX
+  vo_osx_redraw_func = osx_redraw;
+#endif
   return 0;
 }