forked from enlightenment/enlightenment
xkbswitch: change icon if E_EVENT_XKB_CHANGED is emitted
This commit is contained in:
parent
bd7136ade1
commit
1c7cd941d0
|
@ -44,6 +44,8 @@ static Eina_List *instances = NULL;
|
||||||
/* CONFIG STRUCTURE */
|
/* CONFIG STRUCTURE */
|
||||||
Xkb _xkb = { NULL, NULL, NULL };
|
Xkb _xkb = { NULL, NULL, NULL };
|
||||||
|
|
||||||
|
static Ecore_Event_Handler *xkb_change_handle = NULL;
|
||||||
|
|
||||||
static const E_Gadcon_Client_Class _gc_class =
|
static const E_Gadcon_Client_Class _gc_class =
|
||||||
{
|
{
|
||||||
GADCON_CLIENT_CLASS_VERSION,
|
GADCON_CLIENT_CLASS_VERSION,
|
||||||
|
@ -75,12 +77,8 @@ e_modapi_init(E_Module *m)
|
||||||
"preferences-desktop-keyboard",
|
"preferences-desktop-keyboard",
|
||||||
_xkb_cfg_dialog);
|
_xkb_cfg_dialog);
|
||||||
|
|
||||||
|
|
||||||
_xkb.module = m;
|
_xkb.module = m;
|
||||||
#ifndef HAVE_WAYLAND_ONLY
|
xkb_change_handle = ecore_event_handler_add(E_EVENT_XKB_CHANGED, _xkb_changed_state, NULL);
|
||||||
if (e_comp_util_has_x())
|
|
||||||
ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, _xkb_changed_state, NULL);
|
|
||||||
#endif
|
|
||||||
/* Gadcon */
|
/* Gadcon */
|
||||||
e_gadcon_provider_register(&_gc_class);
|
e_gadcon_provider_register(&_gc_class);
|
||||||
return m;
|
return m;
|
||||||
|
@ -100,6 +98,7 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
||||||
if (_xkb.cfd) e_object_del(E_OBJECT(_xkb.cfd));
|
if (_xkb.cfd) e_object_del(E_OBJECT(_xkb.cfd));
|
||||||
_xkb.cfd = NULL;
|
_xkb.cfd = NULL;
|
||||||
_xkb.module = NULL;
|
_xkb.module = NULL;
|
||||||
|
ecore_event_handler_del(xkb_change_handle);
|
||||||
e_gadcon_provider_unregister(&_gc_class);
|
e_gadcon_provider_unregister(&_gc_class);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -279,18 +278,12 @@ _gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas)
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_WAYLAND_ONLY
|
|
||||||
static Eina_Bool
|
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;
|
_xkb_update_icon(e_config->xkb.cur_group);
|
||||||
|
|
||||||
//INF("xkb group %d", ev->group);
|
|
||||||
e_config->xkb.cur_group = ev->group;
|
|
||||||
_xkb_update_icon(ev->group);
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue