bakkeby/patches

rioresize over multiple monitors

jzbor opened this issue · 2 comments

jzbor commented

I found another bug with multiple monitor setups. This time with rioresize - its much easier to resolve. It was just missing an arrange() on the old monitor:

diff --git a/moonwm.c b/moonwm.c
index ff18d60..f64b41f 100644
--- a/moonwm.c
+++ b/moonwm.c
@@ -2441,7 +2441,8 @@ riodraw(Client *c, const char slopstyle[])
 void
 rioposition(Client *c, int x, int y, int w, int h)
 {
-	Monitor *m;
+	Monitor *m, *mold;
+    mold = c->mon;
 	if ((m = recttomon(x, y, w, h)) && m != c->mon) {
 		detach(c);
 		detachstack(c);
@@ -2458,7 +2459,9 @@ rioposition(Client *c, int x, int y, int w, int h)
 		resize(c, x, y, w - (borderpx * 2), h - (borderpx * 2), borderpx, 0);
 	else
 		resize(c, x - borderpx, y - borderpx, w, h, borderpx, 0);
+	drawbar(mold);
 	drawbar(c->mon);
+	arrange(mold);
 	arrange(c->mon);
 
 	riodimensions[3] = -1;

Yes that makes sense. I guess you'd only want to arrange the previous monitor of we are changing monitors. The drawbar calls might actually be redundant if arrange is called due to arrange --> restack --> drawbar.

Pushed the fix now, thanks a lot for finding and reporting :D