Fix for Treeview Regression in Putty, winamp, et al.

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

 



Putty and winamp use dialogs which contain treeviews.
When the treeview code sets values to be passed to the callback function,
it decides there if it is returning to A or W.
When it is returning to a dialog, it returns a W,
however, when the user code which the dialog calls is an A function,
it excepts TVN_*A, when the treeview code is sending TVN_*W.
The most logical place to test for this, was in DefDlgProcW,
which then modifies the code when it finds
a) the msg to be WM_NOTIFY
b) the lParam to be non-null
c) the code to be of W form
d) the code to be of a TVN_ type.

As this is my second real patch, any comments are welcome :)

-Dante
Index: windows/defdlg.c
===================================================================
RCS file: /home/wine/wine/windows/defdlg.c,v
retrieving revision 1.29
diff -u -r1.29 defdlg.c
--- windows/defdlg.c	14 Jan 2003 19:29:15 -0000	1.29
+++ windows/defdlg.c	13 Feb 2003 05:39:00 -0000
@@ -395,12 +395,22 @@
 LRESULT WINAPI DefDlgProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
 {
     BOOL result = FALSE;
+    BOOL forWide = FALSE;
     WNDPROC dlgproc;
+		/* make sure we only change TVN_ codes. */
+    if( msg == WM_NOTIFY && lParam && ((LPNMHDR)lParam)->code & 0x30 )
+        forWide = TRUE;
 
     SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
 
     if ((dlgproc = DEFDLG_GetDlgProc( hwnd )))
     {
+        /* if call was meant for a W funcition, but the callback
+         * is really an A function, change the code from a W code
+         * to a A code.
+         **/
+        if( forWide && (WINPROC_GetProcType( dlgproc) == WIN_PROC_32A ))
+            ((LPNMHDR)lParam)->code += 0x31;
         /* Call dialog procedure */
         result = CallWindowProcW( dlgproc, hwnd, msg, wParam, lParam );
         /* 16 bit dlg procs only return BOOL16 */

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

  Powered by Linux