Ignore:
Timestamp:
Oct 20, 1999, 3:46:29 PM (26 years ago)
Author:
sandervl
Message:

position change bugfixes

File:
1 edited

Legend:

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

    r1354 r1376  
    1 /* $Id: pmwindow.cpp,v 1.36 1999-10-19 12:32:13 dengert Exp $ */
     1/* $Id: pmwindow.cpp,v 1.37 1999-10-20 13:46:26 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    2222#include <win32wbase.h>
    2323#include <win32dlg.h>
     24#include "win32wdesktop.h"
    2425#include "pmwindow.h"
    2526#include "oslibwin.h"
     
    251252      SWP      swpOld;
    252253      WINDOWPOS wp;
    253       ULONG    parentHeight = 0;
     254      ULONG     parentHeight = 0;
    254255      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
    255256
    256         dprintf(("OS2: WM_ADJUSTWINDOWPOS %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     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));
    257258
    258259        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
    259         if (!win32wnd->CanReceiveSizeMsgs())    break;
     260        if(!win32wnd->CanReceiveSizeMsgs()) break;
    260261
    261262        WinQueryWindowPos(hwnd, &swpOld);
     
    268269                else    break;
    269270            }
    270             else
    271                 hFrame = win32wnd->getOS2FrameWindowHandle();
    272         }
     271        }
     272        hFrame = win32wnd->getOS2FrameWindowHandle();
    273273        OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hFrame);
    274274
     
    279279           if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
    280280        }
    281         win32wnd->MsgPosChanging((LPARAM)&wp);
     281        if(win32wnd->MsgPosChanging((LPARAM)&wp) == 0)
     282        {//app or default window handler changed wp
     283            dprintf(("OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));
     284            dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     285            OSLibMapWINDOWPOStoSWP(&wp, pswp, &swpOld, hParent, hFrame);
     286            dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     287            //TODO: What should we return here? 0 means no changes, but the AWP flags
     288            //      aren't very useful either
     289        }
    282290        break;
    283291    }
     
    285293    case WM_WINDOWPOSCHANGED:
    286294    {
    287       PSWP      pswp  = (PSWP)mp1;
    288       PSWP      pswpo = pswp + 1;
     295      PSWP      pswp   = (PSWP)mp1;
     296      SWP       swpOld = *(pswp + 1);
    289297      WINDOWPOS wp;
    290298      ULONG     parentHeight = 0;
    291299      HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
    292       LONG      yDelta = pswp->cy - pswpo->cy;
    293       LONG      xDelta = pswp->cx - pswpo->cx;
    294       ULONG     classStyle;
     300      LONG      yDelta = pswp->cy - swpOld.cy;
     301      LONG      xDelta = pswp->cx - swpOld.cx;
    295302
    296303        dprintf(("OS2: WM_WINDOWPOSCHANGED %x %x (%d,%d) (%d,%d)", hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    297304
    298305        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) break;
    299         if (!win32wnd->CanReceiveSizeMsgs())    break;
     306        if(!win32wnd->CanReceiveSizeMsgs()) break;
    300307
    301308        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     
    306313                else    goto RunDefWndProc; //parent has just been destroyed
    307314            }
    308             else
    309                 hFrame = WinQueryWindow(hwnd, QW_PARENT);
    310         }
    311         OSLibMapSWPtoWINDOWPOS(pswp, &wp, pswpo, hParent, hFrame);
    312 
    313         SWP swpFrame;
    314         WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swpFrame);
    315         dprintf(("WINDOWPOSCHANGE %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), win32wnd->getOS2FrameWindowHandle(),
    316                          swpFrame.fl,swpFrame.x, swpFrame.y, swpFrame.cx, swpFrame.cy));
    317         POINTL point;
    318 
    319         point.x = swpFrame.x;
    320         point.y = swpFrame.y;
    321         if(win32wnd->getParent() != NULL)
    322         {
    323                 WinMapWindowPoints(WinQueryWindow(hwnd, QW_PARENT), HWND_DESKTOP,
    324                                    &point, 1);
    325         }
    326         point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
    327 
    328         win32wnd->setWindowRect(point.x, point.y, point.x+swpFrame.cx, point.y+swpFrame.cy);
    329         win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
     315        }
     316        hFrame = WinQueryWindow(hwnd, QW_PARENT);
     317        OSLibMapSWPtoWINDOWPOS(pswp, &wp, &swpOld, hParent, hFrame);
     318
     319        win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
     320        win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    330321
    331322        wp.hwnd = win32wnd->getWindowHandle();
     
    335326           wp.hwndInsertAfter = wndAfter->getWindowHandle();
    336327        }
    337         classStyle = win32wnd->getClass()->getStyle();
    338328
    339329        if (yDelta != 0 || xDelta != 0)
     
    395385        win32wnd->MsgPosChanged((LPARAM)&wp);
    396386
    397     goto RunDefWndProc;
    398 //        break;
     387        goto RunDefWndProc;
    399388    }
    400389
     
    611600        break;
    612601    }
    613 
    614     //**************************************************************************
    615     //Slider messages
    616     //**************************************************************************
    617 /* CB: handled internally
    618     case WM_VSCROLL:
    619     case WM_HSCROLL:
    620     {
    621      ULONG scrollPos, scrollCode, scrollMsg;
    622 
    623     scrollCode = SHORT2FROMMP(mp2);
    624     scrollPos  = SHORT1FROMMP(mp2);
    625     scrollMsg  = msg;
    626 
    627     OSLibTranslateScrollCmdAndMsg(&scrollMsg, &scrollCode);
    628 
    629         if(win32wnd->MsgScroll(scrollMsg, scrollCode, scrollPos)) {
    630             goto RunDefWndProc;
    631         }
    632     break;
    633     }
    634 */
    635602
    636603    case WM_CONTROL:
     
    853820            win32wnd->setEraseBkgnd (!erased, !erased);
    854821        }
     822
    855823        break;
    856824    }
     
    860828
    861829        if (WinQueryUpdateRect (hwnd, NULL)) {
    862             if (win32wnd->isEraseBkgnd() && !win32wnd->isSupressErase()) {
     830            if (!win32wnd->isSupressErase()) {
    863831                BOOL erased = sendEraseBkgnd (win32wnd);
    864832                win32wnd->setEraseBkgnd (!erased, !erased);
     
    939907      {
    940908        PSWP      pswp  = (PSWP)mp1;
    941         PSWP      pswpo = pswp + 1;
     909        SWP       swpOld = *(pswp + 1);
    942910        WINDOWPOS wp;
    943911        HWND      hParent = NULLHANDLE, hFrame = NULLHANDLE;
     
    948916          hFrame = WinQueryWindow(hwnd, QW_PARENT);
    949917
    950         OSLibMapSWPtoWINDOWPOS(pswp,&wp,pswpo,hParent,hFrame);
    951 
    952         SWP swpFrame;
    953         WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swpFrame);
    954         POINTL point;
    955 
    956         point.x = swpFrame.x;
    957         point.y = swpFrame.y;
    958         WinMapWindowPoints(WinQueryWindow(hwnd, QW_PARENT), HWND_DESKTOP,
    959                            &point, 1);
    960         point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
    961 
    962         win32wnd->setWindowRect(point.x, point.y, point.x+swpFrame.cx, point.y+swpFrame.cy);
    963         win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
     918        OSLibMapSWPtoWINDOWPOS(pswp,&wp, &swpOld,hParent,hFrame);
     919
     920        win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
     921        win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    964922
    965923        win32wnd->MsgPosChanged((LPARAM)&wp);
Note: See TracChangeset for help on using the changeset viewer.