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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 // TODO(sad): some keycodes are still missing. | 831 // TODO(sad): some keycodes are still missing. |
832 } | 832 } |
833 DLOG(WARNING) << "Unknown keysym: " << base::StringPrintf("0x%x", keysym); | 833 DLOG(WARNING) << "Unknown keysym: " << base::StringPrintf("0x%x", keysym); |
834 return VKEY_UNKNOWN; | 834 return VKEY_UNKNOWN; |
835 } | 835 } |
836 | 836 |
837 const char* CodeFromXEvent(const XEvent* xev) { | 837 const char* CodeFromXEvent(const XEvent* xev) { |
838 int keycode = (xev->type == GenericEvent) | 838 int keycode = (xev->type == GenericEvent) |
839 ? static_cast<XIDeviceEvent*>(xev->xcookie.data)->detail | 839 ? static_cast<XIDeviceEvent*>(xev->xcookie.data)->detail |
840 : xev->xkey.keycode; | 840 : xev->xkey.keycode; |
841 return KeycodeConverter::GetInstance()->NativeKeycodeToCode(keycode); | 841 return ui::KeycodeConverter::NativeKeycodeToCode(keycode); |
842 } | 842 } |
843 | 843 |
844 uint16 GetCharacterFromXEvent(const XEvent* xev) { | 844 uint16 GetCharacterFromXEvent(const XEvent* xev) { |
845 XEvent xkeyevent = {0}; | 845 XEvent xkeyevent = {0}; |
846 const XKeyEvent* xkey = NULL; | 846 const XKeyEvent* xkey = NULL; |
847 if (xev->type == GenericEvent) { | 847 if (xev->type == GenericEvent) { |
848 // Convert the XI2 key event into a core key event so that we can | 848 // Convert the XI2 key event into a core key event so that we can |
849 // continue to use XLookupString() until crbug.com/367732 is complete. | 849 // continue to use XLookupString() until crbug.com/367732 is complete. |
850 InitXKeyEventFromXIDeviceEvent(*xev, &xkeyevent); | 850 InitXKeyEventFromXIDeviceEvent(*xev, &xkeyevent); |
851 xkey = &xkeyevent.xkey; | 851 xkey = &xkeyevent.xkey; |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND | 1342 // alone does not map to XK_less; XKeysymToKeycode() returns KEY_102ND |
1343 // (the '<>' key between Shift and Z on 105-key keyboards) which does. | 1343 // (the '<>' key between Shift and Z on 105-key keyboards) which does. |
1344 // | 1344 // |
1345 // crbug.com/386066 and crbug.com/390263 are examples of problems | 1345 // crbug.com/386066 and crbug.com/390263 are examples of problems |
1346 // associated with this. | 1346 // associated with this. |
1347 // | 1347 // |
1348 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false)); | 1348 return XKeysymToKeycode(display, XKeysymForWindowsKeyCode(key_code, false)); |
1349 } | 1349 } |
1350 | 1350 |
1351 } // namespace ui | 1351 } // namespace ui |
OLD | NEW |