Alexandre Julliard : user: Moved Get/SetClassLong16 to wnd16.c.

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


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 10 17:08:05 2006 +0200

user: Moved Get/SetClassLong16 to wnd16.c.

---

 dlls/user/class.c |  117 -----------------------------------------------------
 dlls/user/wnd16.c |   41 +++++++++++++++++++
 2 files changed, 41 insertions(+), 117 deletions(-)

diff --git a/dlls/user/class.c b/dlls/user/class.c
index f1f82cf..5e20cb4 100644
--- a/dlls/user/class.c
+++ b/dlls/user/class.c
@@ -53,7 +53,6 @@ typedef struct tagCLASS
     INT              cbClsExtra;    /* Class extra bytes */
     INT              cbWndExtra;    /* Window extra bytes */
     LPWSTR           menuName;      /* Default menu name (Unicode followed by ASCII) */
-    SEGPTR           segMenuName;   /* Default menu name as SEGPTR */
     HINSTANCE        hInstance;     /* Module that created the task */
     HICON            hIcon;         /* Default icon */
     HICON            hIconSm;       /* Default small icon */
@@ -149,18 +148,6 @@ static BOOL set_server_info( HWND hwnd, 
  *
  * Get the class winproc for a given proc type
  */
-static WNDPROC16 CLASS_GetProc16( CLASS *classPtr )
-{
-    if (classPtr->winprocA) return WINPROC_GetProc16( classPtr->winprocA, FALSE );
-    else return WINPROC_GetProc16( classPtr->winprocW, TRUE );
-}
-
-
-/***********************************************************************
- *           CLASS_GetProc
- *
- * Get the class winproc for a given proc type
- */
 static WNDPROC CLASS_GetProc( CLASS *classPtr, BOOL unicode )
 {
     WNDPROC proc = classPtr->winprocA;
@@ -177,29 +164,6 @@ static WNDPROC CLASS_GetProc( CLASS *cla
 
 
 /***********************************************************************
- *           CLASS_SetProc16
- *
- * Set the class winproc for a given proc type.
- * Returns the previous window proc.
- */
-static void CLASS_SetProc16( CLASS *classPtr, WNDPROC16 newproc )
-{
-    WNDPROC proc = WINPROC_AllocProc16( newproc );
-
-    if (WINPROC_IsUnicode( proc, FALSE ))
-    {
-        classPtr->winprocA = 0;
-        classPtr->winprocW = proc;
-    }
-    else
-    {
-        classPtr->winprocA = proc;
-        classPtr->winprocW = 0;
-    }
-}
-
-
-/***********************************************************************
  *           CLASS_SetProc
  *
  * Set the class winproc for a given proc type.
@@ -235,20 +199,6 @@ inline static LPSTR CLASS_GetMenuNameA( 
 
 
 /***********************************************************************
- *           CLASS_GetMenuName16
- *
- * Get the menu name as a SEGPTR.
- */
-inline static SEGPTR CLASS_GetMenuName16( CLASS *classPtr )
-{
-    if (!HIWORD(classPtr->menuName)) return (SEGPTR)classPtr->menuName;
-    if (!classPtr->segMenuName)
-        classPtr->segMenuName = MapLS( CLASS_GetMenuNameA(classPtr) );
-    return classPtr->segMenuName;
-}
-
-
-/***********************************************************************
  *           CLASS_GetMenuNameW
  *
  * Get the menu name as a Unicode string.
@@ -266,8 +216,6 @@ inline static LPWSTR CLASS_GetMenuNameW(
  */
 static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
 {
-    UnMapLS( classPtr->segMenuName );
-    classPtr->segMenuName = 0;
     if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
     if (HIWORD(name))
     {
@@ -288,8 +236,6 @@ static void CLASS_SetMenuNameA( CLASS *c
  */
 static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
 {
-    UnMapLS( classPtr->segMenuName );
-    classPtr->segMenuName = 0;
     if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
     if (HIWORD(name))
     {
@@ -318,7 +264,6 @@ static void CLASS_FreeClass( CLASS *clas
     list_remove( &classPtr->entry );
     if (classPtr->hbrBackground > (HBRUSH)(COLOR_GRADIENTINACTIVECAPTION + 1))
         DeleteObject( classPtr->hbrBackground );
-    UnMapLS( classPtr->segMenuName );
     HeapFree( GetProcessHeap(), 0, classPtr->menuName );
     HeapFree( GetProcessHeap(), 0, classPtr );
     USER_Unlock();
@@ -742,40 +687,6 @@ WORD WINAPI GetClassWord( HWND hwnd, INT
 
 
 /***********************************************************************
- *		GetClassLong (USER.131)
- */
-LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
-{
-    CLASS *class;
-    LONG ret;
-    HWND hwnd = (HWND)(ULONG_PTR)hwnd16;  /* no need for full handle */
-
-    TRACE("%p %d\n",hwnd, offset);
-
-    switch( offset )
-    {
-    case GCLP_WNDPROC:
-        if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
-        if (class == CLASS_OTHER_PROCESS) break;
-        ret = (LONG)CLASS_GetProc16( class );
-        release_class_ptr( class );
-        return ret;
-    case GCLP_MENUNAME:
-        if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
-        if (class == CLASS_OTHER_PROCESS) break;
-        ret = (LONG)CLASS_GetMenuName16( class );
-        release_class_ptr( class );
-        return ret;
-    default:
-        return GetClassLongA( hwnd, offset );
-    }
-    FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
-    SetLastError( ERROR_INVALID_HANDLE );
-    return 0;
-}
-
-
-/***********************************************************************
  *		GetClassLongW (USER32.@)
  */
 DWORD WINAPI GetClassLongW( HWND hwnd, INT offset )
@@ -955,34 +866,6 @@ WORD WINAPI SetClassWord( HWND hwnd, INT
 
 
 /***********************************************************************
- *		SetClassLong (USER.132)
- */
-LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
-{
-    CLASS *class;
-    LONG retval;
-    HWND hwnd = (HWND)(ULONG_PTR)hwnd16;  /* no need for full handle */
-
-    TRACE("%p %d %lx\n", hwnd, offset, newval);
-
-    switch(offset)
-    {
-    case GCLP_WNDPROC:
-        if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
-        retval = (LONG)CLASS_GetProc16( class );
-        CLASS_SetProc16( class, (WNDPROC16)newval );
-        release_class_ptr( class );
-        return retval;
-    case GCLP_MENUNAME:
-        newval = (LONG)MapSL( newval );
-        /* fall through */
-    default:
-        return SetClassLongA( hwnd, offset, newval );
-    }
-}
-
-
-/***********************************************************************
  *		SetClassLongW (USER32.@)
  */
 DWORD WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval )
diff --git a/dlls/user/wnd16.c b/dlls/user/wnd16.c
index 5471f36..727415b 100644
--- a/dlls/user/wnd16.c
+++ b/dlls/user/wnd16.c
@@ -661,6 +661,47 @@ WORD WINAPI SetClassWord16( HWND16 hwnd,
 }
 
 
+/***********************************************************************
+ *		GetClassLong (USER.131)
+ */
+LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
+{
+    LONG_PTR ret = GetClassLongA( WIN_Handle32(hwnd16), offset );
+
+    switch( offset )
+    {
+    case GCLP_WNDPROC:
+        return (LONG_PTR)WINPROC_GetProc16( (WNDPROC)ret, FALSE );
+    case GCLP_MENUNAME:
+        return MapLS( (void *)ret );  /* leak */
+    default:
+        return ret;
+    }
+}
+
+
+/***********************************************************************
+ *		SetClassLong (USER.132)
+ */
+LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
+{
+    switch( offset )
+    {
+    case GCLP_WNDPROC:
+        {
+            WNDPROC new_proc = WINPROC_AllocProc16( (WNDPROC16)newval );
+            WNDPROC old_proc = (WNDPROC)SetClassLongA( WIN_Handle32(hwnd16), offset, (LONG_PTR)new_proc );
+            return (LONG)WINPROC_GetProc16( (WNDPROC)old_proc, FALSE );
+        }
+    case GCLP_MENUNAME:
+        newval = (LONG)MapSL( newval );
+        /* fall through */
+    default:
+        return SetClassLongA( WIN_Handle32(hwnd16), offset, newval );
+    }
+}
+
+
 /**************************************************************************
  *              GetWindowWord   (USER.133)
  */




More information about the wine-cvs mailing list