mirror of
https://github.com/swaywm/sway.git
synced 2026-04-20 06:47:03 -04:00
Add null-safety check for virtual keyboard keymaps
Note that in the `sway_keyboard_configure` function of sway/input/keyboard.c, we have skipped the `sway_keyboard_set_layout` function for virtual keyboards, which then have null keymaps. Hence, a null-safety check is needed at runtime.
This commit is contained in:
parent
951a22c244
commit
f344e9d5a5
2 changed files with 12 additions and 2 deletions
|
|
@ -95,10 +95,18 @@ struct cmd_results *input_cmd_xkb_switch_layout(int argc, char **argv) {
|
|||
continue;
|
||||
}
|
||||
|
||||
struct wlr_keyboard *keyboard =
|
||||
wlr_keyboard_from_input_device(dev->wlr_device);
|
||||
if (keyboard->keymap == NULL && dev->is_virtual) {
|
||||
// The `sway_keyboard_set_layout` function is by default skipped
|
||||
// when configuring virtual keyboards.
|
||||
continue;
|
||||
}
|
||||
|
||||
struct xkb_switch_layout_action *action =
|
||||
&actions[actions_len++];
|
||||
action->keyboard = keyboard;
|
||||
|
||||
action->keyboard = wlr_keyboard_from_input_device(dev->wlr_device);
|
||||
if (relative) {
|
||||
action->layout = get_layout_relative(action->keyboard, relative);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue