diff --git a/unix/menu.c b/unix/menu.c index c1fe5db5..95a92eaa 100644 --- a/unix/menu.c +++ b/unix/menu.c @@ -2514,10 +2514,10 @@ apc_popup( Handle self, int x, int y, Rect *anchor) y = anchor-> top - w-> sz. y; else y = 0; - if ( anchor-> right + w-> sz.x <= guts. displaySize.x) - x = anchor-> right; - else if ( w-> sz.x < anchor-> left) - x = anchor-> left - w-> sz. x; + if ( anchor-> left + w-> sz.x <= guts. displaySize.x) + x = anchor-> left; + else if ( w-> sz.x < anchor-> right) + x = anchor-> right - w-> sz. x; else x = 0; w-> pos. x = x; diff --git a/win32/menu.c b/win32/menu.c index d8587eb3..1a691572 100644 --- a/win32/menu.c +++ b/win32/menu.c @@ -665,7 +665,7 @@ apc_popup( Handle self, int x, int y, Rect * anchor) guts. popup_active = 1; ret = TrackPopupMenuEx( - ( HMENU) var handle, TPM_LEFTBUTTON|TPM_LEFTALIGN|TPM_RIGHTBUTTON, + ( HMENU) var handle, TPM_LEFTBUTTON|TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RIGHTBUTTON, x, y, owner, anchor ? &tpm : NULL); guts. popup_active = 0; return ret;