make popup location calcs xinerama aware. i bet this even closes some BRs. i'm too tired to look for them though. =P

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=773980
This commit is contained in:
Aaron J. Seigo 2008-02-12 09:41:49 +00:00
parent 70b12916b2
commit 5b394a752f

View File

@ -553,6 +553,9 @@ QPoint Widget::popupPosition(const QSize s) const
loc = pv->containment()->location();
}
QRect screenRect = QApplication::desktop()->screenGeometry(pv ? pv->containment()->screen() : -1);
pos += screenRect.topLeft();
switch (loc) {
case BottomEdge:
pos = QPoint(pos.x(), pos.y() - s.height());
@ -575,13 +578,12 @@ QPoint Widget::popupPosition(const QSize s) const
}
//are we out of screen?
QRect screenRect = QApplication::desktop()->screenGeometry(pv->containment()->screen());
if (pos.rx() + s.width() > screenRect.width()) {
pos.rx() -= ((pos.rx() + s.width()) - screenRect.width());
if (pos.rx() + s.width() > screenRect.right()) {
pos.rx() -= ((pos.rx() + s.width()) - screenRect.right());
}
if (pos.ry() + s.height() > screenRect.height()) {
pos.ry() -= ((pos.ry() + s.height()) - screenRect.height());
if (pos.ry() + s.height() > screenRect.bottom()) {
pos.ry() -= ((pos.ry() + s.height()) - screenRect.bottom());
}
pos.rx() = qMax(0, pos.rx());