Ignore:
Timestamp:
Oct 22, 1999, 8:11:51 PM (26 years ago)
Author:
sandervl
Message:

Lots of changes/fixes

File:
1 edited

Legend:

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

    r1391 r1405  
    1 /* $Id: pmwindow.cpp,v 1.39 1999-10-21 12:19:27 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.40 1999-10-22 18:11:47 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    247247        break;
    248248
    249     case WM_ADJUSTWINDOWPOS:
    250     {
    251       PSWP     pswp = (PSWP)mp1;
    252       SWP      swpOld;
    253       WINDOWPOS wp;
    254       ULONG     parentHeight = 0;
    255       HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE, hwndAfter;
    256 
    257         dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    258 
    259         if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) goto RunDefWndProc;;
    260 
    261         //SvL: TODO: Workaround. Why is this happening?
    262         //     When this flag is set the coordinates are 0, even though SWP_SIZE & SWP_MOVE are set.
    263 //        if ((pswp->fl & SWP_NOADJUST)) goto RunDefWndProc;
    264 
    265         if(!win32wnd->CanReceiveSizeMsgs()) goto RunDefWndProc;;
    266 
    267         WinQueryWindowPos(hwnd, &swpOld);
    268 
    269         if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    270             if (win32wnd->isChild()) {
    271                 if(win32wnd->getParent()) {
    272                         hParent = win32wnd->getParent()->getOS2WindowHandle();
    273                 }
    274                 else    goto RunDefWndProc;;
    275             }
    276         }
    277         hwndAfter = pswp->hwndInsertBehind;
    278         hFrame = win32wnd->getOS2FrameWindowHandle();
    279         OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hFrame);
    280 
    281         wp.hwnd = win32wnd->getWindowHandle();
    282         if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
    283         {
    284            Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
    285            if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
    286         }
    287         if(win32wnd->MsgPosChanging((LPARAM)&wp) == 0)
    288         {//app or default window handler changed wp
    289             dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));
    290             dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    291             OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, hParent, hFrame);
    292             dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    293             pswp->fl |= SWP_NOADJUST;
    294             pswp->hwndInsertBehind = hwndAfter;
    295             pswp->hwnd = hFrame;
    296 
    297             WinSetMultWindowPos(GetThreadHAB(), pswp, 1);
    298             return (MRESULT)0;
    299         }
    300         break;
    301     }
    302 
    303     case WM_WINDOWPOSCHANGED:
    304     {
    305       PSWP      pswp   = (PSWP)mp1;
    306       SWP       swpOld = *(pswp + 1);
    307       WINDOWPOS wp;
    308       ULONG     parentHeight = 0;
    309       HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
    310       LONG      yDelta = pswp->cy - swpOld.cy;
    311       LONG      xDelta = pswp->cx - swpOld.cx;
    312 
    313         dprintf(("OS2: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    314 
    315         if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
    316         if(!win32wnd->CanReceiveSizeMsgs()) break;
    317 
    318         if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    319             if (win32wnd->isChild()) {
    320                 if(win32wnd->getParent()) {
    321                         hParent = win32wnd->getParent()->getOS2WindowHandle();
    322                 }
    323                 else    goto RunDefWndProc; //parent has just been destroyed
    324             }
    325         }
    326         OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hwnd);
    327 
    328         win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
    329         win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    330 
    331         wp.hwnd = win32wnd->getWindowHandle();
    332         if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
    333         {
    334            Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
    335            wp.hwndInsertAfter = wndAfter->getWindowHandle();
    336         }
    337 
    338         if (yDelta != 0 || xDelta != 0)
    339         {
    340             HENUM henum = WinBeginEnumWindows(pswp->hwnd);
    341             SWP swp[10];
    342             int i = 0;
    343             HWND hwnd;
    344 
    345             while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
    346             {
    347 #if 0
    348                 if (mdiClient )
    349                 {
    350                   continue;
    351                 }
    352 #endif
    353                 WinQueryWindowPos(hwnd, &(swp[i]));
    354 
    355 #ifdef DEBUG
    356                 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
    357                 dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d) %x", (window) ? window->getWindowHandle() : hwnd,
    358                          yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl));
    359 #endif
    360 
    361                 if(swp[i].y != 0) {
    362                     //child window at offset <> 0 from client area -> offset now changes
    363                     swp[i].y  += yDelta;
    364                     swp[i].fl &= ~(SWP_NOREDRAW);
    365                 }
    366                 //else child window with the same start coorindates as the client area
    367                 //The app should resize it.
    368 
    369                if (i == 9)
    370                 {
    371                     WinSetMultWindowPos(GetThreadHAB(), swp, 10);
    372                     i = 0;
    373                 }
    374                 else
    375                 {
    376                     i++;
    377                 }
    378             }
    379 
    380             WinEndEnumWindows(henum);
    381 
    382             if (i)
    383                WinSetMultWindowPos(GetThreadHAB(), swp, i);
    384         }
    385         if (yDelta != 0)
    386         {
    387             POINT pt;
    388             if(GetCaretPos (&pt) == TRUE)
    389             {
    390                 pt.y -= yDelta;
    391                 SetCaretPos (pt.x, pt.y);
    392             }
    393         }
    394         win32wnd->MsgPosChanged((LPARAM)&wp);
    395 
    396         goto RunDefWndProc;
    397     }
    398 
    399249    case WM_SIZE:
    400250    {
Note: See TracChangeset for help on using the changeset viewer.