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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 case XF86XK_Favorites: | 358 case XF86XK_Favorites: |
359 return VKEY_BROWSER_FAVORITES; | 359 return VKEY_BROWSER_FAVORITES; |
360 case XF86XK_HomePage: | 360 case XF86XK_HomePage: |
361 return VKEY_BROWSER_HOME; | 361 return VKEY_BROWSER_HOME; |
362 case XF86XK_AudioMute: | 362 case XF86XK_AudioMute: |
363 return VKEY_VOLUME_MUTE; | 363 return VKEY_VOLUME_MUTE; |
364 case XF86XK_AudioLowerVolume: | 364 case XF86XK_AudioLowerVolume: |
365 return VKEY_VOLUME_DOWN; | 365 return VKEY_VOLUME_DOWN; |
366 case XF86XK_AudioRaiseVolume: | 366 case XF86XK_AudioRaiseVolume: |
367 return VKEY_VOLUME_UP; | 367 return VKEY_VOLUME_UP; |
| 368 case XF86XK_AudioNext: |
| 369 return VKEY_MEDIA_NEXT_TRACK; |
| 370 case XF86XK_AudioPrev: |
| 371 return VKEY_MEDIA_PREV_TRACK; |
368 case XF86XK_AudioStop: | 372 case XF86XK_AudioStop: |
369 return VKEY_MEDIA_STOP; | 373 return VKEY_MEDIA_STOP; |
370 case XF86XK_AudioPlay: | 374 case XF86XK_AudioPlay: |
371 return VKEY_MEDIA_PLAY_PAUSE; | 375 return VKEY_MEDIA_PLAY_PAUSE; |
372 case XF86XK_Mail: | 376 case XF86XK_Mail: |
373 return VKEY_MEDIA_LAUNCH_MAIL; | 377 return VKEY_MEDIA_LAUNCH_MAIL; |
| 378 case XF86XK_LaunchA: // F3 on an Apple keyboard. |
| 379 return VKEY_MEDIA_LAUNCH_APP1; |
| 380 case XF86XK_LaunchB: // F4 on an Apple keyboard. |
374 case XF86XK_Calculator: | 381 case XF86XK_Calculator: |
375 return VKEY_MEDIA_LAUNCH_APP2; | 382 return VKEY_MEDIA_LAUNCH_APP2; |
376 case XF86XK_MonBrightnessDown: | 383 case XF86XK_MonBrightnessDown: |
377 return VKEY_BRIGHTNESS_DOWN; | 384 return VKEY_BRIGHTNESS_DOWN; |
378 case XF86XK_MonBrightnessUp: | 385 case XF86XK_MonBrightnessUp: |
379 return VKEY_BRIGHTNESS_UP; | 386 return VKEY_BRIGHTNESS_UP; |
| 387 case XF86XK_KbdBrightnessDown: |
| 388 return VKEY_KEY_BRIGHTNESS_DOWN; |
| 389 case XF86XK_KbdBrightnessUp: |
| 390 return VKEY_KEY_BRIGHTNESS_UP; |
380 | 391 |
381 // TODO(sad): some keycodes are still missing. | 392 // TODO(sad): some keycodes are still missing. |
382 } | 393 } |
383 DLOG(WARNING) << "Unknown keysym: " << StringPrintf("0x%x", keysym); | 394 DLOG(WARNING) << "Unknown keysym: " << StringPrintf("0x%x", keysym); |
384 return VKEY_UNKNOWN; | 395 return VKEY_UNKNOWN; |
385 } | 396 } |
386 | 397 |
387 uint16 GetCharacterFromXEvent(XEvent* xev) { | 398 uint16 GetCharacterFromXEvent(XEvent* xev) { |
388 char buf[6]; | 399 char buf[6]; |
389 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); | 400 int bytes_written = XLookupString(&xev->xkey, buf, 6, NULL, NULL); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 case VKEY_BRIGHTNESS_UP: | 733 case VKEY_BRIGHTNESS_UP: |
723 return XF86XK_MonBrightnessUp; | 734 return XF86XK_MonBrightnessUp; |
724 | 735 |
725 default: | 736 default: |
726 LOG(WARNING) << "Unknown keycode:" << keycode; | 737 LOG(WARNING) << "Unknown keycode:" << keycode; |
727 return 0; | 738 return 0; |
728 } | 739 } |
729 } | 740 } |
730 | 741 |
731 } // namespace ui | 742 } // namespace ui |
OLD | NEW |