bu5hm4n pushed a commit to branch master.

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

commit 1c7cd941d09251a8a4582d6e1f2befadd8f8f587
Author: Marcel Hollerbach <marcel-hollerb...@t-online.de>
Date:   Mon Jan 18 21:07:53 2016 +0100

    xkbswitch: change icon if E_EVENT_XKB_CHANGED is emitted
---
 src/modules/xkbswitch/e_mod_main.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/modules/xkbswitch/e_mod_main.c 
b/src/modules/xkbswitch/e_mod_main.c
index 89c1c59..8f7f754 100644
--- a/src/modules/xkbswitch/e_mod_main.c
+++ b/src/modules/xkbswitch/e_mod_main.c
@@ -44,6 +44,8 @@ static Eina_List *instances = NULL;
 /* CONFIG STRUCTURE */
 Xkb _xkb = { NULL, NULL, NULL };
 
+static Ecore_Event_Handler *xkb_change_handle = NULL;
+
 static const E_Gadcon_Client_Class _gc_class =
 {
    GADCON_CLIENT_CLASS_VERSION,
@@ -75,12 +77,8 @@ e_modapi_init(E_Module *m)
                                  "preferences-desktop-keyboard",
                                  _xkb_cfg_dialog);
 
-
    _xkb.module = m;
-#ifndef HAVE_WAYLAND_ONLY
-   if (e_comp_util_has_x())
-     ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, 
_xkb_changed_state, NULL);
-#endif
+   xkb_change_handle = ecore_event_handler_add(E_EVENT_XKB_CHANGED, 
_xkb_changed_state, NULL);
    /* Gadcon */
    e_gadcon_provider_register(&_gc_class);
    return m;
@@ -100,6 +98,7 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
    if (_xkb.cfd) e_object_del(E_OBJECT(_xkb.cfd));
    _xkb.cfd = NULL;
    _xkb.module = NULL;
+   ecore_event_handler_del(xkb_change_handle);
    e_gadcon_provider_unregister(&_gc_class);
 
    return 1;
@@ -279,18 +278,12 @@ _gc_icon(const E_Gadcon_Client_Class *client_class 
EINA_UNUSED, Evas *evas)
    return o;
 }
 
-#ifndef HAVE_WAYLAND_ONLY
 static Eina_Bool
-_xkb_changed_state(void *data EINA_UNUSED, int type EINA_UNUSED, void *event 
EINA_UNUSED)
+_xkb_changed_state(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
-   Ecore_X_Event_Xkb *ev = (Ecore_X_Event_Xkb *)event;
-
-   //INF("xkb group %d", ev->group);
-   e_config->xkb.cur_group = ev->group;
-   _xkb_update_icon(ev->group);
+   _xkb_update_icon(e_config->xkb.cur_group);
    return ECORE_CALLBACK_PASS_ON;
 }
-#endif
 
 #if 0
 static int

-- 


Reply via email to