forked from enlightenment/enlightenment
stringshare and action cleanups for winlist, should no longer call strcmp 500 times per activation
SVN revision: 75602
This commit is contained in:
parent
80e60a5fe3
commit
1ca3270f1d
|
@ -9,7 +9,8 @@ static void _e_mod_action_winlist_key_cb(E_Object *obj, const char *params,
|
|||
Ecore_Event_Key *ev);
|
||||
|
||||
static E_Module *conf_module = NULL;
|
||||
static E_Action *act = NULL;
|
||||
const char *_winlist_act = NULL;
|
||||
E_Action *_act_winlist = NULL;
|
||||
|
||||
/* module setup */
|
||||
EAPI E_Module_Api e_modapi =
|
||||
|
@ -25,13 +26,14 @@ e_modapi_init(E_Module *m)
|
|||
e_configure_registry_category_add("windows", 50, _("Windows"), NULL, "preferences-system-windows");
|
||||
e_configure_registry_item_add("windows/window_list", 70, _("Window Switcher"), NULL, "preferences-winlist", e_int_config_winlist);
|
||||
e_winlist_init();
|
||||
_winlist_act = eina_stringshare_add("winlist");
|
||||
/* add module supplied action */
|
||||
act = e_action_add("winlist");
|
||||
if (act)
|
||||
_act_winlist = e_action_add(_winlist_act);
|
||||
if (_act_winlist)
|
||||
{
|
||||
act->func.go = _e_mod_action_winlist_cb;
|
||||
act->func.go_mouse = _e_mod_action_winlist_mouse_cb;
|
||||
act->func.go_key = _e_mod_action_winlist_key_cb;
|
||||
_act_winlist->func.go = _e_mod_action_winlist_cb;
|
||||
_act_winlist->func.go_mouse = _e_mod_action_winlist_mouse_cb;
|
||||
_act_winlist->func.go_key = _e_mod_action_winlist_key_cb;
|
||||
e_action_predef_name_set(_("Window : List"), _("Next Window"),
|
||||
"winlist", "next", NULL, 0);
|
||||
e_action_predef_name_set(_("Window : List"), _("Previous Window"),
|
||||
|
@ -67,7 +69,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
E_Config_Dialog *cfd;
|
||||
|
||||
/* remove module-supplied action */
|
||||
if (act)
|
||||
if (_act_winlist)
|
||||
{
|
||||
e_action_predef_name_del(_("Window : List"), _("Previous Window"));
|
||||
e_action_predef_name_del(_("Window : List"), _("Next Window"));
|
||||
|
@ -80,7 +82,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
e_action_predef_name_del(_("Window : List"), _("Window Up"));
|
||||
e_action_predef_name_del(_("Window : List"), _("Window on the Right"));
|
||||
e_action_del("winlist");
|
||||
act = NULL;
|
||||
_act_winlist = NULL;
|
||||
}
|
||||
e_winlist_shutdown();
|
||||
|
||||
|
@ -89,6 +91,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
e_configure_registry_item_del("windows/window_list");
|
||||
e_configure_registry_category_del("windows");
|
||||
conf_module = NULL;
|
||||
eina_stringshare_replace(&_winlist_act, NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "e_winlist.h"
|
||||
#include "e_int_config_winlist.h"
|
||||
|
||||
extern const char *_winlist_act;
|
||||
extern E_Action *_act_winlist;
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
||||
EAPI void *e_modapi_init (E_Module *m);
|
||||
|
|
|
@ -76,7 +76,7 @@ _wmclass_picked(const Eina_List *lst, const char *wmclass)
|
|||
if (!wmclass) return EINA_FALSE;
|
||||
|
||||
EINA_LIST_FOREACH(lst, l, s)
|
||||
if ((s) && (!strcmp(s, wmclass)))
|
||||
if (s == wmclass)
|
||||
return EINA_TRUE;
|
||||
|
||||
return EINA_FALSE;
|
||||
|
@ -183,8 +183,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
|
|||
if (!_last_border)
|
||||
pick = EINA_FALSE;
|
||||
else
|
||||
pick = !strcmp(_last_border->client.icccm.class,
|
||||
bd->client.icccm.class);
|
||||
pick = _last_border->client.icccm.class == bd->client.icccm.class;
|
||||
break;
|
||||
case E_WINLIST_FILTER_CLASSES:
|
||||
pick = (!_wmclass_picked(wmclasses, bd->client.icccm.class));
|
||||
|
@ -1319,14 +1318,13 @@ _e_winlist_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
_e_winlist_activate_nth(9);
|
||||
else
|
||||
{
|
||||
E_Action *act;
|
||||
Eina_List *l;
|
||||
E_Config_Binding_Key *binding;
|
||||
E_Binding_Modifier mod;
|
||||
|
||||
EINA_LIST_FOREACH(e_config->key_bindings, l, binding)
|
||||
{
|
||||
if (binding->action && strcmp(binding->action, "winlist")) continue;
|
||||
if (binding->action != _winlist_act) continue;
|
||||
|
||||
mod = 0;
|
||||
|
||||
|
@ -1342,11 +1340,11 @@ _e_winlist_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
if (binding->key && (!strcmp(binding->key, ev->keyname)) &&
|
||||
((binding->modifiers == mod) || (binding->any_mod)))
|
||||
{
|
||||
if (!(act = e_action_find(binding->action))) continue;
|
||||
if (act->func.go_key)
|
||||
act->func.go_key(E_OBJECT(_winlist->zone), binding->params, ev);
|
||||
else if (act->func.go)
|
||||
act->func.go(E_OBJECT(_winlist->zone), binding->params);
|
||||
if (!_act_winlist) continue;
|
||||
if (_act_winlist->func.go_key)
|
||||
_act_winlist->func.go_key(E_OBJECT(_winlist->zone), binding->params, ev);
|
||||
else if (_act_winlist->func.go)
|
||||
_act_winlist->func.go(E_OBJECT(_winlist->zone), binding->params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1357,7 +1355,6 @@ static Eina_Bool
|
|||
_e_winlist_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||
{
|
||||
Ecore_Event_Key *ev;
|
||||
E_Action *act;
|
||||
Eina_List *l;
|
||||
E_Config_Binding_Key *binding;
|
||||
E_Binding_Modifier mod;
|
||||
|
@ -1405,7 +1402,7 @@ _e_winlist_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
|
||||
EINA_LIST_FOREACH(e_config->key_bindings, l, binding)
|
||||
{
|
||||
if (binding->action && strcmp(binding->action, "winlist")) continue;
|
||||
if (binding->action != _winlist_act) continue;
|
||||
mod = 0;
|
||||
|
||||
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
||||
|
@ -1420,11 +1417,11 @@ _e_winlist_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
if (binding->key && (!strcmp(binding->key, ev->keyname)) &&
|
||||
((binding->modifiers == mod) || (binding->any_mod)))
|
||||
{
|
||||
if (!(act = e_action_find(binding->action))) continue;
|
||||
if (act->func.end_key)
|
||||
act->func.end_key(E_OBJECT(_winlist->zone), binding->params, ev);
|
||||
else if (act->func.end)
|
||||
act->func.end(E_OBJECT(_winlist->zone), binding->params);
|
||||
if (!_act_winlist) continue;
|
||||
if (_act_winlist->func.end_key)
|
||||
_act_winlist->func.end_key(E_OBJECT(_winlist->zone), binding->params, ev);
|
||||
else if (_act_winlist->func.end)
|
||||
_act_winlist->func.end(E_OBJECT(_winlist->zone), binding->params);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#ifndef E_WINLIST_H
|
||||
#define E_WINLIST_H
|
||||
|
||||
#include "e_mod_main.h"
|
||||
|
||||
int e_winlist_init(void);
|
||||
int e_winlist_shutdown(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue