Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: app/keyboard_code_conversion_x.cc

Issue 3801011: touchui: Directly process key and mouse events. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: nit Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « app/keyboard_code_conversion_x.h ('k') | base/base.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "app/keyboard_code_conversion_x.h"
6
7 #include <X11/keysym.h>
8 #include <X11/Xlib.h>
9
10 #include "base/logging.h"
11
12 namespace app {
13
14 // Get an app::KeyboardCode from an X keyevent
15 KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev) {
16 KeySym keysym = XLookupKeysym(&xev->xkey, 0);
17
18 // TODO(sad): Have |keysym| go through the X map list?
19
20 switch (keysym) {
21 case XK_BackSpace:
22 return VKEY_BACK;
23 case XK_Tab:
24 return VKEY_TAB;
25 case XK_Linefeed:
26 case XK_Return:
27 return VKEY_RETURN;
28 case XK_Clear:
29 return VKEY_CLEAR;
30 case XK_KP_Space:
31 case XK_space:
32 return VKEY_SPACE;
33 case XK_Home:
34 case XK_KP_Home:
35 return VKEY_HOME;
36 case XK_End:
37 case XK_KP_End:
38 return VKEY_END;
39 case XK_Left:
40 case XK_KP_Left:
41 return VKEY_LEFT;
42 case XK_Right:
43 case XK_KP_Right:
44 return VKEY_RIGHT;
45 case XK_Down:
46 case XK_KP_Down:
47 return VKEY_DOWN;
48 case XK_Up:
49 case XK_KP_Up:
50 return VKEY_UP;
51 case XK_Control_L:
52 return VKEY_LCONTROL;
53 case XK_Control_R:
54 return VKEY_RCONTROL;
55 case XK_Escape:
56 return VKEY_ESCAPE;
57 case XK_A:
58 case XK_a:
59 return VKEY_A;
60 case XK_B:
61 case XK_b:
62 return VKEY_B;
63 case XK_C:
64 case XK_c:
65 return VKEY_C;
66 case XK_D:
67 case XK_d:
68 return VKEY_D;
69 case XK_E:
70 case XK_e:
71 return VKEY_E;
72 case XK_F:
73 case XK_f:
74 return VKEY_F;
75 case XK_G:
76 case XK_g:
77 return VKEY_G;
78 case XK_H:
79 case XK_h:
80 return VKEY_H;
81 case XK_I:
82 case XK_i:
83 return VKEY_I;
84 case XK_J:
85 case XK_j:
86 return VKEY_J;
87 case XK_K:
88 case XK_k:
89 return VKEY_K;
90 case XK_L:
91 case XK_l:
92 return VKEY_L;
93 case XK_M:
94 case XK_m:
95 return VKEY_M;
96 case XK_N:
97 case XK_n:
98 return VKEY_N;
99 case XK_O:
100 case XK_o:
101 return VKEY_O;
102 case XK_P:
103 case XK_p:
104 return VKEY_P;
105 case XK_Q:
106 case XK_q:
107 return VKEY_Q;
108 case XK_R:
109 case XK_r:
110 return VKEY_R;
111 case XK_S:
112 case XK_s:
113 return VKEY_S;
114 case XK_T:
115 case XK_t:
116 return VKEY_T;
117 case XK_U:
118 case XK_u:
119 return VKEY_U;
120 case XK_V:
121 case XK_v:
122 return VKEY_V;
123 case XK_W:
124 case XK_w:
125 return VKEY_W;
126 case XK_X:
127 case XK_x:
128 return VKEY_X;
129 case XK_Y:
130 case XK_y:
131 return VKEY_Y;
132 case XK_Z:
133 case XK_z:
134 return VKEY_Z;
135 case XK_0:
136 return VKEY_0;
137 case XK_1:
138 return VKEY_1;
139 case XK_2:
140 return VKEY_2;
141 case XK_3:
142 return VKEY_3;
143 case XK_4:
144 return VKEY_4;
145 case XK_5:
146 return VKEY_5;
147 case XK_6:
148 return VKEY_6;
149 case XK_7:
150 return VKEY_7;
151 case XK_8:
152 return VKEY_8;
153 case XK_9:
154 return VKEY_9;
155
156 // TODO(sad): A lot of keycodes are still missing.
157 }
158
159 DLOG(WARNING) << "Unknown keycode: " << keysym;
160 return VKEY_UNKNOWN;
161 }
162
163 } // namespace app
OLDNEW
« no previous file with comments | « app/keyboard_code_conversion_x.h ('k') | base/base.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698