- return (c->sm_client_id &&
- !strcmp(s->id, c->sm_client_id) &&
- !strcmp(s->name, c->name) &&
- !strcmp(s->class, c->class) &&
- !strcmp(s->role, c->role));
+ ob_debug_type(OB_DEBUG_SM, "Comparing client against saved state: ");
+ ob_debug_type(OB_DEBUG_SM, " client id: %s ", c->sm_client_id);
+ ob_debug_type(OB_DEBUG_SM, " client name: %s ", c->name);
+ ob_debug_type(OB_DEBUG_SM, " client class: %s ", c->class);
+ ob_debug_type(OB_DEBUG_SM, " client role: %s ", c->role);
+ ob_debug_type(OB_DEBUG_SM, " client type: %d ", c->type);
+ ob_debug_type(OB_DEBUG_SM, " client command: %s ",
+ c->wm_command ? c->wm_command : "(null)");
+ ob_debug_type(OB_DEBUG_SM, " state id: %s ", s->id);
+ ob_debug_type(OB_DEBUG_SM, " state name: %s ", s->name);
+ ob_debug_type(OB_DEBUG_SM, " state class: %s ", s->class);
+ ob_debug_type(OB_DEBUG_SM, " state role: %s ", s->role);
+ ob_debug_type(OB_DEBUG_SM, " state type: %d ", s->type);
+ ob_debug_type(OB_DEBUG_SM, " state command: %s ",
+ s->command ? s->command : "(null)");
+
+ if ((c->sm_client_id && s->id && !strcmp(c->sm_client_id, s->id)) ||
+ (c->wm_command && s->command && !strcmp(c->wm_command, s->command)))
+ {
+ return (!strcmp(s->name, c->name) &&
+ !strcmp(s->class, c->class) &&
+ !strcmp(s->role, c->role) &&
+ /* the check for type is to catch broken clients, like
+ firefox, which open a different window on startup
+ with the same info as the one we saved. only do this
+ check for old windows that dont use xsmp, others should
+ know better ! */
+ (!s->command || c->type == s->type));
+ }
+ return FALSE;