From fef6b31b994befac0ee14391572ebc2b9b33e104 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 1 Feb 2018 14:40:46 +0100 Subject: GTK: fix menu positioning on high-DPI The target position is passed in physical native pixels, so call QPlatformWindow::mapToGlobal() instead of QWindow::mapToGlobal(). The latter operates on logical pixels. Task-number: QTBUG-55251 Change-Id: I789128a0a345d4113fced82ed1b215fe14044634 Reviewed-by: Friedemann Kleint --- src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 99407a21de..cdd1abaf7d 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -41,6 +41,7 @@ #include #include +#include #undef signals #include @@ -450,8 +451,9 @@ void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, m_targetPos = QPoint(targetRect.x(), targetRect.y() + targetRect.height()); - if (parentWindow) - m_targetPos = parentWindow->mapToGlobal(m_targetPos); + QPlatformWindow *pw = parentWindow ? parentWindow->handle() : nullptr; + if (pw) + m_targetPos = pw->mapToGlobal(m_targetPos); gtk_menu_popup(GTK_MENU(m_menu), NULL, NULL, qt_gtk_menu_position_func, this, 0, gtk_get_current_event_time()); } -- cgit v1.2.3