Alexandre Julliard : user: Add a WIN_ISUNICODE flag instead of relying on the winproc type.

Alexandre Julliard julliard at wine.codeweavers.com
Wed May 10 12:56:40 CDT 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 10 12:55:36 2006 +0200

user: Add a WIN_ISUNICODE flag instead of relying on the winproc type.
    
Also fix the initial value for the server is_unicode flag.

---

 dlls/user/class.c |    1 +
 dlls/user/win.c   |   15 +++++++++------
 include/win.h     |    3 ++-
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/user/class.c b/dlls/user/class.c
index 1f36562..f823b2f 100644
--- a/dlls/user/class.c
+++ b/dlls/user/class.c
@@ -532,6 +532,7 @@ void CLASS_AddWindow( CLASS *class, WND 
     }
     win->class    = class;
     win->clsStyle = class->style;
+    if (WINPROC_GetProcType( win->winproc ) == WIN_PROC_32W) win->flags |= WIN_ISUNICODE;
 }
 
 
diff --git a/dlls/user/win.c b/dlls/user/win.c
index 4732fc6..acff599 100644
--- a/dlls/user/win.c
+++ b/dlls/user/win.c
@@ -122,6 +122,7 @@ static WND *create_window_handle( HWND p
     win->parent     = full_parent;
     win->owner      = full_owner;
     win->dwMagic    = WND_MAGIC;
+    win->flags      = 0;
     win->cbWndExtra = extra_bytes;
     memset( win->wExtra, 0, extra_bytes );
     CLASS_AddWindow( class, win, type );
@@ -988,13 +989,13 @@ static HWND WIN_CreateWindowEx( CREATEST
     wndPtr->dwExStyle      = cs->dwExStyle;
     wndPtr->wIDmenu        = 0;
     wndPtr->helpContext    = 0;
-    wndPtr->flags          = (type == WIN_PROC_16) ? 0 : WIN_ISWIN32;
     wndPtr->pVScroll       = NULL;
     wndPtr->pHScroll       = NULL;
     wndPtr->userdata       = 0;
     wndPtr->hIcon          = 0;
     wndPtr->hIconSmall     = 0;
     wndPtr->hSysMenu       = 0;
+    if (type != WIN_PROC_16) wndPtr->flags |= WIN_ISWIN32;
 
     if (wndPtr->dwStyle & WS_SYSMENU) SetSystemMenu( hwnd, 0 );
 
@@ -1032,7 +1033,7 @@ static HWND WIN_CreateWindowEx( CREATEST
         req->style     = wndPtr->dwStyle;
         req->ex_style  = wndPtr->dwExStyle;
         req->instance  = (void *)wndPtr->hInstance;
-        req->is_unicode = (type == WIN_PROC_32W);
+        req->is_unicode = (wndPtr->flags & WIN_ISUNICODE) != 0;
         req->extra_offset = -1;
         wine_server_call( req );
     }
@@ -1683,7 +1684,7 @@ BOOL WINAPI IsWindowUnicode( HWND hwnd )
 
     if (wndPtr != WND_OTHER_PROCESS)
     {
-        retvalue = (WINPROC_GetProcType( wndPtr->winproc ) == WIN_PROC_32W);
+        retvalue = (wndPtr->flags & WIN_ISUNICODE) != 0;
         WIN_ReleasePtr( wndPtr );
     }
     else
@@ -1990,10 +1991,12 @@ static LONG_PTR WIN_SetWindowLong( HWND 
         }
     case GWLP_WNDPROC:
     {
-        WINDOWPROCTYPE old_type = WINPROC_GetProcType( wndPtr->winproc );
+        UINT old_flags = wndPtr->flags;
         retval = (ULONG_PTR)WINPROC_GetProc( wndPtr->winproc, type );
         wndPtr->winproc = WINPROC_AllocProc( (WNDPROC)newval, type );
-        if (old_type == type)
+        if (WINPROC_GetProcType( wndPtr->winproc ) == WIN_PROC_32W) wndPtr->flags |= WIN_ISUNICODE;
+        else wndPtr->flags &= ~WIN_ISUNICODE;
+        if (!((old_flags ^ wndPtr->flags) & WIN_ISUNICODE))
         {
             WIN_ReleasePtr( wndPtr );
             return retval;
@@ -2059,7 +2062,7 @@ static LONG_PTR WIN_SetWindowLong( HWND 
             break;
         case GWLP_WNDPROC:
             req->flags = SET_WIN_UNICODE;
-            req->is_unicode = (type == WIN_PROC_32W);
+            req->is_unicode = (wndPtr->flags & WIN_ISUNICODE) != 0;
             break;
         case GWLP_USERDATA:
             req->flags = SET_WIN_USERDATA;
diff --git a/include/win.h b/include/win.h
index 437aecf..f5affc3 100644
--- a/include/win.h
+++ b/include/win.h
@@ -68,7 +68,8 @@ #define WIN_NCACTIVATED           0x0004
 #define WIN_ISMDICLIENT           0x0008 /* Window is an MDIClient */
 #define WIN_ISDIALOG              0x0010 /* Window is a dialog */
 #define WIN_ISWIN32               0x0020 /* Understands Win32 messages */
-#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0040 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
+#define WIN_ISUNICODE             0x0040 /* Window is Unicode */
+#define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0080 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */
 
   /* Window functions */
 extern WND *WIN_GetPtr( HWND hwnd );




More information about the wine-cvs mailing list