Changeset 5215 for trunk/src


Ignore:
Timestamp:
Feb 20, 2001, 4:40:23 PM (25 years ago)
Author:
sandervl
Message:

ScrollWindow, maximized window + system menu fixes

Location:
trunk/src/user32
Files:
7 edited

Legend:

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

    r5191 r5215  
    1 /* $Id: dc.cpp,v 1.90 2001-02-19 13:13:00 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.91 2001-02-20 15:40:22 sandervl Exp $ */
    22
    33/*
     
    231231
    232232//testestest
    233    if(wnd && wnd->getWindowWidth() && wnd->getWindowHeight()) {
    234        RECTL recttmp, rectviewold;
    235 
    236        rc = GpiQueryPageViewport(pHps->hps, &rectviewold);
    237        if(rc == 0) {
    238            dprintf(("WARNING: GpiQueryPageViewport returned FALSE!!"));
    239        }
    240        recttmp.xLeft   = 0;
    241 //       recttmp.xRight  = ((double)wnd->getWindowWidth() / xScale);
    242        recttmp.xRight  = ((double)GetScreenWidth() / xScale);
    243        recttmp.yBottom = 0;
    244 //       recttmp.yTop    = ((double)wnd->getWindowHeight() / yScale);
    245        recttmp.yTop    = ((double)GetScreenHeight() / yScale);
    246 
    247        if(recttmp.yTop != rectviewold.yTop ||
    248           recttmp.xRight != rectviewold.xRight)
    249        {
    250            dprintf(("GpiSetPageViewport %x (%d,%d) %f %f", pHps->hps, recttmp.xRight, recttmp.yTop, xScale, yScale));
    251            rc = GpiSetPageViewport(pHps->hps, &recttmp);
    252            if(rc == 0) {
    253               dprintf(("WARNING: GpiSetPageViewport returned FALSE!!"));
    254            }
    255        }
     233   if(wnd && wnd->getWindowWidth() && wnd->getWindowHeight())
     234   {
     235        RECTL recttmp, rectviewold;
     236
     237        rc = GpiQueryPageViewport(pHps->hps, &rectviewold);
     238        if(rc == 0) {
     239            dprintf(("WARNING: GpiQueryPageViewport returned FALSE!!"));
     240        }
     241        recttmp.xLeft   = 0;
     242        recttmp.xRight  = ((double)GetScreenWidth() / xScale);
     243        recttmp.yBottom = 0;
     244        recttmp.yTop    = ((double)GetScreenHeight() / yScale);
     245
     246        if(recttmp.yTop != rectviewold.yTop ||
     247           recttmp.xRight != rectviewold.xRight)
     248        {
     249            if(pHps->viewportYExt > pHps->windowExt.cy) {//scaling up means we have to invert the y values
     250                recttmp.yBottom = GetScreenHeight() - recttmp.yTop;
     251                recttmp.yTop    = GetScreenHeight();
     252            }
     253            dprintf(("GpiSetPageViewport %x (%d,%d)(%d,%d) %f %f", pHps->hps, recttmp.xLeft, recttmp.yBottom, recttmp.xRight, recttmp.yTop, xScale, yScale));
     254            rc = GpiSetPageViewport(pHps->hps, &recttmp);
     255            if(rc == 0) {
     256                dprintf(("WARNING: GpiSetPageViewport returned FALSE!!"));
     257            }
     258        }
    256259   }
    257260//testestest
     
    16981701}
    16991702//******************************************************************************
     1703//SvL: Using WinScrollWindow to scroll child windows is better (smoother).
    17001704//******************************************************************************
    17011705INT WIN32API ScrollWindowEx(HWND hwnd, int dx, int dy, const RECT *pScroll, const RECT *pClip,
     
    17241728
    17251729    if (scrollFlag & SW_INVALIDATE_W)      scrollFlagsOS2 |= SW_INVALIDATERGN;
     1730    if (scrollFlag & SW_SCROLLCHILDREN_W)  scrollFlagsOS2 |= SW_SCROLLCHILDREN;
    17261731
    17271732    mapWin32ToOS2Rect(window->getWindowHeight(), window->getClientRectPtr(), (PRECTLOS2)&clientRect);
     
    17581763      //CB: todo, scroll in several steps
    17591764      //    is time in ms? time <-> iteration count?
    1760     }
    1761 
    1762     // Scroll children first
    1763     if (scrollFlag & SW_SCROLLCHILDREN_W)
    1764     {
    1765         HWND hwndChild;
    1766         RECT rectChild, rc;
    1767 
    1768             dprintf(("ScrollWindowEx: Scroll child windows"));
    1769             GetClientRect(hwnd, &rc);
    1770             if (pScroll) IntersectRect(&rc, &rc, pScroll);
    1771 
    1772             hwndChild = GetWindow(hwnd, GW_CHILD_W);
    1773 
    1774             while(hwndChild)
    1775             {
    1776                 Win32BaseWindow *child;
    1777 
    1778                 child = Win32BaseWindow::GetWindowFromHandle(hwndChild);
    1779                 if(!child) {
    1780                     dprintf(("ScrollWindowEx, child %x not found", hwnd));
    1781                     return 0;
    1782                 }
    1783                 rectChild = *child->getWindowRect();
    1784                 if(!pRectUpdate || IntersectRect(&rectChild, &rectChild, &rc))
    1785                 {
    1786                      dprintf(("ScrollWindowEx: Scroll child window %x", hwndChild));
    1787                      SetWindowPos(hwndChild, 0, rectChild.left + dx,
    1788                                   rectChild.top + orgdy, 0, 0, SWP_NOZORDER_W |
    1789                                   SWP_NOSIZE_W | SWP_NOACTIVATE_W | SWP_NOREDRAW);
    1790                 }
    1791                 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT_W);
    1792             }
    1793             dprintf(("***ScrollWindowEx: Scroll child windows DONE"));
    17941765    }
    17951766
     
    18011772    {
    18021773        return ERROR_W;
     1774    }
     1775
     1776    //Notify children that they have moved (according to the SDK docs,
     1777    //they only receive a WM_MOVE message)
     1778    //(PM only does this for windows with CS_MOVENOTIFY class)
     1779    //TODO: Verify this (no WM_WINDOWPOSCHANGING/ED?)
     1780    if (scrollFlag & SW_SCROLLCHILDREN_W)
     1781    {
     1782        HWND hwndChild;
     1783        RECT rectChild, rc;
     1784
     1785            dprintf(("ScrollWindowEx: Scroll child windows"));
     1786            GetClientRect(hwnd, &rc);
     1787            if (pScroll) IntersectRect(&rc, &rc, pScroll);
     1788
     1789            hwndChild = GetWindow(hwnd, GW_CHILD_W);
     1790
     1791            while(hwndChild)
     1792            {
     1793                Win32BaseWindow *child;
     1794
     1795                child = Win32BaseWindow::GetWindowFromHandle(hwndChild);
     1796                if(!child) {
     1797                    dprintf(("ERROR: ScrollWindowEx, child %x not found", hwnd));
     1798                    return 0;
     1799                }
     1800                rectChild = *child->getWindowRect();
     1801                if(!pRectUpdate || IntersectRect(&rectChild, &rectChild, &rc))
     1802                {
     1803                     dprintf(("ScrollWindowEx: Scroll child window %x", hwndChild));
     1804                     child->ScrollWindow(dx, orgdy);
     1805                }
     1806                hwndChild = GetWindow(hwndChild, GW_HWNDNEXT_W);
     1807            }
     1808            dprintf(("***ScrollWindowEx: Scroll child windows DONE"));
    18031809    }
    18041810
  • trunk/src/user32/oslibwin.cpp

    r5191 r5215  
    1 /* $Id: oslibwin.cpp,v 1.87 2001-02-19 13:13:02 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.88 2001-02-20 15:40:22 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    821821}
    822822//******************************************************************************
    823 //******************************************************************************
     823//Returns the maximum position for a window
     824//Should only be used from toplevel windows
     825//******************************************************************************
     826BOOL OSLibWinGetMaxPosition(HWND hwndOS2, RECT *rect)
     827{
     828 SWP  swp;
     829 
     830  if(!WinGetMaxPosition(hwndOS2, &swp)) {
     831        dprintf(("WARNING: WinGetMaxPosition %x returned FALSE", hwndOS2));
     832        return FALSE;
     833  }
     834  rect->left   = swp.x;
     835  rect->right  = swp.x + swp.cx;
     836  rect->top    = ScreenHeight - (swp.y + swp.cy);
     837  rect->bottom = ScreenHeight - swp.y;
     838  return TRUE;
     839}
     840//******************************************************************************
     841//******************************************************************************
  • trunk/src/user32/oslibwin.h

    r5191 r5215  
    1 /* $Id: oslibwin.h,v 1.49 2001-02-19 13:13:04 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.50 2001-02-20 15:40:22 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    306306
    307307BOOL   OSLibWinLockWindowUpdate(HWND hwnd);
     308BOOL   OSLibWinGetMaxPosition(HWND hwndOS2, RECT *rect);
    308309
    309310#endif //__OSLIBWIN_H__
  • trunk/src/user32/win32wbase.cpp

    r5173 r5215  
    1 /* $Id: win32wbase.cpp,v 1.237 2001-02-18 17:59:05 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.238 2001-02-20 15:40:22 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    638638    if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
    639639    {
    640          GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
     640        GetMinMaxInfo(&maxSize, &maxPos, &minTrack, &maxTrack);
    641641        if (maxSize.x < cs->cx) cs->cx = maxSize.x;
    642642        if (maxSize.y < cs->cy) cs->cy = maxSize.y;
     
    22472247
    22482248    if(!(swp & SWP_NOACTIVATE)) {
    2249     OSLibWinSetActiveWindow(OS2Hwnd);
     2249        OSLibWinSetActiveWindow(OS2Hwnd);
    22502250    }
    22512251
     
    24412441    }
    24422442    return (rc);
     2443}
     2444//******************************************************************************
     2445//Called by ScrollWindowEx (dc.cpp) to notify child window that it has moved
     2446//******************************************************************************
     2447BOOL Win32BaseWindow::ScrollWindow(int dx, int dy)
     2448{
     2449    rectWindow.left   += dx;
     2450    rectWindow.right  += dx;
     2451    rectWindow.top    += dy;
     2452    rectWindow.bottom += dy;
     2453    SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));
     2454    return TRUE;
    24432455}
    24442456//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r5173 r5215  
    1 /* $Id: win32wbase.h,v 1.106 2001-02-18 17:59:05 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.107 2001-02-20 15:40:23 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    222222         BOOL   SetWindowPlacement(WINDOWPLACEMENT *winpos);
    223223         BOOL   GetWindowPlacement(LPWINDOWPLACEMENT winpos);
     224         BOOL   ScrollWindow(int dx, int dy);
    224225         BOOL   DestroyWindow();
    225226         HWND   SetActiveWindow();
  • trunk/src/user32/win32wbasenonclient.cpp

    r4597 r5215  
    1 /* $Id: win32wbasenonclient.cpp,v 1.26 2000-11-15 13:57:57 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.27 2001-02-20 15:40:23 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    229229            pt.y = msg.pt.y;
    230230            ScreenToClient(getWindowHandle(), &pt);
    231             pt.x += rectClient.left;
    232             pt.y += rectClient.top;
     231        pt.x += rectClient.left;
     232        pt.y += rectClient.top;
    233233            msg.lParam = MAKELONG(pt.x,pt.y);
    234234
     
    264264      Win32BaseWindow *topparent = GetTopParent();
    265265
    266         if (GetActiveWindow() != topparent->getWindowHandle())
     266        if((getStyle() & WS_CHILD) && !(getExStyle() & WS_EX_MDICHILD))
    267267        {
    268             //SvL: Calling topparent->SetActiveWindow() causes focus problems
    269 //          topparent->SetActiveWindow();
    270             OSLibWinSetFocus(topparent->getOS2WindowHandle());
     268            if (GetActiveWindow() != topparent->getWindowHandle())
     269            {
     270                //SvL: Calling topparent->SetActiveWindow() causes focus problems
     271                topparent->SetActiveWindow();
     272////            OSLibWinSetFocus(topparent->getOS2WindowHandle());
     273            }
     274            if (GetActiveWindow() == topparent->getWindowHandle())
     275                 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
     276            else dprintf(("ACtive window (%x) != toplevel wnd %x", OSLibWinQueryActiveWindow(), topparent->getWindowHandle()));
    271277        }
    272 
    273         if (GetActiveWindow() == topparent->getWindowHandle())
    274             SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
    275         else dprintf(("ACtive window (%x) != toplevel wnd %x", OSLibWinQueryActiveWindow(), topparent->getWindowHandle()));
     278        else {
     279            SetActiveWindow();
     280            if (GetActiveWindow() == topparent->getWindowHandle())
     281                 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
     282            else dprintf(("ACtive window (%x) != wnd %x", OSLibWinQueryActiveWindow(), getWindowHandle()));
     283        }
    276284        break;
    277285    }
    278286
    279287    case HTSYSMENU:
    280       if(dwStyle & WS_SYSMENU )
    281       {
    282         SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
    283       }
    284       break;
     288        if(dwStyle & WS_SYSMENU )
     289        {
     290            SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
     291        }
     292        break;
    285293
    286294    case HTMENU:
    287       SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
    288       break;
     295        SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
     296        break;
    289297
    290298    case HTHSCROLL:
    291       SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
    292       break;
     299        SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
     300        break;
    293301
    294302    case HTVSCROLL:
    295       SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
    296       break;
     303        SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
     304        break;
    297305
    298306    case HTMINBUTTON:
    299307    case HTMAXBUTTON:
    300308    case HTHELP:
    301       TrackMinMaxHelpBox(wParam);
    302       break;
     309        TrackMinMaxHelpBox(wParam);
     310        break;
    303311
    304312    case HTCLOSE:
    305       TrackCloseButton(wParam);
    306       break;
     313        TrackCloseButton(wParam);
     314        break;
    307315
    308316    case HTLEFT:
     
    664672}
    665673//******************************************************************************
     674//Returns position of system menu in screen coordinates
    666675//******************************************************************************
    667676BOOL Win32BaseWindow::GetSysPopupPos(RECT* rect)
    668677{
    669   if(hSysMenu)
    670   {
    671       if(dwStyle & WS_MINIMIZE )
    672         *rect = rectWindow;
    673       else
    674       {
    675           GetInsideRect(rect );
    676           OffsetRect( rect, rectWindow.left, rectWindow.top);
    677           rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
    678           rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
    679       }
    680       return TRUE;
    681   }
    682   return FALSE;
     678    if(hSysMenu)
     679    {
     680        if(dwStyle & WS_MINIMIZE) {
     681            *rect = rectWindow;
     682        }
     683        else
     684        {
     685            GetInsideRect(rect );
     686            OffsetRect( rect, rectWindow.left, rectWindow.top);
     687                if(getStyle() & WS_CHILD)
     688                ClientToScreen(getParent()->getWindowHandle(), (POINT *)rect);
     689
     690            rect->right = rect->left + GetSystemMetrics(SM_CYCAPTION) - 1;
     691            rect->bottom = rect->top + GetSystemMetrics(SM_CYCAPTION) - 1;
     692        }
     693        return TRUE;
     694    }
     695    return FALSE;
    683696}
    684697//******************************************************************************
     
    13401353        if (wParam == SC_PUTMARK)
    13411354            WriteLog(("Mark requested by user\n"));
    1342         else
    1343         if (wParam == SC_DEBUGINT3) 
     1355    else
     1356        if (wParam == SC_DEBUGINT3)
    13441357            DebugInt3();
    13451358#endif
  • trunk/src/user32/win32wbasepos.cpp

    r4945 r5215  
    1 /* $Id: win32wbasepos.cpp,v 1.18 2001-01-14 17:15:47 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.19 2001-02-20 15:40:23 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    3939#include <win\hook.h>
    4040
    41 #define DBG_LOCALLOG    DBG_win32wbasepos
     41#define DBG_LOCALLOG    DBG_win32wbasepos
    4242#include "dbglocal.h"
    4343
     
    5454
    5555    /* Compute default values */
    56 
    57     MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);
    58     MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);
    59     MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
    60     MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
    61     MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
    62     MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
     56    MinMax.ptMaxPosition.x = 0;
     57    MinMax.ptMaxPosition.y = 0;
     58
     59    if(!(getStyle() & (WS_POPUP | WS_CHILD))) {
     60        RECT rect;
     61        OSLibWinGetMaxPosition(getOS2WindowHandle(), &rect);
     62        MinMax.ptMaxPosition.x = rect.left;
     63        MinMax.ptMaxPosition.y = rect.top;
     64
     65        MinMax.ptMaxSize.x = rect.right - rect.left;
     66        MinMax.ptMaxSize.y = rect.bottom - rect.top;
     67        MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
     68        MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
     69        MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
     70        MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
     71    }
     72    else {
     73        MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);
     74        MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);
     75        MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);
     76        MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);
     77        MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);
     78        MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);
     79    }
    6380
    6481    if (HAS_DLGFRAME( dwStyle, dwExStyle ))
     
    7592            yinc += GetSystemMetrics(SM_CYFRAME);
    7693        }
    77         //SvL: Wine has no 'else', but I'm seeing different behaviour in NT
     94        //SvL: Wine has no 'else', but I'm seeing different behaviour in NT
    7895        //     and it doesn't make much sense either as a window can have
    7996        //     only one kind of border (see drawing code)
    80         else
     97        else
    8198        if (dwStyle & WS_BORDER)
    8299        {
     
    95112    {
    96113#endif
    97         MinMax.ptMaxPosition.x = -xinc;
    98         MinMax.ptMaxPosition.y = -yinc;
     114        MinMax.ptMaxPosition.x -= xinc;
     115        MinMax.ptMaxPosition.y -= yinc;
    99116//    }
    100117
     
    138155   if((winpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )
    139156   {
    140         params.rgrc[0] = *newWindowRect;
    141         if(calcValidRect)
    142         {
    143                 winposCopy = *winpos;
    144                 params.rgrc[1] = *oldWindowRect;
    145                 params.rgrc[2] = *oldClientRect;
    146                 //client rectangel must be in parent coordinates
    147                 OffsetRect(&params.rgrc[2], rectWindow.left, rectWindow.top);
    148 
    149                 params.lppos = &winposCopy;
    150         }
    151         result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)&params );
    152 
    153         /* If the application send back garbage, ignore it */
    154         if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom)
    155         {
    156                 *newClientRect = params.rgrc[0];
    157                 //client rectangle now in parent coordinates; convert to 'frame' coordinates
    158                 OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top);
    159         }
     157    params.rgrc[0] = *newWindowRect;
     158    if(calcValidRect)
     159    {
     160            winposCopy = *winpos;
     161            params.rgrc[1] = *oldWindowRect;
     162            params.rgrc[2] = *oldClientRect;
     163            //client rectangel must be in parent coordinates
     164            OffsetRect(&params.rgrc[2], rectWindow.left, rectWindow.top);
     165
     166            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    {
     173            *newClientRect = params.rgrc[0];
     174            //client rectangle now in parent coordinates; convert to 'frame' coordinates
     175            OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top);
     176    }
    160177
    161178        /* FIXME: WVR_ALIGNxxx */
     
    169186   }
    170187   else
    171    if(!(winpos->flags & SWP_NOMOVE) && 
     188   if(!(winpos->flags & SWP_NOMOVE) &&
    172189       (newClientRect->left != rectClient.left || newClientRect->top != rectClient.top)) {
    173190            winpos->flags &= ~SWP_NOCLIENTMOVE;
     
    206223    POINT size;
    207224
    208     size.x = rectWindow.left; 
     225    size.x = rectWindow.left;
    209226    size.y = rectWindow.top;
    210227
    211228    if(IsRectEmpty(&windowpos.rcNormalPosition)) {
    212         CopyRect(&windowpos.rcNormalPosition, &rectWindow);
     229    CopyRect(&windowpos.rcNormalPosition, &rectWindow);
    213230    }
    214231    if(!HOOK_CallHooksA(WH_CBT, HCBT_MINMAX, getWindowHandle(), cmd))
    215232    {
    216         if(getStyle() & WS_MINIMIZE )
    217         {
    218             if(!SendInternalMessageA(WM_QUERYOPEN, 0, 0L))
    219                 return (SWP_NOSIZE | SWP_NOMOVE);
    220         }
    221         switch( cmd )
    222         {
    223             case SW_MINIMIZE:
    224                 if( getStyle() & WS_MAXIMIZE)
    225                 {
    226                         setFlags(getFlags() | WIN_RESTORE_MAX);
    227                         setStyle(getStyle() & ~WS_MAXIMIZE);
     233    if(getStyle() & WS_MINIMIZE )
     234    {
     235        if(!SendInternalMessageA(WM_QUERYOPEN, 0, 0L))
     236        return (SWP_NOSIZE | SWP_NOMOVE);
     237    }
     238    switch( cmd )
     239    {
     240        case SW_MINIMIZE:
     241        if( getStyle() & WS_MAXIMIZE)
     242        {
     243                setFlags(getFlags() | WIN_RESTORE_MAX);
     244                setStyle(getStyle() & ~WS_MAXIMIZE);
    228245                }
    229                 else    setFlags(getFlags() & ~WIN_RESTORE_MAX);
    230 
    231                 setStyle(getStyle() | WS_MINIMIZE);
    232 
    233                 SetRect(lpRect, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y,
    234                         GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
    235                 break;
    236 
    237             case SW_MAXIMIZE:
     246                else    setFlags(getFlags() & ~WIN_RESTORE_MAX);
     247
     248        setStyle(getStyle() | WS_MINIMIZE);
     249
     250        SetRect(lpRect, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y,
     251                GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
     252        break;
     253
     254        case SW_MAXIMIZE:
    238255                GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL );
    239256
    240                 if(getStyle() & WS_MINIMIZE )
    241                 {
    242                      setStyle(getStyle() & ~WS_MINIMIZE);
    243                 }
     257        if(getStyle() & WS_MINIMIZE )
     258        {
     259             setStyle(getStyle() & ~WS_MINIMIZE);
     260        }
    244261                setStyle(getStyle() | WS_MAXIMIZE);
    245262
    246                 SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y,
    247                         size.x, size.y );
    248                 break;
    249 
    250             case SW_RESTORE:
    251                 if(getStyle() & WS_MINIMIZE)
    252                 {
    253                         setStyle(getStyle() & ~WS_MINIMIZE);
    254 
    255                         if( getFlags() & WIN_RESTORE_MAX)
    256                         {
    257                                 /* Restore to maximized position */
    258                                 GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL);
    259                                 setStyle(getStyle() | WS_MAXIMIZE);
    260                                 SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, size.x, size.y);
    261                                 break;
    262                         }
    263                 }
    264                 else
    265                 if( !(getStyle() & WS_MAXIMIZE) )
    266                         return 0;
    267                 else    setStyle(getStyle() & ~WS_MAXIMIZE);
    268 
    269                 /* Restore to normal position */
    270 
    271                 *lpRect = windowpos.rcNormalPosition;
    272                 lpRect->right -= lpRect->left;
    273                 lpRect->bottom -= lpRect->top;
    274                 break;
    275         }
    276     } 
     263        SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y,
     264                size.x, size.y );
     265        break;
     266
     267        case SW_RESTORE:
     268        if(getStyle() & WS_MINIMIZE)
     269        {
     270                setStyle(getStyle() & ~WS_MINIMIZE);
     271
     272                if( getFlags() & WIN_RESTORE_MAX)
     273                {
     274                /* Restore to maximized position */
     275                            GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL);
     276                setStyle(getStyle() | WS_MAXIMIZE);
     277                SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, size.x, size.y);
     278                break;
     279                }
     280        }
     281        else
     282            if( !(getStyle() & WS_MAXIMIZE) )
     283            return 0;
     284            else    setStyle(getStyle() & ~WS_MAXIMIZE);
     285
     286        /* Restore to normal position */
     287
     288        *lpRect = windowpos.rcNormalPosition;
     289        lpRect->right -= lpRect->left;
     290        lpRect->bottom -= lpRect->top;
     291        break;
     292    }
     293    }
    277294    else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
    278295
Note: See TracChangeset for help on using the changeset viewer.