bindsym: change xkb_rule_names initialization

master
Konstantin Pospelov 6 years ago committed by Simon Ser
parent ddf63ffabe
commit c42497aca0

@ -577,7 +577,8 @@ void merge_input_config(struct input_config *dst, struct input_config *src);
struct input_config *store_input_config(struct input_config *ic); struct input_config *store_input_config(struct input_config *ic);
struct xkb_rule_names input_config_get_rule_names(struct input_config *ic); void input_config_fill_rule_names(struct input_config *ic,
struct xkb_rule_names *rules);
void free_input_config(struct input_config *ic); void free_input_config(struct input_config *ic);

@ -337,7 +337,7 @@ static void config_defaults(struct sway_config *config) {
if (!(config->ipc_policies = create_list())) goto cleanup; if (!(config->ipc_policies = create_list())) goto cleanup;
// The keysym to keycode translation // The keysym to keycode translation
struct xkb_rule_names rules = {}; struct xkb_rule_names rules = {0};
config->keysym_translation_state = config->keysym_translation_state =
keysym_translation_state_create(rules); keysym_translation_state_create(rules);
@ -989,7 +989,8 @@ static void translate_binding_list(list_t *bindings, list_t *bindsyms,
void translate_keysyms(struct input_config *input_config) { void translate_keysyms(struct input_config *input_config) {
keysym_translation_state_destroy(config->keysym_translation_state); keysym_translation_state_destroy(config->keysym_translation_state);
struct xkb_rule_names rules = input_config_get_rule_names(input_config); struct xkb_rule_names rules = {0};
input_config_fill_rule_names(input_config, &rules);
config->keysym_translation_state = config->keysym_translation_state =
keysym_translation_state_create(rules); keysym_translation_state_create(rules);

@ -212,16 +212,13 @@ struct input_config *store_input_config(struct input_config *ic) {
return ic; return ic;
} }
struct xkb_rule_names input_config_get_rule_names(struct input_config *ic) { void input_config_fill_rule_names(struct input_config *ic,
struct xkb_rule_names rules = { struct xkb_rule_names *rules) {
.layout = ic->xkb_layout, rules->layout = ic->xkb_layout;
.model = ic->xkb_model, rules->model = ic->xkb_model;
.options = ic->xkb_options, rules->options = ic->xkb_options;
.rules = ic->xkb_rules, rules->rules = ic->xkb_rules;
.variant = ic->xkb_variant, rules->variant = ic->xkb_variant;
};
return rules;
} }
void free_input_config(struct input_config *ic) { void free_input_config(struct input_config *ic) {

@ -482,11 +482,9 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
struct wlr_input_device *wlr_device = struct wlr_input_device *wlr_device =
keyboard->seat_device->input_device->wlr_device; keyboard->seat_device->input_device->wlr_device;
struct xkb_rule_names rules; struct xkb_rule_names rules = {0};
if (input_config) { if (input_config) {
rules = input_config_get_rule_names(input_config); input_config_fill_rule_names(input_config, &rules);
} else {
memset(&rules, 0, sizeof(rules));
} }
if (!rules.layout) { if (!rules.layout) {

Loading…
Cancel
Save