Merge branch 'master' into keyboard-fixes

master
Tony Crisci 7 years ago
commit 20327d82cb

@ -354,8 +354,16 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
wlr_log(L_ERROR, "Cannot create XKB context"); wlr_log(L_ERROR, "Cannot create XKB context");
return NULL; return NULL;
} }
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS)); struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
XKB_KEYMAP_COMPILE_NO_FLAGS);
if (keymap == NULL) {
xkb_context_unref(context);
wlr_log(L_ERROR, "Cannot create XKB keymap");
return NULL;
}
wlr_keyboard_set_keymap(device->keyboard, keymap);
xkb_context_unref(context); xkb_context_unref(context);
int repeat_rate = (config->repeat_rate > 0) ? config->repeat_rate : 25; int repeat_rate = (config->repeat_rate > 0) ? config->repeat_rate : 25;

@ -30,11 +30,7 @@ int main(int argc, char **argv) {
assert(server.wl_display = wl_display_create()); assert(server.wl_display = wl_display_create());
assert(server.wl_event_loop = wl_display_get_event_loop(server.wl_display)); assert(server.wl_event_loop = wl_display_get_event_loop(server.wl_display));
//assert(server.backend = wlr_backend_autocreate(server.wl_display)); assert(server.backend = wlr_backend_autocreate(server.wl_display));
assert(server.backend = wlr_headless_backend_create(server.wl_display));
wlr_headless_add_output(server.backend, 1280, 720);
wlr_headless_add_input_device(server.backend, WLR_INPUT_DEVICE_KEYBOARD);
wlr_headless_add_input_device(server.backend, WLR_INPUT_DEVICE_POINTER);
assert(server.renderer = wlr_gles2_renderer_create(server.backend)); assert(server.renderer = wlr_gles2_renderer_create(server.backend));
server.data_device_manager = server.data_device_manager =

@ -1,4 +1,3 @@
#include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -132,13 +131,16 @@ void wlr_keyboard_led_update(struct wlr_keyboard *kb, uint32_t leds) {
void wlr_keyboard_set_keymap(struct wlr_keyboard *kb, void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
struct xkb_keymap *keymap) { struct xkb_keymap *keymap) {
wlr_log(L_DEBUG, "Keymap set");
if (kb->keymap) { if (kb->keymap) {
xkb_keymap_unref(kb->keymap); xkb_keymap_unref(kb->keymap);
} }
kb->keymap = keymap;
xkb_keymap_ref(keymap); xkb_keymap_ref(keymap);
assert(kb->xkb_state = xkb_state_new(kb->keymap)); kb->keymap = keymap;
kb->xkb_state = xkb_state_new(kb->keymap);
if (kb->xkb_state == NULL) {
wlr_log(L_ERROR, "Failed to create XKB state");
return;
}
const char *led_names[WLR_LED_COUNT] = { const char *led_names[WLR_LED_COUNT] = {
XKB_LED_NAME_NUM, XKB_LED_NAME_NUM,

Loading…
Cancel
Save