From 45fb34790e6a2efa1678dad5b0206785df9bb953 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 9 Sep 2019 15:53:59 +0200 Subject: ui: fix popup menu placement in syntaxedit When pop-up menu is invoked using keyboard, the coordinates are (-1,-1). However, LOWORD/HIWORD return (65535, 65535). Signed-off-by: Simon Rozman --- ui/syntax/syntaxedit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/syntax/syntaxedit.c b/ui/syntax/syntaxedit.c index c04c1f8a..70ebca63 100644 --- a/ui/syntax/syntaxedit.c +++ b/ui/syntax/syntaxedit.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -281,8 +282,8 @@ static void context_menu(HWND hWnd, INT x, INT y) if (x == -1 && y == -1) { RECT rect; GetWindowRect(hWnd, &rect); - x = rect.left + (rect.right - rect.left) / 2; - y = rect.top + (rect.bottom - rect.top) / 2; + x = (rect.left + rect.right) / 2; + y = (rect.top + rect.bottom) / 2; } if (GetFocus() != hWnd) @@ -356,7 +357,7 @@ static LRESULT CALLBACK child_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP break; } case WM_CONTEXTMENU: - context_menu(hWnd, LOWORD(lParam), HIWORD(lParam)); + context_menu(hWnd, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return 0; case WM_THEMECHANGED: highlight_text(hWnd); -- cgit v1.2.3-59-g8ed1b