* Fixed some regressions I introduced. The video is now correctly layouted

again. Bute this commit seems to make the old bug that some parts of the GUI
  are black much more likely. Will look into it tomorrow.
* The calculations to move the window wholy into the screen frame were buggy.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34120 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-11-18 23:25:02 +00:00
parent 46776004f7
commit e337e55fdd
3 changed files with 46 additions and 33 deletions
+32 -30
View File
@@ -64,6 +64,32 @@ MainApp::MainApp()
{ {
mpSettings settings = Settings::CurrentSettings(); mpSettings settings = Settings::CurrentSettings();
fLastFilePanelFolder = settings.filePanelFolder; fLastFilePanelFolder = settings.filePanelFolder;
// Now tell the application roster, that we're interested
// in getting notifications of apps being launched or quit.
// In this way we are going to detect a media_server restart.
be_roster->StartWatching(BMessenger(this, this),
B_REQUEST_LAUNCHED | B_REQUEST_QUIT);
// we will keep track of the status of media_server
// and media_addon_server
fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
BAlert* alert = new BAlert("start_media_server",
"It appears the Media Server is not running.\n"
"Would you like to start it ?", "Quit", "Start Media Server", NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 0) {
PostMessage(B_QUIT_REQUESTED);
return;
}
launch_media_server();
fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
}
} }
@@ -116,32 +142,7 @@ MainApp::PlayerCount() const
void void
MainApp::ReadyToRun() MainApp::ReadyToRun()
{ {
// Now tell the application roster, that we're interested printf("MainApp::ReadyToRun()\n");
// in getting notifications of apps being launched or quit.
// In this way we are going to detect a media_server restart.
be_roster->StartWatching(BMessenger(this, this),
B_REQUEST_LAUNCHED | B_REQUEST_QUIT);
// we will keep track of the status of media_server
// and media_addon_server
fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
BAlert* alert = new BAlert("start_media_server",
"It appears the Media Server is not running.\n"
"Would you like to start it ?", "Quit", "Start Media Server", NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 0) {
PostMessage(B_QUIT_REQUESTED);
return;
}
launch_media_server();
fMediaServerRunning = be_roster->IsRunning(kMediaServerSig);
fMediaAddOnServerRunning = be_roster->IsRunning(kMediaServerAddOnSig);
}
// make sure we have at least one window open // make sure we have at least one window open
if (fPlayerCount == 0) { if (fPlayerCount == 0) {
MainWin* window = NewWindow(); MainWin* window = NewWindow();
@@ -150,10 +151,11 @@ MainApp::ReadyToRun()
return; return;
} }
BMessage lastPlaylistArchive; BMessage lastPlaylistArchive;
if (_RestoreCurrentPlaylist(&lastPlaylistArchive) == B_OK) if (_RestoreCurrentPlaylist(&lastPlaylistArchive) == B_OK) {
window->OpenPlaylist(&lastPlaylistArchive); lastPlaylistArchive.what = M_OPEN_PREVIOUS_PLAYLIST;
window->PostMessage(&lastPlaylistArchive);
window->Show(); } else
window->Show();
} }
// setup the settings window now, we need to have it // setup the settings window now, we need to have it
+3 -1
View File
@@ -46,7 +46,9 @@ enum {
M_SAVE_PANEL_RESULT = 'sprs', M_SAVE_PANEL_RESULT = 'sprs',
M_MEDIA_SERVER_STARTED = 'msst', M_MEDIA_SERVER_STARTED = 'msst',
M_MEDIA_SERVER_QUIT = 'msqt' M_MEDIA_SERVER_QUIT = 'msqt',
M_OPEN_PREVIOUS_PLAYLIST = 'oppp'
}; };
+11 -2
View File
@@ -218,6 +218,9 @@ MainWin::MainWin(bool isFirstWindow)
AddShortcut('y', B_COMMAND_KEY, new BMessage(B_UNDO)); AddShortcut('y', B_COMMAND_KEY, new BMessage(B_UNDO));
AddShortcut('z', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO)); AddShortcut('z', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
AddShortcut('y', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO)); AddShortcut('y', B_COMMAND_KEY | B_SHIFT_KEY, new BMessage(B_REDO));
Hide();
Show();
} }
@@ -384,6 +387,9 @@ MainWin::MessageReceived(BMessage* msg)
_RefsReceived(msg); _RefsReceived(msg);
} }
break; break;
case M_OPEN_PREVIOUS_PLAYLIST:
OpenPlaylist(msg);
break;
case B_UNDO: case B_UNDO:
case B_REDO: case B_REDO:
@@ -765,6 +771,9 @@ MainWin::OpenPlaylist(const BMessage* playlistArchive)
playlistLocker.Unlock(); playlistLocker.Unlock();
playlistArchive->FindInt64("position", (int64*)&fInitialSeekPosition); playlistArchive->FindInt64("position", (int64*)&fInitialSeekPosition);
if (IsHidden())
Show();
} }
@@ -1305,9 +1314,9 @@ MainWin::_ResizeWindow(int percent, bool useNoVideoWidth, bool stayOnScreen)
else if (frame.right > screenFrame.right) else if (frame.right > screenFrame.right)
offsetX = (int)(screenFrame.right - frame.right); offsetX = (int)(screenFrame.right - frame.right);
if (frame.top < screenFrame.top) if (frame.top < screenFrame.top)
offsetX = (int)(screenFrame.top - frame.top); offsetY = (int)(screenFrame.top - frame.top);
else if (frame.bottom > screenFrame.bottom) else if (frame.bottom > screenFrame.bottom)
offsetX = (int)(screenFrame.bottom - frame.bottom); offsetY = (int)(screenFrame.bottom - frame.bottom);
MoveBy(offsetX, offsetY); MoveBy(offsetX, offsetY);
} }
} }