mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
Use common function for keyboard init and reconfig
This commit is contained in:
parent
4b617b1e8c
commit
6b49f87ae5
5 changed files with 11 additions and 26 deletions
|
|
@ -9,8 +9,7 @@ struct seat;
|
|||
struct keyboard;
|
||||
struct wlr_keyboard;
|
||||
|
||||
void keyboard_init(struct seat *seat);
|
||||
void keyboard_reload(struct seat *seat);
|
||||
void keyboard_init(struct seat *seat, bool reconfig);
|
||||
void keyboard_finish(struct seat *seat);
|
||||
|
||||
void keyboard_setup_handlers(struct keyboard *keyboard);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ void
|
|||
input_handlers_init(struct seat *seat)
|
||||
{
|
||||
cursor_init(seat);
|
||||
keyboard_init(seat);
|
||||
keyboard_init(seat, false);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -593,10 +593,15 @@ keyboard_update_layout(struct seat *seat, xkb_layout_index_t layout)
|
|||
}
|
||||
|
||||
void
|
||||
keyboard_init(struct seat *seat)
|
||||
keyboard_init(struct seat *seat, bool reconfig)
|
||||
{
|
||||
seat->keyboard_group = wlr_keyboard_group_create();
|
||||
struct wlr_keyboard *kb = &seat->keyboard_group->keyboard;
|
||||
struct wlr_keyboard *kb;
|
||||
if (reconfig) {
|
||||
kb = wlr_seat_get_keyboard(seat->seat);
|
||||
} else {
|
||||
seat->keyboard_group = wlr_keyboard_group_create();
|
||||
kb = &seat->keyboard_group->keyboard;
|
||||
}
|
||||
struct xkb_rule_names rules = { 0 };
|
||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||
|
|
@ -613,24 +618,6 @@ keyboard_init(struct seat *seat)
|
|||
keybind_update_keycodes(seat->server);
|
||||
}
|
||||
|
||||
void
|
||||
keyboard_reload(struct seat *seat)
|
||||
{
|
||||
struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat->seat);
|
||||
struct xkb_rule_names rules = { 0 };
|
||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
||||
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
if (keymap) {
|
||||
wlr_keyboard_set_keymap(kb, keymap);
|
||||
xkb_keymap_unref(keymap);
|
||||
} else {
|
||||
wlr_log(WLR_ERROR, "Failed to create xkb keymap");
|
||||
}
|
||||
xkb_context_unref(context);
|
||||
wlr_keyboard_set_repeat_info(kb, rc.repeat_rate, rc.repeat_delay);
|
||||
}
|
||||
|
||||
void
|
||||
keyboard_setup_handlers(struct keyboard *keyboard)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ seat_reconfigure(struct server *server)
|
|||
break;
|
||||
}
|
||||
}
|
||||
keyboard_reload(seat);
|
||||
keyboard_init(seat, true);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ reload_config_and_theme(void)
|
|||
regions_reconfigure(g_server);
|
||||
resize_indicator_reconfigure(g_server);
|
||||
kde_server_decoration_update_default();
|
||||
keybind_update_keycodes(g_server);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue