[MPlayer-cvslog] r34423 - trunk/osdep/keycodes.h

reimar subversion at mplayerhq.hu
Sat Dec 10 15:27:04 CET 2011


Author: reimar
Date: Sat Dec 10 15:27:04 2011
New Revision: 34423

Log:
Use an enum to define keycodes and fix CTRL and backspace key having
the same keycode.
This is because KEY_CTRL was supposed to be the name of the "key class",
not the key, but that was later misunderstood.
Obviously that was some major bad naming....

Modified:
   trunk/osdep/keycodes.h

Modified: trunk/osdep/keycodes.h
==============================================================================
--- trunk/osdep/keycodes.h	Fri Dec  9 16:17:11 2011	(r34422)
+++ trunk/osdep/keycodes.h	Sat Dec 10 15:27:04 2011	(r34423)
@@ -23,24 +23,61 @@
 #ifndef MPLAYER_KEYCODES_H
 #define MPLAYER_KEYCODES_H
 
-#define KEY_ENTER 13
-#define KEY_TAB 9
-
 #define KEY_BASE 0x100
 
-/*  Function keys  */
-#define KEY_F (KEY_BASE+64)
-
-/* Control keys */
-#define KEY_CTRL (KEY_BASE)
-#define KEY_BACKSPACE (KEY_CTRL+0)
-#define KEY_DELETE (KEY_CTRL+1)
-#define KEY_INSERT (KEY_CTRL+2)
-#define KEY_HOME (KEY_CTRL+3)
-#define KEY_END (KEY_CTRL+4)
-#define KEY_PAGE_UP (KEY_CTRL+5)
-#define KEY_PAGE_DOWN (KEY_CTRL+6)
-#define KEY_ESC (KEY_CTRL+7)
+enum {
+    KEY_TAB = 9,
+    KEY_ENTER = 13,
+    /* Control keys */
+    KEY_BACKSPACE = KEY_BASE,
+    KEY_DELETE,
+    KEY_INSERT,
+    KEY_HOME,
+    KEY_END,
+    KEY_PAGE_UP,
+    KEY_PAGE_DOWN,
+    KEY_ESC,
+    /* Cursor movement */
+    KEY_RIGHT = KEY_BASE + 16,
+    KEY_LEFT,
+    KEY_DOWN,
+    KEY_UP,
+    /* Keypad keys */
+    KEY_KP0 = KEY_BASE + 32,
+    KEY_KP1,
+    KEY_KP2,
+    KEY_KP3,
+    KEY_KP4,
+    KEY_KP5,
+    KEY_KP6,
+    KEY_KP7,
+    KEY_KP8,
+    KEY_KP9,
+    KEY_KPDEC,
+    KEY_KPINS,
+    KEY_KPDEL,
+    KEY_KPENTER,
+    /* Key combination keys */
+    KEY_CTRL = KEY_BASE + 48,
+    /* Function keys */
+    KEY_F = KEY_BASE + 64,
+    /* Multimedia keyboard/remote keys */
+    KEY_POWER = KEY_BASE+384,
+    KEY_MENU,
+    KEY_PLAY,
+    KEY_PAUSE,
+    KEY_PLAYPAUSE,
+    KEY_STOP,
+    KEY_FORWARD,
+    KEY_REWIND,
+    KEY_NEXT,
+    KEY_PREV,
+    KEY_VOLUME_UP,
+    KEY_VOLUME_DOWN,
+    KEY_MUTE,
+    /* Special internal/virtual keys */
+    KEY_CLOSE_WIN = 0x1000,
+};
 
 /* Control keys short name */
 #define KEY_BS KEY_BACKSPACE
@@ -50,48 +87,4 @@
 #define KEY_PGDOWN KEY_PAGE_DOWN
 #define KEY_PGDWN KEY_PAGE_DOWN
 
-/* Cursor movement */
-#define KEY_CRSR (KEY_BASE+16)
-#define KEY_RIGHT (KEY_CRSR+0)
-#define KEY_LEFT (KEY_CRSR+1)
-#define KEY_DOWN (KEY_CRSR+2)
-#define KEY_UP (KEY_CRSR+3)
-
-/* Multimedia keyboard/remote keys */
-#define KEY_MM_BASE (KEY_BASE+384)
-#define KEY_POWER (KEY_MM_BASE+0)
-#define KEY_MENU (KEY_MM_BASE+1)
-#define KEY_PLAY (KEY_MM_BASE+2)
-#define KEY_PAUSE (KEY_MM_BASE+3)
-#define KEY_PLAYPAUSE (KEY_MM_BASE+4)
-#define KEY_STOP (KEY_MM_BASE+5)
-#define KEY_FORWARD (KEY_MM_BASE+6)
-#define KEY_REWIND (KEY_MM_BASE+7)
-#define KEY_NEXT (KEY_MM_BASE+8)
-#define KEY_PREV (KEY_MM_BASE+9)
-#define KEY_VOLUME_UP (KEY_MM_BASE+10)
-#define KEY_VOLUME_DOWN (KEY_MM_BASE+11)
-#define KEY_MUTE (KEY_MM_BASE+12)
-
-/* Keypad keys */
-#define KEY_KEYPAD (KEY_BASE+32)
-#define KEY_KP0 (KEY_KEYPAD+0)
-#define KEY_KP1 (KEY_KEYPAD+1)
-#define KEY_KP2 (KEY_KEYPAD+2)
-#define KEY_KP3 (KEY_KEYPAD+3)
-#define KEY_KP4 (KEY_KEYPAD+4)
-#define KEY_KP5 (KEY_KEYPAD+5)
-#define KEY_KP6 (KEY_KEYPAD+6)
-#define KEY_KP7 (KEY_KEYPAD+7)
-#define KEY_KP8 (KEY_KEYPAD+8)
-#define KEY_KP9 (KEY_KEYPAD+9)
-#define KEY_KPDEC (KEY_KEYPAD+10)
-#define KEY_KPINS (KEY_KEYPAD+11)
-#define KEY_KPDEL (KEY_KEYPAD+12)
-#define KEY_KPENTER (KEY_KEYPAD+13)
-
-/* Special keys */
-#define KEY_INTERN (0x1000)
-#define KEY_CLOSE_WIN (KEY_INTERN+0)
-
 #endif /* MPLAYER_KEYCODES_H */


More information about the MPlayer-cvslog mailing list