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> |
11 #include <X11/XF86keysym.h> | 11 #include <X11/XF86keysym.h> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 // Get an ui::KeyboardCode from an X keyevent | 20 // Get an ui::KeyboardCode from an X keyevent |
21 KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev) { | 21 KeyboardCode KeyboardCodeFromXKeyEvent(XEvent* xev) { |
22 // XLookupKeysym does not take into consideration the state of the lock/shift | 22 // XLookupKeysym does not take into consideration the state of the lock/shift |
23 // etc. keys. So it is necessary to use XLookupString instead. | 23 // etc. keys. So it is necessary to use XLookupString instead. |
24 KeySym keysym; | 24 KeySym keysym; |
25 XLookupString(&xev->xkey, NULL, 0, &keysym, NULL); | 25 XLookupString(&xev->xkey, NULL, 0, &keysym, NULL); |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 case VKEY_KBD_BRIGHTNESS_UP: | 786 case VKEY_KBD_BRIGHTNESS_UP: |
787 return XF86XK_KbdBrightnessUp; | 787 return XF86XK_KbdBrightnessUp; |
788 | 788 |
789 default: | 789 default: |
790 LOG(WARNING) << "Unknown keycode:" << keycode; | 790 LOG(WARNING) << "Unknown keycode:" << keycode; |
791 return 0; | 791 return 0; |
792 } | 792 } |
793 } | 793 } |
794 | 794 |
795 } // namespace ui | 795 } // namespace ui |
OLD | NEW |