Also hide the full screen controls when the mouse is over them.

* We just wait a little longer in this case, like 4.5s.
* Changed the code to only send the messages when needed, before they were
  being sent every 1.5s.
* However, this is untested as of yet, as the layout changes didn't allow me
  to run the MediaPlayer on my system. Will do so in a minute on another one.
This commit is contained in:
Axel Dörfler 2012-01-10 22:02:03 +01:00
parent 7dde214bc0
commit 7532547c06
3 changed files with 38 additions and 14 deletions

View File

@ -975,7 +975,8 @@ MainWin::MessageReceived(BMessage* msg)
if (fIsFullscreen) {
BPoint videoViewWhere;
if (msg->FindPoint("where", &videoViewWhere) == B_OK) {
if (!fControls->Frame().Contains(videoViewWhere)) {
if (msg->FindBool("force")
|| !fControls->Frame().Contains(videoViewWhere)) {
_ShowFullscreenControls(false);
// hide the mouse cursor until the user moves it
be_app->ObscureCursor();
@ -2333,6 +2334,7 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
return;
fShowsFullscreenControls = show;
fVideoView->SetFullscreenControlsVisible(show);
if (show) {
fControls->RemoveSelf();
@ -2341,6 +2343,7 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
fVideoView->AddChild(fControls);
if (fScaleFullscreenControls)
fControls->SetSymbolScale(1.5f);
while (fControls->IsHidden())
fControls->Show();
}
@ -2364,16 +2367,15 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
finalMessage.AddFloat("offset", originalY + moveDist);
finalMessage.AddBool("show", show);
PostMessage(&finalMessage, this);
} else {
if (!show) {
fControls->RemoveSelf();
fControls->MoveTo(fVideoView->Frame().left,
fVideoView->Frame().bottom + 1);
fBackground->AddChild(fControls);
fControls->SetSymbolScale(1.0f);
while (!fControls->IsHidden())
fControls->Hide();
}
} else if (!show) {
fControls->RemoveSelf();
fControls->MoveTo(fVideoView->Frame().left,
fVideoView->Frame().bottom + 1);
fBackground->AddChild(fControls);
fControls->SetSymbolScale(1.0f);
while (!fControls->IsHidden())
fControls->Hide();
}
}

View File

@ -31,6 +31,8 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
fOverlayMode(false),
fIsPlaying(false),
fIsFullscreen(false),
fFullscreenControlsVisible(false),
fSendHideCounter(0),
fLastMouseMove(system_time()),
fSubtitleBitmap(new SubtitleBitmap),
@ -127,9 +129,17 @@ VideoView::Pulse()
uint32 buttons;
GetMouse(&where, &buttons, false);
if (buttons == 0) {
BMessage message(M_HIDE_FULL_SCREEN_CONTROLS);
message.AddPoint("where", where);
Window()->PostMessage(&message, Window());
if (fFullscreenControlsVisible) {
if (fSendHideCounter == 0 || fSendHideCounter == 3) {
// Send after 1.5s and after 4.5s
BMessage message(M_HIDE_FULL_SCREEN_CONTROLS);
message.AddPoint("where", where);
if (fSendHideCounter > 0)
message.AddBool("force", true);
Window()->PostMessage(&message, Window());
}
fSendHideCounter++;
}
ConvertToScreen(&where);
set_mouse_position((int32)where.x, (int32)where.y);
@ -292,6 +302,15 @@ void
VideoView::SetFullscreen(bool fullScreen)
{
fIsFullscreen = fullScreen;
fSendHideCounter = 0;
}
void
VideoView::SetFullscreenControlsVisible(bool visible)
{
fFullscreenControlsVisible = visible;
fSendHideCounter = 0;
}

View File

@ -49,6 +49,7 @@ public:
void SetPlaying(bool playing);
void SetFullscreen(bool fullScreen);
void SetFullscreenControlsVisible(bool visible);
void SetVideoFrame(const BRect& frame);
void SetSubTitle(const char* text);
@ -68,6 +69,8 @@ private:
rgb_color fOverlayKeyColor;
bool fIsPlaying;
bool fIsFullscreen;
bool fFullscreenControlsVisible;
uint8 fSendHideCounter;
bigtime_t fLastMouseMove;
SubtitleBitmap* fSubtitleBitmap;