shod

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit d2fd3a45e0c1418f292c1f080493fe4f9cd5cc3a
parent c3e1b19358bce24725cd29e479466720d5398c25
Author: phillbush <phillbush@cock.li>
Date:   Sun, 19 Sep 2021 19:59:45 -0300

fix focusing when closing window

Diffstat:
Mshod.c | 15++++++++++-----
Mshodc.c | 2+-
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/shod.c b/shod.c @@ -2399,6 +2399,7 @@ containerminimize(struct Container *c, int minimize, int focus) containersendtodesk(c, wm.selmon->seldesk, 1, 0); containermoveresize(c); containerhide(c, 0); + tabfocus(c->selcol->selrow->seltab, 0); } else { return; } @@ -3790,26 +3791,28 @@ manage(Window win, XWindowAttributes *wa, int ignoreunmap) static void unmanage(struct Tab *t) { - struct Container *c, *focus; + struct Container *c, *next; struct Column *col; struct Row *row; struct Desktop *desk; int moveresize; + int focus; row = t->row; col = row->col; c = col->c; desk = c->desk; moveresize = 1; - focus = c; + next = c; tabdel(t); + focus = (c == wm.focused); if (row->ntabs == 0) { rowdel(row); if (col->nrows == 0) { coldel(col); if (c->ncols == 0) { containerdel(c); - focus = getnextfocused(desk->mon, desk); + next = getnextfocused(desk->mon, desk); moveresize = 0; } } @@ -3820,7 +3823,9 @@ unmanage(struct Tab *t) containerredecorate(c, NULL, NULL, 0); shodgroup(c); } - tabfocus((focus != NULL) ? focus->selcol->selrow->seltab : NULL, 0); + if (focus) { + tabfocus((next != NULL) ? next->selcol->selrow->seltab : NULL, 0); + } } /* scan for already existing windows and adopt them */ @@ -4485,7 +4490,7 @@ xeventclientmessage(XEvent *e) } else if ((Atom)ev->data.l[i] == atoms[_NET_WM_STATE_STICKY]) { containerstick(res.c, ev->data.l[0]); } else if ((Atom)ev->data.l[i] == atoms[_NET_WM_STATE_HIDDEN]) { - containerminimize(res.c, ev->data.l[0], 1); + containerminimize(res.c, ev->data.l[0], (res.c == wm.focused)); } else if ((Atom)ev->data.l[i] == atoms[_NET_WM_STATE_ABOVE]) { containerabove(res.c, ev->data.l[0]); } else if ((Atom)ev->data.l[i] == atoms[_NET_WM_STATE_BELOW]) { diff --git a/shodc.c b/shodc.c @@ -334,7 +334,7 @@ closewin(int argc, char *argv[]) win = None; if (argc == 1) win = active; - else if (argc == 2 && argv[1][0] == '-') + else if (argc == 2 && argv[1][0] != '-') win = getwin(argv[1]); else usage();