Nikolay Sivov : comctl32/listview: Add NM_HOVER notification.

Alexandre Julliard julliard at winehq.org
Mon Nov 30 10:42:49 CST 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Fri Nov 27 23:05:43 2009 +0300

comctl32/listview: Add NM_HOVER notification.

---

 dlls/comctl32/listview.c       |    9 ++++++---
 dlls/comctl32/tests/listview.c |   36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 6d563b7..97bf05a 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -99,7 +99,6 @@
  *   -- LVN_GETINFOTIP
  *   -- LVN_HOTTRACK
  *   -- LVN_SETDISPINFO
- *   -- NM_HOVER
  *   -- LVN_BEGINRDRAG
  *
  * Messages:
@@ -3654,18 +3653,22 @@ static inline BOOL LISTVIEW_IsHotTracking(const LISTVIEW_INFO *infoPtr)
  */
 static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)
 {
+    NMHDR hdr;
+
+    if (notify_hdr(infoPtr, NM_HOVER, &hdr)) return 0;
+
     if (LISTVIEW_IsHotTracking(infoPtr))
     {
         LVITEMW item;
         POINT pt;
 
-        SetFocus(infoPtr->hwndSelf);
-
         pt.x = x;
         pt.y = y;
 
         if (LISTVIEW_GetItemAtPt(infoPtr, &item, pt))
             LISTVIEW_SetSelection(infoPtr, item.iItem);
+
+        SetFocus(infoPtr->hwndSelf);
     }
 
     return 0;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 651b941..0b55a23 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -46,7 +46,9 @@ static const WCHAR testparentclassW[] =
 
 HWND hwndparent, hwndparentW;
 /* prevents edit box creation, LVN_BEGINLABELEDIT return value */
-BOOL blockEdit;
+static BOOL blockEdit;
+/* return nonzero on NM_HOVER */
+static BOOL g_block_hover;
 /* dumps LVN_ITEMCHANGED message data */
 static BOOL g_dump_itemchanged;
 /* format reported to control:
@@ -278,6 +280,12 @@ static const struct message edit_end_nochange[] = {
     { 0 }
 };
 
+static const struct message hover_parent[] = {
+    { WM_GETDLGCODE, sent }, /* todo_wine */
+    { WM_NOTIFY, sent|id, 0, 0, NM_HOVER },
+    { 0 }
+};
+
 static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     static LONG defwndproc_counter = 0;
@@ -344,6 +352,9 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
                          nmlv->iItem, nmlv->uNewState, nmlv->uOldState, nmlv->uChanged);
               }
               break;
+          case NM_HOVER:
+              if (g_block_hover) return 1;
+              break;
           }
           break;
       }
@@ -4247,6 +4258,28 @@ static void test_LVS_EX_HEADERINALLVIEWS(void)
     DestroyWindow(hwnd);
 }
 
+static void test_hover(void)
+{
+    HWND hwnd;
+    DWORD r;
+
+    hwnd = create_custom_listview_control(LVS_ICON);
+
+    /* test WM_MOUSEHOVER forwarding */
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    r = SendMessage(hwnd, WM_MOUSEHOVER, 0, 0);
+    expect(0, r);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER allow test", TRUE);
+    g_block_hover = TRUE;
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    r = SendMessage(hwnd, WM_MOUSEHOVER, 0, 0);
+    expect(0, r);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, hover_parent, "NM_HOVER block test", TRUE);
+    g_block_hover = FALSE;
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(listview)
 {
     HMODULE hComctl32;
@@ -4306,6 +4339,7 @@ START_TEST(listview)
     test_getcolumnwidth();
     test_approximate_viewrect();
     test_finditem();
+    test_hover();
 
     if (!load_v6_module(&ctx_cookie, &hCtx))
     {




More information about the wine-cvs mailing list