Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / events / ozone / layout / xkb / xkb_keyboard_code_conversion.cc
blob84ab9ba565f3310865064b3f6dd90e1038d406b1
1 // Copyright 2014 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.
5 #include "ui/events/ozone/layout/xkb/xkb_keyboard_code_conversion.h"
7 #include "ui/events/keycodes/dom3/dom_key.h"
9 namespace ui {
11 DomKey NonPrintableXkbKeySymToDomKey(xkb_keysym_t keysym) {
12 switch (keysym) {
13 case XKB_KEY_BackSpace:
14 return DomKey::BACKSPACE;
15 case XKB_KEY_Tab:
16 case XKB_KEY_KP_Tab:
17 case XKB_KEY_ISO_Left_Tab:
18 return DomKey::TAB;
19 case XKB_KEY_Clear:
20 case XKB_KEY_KP_Begin:
21 case XKB_KEY_XF86Clear:
22 return DomKey::CLEAR;
23 case XKB_KEY_Return:
24 case XKB_KEY_KP_Enter:
25 return DomKey::ENTER;
26 case XKB_KEY_Linefeed:
27 return DomKey::ENTER;
28 case XKB_KEY_Pause:
29 return DomKey::PAUSE;
30 case XKB_KEY_Scroll_Lock:
31 return DomKey::SCROLL_LOCK;
32 case XKB_KEY_Escape:
33 return DomKey::ESCAPE;
34 case XKB_KEY_Multi_key:
35 return DomKey::COMPOSE;
36 case XKB_KEY_Kanji:
37 return DomKey::KANJI_MODE;
38 case XKB_KEY_Muhenkan:
39 return DomKey::NON_CONVERT;
40 case XKB_KEY_Henkan_Mode:
41 return DomKey::CONVERT;
42 case XKB_KEY_Romaji:
43 return DomKey::ROMAJI;
44 case XKB_KEY_Hiragana:
45 return DomKey::HIRAGANA;
46 case XKB_KEY_Katakana:
47 return DomKey::KATAKANA;
48 case XKB_KEY_Hiragana_Katakana:
49 return DomKey::HIRAGANA_KATAKANA;
50 case XKB_KEY_Zenkaku:
51 return DomKey::ZENKAKU;
52 case XKB_KEY_Hankaku:
53 return DomKey::HANKAKU;
54 case XKB_KEY_Zenkaku_Hankaku:
55 return DomKey::ZENKAKU_HANKAKU;
56 case XKB_KEY_Kana_Lock:
57 return DomKey::KANA_MODE;
58 case XKB_KEY_Eisu_Shift:
59 case XKB_KEY_Eisu_toggle:
60 return DomKey::EISU;
61 case XKB_KEY_Hangul:
62 return DomKey::HANGUL_MODE;
63 case XKB_KEY_Hangul_Hanja:
64 return DomKey::HANJA_MODE;
65 case XKB_KEY_Codeinput:
66 return DomKey::CODE_INPUT;
67 case XKB_KEY_SingleCandidate:
68 return DomKey::SINGLE_CANDIDATE;
69 case XKB_KEY_MultipleCandidate:
70 return DomKey::ALL_CANDIDATES;
71 case XKB_KEY_PreviousCandidate:
72 return DomKey::PREVIOUS_CANDIDATE;
73 case XKB_KEY_Home:
74 case XKB_KEY_KP_Home:
75 return DomKey::HOME;
76 case XKB_KEY_Left:
77 case XKB_KEY_KP_Left:
78 return DomKey::ARROW_LEFT;
79 case XKB_KEY_Up:
80 case XKB_KEY_KP_Up:
81 return DomKey::ARROW_UP;
82 case XKB_KEY_Right:
83 case XKB_KEY_KP_Right:
84 return DomKey::ARROW_RIGHT;
85 case XKB_KEY_Down:
86 case XKB_KEY_KP_Down:
87 return DomKey::ARROW_DOWN;
88 case XKB_KEY_Prior:
89 case XKB_KEY_KP_Prior:
90 return DomKey::PAGE_UP;
91 case XKB_KEY_Next:
92 case XKB_KEY_KP_Next:
93 case XKB_KEY_XF86ScrollDown:
94 return DomKey::PAGE_DOWN;
95 case XKB_KEY_End:
96 case XKB_KEY_KP_End:
97 case XKB_KEY_XF86ScrollUp:
98 return DomKey::END;
99 case XKB_KEY_Select:
100 return DomKey::SELECT;
101 case XKB_KEY_Print:
102 return DomKey::PRINT;
103 case XKB_KEY_Execute:
104 return DomKey::EXECUTE;
105 case XKB_KEY_Insert:
106 case XKB_KEY_KP_Insert:
107 return DomKey::INSERT;
108 case XKB_KEY_Undo:
109 return DomKey::UNDO;
110 case XKB_KEY_Redo:
111 return DomKey::REDO;
112 case XKB_KEY_Menu:
113 return DomKey::CONTEXT_MENU;
114 case XKB_KEY_Find:
115 return DomKey::FIND;
116 case XKB_KEY_Cancel:
117 return DomKey::CANCEL;
118 case XKB_KEY_Help:
119 return DomKey::HELP;
120 case XKB_KEY_Break:
121 case XKB_KEY_3270_Attn:
122 return DomKey::ATTN;
123 case XKB_KEY_Mode_switch:
124 return DomKey::MODE_CHANGE;
125 case XKB_KEY_Num_Lock:
126 return DomKey::NUM_LOCK;
127 case XKB_KEY_F1:
128 case XKB_KEY_KP_F1:
129 return DomKey::F1;
130 case XKB_KEY_F2:
131 case XKB_KEY_KP_F2:
132 return DomKey::F2;
133 case XKB_KEY_F3:
134 case XKB_KEY_KP_F3:
135 return DomKey::F3;
136 case XKB_KEY_F4:
137 case XKB_KEY_KP_F4:
138 return DomKey::F4;
139 case XKB_KEY_F5:
140 return DomKey::F5;
141 case XKB_KEY_F6:
142 return DomKey::F6;
143 case XKB_KEY_F7:
144 return DomKey::F7;
145 case XKB_KEY_F8:
146 return DomKey::F8;
147 case XKB_KEY_F9:
148 return DomKey::F9;
149 case XKB_KEY_F10:
150 return DomKey::F10;
151 case XKB_KEY_F11:
152 return DomKey::F11;
153 case XKB_KEY_F12:
154 return DomKey::F12;
155 case XKB_KEY_XF86Tools: // XKB 'inet' mapping of F13
156 case XKB_KEY_F13:
157 return DomKey::F13;
158 case XKB_KEY_F14:
159 case XKB_KEY_XF86Launch5: // XKB 'inet' mapping of F14
160 return DomKey::F14;
161 case XKB_KEY_F15:
162 case XKB_KEY_XF86Launch6: // XKB 'inet' mapping of F15
163 return DomKey::F15;
164 case XKB_KEY_F16:
165 case XKB_KEY_XF86Launch7: // XKB 'inet' mapping of F16
166 return DomKey::F16;
167 case XKB_KEY_F17:
168 case XKB_KEY_XF86Launch8: // XKB 'inet' mapping of F17
169 return DomKey::F17;
170 case XKB_KEY_F18:
171 case XKB_KEY_XF86Launch9: // XKB 'inet' mapping of F18
172 return DomKey::F18;
173 case XKB_KEY_F19:
174 return DomKey::F19;
175 case XKB_KEY_F20:
176 return DomKey::F20;
177 case XKB_KEY_F21:
178 return DomKey::F21;
179 case XKB_KEY_F22:
180 return DomKey::F22;
181 case XKB_KEY_F23:
182 return DomKey::F23;
183 case XKB_KEY_F24:
184 return DomKey::F24;
185 case XKB_KEY_Shift_L:
186 case XKB_KEY_Shift_R:
187 return DomKey::SHIFT;
188 case XKB_KEY_Control_L:
189 case XKB_KEY_Control_R:
190 return DomKey::CONTROL;
191 case XKB_KEY_Caps_Lock:
192 return DomKey::CAPS_LOCK;
193 case XKB_KEY_Meta_L:
194 case XKB_KEY_Meta_R:
195 return DomKey::META;
196 case XKB_KEY_Alt_L:
197 case XKB_KEY_Alt_R:
198 return DomKey::ALT;
199 case XKB_KEY_Super_L:
200 case XKB_KEY_Super_R:
201 return DomKey::OS;
202 case XKB_KEY_Hyper_L:
203 case XKB_KEY_Hyper_R:
204 return DomKey::HYPER;
205 case XKB_KEY_Delete:
206 return DomKey::DEL;
207 case XKB_KEY_SunProps:
208 return DomKey::PROPS;
209 case XKB_KEY_XF86Next_VMode:
210 return DomKey::VIDEO_MODE_NEXT;
211 case XKB_KEY_XF86MonBrightnessUp:
212 return DomKey::BRIGHTNESS_UP;
213 case XKB_KEY_XF86MonBrightnessDown:
214 return DomKey::BRIGHTNESS_DOWN;
215 case XKB_KEY_XF86Standby:
216 case XKB_KEY_XF86Sleep:
217 case XKB_KEY_XF86Suspend:
218 return DomKey::STANDBY;
219 case XKB_KEY_XF86AudioLowerVolume:
220 return DomKey::VOLUME_DOWN;
221 case XKB_KEY_XF86AudioMute:
222 return DomKey::VOLUME_MUTE;
223 case XKB_KEY_XF86AudioRaiseVolume:
224 return DomKey::VOLUME_UP;
225 case XKB_KEY_XF86AudioPlay:
226 return DomKey::MEDIA_PLAY;
227 case XKB_KEY_XF86AudioStop:
228 return DomKey::MEDIA_STOP;
229 case XKB_KEY_XF86AudioPrev:
230 return DomKey::MEDIA_TRACK_PREVIOUS;
231 case XKB_KEY_XF86AudioNext:
232 return DomKey::MEDIA_TRACK_NEXT;
233 case XKB_KEY_XF86HomePage:
234 return DomKey::BROWSER_HOME;
235 case XKB_KEY_XF86Mail:
236 return DomKey::LAUNCH_MAIL;
237 case XKB_KEY_XF86Search:
238 return DomKey::BROWSER_SEARCH;
239 case XKB_KEY_XF86AudioRecord:
240 return DomKey::MEDIA_RECORD;
241 case XKB_KEY_XF86Calculator:
242 return DomKey::LAUNCH_CALCULATOR;
243 case XKB_KEY_XF86Calendar:
244 return DomKey::LAUNCH_CALENDAR;
245 case XKB_KEY_XF86Back:
246 return DomKey::BROWSER_BACK;
247 case XKB_KEY_XF86Forward:
248 return DomKey::BROWSER_FORWARD;
249 case XKB_KEY_XF86Stop:
250 return DomKey::BROWSER_STOP;
251 case XKB_KEY_XF86Refresh:
252 case XKB_KEY_XF86Reload:
253 return DomKey::BROWSER_REFRESH;
254 case XKB_KEY_XF86PowerOff:
255 return DomKey::POWER_OFF;
256 case XKB_KEY_XF86WakeUp:
257 return DomKey::WAKE_UP;
258 case XKB_KEY_XF86Eject:
259 return DomKey::EJECT;
260 case XKB_KEY_XF86ScreenSaver:
261 return DomKey::LAUNCH_SCREEN_SAVER;
262 case XKB_KEY_XF86WWW:
263 return DomKey::LAUNCH_WEB_BROWSER;
264 case XKB_KEY_XF86Favorites:
265 return DomKey::BROWSER_FAVORITES;
266 case XKB_KEY_XF86AudioPause:
267 return DomKey::MEDIA_PAUSE;
268 case XKB_KEY_XF86AudioMedia:
269 case XKB_KEY_XF86Music:
270 return DomKey::LAUNCH_MUSIC_PLAYER;
271 case XKB_KEY_XF86MyComputer:
272 case XKB_KEY_XF86Explorer:
273 return DomKey::LAUNCH_MY_COMPUTER;
274 case XKB_KEY_XF86AudioRewind:
275 return DomKey::MEDIA_REWIND;
276 case XKB_KEY_XF86CD:
277 case XKB_KEY_XF86Video:
278 return DomKey::LAUNCH_MEDIA_PLAYER;
279 case XKB_KEY_XF86Close:
280 return DomKey::CLOSE;
281 case XKB_KEY_XF86Copy:
282 case XKB_KEY_SunCopy:
283 return DomKey::COPY;
284 case XKB_KEY_XF86Cut:
285 case XKB_KEY_SunCut:
286 return DomKey::CUT;
287 case XKB_KEY_XF86Display:
288 return DomKey::DISPLAY_SWAP;
289 case XKB_KEY_XF86Excel:
290 return DomKey::LAUNCH_SPREADSHEET;
291 case XKB_KEY_XF86LogOff:
292 return DomKey::LOG_OFF;
293 case XKB_KEY_XF86New:
294 return DomKey::NEW;
295 case XKB_KEY_XF86Open:
296 case XKB_KEY_SunOpen:
297 return DomKey::OPEN;
298 case XKB_KEY_XF86Paste:
299 case XKB_KEY_SunPaste:
300 return DomKey::PASTE;
301 case XKB_KEY_XF86Reply:
302 return DomKey::MAIL_REPLY;
303 case XKB_KEY_XF86Save:
304 return DomKey::SAVE;
305 case XKB_KEY_XF86Send:
306 return DomKey::MAIL_SEND;
307 case XKB_KEY_XF86Spell:
308 return DomKey::SPELL_CHECK;
309 case XKB_KEY_XF86SplitScreen:
310 return DomKey::SPLIT_SCREEN_TOGGLE;
311 case XKB_KEY_XF86Word:
312 case XKB_KEY_XF86OfficeHome:
313 return DomKey::LAUNCH_WORD_PROCESSOR;
314 case XKB_KEY_XF86ZoomIn:
315 return DomKey::ZOOM_IN;
316 case XKB_KEY_XF86ZoomOut:
317 return DomKey::ZOOM_OUT;
318 case XKB_KEY_XF86WebCam:
319 return DomKey::LAUNCH_WEB_CAM;
320 case XKB_KEY_XF86MailForward:
321 return DomKey::MAIL_FORWARD;
322 case XKB_KEY_XF86AudioForward:
323 return DomKey::MEDIA_FAST_FORWARD;
324 case XKB_KEY_XF86AudioRandomPlay:
325 return DomKey::RANDOM_TOGGLE;
326 case XKB_KEY_XF86Subtitle:
327 return DomKey::SUBTITLE;
328 case XKB_KEY_XF86Hibernate:
329 return DomKey::HIBERNATE;
330 case XKB_KEY_3270_EraseEOF:
331 return DomKey::ERASE_EOF;
332 case XKB_KEY_3270_Play:
333 return DomKey::PLAY;
334 case XKB_KEY_3270_ExSelect:
335 return DomKey::EX_SEL;
336 case XKB_KEY_3270_CursorSelect:
337 return DomKey::CR_SEL;
338 case XKB_KEY_3270_PrintScreen:
339 return DomKey::PRINT_SCREEN;
340 case XKB_KEY_ISO_Level3_Shift:
341 return DomKey::ALT_GRAPH;
342 case XKB_KEY_ISO_Next_Group:
343 return DomKey::GROUP_NEXT;
344 case XKB_KEY_ISO_Prev_Group:
345 return DomKey::GROUP_PREVIOUS;
346 case XKB_KEY_ISO_First_Group:
347 return DomKey::GROUP_FIRST;
348 case XKB_KEY_ISO_Last_Group:
349 return DomKey::GROUP_LAST;
350 case XKB_KEY_dead_grave:
351 case XKB_KEY_dead_acute:
352 case XKB_KEY_dead_circumflex:
353 case XKB_KEY_dead_tilde:
354 case XKB_KEY_dead_macron:
355 case XKB_KEY_dead_breve:
356 case XKB_KEY_dead_abovedot:
357 case XKB_KEY_dead_diaeresis:
358 case XKB_KEY_dead_abovering:
359 case XKB_KEY_dead_doubleacute:
360 case XKB_KEY_dead_caron:
361 case XKB_KEY_dead_cedilla:
362 case XKB_KEY_dead_ogonek:
363 case XKB_KEY_dead_iota:
364 case XKB_KEY_dead_belowdot:
365 case XKB_KEY_dead_hook:
366 case XKB_KEY_dead_horn:
367 case XKB_KEY_dead_stroke:
368 case XKB_KEY_dead_abovecomma:
369 case XKB_KEY_dead_abovereversedcomma:
370 case XKB_KEY_dead_doublegrave:
371 case XKB_KEY_dead_belowring:
372 case XKB_KEY_dead_belowmacron:
373 case XKB_KEY_dead_belowcircumflex:
374 case XKB_KEY_dead_belowtilde:
375 case XKB_KEY_dead_belowbreve:
376 case XKB_KEY_dead_belowdiaeresis:
377 case XKB_KEY_dead_invertedbreve:
378 case XKB_KEY_dead_belowcomma:
379 case XKB_KEY_dead_currency:
380 return DomKey::DEAD;
381 default:
382 return DomKey::NONE;
386 base::char16 DeadXkbKeySymToCombiningCharacter(xkb_keysym_t keysym) {
387 switch (keysym) {
388 case XKB_KEY_dead_grave:
389 return 0x0768; // combining grave accent
390 case XKB_KEY_dead_acute:
391 return 0x0769; // combining acute accent
392 case XKB_KEY_dead_circumflex:
393 return 0x0770; // combining circumflex accent
394 case XKB_KEY_dead_tilde:
395 return 0x0771; // combining tilde
396 case XKB_KEY_dead_macron:
397 return 0x0772; // combining macron
398 case XKB_KEY_dead_breve:
399 return 0x0774; // combining breve
400 case XKB_KEY_dead_abovedot:
401 return 0x0775; // combining dot above
402 case XKB_KEY_dead_diaeresis:
403 return 0x0776; // combining diaeresis
404 case XKB_KEY_dead_abovering:
405 return 0x0778; // combining ring above
406 case XKB_KEY_dead_doubleacute:
407 return 0x0779; // combining double acute accent
408 case XKB_KEY_dead_caron:
409 return 0x0780; // combining caron
410 case XKB_KEY_dead_cedilla:
411 return 0x0807; // combining cedilla
412 case XKB_KEY_dead_ogonek:
413 return 0x0808; // combining ogonek
414 case XKB_KEY_dead_iota:
415 return 0x0837; // combining greek ypogegrammeni
416 case XKB_KEY_dead_belowdot:
417 return 0x0803; // combining dot below
418 case XKB_KEY_dead_hook:
419 return 0x0777; // combining hook above
420 case XKB_KEY_dead_horn:
421 return 0x0795; // combining horn
422 case XKB_KEY_dead_stroke:
423 return 0x0824; // combining long solidus overlay
424 case XKB_KEY_dead_abovecomma:
425 return 0x0787; // combining comma above
426 case XKB_KEY_dead_abovereversedcomma:
427 return 0x0788; // combining reversed comma above
428 case XKB_KEY_dead_doublegrave:
429 return 0x0783; // combining double grave accent
430 case XKB_KEY_dead_belowring:
431 return 0x0805; // combining ring below
432 case XKB_KEY_dead_belowmacron:
433 return 0x0817; // combining macron below
434 case XKB_KEY_dead_belowcircumflex:
435 return 0x0813; // combining circumflex accent below
436 case XKB_KEY_dead_belowtilde:
437 return 0x0816; // combining tilde below
438 case XKB_KEY_dead_belowbreve:
439 return 0x0814; // combining breve below
440 case XKB_KEY_dead_belowdiaeresis:
441 return 0x0804; // combining diaeresis below
442 case XKB_KEY_dead_invertedbreve:
443 return 0x0785; // combining inverted breve
444 case XKB_KEY_dead_belowcomma:
445 return 0x0806; // combining comma below
446 case XKB_KEY_dead_currency:
447 return 0x0164; // currency sign
448 default:
449 return 0;
453 } // namespace ui