Fixed hiding the mouse cursor after going full screen.

* This fixes a regression I introduced in hrev43648; the mouse cursor
  was only being hidden in case the controls were visible (ie. only
  after an extra mouse move in full screen).
This commit is contained in:
Axel Dörfler 2012-08-25 13:57:50 +02:00
parent 6912e7dc03
commit c95601d728
2 changed files with 11 additions and 2 deletions

View File

@ -32,6 +32,7 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
fIsPlaying(false),
fIsFullscreen(false),
fFullscreenControlsVisible(false),
fFirstAfterFullscreen(false),
fSendHideCounter(0),
fLastMouseMove(system_time()),
@ -115,6 +116,9 @@ VideoView::MessageReceived(BMessage* message)
}
/*!
Disables the screen saver, and hides the full screen controls.
*/
void
VideoView::Pulse()
{
@ -124,12 +128,13 @@ VideoView::Pulse()
bigtime_t now = system_time();
if (now - fLastMouseMove > 1500000) {
fLastMouseMove = now;
// take care of disabling the screen saver
BPoint where;
uint32 buttons;
GetMouse(&where, &buttons, false);
if (buttons == 0) {
if (fFullscreenControlsVisible) {
// Hide the full screen controls (and the mouse pointer)
// after a while
if (fFullscreenControlsVisible || fFirstAfterFullscreen) {
if (fSendHideCounter == 0 || fSendHideCounter == 3) {
// Send after 1.5s and after 4.5s
BMessage message(M_HIDE_FULL_SCREEN_CONTROLS);
@ -139,8 +144,10 @@ VideoView::Pulse()
Window()->PostMessage(&message, Window());
}
fSendHideCounter++;
fFirstAfterFullscreen = false;
}
// Take care of disabling the screen saver
ConvertToScreen(&where);
set_mouse_position((int32)where.x, (int32)where.y);
}
@ -303,6 +310,7 @@ VideoView::SetFullscreen(bool fullScreen)
{
fIsFullscreen = fullScreen;
fSendHideCounter = 0;
fFirstAfterFullscreen = true;
}

View File

@ -70,6 +70,7 @@ private:
bool fIsPlaying;
bool fIsFullscreen;
bool fFullscreenControlsVisible;
bool fFirstAfterFullscreen;
uint8 fSendHideCounter;
bigtime_t fLastMouseMove;