1 /*****************************************************************************
2 * vlc_keys.h: keycode defines
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
27 #define KEY_MODIFIER 0xFF000000
28 #define KEY_MODIFIER_ALT 0x01000000
29 #define KEY_MODIFIER_SHIFT 0x02000000
30 #define KEY_MODIFIER_CTRL 0x04000000
31 #define KEY_MODIFIER_META 0x08000000
32 #define KEY_MODIFIER_COMMAND 0x10000000
34 #define KEY_SPECIAL 0x00FF0000
35 #define KEY_LEFT 0x00010000
36 #define KEY_RIGHT 0x00020000
37 #define KEY_UP 0x00030000
38 #define KEY_DOWN 0x00040000
39 #define KEY_SPACE 0x00050000
40 #define KEY_ENTER 0x00060000
41 #define KEY_F1 0x00070000
42 #define KEY_F2 0x00080000
43 #define KEY_F3 0x00090000
44 #define KEY_F4 0x000A0000
45 #define KEY_F5 0x000B0000
46 #define KEY_F6 0x000C0000
47 #define KEY_F7 0x000D0000
48 #define KEY_F8 0x000E0000
49 #define KEY_F9 0x000F0000
50 #define KEY_F10 0x00100000
51 #define KEY_F11 0x00110000
52 #define KEY_F12 0x00120000
53 #define KEY_HOME 0x00130000
54 #define KEY_END 0x00140000
55 #define KEY_INSERT 0x00150000
56 #define KEY_DELETE 0x00160000
57 #define KEY_MENU 0x00170000
58 #define KEY_ESC 0x00180000
59 #define KEY_PAGEUP 0x00190000
60 #define KEY_PAGEDOWN 0x001A0000
61 #define KEY_TAB 0x001B0000
62 #define KEY_BACKSPACE 0x001C0000
63 #define KEY_MOUSEWHEELUP 0x001D0000
64 #define KEY_MOUSEWHEELDOWN 0x001E0000
65 #define KEY_MOUSEWHEELLEFT 0x001F0000
66 #define KEY_MOUSEWHEELRIGHT 0x00200000
69 * The media keys are only used in win32. Support for other OSes needs to
71 #define KEY_BROWSER_BACK 0x001F0000
72 #define KEY_BROWSER_FORWARD 0x00200000
73 #define KEY_BROWSER_REFRESH 0x00210000
74 #define KEY_BROWSER_STOP 0x00220000
75 #define KEY_BROWSER_SEARCH 0x00230000
76 #define KEY_BROWSER_FAVORITES 0x00240000
77 #define KEY_BROWSER_HOME 0x00250000
78 #define KEY_VOLUME_MUTE 0x00260000
79 #define KEY_VOLUME_DOWN 0x00270000
80 #define KEY_VOLUME_UP 0x00280000
81 #define KEY_MEDIA_NEXT_TRACK 0x00290000
82 #define KEY_MEDIA_PREV_TRACK 0x002a0000
83 #define KEY_MEDIA_STOP 0x002b0000
84 #define KEY_MEDIA_PLAY_PAUSE 0x002c0000
86 #define KEY_ASCII 0x0000007F
89 typedef struct key_descriptor_s
91 const char *psz_key_string
;
95 #define ADD_KEY(a) { a, *a }
97 static const struct key_descriptor_s vlc_modifiers
[] =
99 { "Alt", KEY_MODIFIER_ALT
},
100 { "Shift", KEY_MODIFIER_SHIFT
},
101 { "Ctrl", KEY_MODIFIER_CTRL
},
102 { "Meta", KEY_MODIFIER_META
},
103 { "Command", KEY_MODIFIER_COMMAND
}
106 static const struct key_descriptor_s vlc_keys
[] =
108 { "Unset", KEY_UNSET
},
109 { "Left", KEY_LEFT
},
110 { "Right", KEY_RIGHT
},
112 { "Down", KEY_DOWN
},
113 { "Space", KEY_SPACE
},
114 { "Enter", KEY_ENTER
},
127 { "Home", KEY_HOME
},
129 { "Insert", KEY_INSERT
},
130 { "Delete", KEY_DELETE
},
131 { "Menu", KEY_MENU
},
133 { "Page Up", KEY_PAGEUP
},
134 { "Page Down", KEY_PAGEDOWN
},
136 { "Backspace", KEY_BACKSPACE
},
137 { "Mouse Wheel Up", KEY_MOUSEWHEELUP
},
138 { "Mouse Wheel Down", KEY_MOUSEWHEELDOWN
},
190 { "Browser Back", KEY_BROWSER_BACK
},
191 { "Browser Forward", KEY_BROWSER_FORWARD
},
192 { "Browser Refresh", KEY_BROWSER_REFRESH
},
193 { "Browser Stop", KEY_BROWSER_STOP
},
194 { "Browser Search", KEY_BROWSER_SEARCH
},
195 { "Browser Favorites", KEY_BROWSER_FAVORITES
},
196 { "Browser Home", KEY_BROWSER_HOME
},
197 { "Volume Mute", KEY_VOLUME_MUTE
},
198 { "Volume Down", KEY_VOLUME_DOWN
},
199 { "Volume Up", KEY_VOLUME_UP
},
200 { "Media Next Track", KEY_MEDIA_NEXT_TRACK
},
201 { "Media Prev Track", KEY_MEDIA_PREV_TRACK
},
202 { "Media Stop", KEY_MEDIA_STOP
},
203 { "Media Play Pause", KEY_MEDIA_PLAY_PAUSE
}
206 static inline const char *KeyToString( int i_key
)
209 for ( i
= 0; i
< sizeof(vlc_keys
) / sizeof(key_descriptor_t
); i
++ )
211 if ( vlc_keys
[i
].i_key_code
== i_key
)
213 return vlc_keys
[i
].psz_key_string
;
219 static inline int StringToKey( char *psz_key
)
222 for ( i
= 0; i
< sizeof(vlc_keys
) / sizeof(key_descriptor_t
); i
++ )
224 if ( !strcmp( vlc_keys
[i
].psz_key_string
, psz_key
))
226 return vlc_keys
[i
].i_key_code
;
232 typedef enum vlc_key
{
242 ACTIONID_TOGGLE_FULLSCREEN
,
245 ACTIONID_NAV_ACTIVATE
,
250 ACTIONID_JUMP_BACKWARD_EXTRASHORT
,
251 ACTIONID_JUMP_FORWARD_EXTRASHORT
,
252 ACTIONID_JUMP_BACKWARD_SHORT
,
253 ACTIONID_JUMP_FORWARD_SHORT
,
254 ACTIONID_JUMP_BACKWARD_MEDIUM
,
255 ACTIONID_JUMP_FORWARD_MEDIUM
,
256 ACTIONID_JUMP_BACKWARD_LONG
,
257 ACTIONID_JUMP_FORWARD_LONG
,
260 /* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
261 ACTIONID_SET_BOOKMARK1
,
262 ACTIONID_SET_BOOKMARK2
,
263 ACTIONID_SET_BOOKMARK3
,
264 ACTIONID_SET_BOOKMARK4
,
265 ACTIONID_SET_BOOKMARK5
,
266 ACTIONID_SET_BOOKMARK6
,
267 ACTIONID_SET_BOOKMARK7
,
268 ACTIONID_SET_BOOKMARK8
,
269 ACTIONID_SET_BOOKMARK9
,
270 ACTIONID_SET_BOOKMARK10
,
271 ACTIONID_PLAY_BOOKMARK1
,
272 ACTIONID_PLAY_BOOKMARK2
,
273 ACTIONID_PLAY_BOOKMARK3
,
274 ACTIONID_PLAY_BOOKMARK4
,
275 ACTIONID_PLAY_BOOKMARK5
,
276 ACTIONID_PLAY_BOOKMARK6
,
277 ACTIONID_PLAY_BOOKMARK7
,
278 ACTIONID_PLAY_BOOKMARK8
,
279 ACTIONID_PLAY_BOOKMARK9
,
280 ACTIONID_PLAY_BOOKMARK10
,
281 /* end of contiguous zone */
282 ACTIONID_SUBDELAY_UP
,
283 ACTIONID_SUBDELAY_DOWN
,
284 ACTIONID_HISTORY_BACK
,
285 ACTIONID_HISTORY_FORWARD
,
286 ACTIONID_AUDIO_TRACK
,
287 ACTIONID_SUBTITLE_TRACK
,
288 ACTIONID_CUBESPEED_UP
,
289 ACTIONID_CUBESPEED_DOWN
,
292 /* chapter and title navigation */
295 ACTIONID_CHAPTER_PREV
,
296 ACTIONID_CHAPTER_NEXT
,
297 /* end of chapter and title navigation */
298 ACTIONID_AUDIODELAY_UP
,
299 ACTIONID_AUDIODELAY_DOWN
,
303 ACTIONID_ASPECT_RATIO
,
305 ACTIONID_DEINTERLACE
,
311 ACTIONID_UNCROP_LEFT
,
312 ACTIONID_CROP_BOTTOM
,
313 ACTIONID_UNCROP_BOTTOM
,
315 ACTIONID_UNCROP_RIGHT
,
320 ACTIONID_LEAVE_FULLSCREEN
,
327 ACTIONID_MENU_SELECT
,
329 ACTIONID_ZOOM_QUARTER
,
331 ACTIONID_ZOOM_ORIGINAL
,
332 ACTIONID_ZOOM_DOUBLE
,
333 /* Cycle Through Audio Devices */
334 ACTIONID_AUDIODEVICE_CYCLE