Ignore:
Timestamp:
May 11, 2001, 10:39:46 AM (24 years ago)
Author:
sandervl
Message:

client/frame rewrite

File:
1 edited

Legend:

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

    r5646 r5685  
    1 /* $Id: win32wbase.cpp,v 1.254 2001-05-03 17:51:01 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.255 2001-05-11 08:39:45 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
    44 *
    5  * Copyright 1998-2000 Sander van Leeuwen (sandervl@xs4all.nl)
     5 * Copyright 1998-2001 Sander van Leeuwen (sandervl@xs4all.nl)
    66 * Copyright 1999      Daniela Engert (dani@ngrt.de)
    77 * Copyright 1999-2000 Christoph Bratschi (cbratschi@datacomm.ch)
     
    106106  fCreationFinished= FALSE;
    107107  fMinMaxChange    = FALSE;
    108   fOwnDCDirty      = FALSE;
     108  fVisibleRegionChanged = FALSE;
     109  fEraseBkgndFlag  = TRUE;
    109110
    110111  windowNameA      = NULL;
     
    116117  magic            = WIN32PM_MAGIC;
    117118  OS2Hwnd          = 0;
     119  OS2HwndFrame     = 0;
    118120  hSysMenu         = 0;
    119121  Win32Hwnd        = 0;
     
    146148  hIcon              = 0;
    147149  hIconSm            = 0;
    148 
    149   EraseBkgndFlag     = TRUE;
    150150
    151151  horzScrollInfo     = NULL;
     
    467467                                   (owner) ? owner->getOS2WindowHandle() : ((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP),
    468468                                   (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE,
    469                                    0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle());
     469                                   0, fTaskList,fXDefault | fCXDefault,windowClass->getStyle(), &OS2HwndFrame);
    470470    if(OS2Hwnd == 0) {
    471471        dprintf(("Window creation failed!! OS LastError %0x", OSLibWinGetLastError()));
     
    688688
    689689    if(fTaskList) {
    690         hTaskList = OSLibWinAddToTaskList(OS2Hwnd, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);
     690        hTaskList = OSLibWinAddToTaskList(OS2HwndFrame, windowNameA, (cs->style & WS_VISIBLE) ? 1 : 0);
    691691    }
    692692
     
    871871    else setStyle(getStyle() & ~WS_VISIBLE);
    872872
    873     return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
     873    //already sent from ShowWindow
     874////    return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
     875    return 0;
    874876}
    875877//******************************************************************************
     
    897899//******************************************************************************
    898900//******************************************************************************
    899 #if 0
    900 ULONG Win32BaseWindow::MsgMinMax()
    901 {
    902 
    903 }
    904 #endif
    905 //******************************************************************************
    906 //******************************************************************************
    907901ULONG Win32BaseWindow::MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos)
    908902{
     
    911905  return SendInternalMessageA(msg, MAKELONG(scrollCode, scrollPos), 0);
    912906}
    913 //******************************************************************************
    914 //******************************************************************************
    915 #ifndef ODIN_HITTEST
    916 ULONG Win32BaseWindow::MsgHitTest(MSG *msg)
    917 {
    918   lastHitTestVal = DispatchMsgA(msg);
    919 
    920   dprintf2(("MsgHitTest %x (%d,%d) (%d,%d) (%d,%d) returned %x", getWindowHandle(), LOWORD(msg->lParam), HIWORD(msg->lParam), rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom, lastHitTestVal));
    921 
    922   if (lastHitTestVal == HTTRANSPARENT)
    923     return HTOS_TRANSPARENT;
    924   else
    925     return HTOS_NORMAL;
    926 }
    927 #endif
    928907//******************************************************************************
    929908//******************************************************************************
     
    957936
    958937    if(hwndOS2Win) {
    959             threadidhwnd = O32_GetWindowThreadProcessId(hwndOS2Win, &procidhwnd);
    960     }
    961 //Warning: temporary hack to force focus to newly created window
    962 //RealPlayer 8 does not pass WM_ACTIVATE to defwindowproc and doesn't call
    963 //setfocus -> keyboard focus not set
    964 //TODO: Find real cause!!
     938        threadidhwnd = O32_GetWindowThreadProcessId(hwndOS2Win, &procidhwnd);
     939    }
     940    //Warning: temporary hack to force focus to newly created window
     941    //RealPlayer 8 does not pass WM_ACTIVATE to defwindowproc and doesn't call
     942    //setfocus -> keyboard focus not set
     943    //TODO: Find real cause!!
    965944    if(GetFocus() == 0 && fActivate) {
    966945        if(!(getStyle() & WS_MINIMIZE))
    967946            SetFocus(getWindowHandle());
    968947    }
    969 //Warning: temporary hack to force focus to newly created window
     948    //Warning: temporary hack to force focus to newly created window
    970949
    971950    if(fActivate) {
    972             SendInternalMessageA(WM_ACTIVATEAPP, 1, dwThreadId);    //activate; specify window thread id
    973     }
    974     else    SendInternalMessageA(WM_ACTIVATEAPP, 0, threadidhwnd);  //deactivate; specify thread id of other process
     951         SendInternalMessageA(WM_ACTIVATEAPP, 1, dwThreadId);    //activate; specify window thread id
     952    }
     953    else SendInternalMessageA(WM_ACTIVATEAPP, 0, threadidhwnd);  //deactivate; specify thread id of other process
    975954    return rc;
    976955}
     
    10671046
    10681047                    //SvL: Calling OSLibSetActiveWindow(hwndTop); causes focus problems
    1069                     if (win32top) OSLibWinSetFocus(win32top->getOS2WindowHandle());
     1048                    if (win32top) OSLibWinSetFocus(win32top->getOS2FrameWindowHandle());
    10701049                }
    10711050        }
     
    11221101}
    11231102//******************************************************************************
    1124 //******************************************************************************
    1125 ULONG Win32BaseWindow::MsgNCPaint()
    1126 {
    1127   RECT rect;
    1128 
    1129   if(GetOS2UpdateRect(this,&rect))
    1130   {
     1103//TODO: Should use update region, not rectangle
     1104//******************************************************************************
     1105ULONG Win32BaseWindow::MsgNCPaint(PRECT pUpdateRect)
     1106{
    11311107    HRGN hrgn;
    11321108    ULONG rc;
    11331109    RECT client = rectClient;
    11341110
    1135         if ((rect.left >= client.left) && (rect.left < client.right) &&
    1136            (rect.right >= client.left) && (rect.right < client.right) &&
    1137            (rect.top  >= client.top) && (rect.top < client.bottom) &&
    1138            (rect.bottom >= client.top) && (rect.bottom < client.bottom))
    1139         {
    1140                 return 0;
    1141         }
    1142 
    1143         dprintf(("MsgNCPaint (%d,%d)(%d,%d)", rect.left, rect.top, rect.right, rect.bottom));
    1144         hrgn = CreateRectRgnIndirect(&rect);
    1145         if (!hrgn) return 0;
    1146 
    1147         rc = SendInternalMessageA(WM_NCPAINT, hrgn, 0);
    1148 
    1149         DeleteObject(hrgn);
    1150 
    1151         return rc;
    1152   }
    1153   else  return 0;
     1111    if ((pUpdateRect->left >= client.left) && (pUpdateRect->left < client.right) &&
     1112       (pUpdateRect->right >= client.left) && (pUpdateRect->right < client.right) &&
     1113       (pUpdateRect->top  >= client.top) && (pUpdateRect->top < client.bottom) &&
     1114       (pUpdateRect->bottom >= client.top) && (pUpdateRect->bottom < client.bottom))
     1115    {
     1116        return 0;
     1117    }
     1118
     1119    dprintf(("MsgNCPaint (%d,%d)(%d,%d)", pUpdateRect->left, pUpdateRect->top, pUpdateRect->right, pUpdateRect->bottom));
     1120    hrgn = CreateRectRgnIndirect(pUpdateRect);
     1121
     1122    rc = SendInternalMessageA(WM_NCPAINT, hrgn, 0);
     1123
     1124    DeleteObject(hrgn);
     1125
     1126    return rc;
    11541127}
    11551128//******************************************************************************
     
    11641137  ULONG rc;
    11651138
    1166   if(lpWndPos)
    1167   {
     1139    if(lpWndPos)
     1140    {
    11681141        //set new window rectangle
    11691142        setWindowRect(lpWndPos->x, lpWndPos->y, lpWndPos->x+lpWndPos->cx,
    11701143                      lpWndPos->y+lpWndPos->cy);
    11711144        newWindowRect = rectWindow;
    1172   }
    1173   else {
     1145    }
     1146    else {
    11741147        wndPos.hwnd  = getWindowHandle();
    11751148        wndPos.hwndInsertAfter = 0;
     
    11811154        wndPos.flags = SWP_FRAMECHANGED;
    11821155        lpWndPos     = &wndPos;
    1183   }
    1184 
    1185   newClientRect = rectClient;
    1186   rc = SendNCCalcSize(TRUE, &newWindowRect,  &oldWindowRect, &client, lpWndPos, &newClientRect);
    1187   rectClient = newClientRect; //must update rectClient here
    1188 
    1189   dprintf(("MsgFormatFrame: old client rect (%d,%d)(%d,%d), new client (%d,%d)(%d,%d)", client.left, client.top, client.right, client.bottom, rectClient.left, rectClient.top, rectClient.right, rectClient.bottom));
    1190   dprintf(("MsgFormatFrame: old window rect (%d,%d)(%d,%d), new window (%d,%d)(%d,%d)", oldWindowRect.left, oldWindowRect.top, oldWindowRect.right, oldWindowRect.bottom, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom));
     1156    }
     1157
     1158    newClientRect = rectClient;
     1159    rc = SendNCCalcSize(TRUE, &newWindowRect,  &oldWindowRect, &client, lpWndPos, &newClientRect);
     1160    rectClient = newClientRect; //must update rectClient here
     1161
     1162    dprintf(("MsgFormatFrame: old client rect (%d,%d)(%d,%d), new client (%d,%d)(%d,%d)", client.left, client.top, client.right, client.bottom, rectClient.left, rectClient.top, rectClient.right, rectClient.bottom));
     1163    dprintf(("MsgFormatFrame: old window rect (%d,%d)(%d,%d), new window (%d,%d)(%d,%d)", oldWindowRect.left, oldWindowRect.top, oldWindowRect.right, oldWindowRect.bottom, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom));
     1164
     1165    if(fNoSizeMsg || !EqualRect(&client, &rectClient)) {
     1166        OSLibWinSetClientPos(getOS2WindowHandle(), rectClient.left, rectClient.top, getClientWidth(), getClientHeight(), getWindowHeight());
     1167    }
    11911168
    11921169#if 1
     
    14301407            HandleNCPaint((HRGN)1);
    14311408            if(hTaskList) {
    1432                 OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
     1409                OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
    14331410            }
    14341411        }
     
    15901567          return 1;
    15911568        }
    1592        
     1569
    15931570        if (!windowClass || !windowClass->getBackgroundBrush()) return 0;
    15941571
     
    19171894        if ((dwStyle & WS_CAPTION) == WS_CAPTION)
    19181895        {
    1919           HandleNCPaint((HRGN)1);
    1920           if(hTaskList) {
    1921         OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
    1922       }
     1896            HandleNCPaint((HRGN)1);
     1897            if(hTaskList) {
     1898                OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
     1899            }
    19231900        }
    19241901
     
    22312208    case SW_HIDE:
    22322209        if (!wasVisible) goto END;
    2233             swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
    2234         SWP_NOACTIVATE | SWP_NOZORDER;
     2210
     2211        swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER;
    22352212        break;
    22362213
     
    22422219        /* fall through */
    22432220    case SW_MINIMIZE:
    2244         if(!(getStyle() & WS_CHILD))
    2245         {
    2246             if( !(getStyle() & WS_MINIMIZE) )
    2247                  swp |= MinMaximize(SW_MINIMIZE, &newPos );
    2248 
    2249             swp |= SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW;
    2250         }
    2251         else {
    2252             swp |= SWP_FRAMECHANGED;
    2253             if( !(getStyle() & WS_MINIMIZE) ) {
    2254                  swp |= MinMaximize(SW_MINIMIZE, &newPos );
    2255                  fMinMaxChange = TRUE; //-> invalidate entire window in WM_CALCINVALIDRECT
    2256             }
    2257             else swp |= SWP_NOSIZE | SWP_NOMOVE;
    2258         }
     2221        swp |= SWP_FRAMECHANGED;
     2222        if( !(getStyle() & WS_MINIMIZE) ) {
     2223             swp |= MinMaximize(SW_MINIMIZE, &newPos );
     2224             fMinMaxChange = TRUE; //-> invalidate entire window in WM_CALCINVALIDRECT
     2225        }
     2226        else swp |= SWP_NOSIZE | SWP_NOMOVE;
    22592227        break;
    22602228
     
    23172285
    23182286    if(!(swp & SWP_NOACTIVATE)) {
    2319         OSLibWinSetActiveWindow(OS2Hwnd);
     2287        OSLibWinSetActiveWindow(OS2HwndFrame);
    23202288    }
    23212289
     
    24542422            }
    24552423        }
    2456         OSLibWinQueryWindowPos(OS2Hwnd, &swpOld);
     2424        OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld);
    24572425    }
    24582426
    24592427    if(getParent()) {
    2460           OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, getParent()->getWindowHeight(),
    2461                                  getParent()->getClientRectPtr()->left,
    2462                                  getParent()->getClientRectPtr()->top,
    2463                                  OS2Hwnd);
    2464     }
    2465     else  OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, OSLibQueryScreenHeight(), 0, 0, OS2Hwnd);
     2428          OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, getParent()->getClientHeight(),
     2429                                      OS2HwndFrame);
     2430    }
     2431    else  OSLibMapWINDOWPOStoSWP(&wpos, &swp, &swpOld, OSLibQueryScreenHeight(), OS2HwndFrame);
     2432
    24662433    if (swp.fl == 0) {
    24672434        if(fuFlags & SWP_FRAMECHANGED)
     
    24772444        Win32BaseWindow *wndBehind = Win32BaseWindow::GetWindowFromHandle(swp.hwndInsertBehind);
    24782445        if(wndBehind) {
    2479             swp.hwndInsertBehind   = wndBehind->getOS2WindowHandle();
     2446            swp.hwndInsertBehind   = wndBehind->getOS2FrameWindowHandle();
    24802447        }
    24812448        else {
     
    24842451        }
    24852452    }
    2486     swp.hwnd = OS2Hwnd;
     2453    swp.hwnd = OS2HwndFrame;
    24872454
    24882455    if(fuFlags & SWP_SHOWWINDOW && !IsWindowVisible(getWindowHandle())) {
     
    24902457        if(hTaskList) {
    24912458            dprintf(("Adding window %x to tasklist", getWindowHandle()));
    2492             OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), 1);
     2459            OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), 1);
    24932460        }
    24942461    }
     
    24982465        if(hTaskList && !(getStyle() & WS_MINIMIZE)) {
    24992466            dprintf(("Removing window %x from tasklist", getWindowHandle()));
    2500             OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), 0);
     2467            OSLibWinChangeTaskList(hTaskList, OS2HwndFrame, getWindowNameA(), 0);
    25012468        }
    25022469    }
     
    25102477    }
    25112478
    2512     //Restore window origin of parent window with CS_OWNDC style
    2513     //(fixes paint offset problems in Opera windows)
    2514     if(getParent() && getParent()->isOwnDC()) {
    2515         dprintfOrigin(getParent()->getOwnDC());
    2516         selectClientArea(getParent(), getParent()->getOwnDC());
    2517     }
    2518 
    25192479    if((fuFlags & SWP_FRAMECHANGED) && (fuFlags & (SWP_NOMOVE | SWP_NOSIZE) == (SWP_NOMOVE | SWP_NOSIZE)))
    25202480    {
    2521             NotifyFrameChanged(&wpos, &oldClientRect);
     2481        NotifyFrameChanged(&wpos, &oldClientRect);
    25222482    }
    25232483    return (rc);
     
    27132673
    27142674    fDestroyWindowCalled = TRUE;
    2715     return OSLibWinDestroyWindow(OS2Hwnd);
     2675    return OSLibWinDestroyWindow(OS2HwndFrame);
    27162676}
    27172677//******************************************************************************
     
    27702730        setParent(newparent);
    27712731        getParent()->addChild(this);
    2772         OSLibWinSetParent(getOS2WindowHandle(), getParent()->getOS2WindowHandle());
     2732        OSLibWinSetParent(getOS2FrameWindowHandle(), getParent()->getOS2WindowHandle());
    27732733        if(!(getStyle() & WS_CHILD))
    27742734        {
     
    27762736            setStyle(getStyle() | WS_CHILD);
    27772737            if(getWindowId())
    2778                 {
    2779                         DestroyMenu( (HMENU) getWindowId() );
    2780                         setWindowId(0);
    2781                 }
     2738            {
     2739                DestroyMenu( (HMENU) getWindowId() );
     2740                setWindowId(0);
     2741            }
    27822742        }
    27832743   }
     
    27852745        setParent(windowDesktop);
    27862746        windowDesktop->addChild(this);
    2787         OSLibWinSetParent(getOS2WindowHandle(), OSLIB_HWND_DESKTOP);
     2747        OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP);
    27882748
    27892749    //TODO: Send WM_STYLECHANGED msg?
     
    28242784
    28252785    hwndTop = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP);
    2826     if(!isDesktopWindow()) {
    2827     topwindow = GetWindowFromOS2Handle(hwndTop);
    2828     if(topwindow) {
    2829         return topwindow->getWindowHandle();
    2830     }
    2831     return 0;
     2786    if(!isDesktopWindow())
     2787    {
     2788        topwindow = GetWindowFromOS2FrameHandle(hwndTop);
     2789        if(topwindow) {
     2790            return topwindow->getWindowHandle();
     2791        }
     2792        return 0;
    28322793    }
    28332794    while(hwndTop) {
    2834     topwindow = GetWindowFromOS2Handle(hwndTop);
    2835     if(topwindow) {
    2836         return topwindow->getWindowHandle();
    2837     }
     2795        topwindow = GetWindowFromOS2FrameHandle(hwndTop);
     2796        if(topwindow) {
     2797            return topwindow->getWindowHandle();
     2798        }
    28382799        hwndTop = OSLibWinQueryWindow(hwndTop, QWOS_NEXT);
    28392800    }
     
    30112972        while(hwnd)
    30122973        {
    3013             wnd = GetWindowFromOS2Handle(hwnd);
     2974            wnd = GetWindowFromOS2FrameHandle(hwnd);
    30142975            if(wnd == NULL) {
    30152976                hwnd = OSLibWinQueryClientWindow(hwnd);
     
    30413002 Win32BaseWindow *window;
    30423003
    3043 #if 1
    30443004    switch(uCmd)
    30453005    {
     
    30493009            window = (Win32BaseWindow *)getParent();
    30503010            hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_TOP);
    3051             window = GetWindowFromOS2Handle(hwndRelated);
     3011            window = GetWindowFromOS2FrameHandle(hwndRelated);
    30523012            if(window) {
    3053                   hwndRelated = window->getWindowHandle();
     3013                 hwndRelated = window->getWindowHandle();
    30543014            }
    30553015            else hwndRelated = 0;
    30563016        }
    3057         else hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
     3017        else {
     3018            dprintf(("WARNING: GW_HWNDFIRST not correctly implemented for toplevel/most windows!"));
     3019            hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
     3020        }
    30583021        break;
    30593022
    30603023    case GW_HWNDLAST:
    3061         hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_BOTTOM);
    3062         window = GetWindowFromOS2Handle(hwndRelated);
    3063         if(window) {
    3064              hwndRelated = window->getWindowHandle();
    3065         }
    3066         else hwndRelated = 0;
     3024        if(getParent()) {
     3025            window = (Win32BaseWindow *)getParent();
     3026            hwndRelated = OSLibWinQueryWindow(window->getOS2WindowHandle(), QWOS_BOTTOM);
     3027            dprintf(("os2 handle %x", hwndRelated));
     3028            window = GetWindowFromOS2FrameHandle(hwndRelated);
     3029            if(window) {
     3030                 hwndRelated = window->getWindowHandle();
     3031            }
     3032            else hwndRelated = 0;
     3033        }
     3034        else {
     3035            dprintf(("WARNING: GW_HWNDLAST not correctly implemented for toplevel/most windows!"));
     3036            hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
     3037        }
    30673038        break;
    30683039
    30693040    case GW_HWNDNEXT:
    3070         hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_NEXT);
    3071         window = GetWindowFromOS2Handle(hwndRelated);
    3072         if(window) {
    3073              hwndRelated = window->getWindowHandle();
    3074         }
    3075         else hwndRelated = 0;
     3041        if(getParent()) {
     3042            hwndRelated = OSLibWinQueryWindow(getOS2FrameWindowHandle(), QWOS_NEXT);
     3043            window = GetWindowFromOS2FrameHandle(hwndRelated);
     3044            if(window) {
     3045                 hwndRelated = window->getWindowHandle();
     3046            }
     3047            else hwndRelated = 0;
     3048        }
     3049        else {
     3050            dprintf(("WARNING: GW_HWNDNEXT not correctly implemented for toplevel/most windows!"));
     3051            hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
     3052        }
    30763053        break;
    30773054
    30783055    case GW_HWNDPREV:
    3079         hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_PREV);
    3080         window = GetWindowFromOS2Handle(hwndRelated);
    3081         if(window) {
    3082              hwndRelated = window->getWindowHandle();
    3083         }
    3084         else hwndRelated = 0;
     3056        if(getParent()) {
     3057            hwndRelated = OSLibWinQueryWindow(getOS2FrameWindowHandle(), QWOS_PREV);
     3058            window = GetWindowFromOS2FrameHandle(hwndRelated);
     3059            if(window) {
     3060                 hwndRelated = window->getWindowHandle();
     3061            }
     3062            else hwndRelated = 0;
     3063        }
     3064        else {
     3065            dprintf(("WARNING: GW_HWNDPREV not correctly implemented for toplevel/most windows!"));
     3066            hwndRelated = 0; //TODO: not correct; should get first child in z-order of desktop
     3067        }
    30853068        break;
    30863069
     
    30933076    case GW_CHILD:
    30943077        hwndRelated = OSLibWinQueryWindow(getOS2WindowHandle(), QWOS_TOP);
    3095         window = GetWindowFromOS2Handle(hwndRelated);
     3078        window = GetWindowFromOS2FrameHandle(hwndRelated);
    30963079        if(window) {
    30973080             hwndRelated = window->getWindowHandle();
     
    31003083        break;
    31013084    }
    3102 #else
    3103     switch(uCmd)
    3104     {
    3105     case GW_HWNDFIRST:
    3106         if(getParent()) {
    3107             window = (Win32BaseWindow *)getParent()->getFirstChild();
    3108             hwndRelated = window->getWindowHandle();
    3109         }
    3110         break;
    3111 
    3112     case GW_HWNDLAST:
    3113         if(!getParent())
    3114         {
    3115             goto end;
    3116         }
    3117 
    3118         window = this;
    3119         while(window->getNextChild())
    3120         {
    3121             window = (Win32BaseWindow *)window->getNextChild();
    3122         }
    3123         hwndRelated = window->getWindowHandle();
    3124         break;
    3125 
    3126     case GW_HWNDNEXT:
    3127         window = (Win32BaseWindow *)getNextChild();
    3128         if(window) {
    3129             hwndRelated = window->getWindowHandle();
    3130         }
    3131         break;
    3132 
    3133     case GW_HWNDPREV:
    3134         if(!getParent())
    3135         {
    3136             goto end;
    3137         }
    3138         window = (Win32BaseWindow *)(getParent()->getFirstChild()); /* First sibling */
    3139         if(window == this)
    3140         {
    3141             hwndRelated = 0;  /* First in list */
    3142             goto end;
    3143         }
    3144         while(window->getNextChild())
    3145         {
    3146             if (window->getNextChild() == this)
    3147             {
    3148                 hwndRelated = window->getWindowHandle();
    3149                 goto end;
    3150             }
    3151             window = (Win32BaseWindow *)window->getNextChild();
    3152         }
    3153         break;
    3154 
    3155     case GW_OWNER:
    3156         if(getOwner()) {
    3157             hwndRelated = getOwner()->getWindowHandle();
    3158         }
    3159         break;
    3160 
    3161     case GW_CHILD:
    3162         if(getFirstChild()) {
    3163             hwndRelated = ((Win32BaseWindow *)getFirstChild())->getWindowHandle();
    3164         }
    3165         break;
    3166     }
    3167 #endif
    31683085end:
    31693086    dprintf(("GetWindow %x %d returned %x", getWindowHandle(), uCmd, hwndRelated));
     
    32273144        SendMessageA(WM_CANCELMODE, 0, 0);
    32283145  }
    3229   OSLibWinEnableWindow(OS2Hwnd, fEnable);
     3146  OSLibWinEnableWindow(OS2HwndFrame, fEnable);
    32303147  if(fEnable == FALSE) {
    32313148        //SvL: No need to clear focus as PM already does this
     
    34363353                setStyle(ss.styleNew);
    34373354                SendInternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
    3438                 OSLibSetWindowStyle(getOS2WindowHandle(), getStyle(), getExStyle());
     3355                OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), getStyle(), getExStyle());
    34393356#ifdef DEBUG
    34403357                PrintWindowStyle(ss.styleNew, 0);
     
    36073524//  dprintf2(("Win32BaseWindow::GetWindowFromOS2Handle: not an Odin os2 window %x", hwnd));
    36083525    return 0;
     3526}
     3527//******************************************************************************
     3528//******************************************************************************
     3529Win32BaseWindow *Win32BaseWindow::GetWindowFromOS2FrameHandle(HWND hwnd)
     3530{
     3531    return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));
    36093532}
    36103533//******************************************************************************
     
    38083731            return window->getWindowHandle();
    38093732    }
     3733    window = Win32BaseWindow::GetWindowFromOS2FrameHandle(hwnd);
     3734    if(window) {
     3735            return window->getWindowHandle();
     3736    }
     3737
    38103738//    dprintf2(("Win32BaseWindow::OS2ToWin32Handle: not a win32 window %x", hwnd));
    38113739    return 0;
Note: See TracChangeset for help on using the changeset viewer.