FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
KeyCodesX11.cpp
1 /**********************************************************\
2 Original Author: Peter Szucs
3 
4 Created: July 14, 2011
5 License: Dual license model; choose one of two:
6 New BSD License
7 http://www.opensource.org/licenses/bsd-license.php
8 - or -
9 GNU Lesser General Public License, version 2.1
10 http://www.gnu.org/licenses/lgpl-2.1.html
11 
12 Copyright 2011 Peter Szucs and the Firebreath development team
13 \**********************************************************/
14 
15 #include "KeyCodesX11.h"
16 
17 #if FB_GUI_DISABLED != 1
18 #include <gdk/gdkkeysyms.h>
19 #endif
20 
21 namespace FB {
22 
23  FBKeyCode GDKKeyCodeToFBKeyCode( unsigned int key )
24  {
25  FBKeyCode retVal = FBKEY_UNKNOWN;
26 
27 #if FB_GUI_DISABLED != 1
28  switch( key )
29  {
30  case GDK_KP_Add : retVal = FBKEY_ADD; break;
31  case GDK_Alt_L : retVal = FBKEY_ALT; break;
32  case GDK_Alt_R : retVal = FBKEY_ALT; break;
33  case GDK_Cancel : retVal = FBKEY_CANCEL; break;
34  case GDK_Caps_Lock : retVal = FBKEY_CAPSLOCK; break;
35  case GDK_Clear : retVal = FBKEY_CLEAR; break;
36  case GDK_Control_L : retVal = FBKEY_CONTROL; break;
37  case GDK_Control_R : retVal = FBKEY_CONTROL; break;
38  case GDK_KP_Decimal : retVal = FBKEY_DECIMAL; break;
39  case GDK_Delete : retVal = FBKEY_DELETE; break;
40  case GDK_KP_Divide : retVal = FBKEY_DIVIDE; break;
41  case GDK_Escape : retVal = FBKEY_ESCAPE; break;
42  case GDK_Execute : retVal = FBKEY_EXECUTE; break;
43  case GDK_F1 : retVal = FBKEY_F1; break;
44  case GDK_F10 : retVal = FBKEY_F10; break;
45  case GDK_F11 : retVal = FBKEY_F11; break;
46  case GDK_F12 : retVal = FBKEY_F12; break;
47  case GDK_F13 : retVal = FBKEY_F13; break;
48  case GDK_F14 : retVal = FBKEY_F14; break;
49  case GDK_F15 : retVal = FBKEY_F15; break;
50  case GDK_F16 : retVal = FBKEY_F16; break;
51  case GDK_F17 : retVal = FBKEY_F17; break;
52  case GDK_F18 : retVal = FBKEY_F18; break;
53  case GDK_F19 : retVal = FBKEY_F19; break;
54  case GDK_F2 : retVal = FBKEY_F2; break;
55  case GDK_F20 : retVal = FBKEY_F20; break;
56  case GDK_F21 : retVal = FBKEY_F21; break;
57  case GDK_F22 : retVal = FBKEY_F22; break;
58  case GDK_F3 : retVal = FBKEY_F3; break;
59  case GDK_F4 : retVal = FBKEY_F4; break;
60  case GDK_F5 : retVal = FBKEY_F5; break;
61  case GDK_F6 : retVal = FBKEY_F6; break;
62  case GDK_F7 : retVal = FBKEY_F7; break;
63  case GDK_F8 : retVal = FBKEY_F8; break;
64  case GDK_F9 : retVal = FBKEY_F9; break;
65  case GDK_Help : retVal = FBKEY_HELP; break;
66  case GDK_Insert : retVal = FBKEY_INSERT; break;
67  case GDK_KP_Multiply : retVal = FBKEY_MULTIPLY; break;
68  case GDK_Num_Lock : retVal = FBKEY_NUMLOCK; break;
69  case GDK_KP_0 : retVal = FBKEY_NUMPAD0; break;
70  case GDK_KP_1 : retVal = FBKEY_NUMPAD1; break;
71  case GDK_KP_2 : retVal = FBKEY_NUMPAD2; break;
72  case GDK_KP_3 : retVal = FBKEY_NUMPAD3; break;
73  case GDK_KP_4 : retVal = FBKEY_NUMPAD4; break;
74  case GDK_KP_5 : retVal = FBKEY_NUMPAD5; break;
75  case GDK_KP_6 : retVal = FBKEY_NUMPAD6; break;
76  case GDK_KP_7 : retVal = FBKEY_NUMPAD7; break;
77  case GDK_KP_8 : retVal = FBKEY_NUMPAD8; break;
78  case GDK_KP_9 : retVal = FBKEY_NUMPAD9; break;
79  case GDK_Page_Down : retVal = FBKEY_PAGEDOWN; break;
80  case GDK_Page_Up : retVal = FBKEY_PAGEUP; break;
81  case GDK_Return : retVal = FBKEY_RETURN; break;
82  case GDK_Scroll_Lock : retVal = FBKEY_SCROLL ; break;
83  case GDK_Select : retVal = FBKEY_SELECT; break;
84  case GDK_KP_Separator : retVal = FBKEY_SEPARATOR; break;
85  case GDK_Shift_L : retVal = FBKEY_SHIFT; break;
86  case GDK_Shift_R : retVal = FBKEY_SHIFT; break;
87  case GDK_Sys_Req : retVal = FBKEY_PRINTSCREEN; break;
88  case GDK_space : retVal = FBKEY_SPACE; break;
89  case GDK_KP_Subtract : retVal = FBKEY_SUBTRACT; break;
90  case GDK_Tab : retVal = FBKEY_TAB; break;
91  case GDK_Up : retVal = FBKEY_UP; break;
92  case GDK_Down : retVal = FBKEY_DOWN; break;
93  case GDK_Left : retVal = FBKEY_LEFT; break;
94  case GDK_Right : retVal = FBKEY_RIGHT; break;
95  case GDK_Meta_L : retVal = FBKEY_WINDOWS_LEFT; break;
96  case GDK_Menu : retVal = FBKEY_WINDOWS_MENU; break;
97  case GDK_Meta_R : retVal = FBKEY_WINDOWS_RIGHT; break;
98  case GDK_BackSpace : retVal = FBKEY_BACKSPACE; break;
99  case GDK_End : retVal = FBKEY_END; break;
100  case GDK_Home : retVal = FBKEY_HOME; break;
101  case GDK_Pause : retVal = FBKEY_PAUSE; break;
102  case GDK_Print : retVal = FBKEY_PRINT; break;
103  }
104 #endif
105 
106  return retVal;
107  }
108 
109 }
110 
FBKeyCode GDKKeyCodeToFBKeyCode(unsigned int key)
Converts a GDK key code to a FireBreath key code.
Definition: KeyCodesX11.cpp:23
FBKeyCode
Values that represent different keys in a platform agnostic way.
Definition: KeyCodes.h:26