Treeview notifications fix

Dimitrie O. Paun dpaun at rogers.com
Tue Oct 29 08:14:04 CST 2002


Dustin asked me nicely, could not resist.
Should fix bug http://bugs.winehq.org/show_bug.cgi?id=1073.

ChangeLog
  Send the right notification code (A/W) depending on the Unicode setting.

Index: dlls/comctl32/treeview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.106
diff -u -r1.106 treeview.c
--- dlls/comctl32/treeview.c	25 Oct 2002 19:09:02 -0000	1.106
+++ dlls/comctl32/treeview.c	29 Oct 2002 14:11:34 -0000
@@ -412,6 +412,16 @@
 
 /* Notifications ************************************************************/
 
+static INT get_notifycode(TREEVIEW_INFO *infoPtr, INT code)
+{
+    if (infoPtr->bNtfUnicode) {
+	if ( code >= (TVN_FIRST + TVN_LAST) / 2) code -= (TVN_FIRST - TVN_LAST) / 2;
+    } else {
+	if ( code < (TVN_FIRST + TVN_LAST) / 2) code += (TVN_FIRST - TVN_LAST) / 2;
+    }
+    return code;
+}
+
 static LRESULT
 TREEVIEW_SendRealNotify(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 {
@@ -429,10 +439,10 @@
     NMHDR nmhdr;
     HWND hwnd = infoPtr->hwnd;
 
-    TRACE("%x\n", code);
+    TRACE("%d\n", code);
     nmhdr.hwndFrom = hwnd;
     nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
-    nmhdr.code = code;
+    nmhdr.code = get_notifycode(infoPtr, code);
 
     return (BOOL)TREEVIEW_SendRealNotify(infoPtr,
 				  (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr);
@@ -476,14 +486,14 @@
     NMTREEVIEWA nmhdr;
     BOOL ret;
 
-    TRACE("code:%x action:%x olditem:%p newitem:%p\n",
+    TRACE("code:%d action:%x olditem:%p newitem:%p\n",
 	  code, action, oldItem, newItem);
 
     ZeroMemory(&nmhdr, sizeof(NMTREEVIEWA));
 
     nmhdr.hdr.hwndFrom = hwnd;
     nmhdr.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
-    nmhdr.hdr.code = code;
+    nmhdr.hdr.code = get_notifycode(infoPtr, code);
     nmhdr.action = action;
 
     if (oldItem)
@@ -512,11 +522,11 @@
     HWND hwnd = infoPtr->hwnd;
     NMTREEVIEWA nmhdr;
 
-    TRACE("code:%x dragitem:%p\n", code, dragItem);
+    TRACE("code:%d dragitem:%p\n", code, dragItem);
 
     nmhdr.hdr.hwndFrom = hwnd;
     nmhdr.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
-    nmhdr.hdr.code = code;
+    nmhdr.hdr.code = get_notifycode(infoPtr, code);
     nmhdr.action = 0;
     nmhdr.itemNew.mask = TVIF_STATE | TVIF_PARAM | TVIF_HANDLE;
     nmhdr.itemNew.hItem = dragItem;
@@ -623,7 +633,7 @@
 
     tvdi.hdr.hwndFrom = hwnd;
     tvdi.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
-    tvdi.hdr.code = TVN_BEGINLABELEDITA;
+    tvdi.hdr.code = get_notifycode(infoPtr, TVN_BEGINLABELEDITA);
 
     tvdi.item.mask = TVIF_HANDLE | TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
     tvdi.item.hItem = editItem;
@@ -3628,7 +3638,7 @@
 
     tvdi.hdr.hwndFrom = hwnd;
     tvdi.hdr.idFrom = GetWindowLongA(hwnd, GWL_ID);
-    tvdi.hdr.code = TVN_ENDLABELEDITA;
+    tvdi.hdr.code = get_notifycode(infoPtr, TVN_ENDLABELEDITA);
     tvdi.item.mask = 0;
     tvdi.item.hItem = editedItem;
     tvdi.item.state = editedItem->state;


-- 
Dimi.




More information about the wine-patches mailing list