Changeset 2521 for trunk/src


Ignore:
Timestamp:
Jan 26, 2000, 7:02:38 PM (26 years ago)
Author:
cbratschi
Message:

refixed WM_WINDOWPOS*

Location:
trunk/src/user32
Files:
8 edited

Legend:

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

    r2489 r2521  
    1 /* $Id: oslibwin.cpp,v 1.63 2000-01-21 13:30:34 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.64 2000-01-26 18:02:34 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    9393
    9494  if (*hwndFrame) {
    95     hwndClient = WinCreateWindow (*hwndFrame,saveBits ? WIN32_STDCLASS:WIN32_STDCLASS2,
     95    hwndClient = WinCreateWindow (*hwndFrame,saveBits ? WIN32_STDCLASS2:WIN32_STDCLASS,
    9696                                  NULL, dwClientStyle, 0, 0, 0, 0,
    9797                                  *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
     
    525525        point.x = swpFrame.x;
    526526        point.y = swpFrame.y;
    527         if(hParent)
     527
     528        if (hParent)
    528529        {
    529                 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
     530          RECTL parentRect;
     531
     532          WinQueryWindowRect(hParent,&parentRect);
     533          parentHeight = parentRect.yTop;
     534        } else
     535        {
     536          parentHeight = ScreenHeight;
    530537        }
    531         point.y = ScreenHeight-point.y-swpFrame.cy;
     538
     539        point.y = parentHeight-point.y-swpFrame.cy;
    532540
    533541        cy = swpFrame.cy;
     
    610618    if(fuFlags & (SWP_MOVE | SWP_SIZE))
    611619    {
     620        if (hParent)
     621        {
     622          RECTL parentRect;
     623
     624          WinQueryWindowRect(hParent,&parentRect);
     625          parentHeight = parentRect.yTop;
     626        } else
     627        {
     628          parentHeight = ScreenHeight;
     629        }
     630
    612631        point.x = x;
    613         point.y = y;
    614 
    615         if(hParent)
    616         {
    617                 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
    618         }
    619         point.y = ScreenHeight-point.y-cy;
     632        point.y = parentHeight-y-cy;
    620633
    621634        x  = point.x;
     
    706719         y = pswpOld->y;
    707720
    708          if (!((y == 0) && (pswpOld->cy == 0)))
    709          {
    710             y = parentHeight-y-pswpOld->cy;
    711          }
     721         y = parentHeight-y-pswpOld->cy;
    712722      }
    713723
     
    724734      y  = parentHeight-y-cy;
    725735
    726 
    727        if ((pswpOld->x == x) && (pswpOld->y == y))
     736      if ((pswpOld->x == x) && (pswpOld->y == y))
    728737         flags &= ~SWP_MOVE;
    729738
     
    757766   UINT fuFlags         = pwpos->flags;
    758767   ULONG parentHeight;
    759    POINTL point;
    760768
    761769   HWND  hWinAfter;
     
    787795   if (flags & (SWP_MOVE | SWP_SIZE))
    788796   {
    789       point.x = x;
    790       point.y = y;
    791 
    792       if(hParent) {
    793             parentHeight = OSLibGetWindowHeight(hParent);
    794 
    795             point.y = ScreenHeight-point.y-cy;
    796             WinMapWindowPoints(HWND_DESKTOP, hParent, &point, 1);
    797             point.y = parentHeight-point.y-cy;
     797      if (hParent)
     798      {
     799        RECTL parentRect;
     800
     801        WinQueryWindowRect(hParent,&parentRect);
     802        parentHeight = parentRect.yTop;
     803      } else
     804      {
     805        parentHeight = ScreenHeight;
    798806      }
    799       else  parentHeight = ScreenHeight;
    800 
    801       x  = point.x;
    802       y  = point.y;
    803807
    804808      if (flags & SWP_SIZE)
     
    814818      y  = parentHeight-y-cy;
    815819
    816 
    817        if ((pswpOld->x == x) && (pswpOld->y == y))
     820      if ((pswpOld->x == x) && (pswpOld->y == y))
    818821         flags &= ~SWP_MOVE;
    819822
  • trunk/src/user32/pmframe.cpp

    r2483 r2521  
    1 /* $Id: pmframe.cpp,v 1.38 2000-01-20 16:48:55 cbratschi Exp $ */
     1/* $Id: pmframe.cpp,v 1.39 2000-01-26 18:02:35 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    141141    case WM_QUERYTRACKINFO:
    142142    {
    143       //CB: todo: use minmaxinfo
    144       goto RunDefFrameProc;
     143      PTRACKINFO trackInfo = (PTRACKINFO)mp2;
     144
     145      RestoreOS2TIB();
     146      OldFrameProc(hwnd,msg,mp1,mp2);
     147      SetWin32TIB();
     148      trackInfo->cxBorder = 0;
     149      trackInfo->cyBorder = 0;
     150      win32wnd->AdjustTrackInfo((PPOINT)&trackInfo->ptlMinTrackSize,(PPOINT)&trackInfo->ptlMaxTrackSize);
     151      RestoreOS2TIB();
     152      return (MRESULT)TRUE;
    145153    }
    146154
     
    212220      PSWP     pswp = (PSWP)mp1;
    213221      SWP      swpOld;
    214       WINDOWPOS wp;
     222      WINDOWPOS wp,wpOld;
    215223      HWND      hParent = NULLHANDLE, hwndAfter;
    216224
     
    254262        }
    255263
    256         //CB: problems with profmine titlebar tracking
    257         if(win32wnd->MsgPosChanging((LPARAM)&wp) == 0)
    258         {//app or default window handler changed wp
    259             dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));
    260             dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    261 
    262             OSLibMapWINDOWPOStoSWPFrame(&wp, pswp, &swpOld, hParent, hwnd);
    263             dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
    264             pswp->fl |= SWP_NOADJUST;
    265             pswp->hwndInsertBehind = hwndAfter;
    266             pswp->hwnd = hwnd;
    267 
    268             RestoreOS2TIB();
    269             return (MRESULT)0xf;
     264        wpOld = wp;
     265        win32wnd->MsgPosChanging((LPARAM)&wp);
     266
     267        if ((wp.hwndInsertAfter != wpOld.hwndInsertAfter) ||
     268            (wp.x != wpOld.x) || (wp.y != wpOld.y) || (wp.cx != wpOld.cx) || (wp.cy != wpOld.cy) || (wp.flags != wpOld.flags))
     269        {
     270          dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));
     271          dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     272
     273          OSLibMapWINDOWPOStoSWPFrame(&wp, pswp, &swpOld, hParent, hwnd);
     274          dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy));
     275          pswp->fl |= SWP_NOADJUST;
     276          pswp->hwndInsertBehind = hwndAfter;
     277          pswp->hwnd = hwnd;
     278
     279          RestoreOS2TIB();
     280          return (MRESULT)0xf;
    270281        }
    271282        goto RunDefFrameProc;
  • trunk/src/user32/user32.cpp

    r2469 r2521  
    1 /* $Id: user32.cpp,v 1.66 2000-01-18 20:10:47 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.67 2000-01-26 18:02:35 cbratschi Exp $ */
    22
    33/*
     
    785785    case SM_CYMINIMIZED:
    786786        break;
     787
     788    case SM_CXMINTRACK:
     789    case SM_CXMIN:
     790        rc = 112;
     791        break;
     792
     793    case SM_CYMINTRACK:
     794    case SM_CYMIN:
     795        rc = 27;
     796        break;
     797
    787798    case SM_CXMAXTRACK: //max window size
    788799    case SM_CXMAXIMIZED:    //max toplevel window size
    789800        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CXSCREEN);
    790801        break;
     802
    791803    case SM_CYMAXTRACK:
    792804    case SM_CYMAXIMIZED:
    793805        rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYSCREEN);
    794806        break;
     807
    795808    case SM_NETWORK:
    796809        rc = 0x01;  //TODO: default = yes
  • trunk/src/user32/win32wbase.cpp

    r2489 r2521  
    1 /* $Id: win32wbase.cpp,v 1.144 2000-01-21 13:30:35 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.145 2000-01-26 18:02:36 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    462462        if (maxSize.x < cs->cx) cs->cx = maxSize.x;
    463463        if (maxSize.y < cs->cy) cs->cy = maxSize.y;
    464         if (cs->cx < minTrack.x ) cs->cx = minTrack.x;
    465         if (cs->cy < minTrack.y ) cs->cy = minTrack.y;
     464        if (cs->cx < minTrack.x) cs->cx = minTrack.x;
     465        if (cs->cy < minTrack.y) cs->cy = minTrack.y;
    466466  }
    467467
     
    653653                                MAKELONG(rectClient.right-rectClient.left,
    654654                                         rectClient.bottom-rectClient.top));
    655                 DWORD lParam;
    656 
    657                 if(getParent()) {//in parent coordinates
    658                     POINT point;
    659 
    660                     point.x = rectClient.left;
    661                     point.y = rectClient.top;
    662                     MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
    663 
    664                     lParam = MAKELONG(point.x, point.y);
    665                 }
    666                 else {//in screen coordinates
    667                     lParam = MAKELONG(rectWindow.left+rectClient.left, rectWindow.top+rectClient.top);
    668                 }
    669                 SendInternalMessageA(WM_MOVE, 0, lParam);
     655                SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
    670656            }
    671657
     
    779765    //     a WM_WINDOWPOSCHANGED msg -> crash)
    780766    if(fNoSizeMsg || fDestroyWindowCalled)
    781         return 1;
     767        return 0;
    782768
    783769    return SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, lp);
     
    10511037  ULONG rc;
    10521038
    1053   if(lpWndPos) {
     1039  if(lpWndPos)
     1040  {
     1041    POINT point;
     1042
    10541043    //set new window rectangle
    1055     setWindowRect(lpWndPos->x, lpWndPos->y, lpWndPos->x + lpWndPos->cx, lpWndPos->y + lpWndPos->cy);
    1056     newWindowRect= rectWindow;
     1044    point.x = lpWndPos->x;
     1045    point.y = lpWndPos->y;
     1046    if (getParent()) ClientToScreen(getParent()->getWindowHandle(),&point);
     1047    setWindowRect(point.x,point.y,point.x+lpWndPos->cx,point.y+lpWndPos->cy);
     1048    newWindowRect = rectWindow;
    10571049  }
    10581050  else {
     
    14101402        if (!(wpos->flags & SWP_NOMOVE) && !(wpos->flags & SWP_NOCLIENTMOVE))
    14111403        {
    1412             DWORD lParam;
    1413 
    1414                 if(getParent()) {//in parent coordinates
    1415                     POINT point;
    1416 
    1417                     point.x = rectClient.left;
    1418                     point.y = rectClient.top;
    1419                     MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
    1420 
    1421                     lParam = MAKELONG(point.x, point.y);
    1422                 }
    1423                 else {//in screen coordinates
    1424                     lParam = MAKELONG(rectWindow.left+rectClient.left, rectWindow.top+rectClient.top);
    1425                 }
    1426                 SendInternalMessageA(WM_MOVE, 0, lParam);
     1404            SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
    14271405        }
    14281406        if (!(wpos->flags & SWP_NOSIZE) && !(wpos->flags & SWP_NOCLIENTSIZE))
     
    20632041
    20642042#if 0 //CB: test: MSIE 2.0 displays the tool-/addressbar this way -> to check
     2043      //CB: -> comctl32: toolbar (WM_SIZE), same bug: statusbar height
    20652044  //CB: cx or cy are 0
    2066 if (cx == 0) cx = 50;
    2067 if (cy == 0) cy = 50;
     2045
     2046if (cx == 0)
     2047{
     2048  dprintf(("CB: cx is 0! %d",fuFlags));
     2049  if (fuFlags & SWP_NOSIZE) dprintf(("CB: nosize"));
     2050  //cx = 50;
     2051}
     2052if (cy == 0)
     2053{
     2054  dprintf(("CB: cy is 0! %d",fuFlags));
     2055  if (fuFlags & SWP_NOSIZE) dprintf(("CB: nosize"));
     2056  //cy = 50;
     2057}
     2058
    20682059#endif
    20692060
     
    21102101        }
    21112102    }
    2112 //CB: todo
    2113  #if 0
    2114     if (isFrameWindow())
    2115     {
    2116       if (!isChild())
    2117       {
    2118         POINT maxSize, maxPos, minTrack, maxTrack;
    2119 
    2120         GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
    2121 
    2122         if (swp.cx > maxTrack.x) swp.cx = maxTrack.x;
    2123         if (swp.cy > maxTrack.y) swp.cy = maxTrack.y;
    2124         if (swp.cx < minTrack.x) swp.cx = minTrack.x;
    2125         if (swp.cy < minTrack.y) swp.cy = minTrack.y;
    2126       }
    2127       swp.hwnd = OS2HwndFrame;
    2128     }
    2129     else
    2130 #endif
    2131       swp.hwnd = OS2HwndFrame;
     2103    swp.hwnd = OS2HwndFrame;
    21322104
    21332105    dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl));
  • trunk/src/user32/win32wbase.h

    r2489 r2521  
    1 /* $Id: win32wbase.h,v 1.73 2000-01-21 13:30:35 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.74 2000-01-26 18:02:37 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    429429
    430430         VOID  AdjustMaximizedRect(LPRECT rect);
     431         VOID  AdjustTrackInfo(PPOINT minTrackSize,PPOINT maxTrackSize);
    431432
    432433         BOOL   isOwnDC() { return (windowClass && windowClass->getStyle() & CS_OWNDC_W); }
  • trunk/src/user32/win32wbasenonclient.cpp

    r2483 r2521  
    1 /* $Id: win32wbasenonclient.cpp,v 1.4 2000-01-20 16:48:57 cbratschi Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.5 2000-01-26 18:02:37 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    334334//******************************************************************************
    335335//******************************************************************************
     336VOID Win32BaseWindow::AdjustTrackInfo(PPOINT minTrackSize,PPOINT maxTrackSize)
     337{
     338  if ((dwStyle & WS_THICKFRAME) || !(dwStyle & (WS_POPUP | WS_CHILD)))
     339    GetMinMaxInfo(NULL,NULL,minTrackSize,maxTrackSize);
     340}
     341//******************************************************************************
     342//******************************************************************************
    336343VOID Win32BaseWindow::AdjustRectOuter(LPRECT rect,BOOL menu)
    337344{
  • trunk/src/user32/win32wbasepos.cpp

    r2469 r2521  
    1 /* $Id: win32wbasepos.cpp,v 1.10 2000-01-18 20:10:57 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.11 2000-01-26 18:02:38 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    156156}
    157157/***********************************************************************
    158  *           WINPOS_HandleWindowPosChanging16
     158 *           WINPOS_HandleWindowPosChanging
    159159 *
    160160 * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc().
     
    162162LONG Win32BaseWindow::HandleWindowPosChanging(WINDOWPOS *winpos)
    163163{
    164  POINT maxSize, minTrack;
    165  int   rc = 1;
     164    POINT maxSize;
     165    if (winpos->flags & SWP_NOSIZE) return 0;
    166166
    167     if (winpos->flags & SWP_NOSIZE)
    168         return 1;
    169 
    170     if ((getStyle() & WS_THICKFRAME) ||
    171         ((getStyle() & (WS_POPUP | WS_CHILD)) == 0))
     167    if ((dwStyle & WS_THICKFRAME) ||
     168        ((dwStyle & (WS_POPUP | WS_CHILD)) == 0))
    172169    {
    173         GetMinMaxInfo(&maxSize, NULL, &minTrack, NULL );
    174         if (maxSize.x < winpos->cx) {
    175             winpos->cx = maxSize.x;
    176             rc = 0;
    177         }
    178         if (maxSize.y < winpos->cy) {
    179             winpos->cy = maxSize.y;
    180             rc = 0;
    181         }
    182         if (!(getStyle() & WS_MINIMIZE))
    183         {
    184             if (winpos->cx < minTrack.x ) {
    185                 winpos->cx = minTrack.x;
    186                 rc = 0;
    187             }
    188             if (winpos->cy < minTrack.y ) {
    189                 winpos->cy = minTrack.y;
    190                 rc = 0;
    191             }
    192         }
     170        GetMinMaxInfo( &maxSize, NULL, NULL, NULL );
     171        winpos->cx = MIN( winpos->cx, maxSize.x );
     172        winpos->cy = MIN( winpos->cy, maxSize.y );
    193173    }
    194     return rc;
     174    return 0;
    195175}
    196176//******************************************************************************
  • trunk/src/user32/window.cpp

    r2483 r2521  
    1 /* $Id: window.cpp,v 1.50 2000-01-20 16:48:58 cbratschi Exp $ */
     1/* $Id: window.cpp,v 1.51 2000-01-26 18:02:38 cbratschi Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    400400        dprintf(("IsIconic, window %x not found", hwnd));
    401401        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    402         return 0;
     402        return FALSE;
    403403    }
    404404    rc = window->IsIconic();
     
    493493  Win32BaseWindow *window;
    494494
     495    if (!hwnd)
     496    {
     497      dprintf(("SetWindowPos: Can't move desktop!"));
     498      return TRUE;
     499    }
    495500    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    496501    if(!window) {
    497502        dprintf(("SetWindowPos, window %x not found", hwnd));
    498503        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    499         return 0;
     504        return FALSE;
    500505    }
    501506    dprintf(("SetWindowPos %x %x x=%d y=%d cx=%d cy=%d %x", hwnd, hwndInsertAfter, x, y, cx, cy, fuFlags));
     
    560565  BOOL rc;
    561566
    562     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     567    if (hwnd)
     568      window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     569    else
     570      window = windowDesktop;
    563571    if(!window) {
    564572        dprintf(("IsWindowVisible, window %x not found", hwnd));
     
    641649  Win32BaseWindow *window;
    642650
    643     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     651    if (hwnd)
     652      window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     653    else
     654      window = windowDesktop;
    644655    if(!window) {
    645656        dprintf(("GetWindowRect, window %x not found", hwnd));
Note: See TracChangeset for help on using the changeset viewer.