* Removed the 150ms delay before showing the window - the window is now always

opened only once the stream is ready. This fixes the random "open in audio
  position" of video files.
* Removed a call to _ShowIfNeeded() in _RefsReceived(); it doesn't seem to have
  any purpose.
* Center new video windows on screen.
* Call _ShowIfNeeded() after the window has been positioned and resized in
  _SetupWindow(). This fixes having the window jump around on screen after
  launch.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42352 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2011-07-01 00:05:29 +00:00
parent 0325a782f4
commit f74d4e95d9
1 changed files with 7 additions and 20 deletions

View File

@ -112,8 +112,6 @@ enum {
M_FILE_DELETE,
M_SHOW_IF_NEEDED,
M_SLIDE_CONTROLS,
M_FINISH_SLIDING_CONTROLS
};
@ -169,13 +167,10 @@ static const char* kDisabledSeekMessage = B_TRANSLATE("Drop files to play");
static const char* kApplicationName = B_TRANSLATE_SYSTEM_NAME(NAME);
//#define printf(a...)
MainWin::MainWin(bool isFirstWindow, BMessage* message)
:
BWindow(BRect(100, 100, 400, 300), kApplicationName, B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */),
B_ASYNCHRONOUS_CONTROLS),
fCreationTime(system_time()),
fInfoWin(NULL),
fPlaylistWindow(NULL),
@ -939,10 +934,6 @@ MainWin::MessageReceived(BMessage* msg)
_AdoptGlobalSettings();
break;
case M_SHOW_IF_NEEDED:
_ShowIfNeeded();
break;
case M_SLIDE_CONTROLS:
{
float offset;
@ -1094,12 +1085,6 @@ MainWin::OpenPlaylistItem(const PlaylistItemRef& item)
BString string;
string << "Opening '" << item->Name() << "'.";
fControls->SetDisabledString(string.String());
if (IsHidden()) {
BMessage showMessage(M_SHOW_IF_NEEDED);
BMessageRunner::StartSending(BMessenger(this), &showMessage,
150000, 1);
}
}
}
@ -1304,7 +1289,6 @@ MainWin::_RefsReceived(BMessage* message)
if (message->FindRect("window frame", &fNoVideoFrame) != B_OK)
fNoVideoFrame = BRect();
_ShowIfNeeded();
}
@ -1396,8 +1380,6 @@ MainWin::_SetupWindow()
}
_UpdateControlsEnabledStatus();
_ShowIfNeeded();
// Adopt the size and window layout if necessary
if (previousSourceWidth != fSourceWidth
|| previousSourceHeight != fSourceHeight
@ -1415,6 +1397,8 @@ MainWin::_SetupWindow()
}
}
_ShowIfNeeded();
fVideoView->MakeFocus();
}
@ -2320,13 +2304,16 @@ MainWin::_ToggleNoInterface()
void
MainWin::_ShowIfNeeded()
{
// Only proceed if the window is already running
if (find_thread(NULL) != Thread())
return;
if (!fHasVideo && fNoVideoFrame.IsValid()) {
MoveTo(fNoVideoFrame.LeftTop());
ResizeTo(fNoVideoFrame.Width(), fNoVideoFrame.Height());
}
} else if (fHasVideo && IsHidden())
CenterOnScreen();
fNoVideoFrame = BRect();
if (IsHidden()) {