Hotkeys: Enable mouse wheel up/down and left/right usage. (mapped respectivly to...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 8 May 2007 11:23:47 +0000 (11:23 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 8 May 2007 11:23:47 +0000 (11:23 +0000)
include/vlc_keys.h
modules/control/hotkeys.c

index 91ebea3..2931b75 100644 (file)
@@ -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
index 1df6d8d..61b8cc3 100644 (file)
@@ -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 )
         {