From 9ee30c57fdcda9788fc83f4193c6755282524e41 Mon Sep 17 00:00:00 2001 From: Doug Lyons Date: Sat, 10 Aug 2024 16:00:44 -0500 Subject: [PATCH] [NTUSER] Fix popup menu placement when part way off right edge of screen (#7220) * Move the popup menu to the right edge of the screen when it is past the screen edge on the right. CORE-19706 --- win32ss/user/ntuser/menu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c index 47cd4fc42b7..6c454ae4d87 100644 --- a/win32ss/user/ntuser/menu.c +++ b/win32ss/user/ntuser/menu.c @@ -2992,16 +2992,14 @@ static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT fl /* We are off the right side of the screen */ if (x + width > monitor->rcMonitor.right) { - if ((x - width) < monitor->rcMonitor.left || x >= monitor->rcMonitor.right) - x = monitor->rcMonitor.right - width; - else - x -= width; + /* Position menu at right edge of the screen */ + x = monitor->rcMonitor.right - width; } /* We are off the left side of the screen */ if (x < monitor->rcMonitor.left) { - /* Position menu at left edge of screen */ + /* Position menu at left edge of the screen */ x = 0; if (x < monitor->rcMonitor.left || x >= monitor->rcMonitor.right || bIsPopup)