commit 2948c325918e0b5e08c91ba0b6d5f1b62896d52b
parent 656a67625d00519a625bbb40124d14e6f41d32de
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sun, 29 Oct 2017 09:54:20 -0400
listview: fix header right click detection when list is scrolled on macOS
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/listview.cpp b/src/listview.cpp
@@ -27,6 +27,8 @@
using namespace std;
+bool ListView_GetScroll(HWND, POINT *); // undocumented macOS SWELL function
+
static int adjustWidth(const int points)
{
#ifdef _WIN32
@@ -453,8 +455,14 @@ bool ListView::onContextMenu(HWND dialog, int x, int y)
GetWindowRect(header, &rect);
const int headerHeight = rect.bottom - rect.top;
#else
- // point.y is negative on OS X when hovering the header
- const int headerHeight = 0;
+ // point.y is negative on macOS when hovering the header
+ constexpr int headerHeight = 0;
+
+ #ifdef __APPLE__
+ POINT scroll;
+ ListView_GetScroll(handle(), &scroll);
+ point.y -= scroll.y;
+ #endif
#endif
if(point.y < headerHeight && x != -1) {