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 #define XK_3270 // for XK_3270_BackTab | 7 #define XK_3270 // for XK_3270_BackTab |
8 #include <X11/keysym.h> | 8 #include <X11/keysym.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/Xutil.h> | 10 #include <X11/Xutil.h> |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 const char* CodeFromXEvent(XEvent* xev) { | 441 const char* CodeFromXEvent(XEvent* xev) { |
442 return KeycodeConverter::GetInstance()->NativeKeycodeToCode( | 442 return KeycodeConverter::GetInstance()->NativeKeycodeToCode( |
443 xev->xkey.keycode); | 443 xev->xkey.keycode); |
444 } | 444 } |
445 | 445 |
446 uint16 GetCharacterFromXEvent(XEvent* xev) { | 446 uint16 GetCharacterFromXEvent(XEvent* xev) { |
447 char buf[6]; | 447 char buf[6]; |
448 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); | 448 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); |
449 DCHECK_LE(bytes_written, 6); | 449 DCHECK_LE(bytes_written, 6); |
450 | 450 |
451 string16 result; | 451 base::string16 result; |
452 return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) && | 452 return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) && |
453 result.length() == 1) ? result[0] : 0; | 453 result.length() == 1) ? result[0] : 0; |
454 } | 454 } |
455 | 455 |
456 unsigned int DefaultXKeysymFromHardwareKeycode(unsigned int hardware_code) { | 456 unsigned int DefaultXKeysymFromHardwareKeycode(unsigned int hardware_code) { |
457 static const unsigned int kHardwareKeycodeMap[] = { | 457 static const unsigned int kHardwareKeycodeMap[] = { |
458 0, // 0x00: | 458 0, // 0x00: |
459 0, // 0x01: | 459 0, // 0x01: |
460 0, // 0x02: | 460 0, // 0x02: |
461 0, // 0x03: | 461 0, // 0x03: |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 case VKEY_KBD_BRIGHTNESS_UP: | 801 case VKEY_KBD_BRIGHTNESS_UP: |
802 return XF86XK_KbdBrightnessUp; | 802 return XF86XK_KbdBrightnessUp; |
803 | 803 |
804 default: | 804 default: |
805 LOG(WARNING) << "Unknown keycode:" << keycode; | 805 LOG(WARNING) << "Unknown keycode:" << keycode; |
806 return 0; | 806 return 0; |
807 } | 807 } |
808 } | 808 } |
809 | 809 |
810 } // namespace ui | 810 } // namespace ui |
OLD | NEW |