]> git.sesse.net Git - vlc/commitdiff
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 2f853280df123a223c63f1098697c8d7d7aca935..3a7677f930b084d15c110bc7c1d451462739afd8 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 2e973b2abbc20ad23e50cb9c693e8be2e6b02c07..4f874d31aeb0d77abeac6af209c3a8acfcd1135a 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 5d2a21b649f1d4cae70a28faf91cf44103dc967a..4afe9fc6ca9a5661334e99f4613e65b0565d0545 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 82c1da11abc4c84b41a9185117ab818d6c717c95..ea941bfad2388f33ebc49e8098a16358b705e9de 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 f7eec90539503852818741d9aeccf2125aea21fa..2a21525040099d01c785c39d55905619a88fecea 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 05b4afb65cfda8b4f8aa75b4898ccf3def6e2b76..cf84ea6a220a10ced9c74443f088f2ee46323832 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 41f5ec3a7591a5cd631b18916fd9767176378ae2..3c54718bbc8ab74378f8b052665b0c16fc101276 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 17600e6273bc0a04d2eff9dc491771af9309b1ba..2940d899915cf61fc2e7ce968621dfee825bf0db 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 3ed1de7168dc37347e0deb763a40d4461d8b0032..90972cf1a90a4573a5ea61249b9b338636573131 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 e9829c77d43e05c7643d6d3945fb6d0d3c5ffcf3..c3c686f3a1f85f32afd9e98b06363fde3da9fb93 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 b1e9bd2583cfdffcc5634f86bc774f34e30484be..770f057f0cfe7f2b3a5cc22fe7d4568a7047e4d5 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 e01b822131118f748df7298ed1463208ac06683b..600b454d68e53f778b928a432d24514d7ed4bfca 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 fcd8725ef2a617811bd44a1917f03854592fe260..2385c4e512f1fc16cad0534bafa59f3d69293499 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" );