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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return VKEY_UNKNOWN; | 348 return VKEY_UNKNOWN; |
349 #endif | 349 #endif |
350 | 350 |
351 // For supporting multimedia buttons on a USB keyboard. | 351 // For supporting multimedia buttons on a USB keyboard. |
352 case XF86XK_AudioMute: | 352 case XF86XK_AudioMute: |
353 return VKEY_VOLUME_MUTE; | 353 return VKEY_VOLUME_MUTE; |
354 case XF86XK_AudioLowerVolume: | 354 case XF86XK_AudioLowerVolume: |
355 return VKEY_VOLUME_DOWN; | 355 return VKEY_VOLUME_DOWN; |
356 case XF86XK_AudioRaiseVolume: | 356 case XF86XK_AudioRaiseVolume: |
357 return VKEY_VOLUME_UP; | 357 return VKEY_VOLUME_UP; |
| 358 case XF86XK_MonBrightnessDown: |
| 359 return VKEY_BRIGHTNESS_DOWN; |
| 360 case XF86XK_MonBrightnessUp: |
| 361 return VKEY_BRIGHTNESS_UP; |
358 | 362 |
359 // TODO(sad): some keycodes are still missing. | 363 // TODO(sad): some keycodes are still missing. |
360 } | 364 } |
361 DLOG(WARNING) << "Unknown keysym: " << StringPrintf("0x%x", keysym); | 365 DLOG(WARNING) << "Unknown keysym: " << StringPrintf("0x%x", keysym); |
362 return VKEY_UNKNOWN; | 366 return VKEY_UNKNOWN; |
363 } | 367 } |
364 | 368 |
365 uint16 GetCharacterFromXEvent(XEvent* xev) { | 369 uint16 GetCharacterFromXEvent(XEvent* xev) { |
366 char buf[6]; | 370 char buf[6]; |
367 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); | 371 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 case VKEY_F23: | 670 case VKEY_F23: |
667 case VKEY_F24: | 671 case VKEY_F24: |
668 return XK_F1 + (keycode - VKEY_F1); | 672 return XK_F1 + (keycode - VKEY_F1); |
669 | 673 |
670 case VKEY_VOLUME_MUTE: | 674 case VKEY_VOLUME_MUTE: |
671 return XF86XK_AudioMute; | 675 return XF86XK_AudioMute; |
672 case VKEY_VOLUME_DOWN: | 676 case VKEY_VOLUME_DOWN: |
673 return XF86XK_AudioLowerVolume; | 677 return XF86XK_AudioLowerVolume; |
674 case VKEY_VOLUME_UP: | 678 case VKEY_VOLUME_UP: |
675 return XF86XK_AudioRaiseVolume; | 679 return XF86XK_AudioRaiseVolume; |
| 680 case VKEY_BRIGHTNESS_DOWN: |
| 681 return XF86XK_MonBrightnessDown; |
| 682 case VKEY_BRIGHTNESS_UP: |
| 683 return XF86XK_MonBrightnessUp; |
676 | 684 |
677 default: | 685 default: |
678 LOG(WARNING) << "Unknown keycode:" << keycode; | 686 LOG(WARNING) << "Unknown keycode:" << keycode; |
679 return 0; | 687 return 0; |
680 } | 688 } |
681 } | 689 } |
682 | 690 |
683 } // namespace ui | 691 } // namespace ui |
OLD | NEW |