aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Pospelov <kupospelov@gmail.com>2019-03-05 22:38:26 +0300
committerSimon Ser <contact@emersion.fr>2019-04-26 20:56:48 +0300
commitc42497aca00a234679ca5dc2884ab40afe0d84ad (patch)
treeee0b1521537cd97c943f894a29efa5e4c12bb1e3
parentddf63ffabefd740bf2afa1addaf6e859d65aba6a (diff)
bindsym: change xkb_rule_names initialization
-rw-r--r--include/sway/config.h3
-rw-r--r--sway/config.c5
-rw-r--r--sway/config/input.c17
-rw-r--r--sway/input/keyboard.c6
4 files changed, 14 insertions, 17 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index a0a98fb6..01c99cb4 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -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 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);
diff --git a/sway/config.c b/sway/config.c
index fed01eb4..d4a4a2f7 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -337,7 +337,7 @@ static void config_defaults(struct sway_config *config) {
if (!(config->ipc_policies = create_list())) goto cleanup;
// The keysym to keycode translation
- struct xkb_rule_names rules = {};
+ struct xkb_rule_names rules = {0};
config->keysym_translation_state =
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) {
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 =
keysym_translation_state_create(rules);
diff --git a/sway/config/input.c b/sway/config/input.c
index 595aa029..9c533e71 100644
--- a/sway/config/input.c
+++ b/sway/config/input.c
@@ -212,16 +212,13 @@ struct input_config *store_input_config(struct input_config *ic) {
return ic;
}
-struct xkb_rule_names input_config_get_rule_names(struct input_config *ic) {
- struct xkb_rule_names rules = {
- .layout = ic->xkb_layout,
- .model = ic->xkb_model,
- .options = ic->xkb_options,
- .rules = ic->xkb_rules,
- .variant = ic->xkb_variant,
- };
-
- return rules;
+void input_config_fill_rule_names(struct input_config *ic,
+ struct xkb_rule_names *rules) {
+ rules->layout = ic->xkb_layout;
+ rules->model = ic->xkb_model;
+ rules->options = ic->xkb_options;
+ rules->rules = ic->xkb_rules;
+ rules->variant = ic->xkb_variant;
}
void free_input_config(struct input_config *ic) {
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index 04b8b0ce..396cc865 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -482,11 +482,9 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
struct wlr_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) {
- rules = input_config_get_rule_names(input_config);
- } else {
- memset(&rules, 0, sizeof(rules));
+ input_config_fill_rule_names(input_config, &rules);
}
if (!rules.layout) {