depend titlebar protection dir pref on cap dir

when visualPixels is not 0, this means the titlebar does
not touch an upper/lower border, thus moving that direction
is ok and protection should be sought horizontally

BUG: 322507
FIXED-IN: 4.11
REVIEW: 111573
This commit is contained in:
Thomas Lübking 2013-07-18 16:22:34 +02:00
parent 02ed20662d
commit 0f57c9407a

View file

@ -56,6 +56,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
static inline int sign(int v) {
return (v > 0) - (v < 0);
}
//********************************************
// Workspace
//********************************************
@ -3009,13 +3013,16 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
}
}
// Move it (Favour vertically)
if (previousMoveResizeGeom.y() != moveResizeGeom.y())
moveResizeGeom.translate(0,
previousMoveResizeGeom.y() > moveResizeGeom.y() ? 1 : -1);
else
moveResizeGeom.translate(previousMoveResizeGeom.x() > moveResizeGeom.x() ? 1 : -1,
0);
int dx = sign(previousMoveResizeGeom.x() - moveResizeGeom.x()),
dy = sign(previousMoveResizeGeom.y() - moveResizeGeom.y());
if (visiblePixels && dx) // means there's no full width cap -> favor horizontally
dy = 0;
else if (dy)
dx = 0;
// Move it back
moveResizeGeom.translate(dx, dy);
if (moveResizeGeom == previousMoveResizeGeom) {
break; // Prevent lockup
}