summaryrefslogtreecommitdiff
path: root/openbox/focus_cycle_popup.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-06-07 03:21:18 +0000
committerDana Jansens <danakj@orodu.net>2007-06-07 03:21:18 +0000
commit571b09f999585c66e9781877c94807f663c2bd4c (patch)
tree0fec7a7de2797710ffd6f43dd6296605f8b9ce92 /openbox/focus_cycle_popup.c
parent9943a713e974473f52d951103efd9b6bda6dd753 (diff)
nice code cleanup that's been needed for a long time. add parents list to client, which you can iterate instead of going thru the group.
Diffstat (limited to 'openbox/focus_cycle_popup.c')
-rw-r--r--openbox/focus_cycle_popup.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c
index 89468493..b827e524 100644
--- a/openbox/focus_cycle_popup.c
+++ b/openbox/focus_cycle_popup.c
@@ -211,31 +211,26 @@ static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
static gchar *popup_get_name(ObClient *c)
{
ObClient *p;
- gchar *title = NULL;
+ gchar *title;
const gchar *desk = NULL;
gchar *ret;
- /* find our highest direct parent, including non-normal windows */
- for (p = c; p->transient_for && p->transient_for != OB_TRAN_GROUP;
- p = p->transient_for);
+ /* find our highest direct parent */
+ p = client_search_top_direct_parent(c);
if (c->desktop != DESKTOP_ALL && c->desktop != screen_desktop)
desk = screen_desktop_names[c->desktop];
- /* use the transient's parent's title/icon if we don't have one */
- if (p != c && !strcmp("", (c->iconic ? c->icon_title : c->title)))
- title = g_strdup(p->iconic ? p->icon_title : p->title);
+ title = c->iconic ? c->icon_title : c->title;
- if (title == NULL)
- title = g_strdup(c->iconic ? c->icon_title : c->title);
+ /* use the transient's parent's title/icon if we don't have one */
+ if (p != c && title[0] == '\0')
+ title = p->iconic ? p->icon_title : p->title;
if (desk)
ret = g_strdup_printf("%s [%s]", title, desk);
- else {
- ret = title;
- title = NULL;
- }
- g_free(title);
+ else
+ ret = g_strdup(title);
return ret;
}