Alexandre Julliard : user32: Add a Wow handler for the mdi client class.

Alexandre Julliard julliard at winehq.org
Wed Dec 16 09:41:39 CST 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec 16 13:22:08 2009 +0100

user32: Add a Wow handler for the mdi client class.

---

 dlls/user32/controls.h |    3 +++
 dlls/user32/mdi.c      |   31 +++++++------------------------
 dlls/user32/msg16.c    |   37 +++++++++++++++++++++++++++++++++++++
 dlls/user32/winproc.c  |    2 ++
 4 files changed, 49 insertions(+), 24 deletions(-)

diff --git a/dlls/user32/controls.h b/dlls/user32/controls.h
index 9adb031..45dd2d0 100644
--- a/dlls/user32/controls.h
+++ b/dlls/user32/controls.h
@@ -65,6 +65,7 @@ struct wow_handlers16
     LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+    LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*call_window_proc)(HWND,UINT,WPARAM,LPARAM,LRESULT*,void*);
@@ -77,6 +78,7 @@ struct wow_handlers32
     LRESULT (*combo_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*edit_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*listbox_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
+    LRESULT (*mdiclient_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*scrollbar_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     LRESULT (*static_proc)(HWND,UINT,WPARAM,LPARAM,BOOL);
     WNDPROC (*alloc_winproc)(WNDPROC,WNDPROC);
@@ -88,6 +90,7 @@ extern LRESULT ButtonWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDE
 extern LRESULT ComboWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 extern LRESULT EditWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 extern LRESULT ListBoxWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
+extern LRESULT MDIClientWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 extern LRESULT ScrollBarWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 extern LRESULT StaticWndProc_common(HWND,UINT,WPARAM,LPARAM,BOOL) DECLSPEC_HIDDEN;
 
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index 7e017b0..e1910f8 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -93,7 +93,6 @@
 #include "wingdi.h"
 #include "winuser.h"
 #include "wownt32.h"
-#include "wine/winuser16.h"
 #include "wine/unicode.h"
 #include "win.h"
 #include "controls.h"
@@ -1045,8 +1044,7 @@ static void MDI_UpdateFrameText( HWND frame, HWND hClient, BOOL repaint, LPCWSTR
 /**********************************************************************
  *		MDIClientWndProc_common
  */
-static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
-                                        WPARAM wParam, LPARAM lParam, BOOL unicode )
+LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode )
 {
     MDICLIENTINFO *ci;
 
@@ -1070,26 +1068,11 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
       {
           /* Since we are using only cs->lpCreateParams, we can safely
            * cast to LPCREATESTRUCTA here */
-          LPCREATESTRUCTA cs = (LPCREATESTRUCTA)lParam;
-          WND *wndPtr = WIN_GetPtr( hwnd );
-
-	/* Translation layer doesn't know what's in the cs->lpCreateParams
-	 * so we have to keep track of what environment we're in. */
-
-	if( wndPtr->flags & WIN_ISWIN32 )
-	{
-	    LPCLIENTCREATESTRUCT ccs = cs->lpCreateParams;
-	    ci->hWindowMenu	= ccs->hWindowMenu;
-	    ci->idFirstChild	= ccs->idFirstChild;
-	}
-        else
-	{
-	    LPCLIENTCREATESTRUCT16 ccs = MapSL(PtrToUlong(cs->lpCreateParams));
-	    ci->hWindowMenu	= HMENU_32(ccs->hWindowMenu);
-	    ci->idFirstChild	= ccs->idFirstChild;
-	}
-        WIN_ReleasePtr( wndPtr );
+        LPCREATESTRUCTA cs = (LPCREATESTRUCTA)lParam;
+        LPCLIENTCREATESTRUCT ccs = cs->lpCreateParams;
 
+        ci->hWindowMenu		= ccs->hWindowMenu;
+        ci->idFirstChild	= ccs->idFirstChild;
         ci->hwndChildMaximized  = 0;
         ci->child = NULL;
 	ci->nActiveChildren	= 0;
@@ -1294,7 +1277,7 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message,
 static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
     if (!IsWindow(hwnd)) return 0;
-    return MDIClientWndProc_common( hwnd, message, wParam, lParam, FALSE );
+    return wow_handlers.mdiclient_proc( hwnd, message, wParam, lParam, FALSE );
 }
 
 /***********************************************************************
@@ -1303,7 +1286,7 @@ static LRESULT WINAPI MDIClientWndProcA( HWND hwnd, UINT message, WPARAM wParam,
 static LRESULT WINAPI MDIClientWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
 {
     if (!IsWindow(hwnd)) return 0;
-    return MDIClientWndProc_common( hwnd, message, wParam, lParam, TRUE );
+    return wow_handlers.mdiclient_proc( hwnd, message, wParam, lParam, TRUE );
 }
 
 /***********************************************************************
diff --git a/dlls/user32/msg16.c b/dlls/user32/msg16.c
index a39c35c..27a47a4 100644
--- a/dlls/user32/msg16.c
+++ b/dlls/user32/msg16.c
@@ -2493,6 +2493,42 @@ static LRESULT listbox_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
 
 
 /***********************************************************************
+ *           mdiclient_proc16
+ */
+static LRESULT mdiclient_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
+{
+    if (msg == WM_CREATE)
+    {
+        LPCREATESTRUCTA cs = (LPCREATESTRUCTA)lParam;
+        WND *win;
+        BOOL is_win32;
+
+        if (!(win = WIN_GetPtr( hwnd ))) return 0;
+        is_win32 = (win == WND_OTHER_PROCESS || win == WND_DESKTOP || (win->flags & WIN_ISWIN32));
+        WIN_ReleasePtr( win );
+
+	/* Translation layer doesn't know what's in the cs->lpCreateParams
+	 * so we have to keep track of what environment we're in. */
+	if (!is_win32)
+	{
+            void *orig = cs->lpCreateParams;
+            LRESULT ret;
+            CLIENTCREATESTRUCT ccs;
+            CLIENTCREATESTRUCT16 *ccs16 = MapSL( PtrToUlong( orig ));
+
+            ccs.hWindowMenu  = HMENU_32(ccs16->hWindowMenu);
+            ccs.idFirstChild = ccs16->idFirstChild;
+            cs->lpCreateParams = &ccs;
+            ret = wow_handlers32.mdiclient_proc( hwnd, msg, wParam, lParam, unicode );
+            cs->lpCreateParams = orig;
+            return ret;
+	}
+    }
+    return wow_handlers32.mdiclient_proc( hwnd, msg, wParam, lParam, unicode );
+}
+
+
+/***********************************************************************
  *           scrollbar_proc16
  */
 static LRESULT scrollbar_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
@@ -2550,6 +2586,7 @@ void register_wow_handlers(void)
         combo_proc16,
         edit_proc16,
         listbox_proc16,
+        mdiclient_proc16,
         scrollbar_proc16,
         static_proc16,
         call_window_proc_Ato16,
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index 268bda5..0bde530 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -1044,6 +1044,7 @@ void WINAPI UserRegisterWowHandlers( const struct wow_handlers16 *new, struct wo
     orig->combo_proc     = ComboWndProc_common;
     orig->edit_proc      = EditWndProc_common;
     orig->listbox_proc   = ListBoxWndProc_common;
+    orig->mdiclient_proc = MDIClientWndProc_common;
     orig->scrollbar_proc = ScrollBarWndProc_common;
     orig->static_proc    = StaticWndProc_common;
     orig->alloc_winproc  = WINPROC_AllocProc;
@@ -1057,6 +1058,7 @@ struct wow_handlers16 wow_handlers =
     ComboWndProc_common,
     EditWndProc_common,
     ListBoxWndProc_common,
+    MDIClientWndProc_common,
     ScrollBarWndProc_common,
     StaticWndProc_common,
     NULL,  /* call_window_proc */




More information about the wine-cvs mailing list