[vlc-commits] kva: remove VOUT_DISPLAY_HIDE_MOUSE (refs #18661)

Rémi Denis-Courmont git at videolan.org
Sun May 20 19:51:25 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 20 10:39:27 2018 +0300| [092f7f94b81baa13ec20662d6599843686d71fef] | committer: Rémi Denis-Courmont

kva: remove VOUT_DISPLAY_HIDE_MOUSE (refs #18661)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=092f7f94b81baa13ec20662d6599843686d71fef
---

 modules/video_output/kva.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/modules/video_output/kva.c b/modules/video_output/kva.c
index 34b9aae19a..151d3dea62 100644
--- a/modules/video_output/kva.c
+++ b/modules/video_output/kva.c
@@ -103,6 +103,8 @@ struct vout_display_sys_t
     unsigned           button_pressed;
     bool               is_mouse_hidden;
     bool               is_on_top;
+    mtime_t            cursor_timeout;
+    mtime_t            cursor_deadline;
 };
 
 typedef struct
@@ -391,32 +393,29 @@ static void Display( vout_display_t *vd, picture_t *picture,
      * here, WM_SIZE is not sent to its child window.
      * Maybe, is this due to the different threads ? */
     WinPostMsg( sys->client, WM_VLC_MANAGE, 0, 0 );
-}
-
-/*****************************************************************************
- * Control: control facility for the vout
- *****************************************************************************/
-static int Control( vout_display_t *vd, int query, va_list args )
-{
-    vout_display_sys_t *sys = vd->sys;
 
-    switch (query)
-    {
-    case VOUT_DISPLAY_HIDE_MOUSE:
+    if( !sys->is_mouse_hidden && sys->cursor_deadline < mdate() )
     {
         POINTL ptl;
 
         WinQueryPointerPos( HWND_DESKTOP, &ptl );
-        if( !sys->is_mouse_hidden &&
-            WinWindowFromPoint( HWND_DESKTOP, &ptl, TRUE ) == sys->client )
+        if( WinWindowFromPoint( HWND_DESKTOP, &ptl, TRUE ) == sys->client )
         {
             WinShowPointer( HWND_DESKTOP, FALSE );
             sys->is_mouse_hidden = true;
         }
-
-        return VLC_SUCCESS;
     }
+}
 
+/*****************************************************************************
+ * Control: control facility for the vout
+ *****************************************************************************/
+static int Control( vout_display_t *vd, int query, va_list args )
+{
+    vout_display_sys_t *sys = vd->sys;
+
+    switch (query)
+    {
     case VOUT_DISPLAY_CHANGE_FULLSCREEN:
     {
         bool fs = va_arg(args, int);
@@ -647,6 +646,10 @@ static int OpenDisplay( vout_display_t *vd, video_format_t *fmt )
                   psz_video_mode[ sys->kvac.ulMode - 1 ]);
     WinSetWindowText( sys->frame, sz_title );
 
+    sys->cursor_timeout = var_InheritInteger( vd, "mouse-hide-timeout" )
+                          * (CLOCK_FREQ / 1000);
+    sys->cursor_deadline = INT64_MAX;
+
     sys->i_screen_width  = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
     sys->i_screen_height = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
 
@@ -956,6 +959,7 @@ static MRESULT EXPENTRY WndProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
     {
         WinShowPointer(HWND_DESKTOP, TRUE);
         sys->is_mouse_hidden = false;
+        sys->cursor_deadline = mdate() + sys->cursor_timeout;
     }
 
     switch( msg )



More information about the vlc-commits mailing list