Alexandre Julliard : user: Always set the correct class winproc depending on the A/W type.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 9 14:15:26 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: cd0d7529ded1b79f72d12a318d5de47966308454
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=cd0d7529ded1b79f72d12a318d5de47966308454

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue May  9 20:00:40 2006 +0200

user: Always set the correct class winproc depending on the A/W type.

---

 dlls/user/class.c |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/dlls/user/class.c b/dlls/user/class.c
index fe89e65..1f36562 100644
--- a/dlls/user/class.c
+++ b/dlls/user/class.c
@@ -185,8 +185,18 @@ static WNDPROC CLASS_GetProc( CLASS *cla
  */
 static void CLASS_SetProc16( CLASS *classPtr, WNDPROC16 newproc )
 {
-    classPtr->winprocA = WINPROC_AllocProc16( newproc );
-    classPtr->winprocW = 0;
+    WNDPROC proc = WINPROC_AllocProc16( newproc );
+
+    if (WINPROC_GetProcType( proc ) == WIN_PROC_32W)
+    {
+        classPtr->winprocA = 0;
+        classPtr->winprocW = proc;
+    }
+    else
+    {
+        classPtr->winprocA = proc;
+        classPtr->winprocW = 0;
+    }
 }
 
 
@@ -198,23 +208,17 @@ static void CLASS_SetProc16( CLASS *clas
  */
 static void CLASS_SetProc( CLASS *classPtr, WNDPROC newproc, WINDOWPROCTYPE type )
 {
-    WNDPROC *proc = &classPtr->winprocA;
+    WNDPROC proc = WINPROC_AllocProc( newproc, type );
 
-    if (classPtr->winprocW)
+    if (WINPROC_GetProcType( proc ) == WIN_PROC_32W)
     {
-        /* if we have a Unicode proc, use it if we have no ASCII proc
-         * or if we have both and Unicode was requested
-         */
-        if (!*proc || type == WIN_PROC_32W) proc = &classPtr->winprocW;
+        classPtr->winprocA = 0;
+        classPtr->winprocW = proc;
     }
-    *proc = WINPROC_AllocProc( newproc, type );
-    /* now clear the one that we didn't set */
-    if (classPtr->winprocA && classPtr->winprocW)
+    else
     {
-        if (proc == &classPtr->winprocA)
-            classPtr->winprocW = 0;
-        else
-            classPtr->winprocA = 0;
+        classPtr->winprocA = proc;
+        classPtr->winprocW = 0;
     }
 }
 




More information about the wine-cvs mailing list