Commit 78e39f0d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Uniformisation and configurability of Mouse Hidding Time. Patch by Lukas Durfina

parent 31dcf0dd
......@@ -77,7 +77,6 @@ struct vout_sys_t
};
#define MOUSE_IDLE_TIMEOUT 2000000 // two seconds
#define MIN_AUTO_VSYNC_REFRESH 61 // Hz
/*****************************************************************************
......@@ -984,6 +983,7 @@ VLCView::VLCView(BRect bounds, vout_thread_t *p_vout_instance )
fIgnoreDoubleClick(false)
{
p_vout = p_vout_instance;
fMouseHideTimeout = var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
SetViewColor(B_TRANSPARENT_32_BIT);
}
......@@ -1169,7 +1169,7 @@ VLCView::Pulse()
if (!fCursorHidden)
{
if (fCursorInside
&& mdate() - fLastMouseMovedTime > MOUSE_IDLE_TIMEOUT)
&& mdate() - fLastMouseMovedTime > fMouseHideTimeout)
{
be_app->ObscureCursor();
fCursorHidden = true;
......
......@@ -122,6 +122,7 @@ class VLCView : public BView
vout_thread_t *p_vout;
bigtime_t fLastMouseMovedTime;
int fMouseHideTimeout;
bool fCursorHidden;
bool fCursorInside;
bool fIgnoreDoubleClick;
......
......@@ -183,6 +183,8 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
p_vout->p_sys->i_mouse_hide_timeout =
var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
var_Create( p_vout, "video-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
......@@ -475,7 +477,8 @@ static int Manage( vout_thread_t *p_vout )
* Pointer change
*/
if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
(mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
(mdate() - p_vout->p_sys->i_lastmoved) >
p_vout->p_sys->i_mouse_hide_timeout )
{
POINT point;
HWND hwnd;
......
......@@ -261,6 +261,8 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
p_vout->p_sys->i_mouse_hide_timeout =
var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
/* Set main window's size */
p_vout->p_sys->i_window_width = p_vout->i_window_width;
......@@ -638,7 +640,8 @@ static int Manage( vout_thread_t *p_vout )
* Pointer change
*/
if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
(mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
(mdate() - p_vout->p_sys->i_lastmoved) >
p_vout->p_sys->i_mouse_hide_timeout )
{
POINT point;
HWND hwnd;
......
......@@ -118,6 +118,8 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
p_vout->p_sys->i_mouse_hide_timeout =
var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
/* Set main window's size */
p_vout->p_sys->i_window_width = p_vout->i_window_width;
......@@ -337,7 +339,8 @@ static int Manage( vout_thread_t *p_vout )
* Pointer change
*/
if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
(mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
(mdate() - p_vout->p_sys->i_lastmoved) >
p_vout->p_sys->i_mouse_hide_timeout )
{
POINT point;
HWND hwnd;
......
......@@ -72,6 +72,7 @@ struct vout_sys_t
/* Mouse */
volatile vlc_bool_t b_cursor_hidden;
volatile mtime_t i_lastmoved;
mtime_t i_mouse_hide_timeout;
/* Misc */
vlc_bool_t b_on_top_change;
......
......@@ -231,6 +231,8 @@ static int OpenVideo ( vlc_object_t *p_this )
p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate();
p_vout->p_sys->i_mouse_hide_timeout =
var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
/* Set main window's size */
p_vout->p_sys->i_window_width = p_vout->i_window_width;
......@@ -565,7 +567,8 @@ static int Manage( vout_thread_t *p_vout )
* Pointer change
*/
if( p_vout->b_fullscreen && !p_vout->p_sys->b_cursor_hidden &&
(mdate() - p_vout->p_sys->i_lastmoved) > 5000000 )
(mdate() - p_vout->p_sys->i_lastmoved) >
p_vout->p_sys->i_mouse_hide_timeout )
{
POINT point;
HWND hwnd;
......
......@@ -390,7 +390,8 @@ static int Manage( vout_thread_t *p_vout )
/* Pointer change */
// if( ! p_vout->p_sys->b_cursor_autohidden &&
// ( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
// ( mdate() - p_vout->p_sys->i_lastmoved >
// p_vout->p_sys->i_mouse_hide_timeout ) )
// {
// /* Hide the mouse automatically */
// p_vout->p_sys->b_cursor_autohidden = 1;
......
......@@ -77,6 +77,7 @@ struct vout_sys_t
vlc_bool_t b_cursor;
vlc_bool_t b_cursor_autohidden;
mtime_t i_lastmoved;
mtime_t i_mouse_hide_timeout;
mtime_t i_lastpressed; /* to track dbl-clicks */
};
......@@ -227,6 +228,8 @@ static int Open ( vlc_object_t *p_this )
p_vout->p_sys->b_cursor = 1;
p_vout->p_sys->b_cursor_autohidden = 0;
p_vout->p_sys->i_lastmoved = p_vout->p_sys->i_lastpressed = mdate();
p_vout->p_sys->i_mouse_hide_timeout =
var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
if( OpenDisplay( p_vout ) )
{
......@@ -625,7 +628,8 @@ static int Manage( vout_thread_t *p_vout )
/* Pointer change */
if( ! p_vout->p_sys->b_cursor_autohidden &&
( mdate() - p_vout->p_sys->i_lastmoved > 2000000 ) )
( mdate() - p_vout->p_sys->i_lastmoved >
p_vout->p_sys->i_mouse_hide_timeout ) )
{
/* Hide the mouse automatically */
p_vout->p_sys->b_cursor_autohidden = 1;
......
......@@ -342,6 +342,8 @@ int E_(Activate) ( vlc_object_t *p_this )
/* Create blank cursor (for mouse cursor autohiding) */
p_vout->p_sys->i_time_mouse_last_moved = mdate();
p_vout->p_sys->i_mouse_hide_timeout =
var_GetInteger(p_vout, "mouse-hide-timeout") * 1000;
p_vout->p_sys->b_mouse_pointer_visible = 1;
CreateCursor( p_vout );
......@@ -1553,7 +1555,8 @@ static int ManageVideo( vout_thread_t *p_vout )
}
/* Autohide Cursour */
if( mdate() - p_vout->p_sys->i_time_mouse_last_moved > 2000000 )
if( mdate() - p_vout->p_sys->i_time_mouse_last_moved >
p_vout->p_sys->i_mouse_hide_timeout )
{
/* Hide the mouse automatically */
if( p_vout->p_sys->b_mouse_pointer_visible )
......
......@@ -252,6 +252,7 @@ struct vout_sys_t
/* Mouse pointer properties */
vlc_bool_t b_mouse_pointer_visible;
mtime_t i_time_mouse_last_moved; /* used to auto-hide pointer*/
mtime_t i_mouse_hide_timeout; /* after time hide cursor */
Cursor blank_cursor; /* the hidden cursor */
mtime_t i_time_button_last_pressed; /* to track dbl-clicks */
Pixmap cursor_pixmap;
......
......@@ -399,6 +399,12 @@ static const char *ppsz_align_descriptions[] =
#define VIDEO_TITLE_POSITION_LONGTEXT N_( \
"Place on video where to display the title (default bottom center).")
#define MOUSE_HIDE_TIMEOUT_TEXT N_("Hide cursor and fullscreen " \
"controller after x miliseconds.")
#define MOUSE_HIDE_TIMEOUT_LONGTEXT N_( \
"Hide mouse cursor and fullscreen controller after " \
"n miliseconds, default is 3000 ms (3 sec.)")
static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static const char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
......@@ -1485,6 +1491,9 @@ vlc_module_begin();
VIDEO_TITLE_TIMEOUT_LONGTEXT, VLC_FALSE );
add_integer( "video-title-position", 8, NULL, VIDEO_TITLE_POSITION_TEXT,
VIDEO_TITLE_POSITION_LONGTEXT, VLC_FALSE );
// autohide after 3s
add_integer( "mouse-hide-timeout", 3000, NULL, MOUSE_HIDE_TIMEOUT_TEXT,
MOUSE_HIDE_TIMEOUT_LONGTEXT, VLC_FALSE );
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
set_section( N_("Snapshot") , NULL );
......
......@@ -287,6 +287,9 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_Create( p_vout, "video-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "mouse-hide-timeout",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
p_vout->b_title_show = var_CreateGetBool( p_vout, "video-title-show" );
p_vout->i_title_timeout =
(mtime_t)var_CreateGetInteger( p_vout, "video-title-timeout" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment