Jacek Caban : user32: Use the original owner used to create the dialog for WM_ENTERIDLE messages.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Apr 11 10:30:32 CDT 2016


Module: wine
Branch: master
Commit: 36b64321b2d6f2e80c78129dac2a4ffe4881d2bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=36b64321b2d6f2e80c78129dac2a4ffe4881d2bb

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Apr  6 14:41:27 2016 +0200

user32: Use the original owner used to create the dialog for WM_ENTERIDLE messages.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user.exe16/dialog.c       |  4 ++--
 dlls/user.exe16/user_private.h |  2 +-
 dlls/user32/controls.h         |  4 ++--
 dlls/user32/dialog.c           | 22 +++++++++++-----------
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/dlls/user.exe16/dialog.c b/dlls/user.exe16/dialog.c
index 766a468..e5bf7b9 100644
--- a/dlls/user.exe16/dialog.c
+++ b/dlls/user.exe16/dialog.c
@@ -744,7 +744,7 @@ INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
     {
         HWND owner = WIN_Handle32(owner16);
         hwnd = DIALOG_CreateIndirect16( hInst, data, owner, dlgProc, param, TRUE );
-        if (hwnd) ret = wow_handlers32.dialog_box_loop( hwnd );
+        if (hwnd) ret = wow_handlers32.dialog_box_loop( hwnd, owner  );
         GlobalUnlock16( hmem );
     }
     FreeResource16( hmem );
@@ -764,7 +764,7 @@ INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
     if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
     hwnd = DIALOG_CreateIndirect16( hInst, ptr, owner, dlgProc, param, TRUE );
     GlobalUnlock16( dlgTemplate );
-    if (hwnd) return wow_handlers32.dialog_box_loop( hwnd );
+    if (hwnd) return wow_handlers32.dialog_box_loop( hwnd, owner );
     return -1;
 }
 
diff --git a/dlls/user.exe16/user_private.h b/dlls/user.exe16/user_private.h
index 3d97546..7c91afb 100644
--- a/dlls/user.exe16/user_private.h
+++ b/dlls/user.exe16/user_private.h
@@ -63,7 +63,7 @@ struct wow_handlers32
     HWND    (*get_win_handle)(HWND);
     WNDPROC (*alloc_winproc)(WNDPROC,BOOL);
     struct tagDIALOGINFO *(*get_dialog_info)(HWND,BOOL);
-    INT     (*dialog_box_loop)(HWND);
+    INT     (*dialog_box_loop)(HWND,HWND);
     ULONG_PTR (*get_icon_param)(HICON);
     ULONG_PTR (*set_icon_param)(HICON,ULONG_PTR);
 };
diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index 4fdab62..1641645 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -121,7 +121,7 @@ struct wow_handlers32
     HWND    (*get_win_handle)(HWND);
     WNDPROC (*alloc_winproc)(WNDPROC,BOOL);
     struct tagDIALOGINFO *(*get_dialog_info)(HWND,BOOL);
-    INT     (*dialog_box_loop)(HWND);
+    INT     (*dialog_box_loop)(HWND,HWND);
     ULONG_PTR (*get_icon_param)(HICON);
     ULONG_PTR (*set_icon_param)(HICON,ULONG_PTR);
 };
@@ -243,7 +243,7 @@ typedef struct tagDIALOGINFO
 #define DF_END  0x0001
 
 extern DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create ) DECLSPEC_HIDDEN;
-extern INT DIALOG_DoDialogBox( HWND hwnd ) DECLSPEC_HIDDEN;
+extern INT DIALOG_DoDialogBox( HWND hwnd, HWND owner ) DECLSPEC_HIDDEN;
 
 HRGN set_control_clipping( HDC hdc, const RECT *rect ) DECLSPEC_HIDDEN;
 
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index b5ed902..9cb4b8d 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -445,7 +445,7 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
  */
 static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
                                    HWND owner, DLGPROC dlgProc, LPARAM param,
-                                   BOOL unicode, BOOL modal )
+                                   BOOL unicode, HWND *modal_owner )
 {
     HWND hwnd;
     RECT rect;
@@ -584,7 +584,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
         }
     }
 
-    if (modal && owner)
+    if (modal_owner && owner)
     {
         HWND parent;
         /*
@@ -599,6 +599,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
             if (!parent || parent == GetDesktopWindow()) break;
             owner = parent;
         }
+        *modal_owner = owner;
         if (IsWindowEnabled( owner ))
         {
             disabled_owner = owner;
@@ -768,9 +769,8 @@ HWND WINAPI CreateDialogIndirectParamW( HINSTANCE hInst, LPCDLGTEMPLATEW dlgTemp
 /***********************************************************************
  *           DIALOG_DoDialogBox
  */
-INT DIALOG_DoDialogBox( HWND hwnd )
+INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
 {
-    HWND owner = GetWindow( hwnd, GW_OWNER );
     DIALOGINFO * dlgInfo;
     MSG msg;
     INT retval;
@@ -792,7 +792,7 @@ INT DIALOG_DoDialogBox( HWND hwnd )
                     bFirstEmpty = FALSE;
                 }
                 if (!(GetWindowLongW( hwnd, GWL_STYLE ) & DS_NOIDLEMSG))
-               {
+                {
                     /* No message present -> send ENTERIDLE and wait */
                     SendMessageW( owner, WM_ENTERIDLE, MSGF_DIALOGBOX, (LPARAM)hwnd );
                 }
@@ -839,8 +839,8 @@ INT_PTR WINAPI DialogBoxParamA( HINSTANCE hInst, LPCSTR name,
 
     if (!(hrsrc = FindResourceA( hInst, name, (LPSTR)RT_DIALOG ))) return -1;
     if (!(ptr = LoadResource(hInst, hrsrc))) return -1;
-    hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, FALSE, TRUE );
-    if (hwnd) return DIALOG_DoDialogBox( hwnd );
+    hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, FALSE, &owner );
+    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return 0;
 }
 
@@ -857,8 +857,8 @@ INT_PTR WINAPI DialogBoxParamW( HINSTANCE hInst, LPCWSTR name,
 
     if (!(hrsrc = FindResourceW( hInst, name, (LPWSTR)RT_DIALOG ))) return -1;
     if (!(ptr = LoadResource(hInst, hrsrc))) return -1;
-    hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, TRUE, TRUE );
-    if (hwnd) return DIALOG_DoDialogBox( hwnd );
+    hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, dlgProc, param, TRUE, &owner );
+    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return 0;
 }
 
@@ -870,8 +870,8 @@ INT_PTR WINAPI DialogBoxIndirectParamAorW( HINSTANCE hInstance, LPCVOID template
                                            HWND owner, DLGPROC dlgProc,
                                            LPARAM param, DWORD flags )
 {
-    HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner, dlgProc, param, !flags, TRUE );
-    if (hwnd) return DIALOG_DoDialogBox( hwnd );
+    HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner, dlgProc, param, !flags, &owner );
+    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
     return -1;
 }
 




More information about the wine-cvs mailing list