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"
11 DomKey
NonPrintableXkbKeySymToDomKey(xkb_keysym_t keysym
) {
13 case XKB_KEY_BackSpace
:
14 return DomKey::BACKSPACE
;
17 case XKB_KEY_ISO_Left_Tab
:
20 case XKB_KEY_KP_Begin
:
21 case XKB_KEY_XF86Clear
:
24 case XKB_KEY_KP_Enter
:
26 case XKB_KEY_Linefeed
:
30 case XKB_KEY_Scroll_Lock
:
31 return DomKey::SCROLL_LOCK
;
33 return DomKey::ESCAPE
;
34 case XKB_KEY_Multi_key
:
35 return DomKey::COMPOSE
;
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
;
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
;
51 return DomKey::ZENKAKU
;
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
:
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
;
78 return DomKey::ARROW_LEFT
;
81 return DomKey::ARROW_UP
;
83 case XKB_KEY_KP_Right
:
84 return DomKey::ARROW_RIGHT
;
87 return DomKey::ARROW_DOWN
;
89 case XKB_KEY_KP_Prior
:
90 return DomKey::PAGE_UP
;
93 case XKB_KEY_XF86ScrollDown
:
94 return DomKey::PAGE_DOWN
;
97 case XKB_KEY_XF86ScrollUp
:
100 return DomKey::SELECT
;
102 return DomKey::PRINT
;
103 case XKB_KEY_Execute
:
104 return DomKey::EXECUTE
;
106 case XKB_KEY_KP_Insert
:
107 return DomKey::INSERT
;
113 return DomKey::CONTEXT_MENU
;
117 return DomKey::CANCEL
;
121 case XKB_KEY_3270_Attn
:
123 case XKB_KEY_Mode_switch
:
124 return DomKey::MODE_CHANGE
;
125 case XKB_KEY_Num_Lock
:
126 return DomKey::NUM_LOCK
;
155 case XKB_KEY_XF86Tools
: // XKB 'inet' mapping of F13
159 case XKB_KEY_XF86Launch5
: // XKB 'inet' mapping of F14
162 case XKB_KEY_XF86Launch6
: // XKB 'inet' mapping of F15
165 case XKB_KEY_XF86Launch7
: // XKB 'inet' mapping of F16
168 case XKB_KEY_XF86Launch8
: // XKB 'inet' mapping of F17
171 case XKB_KEY_XF86Launch9
: // XKB 'inet' mapping of F18
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
;
199 case XKB_KEY_Super_L
:
200 case XKB_KEY_Super_R
:
202 case XKB_KEY_Hyper_L
:
203 case XKB_KEY_Hyper_R
:
204 return DomKey::HYPER
;
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
;
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
:
284 case XKB_KEY_XF86Cut
:
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
:
295 case XKB_KEY_XF86Open
:
296 case XKB_KEY_SunOpen
:
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
:
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
:
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
:
386 base::char16
DeadXkbKeySymToCombiningCharacter(xkb_keysym_t 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