Ignore:
Timestamp:
Jul 8, 2002, 12:51:01 PM (23 years ago)
Author:
sandervl
Message:

Added GetAncestor; SetFocus fix

File:
1 edited

Legend:

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

    r8846 r8848  
    1 /* $Id: window.cpp,v 1.124 2002-07-08 10:21:55 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.125 2002-07-08 10:51:01 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    727727//******************************************************************************
    728728//******************************************************************************
     729HWND WINAPI GetAncestor( HWND hwnd, UINT type )
     730{
     731    HWND hwndAncestor = 0;
     732
     733    if (type == GA_PARENT)
     734    {
     735        LONG dwStyle = GetWindowLongW( hwnd, GWL_STYLE );
     736        if(dwStyle & WS_CHILD) {
     737            hwndAncestor = GetParent(hwnd);
     738        }
     739        //else no child -> no parent (GetParent returns owner otherwise!)
     740        return hwndAncestor;
     741    }
     742    dprintf(("Unsupported type %d", type));
     743    return 0;
     744}
     745//******************************************************************************
     746//******************************************************************************
    729747HWND WIN32API SetFocus(HWND hwnd)
    730748{
     
    741759    }
    742760
    743     window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    744     if(!window) {
    745         dprintf(("SetFocus, window %x not found", hwnd));
    746         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    747         return 0;
    748     }
    749 
    750761    //SetFocus is not allowed for minimized or disabled windows (this window
    751762    //or any parent)
     
    760771            return 0;
    761772        }
    762         parent = GetParent(hwndTop);
     773        parent = GetAncestor(hwndTop, GA_PARENT);
    763774        if (!parent || parent == GetDesktopWindow()) break;
    764775        hwndTop = parent;
     776    }
     777
     778    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     779    if(!window) {
     780        dprintf(("SetFocus, window %x not found", hwnd));
     781        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
     782        return 0;
    765783    }
    766784
Note: See TracChangeset for help on using the changeset viewer.