Jordan Russell's patch: only process mouse drags when we have the
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 29 Dec 2001 14:05:07 +0000 (14:05 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sat, 29 Dec 2001 14:05:07 +0000 (14:05 +0000)
mouse capture, which in turn will only occur if the initial click
was in the PuTTY client area. Prevents mouse drag events without an
initiating click, and also prevents selection occurring at
unexpected moments such as if you move the mouse before releasing
the second click after double-clicking the title bar to maximise the
window.

git-svn-id: svn://svn.tartarus.org/sgt/putty@1515 cda61777-01e9-0310-a592-d414129be87e

window.c

index 5ea24dc..49a7893 100644 (file)
--- a/window.c
+++ b/window.c
@@ -1937,7 +1937,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
         */
        noise_ultralight(lParam);
 
-       if (wParam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON)) {
+       if (wParam & (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON) &&
+           GetCapture() == hwnd) {
            Mouse_Button b;
            if (wParam & MK_LBUTTON)
                b = MBT_LEFT;