From be7a9d16ea3fa4840b8959de45a64686014618dc Mon Sep 17 00:00:00 2001
From: Rein Klazes <rklazes@casema.net>
Date: Sat, 5 Jun 1999 08:54:27 +0000
Subject: [PATCH] Do not process WM_LBUTTONUP message in ButtonWndProc() when
 the mouse is not captured.

---
 controls/button.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/controls/button.c b/controls/button.c
index 9b49d85aedc..aa8f0f72bed 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -143,6 +143,8 @@ static inline LRESULT WINAPI ButtonWndProc_locked(WND* wndPtr, UINT uMsg,
         break;
 
     case WM_LBUTTONUP:
+	/* FIXME: real windows uses extra flags in the status for this */
+        if (GetCapture() != hWnd) break;
         ReleaseCapture();
         if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
         SendMessageA( hWnd, BM_SETSTATE, FALSE, 0 );
-- 
GitLab