comctl32: Don't ask for WM_MOUSEHOVER messages when LVS_EX_TRACKSELECT was not specified.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
This commit is contained in:
Piotr Caban 2015-10-06 16:19:42 +02:00 committed by Alexandre Julliard
parent 0b1204d870
commit 4dd26ee814
2 changed files with 48 additions and 2 deletions

View File

@ -4122,6 +4122,7 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
/* see if we are supposed to be tracking mouse hovering */
if (LISTVIEW_IsHotTracking(infoPtr)) {
TRACKMOUSEEVENT trackinfo;
DWORD flags;
trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
trackinfo.dwFlags = TME_QUERY;
@ -4129,8 +4130,12 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
/* see if we are already tracking this hwnd */
_TrackMouseEvent(&trackinfo);
if(!(trackinfo.dwFlags & TME_HOVER) || trackinfo.hwndTrack != infoPtr->hwndSelf) {
trackinfo.dwFlags = TME_HOVER;
flags = TME_LEAVE;
if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
flags |= TME_HOVER;
if((trackinfo.dwFlags & flags) != flags || trackinfo.hwndTrack != infoPtr->hwndSelf) {
trackinfo.dwFlags = flags;
trackinfo.dwHoverTime = infoPtr->dwHoverTime;
trackinfo.hwndTrack = infoPtr->hwndSelf;

View File

@ -5745,6 +5745,46 @@ static void test_header_proc(void)
DestroyWindow(hwnd);
}
static void test_oneclickactivate(void)
{
char item1[] = "item1";
LVITEMA item;
HWND hwnd, fg;
INT r;
hwnd = CreateWindowExA(0, "SysListView32", "foo", WS_VISIBLE|WS_CHILD|LVS_LIST,
10, 10, 100, 200, hwndparent, NULL, NULL, NULL);
ok(hwnd != NULL, "failed to create listview window\n");
r = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_ONECLICKACTIVATE);
ok(r == 0, "should return zero\n");
SetForegroundWindow(hwndparent);
fg = GetForegroundWindow();
if (fg != hwndparent)
{
skip("Window is not in the foreground. Skipping oneclickactivate tests.\n");
DestroyWindow(hwnd);
return;
}
item.mask = LVIF_TEXT;
item.iItem = 0;
item.iSubItem = 0;
item.iImage = 0;
item.pszText = item1;
r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item);
ok(r == 0, "should not fail\n");
r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
expect(0, r);
r = SendMessageA(hwnd, WM_MOUSEHOVER, MAKELONG(1, 1), 0);
expect(0, r);
r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
expect(1, r);
DestroyWindow(hwnd);
}
START_TEST(listview)
{
HMODULE hComctl32;
@ -5814,6 +5854,7 @@ START_TEST(listview)
test_deleteitem();
test_insertitem();
test_header_proc();
test_oneclickactivate();
if (!load_v6_module(&ctx_cookie, &hCtx))
{