]> git.sesse.net Git - vlc/blob - include/vlc_keys.h
Added new hotkeys (key-intf-hide, key-jump-3sec, key-jump+3sec, key-title-next, key...
[vlc] / include / vlc_keys.h
1 /*****************************************************************************
2  * hotkeys.h: keycode defines
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #define KEY_MODIFIER         0xFF000000
25 #define KEY_MODIFIER_ALT     0x01000000
26 #define KEY_MODIFIER_SHIFT   0x02000000
27 #define KEY_MODIFIER_CTRL    0x04000000
28 #define KEY_MODIFIER_META    0x08000000
29 #define KEY_MODIFIER_COMMAND 0x10000000
30
31 #define KEY_SPECIAL          0x00FF0000
32 #define KEY_LEFT             0x00010000
33 #define KEY_RIGHT            0x00020000
34 #define KEY_UP               0x00030000
35 #define KEY_DOWN             0x00040000
36 #define KEY_SPACE            0x00050000
37 #define KEY_ENTER            0x00060000
38 #define KEY_F1               0x00070000
39 #define KEY_F2               0x00080000
40 #define KEY_F3               0x00090000
41 #define KEY_F4               0x000A0000
42 #define KEY_F5               0x000B0000
43 #define KEY_F6               0x000C0000
44 #define KEY_F7               0x000D0000
45 #define KEY_F8               0x000E0000
46 #define KEY_F9               0x000F0000
47 #define KEY_F10              0x00100000
48 #define KEY_F11              0x00110000
49 #define KEY_F12              0x00120000
50 #define KEY_HOME             0x00130000
51 #define KEY_END              0x00140000
52 #define KEY_INSERT           0x00150000
53 #define KEY_DELETE           0x00160000
54 #define KEY_MENU             0x00170000
55 #define KEY_ESC              0x00180000
56 #define KEY_PAGEUP           0x00190000
57 #define KEY_PAGEDOWN         0x001A0000
58 #define KEY_TAB              0x001B0000
59 #define KEY_BACKSPACE        0x001C0000
60 #define KEY_MOUSEWHEELUP     0x001D0000
61 #define KEY_MOUSEWHEELDOWN   0x001E0000
62
63 #define KEY_ASCII            0x0000007F
64 #define KEY_UNSET            0
65
66 typedef struct key_descriptor_s
67 {
68     char *psz_key_string;
69     int i_key_code;
70 } key_descriptor_t;
71
72 #define ADD_KEY(a) { a, *a }
73
74 static const struct key_descriptor_s vlc_modifiers[] =
75 {
76     { "Alt", KEY_MODIFIER_ALT },
77     { "Shift", KEY_MODIFIER_SHIFT },
78     { "Ctrl", KEY_MODIFIER_CTRL },
79     { "Meta", KEY_MODIFIER_META },
80     { "Command", KEY_MODIFIER_COMMAND }
81 };
82
83 static const struct key_descriptor_s vlc_keys[] =
84 {
85     { "Unset", KEY_UNSET },
86     { "Left", KEY_LEFT },
87     { "Right", KEY_RIGHT },
88     { "Up", KEY_UP },
89     { "Down", KEY_DOWN },
90     { "Space", KEY_SPACE },
91     { "Enter", KEY_ENTER },
92     { "F1", KEY_F1 },
93     { "F2", KEY_F2 },
94     { "F3", KEY_F3 },
95     { "F4", KEY_F4 },
96     { "F5", KEY_F5 },
97     { "F6", KEY_F6 },
98     { "F7", KEY_F7 },
99     { "F8", KEY_F8 },
100     { "F9", KEY_F9 },
101     { "F10", KEY_F10 },
102     { "F11", KEY_F11 },
103     { "F12", KEY_F12 },
104     { "Home", KEY_HOME },
105     { "End", KEY_END },
106     { "Insert", KEY_INSERT },
107     { "Delete", KEY_DELETE },
108     { "Menu", KEY_MENU },
109     { "Esc", KEY_ESC },
110     { "Page Up", KEY_PAGEUP },
111     { "Page Down", KEY_PAGEDOWN },
112     { "Tab", KEY_TAB },
113     { "Backspace", KEY_BACKSPACE },
114     { "Mouse Wheel Up", KEY_MOUSEWHEELUP },
115     { "Mouse Wheel Down", KEY_MOUSEWHEELDOWN },
116     { "a", 'a' },
117     { "b", 'b' },
118     { "c", 'c' },
119     { "d", 'd' },
120     { "e", 'e' },
121     { "f", 'f' },
122     { "g", 'g' },
123     { "h", 'h' },
124     { "i", 'i' },
125     { "j", 'j' },
126     { "k", 'k' },
127     { "l", 'l' },
128     { "m", 'm' },
129     { "n", 'n' },
130     { "o", 'o' },
131     { "p", 'p' },
132     { "q", 'q' },
133     { "r", 'r' },
134     { "s", 's' },
135     { "t", 't' },
136     { "u", 'u' },
137     { "v", 'v' },
138     { "w", 'w' },
139     { "x", 'x' },
140     { "y", 'y' },
141     { "z", 'z' },
142     { "+", '+' },
143     { "=", '=' },
144     { "-", '-' },
145     { ",", ',' },
146     { ".", '.' },
147     { "<", '<' },
148     { ">", '>' },
149     { "`", '`' },
150     { "/", '/' },
151     { ";", ';' },
152     { "'", '\'' },
153     { "\\", '\\' },
154     { "[", '[' },
155     { "]", ']' },
156     { "*", '*' }
157 };
158
159 static inline char *KeyToString( int i_key )
160 {
161     unsigned int i = 0;
162     for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
163     {
164         if ( vlc_keys[i].i_key_code == i_key )
165         {
166             return vlc_keys[i].psz_key_string;
167         }
168     }
169     return NULL;
170 }
171
172 static inline int StringToKey( char *psz_key )
173 {
174     unsigned int i = 0;
175     for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
176     {
177         if ( !strcmp( vlc_keys[i].psz_key_string, psz_key ))
178         {
179             return vlc_keys[i].i_key_code;
180         }
181     }
182     return 0;
183 }
184
185
186 #define ACTIONID_QUIT                  1
187 #define ACTIONID_PLAY_PAUSE            2
188 #define ACTIONID_PLAY                  3
189 #define ACTIONID_PAUSE                 4
190 #define ACTIONID_STOP                  5
191 #define ACTIONID_PREV                  6
192 #define ACTIONID_NEXT                  7
193 #define ACTIONID_SLOWER                8
194 #define ACTIONID_FASTER                9
195 #define ACTIONID_FULLSCREEN            10
196 #define ACTIONID_VOL_UP                11
197 #define ACTIONID_VOL_DOWN              12
198 #define ACTIONID_NAV_ACTIVATE          13
199 #define ACTIONID_NAV_UP                14
200 #define ACTIONID_NAV_DOWN              15
201 #define ACTIONID_NAV_LEFT              16
202 #define ACTIONID_NAV_RIGHT             17
203 #define ACTIONID_JUMP_BACKWARD_3SEC    18
204 #define ACTIONID_JUMP_FORWARD_3SEC     19
205 #define ACTIONID_JUMP_BACKWARD_10SEC   20
206 #define ACTIONID_JUMP_FORWARD_10SEC    21
207 #define ACTIONID_JUMP_BACKWARD_1MIN    21
208 #define ACTIONID_JUMP_FORWARD_1MIN     23
209 #define ACTIONID_JUMP_BACKWARD_5MIN    24
210 #define ACTIONID_JUMP_FORWARD_5MIN     25
211 #define ACTIONID_POSITION              26
212 #define ACTIONID_VOL_MUTE              27
213 /* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
214 #define ACTIONID_SET_BOOKMARK1         28
215 #define ACTIONID_SET_BOOKMARK2         29
216 #define ACTIONID_SET_BOOKMARK3         39
217 #define ACTIONID_SET_BOOKMARK4         31
218 #define ACTIONID_SET_BOOKMARK5         32
219 #define ACTIONID_SET_BOOKMARK6         33
220 #define ACTIONID_SET_BOOKMARK7         34
221 #define ACTIONID_SET_BOOKMARK8         35
222 #define ACTIONID_SET_BOOKMARK9         36
223 #define ACTIONID_SET_BOOKMARK10        37
224 #define ACTIONID_PLAY_BOOKMARK1        38
225 #define ACTIONID_PLAY_BOOKMARK2        39
226 #define ACTIONID_PLAY_BOOKMARK3        40
227 #define ACTIONID_PLAY_BOOKMARK4        41
228 #define ACTIONID_PLAY_BOOKMARK5        42
229 #define ACTIONID_PLAY_BOOKMARK6        43
230 #define ACTIONID_PLAY_BOOKMARK7        44
231 #define ACTIONID_PLAY_BOOKMARK8        45
232 #define ACTIONID_PLAY_BOOKMARK9        46
233 #define ACTIONID_PLAY_BOOKMARK10       47
234 /* end of contiguous zone */
235 #define ACTIONID_SUBDELAY_UP           48
236 #define ACTIONID_SUBDELAY_DOWN         49
237 #define ACTIONID_HISTORY_BACK          50
238 #define ACTIONID_HISTORY_FORWARD       51
239 #define ACTIONID_AUDIO_TRACK           52
240 #define ACTIONID_SUBTITLE_TRACK        53
241 #define ACTIONID_CUBESPEED_UP          54
242 #define ACTIONID_CUBESPEED_DOWN        55
243 #define ACTIONID_INTF_SHOW             56
244 #define ACTIONID_INTF_HIDE             57
245 /* chapter and title navigation */
246 #define ACTIONID_TITLE_PREV            58
247 #define ACTIONID_TITLE_NEXT            59
248 #define ACTIONID_CHAPTER_PREV          60
249 #define ACTIONID_CHAPTER_NEXT          61
250 /* end of chapter and title navigation */
251 #define ACTIONID_AUDIODELAY_UP         62
252 #define ACTIONID_AUDIODELAY_DOWN       63
253 #define ACTIONID_SNAPSHOT              64
254 #define ACTIONID_RECORD                65