Changeset 2435 for trunk/src


Ignore:
Timestamp:
Jan 14, 2000, 2:16:59 PM (26 years ago)
Author:
sandervl
Message:

Several window position bugfixes

Location:
trunk/src/user32/new
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/oslibmsgtranslate.cpp

    r2426 r2435  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.13 2000-01-13 13:54:52 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.14 2000-01-14 13:16:57 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    236236        return TRUE;
    237237      }
     238      case WM_WINDOWPOSCHANGED:
     239      {
     240        //todo: proper translation
     241        return FALSE;
     242      }
    238243    }
    239244    //do normal translation for all other messages
     
    318323        if (!win32wnd->CanReceiveSizeMsgs())    goto dummymessage;
    319324
    320         dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy));
    321         win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
    322 
    323         thdb->wp.hwnd = win32wnd->getWindowHandle();
    324         if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
    325         {
    326            Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
    327            if(wndAfter)
    328                 thdb->wp.hwndInsertAfter = wndAfter->getWindowHandle();
    329         }
    330 
    331         PRECT lpRect = win32wnd->getWindowRect();
    332         //SvL: Only send it when the client has changed & the frame hasn't
    333         //     If the frame size/position has changed, pmframe.cpp will send
    334         //     this message
    335         if(lpRect->right == thdb->wp.x+thdb->wp.cx && lpRect->bottom == thdb->wp.y+thdb->wp.cy) {
    336                 winMsg->message = WINWM_WINDOWPOSCHANGED;
    337                 winMsg->lParam  = (LPARAM)&thdb->wp;
    338         }
    339         else {
    340 ////            win32wnd->setWindowRect(thdb->wp.x, thdb->wp.y, thdb->wp.x+thdb->wp.cx, thdb->wp.y+thdb->wp.cy);
    341             goto dummymessage;
    342         }
     325        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
     326                dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy));
     327                win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy);
     328
     329                thdb->wp.hwnd = win32wnd->getWindowHandle();
     330                if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM))
     331                {
     332                        Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind);
     333                        if(wndAfter)
     334                        thdb->wp.hwndInsertAfter = wndAfter->getWindowHandle();
     335                }
     336
     337                PRECT lpRect = win32wnd->getWindowRect();
     338                //SvL: Only send it when the client has changed & the frame hasn't
     339                //     If the frame size/position has changed, pmframe.cpp will send
     340                //     this message
     341                if(lpRect->right == thdb->wp.x+thdb->wp.cx && lpRect->bottom == thdb->wp.y+thdb->wp.cy) {
     342                        winMsg->message = WINWM_WINDOWPOSCHANGED;
     343                        winMsg->lParam  = (LPARAM)&thdb->wp;
     344                        break;
     345                }
     346        }
     347        goto dummymessage;
    343348    }
    344349
  • trunk/src/user32/new/pmframe.cpp

    r2433 r2435  
    1 /* $Id: pmframe.cpp,v 1.16 2000-01-13 20:11:37 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.17 2000-01-14 13:16:57 sandervl Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    287287
    288288          //CB: todo: use result for WM_CALCVALIDRECTS
    289 //          mapWin32ToOS2Rect(WinQueryWindow(hwnd,QW_PARENT),hwnd,win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
    290289          mapWin32ToOS2Rect(win32wnd->getOS2FrameWindowHandle(), win32wnd->getClientRectPtr(), (PRECTLOS2)&rect);
    291290
     
    378377    }
    379378
     379    case WM_ERASEBACKGROUND:
     380        break;
     381
    380382    case WM_CALCVALIDRECTS:
    381383    {
     
    447449VOID FrameUpdateClient(Win32BaseWindow *win32wnd)
    448450{
     451  RECT rectOld, rectNew;
    449452  RECTL rect;
    450453  SWP swpClient = {0};
    451454
     455        rectOld = *win32wnd->getClientRectPtr();
    452456        win32wnd->MsgFormatFrame(NULL);
     457        rectNew = *win32wnd->getClientRectPtr();
     458        if(WinEqualRect(0, (PRECTL)&rectOld, (PRECTL)&rectNew) == 1) {
     459                WinInvalidateRect(win32wnd->getOS2FrameWindowHandle(), NULL, FALSE);
     460                return;
     461        }
    453462        //CB: todo: use result for WM_CALCVALIDRECTS
    454 //        mapWin32ToOS2Rect(WinQueryWindow(win32wnd->getOS2FrameWindowHandle(),QW_PARENT),win32wnd->getOS2FrameWindowHandle(),win32wnd->getClientRectPtr(),(PRECTLOS2)&rect);
    455463        mapWin32ToOS2Rect(win32wnd->getOS2FrameWindowHandle(), win32wnd->getClientRectPtr(), (PRECTLOS2)&rect);
    456464
  • trunk/src/user32/new/pmwindow.cpp

    r2426 r2435  
    1 /* $Id: pmwindow.cpp,v 1.40 2000-01-13 13:54:52 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.41 2000-01-14 13:16:57 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    253253    case WM_WINDOWPOSCHANGED:
    254254    {
    255         win32wnd->MsgPosChanged((LPARAM)&thdb->wp);
     255        if(pWinMsg->message != 0)
     256                win32wnd->MsgPosChanged((LPARAM)&thdb->wp);
    256257        goto RunDefWndProc;
    257258    }
  • trunk/src/user32/new/win32wbase.cpp

    r2433 r2435  
    1 /* $Id: win32wbase.cpp,v 1.39 2000-01-13 20:11:37 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.40 2000-01-14 13:16:58 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    10821082  RECT oldWindowRect = rectWindow, client = rectClient, newWindowRect;
    10831083  WINDOWPOS wndPos;
     1084  ULONG rc;
    10841085
    10851086  if(lpWndPos) {
    10861087    //set new window rectangle
    10871088    setWindowRect(lpWndPos->x, lpWndPos->y, lpWndPos->x + lpWndPos->cx, lpWndPos->y + lpWndPos->cy);
    1088     newWindowRect = rectWindow;
     1089    newWindowRect= rectWindow;
    10891090  }
    10901091  else {
    1091     wndPos.hwnd  = Win32Hwnd;
     1092    wndPos.hwnd  = getWindowHandle();
    10921093    wndPos.hwndInsertAfter = 0;
    10931094    newWindowRect= rectWindow;
     
    10981099    wndPos.cy    = newWindowRect.bottom - newWindowRect.top;
    10991100    wndPos.flags = SWP_FRAMECHANGED;
    1100     lpWndPos = &wndPos;
    1101   }
    1102 
    1103   return SendNCCalcSize(TRUE, &oldWindowRect, &newWindowRect, &client, &wndPos, &rectClient);
     1101    lpWndPos     = &wndPos;
     1102  }
     1103
     1104  rc = SendNCCalcSize(TRUE, &newWindowRect,  &oldWindowRect, &client, lpWndPos, &rectClient);
     1105
     1106  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));
     1107  return rc;
    11041108}
    11051109//******************************************************************************
  • trunk/src/user32/new/win32wbasenonclient.cpp

    r2433 r2435  
    1 /* $Id: win32wbasenonclient.cpp,v 1.5 2000-01-13 20:11:39 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.6 2000-01-14 13:16:58 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    234234  {
    235235    case HTCAPTION:
    236       SetActiveWindow();
     236      if (GetActiveWindow() != Win32Hwnd)
     237        SetActiveWindow();
     238
    237239      if (GetActiveWindow() == Win32Hwnd)
    238240        SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
     
    353355LONG Win32BaseWindow::HandleNCCalcSize(BOOL calcValidRects,RECT *winRect)
    354356{
    355   RECT tmpRect = { 0, 0, 0, 0 },*clientRect;
    356   LONG result = WVR_ALIGNTOP | WVR_ALIGNLEFT;
     357  RECT tmpRect = { 0, 0, 0, 0 };
     358  LONG result = 0;
    357359  UINT style;
    358360
     
    364366    if (style & CS_HREDRAW) result |= WVR_HREDRAW;
    365367
    366     clientRect = &((NCCALCSIZE_PARAMS*)winRect)->rgrc[2];
    367     *clientRect = rectWindow;
    368 #if 1
    369     OffsetRect(clientRect, -clientRect->left, -clientRect->top);
    370 #else
    371     if(getParent()) {//in parent coordinates
    372         OffsetRect(clientRect, -clientRect->left, -clientRect->top);
    373         MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), (POINT *)clientRect, 2);
    374     }
    375     //else in screen coordinates (already in screen coordinates)
    376 #endif
    377 
    378368    if(!(dwStyle & WS_MINIMIZE))
    379369    {
    380370        AdjustRectOuter(&tmpRect,FALSE);
    381371
    382         clientRect->left   -= tmpRect.left;
    383         clientRect->top    -= tmpRect.top;
    384         clientRect->right  -= tmpRect.right;
    385         clientRect->bottom -= tmpRect.bottom;
     372        winRect->left   -= tmpRect.left;
     373        winRect->top    -= tmpRect.top;
     374        winRect->right  -= tmpRect.right;
     375        winRect->bottom -= tmpRect.bottom;
    386376
    387377        if (HAS_MENU())
    388378        {
    389             clientRect->top +=
     379            winRect->top +=
    390380                MENU_GetMenuBarHeight(Win32Hwnd,
    391                                        winRect->right - winRect->left,
    392                                        -tmpRect.left, -tmpRect.top ) + 1;
     381                                      winRect->right - winRect->left,
     382                                      -tmpRect.left, -tmpRect.top ) + 1;
    393383        }
    394384
    395385        SetRect (&tmpRect, 0, 0, 0, 0);
    396386        AdjustRectInner(&tmpRect);
    397         clientRect->left   -= tmpRect.left;
    398         clientRect->top    -= tmpRect.top;
    399         clientRect->right  -= tmpRect.right;
    400         clientRect->bottom -= tmpRect.bottom;
     387        winRect->left   -= tmpRect.left;
     388        winRect->top    -= tmpRect.top;
     389        winRect->right  -= tmpRect.right;
     390        winRect->bottom -= tmpRect.bottom;
    401391    }
    402392
  • trunk/src/user32/new/win32wbasepos.cpp

    r2433 r2435  
    1 /* $Id: win32wbasepos.cpp,v 1.6 2000-01-13 20:11:39 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.7 2000-01-14 13:16:59 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    134134        winposCopy = *winpos;
    135135        params.rgrc[1] = *oldWindowRect;
    136 #if 0
    137136        if(getParent()) {//in parent coordinates
    138137            MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), (POINT *)oldClientRect, 2);
     
    141140            OffsetRect(oldClientRect, rectWindow.left, rectWindow.top);
    142141        }
    143 #endif
    144142        params.rgrc[2] = *oldClientRect;
    145143        params.lppos = &winposCopy;
    146144   }
    147145   result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)&params );
    148    if (calcValidRect)
     146
     147   /* If the application send back garbage, ignore it */
     148   if (params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom)
    149149   {
    150       /* If the application send back garbage, ignore it */
    151       if (params.rgrc[2].left <= params.rgrc[2].right && params.rgrc[2].top <= params.rgrc[2].bottom)
    152       {
    153         *newClientRect = params.rgrc[2];
    154 #if 0
    155         if(getParent()) {//in parent coordinates
    156             MapWindowPoints(getParent()->getWindowHandle(), getWindowHandle(), (POINT *)newClientRect, 2);
    157         }
    158         else {//in screen coordinates (just add window rectangle origin (already in screen coordinates))
    159             OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top);
    160         }
    161 #endif
    162       }
    163       else
    164         SetRectEmpty(newClientRect);
     150        *newClientRect = params.rgrc[0];
     151        //client rectangle now in screen coordinates; convert to 'frame' coordinates
     152        OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top);
    165153   }
    166154
  • trunk/src/user32/new/win32wmdichild.cpp

    r2426 r2435  
    1 /* $Id: win32wmdichild.cpp,v 1.8 2000-01-13 13:54:55 sandervl Exp $ */
     1/* $Id: win32wmdichild.cpp,v 1.9 2000-01-14 13:16:59 sandervl Exp $ */
    22/*
    33 * Win32 MDI Child Window Class for OS/2
     
    534534    RECT rect;
    535535
    536     getClientRect(&rect);
     536    client->getClientRect(&rect);
    537537    if(client->getParent() == NULL) {
    538538        dprintf(("Win32MDIChildWindow::childGetMinMaxInfo:: client parent == NULL!!"));
Note: See TracChangeset for help on using the changeset viewer.