mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[0.4.11] [WIN32K:NTUSER] Find a better position for a menu that is off-screen
Previously, we would just stick the menu on the edge of the screen.
We should actually try to flip the menu around the point of origin,
and only when that fails move it to the edge of the screen.
CORE-15001
CORE-9037
cherry picked from commit 0.4.12-dev-346-g
d2626f0c2a
This commit is contained in:
parent
ff0886db4b
commit
1d47cfdc1d
1 changed files with 30 additions and 4 deletions
|
@ -2903,9 +2903,22 @@ static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT fl
|
|||
x -= width - xanchor;
|
||||
|
||||
if( x + width > monitor->rcMonitor.right)
|
||||
x = monitor->rcMonitor.right - width;
|
||||
{
|
||||
/* If we would flip around our origin, would we go off screen on the other side? */
|
||||
if (x - width < monitor->rcMonitor.left)
|
||||
x = monitor->rcMonitor.right - width;
|
||||
else
|
||||
x -= width;
|
||||
}
|
||||
}
|
||||
if( x < monitor->rcMonitor.left )
|
||||
{
|
||||
/* If we would flip around our origin, would we go off screen on the other side? */
|
||||
if (x + width > monitor->rcMonitor.right)
|
||||
x = monitor->rcMonitor.left;
|
||||
else
|
||||
x += width;
|
||||
}
|
||||
if( x < monitor->rcMonitor.left ) x = monitor->rcMonitor.left;
|
||||
|
||||
if( y + height > monitor->rcMonitor.bottom)
|
||||
{
|
||||
|
@ -2913,9 +2926,22 @@ static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT fl
|
|||
y -= height + yanchor;
|
||||
|
||||
if( y + height > monitor->rcMonitor.bottom)
|
||||
y = monitor->rcMonitor.bottom - height;
|
||||
{
|
||||
/* If we would flip around our origin, would we go off screen on the other side? */
|
||||
if (y - height < monitor->rcMonitor.top)
|
||||
y = monitor->rcMonitor.bottom - height;
|
||||
else
|
||||
y -= height;
|
||||
}
|
||||
}
|
||||
if( y < monitor->rcMonitor.top )
|
||||
{
|
||||
/* If we would flip around our origin, would we go off screen on the other side? */
|
||||
if (y + height > monitor->rcMonitor.bottom)
|
||||
y = monitor->rcMonitor.top;
|
||||
else
|
||||
y += height;
|
||||
}
|
||||
if( y < monitor->rcMonitor.top ) y = monitor->rcMonitor.top;
|
||||
|
||||
pWnd = ValidateHwndNoErr( menu->hWnd );
|
||||
|
||||
|
|
Loading…
Reference in a new issue