https://git.reactos.org/?p=reactos.git;a=commitdiff;h=007ec0310c0de0387d6ec…
commit 007ec0310c0de0387d6ec69e059d1237f207ad1d
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Mon Jan 14 20:49:23 2019 +0100
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Tue Jan 15 14:34:53 2019 +0200
[WIN32K:NTUSER] Fix a case where the menu was off-screen on the other side
Found by Denis Malikov
CORE-15001
CORE-9037
---
win32ss/user/ntuser/menu.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/win32ss/user/ntuser/menu.c b/win32ss/user/ntuser/menu.c
index b8177594df..eb8874c0cb 100644
--- a/win32ss/user/ntuser/menu.c
+++ b/win32ss/user/ntuser/menu.c
@@ -2912,8 +2912,9 @@ static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT
id, UINT fl
if( x + width > monitor->rcMonitor.right)
{
- /* If we would flip around our origin, would we go off screen on the other
side? */
- if (x - width < monitor->rcMonitor.left)
+ /* If we would flip around our origin, would we go off screen on the other
side?
+ Or is our origin itself too far to the right already? */
+ if (x - width < monitor->rcMonitor.left || x >
monitor->rcMonitor.right)
x = monitor->rcMonitor.right - width;
else
x -= width;
@@ -2935,8 +2936,9 @@ static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT
id, UINT fl
if( y + height > monitor->rcMonitor.bottom)
{
- /* If we would flip around our origin, would we go off screen on the other
side? */
- if (y - height < monitor->rcMonitor.top)
+ /* If we would flip around our origin, would we go off screen on the other
side?
+ Or is our origin itself too far to the bottom already? */
+ if (y - height < monitor->rcMonitor.top || y >
monitor->rcMonitor.bottom)
y = monitor->rcMonitor.bottom - height;
else
y -= height;