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 *****************************************************************************/
24 #if !defined( __LIBVLC__ )
25 #error You are not libvlc or one of its plugins. You cannot include this file
31 #define KEY_MODIFIER 0xFF000000
32 #define KEY_MODIFIER_ALT 0x01000000
33 #define KEY_MODIFIER_SHIFT 0x02000000
34 #define KEY_MODIFIER_CTRL 0x04000000
35 #define KEY_MODIFIER_META 0x08000000
36 #define KEY_MODIFIER_COMMAND 0x10000000
38 #define KEY_SPECIAL 0x00FF0000
39 #define KEY_LEFT 0x00010000
40 #define KEY_RIGHT 0x00020000
41 #define KEY_UP 0x00030000
42 #define KEY_DOWN 0x00040000
43 #define KEY_SPACE 0x00050000
44 #define KEY_ENTER 0x00060000
45 #define KEY_F1 0x00070000
46 #define KEY_F2 0x00080000
47 #define KEY_F3 0x00090000
48 #define KEY_F4 0x000A0000
49 #define KEY_F5 0x000B0000
50 #define KEY_F6 0x000C0000
51 #define KEY_F7 0x000D0000
52 #define KEY_F8 0x000E0000
53 #define KEY_F9 0x000F0000
54 #define KEY_F10 0x00100000
55 #define KEY_F11 0x00110000
56 #define KEY_F12 0x00120000
57 #define KEY_HOME 0x00130000
58 #define KEY_END 0x00140000
59 #define KEY_INSERT 0x00150000
60 #define KEY_DELETE 0x00160000
61 #define KEY_MENU 0x00170000
62 #define KEY_ESC 0x00180000
63 #define KEY_PAGEUP 0x00190000
64 #define KEY_PAGEDOWN 0x001A0000
65 #define KEY_TAB 0x001B0000
66 #define KEY_BACKSPACE 0x001C0000
67 #define KEY_MOUSEWHEELUP 0x001D0000
68 #define KEY_MOUSEWHEELDOWN 0x001E0000
69 #define KEY_MOUSEWHEELLEFT 0x001F0000
70 #define KEY_MOUSEWHEELRIGHT 0x00200000
73 * The media keys are only used in win32. Support for other OSes needs to
75 #define KEY_BROWSER_BACK 0x001F0000
76 #define KEY_BROWSER_FORWARD 0x00200000
77 #define KEY_BROWSER_REFRESH 0x00210000
78 #define KEY_BROWSER_STOP 0x00220000
79 #define KEY_BROWSER_SEARCH 0x00230000
80 #define KEY_BROWSER_FAVORITES 0x00240000
81 #define KEY_BROWSER_HOME 0x00250000
82 #define KEY_VOLUME_MUTE 0x00260000
83 #define KEY_VOLUME_DOWN 0x00270000
84 #define KEY_VOLUME_UP 0x00280000
85 #define KEY_MEDIA_NEXT_TRACK 0x00290000
86 #define KEY_MEDIA_PREV_TRACK 0x002a0000
87 #define KEY_MEDIA_STOP 0x002b0000
88 #define KEY_MEDIA_PLAY_PAUSE 0x002c0000
90 #define KEY_ASCII 0x0000007F
93 typedef struct key_descriptor_s
95 const char *psz_key_string
;
99 #define ADD_KEY(a) { a, *a }
101 static const struct key_descriptor_s vlc_modifiers
[] =
103 { "Alt", KEY_MODIFIER_ALT
},
104 { "Shift", KEY_MODIFIER_SHIFT
},
105 { "Ctrl", KEY_MODIFIER_CTRL
},
106 { "Meta", KEY_MODIFIER_META
},
107 { "Command", KEY_MODIFIER_COMMAND
}
110 static const struct key_descriptor_s vlc_keys
[] =
112 { "Unset", KEY_UNSET
},
113 { "Left", KEY_LEFT
},
114 { "Right", KEY_RIGHT
},
116 { "Down", KEY_DOWN
},
117 { "Space", KEY_SPACE
},
118 { "Enter", KEY_ENTER
},
131 { "Home", KEY_HOME
},
133 { "Insert", KEY_INSERT
},
134 { "Delete", KEY_DELETE
},
135 { "Menu", KEY_MENU
},
137 { "Page Up", KEY_PAGEUP
},
138 { "Page Down", KEY_PAGEDOWN
},
140 { "Backspace", KEY_BACKSPACE
},
141 { "Mouse Wheel Up", KEY_MOUSEWHEELUP
},
142 { "Mouse Wheel Down", KEY_MOUSEWHEELDOWN
},
194 { "Browser Back", KEY_BROWSER_BACK
},
195 { "Browser Forward", KEY_BROWSER_FORWARD
},
196 { "Browser Refresh", KEY_BROWSER_REFRESH
},
197 { "Browser Stop", KEY_BROWSER_STOP
},
198 { "Browser Search", KEY_BROWSER_SEARCH
},
199 { "Browser Favorites", KEY_BROWSER_FAVORITES
},
200 { "Browser Home", KEY_BROWSER_HOME
},
201 { "Volume Mute", KEY_VOLUME_MUTE
},
202 { "Volume Down", KEY_VOLUME_DOWN
},
203 { "Volume Up", KEY_VOLUME_UP
},
204 { "Media Next Track", KEY_MEDIA_NEXT_TRACK
},
205 { "Media Prev Track", KEY_MEDIA_PREV_TRACK
},
206 { "Media Stop", KEY_MEDIA_STOP
},
207 { "Media Play Pause", KEY_MEDIA_PLAY_PAUSE
}
210 static inline const char *KeyToString( int i_key
)
213 for ( i
= 0; i
< sizeof(vlc_keys
) / sizeof(key_descriptor_t
); i
++ )
215 if ( vlc_keys
[i
].i_key_code
== i_key
)
217 return vlc_keys
[i
].psz_key_string
;
223 static inline int StringToKey( char *psz_key
)
226 for ( i
= 0; i
< sizeof(vlc_keys
) / sizeof(key_descriptor_t
); i
++ )
228 if ( !strcmp( vlc_keys
[i
].psz_key_string
, psz_key
))
230 return vlc_keys
[i
].i_key_code
;
236 typedef enum vlc_key
{
246 ACTIONID_TOGGLE_FULLSCREEN
,
249 ACTIONID_NAV_ACTIVATE
,
254 ACTIONID_JUMP_BACKWARD_EXTRASHORT
,
255 ACTIONID_JUMP_FORWARD_EXTRASHORT
,
256 ACTIONID_JUMP_BACKWARD_SHORT
,
257 ACTIONID_JUMP_FORWARD_SHORT
,
258 ACTIONID_JUMP_BACKWARD_MEDIUM
,
259 ACTIONID_JUMP_FORWARD_MEDIUM
,
260 ACTIONID_JUMP_BACKWARD_LONG
,
261 ACTIONID_JUMP_FORWARD_LONG
,
264 /* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
265 ACTIONID_SET_BOOKMARK1
,
266 ACTIONID_SET_BOOKMARK2
,
267 ACTIONID_SET_BOOKMARK3
,
268 ACTIONID_SET_BOOKMARK4
,
269 ACTIONID_SET_BOOKMARK5
,
270 ACTIONID_SET_BOOKMARK6
,
271 ACTIONID_SET_BOOKMARK7
,
272 ACTIONID_SET_BOOKMARK8
,
273 ACTIONID_SET_BOOKMARK9
,
274 ACTIONID_SET_BOOKMARK10
,
275 ACTIONID_PLAY_BOOKMARK1
,
276 ACTIONID_PLAY_BOOKMARK2
,
277 ACTIONID_PLAY_BOOKMARK3
,
278 ACTIONID_PLAY_BOOKMARK4
,
279 ACTIONID_PLAY_BOOKMARK5
,
280 ACTIONID_PLAY_BOOKMARK6
,
281 ACTIONID_PLAY_BOOKMARK7
,
282 ACTIONID_PLAY_BOOKMARK8
,
283 ACTIONID_PLAY_BOOKMARK9
,
284 ACTIONID_PLAY_BOOKMARK10
,
285 /* end of contiguous zone */
286 ACTIONID_SUBDELAY_UP
,
287 ACTIONID_SUBDELAY_DOWN
,
288 ACTIONID_HISTORY_BACK
,
289 ACTIONID_HISTORY_FORWARD
,
290 ACTIONID_AUDIO_TRACK
,
291 ACTIONID_SUBTITLE_TRACK
,
292 ACTIONID_CUBESPEED_UP
,
293 ACTIONID_CUBESPEED_DOWN
,
296 /* chapter and title navigation */
299 ACTIONID_CHAPTER_PREV
,
300 ACTIONID_CHAPTER_NEXT
,
301 /* end of chapter and title navigation */
302 ACTIONID_AUDIODELAY_UP
,
303 ACTIONID_AUDIODELAY_DOWN
,
307 ACTIONID_ASPECT_RATIO
,
309 ACTIONID_DEINTERLACE
,
315 ACTIONID_UNCROP_LEFT
,
316 ACTIONID_CROP_BOTTOM
,
317 ACTIONID_UNCROP_BOTTOM
,
319 ACTIONID_UNCROP_RIGHT
,
324 ACTIONID_LEAVE_FULLSCREEN
,
331 ACTIONID_MENU_SELECT
,
333 ACTIONID_ZOOM_QUARTER
,
335 ACTIONID_ZOOM_ORIGINAL
,
336 ACTIONID_ZOOM_DOUBLE
,
337 /* Cycle Through Audio Devices */
338 ACTIONID_AUDIODEVICE_CYCLE