Changeset 724 for trunk/src


Ignore:
Timestamp:
Aug 28, 1999, 4:09:58 PM (26 years ago)
Author:
sandervl
Message:

Use shared memory for class & window objects

Location:
trunk/src/user32/new
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/gen_object.cpp

    r655 r724  
    1 /* $Id: gen_object.cpp,v 1.3 1999-08-24 09:20:30 sandervl Exp $ */
     1/* $Id: gen_object.cpp,v 1.4 1999-08-28 14:09:29 sandervl Exp $ */
    22/*
    33 * Generic Object Class for OS/2
     4 *
     5 * Allocated in shared memory, so other processes can access the objects
     6 *
     7 * NOTE: Requires safety precautions to use objects in multiple threads or processes
    48 *
    59 * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl)
  • trunk/src/user32/new/gen_object.h

    r655 r724  
    1 /* $Id: gen_object.h,v 1.2 1999-08-24 09:20:30 sandervl Exp $ */
     1/* $Id: gen_object.h,v 1.3 1999-08-28 14:09:29 sandervl Exp $ */
    22/*
    33 * Generic Object Class for OS/2
     
    88#ifndef __GEN_OBJECT_H__
    99#define __GEN_OBJECT_H__
     10
     11#include "heapshared.h"
    1012
    1113#define OBJTYPE_WINDOW          0
     
    3840static   void  leaveMutex(DWORD objType);
    3941
     42#ifdef __DEBUG_ALLOC__
     43        void *operator new(size_t size, const char *filename, size_t lineno)
     44        {
     45                return _umalloc(sharedHeap, size);
     46        }
     47        void operator delete(void *location, const char *filename, size_t lineno)
     48        {
     49                free(location);
     50        }
     51#else
     52        void *operator new(size_t size)
     53        {
     54                return _umalloc(sharedHeap, size);
     55        }
     56        void operator delete(void *location)
     57        {
     58                free(location);
     59        }
     60#endif
     61
    4062private:
    4163
  • trunk/src/user32/new/initterm.cpp

    r511 r724  
    1 /* $Id: initterm.cpp,v 1.5 1999-08-16 16:55:33 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.6 1999-08-28 14:09:29 sandervl Exp $ */
    22
    33/*
     
    3636#include <spy.h>
    3737#include "pmwindow.h"
     38#include "heapshared.h"
    3839
    3940/*-------------------------------------------------------------------*/
     
    9394         InitSpyQueue();
    9495
     96         if(InitializeSharedHeap() == FALSE)
     97                return 0UL;
     98
    9599         //SvL: Init win32 PM classes
    96100         if(InitPM() == FALSE) {
     
    125129   dprintf(("user32 exit\n"));
    126130   UnregisterSystemClasses();
     131   DestroySharedHeap();
    127132   _ctordtorTerm();
    128133   dprintf(("user32 exit done\n"));
  • trunk/src/user32/new/makefile

    r693 r724  
    1 # $Id: makefile,v 1.33 1999-08-25 15:08:50 dengert Exp $
     1# $Id: makefile,v 1.34 1999-08-28 14:09:29 sandervl Exp $
    22
    33#
     
    2222
    2323OBJS =  user32.obj dialog.obj loadres.obj \
    24         dde.obj \
     24        dde.obj heapshared.obj\
    2525        icon.obj hook.obj hooks.obj winmenu.obj \
    2626        usrcall.obj defwndproc.obj syscolor.obj char.obj initterm.obj \
     
    6969defwndproc.obj: defwndproc.cpp syscolor.h
    7070hooks.obj: hooks.cpp hooks.h
    71 initterm.obj: initterm.cpp $(PDWIN32_INCLUDE)\spy.h pmwindow.h
     71initterm.obj: initterm.cpp $(PDWIN32_INCLUDE)\spy.h pmwindow.h heapshared.h
    7272uitools.obj: uitools.cpp
    7373unknown.obj: unknown.cpp
     
    100100
    101101pmwindow.obj:   pmwindow.cpp win32class.h win32wnd.h win32dlg.h pmwindow.h win32wndchild.h $(PDWIN32_INCLUDE)\wprocess.h oslibgdi.h oslibwin.h
    102 win32class.obj: win32class.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h
    103 win32wnd.obj:   win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h
    104 win32dlg.obj:   win32dlg.cpp win32class.h win32wnd.h win32dlg.h gen_object.h oslibwin.h win32wndchild.h
     102win32class.obj: win32class.cpp win32class.h win32wnd.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h
     103win32wnd.obj:   win32wnd.cpp win32class.h win32wnd.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h
     104win32dlg.obj:   win32dlg.cpp win32class.h win32wnd.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h
    105105win32wndchild.obj: win32wndchild.cpp win32wndchild.h
    106 gen_object.obj: gen_object.cpp gen_object.h
     106gen_object.obj: gen_object.cpp gen_object.h heapshared.h
    107107oslibwin.obj:   oslibwin.cpp oslibwin.h oslibutil.h oslibgdi.h $(PDWIN32_INCLUDE)\winconst.h
    108108oslibutil.obj:  oslibutil.cpp oslibutil.h $(PDWIN32_INCLUDE)\wprocess.h oslibmsg.h
     
    114114dib.obj:        dib.cpp dib.h
    115115
     116heapshared.obj: heapshared.cpp heapshared.h
     117
    116118clean:
    117119        $(RM) *.obj *.lib *.dll *~ *.map *.pch
  • trunk/src/user32/new/oslibwin.cpp

    r715 r724  
    1 /* $Id: oslibwin.cpp,v 1.25 1999-08-27 17:50:56 dengert Exp $ */
     1/* $Id: oslibwin.cpp,v 1.26 1999-08-28 14:09:29 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    675675//******************************************************************************
    676676//******************************************************************************
    677 
     677HWND OSLibWinBeginEnumWindows(HWND hwnd)
     678{
     679   if(hwnd == OSLIB_HWND_DESKTOP)       hwnd = HWND_DESKTOP;
     680
     681   return WinBeginEnumWindows(hwnd);
     682}
     683//******************************************************************************
     684//******************************************************************************
     685HWND OSLibWinGetNextWindow(HWND hwndEnum)
     686{
     687   return WinGetNextWindow(hwndEnum);
     688}
     689//******************************************************************************
     690//******************************************************************************
     691HWND OSLibWinQueryClientWindow(HWND hwndFrame)
     692{
     693 HWND hwndClient = 0;
     694
     695   if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME)
     696          hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT);
     697
     698   return hwndClient;
     699}
     700//******************************************************************************
     701//******************************************************************************
     702BOOL OSLibWinEndEnumWindows(HWND hwndEnum)
     703{
     704   return WinEndEnumWindows(hwndEnum);
     705}
     706//******************************************************************************
     707//******************************************************************************
  • trunk/src/user32/new/oslibwin.h

    r715 r724  
    1 /* $Id: oslibwin.h,v 1.22 1999-08-27 17:50:56 dengert Exp $ */
     1/* $Id: oslibwin.h,v 1.23 1999-08-28 14:09:29 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    237237void  OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame);
    238238
     239HWND  OSLibWinBeginEnumWindows(HWND hwnd);
     240HWND  OSLibWinGetNextWindow(HWND hwndEnum);
     241HWND  OSLibWinQueryClientWindow(HWND hwndFrame);
     242BOOL  OSLibWinEndEnumWindows(HWND hwndEnum);
     243
    239244#endif //__OSLIBWIN_H__
  • trunk/src/user32/new/win32class.cpp

    r655 r724  
    1 /* $Id: win32class.cpp,v 1.7 1999-08-24 09:20:30 sandervl Exp $ */
     1/* $Id: win32class.cpp,v 1.8 1999-08-28 14:09:30 sandervl Exp $ */
    22/*
    33 * Win32 Window Class Managment Code for OS/2
     
    2828                INT len = lstrlenW((LPWSTR)wndclass->lpszClassName)+1;
    2929
    30                 classNameA = (PCHAR)malloc(len);
    31                 classNameW = (WCHAR *)malloc(len*sizeof(WCHAR));
     30                classNameA = (PCHAR)_smalloc(len);
     31                classNameW = (WCHAR *)_smalloc(len*sizeof(WCHAR));
    3232        }
    3333        else {
    3434                INT len = strlen(wndclass->lpszClassName)+1;
    3535
    36                 classNameA = (PCHAR)malloc(len);
    37                 classNameW = (WCHAR *)malloc(len*sizeof(WCHAR));
     36                classNameA = (PCHAR)_smalloc(len);
     37                classNameW = (WCHAR *)_smalloc(len*sizeof(WCHAR));
    3838        }
    3939        if(classNameA == NULL || classNameW == NULL) {
     
    9090  //User data class words/longs
    9191  if(nrExtraClassWords) {
    92         userClassLong = (ULONG *)malloc(nrExtraClassWords);
     92        userClassLong = (ULONG *)_smalloc(nrExtraClassWords);
    9393        if(userClassLong == NULL) {
    9494                dprintf(("Win32Class ctr: userClassLong == NULL!"));
     
    115115        free(menuNameW);
    116116  }
     117}
     118//******************************************************************************
     119//******************************************************************************
     120BOOL Win32WndClass::hasClassName(LPSTR classname, BOOL fUnicode)
     121{
     122  if(HIWORD(classname) == 0) {
     123        return classAtom == (DWORD)classname;
     124  }
     125  if(fUnicode) {
     126        return (lstrcmpW(classNameW, (LPWSTR)classname) == 0);
     127  }
     128  else  return (strcmp(classNameA, classname) == 0);
    117129}
    118130//******************************************************************************
     
    238250  if(HIWORD(newMenuName)) {
    239251        if(isUnicode) {
    240                 menuNameA = (PCHAR)malloc(lstrlenW((LPWSTR)newMenuName)+1);
    241                 menuNameW = (WCHAR *)malloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR));
    242         }
    243         else {
    244                 menuNameA = (PCHAR)malloc(strlen(newMenuName)+1);
    245                 menuNameW = (WCHAR *)malloc((strlen(newMenuName)+1)*sizeof(WCHAR));
     252                menuNameA = (PCHAR)_smalloc(lstrlenW((LPWSTR)newMenuName)+1);
     253                menuNameW = (WCHAR *)_smalloc((lstrlenW((LPWSTR)newMenuName)+1)*sizeof(WCHAR));
     254        }
     255        else {
     256                menuNameA = (PCHAR)_smalloc(strlen(newMenuName)+1);
     257                menuNameW = (WCHAR *)_smalloc((strlen(newMenuName)+1)*sizeof(WCHAR));
    246258        }
    247259        if(menuNameA == NULL || menuNameW == NULL) {
  • trunk/src/user32/new/win32class.h

    r614 r724  
    1 /* $Id: win32class.h,v 1.4 1999-08-22 08:30:52 sandervl Exp $ */
     1/* $Id: win32class.h,v 1.5 1999-08-28 14:09:30 sandervl Exp $ */
    22/*
    33 * Win32 Window Class Managment Code for OS/2
     
    5252          void  DecreaseWindowCount()   { cWindows--; };
    5353          DWORD GetWindowCount()        { return cWindows; };
     54
     55          BOOL  hasClassName(LPSTR classname, BOOL fUnicode = 0);
    5456         
    5557 static  void   UnregisterClassA(HINSTANCE hinst, LPSTR id);
  • trunk/src/user32/new/win32wnd.cpp

    r715 r724  
    1 /* $Id: win32wnd.cpp,v 1.31 1999-08-27 17:50:56 dengert Exp $ */
     1/* $Id: win32wnd.cpp,v 1.32 1999-08-28 14:09:30 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    1111 * Copyright 1993, 1994 Alexandre Julliard
    1212 *
     13 * TODO: Not thread/process safe
    1314 *
    1415 * Project Odin Software License can be found in LICENSE.TXT
     
    2324#include <misc.h>
    2425#include <handlemanager.h>
     26#include <heapstring.h>
    2527#include <win32wnd.h>
    2628#include <spy.h>
     
    7173  fFirstShow       = TRUE;
    7274
    73   memset(windowNameA, 0, MAX_WINDOW_NAMELENGTH);
    74   memset(windowNameW, 0, MAX_WINDOW_NAMELENGTH*sizeof(WCHAR));
     75  windowNameA      = NULL;
     76  windowNameW      = NULL;
    7577  wndNameLength    = 0;
    7678
     
    125127  if(userWindowLong)
    126128        free(userWindowLong);
     129  if(windowNameA) {
     130        free(windowNameA);
     131        windowNameA = NULL;
     132  }
     133  if(windowNameW) {
     134        free(windowNameW);
     135        windowNameW = NULL;
     136  }
    127137}
    128138//******************************************************************************
     
    249259  nrUserWindowLong = windowClass->getExtraWndWords();
    250260  if(nrUserWindowLong) {
    251         userWindowLong = (ULONG *)malloc(nrUserWindowLong);
     261        userWindowLong = (ULONG *)_smalloc(nrUserWindowLong);
    252262        memset(userWindowLong, 0, nrUserWindowLong);
    253263  }
     
    371381#endif
    372382
     383  if(cs->lpszName)
     384        SetWindowText((LPSTR)cs->lpszName);
     385
    373386  OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    374                                  dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName,
     387                                 dwOSWinStyle, dwOSFrameStyle, (char *)windowNameA,
    375388                                 (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    376389                                 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     
    985998{
    986999    if(isUnicode) {
    987         SendInternalMessageW(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameW);
     1000        SendInternalMessageW(WM_GETTEXT, wndNameLength, (LPARAM)windowNameW);
    9881001    }
    9891002    else {
    990         SendInternalMessageA(WM_GETTEXT, MAX_WINDOW_NAMELENGTH, (LPARAM)windowNameA);
     1003        SendInternalMessageA(WM_GETTEXT, wndNameLength, (LPARAM)windowNameA);
    9911004    }
    9921005    return windowNameA;
     
    16561669}
    16571670//******************************************************************************
    1658 //TODO: not complete nor correct (distinction between top-level, top-most & child windows)
     1671//TODO:
     1672//We assume (for now) that if hwndParent or hwndChildAfter are real window handles, that
     1673//the current process owns them.
     1674//******************************************************************************
     1675HWND Win32Window::FindWindowEx(HWND hwndParent, HWND hwndChildAfter, LPSTR lpszClass, LPSTR lpszWindow,
     1676                               BOOL fUnicode)
     1677{
     1678 Win32Window *parent = GetWindowFromHandle(hwndParent);
     1679 Win32Window *child  = GetWindowFromHandle(hwndChildAfter);
     1680
     1681    if((hwndParent != OSLIB_HWND_DESKTOP && !parent) ||
     1682       (hwndChildAfter != 0 && !child) ||
     1683       (hwndParent == OSLIB_HWND_DESKTOP && hwndChildAfter != 0))
     1684    {
     1685        dprintf(("Win32Window::FindWindowEx: parent or child not found %x %x", hwndParent, hwndChildAfter));
     1686        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     1687        return 0;
     1688    }
     1689    if(hwndParent != OSLIB_HWND_DESKTOP)
     1690    {//if the current process owns the window, just do a quick search
     1691        child = (Win32Window *)parent->GetFirstChild();
     1692        if(hwndChildAfter != 0)
     1693        {
     1694            while(child)
     1695            {
     1696                if(child->getWindowHandle() == hwndChildAfter)
     1697                {
     1698                    child = (Win32Window *)child->GetNextChild();
     1699                    break;
     1700                }
     1701                child = (Win32Window *)child->GetNextChild();
     1702            }
     1703        }
     1704        while(child)
     1705        {
     1706            if(child->getWindowClass()->hasClassName(lpszClass, fUnicode) &&
     1707               (!lpszWindow || child->hasWindowName(lpszWindow, fUnicode)))
     1708            {
     1709                dprintf(("FindWindowEx: Found window %x", child->getWindowHandle()));
     1710                return child->getWindowHandle();
     1711            }
     1712            child = (Win32Window *)child->GetNextChild();
     1713        }
     1714    }
     1715    else {
     1716        Win32Window *wnd;
     1717        HWND henum, hwnd;
     1718
     1719        henum = OSLibWinBeginEnumWindows(OSLIB_HWND_DESKTOP);
     1720        hwnd = OSLibWinGetNextWindow(henum);
     1721
     1722        while(hwnd)
     1723        {
     1724            HWND hwndClient;
     1725
     1726            wnd = GetWindowFromOS2Handle(hwnd);
     1727            if(wnd == NULL) {
     1728                hwndClient = OSLibWinQueryClientWindow(hwnd);
     1729                if(hwndClient)  wnd = GetWindowFromOS2Handle(hwndClient);
     1730            }
     1731
     1732            if(wnd && wnd->getWindowClass()->hasClassName(lpszClass, fUnicode) &&
     1733               (!lpszWindow || wnd->hasWindowName(lpszWindow, fUnicode)))
     1734            {
     1735                OSLibWinEndEnumWindows(henum);
     1736                dprintf(("FindWindowEx: Found window %x", wnd->getWindowHandle()));
     1737                return wnd->getWindowHandle();
     1738            }
     1739            hwnd = OSLibWinGetNextWindow(henum);
     1740        }
     1741        OSLibWinEndEnumWindows(henum);
     1742    }
     1743    SetLastError(ERROR_CANNOT_FIND_WND_CLASS); //TODO: not always correct
     1744    return 0;
     1745}
     1746//******************************************************************************
     1747//TODO: not complete nor correct (distinction be    tween top-level, top-most & child windows)
    16591748//******************************************************************************
    16601749HWND Win32Window::GetWindow(UINT uCmd)
     
    17701859//******************************************************************************
    17711860//******************************************************************************
     1861BOOL Win32Window::hasWindowName(LPSTR wndname, BOOL fUnicode)
     1862{
     1863    if(fUnicode) {
     1864            return (lstrcmpW(windowNameW, (LPWSTR)wndname) == 0);
     1865    }
     1866    else    return (strcmp(windowNameA, wndname) == 0);
     1867}
     1868//******************************************************************************
     1869//******************************************************************************
    17721870int Win32Window::GetWindowTextLengthA()
    17731871{
     
    17821880//******************************************************************************
    17831881//******************************************************************************
    1784 BOOL Win32Window::SetWindowTextA(LPCSTR lpsz)
    1785 {
    1786   return OSLibWinSetWindowText(OS2Hwnd, (LPSTR)lpsz);
     1882BOOL Win32Window::SetWindowText(LPSTR lpsz)
     1883{
     1884    if(lpsz == NULL)
     1885        return FALSE;
     1886
     1887    if(isUnicode == FALSE) {
     1888        windowNameA = (LPSTR)_smalloc(strlen(lpsz)+1);
     1889        strcpy(windowNameA, lpsz);
     1890        windowNameW = (LPWSTR)_smalloc((strlen(lpsz)+1)*sizeof(WCHAR));
     1891        lstrcpyAtoW(windowNameW, windowNameA);
     1892    }
     1893    else {
     1894        windowNameW = (LPWSTR)_smalloc((lstrlenW((LPWSTR)lpsz)+1)*sizeof(WCHAR));
     1895        lstrcpyW(windowNameW, (LPWSTR)lpsz);
     1896        windowNameA = (LPSTR)_smalloc(lstrlenW((LPWSTR)lpsz)+1);
     1897        lstrcpyWtoA(windowNameA, windowNameW);
     1898    }
     1899    wndNameLength = strlen(windowNameA)+1; //including 0 terminator
     1900
     1901    if(OS2Hwnd)
     1902        return OSLibWinSetWindowText(OS2Hwnd, (LPSTR)windowNameA);
     1903
     1904    return TRUE;
    17871905}
    17881906//******************************************************************************
     
    18101928                return oldval;
    18111929        case GWL_HWNDPARENT:
    1812         return SetParent((HWND)value);
     1930                return SetParent((HWND)value);
    18131931
    18141932        case GWL_ID:
     
    18952013
    18962014   if(HIWORD(hwnd) != 0x6800) {
    1897     return NULL;
     2015        return NULL;
    18982016   }
    18992017
    19002018   if(HMHandleTranslateToOS2(LOWORD(hwnd), (PULONG)&window) == NO_ERROR) {
    1901     return window;
     2019        return window;
    19022020   }
    19032021   else return NULL;
     
    19142032
    19152033  if(win32wnd && CheckMagicDword(magic)) {
    1916     return win32wnd;
     2034        return win32wnd;
    19172035  }
    19182036  return 0;
  • trunk/src/user32/new/win32wnd.h

    r715 r724  
    1 /* $Id: win32wnd.h,v 1.26 1999-08-27 17:50:57 dengert Exp $ */
     1/* $Id: win32wnd.h,v 1.27 1999-08-28 14:09:30 sandervl Exp $ */
    22/*
    33 * Win32 Window Code for OS/2
     
    4545#define WM_WIN32_POSTMESSAGEW   0x4001
    4646
    47 #define MAX_WINDOW_NAMELENGTH   256
    48 
    49 class Win32Window : private GenericObject, private ChildWindow
     47class Win32Window : public GenericObject, private ChildWindow
    5048{
    5149public:
     
    9189         HWND   getOS2WindowHandle()            { return OS2Hwnd; };
    9290         HWND   getOS2FrameWindowHandle()       { return OS2HwndFrame; };
     91 Win32WndClass *getWindowClass()                { return windowClass; };
     92
    9393         BOOL   isFrameWindow()                 { return OS2Hwnd != OS2HwndFrame; };
    9494   Win32Window *getParent()                     { return (Win32Window *)ChildWindow::GetParent(); };
     
    146146         int    GetWindowTextLengthA();
    147147         int    GetWindowTextA(LPSTR lpsz, int cch);
    148          BOOL   SetWindowTextA(LPCSTR lpsz);
     148         BOOL   SetWindowText(LPSTR lpsz);
     149          BOOL  hasWindowName(LPSTR wndname, BOOL fUnicode = 0);
    149150
    150151       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
     
    158159
    159160Win32WndClass  *getClass()  { return windowClass; };
     161
     162    static HWND FindWindowEx(HWND hwndParent, HWND hwndChildAfter, LPSTR lpszClass, LPSTR lpszWindow,
     163                             BOOL fUnicode = 0);
    160164
    161165static   HWND  Win32ToOS2Handle(HWND hwnd)
     
    219223 Win32Resource *iconResource;
    220224
    221         char    windowNameA[MAX_WINDOW_NAMELENGTH];
    222         WCHAR   windowNameW[MAX_WINDOW_NAMELENGTH];
    223         ULONG   wndNameLength;
     225        char   *windowNameA;
     226        WCHAR  *windowNameW;
     227        ULONG   wndNameLength; //including 0 terminator
    224228
    225229        ULONG  *userWindowLong;
  • trunk/src/user32/new/win32wndchild.cpp

    r314 r724  
    1 /* $Id: win32wndchild.cpp,v 1.1 1999-07-16 11:32:09 sandervl Exp $ */
     1/* $Id: win32wndchild.cpp,v 1.2 1999-08-28 14:09:30 sandervl Exp $ */
    22/*
    33 * Win32 Child/Parent window class for OS/2
     
    3535}
    3636//******************************************************************************
    37 //LIFO insertion
     37//FIFO insertion
    3838//******************************************************************************
    3939BOOL ChildWindow::AddChild(ChildWindow *child)
    4040{
     41 ChildWindow *curchild;
     42
    4143   mutex.enter();
    4244
    43    child->SetNextChild(children);
    44    children = child;
     45   curchild = children;
     46   if(curchild == NULL) {
     47        children = child;
     48   }
     49   else {
     50        while(curchild->GetNextChild()) {
     51                curchild = curchild->GetNextChild();
     52        }
     53        curchild->SetNextChild(this);
     54   }
     55   child->SetNextChild(NULL);
    4556
    4657   mutex.leave();
  • trunk/src/user32/new/win32wndchild.h

    r314 r724  
    1 /* $Id: win32wndchild.h,v 1.1 1999-07-16 11:32:09 sandervl Exp $ */
     1/* $Id: win32wndchild.h,v 1.2 1999-08-28 14:09:30 sandervl Exp $ */
    22/*
    33 * Win32 Child/Parent window class for OS/2
     
    3636        BOOL   AddChild(ChildWindow *child);
    3737        BOOL   RemoveChild(ChildWindow *child);
     38
     39ChildWindow   *GetFirstChild()                  { return children; };
    3840ChildWindow   *GetNextChild()                   { return nextchild; };
    3941        void   SetNextChild(ChildWindow *child) { nextchild = child; };
  • trunk/src/user32/new/window.cpp

    r713 r724  
    1 /* $Id: window.cpp,v 1.16 1999-08-27 16:52:09 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.17 1999-08-28 14:09:30 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    568568    }
    569569    dprintf(("SetWindowTextA %x %s", hwnd, lpsz));
    570     return window->SetWindowTextA(lpsz);
     570    return window->SetWindowText((LPSTR)lpsz);
    571571}
    572572//******************************************************************************
     
    645645HWND WIN32API FindWindowA(LPCSTR lpszClass, LPCSTR lpszWindow)
    646646{
     647    if(!lpszClass) {
     648        SetLastError(ERROR_INVALID_PARAMETER);
     649        return 0;
     650    }
    647651    if(HIWORD(lpszClass)) {
    648652         dprintf(("USER32:  FindWindow %s %s\n", lpszClass, lpszWindow));
    649653    }
    650654    else dprintf(("USER32:  FindWindow %x %s\n", lpszClass, lpszWindow));
    651     return O32_FindWindow(lpszClass, lpszWindow);
    652 }
    653 //******************************************************************************
    654 //******************************************************************************
    655 HWND WIN32API FindWindowExA(HWND hwnd1, HWND hwnd2, LPCSTR lpszClass, LPCSTR lpszWindow)
    656 {
    657 #ifdef DEBUG
    658     WriteLog("USER32:  FindWindowExA, not completely implemented\n");
    659 #endif
    660     return FindWindowA(lpszClass, lpszWindow);
     655
     656    return Win32Window::FindWindowEx(OSLIB_HWND_DESKTOP, 0, (LPSTR)lpszClass, (LPSTR)lpszWindow);
     657}
     658//******************************************************************************
     659//******************************************************************************
     660HWND WIN32API FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
     661{
     662    if(!lpszClass) {
     663        SetLastError(ERROR_INVALID_PARAMETER);
     664        return 0;
     665    }
     666    if(HIWORD(lpszClass)) {
     667         dprintf(("USER32:  FindWindowExA (%x,%x) %s %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
     668    }
     669    else dprintf(("USER32:  FindWindowExA (%x,%x)%x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
     670
     671    return Win32Window::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
    661672}
    662673/*****************************************************************************
     
    686697                               LPCWSTR lpszWindow)
    687698{
    688   dprintf(("USER32:FindWindowExW (%08xh,%08xh,%s,%s) not implemented.\n",
    689          hwndParent,
    690          hwndChildAfter,
    691          lpszClass,
    692         lpszWindow));
    693 
    694   return (NULL);
     699    if(!lpszClass) {
     700        SetLastError(ERROR_INVALID_PARAMETER);
     701        return 0;
     702    }
     703    dprintf(("USER32:  FindWindowExW (%x,%x) %x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
     704
     705    return Win32Window::FindWindowEx(hwndParent, hwndChildAfter, (LPSTR)lpszClass, (LPSTR)lpszWindow);
    695706}
    696707//******************************************************************************
  • trunk/src/user32/new/wingdi.cpp

    r650 r724  
    1 /* $Id: wingdi.cpp,v 1.9 1999-08-23 15:34:47 dengert Exp $ */
     1/* $Id: wingdi.cpp,v 1.10 1999-08-28 14:09:31 sandervl Exp $ */
    22/*
    33 * Win32 Window graphics apis for OS/2
     
    3232        return 0;
    3333    }
     34    window->MsgEraseBackGround(hdc);
    3435#ifdef OPEN32_GDI
    3536    hdc = O32_BeginPaint(window->getOS2WindowHandle(),lps);
Note: See TracChangeset for help on using the changeset viewer.