aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-09-09 15:53:59 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-09-13 12:07:36 -0400
commit45fb34790e6a2efa1678dad5b0206785df9bb953 (patch)
tree925c7cb8986207789c6ef6d98d16c6ed58e3d83d /ui
parentui: cleanup (diff)
downloadwireguard-windows-45fb34790e6a2efa1678dad5b0206785df9bb953.tar.xz
wireguard-windows-45fb34790e6a2efa1678dad5b0206785df9bb953.zip
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 <simon@rozman.si>
Diffstat (limited to 'ui')
-rw-r--r--ui/syntax/syntaxedit.c7
1 files 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 <string.h>
#include <assert.h>
#include <windows.h>
+#include <windowsx.h>
#include <richedit.h>
#include <richole.h>
#include <tom.h>
@@ -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);