Ignore:
Timestamp:
Feb 22, 2001, 7:18:59 PM (25 years ago)
Author:
sandervl
Message:

minimize updates + update region fix in NotifyFrameChanged

File:
1 edited

Legend:

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

    r5236 r5246  
    1 /* $Id: win32wbasepos.cpp,v 1.20 2001-02-21 20:51:07 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.21 2001-02-22 18:18:59 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    155155   if((winpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )
    156156   {
    157     params.rgrc[0] = *newWindowRect;
    158     if(calcValidRect)
    159     {
     157        params.rgrc[0] = *newWindowRect;
     158        if(calcValidRect)
     159        {
    160160            winposCopy = *winpos;
    161161            params.rgrc[1] = *oldWindowRect;
     
    165165
    166166            params.lppos = &winposCopy;
    167     }
    168     result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)&params );
    169 
    170     /* If the application send back garbage, ignore it */
    171     if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom)
    172     {
     167        }
     168        result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)&params );
     169
     170        /* If the application send back garbage, ignore it */
     171        if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom)
     172        {
    173173            *newClientRect = params.rgrc[0];
    174174            //client rectangle now in parent coordinates; convert to 'frame' coordinates
    175175            OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top);
    176     }
     176        }
    177177
    178178        /* FIXME: WVR_ALIGNxxx */
     
    211211    return 0;
    212212}
     213/***********************************************************************
     214 *           WINPOS_FindIconPos
     215 *
     216 * Find a suitable place for an iconic window.
     217 */
     218static void WINPOS_FindIconPos( HWND hwnd, POINT &pt )
     219{
     220    RECT rectParent;
     221    int  x, y, xspacing, yspacing;
     222    HWND hwndChild, hwndParent;
     223
     224    hwndParent = GetParent(hwnd);
     225    if(hwndParent == 0) {
     226        DebugInt3();
     227        return;
     228    }
     229
     230    GetClientRect(hwndParent, &rectParent );
     231    if ((pt.x >= rectParent.left) && (pt.x + GetSystemMetrics(SM_CXICON) < rectParent.right) &&
     232        (pt.y >= rectParent.top) && (pt.y + GetSystemMetrics(SM_CYICON) < rectParent.bottom))
     233        return;  /* The icon already has a suitable position */
     234
     235    xspacing = GetSystemMetrics(SM_CXICONSPACING);
     236    yspacing = GetSystemMetrics(SM_CYICONSPACING);
     237
     238    y = rectParent.bottom;
     239    for (;;)
     240    {
     241        x = rectParent.left;
     242        do
     243        {
     244            /* Check if another icon already occupies this spot */
     245            hwndChild = GetWindow(hwndParent, GW_CHILD);
     246
     247            while(hwndChild)
     248            {
     249                Win32BaseWindow *child = NULL;
     250                RECT *pRectWindow;
     251
     252                child = Win32BaseWindow::GetWindowFromHandle(hwndChild);
     253                if(!child) {
     254                    dprintf(("ERROR: WINPOS_FindIconPos, child %x not found", hwndChild));
     255                    return;
     256                }
     257                if ((child->getStyle() & WS_MINIMIZE) && (child->getWindowHandle() != hwnd))
     258                {
     259                    pRectWindow = child->getWindowRect();
     260                    if ((pRectWindow->left   < x + xspacing) &&
     261                        (pRectWindow->right  >= x) &&
     262                        (pRectWindow->top    <= y) &&
     263                        (pRectWindow->bottom > y - yspacing))
     264                        break;  /* There's a window in there */
     265                }
     266                hwndChild = GetWindow(hwndChild, GW_HWNDNEXT);
     267            }
     268
     269            if (!hwndChild) /* No window was found, so it's OK for us */
     270            {
     271                        pt.x = x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2;
     272                        pt.y = y - (yspacing + GetSystemMetrics(SM_CYICON)) / 2;
     273                        return;
     274            }
     275                x += xspacing;
     276        } while(x <= rectParent.right-xspacing);
     277
     278        y -= yspacing;
     279    }
     280}
    213281/******************************************************************************
    214282 *           WINPOS_MinMaximize
     
    221289{
    222290    UINT swpFlags = 0;
    223     POINT size;
     291    POINT size, iconPos;
    224292
    225293    size.x = rectWindow.left;
     
    248316            setStyle(getStyle() | WS_MINIMIZE);
    249317
    250             SetRect(lpRect, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y,
    251                     GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
     318            iconPos.x = windowpos.ptMinPosition.x;
     319            iconPos.y = windowpos.ptMinPosition.y;
     320            WINPOS_FindIconPos(getWindowHandle(), iconPos);
     321            SetRect(lpRect, iconPos.x, iconPos.y, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
    252322            break;
    253323
Note: See TracChangeset for help on using the changeset viewer.