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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.22