more cleanup

This commit is contained in:
Dana Jansens 2007-06-07 03:25:15 +00:00
parent 571b09f999
commit 7a33207a50

View file

@ -1102,43 +1102,36 @@ static void client_get_desktop(ObClient *self)
self->desktop = d; self->desktop = d;
ob_debug("client requested desktop 0x%x\n", self->desktop); ob_debug("client requested desktop 0x%x\n", self->desktop);
} else { } else {
gboolean trdesk = FALSE; GSList *it;
gboolean first = TRUE;
guint all = screen_num_desktops; /* not a valid value */
if (self->transient_for) { /* if they are all on one desktop, then open it on the
/* if they are all on one desktop, then open it on the same desktop */
same desktop */ for (it = self->parents; it; it = g_slist_next(it)) {
GSList *it; ObClient *c = it->data;
gboolean first = TRUE;
guint all = screen_num_desktops; /* not a valid value */
for (it = self->parents; it; it = g_slist_next(it)) { if (c->desktop == DESKTOP_ALL) continue;
ObClient *c = it->data;
if (c->desktop == DESKTOP_ALL) continue; if (first) {
all = c->desktop;
if (first) { first = FALSE;
all = c->desktop;
first = FALSE;
}
else if (all != c->desktop)
all = screen_num_desktops; /* make it invalid */
}
if (all != screen_num_desktops) {
self->desktop = all;
trdesk = TRUE;
} }
else if (all != c->desktop)
all = screen_num_desktops; /* make it invalid */
} }
if (all != screen_num_desktops) {
if (!trdesk) { self->desktop = all;
/* try get from the startup-notification protocol */
if (sn_get_desktop(self->startup_id, &self->desktop)) {
if (self->desktop >= screen_num_desktops &&
self->desktop != DESKTOP_ALL)
self->desktop = screen_num_desktops - 1;
} else
/* defaults to the current desktop */
self->desktop = screen_desktop;
} }
/* try get from the startup-notification protocol */
else if (sn_get_desktop(self->startup_id, &self->desktop)) {
if (self->desktop >= screen_num_desktops &&
self->desktop != DESKTOP_ALL)
self->desktop = screen_num_desktops - 1;
}
/* defaults to the current desktop */
else
self->desktop = screen_desktop;
} }
} }