* Auto hide the mouse after 5 seconds.

* Disable the screen saver when playing in full screen mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30797 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-05-18 21:13:23 +00:00
parent 8e151a5da5
commit 18b1ca6bbe
4 changed files with 57 additions and 6 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ Application MediaPlayer :
AudioResampler.cpp AudioResampler.cpp
AudioSupplier.cpp AudioSupplier.cpp
AudioVolumeConverter.cpp AudioVolumeConverter.cpp
# media_node_framework/video # media_node_framework/video
VideoConsumer.cpp VideoConsumer.cpp
VideoProducer.cpp VideoProducer.cpp
@@ -104,7 +104,7 @@ Application MediaPlayer :
TransportControlGroup.cpp TransportControlGroup.cpp
VideoView.cpp VideoView.cpp
: be media tracker translation textencoding $(TARGET_LIBSTDC++) : be game media tracker translation textencoding $(TARGET_LIBSTDC++)
: MediaPlayer.rdef : MediaPlayer.rdef
; ;
+2
View File
@@ -1466,6 +1466,8 @@ MainWin::_ToggleFullscreen()
Show(); Show();
} }
fVideoView->SetFullscreen(fIsFullscreen);
_MarkSettingsItem(M_TOGGLE_FULLSCREEN, fIsFullscreen); _MarkSettingsItem(M_TOGGLE_FULLSCREEN, fIsFullscreen);
printf("_ToggleFullscreen leave\n"); printf("_ToggleFullscreen leave\n");
+46 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright © 2006-2008 Stephan Aßmus <[email protected]> * Copyright © 2006-2009 Stephan Aßmus <[email protected]>
* All rights reserved. Distributed under the terms of the MIT license. * All rights reserved. Distributed under the terms of the MIT license.
*/ */
#include "VideoView.h" #include "VideoView.h"
@@ -18,13 +18,19 @@
#undef private #undef private
#endif #endif
#include <Application.h>
#include <WindowScreen.h>
#include "Settings.h" #include "Settings.h"
VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask) VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
: BView(frame, name, resizeMask, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), : BView(frame, name, resizeMask, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE
| B_PULSE_NEEDED),
fOverlayMode(false), fOverlayMode(false),
fIsPlaying(false), fIsPlaying(false),
fIsFullscreen(false),
fLastMouseMove(system_time()),
fGlobalSettingsListener(this) fGlobalSettingsListener(this)
{ {
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
@@ -84,6 +90,37 @@ VideoView::MessageReceived(BMessage* message)
} }
void
VideoView::Pulse()
{
if (!fIsFullscreen || !fIsPlaying)
return;
bigtime_t now = system_time();
if (now - fLastMouseMove > 5LL * 1000000) {
fLastMouseMove = now;
// take care of disabling the screen saver
BPoint where;
uint32 buttons;
GetMouse(&where, &buttons, false);
set_mouse_position((int32)where.x, (int32)where.y);
// hide the mouse cursor until the user moves it
be_app->ObscureCursor();
}
}
void
VideoView::MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage)
{
fLastMouseMove = system_time();
}
// #pragma mark -
void void
VideoView::SetBitmap(const BBitmap* bitmap) VideoView::SetBitmap(const BBitmap* bitmap)
{ {
@@ -214,11 +251,17 @@ VideoView::DisableOverlay()
void void
VideoView::SetPlaying(bool playing) VideoView::SetPlaying(bool playing)
{ {
printf("VideoView::SetPlaying(%d)\n", playing);
fIsPlaying = playing; fIsPlaying = playing;
} }
void
VideoView::SetFullscreen(bool fullScreen)
{
fIsFullscreen = fullScreen;
}
// #pragma mark - // #pragma mark -
+7 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright © 2006-2008 Stephan Aßmus <[email protected]> * Copyright © 2006-2009 Stephan Aßmus <[email protected]>
* All rights reserved. Distributed under the terms of the MIT license. * All rights reserved. Distributed under the terms of the MIT license.
*/ */
#ifndef VIDEO_VIEW_H #ifndef VIDEO_VIEW_H
@@ -21,6 +21,9 @@ public:
// BView interface // BView interface
virtual void Draw(BRect updateRect); virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void Pulse();
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage = NULL);
// VideoTarget interface // VideoTarget interface
virtual void SetBitmap(const BBitmap* bitmap); virtual void SetBitmap(const BBitmap* bitmap);
@@ -37,6 +40,7 @@ public:
void DisableOverlay(); void DisableOverlay();
void SetPlaying(bool playing); void SetPlaying(bool playing);
void SetFullscreen(bool fullScreen);
private: private:
void _DrawBitmap(const BBitmap* bitmap); void _DrawBitmap(const BBitmap* bitmap);
@@ -46,6 +50,8 @@ private:
overlay_restrictions fOverlayRestrictions; overlay_restrictions fOverlayRestrictions;
rgb_color fOverlayKeyColor; rgb_color fOverlayKeyColor;
bool fIsPlaying; bool fIsPlaying;
bool fIsFullscreen;
bigtime_t fLastMouseMove;
ListenerAdapter fGlobalSettingsListener; ListenerAdapter fGlobalSettingsListener;
bool fUseOverlays; bool fUseOverlays;