├── LICENSE
├── meson.build
├── proto
├── meson.build
├── virtual-keyboard-unstable-v1.xml
└── wayfire-shell-unstable-v2.xml
├── src
├── keymap.tpp
├── layouts.tpp
├── main.cpp
├── meson.build
├── osk.hpp
├── shared
│ ├── os-compatibility.c
│ └── os-compatibility.h
├── util
│ └── clara.hpp
├── virtual-keyboard.cpp
├── virtual-keyboard.hpp
├── wayland-window.cpp
└── wayland-window.hpp
└── wf-osk.desktop
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Wayfire
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/meson.build:
--------------------------------------------------------------------------------
1 | project(
2 | 'wf-simple-osk',
3 | 'c',
4 | 'cpp',
5 | version: '0.1',
6 | license: 'MIT',
7 | meson_version: '>=0.43.0',
8 | default_options: [
9 | 'cpp_std=c++17',
10 | 'c_std=c11',
11 | 'warning_level=2',
12 | 'werror=false',
13 | ],
14 | )
15 |
16 | gtkmm = dependency('gtkmm-3.0')
17 | wayland_client = dependency('wayland-client')
18 | wayland_protos = dependency('wayland-protocols')
19 | gtkls = dependency('gtk-layer-shell-0')
20 |
21 | add_project_link_arguments(['-rdynamic'], language:'cpp')
22 | add_project_arguments(['-Wno-unused-parameter'], language: 'cpp')
23 |
24 | subdir('proto')
25 | subdir('src')
26 |
27 | install_data(
28 | 'wf-osk.desktop',
29 | install_dir: '@0@/share/applications'.format(get_option('prefix'))
30 | )
31 |
--------------------------------------------------------------------------------
/proto/meson.build:
--------------------------------------------------------------------------------
1 | wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')
2 |
3 | wayland_scanner = find_program('wayland-scanner')
4 |
5 | wayland_scanner_code = generator(
6 | wayland_scanner,
7 | output: '@BASENAME@-protocol.c',
8 | arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
9 | )
10 |
11 | wayland_scanner_client = generator(
12 | wayland_scanner,
13 | output: '@BASENAME@-client-protocol.h',
14 | arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
15 | )
16 |
17 | client_protocols = [
18 | ['wayfire-shell-unstable-v2.xml'],
19 | ['virtual-keyboard-unstable-v1.xml']
20 | ]
21 |
22 | wl_protos_src = []
23 | wl_protos_headers = []
24 |
25 | foreach p : client_protocols
26 | xml = join_paths(p)
27 | wl_protos_headers += wayland_scanner_client.process(xml)
28 | wl_protos_src += wayland_scanner_code.process(xml)
29 | endforeach
30 |
31 | lib_wl_protos = static_library('wl_protos', wl_protos_src + wl_protos_headers,
32 | dependencies: [wayland_client]) # for the include directory
33 |
34 | wf_protos = declare_dependency(
35 | link_with: lib_wl_protos,
36 | sources: wl_protos_headers,
37 | )
38 |
--------------------------------------------------------------------------------
/proto/virtual-keyboard-unstable-v1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Copyright © 2008-2011 Kristian Høgsberg
5 | Copyright © 2010-2013 Intel Corporation
6 | Copyright © 2012-2013 Collabora, Ltd.
7 | Copyright © 2018 Purism SPC
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a
10 | copy of this software and associated documentation files (the "Software"),
11 | to deal in the Software without restriction, including without limitation
12 | the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 | and/or sell copies of the Software, and to permit persons to whom the
14 | Software is furnished to do so, subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice (including the next
17 | paragraph) shall be included in all copies or substantial portions of the
18 | Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 | DEALINGS IN THE SOFTWARE.
27 |
28 |
29 |
30 |
31 | The virtual keyboard provides an application with requests which emulate
32 | the behaviour of a physical keyboard.
33 |
34 | This interface can be used by clients on its own to provide raw input
35 | events, or it can accompany the input method protocol.
36 |
37 |
38 |
39 |
40 | Provide a file descriptor to the compositor which can be
41 | memory-mapped to provide a keyboard mapping description.
42 |
43 | Format carries a value from the keymap_format enumeration.
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | A key was pressed or released.
57 | The time argument is a timestamp with millisecond granularity, with an
58 | undefined base. All requests regarding a single object must share the
59 | same clock.
60 |
61 | Keymap must be set before issuing this request.
62 |
63 | State carries a value from the key_state enumeration.
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | Notifies the compositor that the modifier and/or group state has
73 | changed, and it should update state.
74 |
75 | The client should use wl_keyboard.modifiers event to synchronize its
76 | internal state with seat state.
77 |
78 | Keymap must be set before issuing this request.
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 | A virtual keyboard manager allows an application to provide keyboard
94 | input events as if they came from a physical keyboard.
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 | Creates a new virtual keyboard associated to a seat.
104 |
105 | If the compositor enables a keyboard to perform arbitrary actions, it
106 | should present an error when an untrusted client requests a new
107 | keyboard.
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/proto/wayfire-shell-unstable-v2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | This protocol provides additional events and requests for special DE
6 | clients like panels, docks, etc.
7 |
8 | It is meant as an addition for protocols like wlr-layer-shell.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | Represents a single output.
27 | Each output is managed independently from the others.
28 |
29 |
30 |
31 |
32 | Emitted when a window gets fullscreened on the given output. In this
33 | mode, windows in the TOP layer are not visible.
34 |
35 | There will be no two consecutive enter_fullscreen calls, i.e. if
36 | fullscreen mode is entered it will be exited before going into this mode
37 | again.
38 |
39 |
40 |
41 |
42 |
43 | Emitted when the output is no longer in fullscreen mode. Each
44 | leave_fullscreen has a corresponding enter_fullscreen before it.
45 |
46 |
47 |
48 |
49 |
50 | Request the compositor to not render the output, so the output usually
51 | is cleared to black color. To enable output rendering again, call
52 | inhibit_output_done.
53 |
54 |
55 |
56 |
57 |
58 | Stop inhibiting the output. This must be called as many times as
59 | inhibit_output was called to actually uninhibit rendering.
60 |
61 | The inhibit/inhibit_done requests can be called multiple times, even
62 | from different apps, so don't assume that a call to inhibit_done would
63 | always mean actually starting the rendering process.
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | A hotspot on the output is an edge or a corner region of the
77 | output where the mouse or touch point has been residing for a given
78 | amount of time.
79 |
80 | The hotspot can be used for example for autohiding panels, where the
81 | panel is shown when the input hovers on the edge of the output for a
82 | specific amount of time.
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | Means that the mouse and/or touch finger was inside the indicated
98 | hotspot for the given amount of time.
99 |
100 | Emitted at most once for each entry of the input inside the hotspot.
101 |
102 |
103 |
104 |
105 |
106 | This event indicates that the mouse or touch point has left the hotspot
107 | area.
108 |
109 | Emitted only once after each enter.
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/src/keymap.tpp:
--------------------------------------------------------------------------------
1 | static const char keymap[] = "xkb_keymap {\
2 | xkb_keycodes \"(unnamed)\" {\
3 | minimum = 8;\
4 | maximum = 255;\
5 | = 9;\
6 | = 10;\
7 | = 11;\
8 | = 12;\
9 | = 13;\
10 | = 14;\
11 | = 15;\
12 | = 16;\
13 | = 17;\
14 | = 18;\
15 | = 19;\
16 | = 20;\
17 | = 21;\
18 | = 22;\
19 | = 23;\
20 | = 24;\
21 | = 25;\
22 | = 26;\
23 | = 27;\
24 | = 28;\
25 | = 29;\
26 | = 30;\
27 | = 31;\
28 | = 32;\
29 | = 33;\
30 | = 34;\
31 | = 35;\
32 | = 36;\
33 | = 37;\
34 | = 38;\
35 | = 39;\
36 | = 40;\
37 | = 41;\
38 | = 42;\
39 | = 43;\
40 | = 44;\
41 | = 45;\
42 | = 46;\
43 | = 47;\
44 | = 48;\
45 | = 49;\
46 | = 50;\
47 | = 51;\
48 | = 52;\
49 | = 53;\
50 | = 54;\
51 | = 55;\
52 | = 56;\
53 | = 57;\
54 | = 58;\
55 | = 59;\
56 | = 60;\
57 | = 61;\
58 | = 62;\
59 | = 63;\
60 | = 64;\
61 | = 65;\
62 | = 66;\
63 | = 67;\
64 | = 68;\
65 | = 69;\
66 | = 70;\
67 | = 71;\
68 | = 72;\
69 | = 73;\
70 | = 74;\
71 | = 75;\
72 | = 76;\
73 | = 77;\
74 | = 78;\
75 | = 79;\
76 | = 80;\
77 | = 81;\
78 | = 82;\
79 | = 83;\
80 | = 84;\
81 | = 85;\
82 | = 86;\
83 | = 87;\
84 | = 88;\
85 | = 89;\
86 | = 90;\
87 | = 91;\
88 | = 92;\
89 | = 94;\
90 | = 95;\
91 | = 96;\
92 | = 97;\
93 | = 98;\
94 | = 99;\
95 | = 100;\
96 | = 101;\
97 | = 102;\
98 | = 103;\
99 | = 104;\
100 | = 105;\
101 | = 106;\
102 | = 107;\
103 | = 108;\
104 | = 109;\
105 | = 110;\
106 | = 111;\
107 | = 112;\
108 | = 113;\
109 | = 114;\
110 | = 115;\
111 | = 116;\
112 | = 117;\
113 | = 118;\
114 | = 119;\
115 | = 120;\
116 | = 121;\
117 | = 122;\
118 | = 123;\
119 | = 124;\
120 | = 125;\
121 | = 126;\
122 | = 127;\
123 | = 128;\
124 | = 129;\
125 | = 130;\
126 | = 131;\
127 | = 132;\
128 | = 133;\
129 | = 134;\
130 | = 135;\
131 | = 136;\
132 | = 137;\
133 | = 138;\
134 | = 139;\
135 | = 140;\
136 | = 141;\
137 | = 142;\
138 | = 143;\
139 | = 144;\
140 | = 145;\
141 | = 146;\
142 | = 147;\
143 | = 148;\
144 | = 149;\
145 | = 150;\
146 | = 151;\
147 | = 152;\
148 | = 153;\
149 | = 154;\
150 | = 155;\
151 | = 156;\
152 | = 157;\
153 | = 158;\
154 | = 159;\
155 | = 160;\
156 | = 161;\
157 | = 162;\
158 | = 163;\
159 | = 164;\
160 | = 165;\
161 | = 166;\
162 | = 167;\
163 | = 168;\
164 | = 169;\
165 | = 170;\
166 | = 171;\
167 | = 172;\
168 | = 173;\
169 | = 174;\
170 | = 175;\
171 | = 176;\
172 | = 177;\
173 | = 178;\
174 | = 179;\
175 | = 180;\
176 | = 181;\
177 | = 182;\
178 | = 183;\
179 | = 184;\
180 | = 185;\
181 | = 186;\
182 | = 187;\
183 | = 188;\
184 | = 189;\
185 | = 190;\
186 | = 191;\
187 | = 192;\
188 | = 193;\
189 | = 194;\
190 | = 195;\
191 | = 196;\
192 | = 197;\
193 | = 198;\
194 | = 199;\
195 | = 200;\
196 | = 201;\
197 | = 202;\
198 | = 203;\
199 | = 204;\
200 | = 205;\
201 | = 206;\
202 | = 207;\
203 | = 208;\
204 | = 209;\
205 | = 210;\
206 | = 211;\
207 | = 212;\
208 | = 213;\
209 | = 214;\
210 | = 215;\
211 | = 216;\
212 | = 217;\
213 | = 218;\
214 | = 219;\
215 | = 220;\
216 | = 221;\
217 | = 222;\
218 | = 223;\
219 | = 224;\
220 | = 225;\
221 | = 226;\
222 | = 227;\
223 | = 228;\
224 | = 229;\
225 | = 230;\
226 | = 231;\
227 | = 232;\
228 | = 233;\
229 | = 234;\
230 | = 235;\
231 | = 236;\
232 | = 237;\
233 | = 238;\
234 | = 239;\
235 | = 240;\
236 | = 241;\
237 | = 242;\
238 | = 243;\
239 | = 244;\
240 | = 245;\
241 | = 246;\
242 | = 247;\
243 | = 248;\
244 | = 249;\
245 | = 250;\
246 | = 251;\
247 | = 252;\
248 | = 253;\
249 | = 254;\
250 | = 255;\
251 | indicator 1 = \"Caps Lock\";\
252 | indicator 2 = \"Num Lock\";\
253 | indicator 3 = \"Scroll Lock\";\
254 | indicator 4 = \"Compose\";\
255 | indicator 5 = \"Kana\";\
256 | indicator 6 = \"Sleep\";\
257 | indicator 7 = \"Suspend\";\
258 | indicator 8 = \"Mute\";\
259 | indicator 9 = \"Misc\";\
260 | indicator 10 = \"Mail\";\
261 | indicator 11 = \"Charging\";\
262 | indicator 12 = \"Shift Lock\";\
263 | indicator 13 = \"Group 2\";\
264 | indicator 14 = \"Mouse Keys\";\
265 | alias = ;\
266 | alias