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/pmframe.cpp

    r1343 r1405  
    1 /* $Id: pmframe.cpp,v 1.8 1999-10-17 19:32:04 cbratschi Exp $ */
     1/* $Id: pmframe.cpp,v 1.9 1999-10-22 18:11:46 sandervl Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    2222#include "pmframe.h"
    2323#include "oslibutil.h"
     24#include "oslibwin.h"
     25#include "caret.h"
    2426
    2527#define PMFRAMELOG
     
    160162MRESULT EXPENTRY Win32FrameProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
    161163{
    162   Win32BaseWindow *win32wnd;
    163   PFNWP OldFrameProc;
     164 Win32BaseWindow *win32wnd;
     165 PFNWP            OldFrameProc;
     166 MRESULT          rc;
    164167
    165168  SetWin32TIB();
     
    177180  switch(msg)
    178181  {
     182#if 1
     183    case WM_ADJUSTWINDOWPOS:
     184    {
     185      PSWP     pswp = (PSWP)mp1;
     186      SWP      swpOld;
     187      WINDOWPOS wp;
     188      ULONG     parentHeight = 0;
     189      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE, hwndAfter;
     190
     191        dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     192
     193        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
     194            goto RunDefFrameProc;
     195        if(!win32wnd->CanReceiveSizeMsgs()) {
     196            break;
     197        }
     198
     199        WinQueryWindowPos(hwnd, &swpOld);
     200
     201        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     202            if (win32wnd->isChild()) {
     203                if(win32wnd->getParent()) {
     204                        hParent = win32wnd->getParent()->getOS2WindowHandle();
     205                }
     206                else    goto RunDefFrameProc;
     207            }
     208        }
     209        hwndAfter = pswp->hwndInsertBehind;
     210        hFrame = win32wnd->getOS2FrameWindowHandle();
     211        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hFrame);
     212
     213        wp.hwnd = win32wnd->getWindowHandle();
     214        if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
     215        {
     216           Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
     217           if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
     218        }
     219        if(win32wnd->MsgPosChanging((LPARAM)&wp) == 0)
     220        {//app or default window handler changed wp
     221            dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));
     222            dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     223            OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, hParent, hFrame);
     224            dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     225            pswp->fl |= SWP_NOADJUST;
     226            pswp->hwndInsertBehind = hwndAfter;
     227            pswp->hwnd = hFrame;
     228
     229            RestoreOS2TIB();
     230            return (MRESULT)0xf;
     231        }
     232        break;
     233    }
     234
     235    case WM_WINDOWPOSCHANGED:
     236    {
     237      PSWP      pswp   = (PSWP)mp1;
     238      SWP       swpOld = *(pswp + 1);
     239      WINDOWPOS wp;
     240      ULONG     parentHeight = 0;
     241      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
     242      LONG      yDelta = pswp->cy - swpOld.cy;
     243      LONG      xDelta = pswp->cx - swpOld.cx;
     244
     245        dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     246        RestoreOS2TIB();
     247        rc = OldFrameProc(hwnd,msg,mp1,mp2);
     248        SetWin32TIB();
     249//        dprintf(("After calling frameproc: (%x) %x %x (%d,%d) (%d,%d)", mp2, hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     250
     251        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
     252            break;
     253
     254        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     255            if (win32wnd->isChild()) {
     256                if(win32wnd->getParent()) {
     257                        hParent = win32wnd->getParent()->getOS2WindowHandle();
     258                }
     259                else    break; //parent has just been destroyed
     260            }
     261        }
     262        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
     263
     264        //delta is difference between old and new client height
     265        yDelta = swpOld.cy - win32wnd->getWindowHeight();
     266
     267        win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
     268        win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
     269
     270        if(!win32wnd->CanReceiveSizeMsgs())
     271            break;
     272
     273        wp.hwnd = win32wnd->getWindowHandle();
     274        if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
     275        {
     276           Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
     277           if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
     278        }
     279
     280        if (yDelta != 0 || xDelta != 0)
     281        {
     282            HENUM henum = WinBeginEnumWindows(WinWindowFromID(pswp->hwnd, FID_CLIENT));
     283            SWP swp[10];
     284            int i = 0;
     285            HWND hwnd;
     286
     287            while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
     288            {
     289#if 0
     290                if (mdiClient )
     291                {
     292                  continue;
     293                }
     294#endif
     295                WinQueryWindowPos(hwnd, &(swp[i]));
     296
     297#ifdef DEBUG
     298                Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
     299                dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d) %x", (window) ? window->getWindowHandle() : hwnd,
     300                         yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl));
     301#endif
     302
     303                if(swp[i].y != 0) {
     304                    //child window at offset <> 0 from client area -> offset now changes
     305                    swp[i].y  += yDelta;
     306                    swp[i].fl &= ~(SWP_NOREDRAW);
     307                }
     308                //else child window with the same start coorindates as the client area
     309                //The app should resize it.
     310
     311               if (i == 9)
     312                {
     313                    WinSetMultWindowPos(GetThreadHAB(), swp, 10);
     314                    i = 0;
     315                }
     316                else
     317                {
     318                    i++;
     319                }
     320            }
     321
     322            WinEndEnumWindows(henum);
     323
     324            if (i)
     325               WinSetMultWindowPos(GetThreadHAB(), swp, i);
     326        }
     327        if (yDelta != 0)
     328        {
     329            POINT pt;
     330            if(GetCaretPos (&pt) == TRUE)
     331            {
     332                pt.y -= yDelta;
     333                SetCaretPos (pt.x, pt.y);
     334            }
     335        }
     336        win32wnd->MsgPosChanged((LPARAM)&wp);
     337        break;
     338    }
     339#else
    179340    case WM_ADJUSTWINDOWPOS:
    180341    {
     
    185346      if(wndchild && wndchild->isChild())
    186347      {
    187 #if 0
    188        SWP swp = *pswp;
    189 
    190         MRESULT rc = OldFrameProc(hwnd, msg, mp1, mp2);
    191         pswp->x = swp.x;
    192         pswp->y = swp.y;
    193         pswp->fl = swp.fl;
    194 #endif
    195348        dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    196349        RestoreOS2TIB();
     
    199352      goto RunDefFrameProc;
    200353    }
    201 #if 0
    202     case WM_WINDOWPOSCHANGED:
    203     {
    204       PSWP      pswp  = (PSWP)mp1;
    205       dprintf(("PMFRAME: WM_WINDOWPOSCHANGED %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    206       goto RunDefFrameProc;
    207     }
    208 
    209     case WM_FORMATFRAME:
    210     {
    211       PSWP      pswp  = (PSWP)mp1;
    212       dprintf(("PMFRAME: WM_FORMATFRAME %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    213       goto RunDefFrameProc;
    214     }
     354
    215355#endif
    216356
     
    224364
    225365    case WM_MOUSEMOVE:
    226       #ifdef PMFRAMELOG
    227        dprintf(("PMFRAME: WM_MOUSEMOVE"));
    228       #endif
    229366      if (InSizeBox(win32wnd,(POINTS*)&mp1))
    230367      {
Note: See TracChangeset for help on using the changeset viewer.