From 811aedf9c24d12f9d79e624a13e643fd78b51a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 10 Sep 2010 10:07:13 +0000 Subject: [PATCH] New player windows returned from NewWindow() are not automatically shown anymore since the playlist restore changes. Unbreak opening a new player, let the application thread open it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38596 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/MainApp.cpp | 7 +++++++ src/apps/mediaplayer/MainApp.h | 1 + src/apps/mediaplayer/MainWin.cpp | 12 +++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/apps/mediaplayer/MainApp.cpp b/src/apps/mediaplayer/MainApp.cpp index 02329a812e..9d2213298b 100644 --- a/src/apps/mediaplayer/MainApp.cpp +++ b/src/apps/mediaplayer/MainApp.cpp @@ -273,6 +273,13 @@ void MainApp::MessageReceived(BMessage* message) { switch (message->what) { + case M_NEW_PLAYER: + { + MainWin* window = NewWindow(); + if (window != NULL) + window->Show(); + break; + } case M_PLAYER_QUIT: { // store the window settings of this instance diff --git a/src/apps/mediaplayer/MainApp.h b/src/apps/mediaplayer/MainApp.h index 8510e9cbad..997eb0d9de 100644 --- a/src/apps/mediaplayer/MainApp.h +++ b/src/apps/mediaplayer/MainApp.h @@ -29,6 +29,7 @@ enum { + M_NEW_PLAYER = 'nwpl', M_PLAYER_QUIT = 'plqt', M_SETTINGS = 'stng', diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index b0b61b7068..35743914a0 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -68,7 +68,6 @@ int MainWin::sNoVideoWidth = MIN_WIDTH; enum { M_DUMMY = 0x100, M_FILE_OPEN = 0x1000, - M_FILE_NEWPLAYER, M_FILE_INFO, M_FILE_PLAYLIST, M_FILE_CLOSE, @@ -700,9 +699,6 @@ MainWin::MessageReceived(BMessage* msg) } // menu item messages - case M_FILE_NEWPLAYER: - gMainApp->NewWindow(); - break; case M_FILE_OPEN: { BMessenger target(this); @@ -1364,8 +1360,10 @@ MainWin::_CreateMenu() fMenuBar->AddItem(fVideoMenu); fMenuBar->AddItem(fSettingsMenu); - fFileMenu->AddItem(new BMenuItem("New player"B_UTF8_ELLIPSIS, - new BMessage(M_FILE_NEWPLAYER), 'N')); + BMenuItem* item = new BMenuItem("New player"B_UTF8_ELLIPSIS, + new BMessage(M_NEW_PLAYER), 'N'); + fFileMenu->AddItem(item); + item->SetTarget(be_app); fFileMenu->AddSeparatorItem(); #if 0 @@ -1375,7 +1373,7 @@ MainWin::_CreateMenu() #else // Add recent files to "Open File" entry as sub-menu. BRecentFilesList recentFiles(10, false, NULL, kAppSig); - BMenuItem* item = new BMenuItem(recentFiles.NewFileListMenu( + item = new BMenuItem(recentFiles.NewFileListMenu( "Open file"B_UTF8_ELLIPSIS, new BMessage(B_REFS_RECEIVED), NULL, this, 10, false, NULL, 0, kAppSig), new BMessage(M_FILE_OPEN)); item->SetShortcut('O', 0);