/[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 290 - (show annotations) (download)
Sat Dec 25 02:51:30 2010 UTC (9 years, 1 month ago) by william
File size: 7679 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4139 local: v0.9.7.283-latest) 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 <gdk/gdkkeysyms.h>
20 #if (GTK_MAJOR_VERSION > 2)
21 // All those GDK_<key> defines are now GDK_KEY_<key>, as of around Gtk+ 2.22. This include gets brought in automatically until Gtk 3.0,
22 // But we want to bring it in after that, too, until we're ready to break compatability prior to Gtk+ 2.22.
23 #include <gdk/gdkkeysyms-compat.h>
24 #endif
25
26 void NTFS_CompressFile( const wxString& file, bool compressStatus ) {}
27
28 // Returns a WXK_* keycode, given some kinda GDK input mess!
29 int TranslateGDKtoWXK( u32 keysym )
30 {
31 int key_code;
32
33 switch ( keysym )
34 {
35 // Shift, Control and Alt don't generate the CHAR events at all
36 case GDK_Shift_L:
37 case GDK_Shift_R:
38 key_code = WXK_SHIFT;
39 break;
40 case GDK_Control_L:
41 case GDK_Control_R:
42 key_code = WXK_CONTROL;
43 break;
44 case GDK_Meta_L:
45 case GDK_Meta_R:
46 case GDK_Alt_L:
47 case GDK_Alt_R:
48 case GDK_Super_L:
49 case GDK_Super_R:
50 key_code = WXK_ALT;
51 break;
52
53 // neither do the toggle modifies
54 case GDK_Scroll_Lock:
55 key_code = WXK_SCROLL;
56 break;
57
58 case GDK_Caps_Lock:
59 key_code = WXK_CAPITAL;
60 break;
61
62 case GDK_Num_Lock:
63 key_code = WXK_NUMLOCK;
64 break;
65
66
67 // various other special keys
68 case GDK_Menu:
69 key_code = WXK_MENU;
70 break;
71
72 case GDK_Help:
73 key_code = WXK_HELP;
74 break;
75
76 case GDK_BackSpace:
77 key_code = WXK_BACK;
78 break;
79
80 case GDK_ISO_Left_Tab:
81 case GDK_Tab:
82 key_code = WXK_TAB;
83 break;
84
85 case GDK_Linefeed:
86 case GDK_Return:
87 key_code = WXK_RETURN;
88 break;
89
90 case GDK_Clear:
91 key_code = WXK_CLEAR;
92 break;
93
94 case GDK_Pause:
95 key_code = WXK_PAUSE;
96 break;
97
98 case GDK_Select:
99 key_code = WXK_SELECT;
100 break;
101
102 case GDK_Print:
103 key_code = WXK_PRINT;
104 break;
105
106 case GDK_Execute:
107 key_code = WXK_EXECUTE;
108 break;
109
110 case GDK_Escape:
111 key_code = WXK_ESCAPE;
112 break;
113
114 // cursor and other extended keyboard keys
115 case GDK_Delete:
116 key_code = WXK_DELETE;
117 break;
118
119 case GDK_Home:
120 key_code = WXK_HOME;
121 break;
122
123 case GDK_Left:
124 key_code = WXK_LEFT;
125 break;
126
127 case GDK_Up:
128 key_code = WXK_UP;
129 break;
130
131 case GDK_Right:
132 key_code = WXK_RIGHT;
133 break;
134
135 case GDK_Down:
136 key_code = WXK_DOWN;
137 break;
138
139 case GDK_Prior: // == GDK_Page_Up
140 key_code = WXK_PAGEUP;
141 break;
142
143 case GDK_Next: // == GDK_Page_Down
144 key_code = WXK_PAGEDOWN;
145 break;
146
147 case GDK_End:
148 key_code = WXK_END;
149 break;
150
151 case GDK_Begin:
152 key_code = WXK_HOME;
153 break;
154
155 case GDK_Insert:
156 key_code = WXK_INSERT;
157 break;
158
159
160 // numpad keys
161 case GDK_KP_0:
162 case GDK_KP_1:
163 case GDK_KP_2:
164 case GDK_KP_3:
165 case GDK_KP_4:
166 case GDK_KP_5:
167 case GDK_KP_6:
168 case GDK_KP_7:
169 case GDK_KP_8:
170 case GDK_KP_9:
171 key_code = WXK_NUMPAD0 + keysym - GDK_KP_0;
172 break;
173
174 case GDK_KP_Space:
175 key_code = WXK_NUMPAD_SPACE;
176 break;
177
178 case GDK_KP_Tab:
179 key_code = WXK_NUMPAD_TAB;
180 break;
181
182 case GDK_KP_Enter:
183 key_code = WXK_NUMPAD_ENTER;
184 break;
185
186 case GDK_KP_F1:
187 key_code = WXK_NUMPAD_F1;
188 break;
189
190 case GDK_KP_F2:
191 key_code = WXK_NUMPAD_F2;
192 break;
193
194 case GDK_KP_F3:
195 key_code = WXK_NUMPAD_F3;
196 break;
197
198 case GDK_KP_F4:
199 key_code = WXK_NUMPAD_F4;
200 break;
201
202 case GDK_KP_Home:
203 key_code = WXK_NUMPAD_HOME;
204 break;
205
206 case GDK_KP_Left:
207 key_code = WXK_NUMPAD_LEFT;
208 break;
209
210 case GDK_KP_Up:
211 key_code = WXK_NUMPAD_UP;
212 break;
213
214 case GDK_KP_Right:
215 key_code = WXK_NUMPAD_RIGHT;
216 break;
217
218 case GDK_KP_Down:
219 key_code = WXK_NUMPAD_DOWN;
220 break;
221
222 case GDK_KP_Prior: // == GDK_KP_Page_Up
223 key_code = WXK_NUMPAD_PAGEUP;
224 break;
225
226 case GDK_KP_Next: // == GDK_KP_Page_Down
227 key_code = WXK_NUMPAD_PAGEDOWN;
228 break;
229
230 case GDK_KP_End:
231 key_code = WXK_NUMPAD_END;
232 break;
233
234 case GDK_KP_Begin:
235 key_code = WXK_NUMPAD_BEGIN;
236 break;
237
238 case GDK_KP_Insert:
239 key_code = WXK_NUMPAD_INSERT;
240 break;
241
242 case GDK_KP_Delete:
243 key_code = WXK_NUMPAD_DELETE;
244 break;
245
246 case GDK_KP_Equal:
247 key_code = WXK_NUMPAD_EQUAL;
248 break;
249
250 case GDK_KP_Multiply:
251 key_code = WXK_NUMPAD_MULTIPLY;
252 break;
253
254 case GDK_KP_Add:
255 key_code = WXK_NUMPAD_ADD;
256 break;
257
258 case GDK_KP_Separator:
259 // FIXME: what is this?
260 //
261 // Some numeric keyboards have a comma on them. I believe this is the symbol
262 // for the comma, to distinguish it from the period on the numeric keypad.
263 // --arcum42
264 key_code = WXK_NUMPAD_SEPARATOR;
265 break;
266
267 case GDK_KP_Subtract:
268 key_code = WXK_NUMPAD_SUBTRACT;
269 break;
270
271 case GDK_KP_Decimal:
272 key_code = WXK_NUMPAD_DECIMAL;
273 break;
274
275 case GDK_KP_Divide:
276 key_code = WXK_NUMPAD_DIVIDE;
277 break;
278
279
280 // function keys
281 case GDK_F1:
282 case GDK_F2:
283 case GDK_F3:
284 case GDK_F4:
285 case GDK_F5:
286 case GDK_F6:
287 case GDK_F7:
288 case GDK_F8:
289 case GDK_F9:
290 case GDK_F10:
291 case GDK_F11:
292 case GDK_F12:
293 key_code = WXK_F1 + keysym - GDK_F1;
294 break;
295
296 default:
297 key_code = 0;
298 }
299
300 return key_code;
301 }
302
303 // NewPipeRedir .. Homeless function for now .. This is as good a spot as any.
304 // Eventually we might be so fancy as to have a linux console pipe to our own console
305 // window, same as the Win32 one. Not sure how doable it is, and it's not as urgent
306 // anyway since Linux has better generic console support and commandline piping.
307 //
308 PipeRedirectionBase* NewPipeRedir( FILE* stdstream )
309 {
310 return NULL;
311 }

  ViewVC Help
Powered by ViewVC 1.1.22