remove duplicated code

This commit is contained in:
seanpringle
2012-09-05 00:37:21 +10:00
parent 80fc26a5fc
commit 9e39572194

20
xoat.c
View File

@@ -548,26 +548,18 @@ void client_active(client *c)
// real simple switcher/launcher
void find_or_start(char *class)
{
int i; client *c, *found = NULL;
int i; client *c;
stack all; windows_visible(&all);
for (i = 0; !found && i < all.depth; i++)
for (i = 0; i < all.depth; i++)
{
XClassHint chint;
if ((c = all.clients[i]) && c->manage && XGetClassHint(display, c->window, &chint))
if ((c = all.clients[i]) && c->manage && !strcasecmp(c->class, class))
{
if (!strcasecmp(chint.res_class, class) || !strcasecmp(chint.res_name, class))
found = c;
XFree(chint.res_class);
XFree(chint.res_name);
}
}
if (found)
{
client_raise(found);
client_active(found);
client_raise(c);
client_active(c);
return;
}
}
exec_cmd(class);
}