user32/dialog : Fix EndDialog behaviour for OrCad. (try 2)
Eliot Blennerhassett
eblennerhassett at audioscience.com
Thu Jul 8 23:36:10 CDT 2010
While allowing existing tests to pass.
For bug#3023
Signed-off-by: Eliot Blennerhassett <eblennerhassett at audioscience.com>
---
Resending without whitespace changes, per feedback from Dan Kegel
dlls/user32/dialog.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index aac8a4d..d6eecbd 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -897,6 +897,28 @@ INT_PTR WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance, LPCDLGTEMPLATEW temp
return DialogBoxIndirectParamAorW( hInstance, template, owner, dlgProc, param, 0 );
}
+
+/***********************************************************************
+ *
+ * ?Exact copy of static DEFDLG_GetDlgProc
+ * Is there another way to do this "correctly"?
+ */
+static DLGPROC DIALOG_GetDlgProc( HWND hwnd )
+{
+ DLGPROC ret;
+ WND *wndPtr = WIN_GetPtr( hwnd );
+
+ if (!wndPtr) return 0;
+ if (wndPtr == WND_OTHER_PROCESS)
+ {
+ ERR( "cannot get dlg proc %p from other process\n", hwnd );
+ return 0;
+ }
+ ret = *(DLGPROC *)((char *)wndPtr->wExtra + DWLP_DLGPROC);
+ WIN_ReleasePtr( wndPtr );
+ return ret;
+}
+
/***********************************************************************
* EndDialog (USER32.@)
*/
@@ -905,6 +927,7 @@ BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval )
BOOL wasEnabled = TRUE;
DIALOGINFO * dlgInfo;
HWND owner;
+ DLGPROC dlgproc;
TRACE("%p %ld\n", hwnd, retval );
@@ -930,8 +953,12 @@ BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval )
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
| SWP_NOZORDER | SWP_NOACTIVATE | SWP_HIDEWINDOW);
-
- if (hwnd == GetActiveWindow()) WINPOS_ActivateOtherWindow( hwnd );
+ /* Only call WINPOS_ActivateOtherWindow if hwnd is a 'dialog'
+ that doesn't have a dialog proc.
+ */
+ if (!(dlgproc = DIALOG_GetDlgProc(hwnd)))
+ if (hwnd == GetActiveWindow())
+ WINPOS_ActivateOtherWindow(hwnd);
/* unblock dialog loop */
PostMessageA(hwnd, WM_NULL, 0, 0);
--
1.7.0.4
More information about the wine-patches
mailing list