[vlc-commits] display: remove mouse events

Rémi Denis-Courmont git at videolan.org
Mon Dec 31 18:48:10 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec 30 23:57:22 2018 +0200| [594c03c497925c0b07b4c8827edc6bc77bf37e3a] | committer: Rémi Denis-Courmont

display: remove mouse events

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

 include/vlc_vout_display.h |  10 -----
 src/video_output/display.c | 103 ---------------------------------------------
 2 files changed, 113 deletions(-)

diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index c6d6e60c63..54d13b549f 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -169,12 +169,6 @@ enum {
     /* */
     VOUT_DISPLAY_EVENT_PICTURES_INVALID,    /* The buffer are now invalid and need to be changed */
 
-    /* Mouse event */
-    VOUT_DISPLAY_EVENT_MOUSE_MOVED,
-    VOUT_DISPLAY_EVENT_MOUSE_PRESSED,
-    VOUT_DISPLAY_EVENT_MOUSE_RELEASED,
-    VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK,
-
     /* VR navigation */
     VOUT_DISPLAY_EVENT_VIEWPOINT_MOVED,
 };
@@ -368,10 +362,6 @@ static inline void vout_display_SendWindowState(vout_display_t *vd, unsigned sta
     vout_display_Control(vd, VOUT_DISPLAY_CHANGE_WINDOW_STATE, state);
 }
 #endif
-static inline void vout_display_SendEventMouseMoved(vout_display_t *vd, int x, int y)
-{
-    vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_MOVED, x, y);
-}
 static inline void vout_display_SendEventMousePressed(vout_display_t *vd, int button)
 {
     vout_window_ReportMousePressed(vd->cfg->window, button);
diff --git a/src/video_output/display.c b/src/video_output/display.c
index f8a25bdf48..39e12fda5b 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -299,13 +299,6 @@ typedef struct {
      * VoutDisplayEvent(ie vout_display_SendEvent) */
     vlc_mutex_t lock;
 
-    /* mouse state */
-    struct {
-        vlc_mouse_t state;
-
-        vlc_tick_t last_pressed;
-    } mouse;
-
     atomic_bool reset_pictures;
     picture_pool_t *pool;
 } vout_display_priv_t;
@@ -384,97 +377,11 @@ static void VoutDisplayDestroyRender(vout_display_t *vd)
         filter_chain_Delete(osys->converters);
 }
 
-static void VoutDisplayEventMouse(vout_display_t *vd, int event, va_list args)
-{
-    vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
-
-    vlc_mutex_lock(&osys->lock);
-
-    /* */
-    vlc_mouse_t m = osys->mouse.state;
-    bool is_ignored = false;
-
-    switch (event) {
-    case VOUT_DISPLAY_EVENT_MOUSE_MOVED: {
-        const int x = (int)va_arg(args, int);
-        const int y = (int)va_arg(args, int);
-
-        //msg_Dbg(vd, "VoutDisplayEvent 'mouse' @%d,%d", x, y);
-
-        m.i_x = x;
-        m.i_y = y;
-        m.b_double_click = false;
-        break;
-    }
-    case VOUT_DISPLAY_EVENT_MOUSE_PRESSED:
-    case VOUT_DISPLAY_EVENT_MOUSE_RELEASED: {
-        const int button = (int)va_arg(args, int);
-        const int button_mask = 1 << button;
-
-        /* Ignore inconsistent event */
-        if ((event == VOUT_DISPLAY_EVENT_MOUSE_PRESSED  &&  (osys->mouse.state.i_pressed & button_mask)) ||
-            (event == VOUT_DISPLAY_EVENT_MOUSE_RELEASED && !(osys->mouse.state.i_pressed & button_mask))) {
-            is_ignored = true;
-            break;
-        }
-
-        /* */
-        msg_Dbg(vd, "VoutDisplayEvent 'mouse button' %d t=%d", button, event);
-
-        m.b_double_click = false;
-        if (event == VOUT_DISPLAY_EVENT_MOUSE_PRESSED)
-            m.i_pressed |= button_mask;
-        else
-            m.i_pressed &= ~button_mask;
-        break;
-    }
-    case VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK:
-        msg_Dbg(vd, "VoutDisplayEvent 'double click'");
-
-        m.b_double_click = true;
-        break;
-    default:
-        vlc_assert_unreachable();
-    }
-
-    if (is_ignored) {
-        vlc_mutex_unlock(&osys->lock);
-        return;
-    }
-
-    /* Emulate double-click if needed */
-    if (!vd->info.has_double_click &&
-        vlc_mouse_HasPressed(&osys->mouse.state, &m, MOUSE_BUTTON_LEFT)) {
-        const vlc_tick_t i_date = vlc_tick_now();
-
-        if (i_date - osys->mouse.last_pressed < VLC_TICK_FROM_MS(300) ) {
-            m.b_double_click = true;
-            osys->mouse.last_pressed = 0;
-        } else {
-            osys->mouse.last_pressed = vlc_tick_now();
-        }
-    }
-
-    /* */
-    osys->mouse.state = m;
-
-    /* */
-    vout_SendDisplayEventMouse(osys->vout, &m);
-    vlc_mutex_unlock(&osys->lock);
-}
-
 static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
 {
     vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
 
     switch (event) {
-    case VOUT_DISPLAY_EVENT_MOUSE_MOVED:
-    case VOUT_DISPLAY_EVENT_MOUSE_PRESSED:
-    case VOUT_DISPLAY_EVENT_MOUSE_RELEASED:
-    case VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK:
-        VoutDisplayEventMouse(vd, event, args);
-        break;
-
     case VOUT_DISPLAY_EVENT_VIEWPOINT_MOVED:
         var_SetAddress(osys->vout, "viewpoint-moved",
                        (void *)va_arg(args, const vlc_viewpoint_t *));
@@ -835,8 +742,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
     osys->pool = NULL;
     vlc_mutex_init(&osys->lock);
 
-    vlc_mouse_Init(&osys->mouse.state);
-
     osys->source = *source;
     osys->crop.left   = 0;
     osys->crop.top    = 0;
@@ -953,14 +858,6 @@ static void SplitterEvent(vout_display_t *vd, int event, va_list args)
     //vout_display_owner_sys_t *osys = vd->owner.sys;
 
     switch (event) {
-#if 0
-    case VOUT_DISPLAY_EVENT_MOUSE_MOVED:
-    case VOUT_DISPLAY_EVENT_MOUSE_PRESSED:
-    case VOUT_DISPLAY_EVENT_MOUSE_RELEASED:
-        /* TODO */
-        break;
-#endif
-    case VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK:
     case VOUT_DISPLAY_EVENT_PICTURES_INVALID:
         VoutDisplayEvent(vd, event, args);
         break;



More information about the vlc-commits mailing list