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 keyboard;
|
||||||
struct wlr_keyboard;
|
struct wlr_keyboard;
|
||||||
|
|
||||||
void keyboard_init(struct seat *seat);
|
void keyboard_init(struct seat *seat, bool reconfig);
|
||||||
void keyboard_reload(struct seat *seat);
|
|
||||||
void keyboard_finish(struct seat *seat);
|
void keyboard_finish(struct seat *seat);
|
||||||
|
|
||||||
void keyboard_setup_handlers(struct keyboard *keyboard);
|
void keyboard_setup_handlers(struct keyboard *keyboard);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ void
|
||||||
input_handlers_init(struct seat *seat)
|
input_handlers_init(struct seat *seat)
|
||||||
{
|
{
|
||||||
cursor_init(seat);
|
cursor_init(seat);
|
||||||
keyboard_init(seat);
|
keyboard_init(seat, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -593,10 +593,15 @@ keyboard_update_layout(struct seat *seat, xkb_layout_index_t layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
keyboard_init(struct seat *seat)
|
keyboard_init(struct seat *seat, bool reconfig)
|
||||||
{
|
{
|
||||||
seat->keyboard_group = wlr_keyboard_group_create();
|
struct wlr_keyboard *kb;
|
||||||
struct wlr_keyboard *kb = &seat->keyboard_group->keyboard;
|
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_rule_names rules = { 0 };
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
|
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);
|
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
|
void
|
||||||
keyboard_setup_handlers(struct keyboard *keyboard)
|
keyboard_setup_handlers(struct keyboard *keyboard)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -537,7 +537,7 @@ seat_reconfigure(struct server *server)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard_reload(seat);
|
keyboard_init(seat, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@ reload_config_and_theme(void)
|
||||||
regions_reconfigure(g_server);
|
regions_reconfigure(g_server);
|
||||||
resize_indicator_reconfigure(g_server);
|
resize_indicator_reconfigure(g_server);
|
||||||
kde_server_decoration_update_default();
|
kde_server_decoration_update_default();
|
||||||
keybind_update_keycodes(g_server);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue