remove duplicated code
This commit is contained in:
20
xoat.c
20
xoat.c
@@ -548,26 +548,18 @@ void client_active(client *c)
|
|||||||
// real simple switcher/launcher
|
// real simple switcher/launcher
|
||||||
void find_or_start(char *class)
|
void find_or_start(char *class)
|
||||||
{
|
{
|
||||||
int i; client *c, *found = NULL;
|
int i; client *c;
|
||||||
stack all; windows_visible(&all);
|
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 && !strcasecmp(c->class, class))
|
||||||
if ((c = all.clients[i]) && c->manage && XGetClassHint(display, c->window, &chint))
|
|
||||||
{
|
{
|
||||||
if (!strcasecmp(chint.res_class, class) || !strcasecmp(chint.res_name, class))
|
client_raise(c);
|
||||||
found = c;
|
client_active(c);
|
||||||
XFree(chint.res_class);
|
|
||||||
XFree(chint.res_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found)
|
|
||||||
{
|
|
||||||
client_raise(found);
|
|
||||||
client_active(found);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
exec_cmd(class);
|
exec_cmd(class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user