/[pcsx2_0.9.7]/trunk/pcsx2/Linux/LnxKeyCodes.cpp
ViewVC logotype

Contents of /trunk/pcsx2/Linux/LnxKeyCodes.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (10 years, 4 months ago) by william
File size: 7345 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 #include "../PrecompiledHeader.h"
17 #include "ConsoleLogger.h"
18
19 //#include <wx/gtk/win_gtk.h>
20 #include <gdk/gdkkeysyms.h>
21 #include <gdk/gdkx.h>
22
23 // Returns a WXK_* keycode, given some kinda GDK input mess!
24 int TranslateGDKtoWXK( u32 keysym )
25 {
26 int key_code;
27
28 switch ( keysym )
29 {
30 // Shift, Control and Alt don't generate the CHAR events at all
31 case GDK_Shift_L:
32 case GDK_Shift_R:
33 key_code = WXK_SHIFT;
34 break;
35 case GDK_Control_L:
36 case GDK_Control_R:
37 key_code = WXK_CONTROL;
38 break;
39 case GDK_Meta_L:
40 case GDK_Meta_R:
41 case GDK_Alt_L:
42 case GDK_Alt_R:
43 case GDK_Super_L:
44 case GDK_Super_R:
45 key_code = WXK_ALT;
46 break;
47
48 // neither do the toggle modifies
49 case GDK_Scroll_Lock:
50 key_code = WXK_SCROLL;
51 break;
52
53 case GDK_Caps_Lock:
54 key_code = WXK_CAPITAL;
55 break;
56
57 case GDK_Num_Lock:
58 key_code = WXK_NUMLOCK;
59 break;
60
61
62 // various other special keys
63 case GDK_Menu:
64 key_code = WXK_MENU;
65 break;
66
67 case GDK_Help:
68 key_code = WXK_HELP;
69 break;
70
71 case GDK_BackSpace:
72 key_code = WXK_BACK;
73 break;
74
75 case GDK_ISO_Left_Tab:
76 case GDK_Tab:
77 key_code = WXK_TAB;
78 break;
79
80 case GDK_Linefeed:
81 case GDK_Return:
82 key_code = WXK_RETURN;
83 break;
84
85 case GDK_Clear:
86 key_code = WXK_CLEAR;
87 break;
88
89 case GDK_Pause:
90 key_code = WXK_PAUSE;
91 break;
92
93 case GDK_Select:
94 key_code = WXK_SELECT;
95 break;
96
97 case GDK_Print:
98 key_code = WXK_PRINT;
99 break;
100
101 case GDK_Execute:
102 key_code = WXK_EXECUTE;
103 break;
104
105 case GDK_Escape:
106 key_code = WXK_ESCAPE;
107 break;
108
109 // cursor and other extended keyboard keys
110 case GDK_Delete:
111 key_code = WXK_DELETE;
112 break;
113
114 case GDK_Home:
115 key_code = WXK_HOME;
116 break;
117
118 case GDK_Left:
119 key_code = WXK_LEFT;
120 break;
121
122 case GDK_Up:
123 key_code = WXK_UP;
124 break;
125
126 case GDK_Right:
127 key_code = WXK_RIGHT;
128 break;
129
130 case GDK_Down:
131 key_code = WXK_DOWN;
132 break;
133
134 case GDK_Prior: // == GDK_Page_Up
135 key_code = WXK_PAGEUP;
136 break;
137
138 case GDK_Next: // == GDK_Page_Down
139 key_code = WXK_PAGEDOWN;
140 break;
141
142 case GDK_End:
143 key_code = WXK_END;
144 break;
145
146 case GDK_Begin:
147 key_code = WXK_HOME;
148 break;
149
150 case GDK_Insert:
151 key_code = WXK_INSERT;
152 break;
153
154
155 // numpad keys
156 case GDK_KP_0:
157 case GDK_KP_1:
158 case GDK_KP_2:
159 case GDK_KP_3:
160 case GDK_KP_4:
161 case GDK_KP_5:
162 case GDK_KP_6:
163 case GDK_KP_7:
164 case GDK_KP_8:
165 case GDK_KP_9:
166 key_code = WXK_NUMPAD0 + keysym - GDK_KP_0;
167 break;
168
169 case GDK_KP_Space:
170 key_code = WXK_NUMPAD_SPACE;
171 break;
172
173 case GDK_KP_Tab:
174 key_code = WXK_NUMPAD_TAB;
175 break;
176
177 case GDK_KP_Enter:
178 key_code = WXK_NUMPAD_ENTER;
179 break;
180
181 case GDK_KP_F1:
182 key_code = WXK_NUMPAD_F1;
183 break;
184
185 case GDK_KP_F2:
186 key_code = WXK_NUMPAD_F2;
187 break;
188
189 case GDK_KP_F3:
190 key_code = WXK_NUMPAD_F3;
191 break;
192
193 case GDK_KP_F4:
194 key_code = WXK_NUMPAD_F4;
195 break;
196
197 case GDK_KP_Home:
198 key_code = WXK_NUMPAD_HOME;
199 break;
200
201 case GDK_KP_Left:
202 key_code = WXK_NUMPAD_LEFT;
203 break;
204
205 case GDK_KP_Up:
206 key_code = WXK_NUMPAD_UP;
207 break;
208
209 case GDK_KP_Right:
210 key_code = WXK_NUMPAD_RIGHT;
211 break;
212
213 case GDK_KP_Down:
214 key_code = WXK_NUMPAD_DOWN;
215 break;
216
217 case GDK_KP_Prior: // == GDK_KP_Page_Up
218 key_code = WXK_NUMPAD_PAGEUP;
219 break;
220
221 case GDK_KP_Next: // == GDK_KP_Page_Down
222 key_code = WXK_NUMPAD_PAGEDOWN;
223 break;
224
225 case GDK_KP_End:
226 key_code = WXK_NUMPAD_END;
227 break;
228
229 case GDK_KP_Begin:
230 key_code = WXK_NUMPAD_BEGIN;
231 break;
232
233 case GDK_KP_Insert:
234 key_code = WXK_NUMPAD_INSERT;
235 break;
236
237 case GDK_KP_Delete:
238 key_code = WXK_NUMPAD_DELETE;
239 break;
240
241 case GDK_KP_Equal:
242 key_code = WXK_NUMPAD_EQUAL;
243 break;
244
245 case GDK_KP_Multiply:
246 key_code = WXK_NUMPAD_MULTIPLY;
247 break;
248
249 case GDK_KP_Add:
250 key_code = WXK_NUMPAD_ADD;
251 break;
252
253 case GDK_KP_Separator:
254 // FIXME: what is this?
255 //
256 // Some numeric keyboards have a comma on them. I believe this is the symbol
257 // for the comma, to distinguish it from the period on the numeric keypad.
258 // --arcum42
259 key_code = WXK_NUMPAD_SEPARATOR;
260 break;
261
262 case GDK_KP_Subtract:
263 key_code = WXK_NUMPAD_SUBTRACT;
264 break;
265
266 case GDK_KP_Decimal:
267 key_code = WXK_NUMPAD_DECIMAL;
268 break;
269
270 case GDK_KP_Divide:
271 key_code = WXK_NUMPAD_DIVIDE;
272 break;
273
274
275 // function keys
276 case GDK_F1:
277 case GDK_F2:
278 case GDK_F3:
279 case GDK_F4:
280 case GDK_F5:
281 case GDK_F6:
282 case GDK_F7:
283 case GDK_F8:
284 case GDK_F9:
285 case GDK_F10:
286 case GDK_F11:
287 case GDK_F12:
288 key_code = WXK_F1 + keysym - GDK_F1;
289 break;
290
291 default:
292 key_code = 0;
293 }
294
295 return key_code;
296 }
297
298 // NewPipeRedir .. Homeless function for now .. This is as good a spot as any.
299 // Eventually we might be so fancy as to have a linux console pipe to our own console
300 // window, same as the Win32 one. Not sure how doable it is, and it's not as urgent
301 // anyway since Linux has better generic console support and commandline piping.
302 //
303 PipeRedirectionBase* NewPipeRedir( FILE* stdstream )
304 {
305 return NULL;
306 }

  ViewVC Help
Powered by ViewVC 1.1.22