Ignore:
Timestamp:
Dec 17, 2000, 4:04:14 PM (25 years ago)
Author:
sandervl
Message:

hook, mdi & focus fixes

File:
1 edited

Legend:

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

    r4658 r4825  
    1 /* $Id: win32wbase.cpp,v 1.224 2000-11-21 11:36:09 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.225 2000-12-17 15:04:11 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    194194    }
    195195
     196    /* Decrement class window counter */
     197    if(windowClass) {
     198        windowClass->DecreaseWindowCount();
     199    }
     200
    196201    if(isOwnDC())
    197202        releaseOwnDC(ownDC);
     
    290295    }
    291296
    292   /* Find the window class */
    293   windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom);
    294   if (!windowClass)
    295   {
     297    /* Find the window class */
     298    windowClass = Win32WndClass::FindClass(cs->hInstance, (LPSTR)classAtom);
     299    if (!windowClass)
     300    {
    296301        GlobalGetAtomNameA( classAtom, buffer, sizeof(buffer) );
    297302        dprintf(("Bad class '%s'\n", buffer ));
    298303        SetLastError(ERROR_INVALID_PARAMETER);
    299304        return 0;
    300   }
     305    }
     306    /* Increment class window counter */
     307    windowClass->IncreaseWindowCount();
     308
    301309#ifdef DEBUG
    302   if(HIWORD(cs->lpszClass))
    303   {
     310    if(HIWORD(cs->lpszClass))
     311    {
    304312        char *astring;
    305313
     
    309317        dprintf(("Window class %s", astring));
    310318        if(isUnicode) FreeAsciiString(astring);
    311   }
    312   else dprintf(("Window class %x", cs->lpszClass));
     319    }
     320    else dprintf(("Window class %x", cs->lpszClass));
    313321#endif
    314322
    315   /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX
    316    * with an atom as the class name, put some programs expect to have a *REAL* string in
    317    * lpszClass when the CREATESTRUCT is sent with WM_CREATE
    318    */
    319   if (!HIWORD(cs->lpszClass) ) {
     323    /* Fix the lpszClass field: from existing programs, it seems ok to call a CreateWindowXXX
     324     * with an atom as the class name, put some programs expect to have a *REAL* string in
     325     * lpszClass when the CREATESTRUCT is sent with WM_CREATE
     326     */
     327    if (!HIWORD(cs->lpszClass) ) {
    320328        if (isUnicode) {
    321329                GlobalGetAtomNameW( classAtom, (LPWSTR)buffer, sizeof(buffer) );
     
    325333        }
    326334        cs->lpszClass = buffer;
    327   }
    328 
    329   /* Fix the coordinates */
    330   fXDefault = FALSE;
    331   fCXDefault = FALSE;
    332   if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))
    333   {
     335    }
     336
     337    /* Fix the coordinates */
     338    fXDefault = FALSE;
     339    fCXDefault = FALSE;
     340    if ((cs->x == CW_USEDEFAULT) || (cs->x == CW_USEDEFAULT16))
     341    {
    334342       /* Never believe Microsoft's documentation... CreateWindowEx doc says
    335343        * that if an overlapped window is created with WS_VISIBLE style bit
     
    354362        cs->y = 0;
    355363        fXDefault = TRUE;
    356   }
    357   if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))
    358   {
     364    }
     365    if ((cs->cx == CW_USEDEFAULT) || (cs->cx == CW_USEDEFAULT16))
     366    {
    359367        cs->cx = 600; /* FIXME */
    360368        cs->cy = 400;
    361369        fCXDefault = TRUE;
    362   }
    363   if (cs->style & (WS_POPUP | WS_CHILD))
    364   {
    365     fXDefault = FALSE;
    366     if (fCXDefault)
    367     {
    368       fCXDefault = FALSE;
    369       cs->cx = cs->cy = 0;
    370     }
    371   }
    372   if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe)
    373 
    374   if (cs->x < 0) cs->x = 0;
    375   if (cs->y < 0) cs->y = 0;
    376 
    377   //Allocate window words
    378   nrUserWindowLong = windowClass->getExtraWndWords();
    379   if(nrUserWindowLong) {
     370    }
     371    if (cs->style & (WS_POPUP | WS_CHILD))
     372    {
     373        fXDefault = FALSE;
     374        if (fCXDefault)
     375        {
     376        fCXDefault = FALSE;
     377        cs->cx = cs->cy = 0;
     378        }
     379    }
     380    if (fXDefault && !fCXDefault) fXDefault = FALSE; //CB: only x positioning doesn't work (calc.exe,cdrlabel.exe)
     381
     382    if (cs->x < 0) cs->x = 0;
     383    if (cs->y < 0) cs->y = 0;
     384
     385    //Allocate window words
     386    nrUserWindowLong = windowClass->getExtraWndWords();
     387    if(nrUserWindowLong) {
    380388        userWindowLong = (ULONG *)_smalloc(nrUserWindowLong);
    381389        memset(userWindowLong, 0, nrUserWindowLong);
    382   }
    383 
    384   if ((cs->style & WS_CHILD) && cs->hwndParent)
    385   {
     390    }
     391
     392    if ((cs->style & WS_CHILD) && cs->hwndParent)
     393    {
    386394        SetParent(cs->hwndParent);
    387395//        owner = GetWindowFromHandle(cs->hwndParent);
    388     owner = 0;
     396        owner = 0;
    389397/*        if(owner == NULL)
    390398        {
     
    395403        //SvL: Shell positioning shouldn't be done for child windows! (breaks Notes)
    396404        fXDefault = fCXDefault = FALSE;
    397   }
    398   else
    399   {
     405    }
     406    else
     407    {
    400408        SetParent(0);
    401409        if (!cs->hwndParent || (cs->hwndParent == windowDesktop->getWindowHandle())) {
     
    412420            }
    413421        }
    414   }
    415 
    416   WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW);
    417   hInstance = cs->hInstance;
    418   dwStyle   = cs->style & ~WS_VISIBLE;
    419   dwExStyle = cs->dwExStyle;
    420 
    421   hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
    422 
    423   /* Increment class window counter */
    424   windowClass->IncreaseWindowCount();
    425 
    426   if (HOOK_IsHooked( WH_CBT ))
    427   {
     422    }
     423
     424    WINPROC_SetProc((HWINDOWPROC *)&win32wndproc, windowClass->getWindowProc(), WINPROC_GetProcType(windowClass->getWindowProc()), WIN_PROC_WINDOW);
     425    hInstance = cs->hInstance;
     426    dwStyle   = cs->style & ~WS_VISIBLE;
     427    dwExStyle = cs->dwExStyle;
     428
     429    hwndLinkAfter = ((cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
     430
     431    /* Correct the window style */
     432    if (!(cs->style & WS_CHILD))
     433    {
     434        dwStyle |= WS_CLIPSIBLINGS;
     435        if (!(cs->style & WS_POPUP))
     436        {
     437            dwStyle |= WS_CAPTION;
     438            flags |= WIN_NEED_SIZE;
     439        }
     440    }
     441    if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
     442
     443    //copy pointer of CREATESTRUCT for usage in MsgCreate method
     444    tmpcs = cs;
     445
     446    //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
     447    TEB *teb = GetThreadTEB();
     448    if(teb == NULL) {
     449        dprintf(("Window creation failed - teb == NULL")); //this is VERY bad
     450        ExitProcess(666);
     451        return FALSE;
     452    }
     453
     454    teb->o.odin.newWindow = (ULONG)this;
     455
     456    DWORD dwOSWinStyle;
     457
     458    OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle);
     459
     460    OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
     461                                   dwOSWinStyle,(char *)windowNameA,
     462                                   (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP),
     463                                   (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
     464                                   0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle());
     465    if(OS2Hwnd == 0) {
     466        dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError()));
     467        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     468        return FALSE;
     469    }
     470    OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE);
     471    SetLastError(0);
     472    return TRUE;
     473}
     474//******************************************************************************
     475//******************************************************************************
     476BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2)
     477{
     478 CREATESTRUCTA  *cs = tmpcs;  //pointer to CREATESTRUCT used in CreateWindowExA method
     479 POINT maxSize, maxPos, minTrack, maxTrack;
     480
     481    OS2Hwnd      = hwndOS2;
     482
     483    fNoSizeMsg = TRUE;
     484
     485    if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
     486        dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
     487        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     488        return FALSE;
     489    }
     490    if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
     491        dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
     492        SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     493        return FALSE;
     494    }
     495
     496    if (HOOK_IsHooked( WH_CBT ))
     497    {
    428498        CBT_CREATEWNDA cbtc;
    429499        LRESULT ret;
     
    431501        cbtc.lpcs = cs;
    432502        cbtc.hwndInsertAfter = hwndLinkAfter;
    433         ret = HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc);
     503        ret = (isUnicode) ? HOOK_CallHooksW(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc)
     504                          : HOOK_CallHooksA(WH_CBT, HCBT_CREATEWND, getWindowHandle(), (LPARAM)&cbtc);
    434505        if(ret)
    435506        {
     
    438509            return FALSE;
    439510        }
    440   }
    441 
    442   /* Correct the window style */
    443   if (!(cs->style & WS_CHILD))
    444   {
    445         dwStyle |= WS_CLIPSIBLINGS;
    446         if (!(cs->style & WS_POPUP))
    447         {
    448             dwStyle |= WS_CAPTION;
    449             flags |= WIN_NEED_SIZE;
    450         }
    451   }
    452   if (cs->dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
    453 
    454   if (cs->style & WS_HSCROLL)
    455   {
     511        //todo: if hook changes parent, we need to do so too!!!!!!!!!!
     512    }
     513
     514    if (cs->style & WS_HSCROLL)
     515    {
    456516        horzScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
    457517        horzScrollInfo->MinVal = horzScrollInfo->CurVal = horzScrollInfo->Page = 0;
    458518        horzScrollInfo->MaxVal = 100;
    459519        horzScrollInfo->flags  = ESB_ENABLE_BOTH;
    460   }
    461 
    462   if (cs->style & WS_VSCROLL)
    463   {
     520    }
     521
     522    if (cs->style & WS_VSCROLL)
     523    {
    464524        vertScrollInfo = (SCROLLBAR_INFO*)malloc(sizeof(SCROLLBAR_INFO));
    465525        vertScrollInfo->MinVal = vertScrollInfo->CurVal = vertScrollInfo->Page = 0;
    466526        vertScrollInfo->MaxVal = 100;
    467527        vertScrollInfo->flags  = ESB_ENABLE_BOTH;
    468   }
    469 
    470   if(HIWORD(cs->lpszName))
    471   {
    472     if (!isUnicode)
    473     {
    474         wndNameLength = strlen(cs->lpszName);
    475         windowNameA = (LPSTR)_smalloc(wndNameLength+1);
    476         strcpy(windowNameA,cs->lpszName);
    477         windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    478         lstrcpyAtoW(windowNameW,windowNameA);
    479         windowNameA[wndNameLength] = 0;
    480         windowNameW[wndNameLength] = 0;
    481     }
    482     else
    483     {
    484         wndNameLength = lstrlenW((LPWSTR)cs->lpszName);
    485         windowNameA = (LPSTR)_smalloc(wndNameLength+1);
    486         lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName);
    487         windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
    488         lstrcpyW(windowNameW,(LPWSTR)cs->lpszName);
    489         windowNameA[wndNameLength] = 0;
    490         windowNameW[wndNameLength] = 0;
    491     }
    492   }
    493 
    494   //copy pointer of CREATESTRUCT for usage in MsgCreate method
    495   tmpcs = cs;
    496 
    497   //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it
    498   TEB *teb = GetThreadTEB();
    499 
    500   if(teb == NULL) {
    501         dprintf(("Window creation failed - teb == NULL")); //this is VERY bad
    502         ExitProcess(666);
    503         return FALSE;
    504   }
    505 
    506   teb->o.odin.newWindow = (ULONG)this;
    507 
    508   DWORD dwOSWinStyle;
    509 
    510   OSLibWinConvertStyle(dwStyle,dwExStyle,&dwOSWinStyle);
    511 
    512   OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP,
    513                                  dwOSWinStyle,(char *)windowNameA,
    514                                  (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP),
    515                                  (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    516                                  0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle());
    517   if(OS2Hwnd == 0) {
    518         dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError()));
    519         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    520         return FALSE;
    521   }
    522   OSLibWinSetVisibleRegionNotify(OS2Hwnd, TRUE);
    523   SetLastError(0);
    524   return TRUE;
    525 }
    526 //******************************************************************************
    527 //******************************************************************************
    528 BOOL Win32BaseWindow::MsgCreate(HWND hwndOS2)
    529 {
    530  CREATESTRUCTA  *cs = tmpcs;  //pointer to CREATESTRUCT used in CreateWindowExA method
    531  POINT maxSize, maxPos, minTrack, maxTrack;
    532 
    533   OS2Hwnd      = hwndOS2;
    534 
    535   fNoSizeMsg = TRUE;
    536 
    537   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {
    538         dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2Hwnd));
    539         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    540         return FALSE;
    541   }
    542   if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {
    543         dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2Hwnd));
    544         SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    545         return FALSE;
    546   }
     528    }
     529
     530    if(HIWORD(cs->lpszName))
     531    {
     532        if (!isUnicode)
     533        {
     534            wndNameLength = strlen(cs->lpszName);
     535            windowNameA = (LPSTR)_smalloc(wndNameLength+1);
     536            strcpy(windowNameA,cs->lpszName);
     537            windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
     538            lstrcpyAtoW(windowNameW,windowNameA);
     539            windowNameA[wndNameLength] = 0;
     540            windowNameW[wndNameLength] = 0;
     541        }
     542        else
     543        {
     544            wndNameLength = lstrlenW((LPWSTR)cs->lpszName);
     545            windowNameA = (LPSTR)_smalloc(wndNameLength+1);
     546            lstrcpyWtoA(windowNameA,(LPWSTR)cs->lpszName);
     547            windowNameW = (LPWSTR)_smalloc((wndNameLength+1)*sizeof(WCHAR));
     548            lstrcpyW(windowNameW,(LPWSTR)cs->lpszName);
     549            windowNameA[wndNameLength] = 0;
     550            windowNameW[wndNameLength] = 0;
     551        }
     552    }
     553
    547554
    548555//SvL: This completely messes up MS Word 97 (no button bar, no menu)
     
    573580#endif
    574581
    575   fakeWinBase.hwndThis     = OS2Hwnd;
    576   fakeWinBase.pWindowClass = windowClass;
    577 
    578   //Set icon from window or class
    579   if (hIcon)
    580     OSLibWinSetIcon(OS2Hwnd,hIcon);
    581   else if (windowClass->getIcon())
    582     OSLibWinSetIcon(OS2Hwnd,windowClass->getIcon());
    583 
    584   /* Get class or window DC if needed */
    585   if(windowClass->getStyle() & CS_OWNDC) {
     582    fakeWinBase.hwndThis     = OS2Hwnd;
     583    fakeWinBase.pWindowClass = windowClass;
     584
     585    //Set icon from window or class
     586    if (hIcon)
     587        OSLibWinSetIcon(OS2Hwnd,hIcon);
     588    else
     589    if (windowClass->getIcon())
     590        OSLibWinSetIcon(OS2Hwnd,windowClass->getIcon());
     591
     592    /* Get class or window DC if needed */
     593    if(windowClass->getStyle() & CS_OWNDC) {
    586594        dprintf(("Class with CS_OWNDC style"));
    587595        ownDC = GetDCEx(getWindowHandle(), NULL, DCX_USESTYLE);
    588   }
    589   else
    590   if (windowClass->getStyle() & CS_PARENTDC)  {
     596    }
     597    else
     598    if (windowClass->getStyle() & CS_PARENTDC)  {
    591599        fParentDC = TRUE;
    592600        ownDC = 0;
    593   }
    594   else
    595   if (windowClass->getStyle() & CS_CLASSDC)  {
     601    }
     602    else
     603    if (windowClass->getStyle() & CS_CLASSDC)  {
    596604        dprintf(("WARNING: Class with CS_CLASSDC style!"));
    597605        ownDC = 0;
    598   }
    599   /* Set the window menu */
    600   if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
    601   {
     606    }
     607    /* Set the window menu */
     608    if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION )
     609    {
    602610        if (cs->hMenu) {
    603611            ::SetMenu(getWindowHandle(), cs->hMenu);
     
    612620                }
    613621        }
    614   }
    615   else
    616   {
     622    }
     623    else
     624    {
    617625        setWindowId((DWORD)cs->hMenu);
    618   }
    619   hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0;
    620 
    621   /* Send the WM_GETMINMAXINFO message and fix the size if needed */
    622   if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
    623   {
    624         GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
     626    }
     627    hSysMenu = (dwStyle & WS_SYSMENU) ? MENU_GetSysMenu(Win32Hwnd,0):0;
     628
     629    /* Send the WM_GETMINMAXINFO message and fix the size if needed */
     630    if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
     631    {
     632         GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
    625633        if (maxSize.x < cs->cx) cs->cx = maxSize.x;
    626634        if (maxSize.y < cs->cy) cs->cy = maxSize.y;
    627635        if (cs->cx < minTrack.x) cs->cx = minTrack.x;
    628636        if (cs->cy < minTrack.y) cs->cy = minTrack.y;
    629   }
    630 
    631   if(cs->style & WS_CHILD)
    632   {
     637    }
     638
     639    if(cs->style & WS_CHILD)
     640    {
    633641        if(cs->cx < 0) cs->cx = 0;
    634642        if(cs->cy < 0) cs->cy = 0;
    635   }
    636   else
    637   {
     643    }
     644    else
     645    {
    638646        if (cs->cx <= 0) cs->cx = 1;
    639647        if (cs->cy <= 0) cs->cy = 1;
    640   }
    641 
    642   //set client & window rectangles from CreateWindowEx CREATESTRUCT
    643   rectWindow.left = cs->x;
    644   rectWindow.right = cs->x+cs->cx;
    645   rectWindow.top = cs->y;
    646   rectWindow.bottom = cs->y+cs->cy;
    647   rectClient = rectWindow;
    648   OffsetRect(&rectClient, -rectClient.left, -rectClient.top);
    649 
    650   /* Send the WM_CREATE message
    651    * Perhaps we shouldn't allow width/height changes as well.
    652    * See p327 in "Internals".
    653    */
    654   maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
    655 
    656   //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE
    657   fCreated = TRUE;
    658 
    659   if(fTaskList) {
    660     hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);
    661   }
    662 
    663   //cs is ascii version of create structure. so use SendInternalMessageA
    664   if(SendInternalMessageA(WM_NCCREATE,0,(LPARAM)cs))
    665   {
     648    }
     649
     650    //set client & window rectangles from CreateWindowEx CREATESTRUCT
     651    rectWindow.left = cs->x;
     652    rectWindow.right = cs->x+cs->cx;
     653    rectWindow.top = cs->y;
     654    rectWindow.bottom = cs->y+cs->cy;
     655    rectClient = rectWindow;
     656    OffsetRect(&rectClient, -rectClient.left, -rectClient.top);
     657
     658    /* Send the WM_CREATE message
     659     * Perhaps we shouldn't allow width/height changes as well.
     660     * See p327 in "Internals".
     661     */
     662    maxPos.x = rectWindow.left; maxPos.y = rectWindow.top;
     663
     664    //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE
     665    fCreated = TRUE;
     666
     667    if(fTaskList) {
     668        hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);
     669    }
     670
     671    //cs is ascii version of create structure. so use SendInternalMessageA
     672    if(SendInternalMessageA(WM_NCCREATE,0,(LPARAM)cs))
     673    {
    666674        RECT tmpRect;
    667675
     
    722730            return TRUE;
    723731        }
    724   }
    725   dprintf(("Window creation FAILED (NCCREATE cancelled creation)"));
    726   SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
     732    }
     733    dprintf(("Window creation FAILED (NCCREATE cancelled creation)"));
     734    SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error
    727735end:
    728   return FALSE;
     736    return FALSE;
    729737}
    730738//******************************************************************************
     
    23672375{
    23682376    MsgFormatFrame(NULL);
    2369     if(RECT_WIDTH(rectClient) != RECT_WIDTH(*oldClientRect) || 
    2370        RECT_HEIGHT(rectClient) != RECT_HEIGHT(*oldClientRect)) 
     2377    if(RECT_WIDTH(rectClient) != RECT_WIDTH(*oldClientRect) ||
     2378       RECT_HEIGHT(rectClient) != RECT_HEIGHT(*oldClientRect))
    23712379    {
    23722380         wpos->flags &= ~SWP_NOSIZE;
     
    28242832    {
    28252833    case GW_HWNDFIRST:
    2826         if(getParent()) {
    2827              window = (Win32BaseWindow *)getParent();
    2828              hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP);
    2829              window = GetWindowFromOS2Handle(hwndRelated);
    2830          if(window) {
     2834        if(getParent())
     2835        {
     2836            window = (Win32BaseWindow *)getParent();
     2837            hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP);
     2838            window = GetWindowFromOS2Handle(hwndRelated);
     2839            if(window) {
    28312840                  hwndRelated = window->getWindowHandle();
    2832              }
    2833              else hwndRelated = 0;
    2834         }
    2835     else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
     2841            }
     2842            else hwndRelated = 0;
     2843        }
     2844        else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
    28362845        break;
    28372846
    28382847    case GW_HWNDLAST:
    28392848        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_BOTTOM);
    2840     window = GetWindowFromOS2Handle(hwndRelated);
    2841     if(window) {
     2849        window = GetWindowFromOS2Handle(hwndRelated);
     2850        if(window) {
    28422851             hwndRelated = window->getWindowHandle();
    28432852        }
    2844     else hwndRelated = 0;
     2853        else hwndRelated = 0;
    28452854        break;
    28462855
    28472856    case GW_HWNDNEXT:
    28482857        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_NEXT);
    2849     window = GetWindowFromOS2Handle(hwndRelated);
    2850     if(window) {
     2858        window = GetWindowFromOS2Handle(hwndRelated);
     2859        if(window) {
    28512860             hwndRelated = window->getWindowHandle();
    28522861        }
    2853     else hwndRelated = 0;
     2862        else hwndRelated = 0;
    28542863        break;
    28552864
    28562865    case GW_HWNDPREV:
    28572866        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_PREV);
    2858     window = GetWindowFromOS2Handle(hwndRelated);
    2859     if(window) {
     2867        window = GetWindowFromOS2Handle(hwndRelated);
     2868        if(window) {
    28602869             hwndRelated = window->getWindowHandle();
    28612870        }
    2862     else hwndRelated = 0;
     2871        else hwndRelated = 0;
    28632872        break;
    28642873
     
    28712880    case GW_CHILD:
    28722881        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP);
    2873     window = GetWindowFromOS2Handle(hwndRelated);
    2874     if(window) {
     2882        window = GetWindowFromOS2Handle(hwndRelated);
     2883        if(window) {
    28752884             hwndRelated = window->getWindowHandle();
    28762885        }
    2877     else hwndRelated = 0;
     2886        else hwndRelated = 0;
    28782887        break;
    28792888    }
     
    29832992 BOOL rc;
    29842993
     2994  dprintf(("Win32BaseWindow::EnableWindow %x %d", getWindowHandle(), fEnable));
    29852995  //return true if previous state was disabled, else false (sdk docs)
    29862996  rc = (getStyle() & WS_DISABLED) != 0;
Note: See TracChangeset for help on using the changeset viewer.