changeset: 2362:05c8f936ecf2
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Oct 14 02:13:28 2008 -0400
files: cmd/menu/main.c cmd/wmii/frame.c
description:
Fix floating window constraints for Xinerama
diff -r cc274f4cc289 -r 05c8f936ecf2 cmd/menu/main.c
--- a/cmd/menu/main.c Tue Oct 14 00:17:01 2008 -0400
+++ b/cmd/menu/main.c Tue Oct 14 02:13:28 2008 -0400
@@ -25,7 +25,7 @@
static void
usage(void) {
- fatal("usage: wimenu ...\n");
+ fatal("usage: wimenu -i [-h <history>] [-a <address>]\n");
}
static int
@@ -271,7 +271,7 @@
if(histfile) {
inbuf = Bopen(histfile, OREAD);
if(!inbuf)
- fatal("Can't open histfile %q: %r", histfile);
+ fatal("Can't open history file %q: %r", histfile);
item = populate_list(inbuf, true);
if(item) {
link(item->prev, &hist);
diff -r cc274f4cc289 -r 05c8f936ecf2 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Tue Oct 14 00:17:01 2008 -0400
+++ b/cmd/wmii/frame.c Tue Oct 14 02:13:28 2008 -0400
@@ -637,22 +637,42 @@
Rectangle
constrain(Rectangle r) {
- Rectangle sr;
+ WMScreen *s, *bestx, *besty;
+ Rectangle isect;
Point p;
+ int i, nbestx, nbesty;
- sr = screen->sel->floating->r;
+ /* Find the screen that this intersects most with
+ * (or doesn't intersect least with), and then make
+ * sure that it overlaps that screen, in the opposite
+ * direction.
+ */
+ SET(nbestx);
+ SET(nbesty);
+ SET(s);
- if(Dx(r) > Dx(sr))
- r.max.x = r.min.x + Dx(sr);
- if(Dy(r) > Dy(sr))
- r.max.y = r.min.y + Dy(sr);
+ bestx = nil;
+ besty = nil;
+ for(i=0; i < nscreens; i++) {
+ s = &screens[i];
+ isect = rect_intersection(r, s->r);
+ if(!bestx || Dx(isect) > nbestx && Dy(isect) > 0) {
+ bestx = s;
+ nbestx = Dx(isect);
+ }
+ if(!besty || Dy(isect) > nbesty && Dy(isect) > 0) {
+ besty = s;
+ nbesty = Dy(isect);
+ }
+ }
- sr = insetrect(sr, Dy(screen->brect));
p = ZP;
- p.x -= min(r.max.x - sr.min.x, 0);
- p.x -= max(r.min.x - sr.max.x, 0);
- p.y -= min(r.max.y - sr.min.y, 0);
- p.y -= max(r.min.y - sr.max.y, 0);
+ isect = insetrect(bestx->r, Dy(screen->brect));
+ p.x -= min(r.max.x - isect.min.x, 0);
+ p.x -= max(r.min.x - isect.max.x, 0);
+ isect = insetrect(besty->r, Dy(screen->brect));
+ p.y -= min(r.max.y - isect.min.y, 0);
+ p.y -= max(r.min.y - isect.max.y, 0);
return rectaddpt(r, p);
}
Received on Tue Oct 14 2008 - 06:13:30 UTC
This archive was generated by hypermail 2.2.0 : Tue Oct 14 2008 - 06:24:04 UTC