Uniformisation and configurability of Mouse Hidding Time. Patch by Lukas Durfina
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 22 Mar 2008 22:32:32 +0000 (15:32 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 22 Mar 2008 22:32:32 +0000 (15:32 -0700)
13 files changed:
modules/gui/beos/VideoOutput.cpp
modules/gui/beos/VideoWindow.h
modules/video_output/msw/direct3d.c
modules/video_output/msw/directx.c
modules/video_output/msw/glwin32.c
modules/video_output/msw/vout.h
modules/video_output/msw/wingdi.c
modules/video_output/qte/qte.cpp
modules/video_output/sdl.c
modules/video_output/x11/xcommon.c
modules/video_output/x11/xcommon.h
src/libvlc-module.c
src/video_output/vout_intf.c

index 2f85328..3a7677f 100644 (file)
@@ -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;
index 2e973b2..4f874d3 100644 (file)
@@ -122,6 +122,7 @@ class VLCView : public BView
             vout_thread_t   *p_vout;
 
             bigtime_t        fLastMouseMovedTime;
+            int             fMouseHideTimeout;
             bool            fCursorHidden;
             bool            fCursorInside;
             bool            fIgnoreDoubleClick;
index 5d2a21b..4afe9fc 100644 (file)
@@ -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;
index 82c1da1..ea941bf 100644 (file)
@@ -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;
index f7eec90..2a21525 100644 (file)
@@ -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;
index 05b4afb..cf84ea6 100644 (file)
@@ -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;
index 41f5ec3..3c54718 100755 (executable)
@@ -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;
index 17600e6..2940d89 100644 (file)
@@ -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;
index 3ed1de7..90972cf 100644 (file)
@@ -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;
index e9829c7..c3c686f 100644 (file)
@@ -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 )
index b1e9bd2..770f057 100644 (file)
@@ -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;
index e01b822..600b454 100644 (file)
@@ -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 );
index fcd8725..2385c4e 100644 (file)
@@ -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" );