[vlc-commits] vout_macosx: reshape if screen configuration was changed by the user ( close #8151)

Felix Paul Kühne git at videolan.org
Thu Mar 7 21:07:39 CET 2013


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Mar  7 21:07:14 2013 +0100| [e8c5e23eaf621bb5c23c63ebc36eaca2c32b170c] | committer: Felix Paul Kühne

vout_macosx: reshape if screen configuration was changed by the user (close #8151)

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

 modules/video_output/macosx.m |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index b9a20f5..5fa24a7 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -503,10 +503,25 @@ static void OpenglSwap (vlc_gl_t *gl)
     GLint params[] = { 1 };
     CGLSetParameter ([[self openGLContext] CGLContextObj], kCGLCPSwapInterval, params);
 
+    [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationDidChangeScreenParametersNotification
+                                                      object:[NSApplication sharedApplication]
+                                                       queue:nil
+                                                  usingBlock:^(NSNotification *notification) {
+                                                      [self performSelectorOnMainThread:@selector(reshape)
+                                                                             withObject:nil
+                                                                          waitUntilDone:NO];
+                                                  }];
+
     [self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
     return self;
 }
 
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    [super dealloc];
+}
+
 /**
  * Gets called by the Open() method.
  */



More information about the vlc-commits mailing list