Changeset 5236 for trunk/src


Ignore:
Timestamp:
Feb 21, 2001, 9:51:07 PM (25 years ago)
Author:
sandervl
Message:

fixes for minimizing frame windows + WM_BUTTONxMOTIONSTART/END handling

Location:
trunk/src/user32
Files:
4 edited

Legend:

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

    r4848 r5236  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.40 2000-12-29 18:39:58 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.41 2001-02-21 20:51:06 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    375375        break;
    376376
     377    case WM_BUTTON2CLICK:
     378    case WM_BUTTON1CLICK:
     379    case WM_BUTTON3CLICK:
     380        goto dummymessage;
     381
    377382    case WM_BUTTON2MOTIONSTART:
    378383    case WM_BUTTON2MOTIONEND:
    379     case WM_BUTTON2CLICK:
    380384    case WM_BUTTON1MOTIONSTART:
    381385    case WM_BUTTON1MOTIONEND:
    382     case WM_BUTTON1CLICK:
    383386    case WM_BUTTON3MOTIONSTART:
    384387    case WM_BUTTON3MOTIONEND:
    385     case WM_BUTTON3CLICK:
    386         goto dummymessage;
     388        //no break; translate to WM_MOUSEMOVE
     389        //Some applications (e.g. Unreal) retrieve all mouse messages
     390        //when a mouse button is pressed and don't expect WM_NULL
    387391
    388392    case WM_MOUSEMOVE:
  • trunk/src/user32/win32wbase.cpp

    r5217 r5236  
    1 /* $Id: win32wbase.cpp,v 1.239 2001-02-20 17:22:05 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.240 2001-02-21 20:51:06 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    849849
    850850    if(fShow) {
    851             setStyle(getStyle() | WS_VISIBLE);
    852     }
    853     else    setStyle(getStyle() & ~WS_VISIBLE);
     851         setStyle(getStyle() | WS_VISIBLE);
     852         if(getStyle() & WS_MINIMIZE) {
     853            return ShowWindow(SW_RESTORE);
     854         }
     855    }
     856    else setStyle(getStyle() & ~WS_VISIBLE);
    854857
    855858    return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
     
    10581061//******************************************************************************
    10591062//******************************************************************************
    1060 ULONG Win32BaseWindow::MsgPaint(ULONG tmp1, BOOL select)
     1063ULONG Win32BaseWindow::MsgPaint(ULONG tmp, ULONG select)
    10611064{
    10621065    if (select && IsWindowIconic())
     
    15881591        if( hdc )
    15891592        {
    1590           if( (getStyle() & WS_MINIMIZE) && (getWindowClass()->getIcon() && hIcon))
    1591           {
    1592             int x = (rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2;
    1593             int y = (rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2;
    1594             dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom ));
    1595             DrawIcon(hdc, x, y, hIcon ? hIcon:getWindowClass()->getIcon() );
    1596           }
    1597           EndPaint(getWindowHandle(), &ps );
     1593            if( (getStyle() & WS_MINIMIZE) && (getWindowClass()->getIcon() || hIcon))
     1594            {
     1595                int x = (rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2;
     1596                int y = (rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2;
     1597                dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom ));
     1598                DrawIcon(hdc, x, y, hIcon ? hIcon:getWindowClass()->getIcon() );
     1599            }
     1600            EndPaint(getWindowHandle(), &ps );
    15981601        }
    15991602        return 0;
     
    21702173 BOOL  rc,wasVisible,showFlag;
    21712174 RECT  newPos = {0, 0, 0, 0};
     2175 BOOL  fInvalidate = FALSE;
    21722176
    21732177    dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow));
     
    21822186        break;
    21832187
    2184     case SW_SHOWMINNOACTIVE:
     2188        case SW_SHOWMINNOACTIVE:
    21852189        swp |= SWP_NOACTIVATE | SWP_NOZORDER;
    21862190        /* fall through */
     
    21892193        /* fall through */
    21902194    case SW_MINIMIZE:
    2191         swp |= SWP_FRAMECHANGED;
    2192         if( !(getStyle() & WS_MINIMIZE) )
    2193              swp |= MinMaximize(SW_MINIMIZE, &newPos );
     2195//testesteest
     2196        if(!(getStyle() & WS_CHILD))
     2197        {
     2198            if( !(getStyle() & WS_MINIMIZE) )
     2199                 swp |= MinMaximize(SW_MINIMIZE, &newPos );
     2200
     2201            swp |= SWP_NOSIZE | SWP_NOMOVE | SWP_HIDEWINDOW;
     2202        }
     2203        else {
     2204            swp |= SWP_FRAMECHANGED;
     2205            if( !(getStyle() & WS_MINIMIZE) ) {
     2206                 swp |= MinMaximize(SW_MINIMIZE, &newPos );
     2207                 fInvalidate = TRUE;
     2208            }
     2209            else swp |= SWP_NOSIZE | SWP_NOMOVE;
     2210        }
     2211//testesteest
     2212        break;
     2213
     2214    case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
     2215        swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
     2216        if( !(getStyle() & WS_MAXIMIZE) )
     2217             swp |= MinMaximize(SW_MAXIMIZE, &newPos );
    21942218        else swp |= SWP_NOSIZE | SWP_NOMOVE;
    21952219        break;
    21962220
    2197     case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE */
    2198             swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
    2199             if( !(getStyle() & WS_MAXIMIZE) )
    2200          swp |= MinMaximize(SW_MAXIMIZE, &newPos );
    2201             else swp |= SWP_NOSIZE | SWP_NOMOVE;
    2202             break;
    2203 
    22042221    case SW_SHOWNA:
    2205             swp |= SWP_NOACTIVATE | SWP_NOZORDER;
    2206             /* fall through */
     2222        swp |= SWP_NOACTIVATE | SWP_NOZORDER;
     2223        /* fall through */
    22072224    case SW_SHOW:
    22082225        swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
     
    22692286        SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
    22702287    }
     2288    if(fInvalidate) {
     2289        InvalidateRect(getWindowHandle(), NULL, 1);
     2290    }
    22712291END:
    22722292    return wasVisible;
     
    24112431        if(hTaskList) {
    24122432            dprintf(("Adding window %x to tasklist", getWindowHandle()));
    2413             OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
     2433            OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), 1);
    24142434        }
    24152435    }
    24162436    else
    2417     if(fuFlags & SWP_HIDEWINDOW && IsWindowVisible()) {
     2437    if((fuFlags & SWP_HIDEWINDOW) && IsWindowVisible()) {
    24182438        setStyle(getStyle() & ~WS_VISIBLE);
    2419         if(hTaskList) {
     2439        if(hTaskList && !(getStyle() & WS_MINIMIZE)) {
    24202440            dprintf(("Removing window %x from tasklist", getWindowHandle()));
    2421             OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), (getStyle() & WS_VISIBLE) ? 1 : 0);
     2441            OSLibWinChangeTaskList(hTaskList, OS2Hwnd, getWindowNameA(), 0);
    24222442        }
    24232443    }
     
    25342554   if(getStyle() & WS_MINIMIZE )
    25352555   {
    2536     //TODO: Why can't this be (0,0)?
    2537     if(wndpl->flags & WPF_SETMINPOSITION && !(!windowpos.ptMinPosition.x && !windowpos.ptMinPosition.y)) {
    2538         SetWindowPos(0, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y,
    2539                      0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
    2540     }
     2556        //TODO: Why can't this be (0,0)?
     2557        if(wndpl->flags & WPF_SETMINPOSITION && !(!windowpos.ptMinPosition.x && !windowpos.ptMinPosition.y)) {
     2558            SetWindowPos(0, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y,
     2559                         0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
     2560        }
    25412561   }
    25422562   else
  • trunk/src/user32/win32wbasenonclient.cpp

    r5217 r5236  
    1 /* $Id: win32wbasenonclient.cpp,v 1.28 2001-02-20 17:22:06 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.29 2001-02-21 20:51:07 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    10131013VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint)
    10141014{
    1015   BOOL active  = flags & WIN_NCACTIVATED;
    1016   HDC hdc;
    1017   RECT rect,rectClip,rfuzz;
    1018 
    1019   /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
    1020      the call to GetDCEx implying that it is allowed not to use it either.
    1021      However, the suggested GetDCEx(    , DCX_WINDOW | DCX_INTERSECTRGN)
    1022      will cause clipRgn to be deleted after ReleaseDC().
    1023      Now, how is the "system" supposed to tell what happened?
    1024    */
    1025 
    1026   dprintf(("DoNCPaint %x %x %d", getWindowHandle(), clip, suppress_menupaint));
    1027   DecreaseLogCount();
    1028 
    1029   rect.top    = rect.left = 0;
    1030   rect.right  = rectWindow.right - rectWindow.left;
    1031   rect.bottom = rectWindow.bottom - rectWindow.top;
    1032 
    1033   if (clip > 1)
    1034   {
    1035     //only redraw caption
    1036     GetRgnBox(clip,&rectClip);
     1015    BOOL active  = flags & WIN_NCACTIVATED;
     1016    HDC hdc;
     1017    RECT rect,rectClip,rfuzz;
     1018
     1019    /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in
     1020       the call to GetDCEx implying that it is allowed not to use it either.
     1021       However, the suggested GetDCEx(    , DCX_WINDOW | DCX_INTERSECTRGN)
     1022       will cause clipRgn to be deleted after ReleaseDC().
     1023       Now, how is the "system" supposed to tell what happened?
     1024    */
     1025
     1026    dprintf(("DoNCPaint %x %x %d", getWindowHandle(), clip, suppress_menupaint));
     1027    DecreaseLogCount();
     1028
     1029    rect.top    = rect.left = 0;
     1030    rect.right  = rectWindow.right - rectWindow.left;
     1031    rect.bottom = rectWindow.bottom - rectWindow.top;
     1032
     1033    if (clip > 1)
     1034    {
     1035        //only redraw caption
     1036        GetRgnBox(clip,&rectClip);
    10371037#if 1
    1038     //SvL: I'm getting paint problems when clipping a dc created in GetDCEx
    1039     //     with a region that covers the entire window (RealPlayer 7 Update 1)
    1040     //     As we don't need to clip anything when that occurs, this workaround
    1041     //     solves the problem.
    1042     if(rectClip.right == getWindowWidth() && rectClip.bottom == getWindowHeight())
     1038        //SvL: I'm getting paint problems when clipping a dc created in GetDCEx
     1039        //     with a region that covers the entire window (RealPlayer 7 Update 1)
     1040        //     As we don't need to clip anything when that occurs, this workaround
     1041        //     solves the problem.
     1042        if(rectClip.right == getWindowWidth() && rectClip.bottom == getWindowHeight())
     1043        {
     1044            clip = 0;
     1045            rectClip = rect;
     1046        }
     1047#endif
     1048    }
     1049    else
    10431050    {
    10441051        clip = 0;
    10451052        rectClip = rect;
    10461053    }
    1047 #endif
    1048   }
    1049   else
    1050   {
    1051     clip = 0;
    1052     rectClip = rect;
    1053   }
    1054 
    1055   if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
    1056                       ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return;
    1057 
    1058   SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
    1059 
    1060   if (HAS_BIGFRAME( dwStyle, dwExStyle))
    1061   {
    1062     DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
    1063   }
    1064   if (HAS_THICKFRAME( dwStyle, dwExStyle ))
    1065     DrawFrame(hdc, &rect, FALSE, active );
    1066   else if (HAS_DLGFRAME( dwStyle, dwExStyle ))
    1067     DrawFrame( hdc, &rect, TRUE, active );
    1068   else if (HAS_THINFRAME( dwStyle ))
    1069   {
    1070     SelectObject( hdc, GetStockObject(NULL_BRUSH) );
    1071     Rectangle( hdc, 0, 0, rect.right, rect.bottom );
    1072   }
    1073 
    1074   if ((dwStyle & WS_CAPTION) == WS_CAPTION)
    1075   {
    1076     RECT  r = rect;
    1077     if (dwExStyle & WS_EX_TOOLWINDOW)
    1078     {
    1079       r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
    1080       rect.top += GetSystemMetrics(SM_CYSMCAPTION);
    1081     }
     1054
     1055    if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
     1056                         ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return;
     1057
     1058    SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) );
     1059
     1060    if (HAS_BIGFRAME( dwStyle, dwExStyle))
     1061    {
     1062        DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
     1063    }
     1064    if (HAS_THICKFRAME( dwStyle, dwExStyle ))
     1065        DrawFrame(hdc, &rect, FALSE, active );
    10821066    else
    1083     {
    1084       r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
    1085       rect.top += GetSystemMetrics(SM_CYCAPTION);
    1086     }
    1087     if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
    1088       DrawCaption(hdc,&r,active);
    1089   }
    1090 
    1091   if (HAS_MENU())
    1092   {
    1093     RECT r = rect;
    1094     r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
    1095 
    1096     rect.top += MENU_DrawMenuBar(hdc,&r,Win32Hwnd,suppress_menupaint)+1;
    1097   }
    1098 
    1099   if (dwExStyle & WS_EX_CLIENTEDGE)
    1100     DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
    1101 
    1102   if (dwExStyle & WS_EX_STATICEDGE)
    1103     DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
    1104 
    1105   /* Draw the scroll-bars */
    1106   if (dwStyle & WS_VSCROLL)
    1107     SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE);
    1108   if (dwStyle & WS_HSCROLL)
    1109     SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE);
    1110 
    1111   /* Draw the "size-box" */
    1112   if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
    1113   {
    1114     RECT r = rect;
    1115     r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
    1116     r.top  = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
    1117     FillRect( hdc, &r,  GetSysColorBrush(COLOR_SCROLLBAR) );
    1118     //CB: todo: child windows have sometimes a size grip (i.e. Notepad)
    1119     //    WS_SIZEBOX isn't set in these cases
    1120     if (!(dwStyle & WS_CHILD))
    1121     {
    1122       POINT p1,p2;
    1123       HPEN penDark = GetSysColorPen(COLOR_3DSHADOW);
    1124       HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT);
    1125       HPEN oldPen = SelectObject(hdc,penDark);
    1126       INT x;
    1127 
    1128       p1.x = r.right-1;
    1129       p1.y = r.bottom;
    1130       p2.x = r.right;
    1131       p2.y = r.bottom-1;
    1132       for (x = 0;x < 3;x++)
    1133       {
    1134         SelectObject(hdc,penDark);
    1135         MoveToEx(hdc,p1.x,p1.y,NULL);
    1136         LineTo(hdc,p2.x,p2.y);
    1137         p1.x--;
    1138         p2.y--;
    1139         MoveToEx(hdc,p1.x,p1.y,NULL);
    1140         LineTo(hdc,p2.x,p2.y);
    1141         SelectObject(hdc,penWhite);
    1142         p1.x--;
    1143         p2.y--;
    1144         MoveToEx(hdc,p1.x,p1.y,NULL);
    1145         LineTo(hdc,p2.x,p2.y);
    1146         p1.x -= 2;
    1147         p2.y -= 2;
    1148       }
    1149 
    1150       SelectObject(hdc,oldPen);
    1151     }
    1152   }
    1153 
    1154   ReleaseDC(getWindowHandle(),hdc);
    1155   IncreaseLogCount();
    1156   dprintf(("**DoNCPaint %x DONE", getWindowHandle()));
     1067    if (HAS_DLGFRAME( dwStyle, dwExStyle ))
     1068        DrawFrame( hdc, &rect, TRUE, active );
     1069    else
     1070    if (HAS_THINFRAME( dwStyle ))
     1071    {
     1072        SelectObject( hdc, GetStockObject(NULL_BRUSH) );
     1073        Rectangle( hdc, 0, 0, rect.right, rect.bottom );
     1074    }
     1075
     1076    if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     1077    {
     1078        RECT  r = rect;
     1079        if (dwExStyle & WS_EX_TOOLWINDOW)
     1080        {
     1081            r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION);
     1082            rect.top += GetSystemMetrics(SM_CYSMCAPTION);
     1083        }
     1084        else
     1085        {
     1086            r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION);
     1087            rect.top += GetSystemMetrics(SM_CYCAPTION);
     1088        }
     1089        if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) )
     1090            DrawCaption(hdc,&r,active);
     1091    }
     1092
     1093    if (HAS_MENU())
     1094    {
     1095        RECT r = rect;
     1096        r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
     1097
     1098        rect.top += MENU_DrawMenuBar(hdc,&r,Win32Hwnd,suppress_menupaint)+1;
     1099    }
     1100
     1101    if (dwExStyle & WS_EX_CLIENTEDGE)
     1102        DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
     1103
     1104    if (dwExStyle & WS_EX_STATICEDGE)
     1105        DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
     1106
     1107    /* Draw the scroll-bars */
     1108    if (dwStyle & WS_VSCROLL)
     1109        SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE);
     1110    if (dwStyle & WS_HSCROLL)
     1111        SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE);
     1112
     1113    /* Draw the "size-box" */
     1114    if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL))
     1115    {
     1116        RECT r = rect;
     1117        r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1;
     1118        r.top  = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1;
     1119        FillRect( hdc, &r,  GetSysColorBrush(COLOR_SCROLLBAR) );
     1120        //CB: todo: child windows have sometimes a size grip (i.e. Notepad)
     1121        //    WS_SIZEBOX isn't set in these cases
     1122        if (!(dwStyle & WS_CHILD))
     1123        {
     1124            POINT p1,p2;
     1125            HPEN penDark = GetSysColorPen(COLOR_3DSHADOW);
     1126            HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT);
     1127            HPEN oldPen = SelectObject(hdc,penDark);
     1128            INT x;
     1129
     1130            p1.x = r.right-1;
     1131            p1.y = r.bottom;
     1132            p2.x = r.right;
     1133            p2.y = r.bottom-1;
     1134            for (x = 0;x < 3;x++)
     1135            {
     1136                SelectObject(hdc,penDark);
     1137                MoveToEx(hdc,p1.x,p1.y,NULL);
     1138                LineTo(hdc,p2.x,p2.y);
     1139                p1.x--;
     1140                p2.y--;
     1141                MoveToEx(hdc,p1.x,p1.y,NULL);
     1142                LineTo(hdc,p2.x,p2.y);
     1143                SelectObject(hdc,penWhite);
     1144                p1.x--;
     1145                p2.y--;
     1146                MoveToEx(hdc,p1.x,p1.y,NULL);
     1147                LineTo(hdc,p2.x,p2.y);
     1148                p1.x -= 2;
     1149                p2.y -= 2;
     1150            }
     1151
     1152            SelectObject(hdc,oldPen);
     1153        }
     1154    }
     1155
     1156    ReleaseDC(getWindowHandle(),hdc);
     1157    IncreaseLogCount();
     1158    dprintf(("**DoNCPaint %x DONE", getWindowHandle()));
    11571159}
    11581160//******************************************************************************
  • trunk/src/user32/win32wbasepos.cpp

    r5215 r5236  
    1 /* $Id: win32wbasepos.cpp,v 1.19 2001-02-20 15:40:23 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.20 2001-02-21 20:51:07 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    227227
    228228    if(IsRectEmpty(&windowpos.rcNormalPosition)) {
    229     CopyRect(&windowpos.rcNormalPosition, &rectWindow);
     229        CopyRect(&windowpos.rcNormalPosition, &rectWindow);
    230230    }
    231231    if(!HOOK_CallHooksA(WH_CBT, HCBT_MINMAX, getWindowHandle(), cmd))
    232232    {
    233     if(getStyle() & WS_MINIMIZE )
    234     {
    235         if(!SendInternalMessageA(WM_QUERYOPEN, 0, 0L))
    236         return (SWP_NOSIZE | SWP_NOMOVE);
    237     }
    238     switch( cmd )
    239     {
     233        if(getStyle() & WS_MINIMIZE )
     234        {
     235            if(!SendInternalMessageA(WM_QUERYOPEN, 0, 0L))
     236                return (SWP_NOSIZE | SWP_NOMOVE);
     237        }
     238        switch( cmd )
     239        {
    240240        case SW_MINIMIZE:
    241         if( getStyle() & WS_MAXIMIZE)
    242         {
    243                 setFlags(getFlags() | WIN_RESTORE_MAX);
    244                 setStyle(getStyle() & ~WS_MAXIMIZE);
    245                 }
    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;
     241            if( getStyle() & WS_MAXIMIZE)
     242            {
     243                 setFlags(getFlags() | WIN_RESTORE_MAX);
     244                 setStyle(getStyle() & ~WS_MAXIMIZE);
     245            }
     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;
    253253
    254254        case SW_MAXIMIZE:
    255                 GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL );
    256 
    257         if(getStyle() & WS_MINIMIZE )
    258         {
    259              setStyle(getStyle() & ~WS_MINIMIZE);
    260         }
    261                 setStyle(getStyle() | WS_MAXIMIZE);
    262 
    263         SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y,
    264                 size.x, size.y );
    265         break;
     255            GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL );
     256
     257            if(getStyle() & WS_MINIMIZE )
     258            {
     259                 setStyle(getStyle() & ~WS_MINIMIZE);
     260            }
     261            setStyle(getStyle() | WS_MAXIMIZE);
     262
     263            SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y,
     264                    size.x, size.y );
     265            break;
    266266
    267267        case SW_RESTORE:
    268         if(getStyle() & WS_MINIMIZE)
    269         {
     268            if(getStyle() & WS_MINIMIZE)
     269            {
    270270                setStyle(getStyle() & ~WS_MINIMIZE);
    271271
    272272                if( getFlags() & WIN_RESTORE_MAX)
    273273                {
    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;
     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;
    279279                }
    280         }
    281         else
     280            }
     281            else
    282282            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     }
     283                 return 0;
     284            else setStyle(getStyle() & ~WS_MAXIMIZE);
     285
     286            /* Restore to normal position */
     287            *lpRect = windowpos.rcNormalPosition;
     288            lpRect->right -= lpRect->left;
     289            lpRect->bottom -= lpRect->top;
     290            break;
     291        }
    293292    }
    294293    else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
Note: See TracChangeset for help on using the changeset viewer.