Comment 29 for bug 834248

I did some debugging and came up with a patch. I hope a compiz developer can fix this more properly.

I have 4 viewports (Oneiric default). The wall plugin has issues with windows on the outer edges, namely
- the left edge of the top/bottom left workspace
- the right edge of the top/bottom right workspace
- the bottom edge of the left/right bottom workspace

When screen->viewportForGeometry (window->geometry (), viewport); is called in wall.cpp to determine which workspace the window is placed on it returns values such as:
- y=-1 if the window is sitting on the bottom edge of a bottom workspace
- x=2 if the window is sitting on the left edge of a left workspace

In my opinion it is incorrect but I could interpret it that it wants to wrap around so from the top workspace (y=0) if I go up and wrap around (y=-1) then I end up on the bottom workspace (y=1).

The attached patch just calculates the values without wrapping around.

My feeling is that the problem may lie in the core. I did some debugging in the core and I saw that when a window is sitting on the bottom edge centerY=-266 for the window but I don't think it is correct. If I move it a few pixels up it will be something like 500 (on a resultion of 768) which makes more sense. Because of this negative center value the calculated offset in the viewportForGeometry function for y becomes -1 and (rect.centerY () / height ()) + offset=-1 so y=-1 is returned from the viewportForGeometry call. This is core however so i did not want to mess with that method and better reinterpreted the values is the wall plugin.