The little things screw up
Posted on Jul 13, 2009
I had this really weird bug in kwin for half a week. When you started resizing windows, all of them would start dancing about the screen. There would be little gaps between them and so on. And I couldn't figure out why. So today I finally tried comparing ( x + width ) and ( right ) of a window. Turns out they are always off by one. So to the QRect::right() documentation:
Returns the x-coordinate of the rectangle's right edge.
Note that for historical reasons this function returns left() + width() - 1; use x() + width() to retrieve the true x-coordinate.
Argh! That ( and bottom() ) was causing the mess. What a relief.