[vlc-commits] core: vout: add VOUT_WINDOW_HIDE_MOUSE

Thomas Guillem git at videolan.org
Wed Nov 30 17:23:32 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Nov 30 11:56:13 2016 +0100| [1a0a8254cc93ff099c311001e674e7a914598d77] | committer: Thomas Guillem

core: vout: add VOUT_WINDOW_HIDE_MOUSE

A window can now hide the mouse cursor. If this control is not implemented by
a "vout window" module, the control will be sent to the "vout display" module.

Fix #12064
Ref #9787

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

 include/vlc_vout_window.h       | 9 +++++++++
 src/video_output/display.c      | 8 +++++---
 src/video_output/display.h      | 1 +
 src/video_output/video_output.c | 7 +++++++
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index 3564f2c..f40bbce 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -62,6 +62,7 @@ enum {
     VOUT_WINDOW_SET_STATE, /* unsigned state */
     VOUT_WINDOW_SET_SIZE,   /* unsigned i_width, unsigned i_height */
     VOUT_WINDOW_SET_FULLSCREEN, /* int b_fullscreen */
+    VOUT_WINDOW_HIDE_MOUSE, /* bool b_hide */
 };
 
 /**
@@ -221,6 +222,14 @@ static inline int vout_window_SetFullScreen(vout_window_t *window, bool full)
     return vout_window_Control(window, VOUT_WINDOW_SET_FULLSCREEN, full);
 }
 
+/**
+ * Hide the mouse cursor
+ */
+static inline int vout_window_HideMouse(vout_window_t *window, bool hide)
+{
+    return vout_window_Control(window, VOUT_WINDOW_HIDE_MOUSE, hide);
+}
+
 static inline void vout_window_ReportSize(vout_window_t *window,
                                           unsigned width, unsigned height)
 {
diff --git a/src/video_output/display.c b/src/video_output/display.c
index e4bd497..19bd459 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -808,16 +808,18 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
         osys->mouse.last_moved + osys->mouse.hide_timeout < date) {
         osys->mouse.is_hidden = hide_mouse = true;
     } else if (osys->mouse.ch_activity) {
+        if (osys->mouse.is_hidden)
+            vout_HideWindowMouse(osys->vout, false);
         osys->mouse.is_hidden = false;
     }
     osys->mouse.ch_activity = false;
     vlc_mutex_unlock(&osys->lock);
 
     if (hide_mouse) {
-        if (!vd->info.has_hide_mouse) {
-            msg_Dbg(vd, "auto hiding mouse cursor");
+        msg_Dbg(vd, "auto hiding mouse cursor");
+        if (vout_HideWindowMouse(osys->vout, true) != VLC_SUCCESS
+         && !vd->info.has_hide_mouse)
             vout_display_Control(vd, VOUT_DISPLAY_HIDE_MOUSE);
-        }
         vout_SendEventMouseHidden(osys->vout);
     }
 
diff --git a/src/video_output/display.h b/src/video_output/display.h
index 7bf94cc..34c39a3 100644
--- a/src/video_output/display.h
+++ b/src/video_output/display.h
@@ -37,5 +37,6 @@ void vout_SendDisplayEventMouse(vout_thread_t *, const vlc_mouse_t *);
 vout_window_t *vout_NewDisplayWindow(vout_thread_t *, unsigned type);
 void vout_DeleteDisplayWindow(vout_thread_t *, vout_window_t *);
 void vout_SetDisplayWindowSize(vout_thread_t *, unsigned, unsigned);
+int  vout_HideWindowMouse(vout_thread_t *, bool);
 
 void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 00036f7..bb7d72c 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -647,6 +647,13 @@ void vout_SetDisplayWindowSize(vout_thread_t *vout,
         vout_display_SendEventDisplaySize(vout->p->display.vd, width, height);
 }
 
+int vout_HideWindowMouse(vout_thread_t *vout, bool hide)
+{
+    vout_window_t *window = vout->p->window;
+
+    return window != NULL ? vout_window_HideMouse(window, hide) : VLC_EGENERIC;
+}
+
 /* */
 static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter)
 {



More information about the vlc-commits mailing list