Ignore:
Timestamp:
Dec 2, 1999, 8:30:41 PM (26 years ago)
Author:
sandervl
Message:

Rewrote EnumThreadWindows/EnumWindows, Fixed GetParent

File:
1 edited

Legend:

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

    r1926 r1949  
    1 /* $Id: win32wbase.cpp,v 1.101 1999-12-01 18:43:08 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.102 1999-12-02 19:30:40 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    415415  else
    416416  {
     417        SetParent(0);
    417418        if (!cs->hwndParent || cs->hwndParent == windowDesktop->getWindowHandle()) {
    418419            owner = NULL;
     
    24472448//******************************************************************************
    24482449//******************************************************************************
     2450Win32BaseWindow *Win32BaseWindow::getParent()
     2451{
     2452  Win32BaseWindow *wndparent = (Win32BaseWindow *)ChildWindow::GetParent();
     2453  return ((ULONG)wndparent == (ULONG)windowDesktop) ? NULL : wndparent;
     2454}
     2455//******************************************************************************
     2456//******************************************************************************
    24492457HWND Win32BaseWindow::GetParent()
    24502458{
    2451   if(getParent()) {
    2452         return getParent()->getWindowHandle();
    2453   }
    2454   else  return 0;
     2459 Win32BaseWindow *wndparent;
     2460
     2461    if ((!(getStyle() & (WS_POPUP|WS_CHILD))))
     2462    {
     2463        return 0;
     2464    }
     2465    wndparent = ((getStyle() & WS_CHILD) ? getParent() : getOwner());
     2466
     2467    return (wndparent) ? wndparent->getWindowHandle() : 0;
    24552468}
    24562469//******************************************************************************
     
    24762489   }
    24772490   else {
    2478     setParent(windowDesktop);
    2479         getParent()->AddChild(this);
     2491        setParent(windowDesktop);
     2492        windowDesktop->AddChild(this);
    24802493        OSLibWinSetParent(getOS2FrameWindowHandle(), OSLIB_HWND_DESKTOP);
    24812494        return oldhwnd;
     
    25572570        dprintf(("EnumChildWindows: enumerating child %x", child->getWindowHandle()));
    25582571        hwnd = child->getWindowHandle();
     2572        if(child->getOwner()) {
     2573                continue; //shouldn't have an owner (Wine)
     2574        }
    25592575        if(lpfn(hwnd, lParam) == FALSE)
    25602576        {
     
    25802596    }
    25812597    return rc;
     2598}
     2599//******************************************************************************
     2600//Enumerate first-level children only and check thread id
     2601//******************************************************************************
     2602BOOL Win32BaseWindow::EnumThreadWindows(DWORD dwThreadId, WNDENUMPROC lpfn, LPARAM lParam)
     2603{
     2604 Win32BaseWindow *child = 0;
     2605 ULONG  tid, pid;
     2606 BOOL   rc;
     2607 HWND   hwnd;
     2608
     2609    dprintf(("EnumThreadWindows %x %x %x", dwThreadId, lpfn, lParam));
     2610
     2611    for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
     2612    {
     2613        OSLibWinQueryWindowProcess(child->getOS2WindowHandle(), &pid, &tid);
     2614       
     2615        if(dwThreadId == tid) {
     2616            dprintf2(("EnumThreadWindows: Found Window %x", child->getWindowHandle()));
     2617            if((rc = lpfn(child->getWindowHandle(), lParam)) == FALSE) {
     2618                break;
     2619            }
     2620        }
     2621    }
     2622    return TRUE;
     2623}
     2624//******************************************************************************
     2625//Enumerate first-level children only
     2626//******************************************************************************
     2627BOOL Win32BaseWindow::EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
     2628{
     2629 Win32BaseWindow *child = 0;
     2630 BOOL   rc;
     2631 HWND   hwnd;
     2632
     2633    dprintf(("EnumWindows %x %x", lpfn, lParam));
     2634
     2635    for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
     2636    {
     2637        hwnd = child->getWindowHandle();
     2638
     2639        dprintf2(("EnumWindows: Found Window %x", child->getWindowHandle()));
     2640        if((rc = lpfn(child->getWindowHandle(), lParam)) == FALSE) {
     2641            break;
     2642        }
     2643    }
     2644    return TRUE;
    25822645}
    25832646//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.