Fix for Treeview Regression in Putty, winamp, et al.
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 */
On February 13, 2003 12:46 am, Drew \"DanteAliegri\" Ogle wrote:
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.
It seems that the real fix is to always send TVN_*A in notifications. However, for whatever reason, that did not fix putty for me, so I did not submit it. Care to give that a shot? -- Dimi.
Dimitrie O. Paun wrote:
On February 13, 2003 12:46 am, Drew \"DanteAliegri\" Ogle wrote:
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.
It seems that the real fix is to always send TVN_*A in notifications. However, for whatever reason, that did not fix putty for me, so I did not submit it. Care to give that a shot?
Well, I don't know enough about compiling to get a callback that is W, but if you compiled a app with TVN_SELCHANGED, and it was usiing W, wouldn't TNV_SELCHANGED evaluate to TVN_SELCHANGEDW? Also, this didn't seem to fix things for me until I did a make dep; make .. not sure why. -Dante
participants (2)
-
Dimitrie O. Paun -
Drew "DanteAliegri" Ogle