forked from enlightenment/enlightenment
e17/ervy: cleanup windows plugin, fix fallback border icon
SVN revision: 62613
This commit is contained in:
parent
b44ac37ec8
commit
aa47d61abc
|
@ -246,6 +246,10 @@ struct _Evry_Event_Action_Performed
|
||||||
#define EVRY_PLUGIN_ITEM_APPEND(_p, _item) \
|
#define EVRY_PLUGIN_ITEM_APPEND(_p, _item) \
|
||||||
EVRY_PLUGIN(_p)->items = eina_list_append(EVRY_PLUGIN(_p)->items, EVRY_ITEM(_item))
|
EVRY_PLUGIN(_p)->items = eina_list_append(EVRY_PLUGIN(_p)->items, EVRY_ITEM(_item))
|
||||||
|
|
||||||
|
#define EVRY_PLUGIN_MIN_QUERY(_p, _input) \
|
||||||
|
if (!(EVRY_PLUGIN(_p)->config->min_query) || \
|
||||||
|
(_input && (strlen(_input) >= EVRY_PLUGIN(_p)->config->min_query)))
|
||||||
|
|
||||||
typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
|
typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
|
||||||
|
|
||||||
#define EVRY_PLUGIN_ITEMS_CLEAR(_p) { \
|
#define EVRY_PLUGIN_ITEMS_CLEAR(_p) { \
|
||||||
|
|
|
@ -24,8 +24,6 @@ struct _Border_Item
|
||||||
E_Border *border;
|
E_Border *border;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GET_BORDER(_bd, _it) Border_Item *_bd = (Border_Item *)_it;
|
|
||||||
|
|
||||||
static const Evry_API *evry = NULL;
|
static const Evry_API *evry = NULL;
|
||||||
static Evry_Module *evry_module = NULL;
|
static Evry_Module *evry_module = NULL;
|
||||||
static Evry_Plugin *_plug;
|
static Evry_Plugin *_plug;
|
||||||
|
@ -35,6 +33,9 @@ static Evas_Object *_icon_get(Evry_Item *it, Evas *e);
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
#define GET_BORDER(_bd, _it) Border_Item *_bd = (Border_Item *)_it;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_border_item_free(Evry_Item *it)
|
_border_item_free(Evry_Item *it)
|
||||||
{
|
{
|
||||||
|
@ -56,7 +57,9 @@ _border_item_add(Plugin *p, E_Border *bd)
|
||||||
if (bd->client.netwm.state.skip_pager)
|
if (bd->client.netwm.state.skip_pager)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bi = EVRY_ITEM_NEW(Border_Item, p, e_border_name_get(bd), _icon_get, _border_item_free);
|
bi = EVRY_ITEM_NEW(Border_Item, p, e_border_name_get(bd),
|
||||||
|
_icon_get, _border_item_free);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%d:%d %s",
|
snprintf(buf, sizeof(buf), "%d:%d %s",
|
||||||
bd->desk->x, bd->desk->y,
|
bd->desk->x, bd->desk->y,
|
||||||
(bd->desktop ? bd->desktop->name : ""));
|
(bd->desktop ? bd->desktop->name : ""));
|
||||||
|
@ -84,10 +87,13 @@ _cb_border_remove(void *data, __UNUSED__ int type, void *event)
|
||||||
|
|
||||||
if (!bi) return ECORE_CALLBACK_PASS_ON;
|
if (!bi) return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
||||||
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
p->borders = eina_list_remove(p->borders, bi);
|
p->borders = eina_list_remove(p->borders, bi);
|
||||||
p->base.items = eina_list_remove(p->base.items, bi);
|
|
||||||
EVRY_ITEM_FREE(bi);
|
EVRY_ITEM_FREE(bi);
|
||||||
|
|
||||||
|
EVRY_PLUGIN_ITEMS_ADD(p, p->borders, p->input, 1, 0);
|
||||||
|
|
||||||
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
|
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
|
||||||
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
@ -97,32 +103,29 @@ _cb_border_add(void *data, __UNUSED__ int type, void *event)
|
||||||
{
|
{
|
||||||
E_Event_Border_Add *ev = event;
|
E_Event_Border_Add *ev = event;
|
||||||
Plugin *p = data;
|
Plugin *p = data;
|
||||||
unsigned int min;
|
|
||||||
|
|
||||||
if (!_border_item_add(p, ev->border))
|
if (!_border_item_add(p, ev->border))
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
min = EVRY_PLUGIN(p)->config->min_query;
|
|
||||||
|
|
||||||
if ((!p->input && (min == 0)) ||
|
|
||||||
(p->input && (strlen(p->input) >= min)))
|
|
||||||
{
|
|
||||||
EVRY_PLUGIN_ITEMS_ADD(p, p->borders, p->input, 1, 0);
|
EVRY_PLUGIN_ITEMS_ADD(p, p->borders, p->input, 1, 0);
|
||||||
|
|
||||||
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
|
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
|
||||||
}
|
|
||||||
|
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_get_borderlist(Plugin *p)
|
static Evry_Plugin *
|
||||||
|
_begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
|
||||||
{
|
{
|
||||||
|
Plugin *p;
|
||||||
E_Border *bd;
|
E_Border *bd;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
|
EVRY_PLUGIN_INSTANCE(p, plugin);
|
||||||
|
|
||||||
p->handlers = eina_list_append
|
p->handlers = eina_list_append
|
||||||
(p->handlers, ecore_event_handler_add
|
(p->handlers, ecore_event_handler_add
|
||||||
(E_EVENT_BORDER_REMOVE, _cb_border_remove, p));
|
(E_EVENT_BORDER_REMOVE, _cb_border_remove, p));
|
||||||
|
@ -133,13 +136,6 @@ _get_borderlist(Plugin *p)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
||||||
_border_item_add(p, bd);
|
_border_item_add(p, bd);
|
||||||
}
|
|
||||||
|
|
||||||
static Evry_Plugin *
|
|
||||||
_begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
|
|
||||||
{
|
|
||||||
Plugin *p;
|
|
||||||
EVRY_PLUGIN_INSTANCE(p, plugin);
|
|
||||||
|
|
||||||
return EVRY_PLUGIN(p);
|
return EVRY_PLUGIN(p);
|
||||||
}
|
}
|
||||||
|
@ -168,26 +164,21 @@ _finish(Evry_Plugin *plugin)
|
||||||
static int
|
static int
|
||||||
_fetch(Evry_Plugin *plugin, const char *input)
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
int len = (input ? strlen(input) : 0);
|
|
||||||
|
|
||||||
GET_PLUGIN(p, plugin);
|
GET_PLUGIN(p, plugin);
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
if (len >= plugin->config->min_query)
|
EVRY_PLUGIN_MIN_QUERY(p, input)
|
||||||
{
|
{
|
||||||
IF_RELEASE(p->input);
|
IF_RELEASE(p->input);
|
||||||
|
|
||||||
if (input)
|
if (input)
|
||||||
p->input = eina_stringshare_add(input);
|
p->input = eina_stringshare_add(input);
|
||||||
|
|
||||||
if (!p->handlers)
|
return EVRY_PLUGIN_ITEMS_ADD(p, p->borders, input, 1, 0);
|
||||||
_get_borderlist(p);
|
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_ADD(p, p->borders, input, 1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!(p->base.items);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -200,42 +191,60 @@ _icon_get(Evry_Item *it, Evas *e)
|
||||||
|
|
||||||
if (bd->internal)
|
if (bd->internal)
|
||||||
{
|
{
|
||||||
o = edje_object_add(e);
|
|
||||||
if (!bd->internal_icon)
|
if (!bd->internal_icon)
|
||||||
e_util_edje_icon_set(o, "enlightenment/e");
|
{
|
||||||
|
o = e_icon_add(e);
|
||||||
|
e_util_icon_theme_set(o, "enlightenment");
|
||||||
|
}
|
||||||
else if (!bd->internal_icon_key)
|
else if (!bd->internal_icon_key)
|
||||||
{
|
{
|
||||||
char *ext;
|
char *ext;
|
||||||
ext = strrchr(bd->internal_icon, '.');
|
ext = strrchr(bd->internal_icon, '.');
|
||||||
if ((ext) && ((!strcmp(ext, ".edj"))))
|
if ((ext) && ((!strcmp(ext, ".edj"))))
|
||||||
{
|
{
|
||||||
|
o = edje_object_add(e);
|
||||||
if (!edje_object_file_set(o, bd->internal_icon, "icon"))
|
if (!edje_object_file_set(o, bd->internal_icon, "icon"))
|
||||||
e_util_edje_icon_set(o, "enlightenment/e");
|
e_util_icon_theme_set(o, "enlightenment");
|
||||||
}
|
}
|
||||||
else if (ext)
|
else if (ext)
|
||||||
{
|
{
|
||||||
evas_object_del(o);
|
|
||||||
o = e_icon_add(e);
|
o = e_icon_add(e);
|
||||||
e_icon_file_set(o, bd->internal_icon);
|
e_icon_file_set(o, bd->internal_icon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!e_util_edje_icon_set(o, bd->internal_icon))
|
o = e_icon_add(e);
|
||||||
e_util_edje_icon_set(o, "enlightenment/e");
|
e_icon_scale_size_set(o, 128);
|
||||||
|
if (!e_util_icon_theme_set(o, bd->internal_icon))
|
||||||
|
e_util_icon_theme_set(o, "enlightenment");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
edje_object_file_set(o, bd->internal_icon,
|
o = edje_object_add(e);
|
||||||
bd->internal_icon_key);
|
edje_object_file_set(o, bd->internal_icon, bd->internal_icon_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!o && bd->desktop)
|
if (bd->client.netwm.icons)
|
||||||
o = e_util_desktop_icon_add(bd->desktop, 128, e);
|
{
|
||||||
|
if (e_config->use_app_icon)
|
||||||
|
goto _use_netwm_icon;
|
||||||
|
|
||||||
if (!o && bd->client.netwm.icons)
|
if (bd->remember && (bd->remember->prop.icon_preference == E_ICON_PREF_NETWM))
|
||||||
|
goto _use_netwm_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bd->desktop)
|
||||||
|
{
|
||||||
|
o = e_util_desktop_icon_add(bd->desktop, 128, e);
|
||||||
|
if (o) return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
_use_netwm_icon:
|
||||||
|
if (bd->client.netwm.icons)
|
||||||
{
|
{
|
||||||
int i, size, tmp, found = 0;
|
int i, size, tmp, found = 0;
|
||||||
o = e_icon_add(e);
|
o = e_icon_add(e);
|
||||||
|
@ -258,8 +267,11 @@ _icon_get(Evry_Item *it, Evas *e)
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!o)
|
|
||||||
o = e_border_icon_add(bd, e);
|
o = e_border_icon_add(bd, e);
|
||||||
|
if (o) return o;
|
||||||
|
|
||||||
|
o = edje_object_add(e);
|
||||||
|
e_util_icon_theme_set(o, "unknown");
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue