commit d157e914ab3cf60f51a98dcaf47bbbdfdeaaaeb1
parent c9150fb99a2f41b488c2f5d456204acf8d716528
Author: Kris Maglione <jg@suckless.org>
Date: Tue, 9 Dec 2008 19:39:13 -0500
Be smarter about which screen to place floating windows on.
Diffstat:
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/cmd/wmii/float.c b/cmd/wmii/float.c
@@ -162,9 +162,9 @@ float_placeframe(Frame *f) {
Point dim, p;
Client *c;
Frame *ff;
- Area *a;
+ Area *a, *sel;
long area, l;
- int i;
+ int i, s;
a = f->area;
c = f->client;
@@ -173,6 +173,7 @@ float_placeframe(Frame *f) {
if(c->trans)
return;
*/
+
if(c->fullscreen >= 0 || c->w.hints->position || starting) {
f->r = f->floatr;
return;
@@ -189,7 +190,28 @@ float_placeframe(Frame *f) {
*/
if(ff->client != f->client)
vector_rpush(&vec, ff->r);
- vp = unique_rects(&vec, a->r);
+
+ /* Decide which screen we want to place this on.
+ * Ideally, it should probably Do the Right Thing
+ * when a screen fills, but what's the right thing?
+ * I think usage will show...
+ */
+ s = -1;
+ ff = client_groupframe(c, f->view);
+ if (ff)
+ s = ownerscreen(ff->r);
+ else if (selclient())
+ s = ownerscreen(selclient()->sel->r);
+ else {
+ sel = view_findarea(a->view, a->view->selcol, false);
+ if (sel)
+ s = sel->screen;
+ }
+
+ r = a->r;
+ if (s > -1)
+ r = screens[s]->r;
+ vp = unique_rects(&vec, r);
area = LONG_MAX;
dim.x = Dx(f->r);
diff --git a/cmd/wmii/screen.c b/cmd/wmii/screen.c
@@ -117,6 +117,8 @@ findthing(Rectangle rect, int direction, Vector_ptr *vec, Rectangle (*key)(void*
int i, n;
best = nil;
+
+ /* For the record, I really hate these macros. */
#define frob(min, max, LT, x, y) \
if(D##y(isect) > 0) /* If they intersect at some point on this axis */ \
if(r.min.x LT rect.min.x) { \