changeset: 2412:00c414212163
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Dec 09 19:39:13 2008 -0500
files: cmd/wmii/float.c cmd/wmii/screen.c
description:
Be smarter about which screen to place floating windows on.
diff -r 16f26d05a13a -r 00c414212163 cmd/wmii/float.c
--- a/cmd/wmii/float.c Tue Dec 09 19:23:34 2008 -0500
+++ b/cmd/wmii/float.c Tue Dec 09 19:39:13 2008 -0500
@@ -162,9 +162,9 @@
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 @@
if(c->trans)
return;
*/
+
if(c->fullscreen >= 0 || c->w.hints->position || starting) {
f->r = f->floatr;
return;
@@ -189,7 +190,28 @@
*/
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 -r 16f26d05a13a -r 00c414212163 cmd/wmii/screen.c
--- a/cmd/wmii/screen.c Tue Dec 09 19:23:34 2008 -0500
+++ b/cmd/wmii/screen.c Tue Dec 09 19:39:13 2008 -0500
@@ -117,6 +117,8 @@
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) { \
Received on Wed Dec 10 2008 - 00:39:14 UTC
This archive was generated by hypermail 2.2.0 : Wed Dec 10 2008 - 00:48:04 UTC