diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index 8a1c2354..fc568556 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -555,7 +555,7 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam GetClientRect(edit, &r); if (!PtInRect(&r, pt)) pt.x = pt.y = 0; MapWindowPoints(edit, HWND_DESKTOP, &pt, 1); - TrackPopupMenu(g_sdata.editSubmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_sdata.hwnd, 0); + TrackPopupMenu(g_sdata.editSubmenu, GetMenuDropAlignment() | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_sdata.hwnd, 0); } break; case TBN_DROPDOWN: diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index 2efd1953..4f0e0df1 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -38,6 +38,7 @@ #define SupportsW9X() ( sizeof(TCHAR) == 1 ) #define SupportsW95() ( FALSE && SupportsW9X() && !DpiAwarePerMonitor() ) #define SupportsW2000() ( sizeof(void*) == 4 ) +#define SupportsRTLUI() ( FALSE ) // UI is English only static inline bool IsWin9598ME() { return SupportsW9X() && (int) GetVersion() < 0; } static inline bool IsWin95() { return SupportsW95() && (GetVersion() & (0x8000FFFF & ~0x0300)) == 0x80000004; } diff --git a/Contrib/Makensisw/toolbar.cpp b/Contrib/Makensisw/toolbar.cpp index 18d0937c..6a72ff62 100644 --- a/Contrib/Makensisw/toolbar.cpp +++ b/Contrib/Makensisw/toolbar.cpp @@ -195,16 +195,18 @@ void EnableToolBarButton(int cmdid, BOOL enabled) SendMessage(g_toolbar.hwnd, TB_SETSTATE, cmdid, MAKELPARAM(state, 0)); } -static UINT IsRTL(HWND hWnd) { return ((UINT) GetWindowLongPtr(hWnd, GWL_EXSTYLE)) & (WS_EX_LAYOUTRTL); } // WS_EX_RIGHT? WS_EX_RTLREADING? +static bool IsRTL(HWND hWnd) { return (((UINT) GetWindowLongPtr(hWnd, GWL_EXSTYLE)) & (WS_EX_LAYOUTRTL)) != 0; } // WS_EX_RIGHT? WS_EX_RTLREADING? static UINT GetToolbarDropdownMenuPos(HWND hTB, UINT Id, POINT&pt) { RECT r; INT_PTR idx = SendMessage(hTB, TB_COMMANDTOINDEX, Id, 0); + UINT tpm_align = GetMenuDropAlignment(); + bool ralign = tpm_align != TPM_LEFTALIGN, rtl = SupportsRTLUI() && IsRTL(hTB); SendMessage(hTB, TB_GETITEMRECT, idx, (LPARAM) &r); MapWindowPoints(hTB, NULL, (POINT*) &r, 2); - pt.x = IsRTL(hTB) ? r.right : r.left, pt.y = r.bottom; - return GetSystemMetrics(SM_MENUDROPALIGNMENT) ? TPM_RIGHTALIGN : TPM_LEFTALIGN; + pt.x = (rtl ^ ralign) ? r.right : r.left, pt.y = r.bottom; + return tpm_align | (rtl ? TPM_LAYOUTRTL : 0) | TPM_VERTICAL; } static void ShowToolbarDropdownMenu(const NMTOOLBAR&nmtb, HWND hNotifyWnd, HMENU hParentMenu, UINT SubMenuId = -1) diff --git a/Contrib/Makensisw/utils.h b/Contrib/Makensisw/utils.h index 01477276..8a82f28b 100644 --- a/Contrib/Makensisw/utils.h +++ b/Contrib/Makensisw/utils.h @@ -138,6 +138,7 @@ bool FileExists(const TCHAR *fname); bool OpenUrlInDefaultBrowser(HWND hwnd, LPCSTR Url); HMENU FindSubMenu(HMENU hMenu, UINT uId); +static UINT GetMenuDropAlignment() { return GetSystemMetrics(SM_MENUDROPALIGNMENT) ? TPM_RIGHTALIGN : TPM_LEFTALIGN; } typedef enum { CFF_RAWSIZE = 0x00, CFF_DPIPT = 0x01, CFF_DPIFROMHWND = 0x02 } CREATEFONTFLAGS; HFONT CreateFontHelper(INT_PTR Data, int Height, DWORD p1, LPCTSTR Face);