[compiz] Patch to wobbly snap for outputs

David Reveman davidr at novell.com
Mon Dec 18 08:50:24 PST 2006


On Sat, 2006-12-16 at 10:36 -0700, Mike Cook wrote:
> On Tue, Dec 13, 2006 at 11:00 AM, Mike Cook wrote: 
> > Whoa!  There are definitely some issues to address here...  Kicker actually
> > does set the struts right on those "inner" edges, which really throws things
> > off in compiz.  I'll see if I can't put together a couple patches to try to do a
> > better job of handling the struts when they're set, and hacking around the
> > fact that gnome-panel doesn't set them (currently).
> 
> Alright, this patch should handle "inner" struts when they're properly set.  I
> toyed with hacking around the fact that gnome-panel doesn't set the strut
> size properly, but the window geometry doesn't seem reliable at the time
> the struts are set, so we'll just have to get that fixed in gnome-panel (which
> would then require some fixes in metacity to handle it, I expect).  Kicker
> (and probably others) does seem to set them and so this should handle it.

Yes, I would probably not have accepted some ugly hack that used window
geometry to work around gnome-panel not setting struts properly anyhow.

-           if (y1 < pBox->y2 && y2 > pBox->y1)
+           /* consider strut if start/end overlaps box, size ends in box,
+              and edge is outside box or both edge & size in same output
+              (in order to handle struts across multiple outputs) */
+           if (y1 < pBox->y2 && y2 > pBox->y1 && x2 < pBox->x2 &&
+               (x1 < pBox->x1 ||
+                   outputDeviceForPoint(w->screen, x1, y1) ==
+                   outputDeviceForPoint(w->screen, x2-1, y2-1)))

The "x2 < pBox->x2"  check makes a lost of sense. However I fail to see
why this:

+               (x1 < pBox->x1 ||
+                   outputDeviceForPoint(w->screen, x1, y1) ==
+                   outputDeviceForPoint(w->screen, x2-1, y2-1))

check is necessary. We already know that "x2 < pBox->x2" so the only
struts that are rejected from this check is those that are partially
outside the box vertically and why we would want to reject those?

This is an obvious fix and it's in head now.

@@ -3415,7 +3429,7 @@ outputDeviceForPoint (CompScreen *s,
        x2 = s->outputDev[i].region.extents.x2;
        y2 = s->outputDev[i].region.extents.y2;
 
-       if (x1 < x && x2 >= x && y1 < y && y2 >= y)
+       if (x1 <= x && x2 > x && y1 <= y && y2 > y)
            return i;
     }

Thanks,

-David



More information about the compiz mailing list