forked from enlightenment/enlightenment
winlist: offer a way to cycle icccm.class
icccm.class is usually unique per application, so you can use that to cycle betwen the applications in your desktop. This mode is complementary to the already existing "cycle all windows of current class", which cycles all windows of the current application. SVN revision: 57386
This commit is contained in:
parent
0167df0c3b
commit
a565e9f077
|
@ -40,6 +40,12 @@ e_modapi_init(E_Module *m)
|
|||
e_action_predef_name_set(_("Window : List"),
|
||||
_("Previous window of same class"),
|
||||
"winlist", "class-prev", NULL, 0);
|
||||
e_action_predef_name_set(_("Window : List"),
|
||||
_("Next window class"), "winlist",
|
||||
"classes-next", NULL, 0);
|
||||
e_action_predef_name_set(_("Window : List"),
|
||||
_("Previous window class"),
|
||||
"winlist", "classes-prev", NULL, 0);
|
||||
e_action_predef_name_set(_("Window : List"), _("Window on the Left"),
|
||||
"winlist", "left", NULL, 0);
|
||||
e_action_predef_name_set(_("Window : List"), _("Window Down"),
|
||||
|
@ -107,22 +113,32 @@ _e_mod_action_winlist_cb(E_Object *obj, const char *params)
|
|||
{
|
||||
if (!strcmp(params, "next"))
|
||||
{
|
||||
if (!e_winlist_show(zone, EINA_FALSE))
|
||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "prev"))
|
||||
{
|
||||
if (!e_winlist_show(zone, EINA_FALSE))
|
||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_prev();
|
||||
}
|
||||
else if (!strcmp(params, "class-next"))
|
||||
{
|
||||
if (!e_winlist_show(zone, EINA_TRUE))
|
||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "class-prev"))
|
||||
{
|
||||
if (!e_winlist_show(zone, EINA_TRUE))
|
||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
||||
e_winlist_prev();
|
||||
}
|
||||
else if (!strcmp(params, "classes-next"))
|
||||
{
|
||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "classes-prev"))
|
||||
{
|
||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
||||
e_winlist_prev();
|
||||
}
|
||||
else if (!strcmp(params, "left"))
|
||||
|
@ -144,7 +160,7 @@ _e_mod_action_winlist_cb(E_Object *obj, const char *params)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!e_winlist_show(zone, EINA_FALSE))
|
||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_next();
|
||||
}
|
||||
}
|
||||
|
@ -174,28 +190,42 @@ _e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params,
|
|||
{
|
||||
if (!strcmp(params, "next"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_FALSE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "prev"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_FALSE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_prev();
|
||||
}
|
||||
else if (!strcmp(params, "class-next"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_TRUE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "class-prev"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_TRUE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_prev();
|
||||
}
|
||||
else if (!strcmp(params, "classes-next"))
|
||||
{
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "classes-prev"))
|
||||
{
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_prev();
|
||||
|
@ -219,7 +249,7 @@ _e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_FALSE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
|
@ -250,28 +280,42 @@ _e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key
|
|||
{
|
||||
if (!strcmp(params, "next"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_FALSE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "prev"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_FALSE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_prev();
|
||||
}
|
||||
else if (!strcmp(params, "class-next"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_TRUE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "class-prev"))
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_TRUE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_prev();
|
||||
}
|
||||
else if (!strcmp(params, "classes-next"))
|
||||
{
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "classes-prev"))
|
||||
{
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_prev();
|
||||
|
@ -295,7 +339,7 @@ _e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key
|
|||
}
|
||||
else
|
||||
{
|
||||
if (e_winlist_show(zone, EINA_FALSE))
|
||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
else
|
||||
e_winlist_next();
|
||||
|
|
|
@ -67,6 +67,21 @@ static Ecore_Animator *_animator = NULL;
|
|||
static const Ecore_X_Window *_win = NULL;
|
||||
static E_Border *_bd_next = NULL;
|
||||
|
||||
static Eina_Bool
|
||||
_wmclass_picked(const Eina_List *lst, const char *wmclass)
|
||||
{
|
||||
const Eina_List *l;
|
||||
const char *s;
|
||||
|
||||
if (!wmclass) return EINA_FALSE;
|
||||
|
||||
EINA_LIST_FOREACH(lst, l, s)
|
||||
if ((s) && (!strcmp(s, wmclass)))
|
||||
return EINA_TRUE;
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
e_winlist_init(void)
|
||||
|
@ -82,12 +97,14 @@ e_winlist_shutdown(void)
|
|||
}
|
||||
|
||||
int
|
||||
e_winlist_show(E_Zone *zone, Eina_Bool same_class)
|
||||
e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
|
||||
{
|
||||
int x, y, w, h;
|
||||
Evas_Object *o;
|
||||
Eina_List *l;
|
||||
E_Desk *desk;
|
||||
E_Border *bd;
|
||||
Eina_List *wmclasses = NULL;
|
||||
|
||||
E_OBJECT_CHECK_RETURN(zone, 0);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
||||
|
@ -155,17 +172,27 @@ e_winlist_show(E_Zone *zone, Eina_Bool same_class)
|
|||
|
||||
desk = e_desk_current_get(_winlist->zone);
|
||||
e_box_freeze(_list_object);
|
||||
for (l = e_border_focus_stack_get(); l; l = l->next)
|
||||
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = l->data;
|
||||
if ((!same_class) ||
|
||||
(!strcmp((const char*) _last_border->client.icccm.class,
|
||||
(const char*) bd->client.icccm.class)))
|
||||
_e_winlist_border_add(bd, _winlist->zone, desk);
|
||||
Eina_Bool pick;
|
||||
switch (filter)
|
||||
{
|
||||
case E_WINLIST_FILTER_CLASS_WINDOWS:
|
||||
pick = !strcmp(_last_border->client.icccm.class,
|
||||
bd->client.icccm.class);
|
||||
break;
|
||||
case E_WINLIST_FILTER_CLASSES:
|
||||
pick = (!_wmclass_picked(wmclasses, bd->client.icccm.class));
|
||||
if (pick)
|
||||
wmclasses = eina_list_append(wmclasses, bd->client.icccm.class);
|
||||
break;
|
||||
default:
|
||||
pick = EINA_TRUE;
|
||||
}
|
||||
if (pick) _e_winlist_border_add(bd, _winlist->zone, desk);
|
||||
}
|
||||
e_box_thaw(_list_object);
|
||||
eina_list_free(wmclasses);
|
||||
|
||||
if (!_wins)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,13 @@
|
|||
int e_winlist_init(void);
|
||||
int e_winlist_shutdown(void);
|
||||
|
||||
int e_winlist_show(E_Zone *zone, Eina_Bool same_class);
|
||||
typedef enum _E_Winlist_Filter {
|
||||
E_WINLIST_FILTER_NONE = 0,
|
||||
E_WINLIST_FILTER_CLASS_WINDOWS = 1, /* all windows from the same class */
|
||||
E_WINLIST_FILTER_CLASSES = 2 /* loop through classes (last selected win) */
|
||||
} E_Winlist_Filter;
|
||||
|
||||
int e_winlist_show(E_Zone *zone, E_Winlist_Filter filter);
|
||||
void e_winlist_hide(void);
|
||||
void e_winlist_next(void);
|
||||
void e_winlist_prev(void);
|
||||
|
|
Loading…
Reference in New Issue