summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qmenu.cpp')
-rw-r--r--src/gui/widgets/qmenu.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index b752ae2..3ea783f 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1913,9 +1913,10 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
pos.setX(screen.left() + desktopFrame);
}
if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) {
- const int bestPos = (snapToMouse ? mouse.y() : p.y()) - desktopFrame - size.height() + 1;
- const int fallbackPos = screen.bottom() - desktopFrame - size.height() + 1;
- pos.setY(qMin(bestPos, fallbackPos));
+ if(snapToMouse)
+ pos.setY(qMin(mouse.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
+ else
+ pos.setY(qMax(p.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
} else if (pos.y() < screen.top() + desktopFrame) {
pos.setY(screen.top() + desktopFrame);
}