vlc/vlc-1.2 | branch: master | Felix Paul Kühne <[email protected]> | Tue Dec 20 00:36:19 2011 +0100| [bfcd282ab9c396a77238e490a87e7bdcf52522f1] | committer: Jean-Baptiste Kempf
macosx: further optimize the menu re-creation on 10.6+ (cherry picked from commit 6a8197f657f1ef74e358864209b1ed4db37ff078) Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=bfcd282ab9c396a77238e490a87e7bdcf52522f1 --- modules/gui/macosx/MainMenu.m | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m index 2ef270e..18cf9db 100644 --- a/modules/gui/macosx/MainMenu.m +++ b/modules/gui/macosx/MainMenu.m @@ -481,10 +481,8 @@ static VLCMainMenu *_o_sharedInstance = nil; if( [o_mi_screen hasSubmenu] ) { y = [[o_mi_screen submenu] numberOfItems] - 1; - msg_Dbg( VLCIntf, "%i items in submenu", y ); while( x != y ) { - msg_Dbg( VLCIntf, "removing item %i of %i", x, y ); [[o_mi_screen submenu] removeItemAtIndex: x]; x++; } @@ -927,12 +925,21 @@ static VLCMainMenu *_o_sharedInstance = nil; selector:(SEL)pf_callback { vlc_value_t val, val_list, text_list; - int i_type, i, i_nb_items; + int i_type, i; /* remove previous items */ - i_nb_items = [o_menu numberOfItems]; - for( i = 0; i < i_nb_items; i++ ) - [o_menu removeItemAtIndex: 0]; + if (OSX_LEOPARD) + { + int i_nb_items; + i_nb_items = [o_menu numberOfItems]; + for( i = 0; i < i_nb_items; i++ ) + [o_menu removeItemAtIndex: 0]; + } + else + { + /* this is more efficient then the legacy code, but 10.6+ only */ + [o_menu removeAllItems]; + } /* Check the type of the object variable */ i_type = var_Type( p_object, psz_variable ); _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
