bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=ab4e4e17cb08f2a2232bbd0ce3a1243e53590045

commit ab4e4e17cb08f2a2232bbd0ce3a1243e53590045
Author: Marcel Hollerbach <marcel-hollerb...@t-online.de>
Date:   Tue Jan 26 00:26:34 2016 +0100

    e_comp_wl: allow variants and options for keyboard settings
    
    Also set options and variants to the rule names struct.
    There is no need to use strdup here the values are just freed in the
    end.
---
 src/bin/e_comp_wl.c             |  2 +-
 src/bin/e_comp_wl_input.c       | 42 +++++++++++++++++++++++------------------
 src/bin/e_comp_wl_input.h       |  2 +-
 src/modules/wl_drm/e_mod_main.c |  2 +-
 src/modules/wl_wl/e_mod_main.c  |  2 +-
 5 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index c2b6cdc..5c2a786 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -2429,7 +2429,7 @@ _e_comp_wl_compositor_create(void)
         if (!layout) layout = strdup("us");
 
         /* update compositor keymap */
-        e_comp_wl_input_keymap_set(rules, model, layout, NULL, NULL);
+        e_comp_wl_input_keymap_set(rules, model, layout, NULL, NULL, NULL, 
NULL);
      }
 #endif
    e_comp_wl->wl.client_disp = ecore_wl2_display_connect(NULL);
diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c
index 3c13a4e..3d12e8d 100644
--- a/src/bin/e_comp_wl_input.c
+++ b/src/bin/e_comp_wl_input.c
@@ -605,7 +605,7 @@ e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled)
 }
 
 E_API void
-e_comp_wl_input_keymap_set(const char *rules, const char *model, const char 
*layout, struct xkb_context *dflt_ctx, struct xkb_keymap *dflt_map)
+e_comp_wl_input_keymap_set(const char *rules, const char *model, const char 
*layout, const char *variant, const char *options, struct xkb_context 
*dflt_ctx, struct xkb_keymap *dflt_map)
 {
    struct xkb_keymap *keymap;
    struct xkb_rule_names names;
@@ -619,18 +619,28 @@ e_comp_wl_input_keymap_set(const char *rules, const char 
*model, const char *lay
    if (!use_dflt_xkb)
      {
         memset(&names, 0, sizeof(names));
-        if (rules) names.rules = strdup(rules);
-        else names.rules = strdup("evdev");
-        if (model) names.model = strdup(model);
-        else names.model = strdup("pc105");
-        if (layout) names.layout = strdup(layout);
-        else names.layout = strdup("us");
+
+        if (rules) names.rules = rules;
+        else names.rules = "evdev";
+
+        if (model) names.model = model;
+        else names.model = "pc105";
+
+        if (layout) names.layout = layout;
+        else names.layout = "us";
+
+        if (variant) names.variant = variant;
+        else names.variant = NULL;
+
+        if (options) names.options = options;
+        else names.options = NULL;
      }
 
    /* unreference any existing context */
    if (e_comp_wl->xkb.context)
      xkb_context_unref(e_comp_wl->xkb.context);
 
+
    /* create a new xkb context */
    if (use_dflt_xkb) e_comp_wl->xkb.context = dflt_ctx;
    else e_comp_wl->xkb.context = xkb_context_new(0);
@@ -643,24 +653,20 @@ e_comp_wl_input_keymap_set(const char *rules, const char 
*model, const char *lay
    /* fetch new keymap based on names */
    if (use_dflt_xkb) keymap = dflt_map;
    else keymap = xkb_map_new_from_names(e_comp_wl->xkb.context, &names, 0);
-   if (keymap)
+
+   if (!keymap)
      {
-        /* update compositor keymap */
-        _e_comp_wl_input_keymap_update(keymap);
+        ERR("Failed to compile keymap");
+        NULL;
      }
 
+   /* update compositor keymap */
+   _e_comp_wl_input_keymap_update(keymap);
+
 #ifdef HAVE_WL_DRM
    if (e_config->xkb.use_cache)
      ecore_drm_device_keyboard_cached_keymap_set(keymap);
 #endif
-
-   /* cleanup */
-   if (!use_dflt_xkb)
-     {
-        free((char *)names.rules);
-        free((char *)names.model);
-        free((char *)names.layout);
-     }
 }
 
 E_API void
diff --git a/src/bin/e_comp_wl_input.h b/src/bin/e_comp_wl_input.h
index 9691b97..e6df151 100644
--- a/src/bin/e_comp_wl_input.h
+++ b/src/bin/e_comp_wl_input.h
@@ -29,7 +29,7 @@ E_API void e_comp_wl_input_pointer_enabled_set(Eina_Bool 
enabled);
 E_API void e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled);
 E_API void e_comp_wl_input_touch_enabled_set(Eina_Bool enabled);
 
-E_API void e_comp_wl_input_keymap_set(const char *rules, const char *model, 
const char *layout,
+E_API void e_comp_wl_input_keymap_set(const char *rules, const char *model, 
const char *layout, const char *variant, const char *options,
                                       struct xkb_context *dflt_ctx, struct 
xkb_keymap *dflt_map);
 
 E_API void e_comp_wl_input_keyboard_event_generate(const char *key, int mods, 
Eina_Bool up);
diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c
index 9a54132..00e1a86 100644
--- a/src/modules/wl_drm/e_mod_main.c
+++ b/src/modules/wl_drm/e_mod_main.c
@@ -790,7 +790,7 @@ e_modapi_init(E_Module *m)
 
    /* FIXME: This is just for testing at the moment....
     * happens to jive with what drm does */
-   e_comp_wl_input_keymap_set(NULL, NULL, NULL, ctx, map);
+   e_comp_wl_input_keymap_set(NULL, NULL, NULL, NULL, NULL, ctx, map);
 
    activate_handler =
       ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE,
diff --git a/src/modules/wl_wl/e_mod_main.c b/src/modules/wl_wl/e_mod_main.c
index 8313f27..6040aa9 100644
--- a/src/modules/wl_wl/e_mod_main.c
+++ b/src/modules/wl_wl/e_mod_main.c
@@ -72,7 +72,7 @@ e_modapi_init(E_Module *m)
    e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE);
    e_comp->pointer->color = EINA_TRUE;
 
-   e_comp_wl_input_keymap_set(NULL, NULL, NULL, NULL, NULL);
+   e_comp_wl_input_keymap_set(NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 
    ecore_evas_pointer_xy_get(e_comp->ee, &e_comp_wl->ptr.x,
                              &e_comp_wl->ptr.y);

-- 


Reply via email to