* 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

View File

@ -46,7 +46,7 @@ Application MediaPlayer :
AudioResampler.cpp
AudioSupplier.cpp
AudioVolumeConverter.cpp
# media_node_framework/video
VideoConsumer.cpp
VideoProducer.cpp
@ -104,7 +104,7 @@ Application MediaPlayer :
TransportControlGroup.cpp
VideoView.cpp
: be media tracker translation textencoding $(TARGET_LIBSTDC++)
: be game media tracker translation textencoding $(TARGET_LIBSTDC++)
: MediaPlayer.rdef
;

View File

@ -1466,6 +1466,8 @@ MainWin::_ToggleFullscreen()
Show();
}
fVideoView->SetFullscreen(fIsFullscreen);
_MarkSettingsItem(M_TOGGLE_FULLSCREEN, fIsFullscreen);
printf("_ToggleFullscreen leave\n");

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2006-2008 Stephan Aßmus <superstippi@gmx.de>
* Copyright © 2006-2009 Stephan Aßmus <superstippi@gmx.de>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "VideoView.h"
@ -18,13 +18,19 @@
#undef private
#endif
#include <Application.h>
#include <WindowScreen.h>
#include "Settings.h"
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),
fIsPlaying(false),
fIsFullscreen(false),
fLastMouseMove(system_time()),
fGlobalSettingsListener(this)
{
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
VideoView::SetBitmap(const BBitmap* bitmap)
{
@ -214,11 +251,17 @@ VideoView::DisableOverlay()
void
VideoView::SetPlaying(bool playing)
{
printf("VideoView::SetPlaying(%d)\n", playing);
fIsPlaying = playing;
}
void
VideoView::SetFullscreen(bool fullScreen)
{
fIsFullscreen = fullScreen;
}
// #pragma mark -

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2006-2008 Stephan Aßmus <superstippi@gmx.de>
* Copyright © 2006-2009 Stephan Aßmus <superstippi@gmx.de>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef VIDEO_VIEW_H
@ -21,6 +21,9 @@ public:
// BView interface
virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message);
virtual void Pulse();
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage = NULL);
// VideoTarget interface
virtual void SetBitmap(const BBitmap* bitmap);
@ -37,6 +40,7 @@ public:
void DisableOverlay();
void SetPlaying(bool playing);
void SetFullscreen(bool fullScreen);
private:
void _DrawBitmap(const BBitmap* bitmap);
@ -46,6 +50,8 @@ private:
overlay_restrictions fOverlayRestrictions;
rgb_color fOverlayKeyColor;
bool fIsPlaying;
bool fIsFullscreen;
bigtime_t fLastMouseMove;
ListenerAdapter fGlobalSettingsListener;
bool fUseOverlays;