Changeset 8846 for trunk/src


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

Changed SetFocus fix; only disallow focus change for minimized and disabled windows.

File:
1 edited

Legend:

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

    r8842 r8846  
    1 /* $Id: window.cpp,v 1.123 2002-07-05 18:15:11 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.124 2002-07-08 10:21:55 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    731731 Win32BaseWindow *window;
    732732 Win32BaseWindow *oldfocuswnd;
    733  HWND lastFocus, lastFocus_W, hwnd_O, hwndTopParent;
     733 HWND lastFocus, lastFocus_W, hwnd_O, hwndTopParent, hwndTop;
    734734 BOOL activate, ret;
    735735 TEB *teb;
     
    740740        return 0;
    741741    }
    742    
    743     if (!IsWindowVisible(hwnd))
    744     {
    745         dprintf(("SetFocus, %x not allowed on invisible window", hwnd));
    746         SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    747         return 0;
    748     }
    749742
    750743    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     
    753746        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    754747        return 0;
     748    }
     749
     750    //SetFocus is not allowed for minimized or disabled windows (this window
     751    //or any parent)
     752    hwndTop = hwnd;
     753    for (;;)
     754    {
     755        HWND parent;
     756
     757        LONG style = GetWindowLongW( hwndTop, GWL_STYLE );
     758        if (style & (WS_MINIMIZE | WS_DISABLED)) {
     759            dprintf(("SetFocus, %x not allowed on minimized or disabled window (%x)", hwnd, style));
     760            return 0;
     761        }
     762        parent = GetParent(hwndTop);
     763        if (!parent || parent == GetDesktopWindow()) break;
     764        hwndTop = parent;
    755765    }
    756766
Note: See TracChangeset for help on using the changeset viewer.