A slightly updated version that avoid the redundant call to
XKeysymToString - Awesome to be able to use terminology again btw :D

On Thu, Dec 15, 2016 at 4:40 AM, hannes.janet...@gmail.com
<hannes.janet...@googlemail.com> wrote:
> Hi,
> this change makes my keyboard mapping work with EFL again. Not sure if
> it's the correct fix but otherwise
> the second call to XKeysymToString is probably redundant in many cases.
>
>
> Best,
> Hannes



-- 
Hannes
From b909457ef466906f2609099299a0bf845618c51e Mon Sep 17 00:00:00 2001
From: Hannes Janetzek <hannes.janet...@gmail.com>
Date: Thu, 15 Dec 2016 05:18:39 +0100
Subject: fix Mode_switch key mapping

- remove redundant XKeysymToString when sym == sym2

diff --git a/src/lib/ecore_x/ecore_x_events.c b/src/lib/ecore_x/ecore_x_events.c
index 0049fca..16acfdc 100644
--- a/src/lib/ecore_x/ecore_x_events.c
+++ b/src/lib/ecore_x/ecore_x_events.c
@@ -344,7 +344,7 @@ _ecore_key_press(int event,
    char *compose = NULL;
    char *tmp = NULL;
    char *keyname;
-   char *key;
+   char *key = NULL;
    char keyname_buffer[256];
    char compose_buffer[256];
    KeySym sym, sym2 = 0;
@@ -372,6 +372,12 @@ _ecore_key_press(int event,
                        sizeof(compose_buffer),
                        &sym2,
                        &status);
+
+   if (sym != sym2)
+     key = XKeysymToString(sym2);
+   if (!key)
+     key = keyname;
+
    if (val > 0)
      {
         compose_buffer[val] = 0;
@@ -381,13 +387,10 @@ _ecore_key_press(int event,
           ERR("Ecore_X cannot convert input key string '%s' to UTF-8. "
               "Is Eina built with iconv support?", compose_buffer);
         tmp = compose;
+
         sym = sym2;
      }
 
-   key = XKeysymToString(sym);
-   if (!key)
-     key = keyname;
-
    key_len = strlen(key);
    keyname_len = strlen(keyname);
    compose_len = (compose) ? strlen(compose) : 0;
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to