From 507a064153e5c4d93f729349def4006a81ff3559 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 19 Jan 2023 12:52:25 +0400 Subject: [PATCH] Fix OpenWith dropdown menu positioning on Windows. --- Telegram/SourceFiles/platform/win/file_utilities_win.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/platform/win/file_utilities_win.cpp b/Telegram/SourceFiles/platform/win/file_utilities_win.cpp index ee874015ca..d1b84288dc 100644 --- a/Telegram/SourceFiles/platform/win/file_utilities_win.cpp +++ b/Telegram/SourceFiles/platform/win/file_utilities_win.cpp @@ -230,7 +230,10 @@ bool UnsafeShowOpenWithDropdown(const QString &filepath, QPoint menuPosition) { menuInfo.dwTypeData = nameArr; InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &menuInfo); - int sel = TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, menuPosition.x(), menuPosition.y(), 0, parentHWND, 0); + // menuPosition is incorrect because of devicePixelRatio :( + POINT position; + GetCursorPos(&position); + int sel = TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, position.x, position.y, 0, parentHWND, 0); DestroyMenu(menu); if (sel > 0) {