put menus nearer the menu if they are positioned awkwardly

svn path=/trunk/KDE/kdelibs/; revision=1124355
This commit is contained in:
Aaron J. Seigo 2010-05-08 23:17:17 +00:00
parent 64238f5f7e
commit 19a9d2f4f6

View File

@ -765,6 +765,15 @@ bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &scr
if (applet && isPanelContainment()) {
desktopMenu.adjustSize();
pos = applet->popupPosition(desktopMenu.size());
if (formFactor == Vertical) {
if (pos.y() + desktopMenu.height() < screenPos.y()) {
pos.setY(screenPos.y());
}
} else if (formFactor == Horizontal) {
if (pos.x() + desktopMenu.width() < screenPos.x()) {
pos.setX(screenPos.x());
}
}
}
desktopMenu.exec(pos);
return true;