Ignore:
Timestamp:
Dec 9, 1999, 1:54:05 AM (26 years ago)
Author:
sandervl
Message:

Unicode <-> Ascii translation changes + fixes for window procedures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32class.cpp

    r1606 r2033  
    1 /* $Id: win32class.cpp,v 1.6 1999-11-05 09:16:22 sandervl Exp $ */
     1/* $Id: win32class.cpp,v 1.7 1999-12-09 00:53:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Class Managment Code for OS/2
     
    2323#include <win32class.h>
    2424#include <win32wnd.h>
     25#include <win\winproc.h>
    2526
    2627static fDestroyAll = FALSE;
     
    2930//Win32WndClass methods:
    3031//******************************************************************************
    31 Win32WndClass::Win32WndClass(WNDCLASSEXA *wndclass, BOOL isUnicode) : GenericObject(&wndclasses, OBJTYPE_CLASS)
    32 {
    33   this->isUnicode = isUnicode;
     32Win32WndClass::Win32WndClass(WNDCLASSEXA *wndclass, BOOL fUnicode) : GenericObject(&wndclasses, OBJTYPE_CLASS)
     33{
     34  isUnicode = fUnicode;
    3435  processId = 0;
    3536
     
    5960                AsciiToUnicode(classNameA, classNameW);
    6061        }
    61         classAtom = 0;
    62         //SvL: If a system control has already be registered, use that atom instead
     62    classAtom = 0;
     63    //SvL: If a system control has already be registered, use that atom instead
    6364        //     of creating a new one
    64         if(wndclass->style & CS_GLOBALCLASS) {
    65                 classAtom = GlobalFindAtomA(classNameA);
    66         }
    67         if(!classAtom) classAtom = GlobalAddAtomA(classNameA);
     65    if(wndclass->style & CS_GLOBALCLASS) {
     66        classAtom = GlobalFindAtomA(classNameA);
     67    }
     68    if(!classAtom) classAtom = GlobalAddAtomA(classNameA);
    6869  }
    6970  else {
     
    7374  }
    7475  if(!(wndclass->style & CS_GLOBALCLASS)) {
    75         processId = GetCurrentProcess();
     76    processId = GetCurrentProcess();
    7677  }
    7778  menuNameA = 0;
     
    105106
    106107  windowStyle           = wndclass->style;
    107   windowProc            = wndclass->lpfnWndProc;
     108  WINPROC_SetProc((HWINDOWPROC *)&windowProc, wndclass->lpfnWndProc, (isUnicode) ? WIN_PROC_32W : WIN_PROC_32A, WIN_PROC_CLASS);
    108109
    109110  //User data class words/longs
     
    126127{
    127128  if(classNameA) {
    128         dprintf(("Win32WndClass dtor, destroy class %s\n", classNameA));
     129    dprintf(("Win32WndClass dtor, destroy class %s\n", classNameA));
    129130  }
    130131
    131132  //SvL: Don't delete global classes
    132133  if(classNameA && !(windowStyle & CS_GLOBALCLASS)) {
    133         GlobalDeleteAtom(classAtom);
    134   }
     134    GlobalDeleteAtom(classAtom);
     135  }
     136
     137  WINPROC_FreeProc(windowProc, WIN_PROC_CLASS);
    135138
    136139  if(userClassLong)     free(userClassLong);
     
    158161  }
    159162  if(fUnicode) {
    160         if(classNameW)
    161                 return (lstrcmpW(classNameW, (LPWSTR)classname) == 0);
    162         return FALSE;
     163        if(classNameW)
     164            return (lstrcmpW(classNameW, (LPWSTR)classname) == 0);
     165        return FALSE;
    163166  }
    164167  else {
    165         if(classNameA)
    166                 return (strcmp(classNameA, classname) == 0);
    167         return FALSE;
     168        if(classNameA)
     169            return (strcmp(classNameA, classname) == 0);
     170        return FALSE;
    168171  }
    169172}
     
    234237{
    235238  if(windowStyle & CS_GLOBALCLASS)
    236         return TRUE;
     239    return TRUE;
    237240
    238241  return curProcessId = processId;
     
    251254  wndclass->lpszClassName = (classNameA) ? (LPCTSTR)classNameA : (LPCTSTR)classAtom;
    252255  wndclass->style         = windowStyle;
    253   wndclass->lpfnWndProc   = windowProc;
     256  wndclass->lpfnWndProc   = (WNDPROC)getClassLongA(GCL_WNDPROC, FALSE);
    254257  wndclass->hIconSm       = hIconSm;
    255258  return(TRUE);
     
    268271  wndclass->lpszClassName = (classNameW) ? (LPCWSTR)classNameW : (LPCWSTR)classAtom;
    269272  wndclass->style         = windowStyle;
    270   wndclass->lpfnWndProc   = windowProc;
     273  wndclass->lpfnWndProc   = (WNDPROC)getClassLongA(GCL_WNDPROC, TRUE);
    271274  wndclass->hIconSm       = hIconSm;
    272275  return(TRUE);
     
    335338//******************************************************************************
    336339//******************************************************************************
    337 ULONG Win32WndClass::getClassLongA(int index, BOOL isUnicode)
     340ULONG Win32WndClass::getClassLongA(int index, BOOL fUnicode)
    338341{
    339342  switch(index) {
     
    355358                return windowStyle;
    356359        case GCL_WNDPROC:
    357                 return (ULONG)windowProc;
     360                return (ULONG) WINPROC_GetProc(windowProc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A);
    358361        case GCW_ATOM: //TODO: does this really happen in windows?
    359362                SetLastError(ERROR_INVALID_PARAMETER);
     
    385388//TODO: What effects what immediately?
    386389//******************************************************************************
    387 ULONG Win32WndClass::setClassLongA(int index, LONG lNewVal, BOOL isUnicode)
     390ULONG Win32WndClass::setClassLongA(int index, LONG lNewVal, BOOL fUnicode)
    388391{
    389392 ULONG rc;
     
    423426                break;
    424427        case GCL_WNDPROC:
    425                 rc = (ULONG)windowProc;
    426                 windowProc = (WNDPROC)lNewVal;
     428                rc = (LONG)WINPROC_GetProc(windowProc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A );
     429                WINPROC_SetProc((HWINDOWPROC *)&windowProc, (WNDPROC)lNewVal, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A, WIN_PROC_CLASS );
    427430                break;
    428431        case GCW_ATOM: //TODO: does this really happen in windows?
Note: See TracChangeset for help on using the changeset viewer.