OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 5 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #define XK_3270 // for XK_3270_BackTab | 9 #define XK_3270 // for XK_3270_BackTab |
10 #include <X11/XF86keysym.h> | 10 #include <X11/XF86keysym.h> |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
485 } else { | 485 } else { |
486 xkeyevent.xkey = xev->xkey; | 486 xkeyevent.xkey = xev->xkey; |
487 } | 487 } |
488 KeyboardCode keycode = VKEY_UNKNOWN; | 488 KeyboardCode keycode = VKEY_UNKNOWN; |
489 XKeyEvent* xkey = &xkeyevent.xkey; | 489 XKeyEvent* xkey = &xkeyevent.xkey; |
490 // XLookupKeysym does not take into consideration the state of the lock/shift | 490 // XLookupKeysym does not take into consideration the state of the lock/shift |
491 // etc. keys. So it is necessary to use XLookupString instead. | 491 // etc. keys. So it is necessary to use XLookupString instead. |
492 XLookupString(xkey, NULL, 0, &keysym, NULL); | 492 XLookupString(xkey, NULL, 0, &keysym, NULL); |
493 if (IsKeypadKey(keysym) || IsPrivateKeypadKey(keysym) || | 493 if (IsKeypadKey(keysym) || IsPrivateKeypadKey(keysym) || |
494 IsCursorKey(keysym) || IsPFKey(keysym) || IsFunctionKey(keysym) || | 494 IsCursorKey(keysym) || IsPFKey(keysym) || IsFunctionKey(keysym) || |
495 IsModifierKey(keysym)) { | 495 IsModifierKey(keysym) || keysym == XK_Return || keysym == XK_Tab || |
496 keysym == XK_BackSpace || keysym == XK_space) { | |
Yuki
2014/10/23 06:33:44
Do we want to support other control characters her
Shu Chen
2014/10/23 07:00:17
Done. Thanks for the suggestion.
| |
496 return KeyboardCodeFromXKeysym(keysym); | 497 return KeyboardCodeFromXKeysym(keysym); |
497 } | 498 } |
498 | 499 |
499 // If |xkey| has modifiers set, other than NumLock, then determine the | 500 // If |xkey| has modifiers set, other than NumLock, then determine the |
500 // un-modified KeySym and use that to map, so that e.g. Ctrl+D correctly | 501 // un-modified KeySym and use that to map, so that e.g. Ctrl+D correctly |
501 // generates VKEY_D. | 502 // generates VKEY_D. |
502 if (xkey->state & 0xFF & ~Mod2Mask) { | 503 if (xkey->state & 0xFF & ~Mod2Mask) { |
503 xkey->state &= (~0xFF | Mod2Mask); | 504 xkey->state &= (~0xFF | Mod2Mask); |
504 XLookupString(xkey, NULL, 0, &keysym, NULL); | 505 XLookupString(xkey, NULL, 0, &keysym, NULL); |
505 } | 506 } |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1358 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND | 1359 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND |
1359 // (the '<>' key between Shift and Z on 105-key keyboards) which does. | 1360 // (the '<>' key between Shift and Z on 105-key keyboards) which does. |
1360 // | 1361 // |
1361 // crbug.com/386066 and crbug.com/390263 are examples of problems | 1362 // crbug.com/386066 and crbug.com/390263 are examples of problems |
1362 // associated with this. | 1363 // associated with this. |
1363 // | 1364 // |
1364 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false)); | 1365 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false)); |
1365 } | 1366 } |
1366 | 1367 |
1367 } // namespace ui | 1368 } // namespace ui |
OLD | NEW |