[vlc-commits] macosx: fix window ordering during startup (close #14486)

David Fuhrmann git at videolan.org
Sat Jun 20 12:40:41 CEST 2015


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Jun 20 11:57:14 2015 +0200| [9434662c9228278ccd18fd649e71fa809745a576] | committer: David Fuhrmann

macosx: fix window ordering during startup (close #14486)

According to docu, application:willFinishLaunching: will be called
as one of the first steps of [NSApp run], before the main loop
will be actually started. Thus, it should make no performance
difference if we load the main window already in openIntf().

For some unknown reasons, a direct call to makeKeyAndOrderFront
works in run(), but not in app:willFinishLaunching:, though.

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

 modules/gui/macosx/intf.m |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index dc56363..1239e2d 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -132,6 +132,9 @@ int OpenIntf (vlc_object_t *p_this)
 
     [NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
 
+    [NSBundle loadNibNamed:@"MainWindow" owner: [VLCMain sharedInstance]];
+    [[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil];
+
     [o_pool release];
     return VLC_SUCCESS;
 }
@@ -769,12 +772,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     items_at_launch = p_playlist->p_local_category->i_children;
     PL_UNLOCK;
 
-    [NSBundle loadNibNamed:@"MainWindow" owner: self];
-
-    // This cannot be called directly here, as the main loop is not running yet so it would have no effect.
-    // So lets enqueue it into the loop for later execution.
-    [o_mainwindow performSelector:@selector(makeKeyAndOrderFront:) withObject:nil afterDelay:0];
-
 #ifdef HAVE_SPARKLE
     [[SUUpdater sharedUpdater] setDelegate:self];
 #endif



More information about the vlc-commits mailing list