misc refactoring
This commit is contained in:
48
xoat.c
48
xoat.c
@@ -547,13 +547,9 @@ void action_find_or_start(void *data, int num, client *cli)
|
|||||||
stack all; query_visible_windows(&all);
|
stack all; query_visible_windows(&all);
|
||||||
|
|
||||||
for (i = 0; i < all.depth; i++)
|
for (i = 0; i < all.depth; i++)
|
||||||
{
|
|
||||||
if ((c = all.clients[i]) && c->manage && !strcasecmp(c->class, class))
|
if ((c = all.clients[i]) && c->manage && !strcasecmp(c->class, class))
|
||||||
{
|
{ client_activate(c); return; }
|
||||||
client_activate(c);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exec_cmd(class);
|
exec_cmd(class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,14 +661,13 @@ void configure_request(XEvent *ev)
|
|||||||
{
|
{
|
||||||
XConfigureRequestEvent *e = &ev->xconfigurerequest;
|
XConfigureRequestEvent *e = &ev->xconfigurerequest;
|
||||||
client *c = window_build_client(e->window);
|
client *c = window_build_client(e->window);
|
||||||
if (!c) return;
|
if (c && c->manage && c->visible && !c->trans)
|
||||||
|
|
||||||
if (c->manage && c->visible && !c->trans)
|
|
||||||
{
|
{
|
||||||
client_update_border(c);
|
client_update_border(c);
|
||||||
client_place_spot(c, c->spot, 0);
|
client_place_spot(c, c->spot, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
if (c)
|
||||||
{
|
{
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
if (e->value_mask & CWX) wc.x = e->x;
|
if (e->value_mask & CWX) wc.x = e->x;
|
||||||
@@ -697,22 +692,15 @@ void configure_notify(XEvent *e)
|
|||||||
void map_request(XEvent *e)
|
void map_request(XEvent *e)
|
||||||
{
|
{
|
||||||
client *c = window_build_client(e->xmaprequest.window);
|
client *c = window_build_client(e->xmaprequest.window);
|
||||||
if (!c) return;
|
if (c && c->manage)
|
||||||
|
|
||||||
if (c->manage)
|
|
||||||
{
|
{
|
||||||
int spot = SPOT_START, mon = MAX(nmonitors-1, MIN(0, MONITOR_START));
|
c->monitor = MONITOR_START == MONITOR_CURRENT ? current_mon: MONITOR_START;
|
||||||
|
c->monitor = MAX(nmonitors-1, MIN(0, c->monitor));
|
||||||
|
monitor *m = &monitors[c->monitor];
|
||||||
|
|
||||||
if (MONITOR_START == MONITOR_CURRENT)
|
int spot = SPOT_START == SPOT_CURRENT ? current_spot: SPOT_START;
|
||||||
mon = current_mon;
|
|
||||||
|
|
||||||
c->monitor = mon;
|
if (SPOT_START == SPOT_SMART) // find spot of best fit
|
||||||
monitor *m = &monitors[mon];
|
|
||||||
|
|
||||||
if (SPOT_START == SPOT_CURRENT)
|
|
||||||
spot = current_spot;
|
|
||||||
|
|
||||||
if (SPOT_START == SPOT_SMART)
|
|
||||||
for (spot = SPOT3; spot > SPOT1; spot--)
|
for (spot = SPOT3; spot > SPOT1; spot--)
|
||||||
if (c->attr.width <= m->spots[spot].w && c->attr.height <= m->spots[spot].h)
|
if (c->attr.width <= m->spots[spot].w && c->attr.height <= m->spots[spot].h)
|
||||||
break;
|
break;
|
||||||
@@ -721,16 +709,14 @@ void map_request(XEvent *e)
|
|||||||
client_update_border(c);
|
client_update_border(c);
|
||||||
client_flush_tags(c);
|
client_flush_tags(c);
|
||||||
}
|
}
|
||||||
XMapWindow(display, c->window);
|
if (c) XMapWindow(display, c->window);
|
||||||
client_free(c);
|
client_free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_notify(XEvent *e)
|
void map_notify(XEvent *e)
|
||||||
{
|
{
|
||||||
client *a = NULL, *c = window_build_client(e->xmap.window);
|
client *a = NULL, *c = window_build_client(e->xmap.window);
|
||||||
if (!c) return;
|
if (c && c->manage)
|
||||||
|
|
||||||
if (c->manage)
|
|
||||||
{
|
{
|
||||||
client_raise_family(c);
|
client_raise_family(c);
|
||||||
client_update_border(c);
|
client_update_border(c);
|
||||||
@@ -738,9 +724,9 @@ void map_notify(XEvent *e)
|
|||||||
if (!(a = window_build_client(current)) || (a && a->spot == c->spot))
|
if (!(a = window_build_client(current)) || (a && a->spot == c->spot))
|
||||||
client_set_focus(c);
|
client_set_focus(c);
|
||||||
client_free(a);
|
client_free(a);
|
||||||
|
ewmh_client_list();
|
||||||
}
|
}
|
||||||
client_free(c);
|
client_free(c);
|
||||||
ewmh_client_list();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void unmap_notify(XEvent *e)
|
void unmap_notify(XEvent *e)
|
||||||
@@ -797,11 +783,8 @@ void client_message(XEvent *ev)
|
|||||||
warnx("restart!");
|
warnx("restart!");
|
||||||
execsh(self);
|
execsh(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
client *c = window_build_client(e->window);
|
client *c = window_build_client(e->window);
|
||||||
if (!c) return;
|
if (c && c->manage)
|
||||||
|
|
||||||
if (c->manage)
|
|
||||||
{
|
{
|
||||||
warnx("client message 0x%lx 0x%08lx %s", e->message_type, (long)c->window, c->class);
|
warnx("client message 0x%lx 0x%08lx %s", e->message_type, (long)c->window, c->class);
|
||||||
if (e->message_type == atoms[_NET_ACTIVE_WINDOW])
|
if (e->message_type == atoms[_NET_ACTIVE_WINDOW])
|
||||||
@@ -995,8 +978,7 @@ int main(int argc, char *argv[])
|
|||||||
client_place_spot(c, c->spot, 1);
|
client_place_spot(c, c->spot, 1);
|
||||||
|
|
||||||
// only activate first one
|
// only activate first one
|
||||||
if (current) continue;
|
if (!current) client_activate(c);
|
||||||
client_activate(c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// main event loop
|
// main event loop
|
||||||
|
|||||||
Reference in New Issue
Block a user