From: Pierre d'Herbemont Date: Tue, 8 May 2007 11:23:47 +0000 (+0000) Subject: Hotkeys: Enable mouse wheel up/down and left/right usage. (mapped respectivly to... X-Git-Tag: 0.9.0-test0~7523 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=fc4af29c6ecff6c02bbddc8f4b4d327d0df1c290;p=vlc Hotkeys: Enable mouse wheel up/down and left/right usage. (mapped respectivly to volume up/down, and position forward/backward). This commit needs review. --- diff --git a/include/vlc_keys.h b/include/vlc_keys.h index 91ebea3d5a..2931b75632 100644 --- a/include/vlc_keys.h +++ b/include/vlc_keys.h @@ -63,6 +63,8 @@ #define KEY_BACKSPACE 0x001C0000 #define KEY_MOUSEWHEELUP 0x001D0000 #define KEY_MOUSEWHEELDOWN 0x001E0000 +#define KEY_MOUSEWHEELLEFT 0x001F0000 +#define KEY_MOUSEWHEELRIGHT 0x00200000 /* TODO: * The media keys are only used in win32. Support for other OSes needs to diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c index 1df6d8d6ad..61b8cc39f5 100644 --- a/modules/control/hotkeys.c +++ b/modules/control/hotkeys.c @@ -163,20 +163,45 @@ static void Run( intf_thread_t *p_intf ) /* Sleep a bit */ // msleep( INTF_IDLE_SLEEP ); - /* Find action triggered by hotkey */ i_action = 0; i_key = GetKey( p_intf ); - for( i = 0; i_key != -1 && p_hotkeys[i].psz_action != NULL; i++ ) - { - if( p_hotkeys[i].i_key == i_key ) - { - i_action = p_hotkeys[i].i_action; - i_times = p_hotkeys[i].i_times; - /* times key pressed within max. delta time */ - p_hotkeys[i].i_times = 0; - break; - } - } + + /* Special action for mouse event */ + /* FIXME: This should probably be configurable */ + /* FIXME: rework hotkeys handling to allow more than 1 event + * to trigger one same action */ + switch (i_key & KEY_SPECIAL) + { + case KEY_MOUSEWHEELUP: + i_action = ACTIONID_VOL_UP; + break; + case KEY_MOUSEWHEELDOWN: + i_action = ACTIONID_VOL_DOWN; + break; + case KEY_MOUSEWHEELLEFT: + i_action = ACTIONID_JUMP_BACKWARD_EXTRASHORT; + break; + case KEY_MOUSEWHEELRIGHT: + i_action = ACTIONID_JUMP_FORWARD_EXTRASHORT; + break; + default: break; + } + + /* No mouse action, find action triggered by hotkey */ + if(!i_action) + { + for( i = 0; i_key != -1 && p_hotkeys[i].psz_action != NULL; i++ ) + { + if( p_hotkeys[i].i_key == i_key ) + { + i_action = p_hotkeys[i].i_action; + i_times = p_hotkeys[i].i_times; + /* times key pressed within max. delta time */ + p_hotkeys[i].i_times = 0; + break; + } + } + } if( !i_action ) {