static void client_get_desktop(Client *self)
{
- guint32 d;
+ guint32 d = screen_num_desktops; /* an always-invalid value */
if (PROP_GET32(self->window, net_wm_desktop, cardinal, &d)) {
if (d >= screen_num_desktops && d != DESKTOP_ALL)
- d = screen_num_desktops - 1;
- self->desktop = d;
+ self->desktop = screen_num_desktops - 1;
+ else
+ self->desktop = d;
} else {
gboolean trdesk = FALSE;
/* defaults to the current desktop */
self->desktop = screen_desktop;
+ }
+ if (self->desktop != d) {
/* set the desktop hint, to make sure that it always exists */
PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop);
}