Ignore:
Timestamp:
Mar 30, 2001, 1:14:36 PM (24 years ago)
Author:
sandervl
Message:

WM_NCHITTEST changes; no longer rely on PM

File:
1 edited

Legend:

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

    r5237 r5404  
    1 /* $Id: window.cpp,v 1.89 2001-02-21 21:30:44 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.90 2001-03-30 11:14:36 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
    44 *
    5  * Copyright 1999 Sander van Leeuwen
     5 * Copyright 1999-2001 Sander van Leeuwen (sandervl@xs4all.nl)
    66 * Copyright 1999 Daniela Engert (dani@ngrt.de)
    77 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
     
    1818 * TODO: ShowOwnedPopups needs to be tested
    1919 *       GetLastActivePopup needs to be rewritten
    20  *       ArrangeIconicWindows probably also
     20 *       ArrangeIconicWindows probably too
    2121 *
    2222 */
     
    700700    dprintf(("SetFocus %x (%x) -> %x (%x)\n", lastFocus_W, lastFocus, hwnd, hwnd_O));
    701701
    702     //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing; 
     702    //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
    703703    //must delay this function call
    704704    if(teb->o.odin.fWM_SETFOCUS) {
     
    724724        return 0;
    725725    }
    726     //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing; 
     726    //PM doesn't allow SetFocus calls during WM_SETFOCUS message processing;
    727727    //If focus was changed during WM_SETFOCUS, the focus window handle is
    728728    //stored in teb->o.odin.hwndFocus (set back to 0 when delayed SetFocus
     
    14931493HWND WIN32API WindowFromPoint( POINT point)
    14941494{
    1495 #if 0
    1496     INT     hittest = HTERROR;
    1497     HWND    retvalue = 0;
    1498     HWND    hwnd = GetDesktopWindow();
    1499     DWORD   dwStyle;
    1500     RECT    rectWindow, rectClient;
    1501     Win32BaseWindow *window;
    1502 
    1503     dprintf(("WindowFromPoint (%d,%d)", point.x, point.y));
    1504 
    1505     while(hwnd)
    1506     {
    1507         window = Win32BaseWindow::GetWindowFromHandle(hwnd);
    1508 
    1509         /* If point is in window, and window is visible, and it  */
    1510         /* is enabled (or it's a top-level window), then explore */
    1511         /* its children. Otherwise, go to the next window.       */
    1512         dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
    1513 
    1514         if ((dwStyle & WS_VISIBLE) && (!(dwStyle & WS_DISABLED) ||
    1515            ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)))
    1516         {
    1517             GetWindowRect(hwnd, &rectWindow);
    1518             if(PtInRect(&rectWindow, point) == TRUE)
    1519             {
    1520                 /* If window is minimized or disabled, return at once */
    1521                 if(dwStyle & WS_MINIMIZE)
    1522                 {
    1523                     break;
    1524                 }
    1525                 if(dwStyle & WS_DISABLED)
    1526                 {
    1527                     break;
    1528                 }
    1529                 retvalue = hwnd;
    1530 
    1531                 GetClientRect(hwnd, &rectClient);
    1532                 InflateRect(&rectClient, rectWindow.left, rectWindow.top);
    1533 
    1534                 /* If point is not in client area, ignore the children */
    1535                 if(PtInRect(&rectClient, point) == FALSE) {
    1536                     break;
    1537                 }
    1538                 if(window->getFirstChild()) {
    1539                      hwnd = ((Win32BaseWindow *)window->getFirstChild())->getWindowHandle();
    1540                 }
    1541                 else break;
    1542             }
    1543             else
    1544             {
    1545                 if(window->getNextChild()) {
    1546                      hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle();
    1547                 }
    1548                 else hwnd = 0;
    1549             }
    1550         }
    1551         else
    1552         {
    1553             if(window->getNextChild()) {
    1554                  hwnd = ((Win32BaseWindow *)window->getNextChild())->getWindowHandle();
    1555             }
    1556             else hwnd = 0;
    1557         }
    1558     }
    1559 
    1560     dprintf(("WindowFromPoint (%d,%d) -> %x", point.x, point.y, hwnd));
    1561     return retvalue;
    1562 #else
    15631495    HWND  hwndOS2, hwnd;
    15641496    POINT wPoint;
     1497    DWORD hittest, dwStyle, dwExStyle;
    15651498
    15661499    wPoint.x = point.x;
     
    15701503    if(hwndOS2)
    15711504    {
    1572       hwnd = OS2ToWin32Handle(hwndOS2);
    1573       if(hwnd) {
    1574               dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
    1575               return hwnd;
    1576       }
     1505        hwnd = OS2ToWin32Handle(hwndOS2);
     1506        while(hwnd)
     1507        {
     1508                dwStyle   = GetWindowLongA(hwnd, GWL_STYLE);
     1509                dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
     1510
     1511                /* If point is in window, and window is visible, and it  */
     1512                /* is enabled (or it's a top-level window), then explore */
     1513                /* its children. Otherwise, go to the next window.       */
     1514
     1515                if( (dwStyle & WS_VISIBLE) &&
     1516                    ((dwExStyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) != (WS_EX_LAYERED | WS_EX_TRANSPARENT)) &&
     1517                    (!(dwStyle & WS_DISABLED) || ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD))
     1518#if 1
     1519                    )
     1520#else
     1521                    &&
     1522                    (wndPtr->hrgnWnd ?  PtInRegion(wndPtr->hrgnWnd, 1))
     1523#endif
     1524                {
     1525                    hittest = SendMessageA(hwnd, WM_NCHITTEST, 0, MAKELONG(point.x, point.y));
     1526                    if(hittest != HTTRANSPARENT) {
     1527                        dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
     1528                        return hwnd;
     1529                    }
     1530                }
     1531                //TODO: Not correct for overlapping sibling windows!
     1532                hwnd = GetParent(hwnd);
     1533        }
    15771534    }
    15781535    dprintf(("WindowFromPoint (%d,%d) %x->1\n", point.x, point.y, hwndOS2));
    15791536    return windowDesktop->getWindowHandle();
    1580 #endif
    15811537}
    15821538//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.