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

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May 18 16:01:19 2018 +0300| [b334e4f4f4c3657e973ab103cb200bdb415d5f5b] | committer: Rémi Denis-Courmont

caca: remove VOUT_DISPLAY_HIDE_MOUSE (refs #18661)

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

 modules/video_output/caca.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
index 316d91c928..ce424ad9a6 100644
--- a/modules/video_output/caca.c
+++ b/modules/video_output/caca.c
@@ -56,6 +56,9 @@ struct vout_display_sys_t {
     picture_pool_t *pool;
     block_fifo_t *fifo;
     vlc_thread_t thread;
+
+    mtime_t cursor_timeout;
+    mtime_t cursor_deadline;
 };
 
 noreturn static void *VoutDisplayEventKeyDispatch(void *data)
@@ -191,10 +194,6 @@ static int Control(vout_display_t *vd, int query, va_list args)
     (void) args;
 
     switch (query) {
-    case VOUT_DISPLAY_HIDE_MOUSE:
-        caca_set_mouse(sys->dp, 0);
-        return VLC_SUCCESS;
-
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
     case VOUT_DISPLAY_CHANGE_ZOOM:
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
@@ -303,6 +302,11 @@ static void Manage(vout_display_t *vd)
 {
     vout_display_sys_t *sys = vd->sys;
 
+    if (sys->cursor_deadline != INT64_MAX && sys->cursor_deadline < mdate()) {
+        caca_set_mouse(sys->dp, 0);
+        sys->cursor_deadline = INT64_MAX;
+    }
+
     struct caca_event ev;
     while (caca_get_event(sys->dp, CACA_EVENT_ANY, &ev, 0) > 0) {
         switch (caca_get_event_type(&ev)) {
@@ -338,12 +342,15 @@ static void Manage(vout_display_t *vd)
                                     vd->source.i_visible_height / place.height;
 
             caca_set_mouse(sys->dp, 1);
+            sys->cursor_deadline = mdate() + sys->cursor_timeout;
             vout_display_SendEventMouseMoved(vd, x, y);
             break;
         }
         case CACA_EVENT_MOUSE_PRESS:
         case CACA_EVENT_MOUSE_RELEASE: {
             caca_set_mouse(sys->dp, 1);
+            sys->cursor_deadline = mdate() + sys->cursor_timeout;
+
             const int caca = caca_get_event_mouse_button(&ev);
             for (int i = 0; mouses[i].caca != -1; i++) {
                 if (mouses[i].caca == caca) {
@@ -472,6 +479,10 @@ static int Open(vlc_object_t *object)
         }
     }
 
+    sys->cursor_timeout = var_InheritInteger(vd, "mouse-hide-timeout")
+                          * (CLOCK_FREQ / 1000);
+    sys->cursor_deadline = INT64_MAX;
+
     /* Fix format */
     video_format_t fmt = vd->fmt;
     if (fmt.i_chroma != VLC_CODEC_RGB32) {
@@ -483,7 +494,6 @@ static int Open(vlc_object_t *object)
 
     /* Setup vout_display now that everything is fine */
     vd->fmt = fmt;
-    vd->info.needs_hide_mouse = true;
 
     vd->pool    = Pool;
     vd->prepare = Prepare;



More information about the vlc-commits mailing list