mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
Handle setting keymap in examples more securely
This commit is contained in:
parent
7bc2657984
commit
7105864e13
7 changed files with 58 additions and 16 deletions
|
@ -239,8 +239,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
if (!keymap) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to create XKB keymap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||||
|
xkb_keymap_unref(keymap);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
case WLR_INPUT_DEVICE_POINTER:;
|
case WLR_INPUT_DEVICE_POINTER:;
|
||||||
|
|
|
@ -239,8 +239,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
if (!keymap) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to create XKB keymap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||||
|
xkb_keymap_unref(keymap);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -304,8 +304,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
if (!keymap) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to create XKB keymap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||||
|
xkb_keymap_unref(keymap);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -188,8 +188,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
if (!keymap) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to create XKB keymap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||||
|
xkb_keymap_unref(keymap);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -141,8 +141,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
if (!keymap) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to create XKB keymap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||||
|
xkb_keymap_unref(keymap);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -297,8 +297,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
if (!keymap) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to create XKB keymap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||||
|
xkb_keymap_unref(keymap);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
case WLR_INPUT_DEVICE_TABLET_PAD:;
|
case WLR_INPUT_DEVICE_TABLET_PAD:;
|
||||||
|
|
|
@ -210,8 +210,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
wlr_log(WLR_ERROR, "Failed to create XKB context");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
|
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||||
|
if (!keymap) {
|
||||||
|
wlr_log(WLR_ERROR, "Failed to create XKB keymap");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||||
|
xkb_keymap_unref(keymap);
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
break;
|
break;
|
||||||
case WLR_INPUT_DEVICE_TOUCH:;
|
case WLR_INPUT_DEVICE_TOUCH:;
|
||||||
|
|
Loading…
Reference in a new issue