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/base/keycodes/keyboard_code_conversion_x.h" | 5 #include "ui/base/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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 return VKEY_BRIGHTNESS_DOWN; | 417 return VKEY_BRIGHTNESS_DOWN; |
418 case XF86XK_MonBrightnessUp: | 418 case XF86XK_MonBrightnessUp: |
419 return VKEY_BRIGHTNESS_UP; | 419 return VKEY_BRIGHTNESS_UP; |
420 case XF86XK_KbdBrightnessDown: | 420 case XF86XK_KbdBrightnessDown: |
421 return VKEY_KBD_BRIGHTNESS_DOWN; | 421 return VKEY_KBD_BRIGHTNESS_DOWN; |
422 case XF86XK_KbdBrightnessUp: | 422 case XF86XK_KbdBrightnessUp: |
423 return VKEY_KBD_BRIGHTNESS_UP; | 423 return VKEY_KBD_BRIGHTNESS_UP; |
424 | 424 |
425 // TODO(sad): some keycodes are still missing. | 425 // TODO(sad): some keycodes are still missing. |
426 } | 426 } |
427 DLOG(WARNING) << "Unknown keysym: " << StringPrintf("0x%x", keysym); | 427 DLOG(WARNING) << "Unknown keysym: " << base::StringPrintf("0x%x", keysym); |
428 return VKEY_UNKNOWN; | 428 return VKEY_UNKNOWN; |
429 } | 429 } |
430 | 430 |
431 uint16 GetCharacterFromXEvent(XEvent* xev) { | 431 uint16 GetCharacterFromXEvent(XEvent* xev) { |
432 char buf[6]; | 432 char buf[6]; |
433 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); | 433 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); |
434 DCHECK_LE(bytes_written, 6); | 434 DCHECK_LE(bytes_written, 6); |
435 | 435 |
436 string16 result; | 436 string16 result; |
437 return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) && | 437 return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) && |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 case VKEY_KBD_BRIGHTNESS_UP: | 782 case VKEY_KBD_BRIGHTNESS_UP: |
783 return XF86XK_KbdBrightnessUp; | 783 return XF86XK_KbdBrightnessUp; |
784 | 784 |
785 default: | 785 default: |
786 LOG(WARNING) << "Unknown keycode:" << keycode; | 786 LOG(WARNING) << "Unknown keycode:" << keycode; |
787 return 0; | 787 return 0; |
788 } | 788 } |
789 } | 789 } |
790 | 790 |
791 } // namespace ui | 791 } // namespace ui |
OLD | NEW |