window resistance complete
This commit is contained in:
parent
c2b3dc9f71
commit
39bd954b8b
1 changed files with 33 additions and 26 deletions
|
@ -3089,6 +3089,9 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
// the amount of space away from the edge to provide resistance
|
// the amount of space away from the edge to provide resistance
|
||||||
const int resistance_offset = screen->getEdgeSnapThreshold();
|
const int resistance_offset = screen->getEdgeSnapThreshold();
|
||||||
|
|
||||||
|
// find the geomeetery where the moving window currently is
|
||||||
|
const Rect &moving = screen->doOpaqueMove() ? frame.rect : frame.changing;
|
||||||
|
|
||||||
// window corners
|
// window corners
|
||||||
const int wleft = dx,
|
const int wleft = dx,
|
||||||
wright = dx + frame.rect.width() - 1,
|
wright = dx + frame.rect.width() - 1,
|
||||||
|
@ -3132,13 +3135,8 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
|
|
||||||
// if the window is already over top of this snap target, then
|
// if the window is already over top of this snap target, then
|
||||||
// resistance is futile, so just ignore it
|
// resistance is futile, so just ignore it
|
||||||
if (screen->doOpaqueMove()) {
|
if (winrect.intersects(moving))
|
||||||
if (winrect.intersects(frame.rect))
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
|
||||||
if (winrect.intersects(frame.changing))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dleft = wright - winrect.left(),
|
int dleft = wright - winrect.left(),
|
||||||
dright = winrect.right() - wleft,
|
dright = winrect.right() - wleft,
|
||||||
|
@ -3163,13 +3161,20 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
if (snapped) {
|
if (snapped) {
|
||||||
if (screen->getWindowCornerSnap()) {
|
if (screen->getWindowCornerSnap()) {
|
||||||
// try corner-snap to its other sides
|
// try corner-snap to its other sides
|
||||||
dtop = abs(wtop - winrect.top());
|
dtop = winrect.top() - wtop;
|
||||||
dbottom = abs(wbottom - winrect.bottom());
|
dbottom = wbottom - winrect.bottom();
|
||||||
if (dtop < resistance_size && dtop <= dbottom)
|
if (dtop > 0 && dtop < resistance_size) {
|
||||||
|
// if we're already past the top edge, then don't provide
|
||||||
|
// resistance
|
||||||
|
if (moving.top() >= winrect.top())
|
||||||
dy = winrect.top();
|
dy = winrect.top();
|
||||||
else if (dbottom < resistance_size)
|
} else if (dbottom > 0 && dbottom < resistance_size) {
|
||||||
|
// if we're already past the bottom edge, then don't provide
|
||||||
|
// resistance
|
||||||
|
if (moving.bottom() <= winrect.bottom())
|
||||||
dy = winrect.bottom() - frame.rect.height() + 1;
|
dy = winrect.bottom() - frame.rect.height() + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3193,13 +3198,20 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
if (snapped) {
|
if (snapped) {
|
||||||
if (screen->getWindowCornerSnap()) {
|
if (screen->getWindowCornerSnap()) {
|
||||||
// try corner-snap to its other sides
|
// try corner-snap to its other sides
|
||||||
dleft = abs(wleft - winrect.left());
|
dleft = winrect.left() - wleft;
|
||||||
dright = abs(wright - winrect.right());
|
dright = wright - winrect.right();
|
||||||
if (dleft < resistance_size && dleft <= dright)
|
if (dleft > 0 && dleft < resistance_size) {
|
||||||
|
// if we're already past the left edge, then don't provide
|
||||||
|
// resistance
|
||||||
|
if (moving.left() >= winrect.left())
|
||||||
dx = winrect.left();
|
dx = winrect.left();
|
||||||
else if (dright < resistance_size)
|
} else if (dright > 0 && dright < resistance_size) {
|
||||||
|
// if we're already past the right edge, then don't provide
|
||||||
|
// resistance
|
||||||
|
if (moving.right() <= winrect.right())
|
||||||
dx = winrect.right() - frame.rect.width() + 1;
|
dx = winrect.right() - frame.rect.width() + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3224,13 +3236,8 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
|
||||||
const Rect &srect = *it;
|
const Rect &srect = *it;
|
||||||
|
|
||||||
// if we're not in the rectangle then don't snap to it.
|
// if we're not in the rectangle then don't snap to it.
|
||||||
if (screen->doOpaqueMove()) {
|
if (! srect.contains(moving))
|
||||||
if (! srect.contains(frame.rect))
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
|
||||||
if (! srect.contains(frame.changing))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dleft = srect.left() - wleft,
|
int dleft = srect.left() - wleft,
|
||||||
dright = wright - srect.right(),
|
dright = wright - srect.right(),
|
||||||
|
|
Loading…
Reference in a new issue