* Display a popup menu.
*/
static BOOL FASTCALL MENU_ShowPopup(PWND pwndOwner, PMENU menu, UINT id, UINT flags,
- INT x, INT y, INT xanchor, INT yanchor )
+ INT x, INT y)
{
UINT width, height;
POINT pt;
PMONITOR monitor;
PWND pWnd;
USER_REFERENCE_ENTRY Ref;
+ BOOL bIsPopup = (flags & TPM_POPUPMENU) != 0;
- TRACE("owner=%p menu=%p id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x\n",
- pwndOwner, menu, id, x, y, xanchor, yanchor);
+ TRACE("owner=%p menu=%p id=0x%04x x=0x%04x y=0x%04x\n",
+ pwndOwner, menu, id, x, y);
if (menu->iItem != NO_SELECTED_ITEM)
{
pt.y = y;
monitor = UserMonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST );
- if (flags & TPM_LAYOUTRTL)
+ if (flags & TPM_LAYOUTRTL)
flags ^= TPM_RIGHTALIGN;
if( flags & TPM_RIGHTALIGN ) x -= width;
if( x + width > monitor->rcMonitor.right)
{
- if( xanchor && x >= width - xanchor )
- x -= width - xanchor;
-
if( x + width > monitor->rcMonitor.right)
{
/* 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)
+ if (!bIsPopup || x - width < monitor->rcMonitor.left || x > monitor->rcMonitor.right)
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)
+ if (!bIsPopup || x + width > monitor->rcMonitor.right)
x = monitor->rcMonitor.left;
else
x += width;
if( y + height > monitor->rcMonitor.bottom)
{
- if( yanchor && y >= height + yanchor )
- y -= height + yanchor;
-
if( y + height > monitor->rcMonitor.bottom)
{
/* 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)
+ if (!bIsPopup || y - height < monitor->rcMonitor.top || y > monitor->rcMonitor.bottom)
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)
+ if (!bIsPopup || y + height > monitor->rcMonitor.bottom)
y = monitor->rcMonitor.top;
else
y += height;
MENU_InitPopup( WndOwner, Item->spSubMenu, Flags );
MENU_ShowPopup( WndOwner, Item->spSubMenu, Menu->iItem, Flags,
- Rect.left, Rect.top, Rect.right, Rect.bottom );
+ Rect.left, Rect.top);
if (SelectFirst)
{
MENU_MoveSelection(WndOwner, Item->spSubMenu, ITEM_NEXT);
if (menu->fFlags & MNF_SYSMENU)
MENU_InitSysMenuPopup( menu, pWnd->style, pWnd->pcls->style, HTSYSMENU);
- if (MENU_ShowPopup(pWnd, menu, 0, wFlags, x, y, 0, 0 ))
+ if (MENU_ShowPopup(pWnd, menu, 0, wFlags | TPM_POPUPMENU, x, y))
ret = MENU_TrackMenu( menu, wFlags | TPM_POPUPMENU, 0, 0, pWnd,
lpTpm ? &lpTpm->rcExclude : NULL);
else