Changeset 2881 for trunk/src


Ignore:
Timestamp:
Feb 24, 2000, 8:19:10 PM (26 years ago)
Author:
sandervl
Message:

WS_MAXIMIZE & WS_MINIMIZE flags updated when necessary & RedrawWindow changes

Location:
trunk/src/user32
Files:
6 edited

Legend:

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

    r2804 r2881  
    1 /* $Id: dc.cpp,v 1.48 2000-02-16 14:34:13 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.49 2000-02-24 19:19:07 sandervl Exp $ */
    22
    33/*
     
    3838#include <winerror.h>
    3939
    40 #define DBG_LOCALLOG    DBG_dc
     40#define DBG_LOCALLOG    DBG_dc
    4141#include "dbglocal.h"
    4242
     
    488488
    489489   pHps->hdcType = TYPE_3;
     490
     491   HideCaret(hwnd);
     492
     493   if(wnd->needsEraseBkgnd()) {
     494        wnd->setEraseBkgnd(FALSE);
     495        lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) != 0);
     496   }
     497   else lpps->fErase = TRUE;
    490498   lpps->hdc = (HDC)hps;
    491 
    492    if(!wnd->isSuppressErase()) {
    493         wnd->setSuppressErase(TRUE);
    494         wnd->setEraseBkgnd (FALSE, !wnd->MsgEraseBackGround(lpps->hdc));
    495    }
    496    lpps->fErase = wnd->isPSErase();
    497499
    498500   if (!hPS_ownDC)
     
    522524   dprintf (("USER32: EndPaint(%x)", hwnd));
    523525
     526   ShowCaret(hwnd);
    524527   if (!pPaint || !pPaint->hdc )
    525528      return TRUE;
     
    534537          WinEndPaint (pHps->hps);
    535538   }
    536    wnd->setSuppressErase(FALSE);
     539   wnd->setEraseBkgnd(TRUE);
    537540
    538541exit:
     
    618621   }
    619622
    620    if(!wnd->isSuppressErase() && lComplexity != RGN_NULL) {
    621         wnd->setSuppressErase(TRUE);
    622         wnd->setEraseBkgnd (FALSE, !wnd->MsgEraseBackGround(pHps->hps));
    623    }
    624    lpps->fErase = wnd->isPSErase(); //correct ??
     623   if(wnd->needsEraseBkgnd() && lComplexity != RGN_NULL) {
     624        wnd->setEraseBkgnd(FALSE);
     625        lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) != 0);
     626   }
     627   else lpps->fErase = TRUE;
     628
    625629   lpps->hdc    = (HDC)pHps->hps;
    626630
     
    683687        dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc));
    684688   }
    685    wnd->setSuppressErase(FALSE);
     689   wnd->setEraseBkgnd(TRUE);
    686690   ShowCaret(hwnd);
    687691
     
    10451049   if (redraw & (RDW_FRAME_W | RDW_NOFRAME_W))
    10461050   {
    1047       O32_SetLastError (ERROR_NOT_SUPPORTED);
    1048       return FALSE;
     1051        O32_SetLastError (ERROR_NOT_SUPPORTED);
     1052        return FALSE;
    10491053   }
    10501054
     
    10561060         return FALSE;
    10571061#else
    1058       hwnd = HWND_DESKTOP;
    1059       wnd  = Win32BaseWindow::GetWindowFromOS2Handle(OSLIB_HWND_DESKTOP);
    1060 
    1061       if (!wnd)
    1062       {
    1063          dprintf(("USER32:dc: RedrawWindow can't find desktop window %08xh\n",
     1062        hwnd = HWND_DESKTOP;
     1063        wnd  = Win32BaseWindow::GetWindowFromOS2Handle(OSLIB_HWND_DESKTOP);
     1064
     1065        if (!wnd)
     1066        {
     1067            dprintf(("USER32:dc: RedrawWindow can't find desktop window %08xh\n",
     1068                      hwnd));
     1069            O32_SetLastError (ERROR_INVALID_PARAMETER);
     1070            return FALSE;
     1071        }
     1072#endif
     1073   }
     1074   else
     1075   {
     1076        wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
     1077
     1078        if (!wnd)
     1079        {
     1080            dprintf(("USER32:dc: RedrawWindow can't find window %08xh\n",
    10641081                  hwnd));
    1065          O32_SetLastError (ERROR_INVALID_PARAMETER);
    1066          return FALSE;
    1067       }
    1068 #endif
    1069    }
    1070    else
    1071    {
    1072       wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    1073 
    1074       if (!wnd)
    1075       {
    1076          dprintf(("USER32:dc: RedrawWindow can't find window %08xh\n",
    1077                   hwnd));
    1078          O32_SetLastError (ERROR_INVALID_PARAMETER);
    1079          return FALSE;
    1080       }
    1081       hwnd = wnd->getOS2WindowHandle();
     1082            O32_SetLastError (ERROR_INVALID_PARAMETER);
     1083            return FALSE;
     1084        }
     1085        hwnd = wnd->getOS2WindowHandle();
    10821086   }
    10831087
     
    10881092   RECTL rectl;
    10891093
    1090    if (redraw & RDW_UPDATENOW_W) redraw &= ~RDW_ERASENOW_W;
    1091 
    1092    //SvL: Should we check if there is already an invalidated window part before
    1093    //     deciding to skip erase?
    1094    if(redraw & RDW_NOERASE_W || ((redraw & (RDW_INVALIDATE_W|RDW_ERASE_W|RDW_ERASENOW_W)) == RDW_INVALIDATE_W)) {
    1095         wnd->setSuppressErase(TRUE);
    1096    }
    1097    else wnd->setSuppressErase(FALSE);
    1098 
    10991094   if (hrgn)
    11001095   {
     
    11361131   if (redraw & RDW_INVALIDATE_W)
    11371132   {
    1138       if (redraw & RDW_ERASE_W)
    1139          wnd->setEraseBkgnd (TRUE, TRUE);
    1140 
    1141       if (!pRect && !hrgn)
    1142          success = WinInvalidateRect (hwnd, NULL, IncludeChildren);
    1143       else if (hrgn)
    1144          success = WinInvalidateRegion (hwnd, hrgnTemp, IncludeChildren);
    1145       else
    1146          success = WinInvalidateRect (hwnd, &rectl, IncludeChildren);
    1147       if (!success) goto error;
     1133        //TODO: SvL: pingpong.exe doesn't have RDW_NOERASE, but doesn't want WM_ERASEBKGND msgs
     1134        if (redraw & RDW_ERASE_W)
     1135            wnd->setEraseBkgnd (TRUE);
     1136
     1137        if (!pRect && !hrgn)
     1138            success = WinInvalidateRect (hwnd, NULL, IncludeChildren);
     1139        else
     1140        if (hrgn)
     1141            success = WinInvalidateRegion (hwnd, hrgnTemp, IncludeChildren);
     1142        else
     1143            success = WinInvalidateRect (hwnd, &rectl, IncludeChildren);
     1144
     1145        if (!success) goto error;
    11481146   }
    11491147   else if (redraw & RDW_VALIDATE_W)
    11501148   {
    1151       if (WinQueryUpdateRect (hwnd, NULL))
    1152       {
    1153          if (!pRect && !hrgn)
    1154             success = WinValidateRect (hwnd, NULL, IncludeChildren);
    1155          else if (hrgn)
    1156             success = WinValidateRegion (hwnd, hrgnTemp, IncludeChildren);
    1157          else
    1158             success = WinValidateRect (hwnd, &rectl, IncludeChildren);
    1159          if (!success) goto error;
    1160       }
     1149        if (redraw & RDW_NOERASE_W)
     1150            wnd->setEraseBkgnd(FALSE);
     1151
     1152        if (WinQueryUpdateRect (hwnd, NULL))
     1153        {
     1154            if (!pRect && !hrgn)
     1155                success = WinValidateRect (hwnd, NULL, IncludeChildren);
     1156            else
     1157            if (hrgn)
     1158                success = WinValidateRegion (hwnd, hrgnTemp, IncludeChildren);
     1159            else
     1160                success = WinValidateRect (hwnd, &rectl, IncludeChildren);
     1161            if (!success) goto error;
     1162        }
    11611163   }
    11621164
    11631165   if(WinQueryUpdateRect(hwnd, NULL))
    11641166   {
     1167        //TODO: Does this work if RDW_ALLCHILDREN is set??
    11651168        if(redraw & RDW_UPDATENOW_W) {
    11661169                wnd->MsgPaint (0, FALSE);
    11671170        }
    11681171        else
    1169         if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W))
    1170                 wnd->setEraseBkgnd (FALSE, !sendEraseBkgnd (wnd));
     1172//        if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W))
     1173        if(redraw & RDW_ERASENOW_W && wnd->needsEraseBkgnd())
     1174                wnd->setEraseBkgnd(sendEraseBkgnd(wnd) == 0);
    11711175   }
    11721176   else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W))
     
    11851189      WinReleasePS (hpsTemp);
    11861190
    1187 //SvL: Test
    1188 //   if ((redraw & RDW_INVALIDATE_W) == 0)
    1189 //      wnd->setSuppressErase (FALSE);
    1190 //   else if ((redraw & RDW_ERASENOW_W) == RDW_ERASENOW_W)
    1191 //      wnd->setSuppressErase (TRUE);
    1192 
    11931191   if (!success)
    11941192      O32_SetLastError (ERROR_INVALID_PARAMETER);
     
    12081206
    12091207   dprintf (("User32: UpdateWindow hwnd %x", hwnd));
    1210 ////SvL: This doesn't work right (it's what Wine does) -> TODO
    1211 ////   return RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW_W | RDW_NOCHILDREN_W);
     1208////SvL: This doesn't work right (Wine uses RDW_NOCHILDREN_W -> doesn't work here)
     1209////     Breaks vpbuddy
     1210////   return RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW_W | RDW_ALLCHILDREN_W);
    12121211   WinUpdateWindow(wnd->getOS2WindowHandle());
    12131212   return TRUE;
  • trunk/src/user32/oslibmsgtranslate.cpp

    r2804 r2881  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.17 2000-02-16 14:34:27 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.18 2000-02-24 19:19:08 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    326326        if (!win32wnd->CanReceiveSizeMsgs())    goto dummymessage;
    327327
     328        ULONG windowStyle = WinQueryWindowULong(os2Msg->hwnd, QWL_STYLE);
     329        win32wnd->setStyle(win32wnd->getStyle() & ~(WS_MAXIMIZE_W|WS_MINIMIZE_W));
     330        if (windowStyle & WS_MINIMIZED) {
     331                win32wnd->setStyle(win32wnd->getStyle() | WS_MINIMIZE_W);
     332        }
     333        else
     334        if (windowStyle & WS_MAXIMIZED) {
     335                win32wnd->setStyle(win32wnd->getStyle() | WS_MAXIMIZE_W);
     336        }
     337
    328338        if(pswp->fl & (SWP_MOVE | SWP_SIZE)) {
    329339                dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy));
     
    667677    case WM_PAINT:
    668678    {
    669         if(win32wnd->IsIconic()) {
     679        if(win32wnd->IsWindowIconic()) {
    670680                winMsg->message = WINWM_PAINTICON;
    671681        }
  • trunk/src/user32/win32dlg.cpp

    r2857 r2881  
    1 /* $Id: win32dlg.cpp,v 1.45 2000-02-22 17:07:41 cbratschi Exp $ */
     1/* $Id: win32dlg.cpp,v 1.46 2000-02-24 19:19:08 sandervl Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    238238        {
    239239            ShowWindow( SW_SHOWNORMAL );    /* SW_SHOW doesn't always work */
    240             ::UpdateWindow( getWindowHandle() );
     240            UpdateWindow( getWindowHandle() );
    241241        }
    242242        SetLastError(0);
     
    972972BOOL Win32Dialog::restoreFocus()
    973973{
    974     if (!hwndFocus || IsIconic()) return FALSE;
     974    if (!hwndFocus || IsWindowIconic()) return FALSE;
    975975
    976976    if (!::IsWindow( hwndFocus )) return FALSE;
  • trunk/src/user32/win32wbase.cpp

    r2873 r2881  
    1 /* $Id: win32wbase.cpp,v 1.168 2000-02-23 17:05:17 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.169 2000-02-24 19:19:08 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    131131  hwndLinkAfter    = HWND_BOTTOM;
    132132  flags            = 0;
    133   isIcon           = FALSE;
    134133  lastHitTestVal   = HTOS_NORMAL;
    135134  owner            = NULL;
     
    140139
    141140  EraseBkgndFlag     = TRUE;
    142   PSEraseFlag        = FALSE;
    143   SuppressEraseFlag  = FALSE;
    144141
    145142  horzScrollInfo     = NULL;
     
    981978ULONG Win32BaseWindow::MsgPaint(ULONG tmp1, BOOL select)
    982979{
    983     if (select && isIcon)
    984         return SendInternalMessageA(WM_PAINTICON, 0, 0);
     980    if (select && IsWindowIconic())
     981        return SendInternalMessageA(WM_PAINTICON, 1, 0);
    985982    else
    986983        return SendInternalMessageA(WM_PAINT, 0, 0);
     
    998995        hdcErase = O32_GetDC(OS2Hwnd);
    999996
    1000     if(isIcon)
     997    if(IsWindowIconic())
    1001998        rc = SendInternalMessageA(WM_ICONERASEBKGND, hdcErase, 0);
    1002999    else
     
    11461143
    11471144    return FALSE;
     1145}
     1146//******************************************************************************
     1147//******************************************************************************
     1148BOOL Win32BaseWindow::IsWindowIconic()
     1149{
     1150    return ((getStyle() & WS_MINIMIZE) && windowClass->getIcon());
    11481151}
    11491152//******************************************************************************
     
    23092312}
    23102313//******************************************************************************
    2311 //Don't call WinUpdateWindow as that one also updates the child windows
    2312 //Also need to send WM_PAINT directly to the window procedure, which doesn't
    2313 //always happen with WinUpdateWindow (could be posted if thread doesn't own window)
    2314 //******************************************************************************
    2315 BOOL Win32BaseWindow::UpdateWindow()
    2316 {
    2317  RECT rect;
    2318 
    2319     if(OSLibWinQueryUpdateRect(OS2Hwnd, &rect))
    2320     {//update region not empty
    2321         HDC hdc;
    2322 
    2323         hdc = O32_GetDC(OS2Hwnd);
    2324         if (isIcon)
    2325         {
    2326             SendInternalMessageA(WM_ICONERASEBKGND, (WPARAM)hdc, 0);
    2327             SendInternalMessageA(WM_PAINTICON, 0, 0);
    2328         }
    2329         else
    2330         {
    2331             SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);
    2332             SendInternalMessageA(WM_PAINT, 0, 0);
    2333         }
    2334         O32_ReleaseDC(OS2Hwnd, hdc);
    2335     }
    2336     return TRUE;
    2337 }
    2338 //******************************************************************************
    2339 //******************************************************************************
    2340 BOOL Win32BaseWindow::IsIconic()
    2341 {
    2342     return OSLibWinIsIconic(OS2Hwnd);
    2343 }
    2344 //******************************************************************************
    23452314//TODO: Should not enumerate children that are created during the enumeration!
    23462315//******************************************************************************
     
    27732742        {
    27742743           STYLESTRUCT ss;
     2744
     2745                //SvL: TODO: Can you change minimize or maximize status here too?
    27752746
    27762747                if(dwStyle == value)
  • trunk/src/user32/win32wbase.h

    r2857 r2881  
    1 /* $Id: win32wbase.h,v 1.85 2000-02-22 17:07:43 cbratschi Exp $ */
     1/* $Id: win32wbase.h,v 1.86 2000-02-24 19:19:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    212212
    213213         BOOL   IsChild(HWND hwndParent);
     214
    214215         HWND   GetTopWindow();
    215216Win32BaseWindow *GetTopParent();
    216          BOOL   UpdateWindow();
    217          BOOL   IsIconic();
     217
    218218         HWND   GetWindow(UINT uCmd);
    219219 virtual BOOL   EnableWindow(BOOL fEnable);
     
    233233         BOOL   IsWindowEnabled();
    234234         BOOL   IsWindowVisible();
    235          //Created with CreateWindowExA or ExW
    236 //         BOOL   IsUnicode()                   { return isUnicode; };
     235         BOOL   IsWindowIconic();
    237236         //Window procedure type
    238237         BOOL   IsWindowUnicode();
     
    330329        LONG    lastHitTestVal;         //Last value returned by WM_NCHITTEST handler
    331330
    332         BOOL    isIcon;
    333331        BOOL    fFirstShow;
    334332        BOOL    fIsDialog;
     
    441439
    442440         ULONG  EraseBkgndFlag:1,
    443                 PSEraseFlag:1,
    444                 SuppressEraseFlag:1,
    445                 filler:29;
     441                filler:31;
    446442public:
    447          VOID   setEraseBkgnd (BOOL erase, BOOL PSErase = FALSE)
    448                     { EraseBkgndFlag = erase; PSEraseFlag = PSErase; }
    449          VOID   setSuppressErase (BOOL erase = FALSE)
    450                     { SuppressEraseFlag = erase; }
    451          BOOL   isEraseBkgnd()   { return EraseBkgndFlag; }
    452          BOOL   isPSErase()      { return EraseBkgndFlag | PSEraseFlag; }
    453          BOOL   isSuppressErase() { return SuppressEraseFlag; }
     443         VOID   setEraseBkgnd (BOOL erase)      { EraseBkgndFlag = erase; }
     444         BOOL   needsEraseBkgnd()               { return EraseBkgndFlag; }
    454445};
    455446
  • trunk/src/user32/window.cpp

    r2852 r2881  
    1 /* $Id: window.cpp,v 1.56 2000-02-21 17:25:33 cbratschi Exp $ */
     1/* $Id: window.cpp,v 1.57 2000-02-24 19:19:10 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    405405        return FALSE;
    406406    }
    407     rc = window->IsIconic();
     407    rc = window->IsWindowIconic();
    408408    dprintf(("IsIconic %x returned %d", hwnd, rc));
    409409    return rc;
Note: See TracChangeset for help on using the changeset viewer.