user32: If the listbox loses focus while holding capture, release it by essentially simulating a button up event.
This commit is contained in:
parent
5782bac2a0
commit
fb298aed04
|
@ -2995,6 +2995,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
|
||||||
SEND_NOTIFICATION( descr, LBN_SETFOCUS );
|
SEND_NOTIFICATION( descr, LBN_SETFOCUS );
|
||||||
return 0;
|
return 0;
|
||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
|
LISTBOX_HandleLButtonUp( descr ); /* Release capture if we have it */
|
||||||
descr->in_focus = FALSE;
|
descr->in_focus = FALSE;
|
||||||
descr->wheel_remain = 0;
|
descr->wheel_remain = 0;
|
||||||
if ((descr->focus_item != -1) && descr->caret_on)
|
if ((descr->focus_item != -1) && descr->caret_on)
|
||||||
|
|
|
@ -234,6 +234,8 @@ static void check_item_height(void)
|
||||||
DestroyWindow (hLB);
|
DestroyWindow (hLB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int got_selchange;
|
||||||
|
|
||||||
static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
|
@ -267,6 +269,10 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
if (HIWORD( wparam ) == LBN_SELCHANGE) got_selchange++;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1588,6 +1594,29 @@ todo_wine
|
||||||
DestroyWindow(parent);
|
DestroyWindow(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_missing_lbuttonup( void )
|
||||||
|
{
|
||||||
|
HWND listbox, parent, capture;
|
||||||
|
|
||||||
|
parent = create_parent();
|
||||||
|
listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent);
|
||||||
|
|
||||||
|
/* Send button down without a corresponding button up */
|
||||||
|
SendMessageA(listbox, WM_LBUTTONDOWN, 0, MAKELPARAM(10,10));
|
||||||
|
capture = GetCapture();
|
||||||
|
ok(capture == listbox, "got %p expected %p\n", capture, listbox);
|
||||||
|
|
||||||
|
/* Capture is released and LBN_SELCHANGE sent during WM_KILLFOCUS */
|
||||||
|
got_selchange = 0;
|
||||||
|
SetFocus(NULL);
|
||||||
|
capture = GetCapture();
|
||||||
|
ok(capture == NULL, "got %p\n", capture);
|
||||||
|
ok(got_selchange, "got %d\n", got_selchange);
|
||||||
|
|
||||||
|
DestroyWindow(listbox);
|
||||||
|
DestroyWindow(parent);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(listbox)
|
START_TEST(listbox)
|
||||||
{
|
{
|
||||||
const struct listbox_test SS =
|
const struct listbox_test SS =
|
||||||
|
@ -1668,4 +1697,5 @@ START_TEST(listbox)
|
||||||
test_listbox_dlgdir();
|
test_listbox_dlgdir();
|
||||||
test_set_count();
|
test_set_count();
|
||||||
test_GetListBoxInfo();
|
test_GetListBoxInfo();
|
||||||
|
test_missing_lbuttonup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue