blob: 07ebf36c671a7a705ffbf1f2d979f02029a8c7e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/input_method/ibus_keymap.h"
#if defined(HAVE_IBUS)
#include <ibus.h>
#endif
namespace chromeos {
namespace input_method {
#if defined(HAVE_IBUS)
std::string GetIBusKey(int keyval) {
// TODO: Ensure all keys are supported.
switch (keyval) {
case IBUS_Escape:
return "Esc";
case IBUS_F1:
return "HistoryBack";
case IBUS_F2:
return "HistoryForward";
case IBUS_F3:
return "BrowserRefresh";
case IBUS_F4:
return "ChromeOSFullscreen"; // TODO: Check this value
case IBUS_F5:
return "ChromeOSSwitchWindow"; // TODO: Check this value
case IBUS_F6:
return "BrightnessDown";
case IBUS_F7:
return "BrightnessUp";
case IBUS_F8:
return "AudioVolumeMute";
case IBUS_F9:
return "AudioVolumeDown";
case IBUS_F10:
return "AudioVolumeUp";
case IBUS_BackSpace:
return "Backspace";
case IBUS_Tab:
return "Tab";
case IBUS_KP_Enter:
case IBUS_Return:
return "Enter";
case IBUS_Meta_L:
return "BrowserSearch";
case IBUS_Up:
case IBUS_KP_Up:
return "Up";
case IBUS_Down:
case IBUS_KP_Down:
return "Down";
case IBUS_Left:
case IBUS_KP_Left:
return "Left";
case IBUS_Right:
case IBUS_KP_Right:
return "Right";
case IBUS_Page_Up:
return "PageUp";
case IBUS_Page_Down:
return "PageDown";
case IBUS_Home:
return "Home";
case IBUS_End:
return "End";
default: {
// TODO: Properly support unicode characters.
char value[2];
value[0] = keyval;
value[1] = '\0';
return value;
}
}
}
std::string GetIBusKeyCode(int keycode) {
// TODO: Support keyboard layouts properly.
return GetIBusKey(keycode);
}
#else
std::string GetIBusKey(int keyval) {
return "";
}
std::string GetIBusKeyCode(int keycode) {
return "";
}
#endif // HAVE_IBUS
} // namespace input_method
} // namespace chromeos
|