[comctl32] Fix listview item activate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch sends and fills a correct item activate notify message
struct. 
Thanks Dimitrie O. Paun for the help.

Changelog:
   * When an item is activated, we should send a NMITEMACTIVATE struct
and not a NMHDR one.

-- 
Maxime Bellengà <maxime.bellenge@laposte.net>
Index: wine/dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.366
diff -u -r1.366 listview.c
--- wine/dlls/comctl32/listview.c	17 Sep 2003 20:15:21 -0000	1.366
+++ wine/dlls/comctl32/listview.c	20 Sep 2003 16:12:14 -0000
@@ -735,9 +735,36 @@
     return notify_hdr(infoPtr, code, &nmh);
 }
 
-static inline void notify_itemactivate(LISTVIEW_INFO *infoPtr)
+static inline void notify_itemactivate(LISTVIEW_INFO *infoPtr, LVHITTESTINFO *htInfo)
 {
-    notify(infoPtr, LVN_ITEMACTIVATE);
+    NMITEMACTIVATE nmia;
+    LVITEMW item;
+
+    if (htInfo) {
+      nmia.uNewState = 0;
+      nmia.uOldState = 0;
+      nmia.uChanged  = 0;
+      nmia.uKeyFlags = 0;
+      
+      item.mask = LVIF_PARAM|LVIF_STATE;
+      item.iItem = htInfo->iItem;
+      item.iSubItem = 0;
+      if (LISTVIEW_GetItemT(infoPtr, &item, TRUE)) {
+	  nmia.lParam = item.lParam;
+ 	  nmia.uOldState = item.state;
+	  nmia.uNewState = item.state | LVIS_ACTIVATING;
+	  nmia.uChanged  = LVIF_STATE;
+      }
+      
+      nmia.iItem = htInfo->iItem;
+      nmia.iSubItem = htInfo->iSubItem;
+      nmia.ptAction = htInfo->pt;     
+      
+      if (GetKeyState(VK_SHIFT) & 0x8000) nmia.uKeyFlags |= LVKF_SHIFT;
+      if (GetKeyState(VK_CONTROL) & 0x8000) nmia.uKeyFlags |= LVKF_CONTROL;
+      if (GetKeyState(VK_MENU) & 0x8000) nmia.uKeyFlags |= LVKF_ALT;
+    }
+    notify_hdr(infoPtr, LVN_ITEMACTIVATE, (LPNMHDR)&nmia);
 }
 
 static inline LRESULT notify_listview(LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
@@ -7677,7 +7704,7 @@
     notify_click(infoPtr, NM_DBLCLK, &htInfo);
 
     /* To send the LVN_ITEMACTIVATE, it must be on an Item */
-    if(htInfo.iItem != -1) notify(infoPtr, LVN_ITEMACTIVATE);
+    if(htInfo.iItem != -1) notify_itemactivate(infoPtr,&htInfo);
 
     return 0;
 }
Index: wine/include/commctrl.h
===================================================================
RCS file: /home/wine/wine/include/commctrl.h,v
retrieving revision 1.117
diff -u -r1.117 commctrl.h
--- wine/include/commctrl.h	17 Sep 2003 20:15:21 -0000	1.117
+++ wine/include/commctrl.h	20 Sep 2003 16:12:21 -0000
@@ -3069,6 +3069,10 @@
     UINT uKeyFlags;
 } NMITEMACTIVATE, *LPNMITEMACTIVATE;
 
+#define LVKF_ALT     0x0001
+#define LVKF_CONTROL 0x0002
+#define LVKF_SHIFT   0x0004
+
 typedef struct tagLVDISPINFO
 {
     NMHDR hdr;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux