OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ | 5 #ifndef UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ |
6 #define UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ | 6 #define UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "ui/events/events_base_export.h" | |
12 #include "ui/events/keycodes/dom/dom_key.h" | 11 #include "ui/events/keycodes/dom/dom_key.h" |
13 #include "ui/events/keycodes/keyboard_codes_posix.h" | 12 #include "ui/events/keycodes/keyboard_codes_posix.h" |
| 13 #include "ui/events/keycodes/keycodes_x_export.h" |
14 | 14 |
15 typedef union _XEvent XEvent; | 15 typedef union _XEvent XEvent; |
16 typedef struct _XDisplay XDisplay; | 16 typedef struct _XDisplay XDisplay; |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 | 19 |
20 enum class DomCode; | 20 enum class DomCode; |
21 | 21 |
22 EVENTS_BASE_EXPORT KeyboardCode KeyboardCodeFromXKeyEvent(const XEvent* xev); | 22 KEYCODES_X_EXPORT KeyboardCode KeyboardCodeFromXKeyEvent(const XEvent* xev); |
23 | 23 |
24 EVENTS_BASE_EXPORT KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym); | 24 KEYCODES_X_EXPORT KeyboardCode KeyboardCodeFromXKeysym(unsigned int keysym); |
25 | 25 |
26 EVENTS_BASE_EXPORT DomCode CodeFromXEvent(const XEvent* xev); | 26 KEYCODES_X_EXPORT DomCode CodeFromXEvent(const XEvent* xev); |
27 | 27 |
28 // Returns a character on a standard US PC keyboard from an XEvent. | 28 // Returns a character on a standard US PC keyboard from an XEvent. |
29 EVENTS_BASE_EXPORT uint16_t GetCharacterFromXEvent(const XEvent* xev); | 29 KEYCODES_X_EXPORT uint16_t GetCharacterFromXEvent(const XEvent* xev); |
30 | 30 |
31 // Returns DomKey and character from an XEvent. | 31 // Returns DomKey and character from an XEvent. |
32 EVENTS_BASE_EXPORT DomKey GetDomKeyFromXEvent(const XEvent* xev); | 32 KEYCODES_X_EXPORT DomKey GetDomKeyFromXEvent(const XEvent* xev); |
33 | 33 |
34 // Converts a KeyboardCode into an X KeySym. | 34 // Converts a KeyboardCode into an X KeySym. |
35 EVENTS_BASE_EXPORT int XKeysymForWindowsKeyCode(KeyboardCode keycode, | 35 KEYCODES_X_EXPORT int XKeysymForWindowsKeyCode(KeyboardCode keycode, |
36 bool shift); | 36 bool shift); |
37 | 37 |
38 // Returns a XKeyEvent keycode (scancode) for a KeyboardCode. Keyboard layouts | 38 // Returns a XKeyEvent keycode (scancode) for a KeyboardCode. Keyboard layouts |
39 // are usually not injective, so inverse mapping should be avoided when | 39 // are usually not injective, so inverse mapping should be avoided when |
40 // practical. A round-trip keycode -> KeyboardCode -> keycode will not | 40 // practical. A round-trip keycode -> KeyboardCode -> keycode will not |
41 // necessarily return the original keycode. | 41 // necessarily return the original keycode. |
42 EVENTS_BASE_EXPORT unsigned int XKeyCodeForWindowsKeyCode(KeyboardCode key_code, | 42 KEYCODES_X_EXPORT unsigned int XKeyCodeForWindowsKeyCode(KeyboardCode key_code, |
43 int flags, | 43 int flags, |
44 XDisplay* display); | 44 XDisplay* display); |
45 | 45 |
46 // Converts an X keycode into ui::KeyboardCode. | 46 // Converts an X keycode into ui::KeyboardCode. |
47 EVENTS_BASE_EXPORT KeyboardCode | 47 KEYCODES_X_EXPORT KeyboardCode |
48 DefaultKeyboardCodeFromHardwareKeycode(unsigned int hardware_code); | 48 DefaultKeyboardCodeFromHardwareKeycode(unsigned int hardware_code); |
49 | 49 |
50 // Initializes a core XKeyEvent from an XI2 key event. | 50 // Initializes a core XKeyEvent from an XI2 key event. |
51 EVENTS_BASE_EXPORT void InitXKeyEventFromXIDeviceEvent(const XEvent& src, | 51 KEYCODES_X_EXPORT void InitXKeyEventFromXIDeviceEvent(const XEvent& src, |
52 XEvent* dst); | 52 XEvent* dst); |
53 | 53 |
54 } // namespace ui | 54 } // namespace ui |
55 | 55 |
56 #endif // UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ | 56 #endif // UI_EVENTS_KEYCODES_KEYBOARD_CODE_CONVERSION_X_H_ |
OLD | NEW |