X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient_list_combined_menu.c;h=f590dc10a992e9e4981df5e77df27b6637f6050d;hb=bf247215bb015dbb4dfa39c38bf020aa815cd306;hp=bc8081b5fda2061cbcee0d7dde99482efa145124;hpb=74c7f786ebbb0f637b4ecb5935ee0fc8d5cda522;p=chaz%2Fopenbox diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c index bc8081b5..f590dc10 100644 --- a/openbox/client_list_combined_menu.c +++ b/openbox/client_list_combined_menu.c @@ -36,6 +36,7 @@ ObMenu *combined_menu; static void self_update(ObMenuFrame *frame, gpointer data) { ObMenu *menu = frame->menu; + ObMenuEntry *e; GList *it; gint i; gboolean icons = FALSE; @@ -44,14 +45,25 @@ static void self_update(ObMenuFrame *frame, gpointer data) menu_clear_entries(menu); for (desktop = 0; desktop < screen_num_desktops; desktop++) { + gboolean empty = TRUE; + + /* Don't need a separator at the very top */ + if (desktop > 0) + menu_add_separator(menu, -1); + e = menu_add_normal(menu, -1, NULL, NULL); + e->data.normal.enabled = FALSE; + e->data.normal.label = g_strdup(screen_desktop_names[desktop]); + /* The one at the bottom will always have entries below it though */ + menu_add_separator(menu, -1); for (it = focus_order[desktop], i = 0; it; it = g_list_next(it), ++i) { ObClient *c = it->data; if (client_normal(c) && (!c->skip_taskbar || c->iconic)) { GSList *acts = NULL; ObAction* act; - ObMenuEntry *e; const ObClientIcon *icon; + empty = FALSE; + if (!icons && c->iconic) { icons = TRUE; menu_add_separator(menu, -1); @@ -76,21 +88,35 @@ static void self_update(ObMenuFrame *frame, gpointer data) } } } - menu_add_separator(menu, -1); - menu_add_separator(menu, -1); icons = FALSE; + + if (empty) { + /* no entries */ + + GSList *acts = NULL; + ObAction* act; + ObMenuEntry *e; + + act = action_from_string("Desktop", OB_USER_ACTION_MENU_SELECTION); + act->data.desktop.desk = desktop; + acts = g_slist_append(acts, act); + e = menu_add_normal(menu, 0, _("Go there..."), acts); + if (desktop == screen_desktop) + e->data.normal.enabled = FALSE; + } } } /* executes it using the client in the actions, since we set that when we make the actions! */ -static void menu_execute(ObMenuEntry *self, guint state, gpointer data) +static void menu_execute(ObMenuEntry *self, guint state, gpointer data, + Time time) { ObAction *a; if (self->data.normal.actions) { a = self->data.normal.actions->data; - action_run(self->data.normal.actions, a->data.any.c, state); + action_run(self->data.normal.actions, a->data.any.c, state, time); } } @@ -102,7 +128,9 @@ static void client_dest(ObClient *client, gpointer data) GList *eit; for (eit = combined_menu->entries; eit; eit = g_list_next(eit)) { ObMenuEntry *meit = eit->data; - if (meit->type == OB_MENU_ENTRY_TYPE_NORMAL) { + if (meit->type == OB_MENU_ENTRY_TYPE_NORMAL && + meit->data.normal.actions) + { ObAction *a = meit->data.normal.actions->data; ObClient *c = a->data.any.c; if (c == client)