window snapping now has xinerama support

This commit is contained in:
Dana Jansens 2002-07-22 06:49:12 +00:00
parent 98d4ac78ff
commit debe8a2f74

View file

@ -3035,48 +3035,45 @@ void BlackboxWindow::doMove(int x_root, int y_root) {
} }
} }
// try snap to the screen's available area RectList snaplist; // the list of rects we will try to snap to
Rect srect = screen->availableArea();
int dleft = std::abs(wleft - srect.left()), // snap to the strut (and screen boundaries for xinerama)
dright = std::abs(wright - srect.right()), #ifdef XINERAMA
dtop = std::abs(wtop - srect.top()), if (screen->isXineramaActive() && blackbox->doXineramaSnapping()) {
dbottom = std::abs(wbottom - srect.bottom()); RectList::iterator it, end = screen->allAvailableAreas().end();
for (it = screen->allAvailableAreas().begin(); it != end; ++it)
snaplist.push_back(*it);
} else
#endif // XINERAMA
if (! screen->doFullMax())
snaplist.push_back(screen->availableArea());
// always snap to the screen edges
snaplist.push_back(screen->getRect());
// snap left? RectList::iterator it, end = snaplist.end();
if (dleft < snap_distance && dleft <= dright) for (it = snaplist.begin(); it != end; ++it) {
dx = srect.left(); Rect &srect = *it;
// snap right?
else if (dright < snap_distance)
dx = srect.right() - frame.rect.width() + 1;
// snap top? int dleft = std::abs(wleft - srect.left()),
if (dtop < snap_distance && dtop <= dbottom) dright = std::abs(wright - srect.right()),
dy = srect.top(); dtop = std::abs(wtop - srect.top()),
// snap bottom? dbottom = std::abs(wbottom - srect.bottom());
else if (dbottom < snap_distance)
dy = srect.bottom() - frame.rect.height() + 1;
srect = screen->getRect(); // now get the full screen // snap left?
if (dleft < snap_distance && dleft <= dright)
dx = srect.left();
// snap right?
else if (dright < snap_distance)
dx = srect.right() - frame.rect.width() + 1;
dleft = std::abs(wleft - srect.left()), // snap top?
dright = std::abs(wright - srect.right()), if (dtop < snap_distance && dtop <= dbottom)
dtop = std::abs(wtop - srect.top()), dy = srect.top();
dbottom = std::abs(wbottom - srect.bottom()); // snap bottom?
else if (dbottom < snap_distance)
// snap left? dy = srect.bottom() - frame.rect.height() + 1;
if (dleft < snap_distance && dleft <= dright) }
dx = srect.left();
// snap right?
else if (dright < snap_distance)
dx = srect.right() - frame.rect.width() + 1;
// snap top?
if (dtop < snap_distance && dtop <= dbottom)
dy = srect.top();
// snap bottom?
else if (dbottom < snap_distance)
dy = srect.bottom() - frame.rect.height() + 1;
} }
if (screen->doOpaqueMove()) { if (screen->doOpaqueMove()) {