From d5f153cd0addc7adb79de5f08a4f479497f60c7e Mon Sep 17 00:00:00 2001 From: Dmitry Karasik Date: Wed, 11 Dec 2024 21:27:16 +0100 Subject: [PATCH] minor fix for popup placement --- unix/menu.c | 8 ++++---- win32/menu.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 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;