all repos — ryudo @ 4ad722c1aa7c7013470c499a25498d51b564a2fc

the floatiling window manager that flows; fork of rio from plan9port

fix heuristics for focusing windows after hiding or deleting current
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmIjCdUACgkQO3+8IhRO
Y5gsTQ/9HnKz1HkEmoZJw2fXFAjieqSRbrHVJl6NFLyv5Ms6IZaijNADNwN/zj/P
Ki6TbXYfcSwXQPRbdOA/H/N3GlhxU2Fgjc8xU6Yrie1PCwHvH5CMlAGJFq7XGrXR
L3W18Kg1GWovtjBivE6AEg0dRtnZ2DBjIWqrEEMgQBwNyr3Hv+GG1tM24MRBScjL
PKN3MtcXJ4BX1FPEdgx3WE4gvHatsRDk/H5YmV+kQ/CVWhZjqbSNAa6s93rnSKI6
1DP1uZxx06Se2ArrmFg28jeSmqb7Qa6mR/U8lZF1fvuSkISh16VdMwrDTPyJJnev
r9WLkpwZEjVyJ0wW+YPVuDNNigmQ7h2wtA6RWbqkrMnbLnGb3cn1D5V/sFE+sB/K
01WzN3u5ItlYNJXiiuWIeuWW8AGWHAwBeo4dwUWg6MNcbBEXoswahJXa7gA0T7l7
SeT2o2kgL1o1KwSayJTidYdm8Eb3ServKKvtFzaZLHl8tUd7Ontm+YdhF2WJQ3oL
8eMRkXDmBRq4oNSCT2FkcqAu3IPtFQtIfFLsa0gYJJgxDXjqvMTIFSvxjODSgY3e
f5s3nkF0WoMrYxEExAX/UIwXVrFFbdON1iv7Y0hwozeXDFJ8tVnGRSKaBo5a1QOO
CQDW5ZX5dlsWFUuyI24PmakqDbktVSCrzSzmkFHdn3reH/VI9+g=
=Y+ey
-----END PGP SIGNATURE-----
commit

4ad722c1aa7c7013470c499a25498d51b564a2fc

parent

1f72f88bde30230ea114635fb5b5a5b2aaccbe89

4 files changed, 68 insertions(+), 13 deletions(-)

jump to
M client.cclient.c

@@ -414,4 +414,25 @@

void ensureactiveonmonitor(int monitor) { if (!current) shuffleonmonitor(monitor); +} + +Window getrevert(Client* c) { + int m; + Client* cc; + + if (!c) { + return 0; + } + + if (c->trans) { + return c->trans; + } else { + m = getmonitorbyclient(c); + for (cc = c->revert; cc && cc->revert; cc = cc->revert) { + if (getmonitorbyclient(cc) == m) { + return cc->window; + } + } + } + return 0; }
M event.cevent.c

@@ -255,14 +255,15 @@ }

} void unmap(XUnmapEvent* e) { - Client* c; - int monitor; + Client *c, *revertc; + Window revert; + int m; curtime = CurrentTime; c = getclient(e->window, 0); if (c) { - monitor = getmonitorbyclient(c); + m = getmonitorbyclient(c); switch (c->state) { case IconicState: if (e->send_event) {

@@ -271,8 +272,14 @@ withdraw(c);

} break; case NormalState: - if (c == current) - shuffleonmonitor(monitor); + if (c == current) { + if (revertc = getclient(getrevert(c), 0)) { + top(revertc); + active(revertc); + } else { + shuffleonmonitor(m); + } + } if (!c->reparenting) withdraw(c); break;

@@ -345,7 +352,8 @@ }

void destroy(Window w) { int i; - Client* c; + Client *c, *revertc; + Window revert; int monitor; curtime = CurrentTime;

@@ -353,14 +361,20 @@ c = getclient(w, 0);

if (c == 0) return; + revert = getrevert(c); monitor = getmonitorbyclient(c); + if (numvirtuals > 1) for (i = 0; i < numvirtuals; i++) if (currents[i] == c) currents[i] = 0; rmclient(c); - ensureactiveonmonitor(monitor); + + if (!current && (revertc = getclient(revert, 0))) { + top(revertc); + active(revertc); + } /* flush any errors generated by the window's sudden demise */ ignore_badwindow = 1;

@@ -383,8 +397,10 @@ execvp(myargv[0], myargv);

perror("ryudo: exec failed"); exit(1); } - if (e->message_type == wm_protocols) + + if (e->message_type == wm_protocols) { return; + } if (e->message_type == wm_change_state) { c = getclient(e->window, 0); if (e->format == 32 && e->data.l[0] == IconicState && c != 0) {
M fns.hfns.h

@@ -103,6 +103,7 @@ int isterminalwindow(Client* c);

void ensureactive(); void ensureactiveonmonitor(int); void shuffleonmonitor(int); +Window getrevert(Client*); /* grab.c */ int menuhit();