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
icc-effect-5.14.5
Thomas Lübking 2013-07-18 16:22:34 +02:00
parent 02ed20662d
commit 0f57c9407a
1 changed files with 14 additions and 7 deletions

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
}