From: Mark Jansen Date: Wed, 7 Aug 2019 20:14:58 +0000 (+0200) Subject: [WIN32SS] Do not propagate TPM_VERTICAL to sub-menus X-Git-Tag: 0.4.14-dev~412 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=84e263ceb231c3ae46ba12c5aea677ba53d8d2fa [WIN32SS] Do not propagate TPM_VERTICAL to sub-menus With this change we can remove the workaround from the off-screen menus dropping below their parent. Many thanks to Joachim for his help debugging / testing this. CORE-16297 --- diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c index a4e76511431..724501c2c5a 100644 --- a/win32ss/user/ntuser/menu.c +++ b/win32ss/user/ntuser/menu.c @@ -2879,8 +2879,10 @@ static void DebugRect(const RECT* rectl, COLORREF color) static void DebugPoint(INT x, INT y, COLORREF color) { - RECT rr = {x, y, x, y}; - DebugRect(&rr, color); + RECT r1 = {x-10, y, x+10, y}; + RECT r2 = {x, y-10, x, y+10}; + DebugRect(&r1, color); + DebugRect(&r2, color); } #endif @@ -3047,9 +3049,6 @@ static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT fl TPM_BOTTOMALIGN | TPM_RIGHTALIGN | TPM_VERTICAL, /* Then the other side again (still swapped hor/ver) */ }; - /* We should first try left / right, this flag is not needed as input */ - UINT tryFlags = flags & ~TPM_VERTICAL; - UINT n; for (n = 0; n < RTL_NUMBER_OF(flag_mods); ++n) { @@ -3057,7 +3056,7 @@ static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT fl INT ty = y; /* Try to move a bit around */ - if (MENU_MoveRect(tryFlags ^ flag_mods[n], &tx, &ty, width, height, &Cleaned, monitor) && + if (MENU_MoveRect(flags ^ flag_mods[n], &tx, &ty, width, height, &Cleaned, monitor) && !RECTL_Intersect(&Cleaned, tx, ty, width, height)) { x = tx; @@ -3447,6 +3446,12 @@ static PMENU FASTCALL MENU_ShowSubPopup(PWND WndOwner, PMENU Menu, BOOL SelectFi } } + /* Next menu does not need to be shown vertical anymore */ + if (Menu->fFlags & MNF_POPUP) + Flags &= (~TPM_VERTICAL); + + + /* use default alignment for submenus */ Flags &= ~(TPM_CENTERALIGN | TPM_RIGHTALIGN | TPM_VCENTERALIGN | TPM_BOTTOMALIGN); @@ -4471,7 +4476,7 @@ static BOOL FASTCALL MENU_ExitTracking(PWND pWnd, BOOL bPopup, UINT wFlags) VOID MENU_TrackMouseMenuBar( PWND pWnd, ULONG ht, POINT pt) { PMENU pMenu = (ht == HTSYSMENU) ? IntGetSystemMenu(pWnd, FALSE) : IntGetMenu( UserHMGetHandle(pWnd) ); // See 74276 and CORE-12801 - UINT wFlags = TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON; + UINT wFlags = TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_VERTICAL; TRACE("wnd=%p ht=0x%04x (%ld,%ld)\n", pWnd, ht, pt.x, pt.y);