vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Thu May 31 21:34:59 2018 +0300| [62fc1d1f864435f953a0be1810fc88848f77531d] | committer: Rémi Denis-Courmont
hotkeys: take care of mouse wheel "key" events > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62fc1d1f864435f953a0be1810fc88848f77531d --- modules/control/hotkeys.c | 18 ++++++++++-------- src/video_output/event.h | 15 +-------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c index dae489fee4..a7a5792bb1 100644 --- a/modules/control/hotkeys.c +++ b/modules/control/hotkeys.c @@ -168,23 +168,25 @@ static int ButtonEvent( vlc_object_t *p_this, char const *psz_var, else p_sys->vrnav.b_button_pressed = false; - if ((newval.i_int & (1 << MOUSE_BUTTON_LEFT)) - && !(oldval.i_int & (1 << MOUSE_BUTTON_LEFT))) - var_SetBool(pl_Get(p_intf), "intf-popupmenu", false); + unsigned pressed = newval.i_int & ~oldval.i_int; - if ((newval.i_int & (1 << MOUSE_BUTTON_CENTER)) - && !(oldval.i_int & (1 << MOUSE_BUTTON_CENTER))) + if (pressed & (1 << MOUSE_BUTTON_LEFT)) + var_SetBool(pl_Get(p_intf), "intf-popupmenu", false); + if (pressed & (1 << MOUSE_BUTTON_CENTER)) var_TriggerCallback(pl_Get(p_intf), "intf-toggle-fscontrol"); - #ifndef _WIN32 - if ((newval.i_int & (1 << MOUSE_BUTTON_RIGHT)) - && !(oldval.i_int & (1 << MOUSE_BUTTON_RIGHT))) + if (pressed & (1 << MOUSE_BUTTON_RIGHT)) #else if ((oldval.i_int & (1 << MOUSE_BUTTON_RIGHT)) && !(newval.i_int & (1 << MOUSE_BUTTON_RIGHT))) #endif var_SetBool(pl_Get(p_intf), "intf-popupmenu", true); + for (int i = MOUSE_BUTTON_WHEEL_UP; i <= MOUSE_BUTTON_WHEEL_RIGHT; i++) + if (pressed & (1 << i)) + var_SetInteger(p_intf->obj.libvlc, "key-pressed", + i - MOUSE_BUTTON_WHEEL_UP + KEY_MOUSEWHEELUP); + return VLC_SUCCESS; } diff --git a/src/video_output/event.h b/src/video_output/event.h index 1c17d79ff4..985052a45f 100644 --- a/src/video_output/event.h +++ b/src/video_output/event.h @@ -55,28 +55,15 @@ static inline void vout_SendEventViewpointMoved(vout_thread_t *vout, } static inline void vout_SendEventMousePressed(vout_thread_t *vout, int button) { - int key = KEY_UNSET; var_OrInteger(vout, "mouse-button-down", 1 << button); - switch (button) - { - case MOUSE_BUTTON_LEFT: + if (button == MOUSE_BUTTON_LEFT) { /* FIXME? */ int x, y; var_GetCoords(vout, "mouse-moved", &x, &y); var_SetCoords(vout, "mouse-clicked", x, y); - return; - } - case MOUSE_BUTTON_CENTER: - case MOUSE_BUTTON_RIGHT: - return; - case MOUSE_BUTTON_WHEEL_UP: key = KEY_MOUSEWHEELUP; break; - case MOUSE_BUTTON_WHEEL_DOWN: key = KEY_MOUSEWHEELDOWN; break; - case MOUSE_BUTTON_WHEEL_LEFT: key = KEY_MOUSEWHEELLEFT; break; - case MOUSE_BUTTON_WHEEL_RIGHT: key = KEY_MOUSEWHEELRIGHT; break; } - vout_SendEventKey(vout, key); } static inline void vout_SendEventMouseReleased(vout_thread_t *vout, int button) { _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
