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

ScrollWindow, maximized window + system menu fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.