Reset BUTTON_HASFOCUS state in WM_KILLFOCUS handler before calling ReleaseCapture

Dmitry Timoshkov dmitry at baikal.ru
Tue Sep 7 06:22:31 CDT 2004


Hello,

WM_KILLFOCUS button message handler may call ReleaseCapture, which causes
a button to receive WM_CAPTURECHANGED message. WM_CAPTURECHANGED message
handler in turn resets BUTTON_NSTATES state (as it should). But since
ReleaseCapture is been called by the WM_KILLFOCUS message handler before
resetting BUTTON_HASFOCUS state, BUTTON_NSTATES state gets reverted again.

These all leads to a misbehaviour of an app I'm working on.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Reset BUTTON_HASFOCUS state in WM_KILLFOCUS handler before
    calling ReleaseCapture.

--- cvs/hq/wine/dlls/user/button.c	2004-08-31 10:10:08.000000000 +0900
+++ wine/dlls/user/button.c	2004-09-07 19:54:59.000000000 +0900
@@ -364,11 +364,11 @@ static LRESULT WINAPI ButtonWndProc_comm
 
     case WM_KILLFOCUS:
         state = get_button_state( hWnd );
-        if ((state & BUTTON_BTNPRESSED) && GetCapture() == hWnd)
-            ReleaseCapture();
-
         set_button_state( hWnd, state & ~BUTTON_HASFOCUS );
 	paint_button( hWnd, btn_type, ODA_FOCUS );
+
+        if ((state & BUTTON_BTNPRESSED) && GetCapture() == hWnd)
+            ReleaseCapture();
         break;
 
     case WM_SYSCOLORCHANGE:






More information about the wine-patches mailing list