Ignore:
Timestamp:
Dec 26, 1999, 6:30:20 PM (26 years ago)
Author:
cbratschi
Message:

non-client fixes, DefWndProc enhancements, several other bugs fixed

File:
1 edited

Legend:

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

    r2200 r2204  
    1 /* $Id: pmframe.cpp,v 1.29 1999-12-24 18:39:10 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.30 1999-12-26 17:30:16 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    203203//******************************************************************************
    204204//******************************************************************************
    205 void FrameTrackFrame(Win32BaseWindow *win32wnd,BOOL lefttop)
    206 {
    207   INT flags = lefttop ? (TF_LEFT | TF_TOP):(TF_RIGHT | TF_BOTTOM);
    208 
    209   WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_TRACKFRAME,(MPARAM)flags,(MPARAM)0);
    210 }
    211 //******************************************************************************
    212 // used by statusbar control
    213 //******************************************************************************
    214 VOID WINAPI TrackWin32Window(HWND hwnd,BOOL lefttop)
    215 {
    216   Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
    217   INT flags = lefttop ? (TF_LEFT | TF_TOP):(TF_RIGHT | TF_BOTTOM);
    218 
    219   if (!win32wnd) return;
    220 
     205VOID FrameTrackFrame(Win32BaseWindow *win32wnd,DWORD flags)
     206{
    221207  WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_TRACKFRAME,(MPARAM)flags,(MPARAM)0);
    222208}
     
    319305      WINDOWPOS wp;
    320306      HWND      hParent = NULLHANDLE;
    321       LONG      yDelta = pswp->cy - swpOld.cy;
    322       LONG      xDelta = pswp->cx - swpOld.cx;
    323       LONG      clientHeight;
    324307
    325308        dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    326 
    327         //Save height so WM_WINDOWPOSCHANGED handler in pmwindow.cpp
    328         //(for client) doesn't overwrite the client rectangle (breaks ydelta calculation)
    329         clientHeight = win32wnd->getWindowHeight();
    330309
    331310        RestoreOS2TIB();
    332311        rc = OldFrameProc(hwnd,msg,mp1,mp2);
    333312        SetWin32TIB();
    334 
    335         if (win32wnd->getParent() && win32wnd->getParent()->InMovingChildren())
    336           goto PosChangedEnd; //same Win32 pos, only OS/2 pos changed
    337313
    338314        if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0)
     
    349325        OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd);
    350326
    351         //delta is difference between old and new client height
    352         yDelta = swpOld.cy - clientHeight;
    353 
    354327        win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy);
    355328        win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    356329
    357         wp.hwnd = win32wnd->getWindowHandle();
    358         if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
    359         {
    360            Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
    361            if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle();
    362         }
    363 
    364 #if 0 //CB: PM does it now for us (-> WM_CALVALIDRECTS)
    365       //    if you remove this code, delete *MovingChildren in Win32BaseWindow class
    366         if (yDelta != 0 || xDelta != 0)
    367         {
    368             HENUM henum = WinBeginEnumWindows(WinWindowFromID(hwnd,FID_CLIENT));
    369             SWP swp[10];
    370             int i = 0;
    371             HWND hwnd;
    372 
    373             win32wnd->setMovingChildren(TRUE);
    374             while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
    375             {
    376                 WinQueryWindowPos(hwnd, &(swp[i]));
    377 
    378 #ifdef DEBUG
    379                 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd);
    380                 dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d) %x", (window) ? window->getWindowHandle() : hwnd,
    381                          yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl));
    382 #endif
    383 
    384                 //if(swp[i].y != 0) //CB: y value of 0 is valid!
    385                 {
    386                     //child window at offset <> 0 from client area -> offset now changes
    387                     swp[i].y  += yDelta;
    388                     swp[i].fl = SWP_MOVE | SWP_NOADJUST;
    389                 }
    390                 //else child window with the same start coordinates as the client area
    391                 //The app should resize it.
    392 
    393                if (i == 9)
    394                 {
    395                     WinSetMultWindowPos(GetThreadHAB(), swp, 10);
    396                     i = 0;
    397                 }
    398                 else
    399                 {
    400                     i++;
    401                 }
    402             }
    403 
    404             WinEndEnumWindows(henum);
    405 
    406             if (i)
    407                WinSetMultWindowPos(GetThreadHAB(), swp, i);
    408             win32wnd->setMovingChildren(FALSE);
    409         }
    410         if (yDelta != 0)
    411         {
    412             POINT pt;
    413             if(GetCaretPos (&pt) == TRUE)
    414             {
    415                 pt.y -= yDelta;
    416                 SetCaretPos (pt.x, pt.y);
    417             }
    418         }
    419 #endif
    420         if(!win32wnd->CanReceiveSizeMsgs())
    421             goto PosChangedEnd;
    422 
    423         win32wnd->MsgPosChanged((LPARAM)&wp);
     330        if(win32wnd->CanReceiveSizeMsgs())
     331          win32wnd->MsgPosChanged((LPARAM)&wp);
    424332
    425333PosChangedEnd:
     
    703611}
    704612
     613DWORD FrameHitTest(Win32BaseWindow *win32wnd,INT x,INT y)
     614{
     615  POINTL point;
     616  HWND hwnd = win32wnd->getOS2FrameWindowHandle(),child;
     617
     618  if (hwnd == win32wnd->getOS2WindowHandle()) return HTCLIENT_W;
     619  if (win32wnd->getOS2WindowHandle() == WinQueryCapture(HWND_DESKTOP)) return HTCLIENT_W;
     620  point.x = x;
     621  point.y = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN)-y-1;
     622  WinMapWindowPoints(HWND_DESKTOP,hwnd,&point,1);
     623  child = WinWindowFromPoint(hwnd,&point,FALSE);
     624
     625  if (child == 0) return HTERROR_W;
     626  if (child == win32wnd->getOS2FrameWindowHandle())
     627  {
     628    RECTL client,frame;
     629
     630    if (CanDrawSizeBox(win32wnd))
     631    {
     632      RECTL rect;
     633
     634      GetSizeBox(win32wnd,&rect);
     635      if (WinPtInRect(GetThreadHAB(),&rect,&point)) return HTGROWBOX_W;
     636    }
     637    //somewhere in the border
     638    INT w = WinQuerySysValue(HWND_DESKTOP,SV_CXMINMAXBUTTON);
     639    INT h = WinQuerySysValue(HWND_DESKTOP,SV_CXMINMAXBUTTON);
     640    WinQueryWindowRect(hwnd,&frame);
     641
     642    if (point.y < h)
     643    {
     644      if (point.x < w) return HTBOTTOMLEFT_W;
     645      if (point.x > frame.xRight-1-w) return HTBOTTOMRIGHT_W;
     646      return HTBOTTOM_W;
     647    }
     648    if (point.y > frame.yTop-1-h)
     649    {
     650      if (point.x < w) return HTTOPLEFT_W;
     651      if (point.x > frame.xRight-1-w) return HTTOPRIGHT_W;
     652      return HTTOP_W;
     653    }
     654    return HTBORDER_W;
     655  } else
     656  {
     657    if (child == WinWindowFromID(hwnd,FID_CLIENT)) return HTCLIENT_W;
     658    if (child == WinWindowFromID(hwnd,FID_VERTSCROLL)) return HTVSCROLL_W;
     659    if (child == WinWindowFromID(hwnd,FID_HORZSCROLL)) return HTHSCROLL_W;
     660    if (child == WinWindowFromID(hwnd,FID_SYSMENU)) return HTSYSMENU_W;
     661    if (child == WinWindowFromID(hwnd,FID_TITLEBAR)) return HTCAPTION_W;
     662    if (child == WinWindowFromID(hwnd,FID_MENU)) return HTMENU_W;
     663    if (child == WinWindowFromID(hwnd,FID_MINMAX))
     664    {
     665      //CB: close, reduce or zoom
     666      return HTZOOM_W;
     667    }
     668
     669    return HTERROR_W;
     670  }
     671}
Note: See TracChangeset for help on using the changeset viewer.