Fix keycodes

This commit is contained in:
Scott Anderson 2017-09-28 20:47:11 +13:00
parent 9ca5b0cae8
commit 38bc0ab1cc
1 changed files with 4 additions and 2 deletions

View File

@ -45,7 +45,7 @@ int x11_event(int fd, uint32_t mask, void *data) {
struct wlr_event_keyboard_key key = { struct wlr_event_keyboard_key key = {
.time_sec = ts.tv_sec, .time_sec = ts.tv_sec,
.time_usec = ts.tv_nsec / 1000, .time_usec = ts.tv_nsec / 1000,
.keycode = press->detail, .keycode = press->detail - 8,
.state = WLR_KEY_PRESSED, .state = WLR_KEY_PRESSED,
}; };
@ -57,7 +57,7 @@ int x11_event(int fd, uint32_t mask, void *data) {
struct wlr_event_keyboard_key key = { struct wlr_event_keyboard_key key = {
.time_sec = ts.tv_sec, .time_sec = ts.tv_sec,
.time_usec = ts.tv_nsec / 1000, .time_usec = ts.tv_nsec / 1000,
.keycode = press->detail, .keycode = press->detail - 8,
.state = WLR_KEY_RELEASED, .state = WLR_KEY_RELEASED,
}; };
@ -94,6 +94,8 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
goto error_x11; goto error_x11;
} }
XSetEventQueueOwner(x11->xlib_conn, XCBOwnsEventQueue);
int fd = xcb_get_file_descriptor(x11->xcb_conn); int fd = xcb_get_file_descriptor(x11->xcb_conn);
struct wl_event_loop *ev = wl_display_get_event_loop(display); struct wl_event_loop *ev = wl_display_get_event_loop(display);
x11->event_source = wl_event_loop_add_fd(ev, fd, WL_EVENT_READABLE, x11_event, x11); x11->event_source = wl_event_loop_add_fd(ev, fd, WL_EVENT_READABLE, x11_event, x11);