commit 374e922
nia
·
2019-12-11 16:23:11 +0000 UTC
parent 08b530b
NetBSD support w/ wscons input
14 files changed,
+1462,
-28
M
Makefile
+5,
-3
1@@ -28,15 +28,17 @@ include config.mk
2 # Dependencies
3 PACKAGES := \
4 libdrm \
5- libinput \
6 pixman-1 \
7 wayland-server \
8 wayland-protocols \
9 wld \
10 xkbcommon
11
12-ifeq ($(ENABLE_LIBUDEV),1)
13-PACKAGES += libudev
14+ifneq ($(shell uname),NetBSD)
15+ PACKAGES += libinput
16+ ifeq ($(ENABLE_LIBUDEV),1)
17+ PACKAGES += libudev
18+ endif
19 endif
20
21 libinput_CONSTRAINTS := --atleast-version=0.4
+52,
-0
1@@ -0,0 +1,52 @@
2+/* swc: launch/devmajor-linux.c
3+ *
4+ * Copyright (c) 2013, 2014, 2016 Michael Forney
5+ * Copyright (c) 2020 Nia Alarie
6+ *
7+ * Based in part upon weston-launch.c from weston which is:
8+ *
9+ * Copyright © 2012 Benjamin Franzke
10+ *
11+ * Permission is hereby granted, free of charge, to any person obtaining a copy
12+ * of this software and associated documentation files (the "Software"), to deal
13+ * in the Software without restriction, including without limitation the rights
14+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15+ * copies of the Software, and to permit persons to whom the Software is
16+ * furnished to do so, subject to the following conditions:
17+ *
18+ * The above copyright notice and this permission notice shall be included in
19+ * all copies or substantial portions of the Software.
20+ *
21+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27+ * SOFTWARE.
28+ */
29+#include <sys/sysmacros.h>
30+#include <linux/major.h>
31+#include "devmajor.h"
32+
33+#ifndef DRM_MAJOR
34+#define DRM_MAJOR 226
35+#endif
36+
37+bool
38+device_is_input(dev_t rdev)
39+{
40+ return major(rdev) == INPUT_MAJOR;
41+}
42+
43+bool
44+device_is_tty(dev_t rdev)
45+{
46+ return major(rdev) == TTY_MAJOR;
47+}
48+
49+bool
50+device_is_drm(dev_t rdev)
51+{
52+ return major(rdev) == DRM_MAJOR;
53+}
+86,
-0
1@@ -0,0 +1,86 @@
2+/* swc: launch/devmajor-netbsd.c
3+ *
4+ * Copyright (c) 2020 Nia Alarie
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7+ * of this software and associated documentation files (the "Software"), to deal
8+ * in the Software without restriction, including without limitation the rights
9+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+ * copies of the Software, and to permit persons to whom the Software is
11+ * furnished to do so, subject to the following conditions:
12+ *
13+ * The above copyright notice and this permission notice shall be included in
14+ * all copies or substantial portions of the Software.
15+ *
16+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+ * SOFTWARE.
23+ */
24+#include <sys/types.h>
25+#include <sys/sysctl.h>
26+#include <stdio.h>
27+#include <stdlib.h>
28+#include <string.h>
29+#include "devmajor.h"
30+
31+static int
32+sysctl_devmajor(const char *devname)
33+{
34+ static int name[] = { CTL_KERN, KERN_DRIVERS };
35+ struct kinfo_drivers *drivers = NULL;
36+ size_t i, len, newlen;
37+ int major;
38+
39+ if (sysctl(name, 2, NULL, &len, NULL, 0)) {
40+ perror("sysctl");
41+ goto fail;
42+ }
43+ if ((drivers = calloc(sizeof(struct kinfo_drivers), len)) == NULL) {
44+ perror("calloc");
45+ goto fail;
46+ }
47+ newlen = len;
48+ if (sysctl(name, 2, drivers, &newlen, NULL, 0)) {
49+ perror("sysctl");
50+ goto fail;
51+ }
52+ for (i = 0; i < len; ++i) {
53+ if (strcmp(devname, drivers[i].d_name) == 0) {
54+ major = drivers[i].d_cmajor;
55+ free(drivers);
56+ return major;
57+ }
58+ }
59+fail:
60+ free(drivers);
61+ return -1;
62+}
63+
64+bool
65+device_is_input(dev_t rdev)
66+{
67+ if (major(rdev) == sysctl_devmajor("wskbd"))
68+ return true;
69+ if (major(rdev) == sysctl_devmajor("wsmouse"))
70+ return true;
71+ if (major(rdev) == sysctl_devmajor("wsmux"))
72+ return true;
73+ return false;
74+}
75+
76+bool
77+device_is_tty(dev_t rdev)
78+{
79+ return major(rdev) == sysctl_devmajor("wsdisplay");
80+}
81+
82+bool
83+device_is_drm(dev_t rdev)
84+{
85+ return major(rdev) == sysctl_devmajor("drm");
86+}
87+
+36,
-0
1@@ -0,0 +1,36 @@
2+/* swc: launch/devmajor.h
3+ *
4+ * Copyright (c) 2020 Nia Alarie
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7+ * of this software and associated documentation files (the "Software"), to deal
8+ * in the Software without restriction, including without limitation the rights
9+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+ * copies of the Software, and to permit persons to whom the Software is
11+ * furnished to do so, subject to the following conditions:
12+ *
13+ * The above copyright notice and this permission notice shall be included in
14+ * all copies or substantial portions of the Software.
15+ *
16+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+ * SOFTWARE.
23+ */
24+
25+#ifndef DEVMAJOR_H
26+#define DEVMAJOR_H
27+
28+#include <sys/stat.h>
29+#include <stdbool.h>
30+
31+bool device_is_input(dev_t);
32+
33+bool device_is_tty(dev_t);
34+
35+bool device_is_drm(dev_t);
36+
37+#endif
+30,
-13
1@@ -26,6 +26,7 @@
2 */
3
4 #include "protocol.h"
5+#include "devmajor.h"
6
7 #include <errno.h>
8 #include <fcntl.h>
9@@ -38,21 +39,25 @@
10 #include <stdnoreturn.h>
11 #include <string.h>
12 #include <unistd.h>
13+#include <signal.h>
14
15 #include <sys/socket.h>
16 #include <sys/stat.h>
17 #include <sys/wait.h>
18 #include <sys/ioctl.h>
19+#include <sys/types.h>
20+#ifndef minor
21 #include <sys/sysmacros.h>
22+#endif
23+#ifdef __NetBSD__
24+#include <dev/wscons/wsdisplay_usl_io.h>
25+extern char **environ;
26+#else
27 #include <linux/input.h>
28 #include <linux/kd.h>
29-#include <linux/major.h>
30 #include <linux/vt.h>
31-#include <xf86drm.h>
32-
33-#ifndef DRM_MAJOR
34-#define DRM_MAJOR 226
35 #endif
36+#include <xf86drm.h>
37
38 #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array)[0])
39
40@@ -116,8 +121,10 @@ stop_devices(bool fatal)
41 die("drmDropMaster:");
42 }
43 for (i = 0; i < num_input_fds; ++i) {
44+#ifdef EVIOCREVOKE
45 if (ioctl(input_fds[i], EVIOCREVOKE, 0) < 0 && errno != ENODEV && fatal)
46 die("ioctl EVIOCREVOKE:");
47+#endif
48 close(input_fds[i]);
49 }
50 num_input_fds = 0;
51@@ -216,8 +223,7 @@ handle_socket_data(int socket)
52 goto fail;
53 }
54
55- switch (major(st.st_rdev)) {
56- case INPUT_MAJOR:
57+ if (device_is_input(st.st_rdev)) {
58 if (!active)
59 goto fail;
60 if (num_input_fds == ARRAY_LENGTH(input_fds)) {
61@@ -225,16 +231,14 @@ handle_socket_data(int socket)
62 goto fail;
63 }
64 input_fds[num_input_fds++] = fd;
65- break;
66- case DRM_MAJOR:
67+ } else if (device_is_drm(st.st_rdev)) {
68 if (num_drm_fds == ARRAY_LENGTH(drm_fds)) {
69 fprintf(stderr, "too many DRM devices opened\n");
70 goto fail;
71 }
72 drm_fds[num_drm_fds++] = fd;
73- break;
74- default:
75- fprintf(stderr, "device is not an input device\n");
76+ } else {
77+ fprintf(stderr, "requested fd is not a DRM or input device\n");
78 goto fail;
79 }
80 break;
81@@ -265,6 +269,10 @@ done:
82 static void
83 find_vt(char *vt, size_t size)
84 {
85+#ifdef __NetBSD__
86+ if (snprintf(vt, size, "/dev/ttyE1") >= size)
87+ die("VT number is too large");
88+#else
89 char *vtnr;
90 int tty0_fd, vt_num;
91
92@@ -283,6 +291,7 @@ find_vt(char *vt, size_t size)
93 if (snprintf(vt, size, "/dev/tty%s", vtnr) >= size)
94 die("XDG_VTNR is too long");
95 }
96+#endif
97 }
98
99 static int
100@@ -317,19 +326,27 @@ setup_tty(int fd)
101 if (fstat(fd, &st) == -1)
102 die("failed to stat TTY fd:");
103 vt = minor(st.st_rdev);
104- if (major(st.st_rdev) != TTY_MAJOR || vt == 0)
105+
106+ if (!device_is_tty(st.st_rdev) || vt == 0)
107 die("not a valid VT");
108
109 if (ioctl(fd, VT_GETSTATE, &state) == -1)
110 die("failed to get the current VT state:");
111 original_vt_state.vt = state.v_active;
112+#ifdef KDGETMODE
113 if (ioctl(fd, KDGKBMODE, &original_vt_state.kb_mode))
114 die("failed to get keyboard mode:");
115 if (ioctl(fd, KDGETMODE, &original_vt_state.console_mode))
116 die("failed to get console mode:");
117+#else
118+ original_vt_state.kb_mode = K_XLATE;
119+ original_vt_state.console_mode = KD_TEXT;
120+#endif
121
122+#ifdef K_OFF
123 if (ioctl(fd, KDSKBMODE, K_OFF) == -1)
124 die("failed to set keyboard mode to K_OFF:");
125+#endif
126 if (ioctl(fd, KDSETMODE, KD_GRAPHICS) == -1) {
127 perror("failed to set console mode to KD_GRAPHICS");
128 goto error0;
+8,
-1
1@@ -5,13 +5,20 @@ dir := launch
2 $(dir)_TARGETS := $(dir)/swc-launch
3 $(dir)_PACKAGES := libdrm
4
5-$(dir)/swc-launch: $(dir)/launch.o $(dir)/protocol.o
6+ifeq ($(shell uname),NetBSD)
7+ DEVMAJOR_OBJ=devmajor-netbsd.o
8+else
9+ DEVMAJOR_OBJ=devmajor-linux.o
10+endif
11+
12+$(dir)/swc-launch: $(dir)/$(DEVMAJOR_OBJ) $(dir)/launch.o $(dir)/protocol.o
13 $(link) $(launch_PACKAGE_LIBS)
14
15 install-$(dir): $(dir)/swc-launch | $(DESTDIR)$(BINDIR)
16 install -m 4755 launch/swc-launch $(DESTDIR)$(BINDIR)
17
18 CLEAN_FILES += $(dir)/launch.o
19+CLEAN_FILES += $(dir)/$(DEVMAJOR_OBJ)
20
21 include common.mk
22
+4,
-3
1@@ -150,7 +150,8 @@ update_keymap(struct xkb *xkb)
2
3 unlink(keymap_path);
4
5- if (posix_fallocate(xkb->keymap.fd, 0, xkb->keymap.size) != 0) {
6+ if (posix_fallocate(xkb->keymap.fd, 0, xkb->keymap.size) != 0 &&
7+ ftruncate(xkb->keymap.fd, xkb->keymap.size) != 0) {
8 WARNING("Could not resize XKB keymap file\n");
9 goto error2;
10 }
11@@ -176,7 +177,7 @@ error0:
12 }
13
14 struct keyboard *
15-keyboard_create(void)
16+keyboard_create(struct xkb_rule_names *names)
17 {
18 struct keyboard *keyboard;
19 struct xkb *xkb;
20@@ -191,7 +192,7 @@ keyboard_create(void)
21 goto error1;
22 }
23
24- if (!(xkb->keymap.map = xkb_keymap_new_from_names(xkb->context, NULL, 0))) {
25+ if (!(xkb->keymap.map = xkb_keymap_new_from_names(xkb->context, names, 0))) {
26 ERROR("Could not create XKB keymap\n");
27 goto error2;
28 }
+2,
-1
1@@ -26,6 +26,7 @@
2
3 #include "input.h"
4
5+#include <xkbcommon/xkbcommon.h>
6 #include <wayland-util.h>
7
8 /* Keycodes are offset by 8 in XKB. */
9@@ -83,7 +84,7 @@ struct keyboard {
10 uint32_t modifiers;
11 };
12
13-struct keyboard *keyboard_create(void);
14+struct keyboard *keyboard_create(struct xkb_rule_names *names);
15 void keyboard_destroy(struct keyboard *keyboard);
16 bool keyboard_reset(struct keyboard *keyboard);
17 void keyboard_set_focus(struct keyboard *keyboard, struct compositor_view *view);
+10,
-5
1@@ -17,7 +17,7 @@ $(dir)_TARGETS += \
2 $(dir)/$(LIBSWC_LINK)
3 endif
4
5-$(dir)_PACKAGES := libdrm libinput pixman-1 wayland-server wld xkbcommon
6+$(dir)_PACKAGES := libdrm pixman-1 wayland-server wld xkbcommon
7 $(dir)_CFLAGS += -Iprotocol
8
9 SWC_SOURCES = \
10@@ -42,7 +42,6 @@ SWC_SOURCES = \
11 libswc/primary_plane.c \
12 libswc/region.c \
13 libswc/screen.c \
14- libswc/seat.c \
15 libswc/shell.c \
16 libswc/shell_surface.c \
17 libswc/shm.c \
18@@ -63,9 +62,15 @@ SWC_SOURCES = \
19 protocol/xdg-decoration-unstable-v1-protocol.c \
20 protocol/xdg-shell-protocol.c
21
22-ifeq ($(ENABLE_LIBUDEV),1)
23-$(dir)_CFLAGS += -DENABLE_LIBUDEV
24-$(dir)_PACKAGES += libudev
25+ifeq ($(shell uname),NetBSD)
26+ SWC_SOURCES += libswc/seat-ws.c
27+else
28+ SWC_SOURCES += libswc/seat.c
29+ $(dir)_PACKAGES += libinput
30+ ifeq ($(ENABLE_LIBUDEV),1)
31+ $(dir)_CFLAGS += -DENABLE_LIBUDEV
32+ $(dir)_PACKAGES += libudev
33+ endif
34 endif
35
36 SWC_STATIC_OBJECTS = $(SWC_SOURCES:%.c=%.o)
+451,
-0
1@@ -0,0 +1,451 @@
2+/* swc: libswc/seat-ws.c
3+ *
4+ * Copyright (c) 2013, 2014 Michael Forney
5+ * Copyright (c) 2019 Nia Alarie
6+ *
7+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8+ * of this software and associated documentation files (the "Software"), to deal
9+ * in the Software without restriction, including without limitation the rights
10+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+ * copies of the Software, and to permit persons to whom the Software is
12+ * furnished to do so, subject to the following conditions:
13+ *
14+ * The above copyright notice and this permission notice shall be included in
15+ * all copies or substantial portions of the Software.
16+ *
17+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+ * SOFTWARE.
24+ */
25+
26+#include "wscons/atKeynames.h"
27+#include "wscons/bsd_KbdMap.h"
28+#include "seat.h"
29+#include "compositor.h"
30+#include "data_device.h"
31+#include "event.h"
32+#include "internal.h"
33+#include "keyboard.h"
34+#include "launch.h"
35+#include "pointer.h"
36+#include "screen.h"
37+#include "surface.h"
38+#include "util.h"
39+
40+#include <stdbool.h>
41+#include <stdio.h>
42+#include <stdlib.h>
43+#include <string.h>
44+#include <fcntl.h>
45+#include <unistd.h>
46+
47+#include <dev/wscons/wsconsio.h>
48+#include <dev/wscons/wsksymdef.h>
49+#include <sys/ioctl.h>
50+
51+/* Map wscons encodings to libxkbcommon layout names. */
52+struct ws_xkb_map {
53+ const int ws;
54+ const char * const xkb;
55+};
56+
57+static const struct ws_xkb_map ws_xkb_encodings[] = {
58+ { KB_UK, "gb" },
59+ { KB_BE, "be" },
60+ { KB_CZ, "cz" },
61+ { KB_DK, "dk" },
62+ { KB_NL, "nl" },
63+ { KB_DE, "de" },
64+ { KB_GR, "gr" },
65+ { KB_HU, "hu" },
66+ { KB_IT, "it" },
67+ { KB_JP, "jp" },
68+ { KB_NO, "no" },
69+ { KB_PL, "pl" },
70+ { KB_PT, "pt" },
71+ { KB_RU, "ru" },
72+ { KB_ES, "es" },
73+ { KB_SV, "sv" },
74+ { KB_SG, "sg" },
75+ { KB_TR, "tr" },
76+ { KB_UA, "ua" },
77+ { -1, NULL }
78+};
79+
80+struct seat {
81+ struct swc_seat base;
82+
83+ char *name;
84+ uint32_t capabilities;
85+
86+ int mouse_fd;
87+ int kbd_fd;
88+ bool ignore;
89+
90+ unsigned kbd_type;
91+
92+ struct xkb_rule_names names;
93+
94+ struct wl_event_source *mouse_source;
95+ struct wl_event_source *kbd_source;
96+
97+ struct wl_listener swc_listener;
98+
99+ struct wl_listener keyboard_focus_listener;
100+ struct pointer pointer;
101+ struct wl_listener data_device_listener;
102+
103+ struct wl_global *global;
104+ struct wl_list resources;
105+};
106+
107+static void
108+handle_keyboard_focus_event(struct wl_listener *listener, void *data)
109+{
110+ struct seat *seat = wl_container_of(listener, seat, keyboard_focus_listener);
111+ struct event *ev = data;
112+ struct input_focus_event_data *event_data = ev->data;
113+
114+ if (ev->type != INPUT_FOCUS_EVENT_CHANGED)
115+ return;
116+
117+ if (event_data->new) {
118+ struct wl_client *client = wl_resource_get_client(event_data->new->surface->resource);
119+
120+ /* Offer the selection to the new focus. */
121+ data_device_offer_selection(seat->base.data_device, client);
122+ }
123+}
124+
125+static void
126+handle_data_device_event(struct wl_listener *listener, void *data)
127+{
128+ struct seat *seat = wl_container_of(listener, seat, data_device_listener);
129+ struct event *ev = data;
130+
131+ if (ev->type != DATA_DEVICE_EVENT_SELECTION_CHANGED)
132+ return;
133+
134+ if (seat->base.keyboard->focus.client)
135+ data_device_offer_selection(seat->base.data_device, seat->base.keyboard->focus.client);
136+}
137+
138+static void
139+handle_swc_event(struct wl_listener *listener, void *data)
140+{
141+ struct seat *seat = wl_container_of(listener, seat, swc_listener);
142+ struct event *ev = data;
143+
144+ switch (ev->type) {
145+ case SWC_EVENT_DEACTIVATED:
146+ seat->ignore = true;
147+ keyboard_reset(seat->base.keyboard);
148+ break;
149+ case SWC_EVENT_ACTIVATED:
150+ seat->ignore = false;
151+ break;
152+ }
153+}
154+
155+/* Wayland Seat Interface */
156+static void
157+get_pointer(struct wl_client *client, struct wl_resource *resource, uint32_t id)
158+{
159+ struct seat *seat = wl_resource_get_user_data(resource);
160+
161+ pointer_bind(&seat->pointer, client, wl_resource_get_version(resource), id);
162+}
163+
164+static void
165+get_keyboard(struct wl_client *client, struct wl_resource *resource, uint32_t id)
166+{
167+ struct seat *seat = wl_resource_get_user_data(resource);
168+
169+ keyboard_bind(seat->base.keyboard, client, wl_resource_get_version(resource), id);
170+}
171+
172+static void
173+get_touch(struct wl_client *client, struct wl_resource *resource, uint32_t id)
174+{
175+ /* XXX: Implement */
176+}
177+
178+static struct wl_seat_interface seat_impl = {
179+ .get_pointer = get_pointer,
180+ .get_keyboard = get_keyboard,
181+ .get_touch = get_touch,
182+};
183+
184+static void
185+bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
186+{
187+ struct seat *seat = data;
188+ struct wl_resource *resource;
189+
190+ if (version > 4)
191+ version = 4;
192+
193+ resource = wl_resource_create(client, &wl_seat_interface, version, id);
194+ wl_resource_set_implementation(resource, &seat_impl, seat, &remove_resource);
195+ wl_list_insert(&seat->resources, wl_resource_get_link(resource));
196+
197+ if (version >= 2)
198+ wl_seat_send_name(resource, seat->name);
199+
200+ wl_seat_send_capabilities(resource, seat->capabilities);
201+}
202+
203+static int
204+ws_to_xkb(unsigned type, int key)
205+{
206+ switch (type) {
207+ case WSKBD_TYPE_PC_XT:
208+ case WSKBD_TYPE_PC_AT:
209+ return wsXtMap[key];
210+ case WSKBD_TYPE_USB:
211+ case WSKBD_TYPE_MAPLE:
212+ return wsUsbMap[key];
213+ default:
214+ fprintf(stderr, "Unknown wskbd type %d\n", type);
215+ return key;
216+ }
217+}
218+
219+static int
220+wsmouse_to_evdev(int button)
221+{
222+ /* The right and middle mouse buttons must be swapped. */
223+ switch (button) {
224+ case 1: /* Middle */
225+ return 0x112;
226+ case 2: /* Right */
227+ return 0x111;
228+ default:
229+ return button + 0x110;
230+ }
231+}
232+
233+static int
234+handle_ws_data(int fd, uint32_t mask, void *data)
235+{
236+ struct seat *seat = data;
237+ struct wscons_event ev;
238+
239+ while (!seat->ignore && (read(fd, &ev, sizeof(ev))) != -1) {
240+ uint32_t state, time;
241+ int key;
242+ wl_fixed_t pos;
243+
244+ time = ev.time.tv_sec + (ev.time.tv_nsec / 1000000L);
245+ switch (ev.type) {
246+ case WSCONS_EVENT_KEY_UP:
247+ state = WL_KEYBOARD_KEY_STATE_RELEASED;
248+ key = ws_to_xkb(seat->kbd_type, ev.value);
249+ keyboard_handle_key(seat->base.keyboard, time, key, state);
250+ break;
251+ case WSCONS_EVENT_KEY_DOWN:
252+ state = WL_KEYBOARD_KEY_STATE_PRESSED;
253+ key = ws_to_xkb(seat->kbd_type, ev.value);
254+ keyboard_handle_key(seat->base.keyboard, time, key, state);
255+ break;
256+ case WSCONS_EVENT_ALL_KEYS_UP:
257+ break;
258+ case WSCONS_EVENT_MOUSE_UP:
259+ state = WL_POINTER_BUTTON_STATE_RELEASED;
260+ key = wsmouse_to_evdev(ev.value);
261+ pointer_handle_button(seat->base.pointer, time, key, state);
262+ break;
263+ case WSCONS_EVENT_MOUSE_DOWN:
264+ state = WL_POINTER_BUTTON_STATE_PRESSED;
265+ key = wsmouse_to_evdev(ev.value);
266+ pointer_handle_button(seat->base.pointer, time, key, state);
267+ break;
268+ case WSCONS_EVENT_MOUSE_DELTA_X:
269+ pos = wl_fixed_from_int(ev.value);
270+ pointer_handle_relative_motion(seat->base.pointer, time, pos, 0);
271+ break;
272+ case WSCONS_EVENT_MOUSE_DELTA_Y:
273+ pos = wl_fixed_from_int(-ev.value);
274+ pointer_handle_relative_motion(seat->base.pointer, time, 0, pos);
275+ break;
276+ case WSCONS_EVENT_MOUSE_DELTA_Z:
277+ pos = wl_fixed_from_int(ev.value * 10);
278+ pointer_handle_axis(seat->base.pointer, time, 0, pos);
279+ break;
280+ case WSCONS_EVENT_MOUSE_DELTA_W:
281+ pos = wl_fixed_from_int(ev.value * 10);
282+ pointer_handle_axis(seat->base.pointer, time, 1, pos);
283+ break;
284+ case WSCONS_EVENT_MOUSE_ABSOLUTE_X:
285+ pos = wl_fixed_from_int(ev.value);
286+ pointer_handle_absolute_motion(seat->base.pointer, time, pos, 0);
287+ break;
288+ case WSCONS_EVENT_MOUSE_ABSOLUTE_Y:
289+ pos = wl_fixed_from_int(-ev.value);
290+ pointer_handle_absolute_motion(seat->base.pointer, time, 0, pos);
291+ break;
292+ }
293+ }
294+ return 0;
295+}
296+
297+static bool
298+initialize_wscons(struct seat *seat)
299+{
300+ int mouse_ver = WSMOUSE_EVENT_VERSION;
301+ int kbd_ver = WSKBDIO_EVENT_VERSION;
302+ int encoding_layout;
303+ kbd_t encoding;
304+ unsigned i;
305+
306+ if ((seat->mouse_fd = launch_open_device("/dev/wsmouse", O_RDONLY | O_NONBLOCK)) == -1) {
307+ ERROR("Could not open mouse device\n");
308+ goto error0;
309+ }
310+ if ((seat->kbd_fd = launch_open_device("/dev/wskbd", O_RDONLY | O_NONBLOCK)) == -1) {
311+ ERROR("Could not open keyboard device\n");
312+ goto error1;
313+ }
314+
315+ (void)ioctl(seat->mouse_fd, WSMOUSEIO_SETVERSION, &mouse_ver);
316+ (void)ioctl(seat->kbd_fd, WSKBDIO_SETVERSION, &kbd_ver);
317+
318+ if (ioctl(seat->kbd_fd, WSKBDIO_GTYPE, &seat->kbd_type) == -1) {
319+ ERROR("Could not get keyboard type\n");
320+ goto error2;
321+ }
322+
323+ if (ioctl(seat->kbd_fd, WSKBDIO_GETENCODING, &encoding) != -1) {
324+ encoding_layout = KB_ENCODING(encoding);
325+ for (i = 0; ws_xkb_encodings[i].xkb != NULL; ++i) {
326+ if (ws_xkb_encodings[i].ws == encoding_layout) {
327+ seat->names.layout = ws_xkb_encodings[i].xkb;
328+ break;
329+ }
330+ }
331+ switch (KB_VARIANT(encoding)) {
332+ case KB_NODEAD:
333+ seat->names.variant = "nodeadkeys";
334+ break;
335+ case KB_SWAPCTRLCAPS:
336+ seat->names.options = "ctrl:swapcaps";
337+ break;
338+ case KB_DVORAK:
339+ seat->names.variant = "dvorak";
340+ break;
341+ case KB_COLEMAK:
342+ seat->names.variant = "colemak";
343+ break;
344+ }
345+ }
346+
347+ return true;
348+error2:
349+ close(seat->kbd_fd);
350+error1:
351+ close(seat->mouse_fd);
352+error0:
353+ return false;
354+}
355+
356+struct swc_seat *
357+seat_create(struct wl_display *display, const char *seat_name)
358+{
359+ struct seat *seat;
360+
361+ seat = malloc(sizeof(*seat));
362+ if (!seat)
363+ goto error0;
364+
365+ seat->names.rules = "base";
366+ seat->names.model = "pc105";
367+ seat->names.layout = "us";
368+ seat->names.variant = "basic";
369+
370+ seat->name = strdup(seat_name);
371+ if (!seat->name) {
372+ ERROR("Could not allocate seat name string\n");
373+ goto error1;
374+ }
375+
376+ if (!initialize_wscons(seat))
377+ goto error2;
378+
379+ seat->global = wl_global_create(display, &wl_seat_interface, 4, seat, &bind_seat);
380+ if (!seat->global)
381+ goto error2;
382+ seat->capabilities = WL_SEAT_CAPABILITY_KEYBOARD | WL_SEAT_CAPABILITY_POINTER;
383+ wl_list_init(&seat->resources);
384+
385+ seat->swc_listener.notify = &handle_swc_event;
386+ wl_signal_add(&swc.event_signal, &seat->swc_listener);
387+
388+ seat->base.data_device = data_device_create();
389+ if (!seat->base.data_device) {
390+ ERROR("Could not initialize data device\n");
391+ goto error3;
392+ }
393+ seat->data_device_listener.notify = &handle_data_device_event;
394+ wl_signal_add(&seat->base.data_device->event_signal, &seat->data_device_listener);
395+
396+ seat->base.keyboard = keyboard_create(&seat->names);
397+ if (!seat->base.keyboard) {
398+ ERROR("Could not initialize keyboard\n");
399+ goto error4;
400+ }
401+ seat->keyboard_focus_listener.notify = handle_keyboard_focus_event;
402+ wl_signal_add(&seat->base.keyboard->focus.event_signal, &seat->keyboard_focus_listener);
403+
404+ if (!pointer_initialize(&seat->pointer)) {
405+ ERROR("Could not initialize pointer\n");
406+ goto error5;
407+ }
408+ seat->base.pointer = &seat->pointer;
409+
410+ seat->kbd_source = wl_event_loop_add_fd
411+ (swc.event_loop, seat->kbd_fd, WL_EVENT_READABLE,
412+ &handle_ws_data, seat);
413+ seat->mouse_source = wl_event_loop_add_fd
414+ (swc.event_loop, seat->mouse_fd, WL_EVENT_READABLE,
415+ &handle_ws_data, seat);
416+
417+ return &seat->base;
418+
419+error5:
420+ keyboard_destroy(seat->base.keyboard);
421+error4:
422+ data_device_destroy(seat->base.data_device);
423+error3:
424+ wl_global_destroy(seat->global);
425+error2:
426+ free(seat->name);
427+error1:
428+ free(seat);
429+error0:
430+ return NULL;
431+}
432+
433+void
434+seat_destroy(struct swc_seat *seat_base)
435+{
436+ struct seat *seat = wl_container_of(seat_base, seat, base);
437+
438+ wl_event_source_remove(seat->mouse_source);
439+ wl_event_source_remove(seat->kbd_source);
440+ close(seat->mouse_fd);
441+ seat->mouse_fd = -1;
442+ close(seat->kbd_fd);
443+ seat->kbd_fd = -1;
444+
445+ pointer_finalize(&seat->pointer);
446+ keyboard_destroy(seat->base.keyboard);
447+ data_device_destroy(seat->base.data_device);
448+
449+ wl_global_destroy(seat->global);
450+ free(seat->name);
451+ free(seat);
452+}
+1,
-1
1@@ -395,7 +395,7 @@ seat_create(struct wl_display *display, const char *seat_name)
2 seat->data_device_listener.notify = &handle_data_device_event;
3 wl_signal_add(&seat->base.data_device->event_signal, &seat->data_device_listener);
4
5- seat->base.keyboard = keyboard_create();
6+ seat->base.keyboard = keyboard_create(NULL);
7 if (!seat->base.keyboard) {
8 ERROR("Could not initialize keyboard\n");
9 goto error4;
+11,
-1
1@@ -51,6 +51,16 @@ struct pool_reference {
2 struct pool *pool;
3 };
4
5+static void *
6+swc_mremap(void *oldp, size_t oldsize, size_t newsize)
7+{
8+#ifdef __NetBSD__
9+ return mremap(oldp, oldsize, NULL, newsize, 0);
10+#else /* Linux-style mremap */
11+ return mremap(oldp, oldsize, newsize, MREMAP_MAYMOVE);
12+#endif
13+}
14+
15 static void
16 unref_pool(struct pool *pool)
17 {
18@@ -138,7 +148,7 @@ resize(struct wl_client *client, struct wl_resource *resource, int32_t size)
19 struct pool *pool = wl_resource_get_user_data(resource);
20 void *data;
21
22- data = mremap(pool->data, pool->size, size, MREMAP_MAYMOVE);
23+ data = swc_mremap(pool->data, pool->size, size);
24 if (data == MAP_FAILED) {
25 wl_resource_post_error(resource, WL_SHM_ERROR_INVALID_FD, "mremap failed: %s", strerror(errno));
26 return;
+281,
-0
1@@ -0,0 +1,281 @@
2+/*
3+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
4+ *
5+ * Permission to use, copy, modify, distribute, and sell this software and its
6+ * documentation for any purpose is hereby granted without fee, provided that
7+ * the above copyright notice appear in all copies and that both that
8+ * copyright notice and this permission notice appear in supporting
9+ * documentation, and that the name of Thomas Roell not be used in
10+ * advertising or publicity pertaining to distribution of the software without
11+ * specific, written prior permission. Thomas Roell makes no representations
12+ * about the suitability of this software for any purpose. It is provided
13+ * "as is" without express or implied warranty.
14+ *
15+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21+ * PERFORMANCE OF THIS SOFTWARE.
22+ *
23+ */
24+/*
25+ * Copyright (c) 1994-2003 by The XFree86 Project, Inc.
26+ *
27+ * Permission is hereby granted, free of charge, to any person obtaining a
28+ * copy of this software and associated documentation files (the "Software"),
29+ * to deal in the Software without restriction, including without limitation
30+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
31+ * and/or sell copies of the Software, and to permit persons to whom the
32+ * Software is furnished to do so, subject to the following conditions:
33+ *
34+ * The above copyright notice and this permission notice shall be included in
35+ * all copies or substantial portions of the Software.
36+ *
37+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
40+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
41+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
42+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43+ * OTHER DEALINGS IN THE SOFTWARE.
44+ *
45+ * Except as contained in this notice, the name of the copyright holder(s)
46+ * and author(s) shall not be used in advertising or otherwise to promote
47+ * the sale, use or other dealings in this Software without prior written
48+ * authorization from the copyright holder(s) and author(s).
49+ */
50+
51+#ifndef _ATKEYNAMES_H
52+#define _ATKEYNAMES_H
53+
54+#define XK_TECHNICAL
55+#define XK_KATAKANA
56+
57+/*
58+ * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
59+ * sets of scancodes. Set3 can only be generated by a MF keyboard.
60+ * Set2 sends a makecode for keypress, and the same code prefixed by a
61+ * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
62+ * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
63+ * Bit 7 ist set if the key is released. The code E0 switches to a
64+ * different meaning to add the new MF cursorkeys, while not breaking old
65+ * applications. E1 is another special prefix. Since I assume that there
66+ * will be further versions of PC/XT scancode compatible keyboards, we
67+ * may be in trouble one day.
68+ *
69+ * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
70+ * 2) Use the keyboards native set and translate it to common keysyms.
71+ */
72+
73+/*
74+ * definition of the AT84/MF101/MF102 Keyboard:
75+ * ============================================================
76+ * Defined Key Cap Glyphs Pressed value
77+ * Key Name Main Also (hex) (dec)
78+ * ---------------- ---------- ------- ------ ------
79+ */
80+
81+#define KEY_Escape /* Escape 0x01 */ 1
82+#define KEY_1 /* 1 ! 0x02 */ 2
83+#define KEY_2 /* 2 @ 0x03 */ 3
84+#define KEY_3 /* 3 # 0x04 */ 4
85+#define KEY_4 /* 4 $ 0x05 */ 5
86+#define KEY_5 /* 5 % 0x06 */ 6
87+#define KEY_6 /* 6 ^ 0x07 */ 7
88+#define KEY_7 /* 7 & 0x08 */ 8
89+#define KEY_8 /* 8 * 0x09 */ 9
90+#define KEY_9 /* 9 ( 0x0a */ 10
91+#define KEY_0 /* 0 ) 0x0b */ 11
92+#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
93+#define KEY_Equal /* = (Equal) + 0x0d */ 13
94+#define KEY_BackSpace /* Back Space 0x0e */ 14
95+#define KEY_Tab /* Tab 0x0f */ 15
96+#define KEY_Q /* Q 0x10 */ 16
97+#define KEY_W /* W 0x11 */ 17
98+#define KEY_E /* E 0x12 */ 18
99+#define KEY_R /* R 0x13 */ 19
100+#define KEY_T /* T 0x14 */ 20
101+#define KEY_Y /* Y 0x15 */ 21
102+#define KEY_U /* U 0x16 */ 22
103+#define KEY_I /* I 0x17 */ 23
104+#define KEY_O /* O 0x18 */ 24
105+#define KEY_P /* P 0x19 */ 25
106+#define KEY_LBrace /* [ { 0x1a */ 26
107+#define KEY_RBrace /* ] } 0x1b */ 27
108+#define KEY_Enter /* Enter 0x1c */ 28
109+#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
110+#define KEY_A /* A 0x1e */ 30
111+#define KEY_S /* S 0x1f */ 31
112+#define KEY_D /* D 0x20 */ 32
113+#define KEY_F /* F 0x21 */ 33
114+#define KEY_G /* G 0x22 */ 34
115+#define KEY_H /* H 0x23 */ 35
116+#define KEY_J /* J 0x24 */ 36
117+#define KEY_K /* K 0x25 */ 37
118+#define KEY_L /* L 0x26 */ 38
119+#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
120+#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
121+#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
122+#define KEY_ShiftL /* Shift(left) 0x2a */ 42
123+#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
124+#define KEY_Z /* Z 0x2c */ 44
125+#define KEY_X /* X 0x2d */ 45
126+#define KEY_C /* C 0x2e */ 46
127+#define KEY_V /* V 0x2f */ 47
128+#define KEY_B /* B 0x30 */ 48
129+#define KEY_N /* N 0x31 */ 49
130+#define KEY_M /* M 0x32 */ 50
131+#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
132+#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
133+#define KEY_Slash /* / (Slash) ? 0x35 */ 53
134+#define KEY_ShiftR /* Shift(right) 0x36 */ 54
135+#define KEY_KP_Multiply /* * 0x37 */ 55
136+#define KEY_Alt /* Alt(left) 0x38 */ 56
137+#define KEY_Space /* (SpaceBar) 0x39 */ 57
138+#define KEY_CapsLock /* CapsLock 0x3a */ 58
139+#define KEY_F1 /* F1 0x3b */ 59
140+#define KEY_F2 /* F2 0x3c */ 60
141+#define KEY_F3 /* F3 0x3d */ 61
142+#define KEY_F4 /* F4 0x3e */ 62
143+#define KEY_F5 /* F5 0x3f */ 63
144+#define KEY_F6 /* F6 0x40 */ 64
145+#define KEY_F7 /* F7 0x41 */ 65
146+#define KEY_F8 /* F8 0x42 */ 66
147+#define KEY_F9 /* F9 0x43 */ 67
148+#define KEY_F10 /* F10 0x44 */ 68
149+#define KEY_NumLock /* NumLock 0x45 */ 69
150+#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
151+#define KEY_KP_7 /* 7 Home 0x47 */ 71
152+#define KEY_KP_8 /* 8 Up 0x48 */ 72
153+#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
154+#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
155+#define KEY_KP_4 /* 4 Left 0x4b */ 75
156+#define KEY_KP_5 /* 5 0x4c */ 76
157+#define KEY_KP_6 /* 6 Right 0x4d */ 77
158+#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
159+#define KEY_KP_1 /* 1 End 0x4f */ 79
160+#define KEY_KP_2 /* 2 Down 0x50 */ 80
161+#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
162+#define KEY_KP_0 /* 0 Insert 0x52 */ 82
163+#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
164+#define KEY_SysReqest /* SysReqest 0x54 */ 84
165+ /* NOTUSED 0x55 */
166+#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
167+#define KEY_F11 /* F11 0x57 */ 87
168+#define KEY_F12 /* F12 0x58 */ 88
169+
170+#define KEY_Prefix0 /* special 0x60 */ 96
171+#define KEY_Prefix1 /* specail 0x61 */ 97
172+
173+/*
174+ * The 'scancodes' below are generated by the server, because the MF101/102
175+ * keyboard sends them as sequence of other scancodes
176+ */
177+#define KEY_Home /* Home 0x59 */ 89
178+#define KEY_Up /* Up 0x5a */ 90
179+#define KEY_PgUp /* PgUp 0x5b */ 91
180+#define KEY_Left /* Left 0x5c */ 92
181+#define KEY_Begin /* Begin 0x5d */ 93
182+#define KEY_Right /* Right 0x5e */ 94
183+#define KEY_End /* End 0x5f */ 95
184+#define KEY_Down /* Down 0x60 */ 96
185+#define KEY_PgDown /* PgDown 0x61 */ 97
186+#define KEY_Insert /* Insert 0x62 */ 98
187+#define KEY_Delete /* Delete 0x63 */ 99
188+#define KEY_KP_Enter /* Enter 0x64 */ 100
189+#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
190+#define KEY_Pause /* Pause 0x66 */ 102
191+#define KEY_Print /* Print 0x67 */ 103
192+#define KEY_KP_Divide /* Divide 0x68 */ 104
193+#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
194+#define KEY_Break /* Break 0x6a */ 106
195+#define KEY_LMeta /* Left Meta 0x6b */ 107
196+#define KEY_RMeta /* Right Meta 0x6c */ 108
197+#define KEY_Menu /* Menu 0x6d */ 109
198+#define KEY_F13 /* F13 0x6e */ 110
199+#define KEY_F14 /* F14 0x6f */ 111
200+#define KEY_F15 /* F15 0x70 */ 112
201+#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112
202+#define KEY_F16 /* F16 0x71 */ 113
203+#define KEY_F17 /* F17 0x72 */ 114
204+#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
205+#define KEY_BSlash2 /* \ _ 0x73 */ 115
206+#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
207+#define KEY_XFER /* Kanji Transfer 0x79 */ 121
208+#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
209+#define KEY_Yen /* Yen 0x7d */ 125
210+
211+#define KEY_Power /* Power Key 0x84 */ 132
212+#define KEY_Mute /* Audio Mute 0x85 */ 133
213+#define KEY_AudioLower /* Audio Lower 0x86 */ 134
214+#define KEY_AudioRaise /* Audio Raise 0x87 */ 135
215+#define KEY_Help /* Help 0x88 */ 136
216+#define KEY_L1 /* Stop 0x89 */ 137
217+#define KEY_L2 /* Again 0x8a */ 138
218+#define KEY_L3 /* Props 0x8b */ 139
219+#define KEY_L4 /* Undo 0x8c */ 140
220+#define KEY_L5 /* Front 0x8d */ 141
221+#define KEY_L6 /* Copy 0x8e */ 142
222+#define KEY_L7 /* Open 0x8f */ 143
223+#define KEY_L8 /* Paste 0x90 */ 144
224+#define KEY_L9 /* Find 0x91 */ 145
225+#define KEY_L10 /* Cut 0x92 */ 146
226+
227+/*
228+ * Fake 'scancodes' in the following ranges are generated for 2-byte
229+ * codes not handled elsewhere. These correspond to most extended keys
230+ * on so-called "Internet" keyboards:
231+ *
232+ * 0x79-0x93
233+ * 0x96-0xa1
234+ * 0xa3-0xac
235+ * 0xb1-0xb4
236+ * 0xba-0xbd
237+ * 0xc2
238+ * 0xcc-0xd2
239+ * 0xd6-0xf7
240+ */
241+
242+/*
243+ * Remapped 'scancodes' are generated for single-byte codes in the range
244+ * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards.
245+ */
246+
247+#define KEY_0x59 0x95
248+#define KEY_0x5A 0xA2
249+#define KEY_0x5B 0xAD
250+#define KEY_0x5C KEY_KP_EQUAL
251+#define KEY_0x5D 0xAE
252+#define KEY_0x5E 0xAF
253+#define KEY_0x5F 0xB0
254+#define KEY_0x62 0xB5
255+#define KEY_0x63 0xB6
256+#define KEY_0x64 0xB7
257+#define KEY_0x65 0xB8
258+#define KEY_0x66 0xB9
259+#define KEY_0x67 0xBE
260+#define KEY_0x68 0xBF
261+#define KEY_0x69 0xC0
262+#define KEY_0x6A 0xC1
263+#define KEY_0x6B 0xC3
264+#define KEY_0x6C 0xC4
265+#define KEY_0x6D 0xC5
266+#define KEY_0x6E 0xC6
267+#define KEY_0x6F 0xC7
268+#define KEY_0x70 0xC8
269+#define KEY_0x71 0xC9
270+#define KEY_0x72 0xCA
271+#define KEY_0x73 0xCB
272+#define KEY_0x74 0xD3
273+#define KEY_0x75 0xD4
274+#define KEY_0x76 0xD5
275+#define KEY_R_0xF4 0xF4
276+#define KEY_R_0xF5 0xF5
277+
278+/* These are for "notused" and "unknown" entries in translation maps. */
279+#define KEY_NOTUSED 0
280+#define KEY_UNKNOWN 255
281+
282+#endif /* _ATKEYNAMES_H */
+485,
-0
1@@ -0,0 +1,485 @@
2+/*
3+ * Slightly modified xf86KbdBSD.c which is
4+ *
5+ * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk)
6+ * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
7+ * and from xf86KbdCODrv.c by Holger Veit
8+ */
9+
10+#include <stdint.h>
11+
12+static uint8_t wsUsbMap[] = {
13+ /* 0 */ KEY_NOTUSED,
14+ /* 1 */ KEY_NOTUSED,
15+ /* 2 */ KEY_NOTUSED,
16+ /* 3 */ KEY_NOTUSED,
17+ /* 4 */ KEY_A,
18+ /* 5 */ KEY_B,
19+ /* 6 */ KEY_C,
20+ /* 7 */ KEY_D,
21+ /* 8 */ KEY_E,
22+ /* 9 */ KEY_F,
23+ /* 10 */ KEY_G,
24+ /* 11 */ KEY_H,
25+ /* 12 */ KEY_I,
26+ /* 13 */ KEY_J,
27+ /* 14 */ KEY_K,
28+ /* 15 */ KEY_L,
29+ /* 16 */ KEY_M,
30+ /* 17 */ KEY_N,
31+ /* 18 */ KEY_O,
32+ /* 19 */ KEY_P,
33+ /* 20 */ KEY_Q,
34+ /* 21 */ KEY_R,
35+ /* 22 */ KEY_S,
36+ /* 23 */ KEY_T,
37+ /* 24 */ KEY_U,
38+ /* 25 */ KEY_V,
39+ /* 26 */ KEY_W,
40+ /* 27 */ KEY_X,
41+ /* 28 */ KEY_Y,
42+ /* 29 */ KEY_Z,
43+ /* 30 */ KEY_1, /* 1 !*/
44+ /* 31 */ KEY_2, /* 2 @ */
45+ /* 32 */ KEY_3, /* 3 # */
46+ /* 33 */ KEY_4, /* 4 $ */
47+ /* 34 */ KEY_5, /* 5 % */
48+ /* 35 */ KEY_6, /* 6 ^ */
49+ /* 36 */ KEY_7, /* 7 & */
50+ /* 37 */ KEY_8, /* 8 * */
51+ /* 38 */ KEY_9, /* 9 ( */
52+ /* 39 */ KEY_0, /* 0 ) */
53+ /* 40 */ KEY_Enter, /* Return */
54+ /* 41 */ KEY_Escape, /* Escape */
55+ /* 42 */ KEY_BackSpace, /* Backspace Delete */
56+ /* 43 */ KEY_Tab, /* Tab */
57+ /* 44 */ KEY_Space, /* Space */
58+ /* 45 */ KEY_Minus, /* - _ */
59+ /* 46 */ KEY_Equal, /* = + */
60+ /* 47 */ KEY_LBrace, /* [ { */
61+ /* 48 */ KEY_RBrace, /* ] } */
62+ /* 49 */ KEY_BSlash, /* \ | */
63+ /* 50 */ KEY_BSlash, /* \ _ # ~ on some keyboards */
64+ /* 51 */ KEY_SemiColon, /* ; : */
65+ /* 52 */ KEY_Quote, /* ' " */
66+ /* 53 */ KEY_Tilde, /* ` ~ */
67+ /* 54 */ KEY_Comma, /* , < */
68+ /* 55 */ KEY_Period, /* . > */
69+ /* 56 */ KEY_Slash, /* / ? */
70+ /* 57 */ KEY_CapsLock, /* Caps Lock */
71+ /* 58 */ KEY_F1, /* F1 */
72+ /* 59 */ KEY_F2, /* F2 */
73+ /* 60 */ KEY_F3, /* F3 */
74+ /* 61 */ KEY_F4, /* F4 */
75+ /* 62 */ KEY_F5, /* F5 */
76+ /* 63 */ KEY_F6, /* F6 */
77+ /* 64 */ KEY_F7, /* F7 */
78+ /* 65 */ KEY_F8, /* F8 */
79+ /* 66 */ KEY_F9, /* F9 */
80+ /* 67 */ KEY_F10, /* F10 */
81+ /* 68 */ KEY_F11, /* F11 */
82+ /* 69 */ KEY_F12, /* F12 */
83+ /* 70 */ KEY_Print, /* PrintScrn SysReq */
84+ /* 71 */ KEY_ScrollLock, /* Scroll Lock */
85+ /* 72 */ KEY_Pause, /* Pause Break */
86+ /* 73 */ KEY_Insert, /* Insert XXX Help on some Mac Keyboards */
87+ /* 74 */ KEY_Home, /* Home */
88+ /* 75 */ KEY_PgUp, /* Page Up */
89+ /* 76 */ KEY_Delete, /* Delete */
90+ /* 77 */ KEY_End, /* End */
91+ /* 78 */ KEY_PgDown, /* Page Down */
92+ /* 79 */ KEY_Right, /* Right Arrow */
93+ /* 80 */ KEY_Left, /* Left Arrow */
94+ /* 81 */ KEY_Down, /* Down Arrow */
95+ /* 82 */ KEY_Up, /* Up Arrow */
96+ /* 83 */ KEY_NumLock, /* Num Lock */
97+ /* 84 */ KEY_KP_Divide, /* Keypad / */
98+ /* 85 */ KEY_KP_Multiply, /* Keypad * */
99+ /* 86 */ KEY_KP_Minus, /* Keypad - */
100+ /* 87 */ KEY_KP_Plus, /* Keypad + */
101+ /* 88 */ KEY_KP_Enter, /* Keypad Enter */
102+ /* 89 */ KEY_KP_1, /* Keypad 1 End */
103+ /* 90 */ KEY_KP_2, /* Keypad 2 Down */
104+ /* 91 */ KEY_KP_3, /* Keypad 3 Pg Down */
105+ /* 92 */ KEY_KP_4, /* Keypad 4 Left */
106+ /* 93 */ KEY_KP_5, /* Keypad 5 */
107+ /* 94 */ KEY_KP_6, /* Keypad 6 */
108+ /* 95 */ KEY_KP_7, /* Keypad 7 Home */
109+ /* 96 */ KEY_KP_8, /* Keypad 8 Up */
110+ /* 97 */ KEY_KP_9, /* KEypad 9 Pg Up */
111+ /* 98 */ KEY_KP_0, /* Keypad 0 Ins */
112+ /* 99 */ KEY_KP_Decimal, /* Keypad . Del */
113+ /* 100 */ KEY_Less, /* < > on some keyboards */
114+ /* 101 */ KEY_Menu, /* Menu */
115+ /* 102 */ KEY_Power, /* sleep key on Sun USB */
116+ /* 103 */ KEY_KP_Equal, /* Keypad = on Mac keyboards */
117+ /* 104 */ KEY_F13,
118+ /* 105 */ KEY_F14,
119+ /* 106 */ KEY_F15,
120+ /* 107 */ KEY_F16,
121+ /* 108 */ KEY_NOTUSED,
122+ /* 109 */ KEY_Power,
123+ /* 110 */ KEY_NOTUSED,
124+ /* 111 */ KEY_NOTUSED,
125+ /* 112 */ KEY_NOTUSED,
126+ /* 113 */ KEY_NOTUSED,
127+ /* 114 */ KEY_NOTUSED,
128+ /* 115 */ KEY_NOTUSED,
129+ /* 116 */ KEY_L7,
130+ /* 117 */ KEY_Help,
131+ /* 118 */ KEY_L3,
132+ /* 119 */ KEY_L5,
133+ /* 120 */ KEY_L1,
134+ /* 121 */ KEY_L2,
135+ /* 122 */ KEY_L4,
136+ /* 123 */ KEY_L10,
137+ /* 124 */ KEY_L6,
138+ /* 125 */ KEY_L8,
139+ /* 126 */ KEY_L9,
140+ /* 127 */ KEY_Mute,
141+ /* 128 */ KEY_AudioRaise,
142+ /* 129 */ KEY_AudioLower,
143+ /* 130 */ KEY_NOTUSED,
144+ /* 131 */ KEY_NOTUSED,
145+ /* 132 */ KEY_NOTUSED,
146+ /* 133 */ KEY_NOTUSED,
147+ /* 134 */ KEY_NOTUSED,
148+/*
149+ * Special keycodes for Japanese keyboards
150+ * Override atKeyname HKTG and BSlash2 code to unique values for JP106 keyboards
151+ */
152+#undef KEY_HKTG
153+#define KEY_HKTG 200 /* Japanese Hiragana Katakana Toggle */
154+#undef KEY_BSlash2
155+#define KEY_BSlash2 203 /* Japanese '\_' key */
156+
157+ /* 135 */ KEY_BSlash2, /* Japanese 106 kbd: '\_' */
158+ /* 136 */ KEY_HKTG, /* Japanese 106 kbd: Hiragana Katakana toggle */
159+ /* 137 */ KEY_Yen, /* Japanese 106 kbd: '\|' */
160+ /* 138 */ KEY_XFER, /* Japanese 106 kbd: Henkan */
161+ /* 139 */ KEY_NFER, /* Japanese 106 kbd: Muhenkan */
162+ /* 140 */ KEY_NOTUSED,
163+ /* 141 */ KEY_NOTUSED,
164+ /* 142 */ KEY_NOTUSED,
165+ /* 143 */ KEY_NOTUSED,
166+/*
167+ * Special keycodes for Korean keyboards
168+ * Define Hangul and Hangul_Hanja unique key codes
169+ * These keys also use KANA and EISU on some Macintosh Japanese USB keyboards
170+ */
171+#define KEY_Hangul 201 /* Also KANA Key on Mac JP USB kbd */
172+#define KEY_Hangul_Hanja 202 /* Also EISU Key on Mac JP USB kbd */
173+ /* 144 */ KEY_Hangul, /* Korean 106 kbd: Hangul */
174+ /* 145 */ KEY_Hangul_Hanja, /* Korean 106 kbd: Hangul Hanja */
175+ /* 146 */ KEY_NOTUSED,
176+ /* 147 */ KEY_NOTUSED,
177+ /* 148 */ KEY_NOTUSED,
178+ /* 149 */ KEY_NOTUSED,
179+ /* 150 */ KEY_NOTUSED,
180+ /* 151 */ KEY_NOTUSED,
181+ /* 152 */ KEY_NOTUSED,
182+ /* 153 */ KEY_NOTUSED,
183+ /* 154 */ KEY_NOTUSED,
184+ /* 155 */ KEY_NOTUSED,
185+ /* 156 */ KEY_NOTUSED,
186+ /* 157 */ KEY_NOTUSED,
187+ /* 158 */ KEY_NOTUSED,
188+ /* 159 */ KEY_NOTUSED,
189+ /* 160 */ KEY_NOTUSED,
190+ /* 161 */ KEY_NOTUSED,
191+ /* 162 */ KEY_NOTUSED,
192+ /* 163 */ KEY_NOTUSED,
193+ /* 164 */ KEY_NOTUSED,
194+ /* 165 */ KEY_NOTUSED,
195+ /* 166 */ KEY_NOTUSED,
196+ /* 167 */ KEY_NOTUSED,
197+ /* 168 */ KEY_NOTUSED,
198+ /* 169 */ KEY_NOTUSED,
199+ /* 170 */ KEY_NOTUSED,
200+ /* 171 */ KEY_NOTUSED,
201+ /* 172 */ KEY_NOTUSED,
202+ /* 173 */ KEY_NOTUSED,
203+ /* 174 */ KEY_NOTUSED,
204+ /* 175 */ KEY_NOTUSED,
205+ /* 176 */ KEY_NOTUSED,
206+ /* 177 */ KEY_NOTUSED,
207+ /* 178 */ KEY_NOTUSED,
208+ /* 179 */ KEY_NOTUSED,
209+ /* 180 */ KEY_NOTUSED,
210+ /* 181 */ KEY_NOTUSED,
211+ /* 182 */ KEY_NOTUSED,
212+ /* 183 */ KEY_NOTUSED,
213+ /* 184 */ KEY_NOTUSED,
214+ /* 185 */ KEY_NOTUSED,
215+ /* 186 */ KEY_NOTUSED,
216+ /* 187 */ KEY_NOTUSED,
217+ /* 188 */ KEY_NOTUSED,
218+ /* 189 */ KEY_NOTUSED,
219+ /* 190 */ KEY_NOTUSED,
220+ /* 191 */ KEY_NOTUSED,
221+ /* 192 */ KEY_NOTUSED,
222+ /* 193 */ KEY_NOTUSED,
223+ /* 194 */ KEY_NOTUSED,
224+ /* 195 */ KEY_NOTUSED,
225+ /* 196 */ KEY_NOTUSED,
226+ /* 197 */ KEY_NOTUSED,
227+ /* 198 */ KEY_NOTUSED,
228+ /* 199 */ KEY_NOTUSED,
229+ /* 200 */ KEY_NOTUSED,
230+ /* 201 */ KEY_NOTUSED,
231+ /* 202 */ KEY_NOTUSED,
232+ /* 203 */ KEY_NOTUSED,
233+ /* 204 */ KEY_NOTUSED,
234+ /* 205 */ KEY_NOTUSED,
235+ /* 206 */ KEY_NOTUSED,
236+ /* 207 */ KEY_NOTUSED,
237+ /* 208 */ KEY_NOTUSED,
238+ /* 209 */ KEY_NOTUSED,
239+ /* 210 */ KEY_NOTUSED,
240+ /* 211 */ KEY_NOTUSED,
241+ /* 212 */ KEY_NOTUSED,
242+ /* 213 */ KEY_NOTUSED,
243+ /* 214 */ KEY_NOTUSED,
244+ /* 215 */ KEY_NOTUSED,
245+ /* 216 */ KEY_NOTUSED,
246+ /* 217 */ KEY_NOTUSED,
247+ /* 218 */ KEY_NOTUSED,
248+ /* 219 */ KEY_NOTUSED,
249+ /* 220 */ KEY_NOTUSED,
250+ /* 221 */ KEY_NOTUSED,
251+ /* 222 */ KEY_NOTUSED,
252+ /* 223 */ KEY_NOTUSED,
253+ /* 224 */ KEY_LCtrl, /* Left Control */
254+ /* 225 */ KEY_ShiftL, /* Left Shift */
255+ /* 226 */ KEY_Alt, /* Left Alt */
256+ /* 227 */ KEY_LMeta, /* Left Meta */
257+ /* 228 */ KEY_RCtrl, /* Right Control */
258+ /* 229 */ KEY_ShiftR, /* Right Shift */
259+ /* 230 */ KEY_AltLang, /* Right Alt, AKA AltGr */
260+ /* 231 */ KEY_LMeta, /* Right Meta XXX */
261+};
262+
263+static uint8_t wsXtMap[] = {
264+ /* 0 */ KEY_NOTUSED,
265+ /* 1 */ KEY_Escape,
266+ /* 2 */ KEY_1,
267+ /* 3 */ KEY_2,
268+ /* 4 */ KEY_3,
269+ /* 5 */ KEY_4,
270+ /* 6 */ KEY_5,
271+ /* 7 */ KEY_6,
272+ /* 8 */ KEY_7,
273+ /* 9 */ KEY_8,
274+ /* 10 */ KEY_9,
275+ /* 11 */ KEY_0,
276+ /* 12 */ KEY_Minus,
277+ /* 13 */ KEY_Equal,
278+ /* 14 */ KEY_BackSpace,
279+ /* 15 */ KEY_Tab,
280+ /* 16 */ KEY_Q,
281+ /* 17 */ KEY_W,
282+ /* 18 */ KEY_E,
283+ /* 19 */ KEY_R,
284+ /* 20 */ KEY_T,
285+ /* 21 */ KEY_Y,
286+ /* 22 */ KEY_U,
287+ /* 23 */ KEY_I,
288+ /* 24 */ KEY_O,
289+ /* 25 */ KEY_P,
290+ /* 26 */ KEY_LBrace,
291+ /* 27 */ KEY_RBrace,
292+ /* 28 */ KEY_Enter,
293+ /* 29 */ KEY_LCtrl,
294+ /* 30 */ KEY_A,
295+ /* 31 */ KEY_S,
296+ /* 32 */ KEY_D,
297+ /* 33 */ KEY_F,
298+ /* 34 */ KEY_G,
299+ /* 35 */ KEY_H,
300+ /* 36 */ KEY_J,
301+ /* 37 */ KEY_K,
302+ /* 38 */ KEY_L,
303+ /* 39 */ KEY_SemiColon,
304+ /* 40 */ KEY_Quote,
305+ /* 41 */ KEY_Tilde,
306+ /* 42 */ KEY_ShiftL,
307+ /* 43 */ KEY_BSlash,
308+ /* 44 */ KEY_Z,
309+ /* 45 */ KEY_X,
310+ /* 46 */ KEY_C,
311+ /* 47 */ KEY_V,
312+ /* 48 */ KEY_B,
313+ /* 49 */ KEY_N,
314+ /* 50 */ KEY_M,
315+ /* 51 */ KEY_Comma,
316+ /* 52 */ KEY_Period,
317+ /* 53 */ KEY_Slash,
318+ /* 54 */ KEY_ShiftR,
319+ /* 55 */ KEY_KP_Multiply,
320+ /* 56 */ KEY_Alt,
321+ /* 57 */ KEY_Space,
322+ /* 58 */ KEY_CapsLock,
323+ /* 59 */ KEY_F1,
324+ /* 60 */ KEY_F2,
325+ /* 61 */ KEY_F3,
326+ /* 62 */ KEY_F4,
327+ /* 63 */ KEY_F5,
328+ /* 64 */ KEY_F6,
329+ /* 65 */ KEY_F7,
330+ /* 66 */ KEY_F8,
331+ /* 67 */ KEY_F9,
332+ /* 68 */ KEY_F10,
333+ /* 69 */ KEY_NumLock,
334+ /* 70 */ KEY_ScrollLock,
335+ /* 71 */ KEY_KP_7,
336+ /* 72 */ KEY_KP_8,
337+ /* 73 */ KEY_KP_9,
338+ /* 74 */ KEY_KP_Minus,
339+ /* 75 */ KEY_KP_4,
340+ /* 76 */ KEY_KP_5,
341+ /* 77 */ KEY_KP_6,
342+ /* 78 */ KEY_KP_Plus,
343+ /* 79 */ KEY_KP_1,
344+ /* 80 */ KEY_KP_2,
345+ /* 81 */ KEY_KP_3,
346+ /* 82 */ KEY_KP_0,
347+ /* 83 */ KEY_KP_Decimal,
348+ /* 84 */ KEY_NOTUSED,
349+ /* 85 */ KEY_NOTUSED,
350+ /* 86 */ KEY_Less, /* backslash on uk, < on german */
351+ /* 87 */ KEY_F11,
352+ /* 88 */ KEY_F12,
353+ /* 89 */ KEY_NOTUSED,
354+ /* 90 */ KEY_NOTUSED,
355+ /* 91 */ KEY_NOTUSED,
356+ /* 92 */ KEY_NOTUSED,
357+ /* 93 */ KEY_NOTUSED,
358+ /* 94 */ KEY_NOTUSED,
359+ /* 95 */ KEY_NOTUSED,
360+ /* 96 */ KEY_NOTUSED,
361+ /* 97 */ KEY_NOTUSED,
362+ /* 98 */ KEY_NOTUSED,
363+ /* 99 */ KEY_NOTUSED,
364+ /* 100 */ KEY_NOTUSED,
365+ /* 101 */ KEY_NOTUSED,
366+ /* 102 */ KEY_NOTUSED,
367+ /* 103 */ KEY_NOTUSED,
368+ /* 104 */ KEY_NOTUSED,
369+ /* 105 */ KEY_NOTUSED,
370+ /* 106 */ KEY_NOTUSED,
371+ /* 107 */ KEY_NOTUSED,
372+ /* 108 */ KEY_NOTUSED,
373+ /* 109 */ KEY_NOTUSED,
374+ /* 110 */ KEY_NOTUSED,
375+ /* 111 */ KEY_NOTUSED,
376+ /* 112 */ KEY_NOTUSED,
377+ /* 113 */ KEY_NOTUSED,
378+ /* 114 */ KEY_NOTUSED,
379+ /* 115 */ KEY_NOTUSED,
380+ /* 116 */ KEY_NOTUSED,
381+ /* 117 */ KEY_NOTUSED,
382+ /* 118 */ KEY_NOTUSED,
383+ /* 119 */ KEY_NOTUSED,
384+ /* 120 */ KEY_NOTUSED,
385+ /* 121 */ KEY_NOTUSED,
386+ /* 122 */ KEY_NOTUSED,
387+ /* 123 */ KEY_NOTUSED,
388+ /* 124 */ KEY_NOTUSED,
389+ /* 125 */ KEY_NOTUSED,
390+ /* 126 */ KEY_NOTUSED,
391+ /* 127 */ KEY_Pause,
392+ /* 128 */ KEY_NOTUSED,
393+ /* 129 */ KEY_NOTUSED,
394+ /* 130 */ KEY_NOTUSED,
395+ /* 131 */ KEY_NOTUSED,
396+ /* 132 */ KEY_NOTUSED,
397+ /* 133 */ KEY_NOTUSED,
398+ /* 134 */ KEY_NOTUSED,
399+ /* 135 */ KEY_NOTUSED,
400+ /* 136 */ KEY_NOTUSED,
401+ /* 137 */ KEY_NOTUSED,
402+ /* 138 */ KEY_NOTUSED,
403+ /* 139 */ KEY_NOTUSED,
404+ /* 140 */ KEY_NOTUSED,
405+ /* 141 */ KEY_NOTUSED,
406+ /* 142 */ KEY_NOTUSED,
407+ /* 143 */ KEY_NOTUSED,
408+ /* 144 */ KEY_NOTUSED,
409+ /* 145 */ KEY_NOTUSED,
410+ /* 146 */ KEY_NOTUSED,
411+ /* 147 */ KEY_NOTUSED,
412+ /* 148 */ KEY_NOTUSED,
413+ /* 149 */ KEY_NOTUSED,
414+ /* 150 */ KEY_NOTUSED,
415+ /* 151 */ KEY_NOTUSED,
416+ /* 152 */ KEY_NOTUSED,
417+ /* 153 */ KEY_NOTUSED,
418+ /* 154 */ KEY_NOTUSED,
419+ /* 155 */ KEY_NOTUSED,
420+ /* 156 */ KEY_KP_Enter,
421+ /* 157 */ KEY_RCtrl,
422+ /* 158 */ KEY_NOTUSED,
423+ /* 159 */ KEY_NOTUSED,
424+ /* 160 */ KEY_Mute,
425+ /* 161 */ KEY_NOTUSED,
426+ /* 162 */ KEY_NOTUSED,
427+ /* 163 */ KEY_NOTUSED,
428+ /* 164 */ KEY_NOTUSED,
429+ /* 165 */ KEY_NOTUSED,
430+ /* 166 */ KEY_NOTUSED,
431+ /* 167 */ KEY_NOTUSED,
432+ /* 168 */ KEY_NOTUSED,
433+ /* 169 */ KEY_NOTUSED,
434+ /* 170 */ KEY_Print,
435+ /* 171 */ KEY_NOTUSED,
436+ /* 172 */ KEY_NOTUSED,
437+ /* 173 */ KEY_NOTUSED,
438+ /* 174 */ KEY_AudioLower,
439+ /* 175 */ KEY_AudioRaise,
440+ /* 176 */ KEY_NOTUSED,
441+ /* 177 */ KEY_NOTUSED,
442+ /* 178 */ KEY_NOTUSED,
443+ /* 179 */ KEY_NOTUSED,
444+ /* 180 */ KEY_NOTUSED,
445+ /* 181 */ KEY_KP_Divide,
446+ /* 182 */ KEY_NOTUSED,
447+ /* 183 */ KEY_Print,
448+ /* 184 */ KEY_AltLang,
449+ /* 185 */ KEY_NOTUSED,
450+ /* 186 */ KEY_NOTUSED,
451+ /* 187 */ KEY_NOTUSED,
452+ /* 188 */ KEY_NOTUSED,
453+ /* 189 */ KEY_NOTUSED,
454+ /* 190 */ KEY_NOTUSED,
455+ /* 191 */ KEY_NOTUSED,
456+ /* 192 */ KEY_NOTUSED,
457+ /* 193 */ KEY_NOTUSED,
458+ /* 194 */ KEY_NOTUSED,
459+ /* 195 */ KEY_NOTUSED,
460+ /* 196 */ KEY_NOTUSED,
461+ /* 197 */ KEY_NOTUSED,
462+ /* 198 */ KEY_NOTUSED,
463+ /* 199 */ KEY_Home,
464+ /* 200 */ KEY_Up,
465+ /* 201 */ KEY_PgUp,
466+ /* 202 */ KEY_NOTUSED,
467+ /* 203 */ KEY_Left,
468+ /* 204 */ KEY_NOTUSED,
469+ /* 205 */ KEY_Right,
470+ /* 206 */ KEY_NOTUSED,
471+ /* 207 */ KEY_End,
472+ /* 208 */ KEY_Down,
473+ /* 209 */ KEY_PgDown,
474+ /* 210 */ KEY_Insert,
475+ /* 211 */ KEY_Delete,
476+ /* 212 */ KEY_NOTUSED,
477+ /* 213 */ KEY_NOTUSED,
478+ /* 214 */ KEY_NOTUSED,
479+ /* 215 */ KEY_NOTUSED,
480+ /* 216 */ KEY_NOTUSED,
481+ /* 217 */ KEY_NOTUSED,
482+ /* 218 */ KEY_NOTUSED,
483+ /* 219 */ KEY_LMeta,
484+ /* 220 */ KEY_RMeta,
485+ /* 221 */ KEY_Menu,
486+};