From 029a558a985de4e9a048d174468346020ab8969a Mon Sep 17 00:00:00 2001 From: Chidambar Zinnoury Date: Fri, 9 Jul 2010 10:34:20 +0000 Subject: [PATCH] WinList: add a new functionality so that we can switch between windows of the same class. This is a major (and interesting) killer-feature of Gnome3, so let's shamelessly steal it. SVN revision: 50154 --- src/modules/winlist/e_mod_main.c | 62 +++++++++++++++++++++++++++----- src/modules/winlist/e_winlist.c | 10 ++++-- src/modules/winlist/e_winlist.h | 2 +- 3 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/modules/winlist/e_mod_main.c b/src/modules/winlist/e_mod_main.c index fcb3060b8..f4b6cff97 100644 --- a/src/modules/winlist/e_mod_main.c +++ b/src/modules/winlist/e_mod_main.c @@ -35,6 +35,10 @@ e_modapi_init(E_Module *m) "next", NULL, 0); e_action_predef_name_set(_("Window : List"), _("Previous Window"), "winlist", "prev", NULL, 0); + e_action_predef_name_set(_("Window : List"), _("Next window of same class"), "winlist", + "class-next", NULL, 0); + e_action_predef_name_set(_("Window : List"), _("Previous window of same class"), + "winlist", "class-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"), @@ -56,6 +60,8 @@ e_modapi_shutdown(E_Module *m) { e_action_predef_name_del(_("Window : List"), _("Previous Window")); e_action_predef_name_del(_("Window : List"), _("Next Window")); + e_action_predef_name_del(_("Window : List"), _("Previous window of same class")); + e_action_predef_name_del(_("Window : List"), _("Next window of same class")); e_action_predef_name_del(_("Window : List"), _("Window on the Left")); e_action_predef_name_del(_("Window : List"), _("Window Down")); e_action_predef_name_del(_("Window : List"), _("Window Up")); @@ -98,12 +104,22 @@ _e_mod_action_winlist_cb(E_Object *obj, const char *params) { if (!strcmp(params, "next")) { - if (!e_winlist_show(zone)) + if (!e_winlist_show(zone, EINA_FALSE)) e_winlist_next(); } else if (!strcmp(params, "prev")) { - if (!e_winlist_show(zone)) + if (!e_winlist_show(zone, EINA_FALSE)) + e_winlist_prev(); + } + else if (!strcmp(params, "class-next")) + { + if (!e_winlist_show(zone, EINA_TRUE)) + e_winlist_next(); + } + else if (!strcmp(params, "class-prev")) + { + if (!e_winlist_show(zone, EINA_TRUE)) e_winlist_prev(); } else if (!strcmp(params, "left")) @@ -125,7 +141,7 @@ _e_mod_action_winlist_cb(E_Object *obj, const char *params) } else { - if (!e_winlist_show(zone)) + if (!e_winlist_show(zone, EINA_FALSE)) e_winlist_next(); } } @@ -154,14 +170,28 @@ _e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params, Ecore_Event_Mo { if (!strcmp(params, "next")) { - if (e_winlist_show(zone)) + if (e_winlist_show(zone, EINA_FALSE)) e_winlist_modifiers_set(ev->modifiers); else e_winlist_next(); } else if (!strcmp(params, "prev")) { - if (e_winlist_show(zone)) + if (e_winlist_show(zone, EINA_FALSE)) + e_winlist_modifiers_set(ev->modifiers); + else + e_winlist_prev(); + } + else if (!strcmp(params, "class-next")) + { + if (e_winlist_show(zone, EINA_TRUE)) + e_winlist_modifiers_set(ev->modifiers); + else + e_winlist_next(); + } + else if (!strcmp(params, "class-prev")) + { + if (e_winlist_show(zone, EINA_TRUE)) e_winlist_modifiers_set(ev->modifiers); else e_winlist_prev(); @@ -185,7 +215,7 @@ _e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params, Ecore_Event_Mo } else { - if (e_winlist_show(zone)) + if (e_winlist_show(zone, EINA_FALSE)) e_winlist_modifiers_set(ev->modifiers); else e_winlist_next(); @@ -216,14 +246,28 @@ _e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key { if (!strcmp(params, "next")) { - if (e_winlist_show(zone)) + if (e_winlist_show(zone, EINA_FALSE)) e_winlist_modifiers_set(ev->modifiers); else e_winlist_next(); } else if (!strcmp(params, "prev")) { - if (e_winlist_show(zone)) + if (e_winlist_show(zone, EINA_FALSE)) + e_winlist_modifiers_set(ev->modifiers); + else + e_winlist_prev(); + } + else if (!strcmp(params, "class-next")) + { + if (e_winlist_show(zone, EINA_TRUE)) + e_winlist_modifiers_set(ev->modifiers); + else + e_winlist_next(); + } + else if (!strcmp(params, "class-prev")) + { + if (e_winlist_show(zone, EINA_TRUE)) e_winlist_modifiers_set(ev->modifiers); else e_winlist_prev(); @@ -247,7 +291,7 @@ _e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key } else { - if (e_winlist_show(zone)) + if (e_winlist_show(zone, EINA_FALSE)) e_winlist_modifiers_set(ev->modifiers); else e_winlist_next(); diff --git a/src/modules/winlist/e_winlist.c b/src/modules/winlist/e_winlist.c index 1767427a2..e819ba34c 100644 --- a/src/modules/winlist/e_winlist.c +++ b/src/modules/winlist/e_winlist.c @@ -83,7 +83,7 @@ e_winlist_shutdown(void) } int -e_winlist_show(E_Zone *zone) +e_winlist_show(E_Zone *zone, Eina_Bool same_class) { int x, y, w, h; Evas_Object *o; @@ -149,6 +149,8 @@ e_winlist_show(E_Zone *zone) edje_object_part_text_set(bg_object, "e.text.title", _("Select a window")); evas_object_show(o); + last_border = e_border_focused_get(); + desk = e_desk_current_get(winlist->zone); e_box_freeze(list_object); for (l = e_border_focus_stack_get(); l; l = l->next) @@ -156,7 +158,10 @@ e_winlist_show(E_Zone *zone) E_Border *bd; bd = l->data; - _e_winlist_border_add(bd, winlist->zone, desk); + 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); } e_box_thaw(list_object); @@ -172,7 +177,6 @@ e_winlist_show(E_Zone *zone) if (e_config->winlist_warp_while_selecting) ecore_x_pointer_xy_get(winlist->zone->container->win, &last_pointer_x, &last_pointer_y); - last_border = e_border_focused_get(); if (last_border) { if (!last_border->lock_focus_out) diff --git a/src/modules/winlist/e_winlist.h b/src/modules/winlist/e_winlist.h index eeffd3d8f..6ce997f59 100644 --- a/src/modules/winlist/e_winlist.h +++ b/src/modules/winlist/e_winlist.h @@ -10,7 +10,7 @@ int e_winlist_init(void); int e_winlist_shutdown(void); -int e_winlist_show(E_Zone *zone); +int e_winlist_show(E_Zone *zone, Eina_Bool same_class); void e_winlist_hide(void); void e_winlist_next(void); void e_winlist_prev(void);