Nikolay Sivov : user32: Button should get captured when highlighted with VK_SPACE.

Alexandre Julliard julliard at winehq.org
Tue Mar 10 10:53:34 CDT 2009


Module: wine
Branch: master
Commit: 2948ec6a7061bd4f260d60eaa6f44981691e1e7a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2948ec6a7061bd4f260d60eaa6f44981691e1e7a

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Tue Mar 10 07:09:35 2009 -0400

user32: Button should get captured when highlighted with VK_SPACE.

---

 dlls/user32/button.c    |    1 +
 dlls/user32/tests/msg.c |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/button.c b/dlls/user32/button.c
index 84b54ab..f2097aa 100644
--- a/dlls/user32/button.c
+++ b/dlls/user32/button.c
@@ -309,6 +309,7 @@ static LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg,
 	{
 	    SendMessageW( hWnd, BM_SETSTATE, TRUE, 0 );
             set_button_state( hWnd, get_button_state( hWnd ) | BUTTON_BTNPRESSED );
+            SetCapture( hWnd );
 	}
 	break;
 
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 054cc03..ed6a820 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -5213,6 +5213,17 @@ static void test_button_messages(void)
     DWORD dlg_code;
     HFONT zfont;
 
+    /* selection with VK_SPACE should capture button window */
+    hwnd = CreateWindowExA(0, "button", "test", BS_CHECKBOX | WS_VISIBLE | WS_POPUP,
+                           0, 0, 50, 14, 0, 0, 0, NULL);
+    ok(hwnd != 0, "Failed to create button window\n");
+    ReleaseCapture();
+    SetFocus(hwnd);
+    SendMessageA(hwnd, WM_KEYDOWN, VK_SPACE, 0);
+    ok(GetCapture() == hwnd, "Should be captured on VK_SPACE WM_KEYDOWN\n");
+    SendMessageA(hwnd, WM_KEYUP, VK_SPACE, 0);
+    DestroyWindow(hwnd);
+
     subclass_button();
 
     for (i = 0; i < sizeof(button)/sizeof(button[0]); i++)




More information about the wine-cvs mailing list