Changeset 1336 for trunk/src


Ignore:
Timestamp:
Oct 17, 1999, 5:46:10 PM (26 years ago)
Author:
sandervl
Message:

Dialog fixes + ported Wine apis

Location:
trunk/src/user32
Files:
8 edited

Legend:

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

    r1333 r1336  
    1 /* $Id: dc.cpp,v 1.14 1999-10-17 12:17:42 cbratschi Exp $ */
     1/* $Id: dc.cpp,v 1.15 1999-10-17 15:46:07 sandervl Exp $ */
    22
    33/*
     
    10061006   Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    10071007
    1008 dprintf (("User32: UpdateWindow hwnd %x -> wnd %x", hwnd, wnd));
     1008   dprintf (("User32: UpdateWindow hwnd %x -> wnd %x", hwnd, wnd));
    10091009
    10101010   if (WinQueryUpdateRect (wnd->getOS2WindowHandle(), NULL))
  • trunk/src/user32/pmwindow.cpp

    r1333 r1336  
    1 /* $Id: pmwindow.cpp,v 1.33 1999-10-17 12:17:44 cbratschi Exp $ */
     1/* $Id: pmwindow.cpp,v 1.34 1999-10-17 15:46:08 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    325325        }
    326326        point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
     327
    327328        win32wnd->setWindowRect(point.x, point.y, point.x+swpFrame.cx, point.y+swpFrame.cy);
    328329        win32wnd->setClientRect(pswpo->x, pswpo->y, pswpo->x + pswpo->cx, pswpo->y + pswpo->cy);
  • trunk/src/user32/user32.cpp

    r1299 r1336  
    1 /* $Id: user32.cpp,v 1.42 1999-10-14 19:31:31 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.43 1999-10-17 15:46:08 sandervl Exp $ */
    22
    33/*
     
    13731373SHORT WIN32API GetKeyState( int nVirtKey)
    13741374{
    1375 #ifdef DEBUG
    1376     WriteLog("USER32:  GetKeyState %d\n", nVirtKey);
     1375//SvL: Hehe. 32 MB logfile for Opera after a minute.
     1376#ifdef DEBUG
     1377//    WriteLog("USER32:  GetKeyState %d\n", nVirtKey);
    13771378#endif
    13781379    return O32_GetKeyState(nVirtKey);
     
    18701871//******************************************************************************
    18711872//******************************************************************************
    1872 BOOL WIN32API EndDeferWindowPos( HDWP hWinPosInfo)
    1873 {
    1874 #ifdef DEBUG
    1875     WriteLog("USER32:  EndDeferWindowPos\n");
    1876 #endif
    1877     return O32_EndDeferWindowPos(hWinPosInfo);
    1878 }
    1879 //******************************************************************************
    1880 //******************************************************************************
    1881 HWND WIN32API FindWindowW( LPCWSTR lpClassName, LPCWSTR lpWindowName)
    1882 {
    1883  char *astring1 = UnicodeToAsciiString((LPWSTR)lpClassName);
    1884  char *astring2 = UnicodeToAsciiString((LPWSTR)lpWindowName);
    1885  HWND rc;
    1886 
    1887 #ifdef DEBUG
    1888     WriteLog("USER32:  FindWindowW\n");
    1889 #endif
    1890     rc = O32_FindWindow(astring1, astring2);
    1891     FreeAsciiString(astring1);
    1892     FreeAsciiString(astring2);
    1893     return rc;
    1894 }
    1895 //******************************************************************************
    1896 //******************************************************************************
    18971873HWND WIN32API GetForegroundWindow(void)
    18981874{
     
    19381914//******************************************************************************
    19391915//******************************************************************************
    1940 #if 0
    1941 int WIN32API GetUpdateRgn( HWND hWnd, HRGN hRgn, BOOL bErase)
    1942 {
    1943 #ifdef DEBUG
    1944     WriteLog("USER32:  GetUpdateRgn\n");
    1945 #endif
    1946     hWnd = Win32Window::Win32ToOS2Handle(hWnd);
    1947 
    1948     return O32_GetUpdateRgn(hWnd,hRgn,bErase);
    1949 }
    1950 #endif
    19511916/*****************************************************************************
    19521917 * Name      : int WIN32API GetWindowRgn
     
    22882253BOOL WIN32API ScreenToClient (HWND hwnd, LPPOINT pt)
    22892254{
    2290 #ifdef DEBUG
    2291     WriteLog("USER32:  ScreenToClient\n");
    2292 #endif
    22932255    Win32BaseWindow *wnd;
    22942256    PRECT rcl;
     2257
     2258    dprintf(("ScreenToClient %x (%d,%d)\n", hwnd, pt->x, pt->y));
    22952259
    22962260    if (!hwnd) return (TRUE);
     
    23022266    OSLibWinMapWindowPoints (OSLIB_HWND_DESKTOP, wnd->getOS2WindowHandle(), (OSLIBPOINT *)pt, 1);
    23032267    pt->y = (rcl->bottom - rcl->top) - pt->y;
     2268    dprintf(("ScreenToClient %x returned (%d,%d)\n", hwnd, pt->x, pt->y));
    23042269    return (TRUE);
    23052270}
    23062271
    2307 /* Scroll Bar Functions */
    2308 
    2309 #if 0
    2310 BOOL WIN32API ScrollDC( HDC arg1, int arg2, int arg3, const RECT * arg4, const RECT * arg5, HRGN arg6, PRECT  arg7)
    2311 {
    2312 #ifdef DEBUG
    2313     WriteLog("USER32:  ScrollDC\n");
    2314 #endif
    2315     return O32_ScrollDC(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
    2316 }
    2317 #endif
    2318 
    23192272/* Icon Functions */
    2320 
    23212273int WIN32API LookupIconIdFromDirectory(PBYTE presbits, BOOL fIcon)
    23222274{
  • trunk/src/user32/win32dlg.cpp

    r1333 r1336  
    1 /* $Id: win32dlg.cpp,v 1.16 1999-10-17 12:17:44 cbratschi Exp $ */
     1/* $Id: win32dlg.cpp,v 1.17 1999-10-17 15:46:09 sandervl Exp $ */
    22/*
    33 * Win32 Dialog Code for OS/2
     
    605605
    606606        dprintf(("Create CONTROL %d", info.id));
    607         hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
    608                                     (LPCWSTR)info.className,
    609                                     (LPCWSTR)info.windowName,
    610                                     info.style | WS_CHILD,
    611                                     info.x * xUnit / 4,
    612                                     info.y * yUnit / 8,
    613                                     info.cx * xUnit / 4,
    614                                     info.cy * yUnit / 8,
    615                                     getWindowHandle(), (HMENU)info.id,
    616                                     hInst, info.data );
     607        if(isUnicode) {
     608            hwndCtrl = ::CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
     609                                        (LPCWSTR)info.className,
     610                                        (LPCWSTR)info.windowName,
     611                                        info.style | WS_CHILD,
     612                                        info.x * xUnit / 4,
     613                                        info.y * yUnit / 8,
     614                                        info.cx * xUnit / 4,
     615                                        info.cy * yUnit / 8,
     616                                        getWindowHandle(), (HMENU)info.id,
     617                                        hInst, info.data );
     618        }
     619        else {
     620            char *classNameA = NULL;
     621            char *windowNameA = NULL;
     622
     623            if(HIWORD(info.className)) {
     624                 classNameA = UnicodeToAsciiString((LPWSTR)info.className);
     625            }
     626            else classNameA = (char *)info.className;
     627
     628            if(HIWORD(info.windowName)) {
     629                 windowNameA = UnicodeToAsciiString((LPWSTR)info.windowName);
     630            }
     631            hwndCtrl = ::CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY,
     632                                        classNameA,
     633                                        windowNameA,
     634                                        info.style | WS_CHILD,
     635                                        info.x * xUnit / 4,
     636                                        info.y * yUnit / 8,
     637                                        info.cx * xUnit / 4,
     638                                        info.cy * yUnit / 8,
     639                                        getWindowHandle(), (HMENU)info.id,
     640                                        hInst, info.data );
     641            if(HIWORD(classNameA)) {
     642                FreeAsciiString(classNameA);
     643            }
     644            if(windowNameA) {
     645                FreeAsciiString(windowNameA);
     646            }
     647        }
    617648
    618649        if (!hwndCtrl) return FALSE;
  • trunk/src/user32/win32wbase.cpp

    r1333 r1336  
    1 /* $Id: win32wbase.cpp,v 1.48 1999-10-17 12:17:45 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.49 1999-10-17 15:46:09 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    12381238    return NULL;
    12391239}
    1240 //******************************************************************************
    1241 //TODO: Not complete
    1242 //******************************************************************************
    1243 LONG Win32BaseWindow::setScrollInfo(int nBar, SCROLLINFO *info, int fRedraw)
    1244 {
    1245   SCROLLBAR_INFO *infoPtr;
    1246   HWND            hwndScroll;
    1247   ULONG           scrollType;
    1248   int             new_flags;
    1249 
    1250 //CB: handled internally
    1251 return 0;
    1252 
    1253     switch(nBar) {
    1254     case SB_HORZ:
    1255         if(!horzScrollInfo) {
    1256             return 0;
    1257         }
    1258         infoPtr = horzScrollInfo;
    1259         hwndScroll = hwndHorzScroll;
    1260         scrollType = OSLIB_HSCROLL;
    1261         break;
    1262     case SB_VERT:
    1263         if(!vertScrollInfo) {
    1264             return 0;
    1265         }
    1266         infoPtr = vertScrollInfo;
    1267         hwndScroll = hwndVertScroll;
    1268         scrollType = OSLIB_VSCROLL;
    1269         break;
    1270     default:
    1271         return 0;
    1272     }
    1273 
    1274     if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return 0;
    1275     if ((info->cbSize != sizeof(*info)) &&
    1276         (info->cbSize != sizeof(*info)-sizeof(info->nTrackPos))) return 0;
    1277 
    1278     /* Set the page size */
    1279     if (info->fMask & SIF_PAGE)
    1280     {
    1281         if( infoPtr->Page != info->nPage )
    1282         {
    1283             infoPtr->Page = info->nPage;
    1284             dprintf(("SetScrollInfo: Set pagesize to %d", info->nPage));
    1285             OSLibWinSetScrollPageSize(OS2HwndFrame, hwndScroll, info->nPage, infoPtr->MaxVal, fRedraw);
    1286         }
    1287     }
    1288 
    1289     /* Set the scroll pos */
    1290     if (info->fMask & SIF_POS)
    1291     {
    1292         if( infoPtr->CurVal != info->nPos )
    1293         {
    1294             infoPtr->CurVal = info->nPos;
    1295             dprintf(("SetScrollInfo: Set scroll position to %d", info->nPos));
    1296             OSLibWinSetScrollPos(OS2HwndFrame, hwndScroll, info->nPos, fRedraw);
    1297         }
    1298     }
    1299 
    1300     /* Set the scroll range */
    1301     if (info->fMask & SIF_RANGE)
    1302     {
    1303         /* Invalid range -> range is set to (0,0) */
    1304         if ((info->nMin > info->nMax) ||
    1305             ((UINT)(info->nMax - info->nMin) >= 0x80000000))
    1306         {
    1307             infoPtr->MinVal = 0;
    1308             infoPtr->MaxVal = 0;
    1309         }
    1310         else
    1311         {
    1312             if( infoPtr->MinVal != info->nMin ||
    1313                 infoPtr->MaxVal != info->nMax )
    1314             {
    1315                 infoPtr->MinVal = info->nMin;
    1316                 infoPtr->MaxVal = info->nMax;
    1317 
    1318                 dprintf(("SetScrollInfo: Set scroll range to (%d,%d)", info->nMin, info->nMax));
    1319                 OSLibWinSetScrollRange(OS2HwndFrame, hwndScroll, info->nMin, info->nMax, fRedraw);
    1320             }
    1321         }
    1322     }
    1323 
    1324     /* Make sure the page size is valid */
    1325     if (infoPtr->Page < 0) infoPtr->Page = 0;
    1326     else if (infoPtr->Page > infoPtr->MaxVal - infoPtr->MinVal + 1 )
    1327         infoPtr->Page = infoPtr->MaxVal - infoPtr->MinVal + 1;
    1328 
    1329     /* Make sure the pos is inside the range */
    1330     if (infoPtr->CurVal < infoPtr->MinVal)
    1331         infoPtr->CurVal = infoPtr->MinVal;
    1332     else if (infoPtr->CurVal > infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
    1333         infoPtr->CurVal = infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 );
    1334 
    1335     /* Check if the scrollbar should be hidden or disabled */
    1336     if (info->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))
    1337     {
    1338         new_flags = infoPtr->flags;
    1339         if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
    1340         {
    1341             /* Hide or disable scroll-bar */
    1342             if (info->fMask & SIF_DISABLENOSCROLL)
    1343             {
    1344                 new_flags = ESB_DISABLE_BOTH;
    1345 //               *action |= SA_SSI_REFRESH;
    1346             }
    1347             else if (nBar != SB_CTL)
    1348             {
    1349 //                *action = SA_SSI_HIDE;
    1350                 goto done;
    1351             }
    1352         }
    1353         else  /* Show and enable scroll-bar */
    1354         {
    1355             new_flags = 0;
    1356 //            if (nBar != SB_CTL)
    1357 //                *action |= SA_SSI_SHOW;
    1358         }
    1359 
    1360         if (infoPtr->flags != new_flags) /* check arrow flags */
    1361         {
    1362             infoPtr->flags = new_flags;
    1363         }
    1364     }
    1365 
    1366 done:
    1367     /* Return current position */
    1368 
    1369     return infoPtr->CurVal;
    1370 }
    13711240/***********************************************************************/
    13721241/***********************************************************************/
     
    20111880
    20121881    dprintf(("ShowWindow %x %x", getWindowHandle(), nCmdShow));
     1882#if 1
     1883    if (flags & WIN_NEED_SIZE)
     1884    {
     1885        /* should happen only in CreateWindowEx() */
     1886        int wParam = SIZE_RESTORED;
     1887
     1888            flags &= ~WIN_NEED_SIZE;
     1889            if (dwStyle & WS_MAXIMIZE)
     1890                wParam = SIZE_MAXIMIZED;
     1891            else
     1892            if (dwStyle & WS_MINIMIZE)
     1893                wParam = SIZE_MINIMIZED;
     1894       
     1895        SendMessageA(WM_SIZE, wParam,
     1896                     MAKELONG(rectClient.right-rectClient.left,
     1897                              rectClient.bottom-rectClient.top));
     1898        SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) );
     1899    }
     1900#else
    20131901    if(fFirstShow) {
    20141902        if(isFrameWindow() && IS_OVERLAPPED(getStyle()) && !isChild()) {
     
    20211909        fFirstShow = FALSE;
    20221910    }
     1911#endif
    20231912    switch(nCmdShow)
    20241913    {
     
    23442233}
    23452234//******************************************************************************
    2346 //TODO: not complete nor correct (distinction be    tween top-level, top-most & child windows)
    23472235//******************************************************************************
    23482236HWND Win32BaseWindow::GetWindow(UINT uCmd)
    23492237{
    2350  Win32BaseWindow  *win32wnd;
    2351  ULONG         magic;
    2352  ULONG         getcmd = 0;
    2353  HWND          hwndRelated, hwnd;
    2354 
    2355     dprintf(("GetWindow %x %d NOT COMPLETE", getWindowHandle(), uCmd));
    2356     hwnd = OS2Hwnd;
     2238 HWND hwndRelated = 0;
     2239 Win32BaseWindow *window;
     2240
    23572241    switch(uCmd)
    23582242    {
    2359         case GW_CHILD:
    2360             getcmd = QWOS_TOP;
    2361             break;
    2362         case GW_HWNDFIRST:
    2363             if(getParent()) {
    2364                     hwnd = getParent()->getOS2WindowHandle();
    2365                     getcmd = QWOS_TOP; //top of child windows
     2243    case GW_HWNDFIRST:
     2244        if(getParent()) {
     2245            window = (Win32BaseWindow *)getParent()->getFirstChild();
     2246            hwndRelated = window->getWindowHandle();
     2247        }
     2248        break;
     2249       
     2250    case GW_HWNDLAST:
     2251        if(getParent())
     2252        {
     2253            goto end;
     2254        }
     2255
     2256        window = this;
     2257        while(window)
     2258        {
     2259            window = (Win32BaseWindow *)window->getNextChild();
     2260        }
     2261        hwndRelated = window->getWindowHandle();
     2262        break;
     2263       
     2264    case GW_HWNDNEXT:
     2265        window = (Win32BaseWindow *)getNextChild();
     2266        if(window) {
     2267            hwndRelated = window->getWindowHandle();
     2268        }
     2269        break;
     2270       
     2271    case GW_HWNDPREV:
     2272        if(!getParent())
     2273        {
     2274            goto end;
     2275        }
     2276        window = (Win32BaseWindow *)(getParent()->getFirstChild()); /* First sibling */
     2277        if(window == this)
     2278        {
     2279            hwndRelated = 0;  /* First in list */
     2280            goto end;
     2281        }
     2282        while(window->getNextChild())
     2283        {
     2284            if (window->getNextChild() == this)
     2285            {
     2286                hwndRelated = window->getWindowHandle();
     2287                goto end;
    23662288            }
    2367             else    getcmd = QWOS_TOP; //TODO
    2368             break;
    2369         case GW_HWNDLAST:
    2370             if(getParent()) {
    2371                     hwnd = getParent()->getOS2WindowHandle();
    2372                     getcmd = QWOS_BOTTOM; //bottom of child windows
    2373             }
    2374             else    getcmd = QWOS_BOTTOM; //TODO
    2375             break;
    2376         case GW_HWNDNEXT:
    2377             getcmd = QWOS_NEXT;
    2378             break;
    2379         case GW_HWNDPREV:
    2380             getcmd = QWOS_PREV;
    2381             break;
    2382         case GW_OWNER:
    2383             if(owner) {
    2384                     return owner->getWindowHandle();
    2385             }
    2386             else    return 0;
    2387     }
    2388     hwndRelated = OSLibWinQueryWindow(hwnd, getcmd);
    2389     if(hwndRelated)
    2390     {
    2391         win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
    2392         magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
    2393         if(CheckMagicDword(magic) && win32wnd)
    2394         {
    2395             return win32wnd->getWindowHandle();
    2396         }
    2397 
    2398     hwndRelated = OSLibWinWindowFromID(hwndRelated, OSLIB_FID_CLIENT);
    2399         win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32WNDPTR);
    2400         magic    = OSLibWinGetWindowULong(hwndRelated, OFFSET_WIN32PM_MAGIC);
    2401         if(CheckMagicDword(magic) && win32wnd)
    2402         {
    2403             return win32wnd->getWindowHandle();
    2404         }
    2405     }
    2406     return 0;
     2289            window = (Win32BaseWindow *)window->getNextChild();
     2290        }
     2291        break;
     2292               
     2293    case GW_OWNER:
     2294        if(getOwner()) {
     2295            hwndRelated = getOwner()->getWindowHandle();
     2296        }
     2297        break;
     2298
     2299    case GW_CHILD:
     2300        if(getFirstChild()) {
     2301            hwndRelated = ((Win32BaseWindow *)getFirstChild())->getWindowHandle();
     2302        }
     2303        break;
     2304    }
     2305end:
     2306    dprintf(("GetWindow %x %d returned %x", getWindowHandle(), uCmd, hwndRelated));
     2307    return hwndRelated;
    24072308}
    24082309//******************************************************************************
     
    25452446                ss.styleOld = dwExStyle;
    25462447                ss.styleNew = value;
     2448        dprintf(("SetWindowLong GWL_EXSTYLE %x new style %x", getWindowHandle(), value));
    25472449                SendMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
    25482450                setExStyle(ss.styleNew);
     
    25562458                ss.styleOld = dwStyle;
    25572459                ss.styleNew = value;
     2460        dprintf(("SetWindowLong GWL_STYLE %x new style %x", getWindowHandle(), value));
    25582461                SendMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
    25592462                setStyle(ss.styleNew);
  • trunk/src/user32/win32wbase.h

    r1333 r1336  
    1 /* $Id: win32wbase.h,v 1.26 1999-10-17 12:17:45 cbratschi Exp $ */
     1/* $Id: win32wbase.h,v 1.27 1999-10-17 15:46:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    182182Win32BaseWindow *getTopParent();
    183183 SCROLLBAR_INFO *getScrollInfo(int nBar);
    184        LONG      setScrollInfo(int nBar, SCROLLINFO *info, int fRedraw);
    185184       HWND      getVertScrollHandle()        { return hwndVertScroll; };
    186185       HWND      getHorzScrollHandle()        { return hwndHorzScroll; };
     
    213212       ULONG getBorderWidth() { return borderWidth; };
    214213       ULONG getBorderHeight() { return borderHeight; };
     214
     215static  void  NC_AdjustRectInner(LPRECT rect, DWORD style, DWORD exStyle);
     216static  void  NC_AdjustRectOuter(LPRECT rect, DWORD style, BOOL menu, DWORD exStyle);
     217static  BOOL  WindowNeedsWMBorder( DWORD style, DWORD exStyle );
    215218
    216219       PVOID getOldWndProc() { return pOldWndProc; }
  • trunk/src/user32/win32wbasepos.cpp

    r1322 r1336  
    1 /* $Id: win32wbasepos.cpp,v 1.2 1999-10-16 14:51:43 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.3 1999-10-17 15:46:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    1111 *
    1212 * TODO: Not thread/process safe
     13 *
     14 * Wine code based on build 990815
    1315 *
    1416 * Project Odin Software License can be found in LICENSE.TXT
     
    4143#include "win32wdesktop.h"
    4244
     45  /* Some useful macros */
    4346#define HAS_DLGFRAME(style,exStyle) \
    4447    (((exStyle) & WS_EX_DLGMODALFRAME) || \
    45      (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
    46 
    47 #define HAS_THICKFRAME(style) \
     48     (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
     49
     50#define HAS_THICKFRAME(style,exStyle) \
    4851    (((style) & WS_THICKFRAME) && \
    49      !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
     52     !((exStyle) & WS_EX_DLGMODALFRAME))
     53
     54#define HAS_THINFRAME(style) \
     55    (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP)))
     56
     57#define HAS_BIGFRAME(style,exStyle) \
     58    (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
     59     ((exStyle) & WS_EX_DLGMODALFRAME))
     60
     61#define HAS_ANYFRAME(style,exStyle) \
     62    (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \
     63     ((exStyle) & WS_EX_DLGMODALFRAME) || \
     64     !((style) & (WS_CHILD | WS_POPUP)))
    5065
    5166#define HAS_3DFRAME(exStyle) \
     
    194209    {
    195210        xinc = yinc = 0;
    196         if (HAS_THICKFRAME(dwStyle))
     211        if (HAS_THICKFRAME(dwStyle, dwExStyle))
    197212        {
    198213            xinc += GetSystemMetrics(SM_CXFRAME);
     
    284299            dprintf(("NCHandleCalcSize Adjusted client rect (%d,%d) (%d,%d)", ncsize->rgrc[0].left, ncsize->rgrc[0].top, ncsize->rgrc[0].right, ncsize->rgrc[0].bottom));
    285300
    286 #if 0
    287             //relative to frame -> relative to itself
    288             ncsize->rgrc[0].right  -= ncsize->rgrc[0].left;
    289             ncsize->rgrc[0].left    = 0;
    290             ncsize->rgrc[0].bottom -= ncsize->rgrc[0].top;
    291             ncsize->rgrc[0].top     = 0;
    292 #endif
     301            OffsetRect(&ncsize->rgrc[0], -ncsize->rgrc[0].left, -ncsize->rgrc[0].top);
    293302        }
    294303#if 0
     
    299308        return result;
    300309}
     310/***********************************************************************
     311 *           WIN_WindowNeedsWMBorder
     312 *
     313 * This method defines the rules for a window to have a WM border,
     314 * caption...  It is used for consitency purposes.
     315 */
     316BOOL Win32BaseWindow::WindowNeedsWMBorder( DWORD style, DWORD exStyle )
     317{
     318//    if (!(style & WS_CHILD) && Options.managed  &&
     319    if (!(style & WS_CHILD)  &&
     320        (((style & WS_CAPTION) == WS_CAPTION) ||
     321         (style & WS_THICKFRAME)))
     322        return TRUE;
     323    return FALSE;
     324}
     325/******************************************************************************
     326 * NC_AdjustRectOuter95
     327 *
     328 * Computes the size of the "outside" parts of the window based on the
     329 * parameters of the client area.
     330 *
     331 + PARAMS
     332 *     LPRECT16  rect
     333 *     DWORD  style
     334 *     BOOL32  menu
     335 *     DWORD  exStyle
     336 *
     337 * NOTES
     338 *     "Outer" parts of a window means the whole window frame, caption and
     339 *     menu bar. It does not include "inner" parts of the frame like client
     340 *     edge, static edge or scroll bars.
     341 *
     342 * Revision history
     343 *     05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
     344 *        Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
     345 *
     346 *     20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
     347 *        Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
     348 *        NC_AdjustRectInner95 and added handling of Win95 styles.
     349 *
     350 *     28-Jul-1999 Ove Kåven (ovek@arcticnet.no)
     351 *        Streamlined window style checks.
     352 *
     353 *****************************************************************************/
     354void Win32BaseWindow::NC_AdjustRectOuter(LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)
     355{
     356    if(style & WS_ICONIC) return;
     357
     358    /* Decide if the window will be managed (see CreateWindowEx) */
     359//    if (!WindowNeedsWMBorder(style, exStyle))
     360//    {
     361       if (HAS_THICKFRAME( style, exStyle ))
     362            InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
     363        else
     364        if (HAS_DLGFRAME( style, exStyle ))
     365            InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
     366        else
     367        if (HAS_THINFRAME( style ))
     368            InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
     369
     370        if ((style & WS_CAPTION) == WS_CAPTION)
     371        {
     372                if (exStyle & WS_EX_TOOLWINDOW)
     373                        rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
     374                else
     375                        rect->top -= GetSystemMetrics(SM_CYCAPTION);
     376        }
     377//    }
     378
     379    if (menu)
     380            rect->top -= GetSystemMetrics(SM_CYMENU);
     381}
     382/******************************************************************************
     383 * NC_AdjustRectInner95
     384 *
     385 * Computes the size of the "inside" part of the window based on the
     386 * parameters of the client area.
     387 *
     388 + PARAMS
     389 *     LPRECT16 rect
     390 *     DWORD    style
     391 *     DWORD    exStyle
     392 *
     393 * NOTES
     394 *     "Inner" part of a window means the window frame inside of the flat
     395 *     window frame. It includes the client edge, the static edge and the
     396 *     scroll bars.
     397 *
     398 * Revision history
     399 *     05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
     400 *        Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
     401 *
     402 *     20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
     403 *        Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
     404 *        NC_AdjustRectInner95 and added handling of Win95 styles.
     405 *
     406 *****************************************************************************/
     407void Win32BaseWindow::NC_AdjustRectInner(LPRECT rect, DWORD style, DWORD exStyle)
     408{
     409    if(style & WS_ICONIC) return;
     410
     411    if (exStyle & WS_EX_CLIENTEDGE)
     412            InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
     413
     414    if (exStyle & WS_EX_STATICEDGE)
     415            InflateRect(rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
     416
     417    if (style & WS_VSCROLL) rect->right  += GetSystemMetrics(SM_CXVSCROLL);
     418    if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
     419}
    301420//******************************************************************************
    302421//******************************************************************************
  • trunk/src/user32/window.cpp

    r1307 r1336  
    1 /* $Id: window.cpp,v 1.16 1999-10-15 10:03:16 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.17 1999-10-17 15:46:10 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    2929#include "user32.h"
    3030#include "winicon.h"
     31#include <win\winpos.h>
    3132
    3233//******************************************************************************
     
    5859        {
    5960          if (!HIWORD(className)) {
    60                   dprintf(("CreateWindowEx32W: bad class name %04x\n", LOWORD(className)));
     61                  dprintf(("CreateWindowEx32A: bad class name %04x\n", LOWORD(className)));
    6162          }
    62           else    dprintf(("CreateWindowEx32W: bad class name '%s'\n", className ));
     63          else    dprintf(("CreateWindowEx32A: bad class name '%s'\n", className ));
    6364
    6465          SetLastError(ERROR_INVALID_PARAMETER);
     
    8182    cs.dwExStyle      = exStyle;
    8283    if(HIWORD(className)) {
    83         dprintf(("CreateWindowExA: class %s parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
     84        dprintf(("CreateWindowExA: class %s parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
    8485    }
    8586    else dprintf(("CreateWindowExA: class %d parent %x (%d,%d) (%d,%d), %x %x", className, parent, x, y, width, height, style, exStyle));
     
    8889        window = (Win32BaseWindow *) new Win32MDIClientWindow(&cs, classAtom, FALSE);
    8990    }
    90     else 
    91     if(!strcmpi((char *) className, DIALOG_CLASS_NAMEA)) 
     91    else
     92    if(!strcmpi((char *) className, DIALOG_CLASS_NAMEA))
    9293    {
    9394      DLG_TEMPLATE dlgTemplate = {0};
     
    146147        {
    147148          sprintf(tmpClassA,"#%d", (int) className);
    148           AsciiToUnicode(tmpClassA, tmpClassW);
     149          AsciiToUnicode(tmpClassA, tmpClassW);
    149150          classAtom = GlobalFindAtomW(tmpClassW);
    150151          className = (LPCWSTR)tmpClassW;
     
    155156                  dprintf(("CreateWindowEx32W: bad class name %04x\n", LOWORD(className)));
    156157          }
    157           else    dprintf(("CreateWindowEx32W: bad class name "));
     158      else    dprintf(("CreateWindowEx32W: bad class name "));
    158159
    159160          SetLastError(ERROR_INVALID_PARAMETER);
     
    180181    }
    181182    else
    182     if(!lstrcmpiW(className, (LPWSTR)DIALOG_CLASS_NAMEW)) 
     183    if(!lstrcmpiW(className, (LPWSTR)DIALOG_CLASS_NAMEW))
    183184    {
    184185      DLG_TEMPLATE dlgTemplate = {0};
     
    258259    if(!window) {
    259260        dprintf(("CreateMDIWindowW, window %x not found", hwndParent));
    260         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     261    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    261262        return 0;
    262263    }
     
    284285    if(!window) {
    285286        dprintf(("DestroyWindow, window %x not found", hwnd));
    286         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     287    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    287288        return 0;
    288289    }
     
    299300    if(!window) {
    300301        dprintf(("SetActiveWindow, window %x not found", hwnd));
    301         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     302    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    302303        return 0;
    303304    }
     
    314315    if(!window) {
    315316        dprintf(("GetParent, window %x not found", hwnd));
    316         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     317    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    317318        return 0;
    318319    }
     
    329330    if(!window) {
    330331        dprintf(("SetParent, window %x not found", hwndChild));
    331         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     332    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    332333        return 0;
    333334    }
     
    344345    if(!window) {
    345346        dprintf(("IsChild, window %x not found", hwnd));
    346         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     347    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    347348        return 0;
    348349    }
     
    359360    if(!window) {
    360361        dprintf(("GetTopWindow, window %x not found", hwnd));
    361         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     362    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    362363        return 0;
    363364    }
     
    389390    if(!window) {
    390391        dprintf(("IsIconic, window %x not found", hwnd));
    391         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     392    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    392393        return 0;
    393394    }
     
    405406    if(!window) {
    406407        dprintf(("GetWindow, window %x not found", hwnd));
    407         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     408    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    408409        return 0;
    409410    }
    410411    rc = window->GetWindow(uCmd);
    411     dprintf(("GetWindow %x %d returned %x", hwnd, uCmd, rc));
    412412    return rc;
    413413}
     
    421421    if(!window) {
    422422        dprintf(("EnableWindow, window %x not found", hwnd));
    423         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     423    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    424424        return 0;
    425425    }
     
    448448    if(!window) {
    449449        dprintf(("ShowWindow, window %x not found", hwnd));
    450         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     450    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    451451        return 0;
    452452    }
     
    463463    if(!window) {
    464464        dprintf(("SetWindowPos, window %x not found", hwnd));
    465         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     465    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    466466        return 0;
    467467    }
     
    522522    if(!window) {
    523523        dprintf(("IsWindowVisible, window %x not found", hwnd));
    524         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     524    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    525525        return 0;
    526526    }
     
    553553    dprintf(("USER32: GetFocus %x\n", hwnd));
    554554    hwnd = Win32BaseWindow::OS2ToWin32Handle(hwnd);
    555     return hwnd;   
     555    return hwnd;
    556556}
    557557//******************************************************************************
     
    625625    if(!window) {
    626626        dprintf(("GetWindowRect, window %x not found", hwnd));
    627         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     627    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    628628        return 0;
    629629    }
     
    641641    if(!window) {
    642642        dprintf(("GetWindowTextLength, window %x not found", hwnd));
    643         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     643    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    644644        return 0;
    645645    }
     
    657657    if(!window) {
    658658        dprintf(("GetWindowTextA, window %x not found", hwnd));
    659         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     659    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    660660        return 0;
    661661    }
     
    680680    if(!window) {
    681681        dprintf(("GetWindowTextW, window %x not found", hwnd));
    682         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     682    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    683683        return 0;
    684684    }
     
    695695    if(!window) {
    696696        dprintf(("SetWindowTextA, window %x not found", hwnd));
    697         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     697    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    698698        return 0;
    699699    }
     
    710710    if(!window) {
    711711        dprintf(("SetWindowTextA, window %x not found", hwnd));
    712         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     712    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    713713        return 0;
    714714    }
     
    746746 HWND hwndWin32 = hwnd;
    747747
     748#if 1
     749 Win32BaseWindow *window;
     750
     751    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     752    if(!window) {
     753        dprintf(("GetClientRect, window %x not found", hwnd));
     754    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     755        return 0;
     756    }
     757    *pRect = *window->getClientRect();
     758    OffsetRect(pRect, -pRect->left, -pRect->top);
     759    dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom));
     760    return TRUE;
     761#else
    748762    hwnd = Win32BaseWindow::Win32ToOS2Handle(hwnd);
    749763    rc = OSLibWinQueryWindowRect(hwnd, pRect);
    750764    dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom));
    751765    return rc;
    752 }
    753 //******************************************************************************
    754 //******************************************************************************
    755 BOOL WIN32API AdjustWindowRect( PRECT arg1, DWORD arg2, BOOL  arg3)
    756 {
    757 #ifdef DEBUG
    758     WriteLog("USER32:  AdjustWindowRect\n");
    759766#endif
    760     return O32_AdjustWindowRect(arg1, arg2, arg3);
    761 }
    762 //******************************************************************************
    763 //******************************************************************************
    764 BOOL WIN32API AdjustWindowRectEx( PRECT arg1, DWORD arg2, BOOL arg3, DWORD  arg4)
    765 {
    766 #ifdef DEBUG
    767     WriteLog("USER32:  AdjustWindowRectEx\n");
     767}
     768//******************************************************************************
     769//******************************************************************************
     770BOOL WIN32API AdjustWindowRect(PRECT rect, DWORD style, BOOL menu)
     771{
     772    return AdjustWindowRectEx(rect, style, menu, 0);
     773}
     774//******************************************************************************
     775//******************************************************************************
     776BOOL WIN32API AdjustWindowRectEx( PRECT rect, DWORD style, BOOL menu, DWORD exStyle)
     777{
     778    dprintf(("AdjustWindowRectEx %x %x %d (%d,%d)(%d,%d)\n", style, exStyle, menu, rect->right, rect->top, rect->left, rect->bottom));
     779
     780#if 0
     781    O32_AdjustWindowRectEx(rect, style, menu, exStyle);
     782#else
     783    /* Correct the window style */
     784    if (!(style & (WS_POPUP | WS_CHILD)))  /* Overlapped window */
     785    style |= WS_CAPTION;
     786
     787    style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD | WS_VSCROLL | WS_HSCROLL);
     788    exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE |
     789        WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
     790    if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
     791
     792    Win32BaseWindow::NC_AdjustRectOuter( rect, style, menu, exStyle );
     793    Win32BaseWindow::NC_AdjustRectInner( rect, style, exStyle );
    768794#endif
    769     return O32_AdjustWindowRectEx(arg1, arg2, arg3, arg4);
     795
     796    dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->right, rect->top, rect->left, rect->bottom));
     797    return TRUE;
    770798}
    771799//******************************************************************************
     
    781809{
    782810    if(!lpszClass) {
    783         SetLastError(ERROR_INVALID_PARAMETER);
    784         return 0;
     811        SetLastError(ERROR_INVALID_PARAMETER);
     812        return 0;
    785813    }
    786814    if(HIWORD(lpszClass)) {
     
    793821//******************************************************************************
    794822//******************************************************************************
     823HWND WIN32API FindWindowW( LPCWSTR lpClassName, LPCWSTR lpWindowName)
     824{
     825 char *astring1 = UnicodeToAsciiString((LPWSTR)lpClassName);
     826 char *astring2 = UnicodeToAsciiString((LPWSTR)lpWindowName);
     827 HWND rc;
     828
     829    rc = FindWindowA(astring1, astring2);
     830    FreeAsciiString(astring1);
     831    FreeAsciiString(astring2);
     832    return rc;
     833}
     834//******************************************************************************
     835//******************************************************************************
    795836HWND WIN32API FindWindowExA(HWND hwndParent, HWND hwndChildAfter, LPCSTR lpszClass, LPCSTR lpszWindow)
    796837{
    797838    if(!lpszClass) {
    798         SetLastError(ERROR_INVALID_PARAMETER);
    799         return 0;
     839        SetLastError(ERROR_INVALID_PARAMETER);
     840        return 0;
    800841    }
    801842    if(HIWORD(lpszClass)) {
     
    833874{
    834875    if(!lpszClass) {
    835         SetLastError(ERROR_INVALID_PARAMETER);
    836         return 0;
     876        SetLastError(ERROR_INVALID_PARAMETER);
     877        return 0;
    837878    }
    838879    dprintf(("USER32:  FindWindowExW (%x,%x) %x %s\n", hwndParent, hwndChildAfter, lpszClass, lpszWindow));
     
    870911
    871912    if (!hwnd) {
    872         SetLastError(ERROR_INVALID_PARAMETER);
    873         return (FALSE);
     913    SetLastError(ERROR_INVALID_PARAMETER);
     914    return (FALSE);
    874915    }
    875916    wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    876917    if (!wnd) {
    877         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    878         return (FALSE);
     918    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     919    return (FALSE);
    879920    }
    880921
     
    887928//******************************************************************************
    888929//******************************************************************************
    889 HDWP WIN32API BeginDeferWindowPos( int arg1)
    890 {
    891 #ifdef DEBUG
    892     WriteLog("USER32:  BeginDeferWindowPos\n");
     930HDWP WIN32API BeginDeferWindowPos(int count)
     931{
     932    HDWP handle;
     933    DWP *pDWP;
     934
     935    dprintf(("USER32:  BeginDeferWindowPos\n"));
     936    if (count <= 0)
     937    {
     938        SetLastError(ERROR_INVALID_PARAMETER);
     939        return 0;
     940    }
     941    handle = (HDWP)HeapAlloc(GetProcessHeap(), 0, sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
     942    if (!handle)
     943        return 0;
     944
     945    pDWP = (DWP *) handle;
     946    pDWP->actualCount    = 0;
     947    pDWP->suggestedCount = count;
     948    pDWP->valid          = TRUE;
     949    pDWP->wMagic         = DWP_MAGIC;
     950    pDWP->hwndParent     = 0;
     951    return handle;
     952}
     953/***********************************************************************
     954 *           DeferWindowPos   (USER32.128)
     955 */
     956HDWP WIN32API DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter,
     957                              INT x, INT y, INT cx, INT cy,
     958                              UINT flags )
     959{
     960  DWP *pDWP;
     961  int i;
     962  HDWP newhdwp = hdwp,retvalue;
     963  Win32BaseWindow *window;
     964
     965    pDWP = (DWP *)hdwp;
     966    if (!pDWP) {
     967        SetLastError(ERROR_INVALID_PARAMETER);
     968        return 0;
     969    }
     970
     971    if (hwnd == GetDesktopWindow())
     972        return 0;
     973
     974    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     975    if(!window) {
     976        dprintf(("DeferWindowPos, window %x not found", hwnd));
     977        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     978        HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
     979        return 0;
     980    }
     981
     982
     983/* Numega Bounds Checker Demo dislikes the following code.
     984   In fact, I've not been able to find any "same parent" requirement in any docu
     985   [AM 980509]
     986 */
     987#if 0
     988    /* All the windows of a DeferWindowPos() must have the same parent */
     989    parent = pWnd->parent->hwndSelf;
     990    if (pDWP->actualCount == 0) pDWP->hwndParent = parent;
     991    else if (parent != pDWP->hwndParent)
     992    {
     993        USER_HEAP_FREE( hdwp );
     994        retvalue = 0;
     995        goto END;
     996    }
    893997#endif
    894     return O32_BeginDeferWindowPos(arg1);
    895 }
    896 //******************************************************************************
    897 //******************************************************************************
    898 HDWP WIN32API DeferWindowPos( HDWP arg1, HWND arg2, HWND  arg3, int arg4, int arg5, int arg6, int arg7, UINT  arg8)
    899 {
    900 #ifdef DEBUG
    901     WriteLog("USER32:  DeferWindowPos\n");
    902 #endif
    903     return O32_DeferWindowPos(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
     998
     999    for (i = 0; i < pDWP->actualCount; i++)
     1000    {
     1001        if (pDWP->winPos[i].hwnd == hwnd)
     1002        {
     1003              /* Merge with the other changes */
     1004            if (!(flags & SWP_NOZORDER))
     1005            {
     1006                pDWP->winPos[i].hwndInsertAfter = hwndAfter;
     1007            }
     1008            if (!(flags & SWP_NOMOVE))
     1009            {
     1010                pDWP->winPos[i].x = x;
     1011                pDWP->winPos[i].y = y;
     1012            }
     1013            if (!(flags & SWP_NOSIZE))
     1014            {
     1015                pDWP->winPos[i].cx = cx;
     1016                pDWP->winPos[i].cy = cy;
     1017            }
     1018            pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
     1019                                               SWP_NOZORDER | SWP_NOREDRAW |
     1020                                               SWP_NOACTIVATE | SWP_NOCOPYBITS|
     1021                                               SWP_NOOWNERZORDER);
     1022            pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW |
     1023                                              SWP_FRAMECHANGED);
     1024            retvalue = hdwp;
     1025            goto END;
     1026        }
     1027    }
     1028    if (pDWP->actualCount >= pDWP->suggestedCount)
     1029    {
     1030        newhdwp = (HDWP)HeapReAlloc(GetProcessHeap(), 0, (LPVOID)hdwp,
     1031                                    sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS));
     1032        if (!newhdwp)
     1033        {
     1034            retvalue = 0;
     1035            goto END;
     1036        }
     1037        pDWP = (DWP *) newhdwp;
     1038        pDWP->suggestedCount++;
     1039    }
     1040    pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
     1041    pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter;
     1042    pDWP->winPos[pDWP->actualCount].x = x;
     1043    pDWP->winPos[pDWP->actualCount].y = y;
     1044    pDWP->winPos[pDWP->actualCount].cx = cx;
     1045    pDWP->winPos[pDWP->actualCount].cy = cy;
     1046    pDWP->winPos[pDWP->actualCount].flags = flags;
     1047    pDWP->actualCount++;
     1048    retvalue = newhdwp;
     1049END:
     1050    return retvalue;
     1051}
     1052//******************************************************************************
     1053//******************************************************************************
     1054BOOL WIN32API EndDeferWindowPos( HDWP hdwp)
     1055{
     1056    DWP *pDWP;
     1057    WINDOWPOS *winpos;
     1058    BOOL res = TRUE;
     1059    int i;
     1060
     1061    dprintf(("EndDeferWindowPos\n"));
     1062    pDWP = (DWP *) hdwp;
     1063    if (!pDWP) {
     1064        SetLastError(ERROR_INVALID_PARAMETER);
     1065        return FALSE;
     1066    }
     1067    for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
     1068    {
     1069        if (!(res = SetWindowPos(winpos->hwnd, winpos->hwndInsertAfter,
     1070                                 winpos->x, winpos->y, winpos->cx,
     1071                                 winpos->cy, winpos->flags )))
     1072            break;
     1073    }
     1074    HeapFree(GetProcessHeap(), 0, (LPVOID)hdwp);
     1075    return res;
    9041076}
    9051077//******************************************************************************
     
    9401112        if (GetWindowRect (hwndParent, &rect) == 0) {
    9411113                // oops, invalid handle
    942                 SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     1114        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    9431115                return NULL;
    9441116        }
     
    9851157                }
    9861158
    987                 dprintf(("ChildWindowFromPointEx returned %x", hWnd));
     1159        dprintf(("ChildWindowFromPointEx returned %x", hWnd));
    9881160                // found it!
    9891161                return hWnd;
     
    9921164        // the point is in the parentwindow but the parentwindow has no child
    9931165        // at this coordinate
    994         dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent));
     1166    dprintf(("ChildWindowFromPointEx returned parent %x", hwndParent));
    9951167        return hwndParent;
    9961168}
     
    10041176    if(!window) {
    10051177        dprintf(("CloseWindow, window %x not found", hwnd));
    1006         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     1178    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    10071179        return 0;
    10081180    }
     
    10331205    if(!window) {
    10341206        dprintf(("IsWindowUnicode, window %x not found", hwnd));
    1035         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     1207    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    10361208        return 0;
    10371209    }
     
    11391311  if(!parentwindow) {
    11401312        dprintf(("EnumChildWindows, window %x not found", hwnd));
    1141         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     1313    SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    11421314        return FALSE;
    11431315  }
Note: See TracChangeset for help on using the changeset viewer.