Piotr Caban : comctl32: Don' t ask for WM_MOUSEHOVER messages when LVS_EX_TRACKSELECT was not specified.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Oct 7 10:00:48 CDT 2015
Module: wine
Branch: master
Commit: 4dd26ee814abb66731d075eb871f6367994f2682
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4dd26ee814abb66731d075eb871f6367994f2682
Author: Piotr Caban <piotr at codeweavers.com>
Date: Tue Oct 6 16:19:42 2015 +0200
comctl32: Don't ask for WM_MOUSEHOVER messages when LVS_EX_TRACKSELECT was not specified.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
---
dlls/comctl32/listview.c | 9 +++++++--
dlls/comctl32/tests/listview.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index e3fad51..c0956ad 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -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;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 3edb25a..8573318 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -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))
{
More information about the wine-cvs
mailing list