summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-01-01 17:35:09 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-01-01 17:35:09 +0100
commita5a07b092bec2e3ff870048c8bf0cf8555e7aca0 (patch)
tree329373136a1c3d7187b3b4cb15705c46185fa5d2
parent21e39758b18049440280664afee8131f8f795525 (diff)
Fix button event direction on double clicks on Windows.
-rw-r--r--plugingui/nativewindow_win32.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugingui/nativewindow_win32.cc b/plugingui/nativewindow_win32.cc
index 57302eb..f2094af 100644
--- a/plugingui/nativewindow_win32.cc
+++ b/plugingui/nativewindow_win32.cc
@@ -153,6 +153,11 @@ LRESULT CALLBACK NativeWindowWin32::dialogProc(HWND hwnd, UINT msg,
break; // unknown button
}
+ // Double-clicking the a mouse button actually generates a sequence
+ // of four messages: WM_xBUTTONDOWN, WM_xBUTTONUP, WM_xBUTTONDBLCLK, and
+ // WM_xBUTTONUP. In other words the second WM_xBUTTONDOWN is replaced by a
+ // WM_xBUTTONDBLCLK. We simply 'return it' as a WM_xBUTTONDOWN but set the
+ // doubleClick boolean hint accordingly.
if(msg == WM_LBUTTONUP ||
msg == WM_RBUTTONUP ||
msg == WM_MBUTTONUP)
@@ -161,7 +166,10 @@ LRESULT CALLBACK NativeWindowWin32::dialogProc(HWND hwnd, UINT msg,
}
else if(msg == WM_LBUTTONDOWN ||
msg == WM_RBUTTONDOWN ||
- msg == WM_MBUTTONDOWN)
+ msg == WM_MBUTTONDOWN ||
+ msg == WM_LBUTTONDBLCLK ||
+ msg == WM_RBUTTONDBLCLK ||
+ msg == WM_MBUTTONDBLCLK)
{
buttonEvent->direction = Direction::down;
}