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 namespace KWin
{ {
static inline int sign(int v) {
return (v > 0) - (v < 0);
}
//******************************************** //********************************************
// Workspace // Workspace
//******************************************** //********************************************
@ -3009,13 +3013,16 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root)
} }
} }
// Move it (Favour vertically) int dx = sign(previousMoveResizeGeom.x() - moveResizeGeom.x()),
if (previousMoveResizeGeom.y() != moveResizeGeom.y()) dy = sign(previousMoveResizeGeom.y() - moveResizeGeom.y());
moveResizeGeom.translate(0, if (visiblePixels && dx) // means there's no full width cap -> favor horizontally
previousMoveResizeGeom.y() > moveResizeGeom.y() ? 1 : -1); dy = 0;
else else if (dy)
moveResizeGeom.translate(previousMoveResizeGeom.x() > moveResizeGeom.x() ? 1 : -1, dx = 0;
0);
// Move it back
moveResizeGeom.translate(dx, dy);
if (moveResizeGeom == previousMoveResizeGeom) { if (moveResizeGeom == previousMoveResizeGeom) {
break; // Prevent lockup break; // Prevent lockup
} }