]> git.sesse.net Git - vlc/blob - include/vlc_keys.h
Add Hotkey to cycle through audio devices
[vlc] / include / vlc_keys.h
1 /*****************************************************************************
2  * vlc_keys.h: keycode defines
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 #if !defined( __LIBVLC__ )
25   #error You are not libvlc or one of its plugins. You cannot include this file
26 #endif
27
28 #ifndef _VLC_KEYS_H
29 #define _VLC_KEYS_H 1
30
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
37
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
71
72 /* TODO:
73  * The media keys are only used in win32. Support for other OSes needs to
74  * be added */
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
89
90 #define KEY_ASCII            0x0000007F
91 #define KEY_UNSET            0
92
93 typedef struct key_descriptor_s
94 {
95     const char *psz_key_string;
96     int i_key_code;
97 } key_descriptor_t;
98
99 #define ADD_KEY(a) { a, *a }
100
101 static const struct key_descriptor_s vlc_modifiers[] =
102 {
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 }
108 };
109
110 static const struct key_descriptor_s vlc_keys[] =
111 {
112     { "Unset", KEY_UNSET },
113     { "Left", KEY_LEFT },
114     { "Right", KEY_RIGHT },
115     { "Up", KEY_UP },
116     { "Down", KEY_DOWN },
117     { "Space", KEY_SPACE },
118     { "Enter", KEY_ENTER },
119     { "F1", KEY_F1 },
120     { "F2", KEY_F2 },
121     { "F3", KEY_F3 },
122     { "F4", KEY_F4 },
123     { "F5", KEY_F5 },
124     { "F6", KEY_F6 },
125     { "F7", KEY_F7 },
126     { "F8", KEY_F8 },
127     { "F9", KEY_F9 },
128     { "F10", KEY_F10 },
129     { "F11", KEY_F11 },
130     { "F12", KEY_F12 },
131     { "Home", KEY_HOME },
132     { "End", KEY_END },
133     { "Insert", KEY_INSERT },
134     { "Delete", KEY_DELETE },
135     { "Menu", KEY_MENU },
136     { "Esc", KEY_ESC },
137     { "Page Up", KEY_PAGEUP },
138     { "Page Down", KEY_PAGEDOWN },
139     { "Tab", KEY_TAB },
140     { "Backspace", KEY_BACKSPACE },
141     { "Mouse Wheel Up", KEY_MOUSEWHEELUP },
142     { "Mouse Wheel Down", KEY_MOUSEWHEELDOWN },
143     { "0", '0' },
144     { "1", '1' },
145     { "2", '2' },
146     { "3", '3' },
147     { "4", '4' },
148     { "5", '5' },
149     { "6", '6' },
150     { "7", '7' },
151     { "8", '8' },
152     { "9", '9' },
153     { "a", 'a' },
154     { "b", 'b' },
155     { "c", 'c' },
156     { "d", 'd' },
157     { "e", 'e' },
158     { "f", 'f' },
159     { "g", 'g' },
160     { "h", 'h' },
161     { "i", 'i' },
162     { "j", 'j' },
163     { "k", 'k' },
164     { "l", 'l' },
165     { "m", 'm' },
166     { "n", 'n' },
167     { "o", 'o' },
168     { "p", 'p' },
169     { "q", 'q' },
170     { "r", 'r' },
171     { "s", 's' },
172     { "t", 't' },
173     { "u", 'u' },
174     { "v", 'v' },
175     { "w", 'w' },
176     { "x", 'x' },
177     { "y", 'y' },
178     { "z", 'z' },
179     { "+", '+' },
180     { "=", '=' },
181     { "-", '-' },
182     { ",", ',' },
183     { ".", '.' },
184     { "<", '<' },
185     { ">", '>' },
186     { "`", '`' },
187     { "/", '/' },
188     { ";", ';' },
189     { "'", '\'' },
190     { "\\", '\\' },
191     { "[", '[' },
192     { "]", ']' },
193     { "*", '*' },
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 }
208 };
209
210 static inline const char *KeyToString( int i_key )
211 {
212     unsigned int i = 0;
213     for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
214     {
215         if ( vlc_keys[i].i_key_code == i_key )
216         {
217             return vlc_keys[i].psz_key_string;
218         }
219     }
220     return NULL;
221 }
222
223 static inline int StringToKey( char *psz_key )
224 {
225     unsigned int i = 0;
226     for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
227     {
228         if ( !strcmp( vlc_keys[i].psz_key_string, psz_key ))
229         {
230             return vlc_keys[i].i_key_code;
231         }
232     }
233     return 0;
234 }
235
236
237 #define ACTIONID_QUIT                  1
238 #define ACTIONID_PLAY_PAUSE            2
239 #define ACTIONID_PLAY                  3
240 #define ACTIONID_PAUSE                 4
241 #define ACTIONID_STOP                  5
242 #define ACTIONID_PREV                  6
243 #define ACTIONID_NEXT                  7
244 #define ACTIONID_SLOWER                8
245 #define ACTIONID_FASTER                9
246 #define ACTIONID_TOGGLE_FULLSCREEN     10
247 #define ACTIONID_VOL_UP                11
248 #define ACTIONID_VOL_DOWN              12
249 #define ACTIONID_NAV_ACTIVATE          13
250 #define ACTIONID_NAV_UP                14
251 #define ACTIONID_NAV_DOWN              15
252 #define ACTIONID_NAV_LEFT              16
253 #define ACTIONID_NAV_RIGHT             17
254 #define ACTIONID_JUMP_BACKWARD_EXTRASHORT 18
255 #define ACTIONID_JUMP_FORWARD_EXTRASHORT  19
256 #define ACTIONID_JUMP_BACKWARD_SHORT   20
257 #define ACTIONID_JUMP_FORWARD_SHORT    21
258 #define ACTIONID_JUMP_BACKWARD_MEDIUM  22
259 #define ACTIONID_JUMP_FORWARD_MEDIUM   23
260 #define ACTIONID_JUMP_BACKWARD_LONG    24
261 #define ACTIONID_JUMP_FORWARD_LONG     25
262 #define ACTIONID_POSITION              26
263 #define ACTIONID_VOL_MUTE              27
264 /* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
265 #define ACTIONID_SET_BOOKMARK1         28
266 #define ACTIONID_SET_BOOKMARK2         29
267 #define ACTIONID_SET_BOOKMARK3         39
268 #define ACTIONID_SET_BOOKMARK4         31
269 #define ACTIONID_SET_BOOKMARK5         32
270 #define ACTIONID_SET_BOOKMARK6         33
271 #define ACTIONID_SET_BOOKMARK7         34
272 #define ACTIONID_SET_BOOKMARK8         35
273 #define ACTIONID_SET_BOOKMARK9         36
274 #define ACTIONID_SET_BOOKMARK10        37
275 #define ACTIONID_PLAY_BOOKMARK1        38
276 #define ACTIONID_PLAY_BOOKMARK2        39
277 #define ACTIONID_PLAY_BOOKMARK3        40
278 #define ACTIONID_PLAY_BOOKMARK4        41
279 #define ACTIONID_PLAY_BOOKMARK5        42
280 #define ACTIONID_PLAY_BOOKMARK6        43
281 #define ACTIONID_PLAY_BOOKMARK7        44
282 #define ACTIONID_PLAY_BOOKMARK8        45
283 #define ACTIONID_PLAY_BOOKMARK9        46
284 #define ACTIONID_PLAY_BOOKMARK10       47
285 /* end of contiguous zone */
286 #define ACTIONID_SUBDELAY_UP           48
287 #define ACTIONID_SUBDELAY_DOWN         49
288 #define ACTIONID_HISTORY_BACK          50
289 #define ACTIONID_HISTORY_FORWARD       51
290 #define ACTIONID_AUDIO_TRACK           52
291 #define ACTIONID_SUBTITLE_TRACK        53
292 #define ACTIONID_CUBESPEED_UP          54
293 #define ACTIONID_CUBESPEED_DOWN        55
294 #define ACTIONID_INTF_SHOW             56
295 #define ACTIONID_INTF_HIDE             57
296 /* chapter and title navigation */
297 #define ACTIONID_TITLE_PREV            58
298 #define ACTIONID_TITLE_NEXT            59
299 #define ACTIONID_CHAPTER_PREV          60
300 #define ACTIONID_CHAPTER_NEXT          61
301 /* end of chapter and title navigation */
302 #define ACTIONID_AUDIODELAY_UP         62
303 #define ACTIONID_AUDIODELAY_DOWN       63
304 #define ACTIONID_SNAPSHOT              64
305 #define ACTIONID_RECORD                65
306 #define ACTIONID_DISC_MENU             66
307 #define ACTIONID_ASPECT_RATIO          67
308 #define ACTIONID_CROP                  68
309 #define ACTIONID_DEINTERLACE           69
310 #define ACTIONID_ZOOM                  70
311 #define ACTIONID_UNZOOM                71
312 #define ACTIONID_CROP_TOP              72
313 #define ACTIONID_UNCROP_TOP            73
314 #define ACTIONID_CROP_LEFT             74
315 #define ACTIONID_UNCROP_LEFT           75
316 #define ACTIONID_CROP_BOTTOM           76
317 #define ACTIONID_UNCROP_BOTTOM         77
318 #define ACTIONID_CROP_RIGHT            78
319 #define ACTIONID_UNCROP_RIGHT          79
320 #define ACTIONID_DUMP                  80
321 #define ACTIONID_RANDOM                81
322 #define ACTIONID_LOOP                  82
323 #define ACTIONID_WALLPAPER             83
324 #define ACTIONID_LEAVE_FULLSCREEN      84
325 #define ACTIONID_MENU_ON               85
326 #define ACTIONID_MENU_OFF              86
327 #define ACTIONID_MENU_RIGHT            87
328 #define ACTIONID_MENU_LEFT             88
329 #define ACTIONID_MENU_UP               89
330 #define ACTIONID_MENU_DOWN             90
331 #define ACTIONID_MENU_SELECT           91
332 /* Zoom */
333 #define ACTIONID_ZOOM_QUARTER          92
334 #define ACTIONID_ZOOM_HALF             93
335 #define ACTIONID_ZOOM_ORIGINAL         94
336 #define ACTIONID_ZOOM_DOUBLE           95
337 /* Cycle Through Audio Devices */
338 #define ACTIONID_AUDIODEVICE_CYCLE     96
339 #endif