uterm: input: allow passing "model" for keyboard descs
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 27 Oct 2012 16:55:21 +0000 (18:55 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 27 Oct 2012 16:55:21 +0000 (18:55 +0200)
We set the model to a system-default, which means, we are hosed if the
system-default is not what the user expects. Therefore, allow setting the
model via internal APIs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/kmscon_seat.c
src/uterm.h
src/uterm_input.c
src/uterm_input.h
src/uterm_input_uxkb.c

index d712249..229cf97 100644 (file)
@@ -409,6 +409,7 @@ int kmscon_seat_new(struct kmscon_seat **out,
        }
 
        ret = uterm_input_new(&seat->input, seat->eloop,
+                             "",
                              seat->conf->xkb_layout,
                              seat->conf->xkb_variant,
                              seat->conf->xkb_options,
index 5d11cd3..6e284ef 100644 (file)
@@ -309,6 +309,7 @@ typedef void (*uterm_input_cb) (struct uterm_input *input,
                                void *data);
 
 int uterm_input_new(struct uterm_input **out, struct ev_eloop *eloop,
+                   const char *model,
                    const char *layout,
                    const char *variant,
                    const char *options,
index 0dbbe70..6581ed5 100644 (file)
@@ -217,6 +217,7 @@ static void input_free_dev(struct uterm_input_dev *dev)
 
 int uterm_input_new(struct uterm_input **out,
                    struct ev_eloop *eloop,
+                   const char *model,
                    const char *layout,
                    const char *variant,
                    const char *options,
@@ -252,7 +253,7 @@ int uterm_input_new(struct uterm_input **out,
        if (ret)
                goto err_free;
 
-       ret = uxkb_desc_init(input, layout, variant, options);
+       ret = uxkb_desc_init(input, model, layout, variant, options);
        if (ret)
                goto err_hook;
 
index e06e6a0..bd04302 100644 (file)
@@ -80,6 +80,7 @@ static inline bool input_bit_is_set(const unsigned long *array, int bit)
 }
 
 int uxkb_desc_init(struct uterm_input *input,
+                  const char *model,
                   const char *layout,
                   const char *variant,
                   const char *options);
index 969072d..1bf48ac 100644 (file)
@@ -41,6 +41,7 @@
 #define LOG_SUBSYSTEM "input_uxkb"
 
 int uxkb_desc_init(struct uterm_input *input,
+                  const char *model,
                   const char *layout,
                   const char *variant,
                   const char *options)
@@ -48,7 +49,7 @@ int uxkb_desc_init(struct uterm_input *input,
        int ret;
        struct xkb_rule_names rmlvo = {
                .rules = "evdev",
-               .model = "",
+               .model = model,
                .layout = layout,
                .variant = variant,
                .options = options,
@@ -62,10 +63,11 @@ int uxkb_desc_init(struct uterm_input *input,
 
        input->keymap = xkb_keymap_new_from_names(input->ctx, &rmlvo, 0);
        if (!input->keymap) {
-               log_warn("failed to create keymap (%s, %s, %s), "
+               log_warn("failed to create keymap (%s, %s, %s, %s), "
                         "reverting to default system keymap",
-                        layout, variant, options);
+                        model, layout, variant, options);
 
+               rmlvo.model = "";
                rmlvo.layout = "";
                rmlvo.variant = "";
                rmlvo.options = "";
@@ -79,8 +81,8 @@ int uxkb_desc_init(struct uterm_input *input,
                }
        }
 
-       log_debug("new keyboard description (%s, %s, %s)",
-                 layout, variant, options);
+       log_debug("new keyboard description (%s, %s, %s, %s)",
+                 model, layout, variant, options);
        return 0;
 
 err_ctx: