Changeset 5409 for trunk/src


Ignore:
Timestamp:
Mar 31, 2001, 1:59:47 AM (24 years ago)
Author:
sandervl
Message:

WindowFromPoint completed + mouse message translation fix

Location:
trunk/src/user32
Files:
2 edited

Legend:

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

    r5404 r5409  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.43 2001-03-30 11:14:35 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.44 2001-03-30 23:59:46 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    397397                goto dummymessage;
    398398            }
     399            winMsg->hwnd = hwnd;
    399400        }
    400401#endif
     
    473474                goto dummymessage;
    474475            }
     476            winMsg->hwnd = hwnd;
    475477        }
    476478#endif
  • trunk/src/user32/window.cpp

    r5406 r5409  
    1 /* $Id: window.cpp,v 1.91 2001-03-30 22:08:20 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.92 2001-03-30 23:59:47 sandervl Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    14841484}
    14851485//******************************************************************************
     1486//******************************************************************************
     1487static BOOL IsPointInWindow(HWND hwnd, POINT point)
     1488{
     1489    RECT  rectWindow;
     1490    DWORD hittest, dwStyle, dwExStyle;
     1491
     1492    dwStyle   = GetWindowLongA(hwnd, GWL_STYLE);
     1493    dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
     1494
     1495    GetWindowRect(hwnd, &rectWindow);
     1496
     1497    /* If point is in window, and window is visible, and it  */
     1498    /* is enabled (or it's a top-level window), then explore */
     1499    /* its children. Otherwise, go to the next window.       */
     1500
     1501    if( (dwStyle & WS_VISIBLE) &&
     1502        ((dwExStyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) != (WS_EX_LAYERED | WS_EX_TRANSPARENT)) &&
     1503        (!(dwStyle & WS_DISABLED) || ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD)) &&
     1504        ((point.x >= rectWindow.left) && (point.x <  rectWindow.right) &&
     1505         (point.y >= rectWindow.top) && (point.y <  rectWindow.bottom))
     1506#if 1
     1507        )
     1508#else
     1509        &&
     1510        (wndPtr->hrgnWnd ?  PtInRegion(wndPtr->hrgnWnd, 1))
     1511#endif
     1512    {
     1513        hittest = SendMessageA(hwnd, WM_NCHITTEST, 0, MAKELONG(point.x, point.y));
     1514        if(hittest != HTTRANSPARENT) {
     1515            return TRUE;
     1516        }
     1517    }
     1518    return FALSE;
     1519}
     1520//******************************************************************************
    14861521//TODO: Does this return handles of hidden or disabled windows?
    14871522//******************************************************************************
     
    14901525    HWND  hwndOS2, hwnd;
    14911526    POINT wPoint;
    1492     DWORD hittest, dwStyle, dwExStyle;
    14931527
    14941528    wPoint.x = point.x;
     
    15011535        while(hwnd)
    15021536        {
    1503                 dwStyle   = GetWindowLongA(hwnd, GWL_STYLE);
    1504                 dwExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
    1505 
    1506                 /* If point is in window, and window is visible, and it  */
    1507                 /* is enabled (or it's a top-level window), then explore */
    1508                 /* its children. Otherwise, go to the next window.       */
    1509 
    1510                 if( (dwStyle & WS_VISIBLE) &&
    1511                     ((dwExStyle & (WS_EX_LAYERED | WS_EX_TRANSPARENT)) != (WS_EX_LAYERED | WS_EX_TRANSPARENT)) &&
    1512                     (!(dwStyle & WS_DISABLED) || ((dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD))
    1513 #if 1
    1514                     )
    1515 #else
    1516                     &&
    1517                     (wndPtr->hrgnWnd ?  PtInRegion(wndPtr->hrgnWnd, 1))
    1518 #endif
    1519                 {
    1520                     hittest = SendMessageA(hwnd, WM_NCHITTEST, 0, MAKELONG(point.x, point.y));
    1521                     if(hittest != HTTRANSPARENT) {
    1522                         dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
    1523                         return hwnd;
     1537                if(IsPointInWindow(hwnd, point)) {
     1538                    dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwnd));
     1539                    return hwnd;
     1540                }
     1541                //try siblings
     1542                HWND hwndSibling;
     1543                HWND hwndParent = GetParent(hwnd);
     1544
     1545                if(hwndParent) {
     1546                    hwndSibling = GetWindow(hwndParent, GW_CHILD);
     1547                    while(hwndSibling) {
     1548                        if(hwndSibling != hwnd) {
     1549                            if(IsPointInWindow(hwndSibling, point)) {
     1550                                dprintf(("WindowFromPoint (%d,%d) %x->%x\n", point.x, point.y, hwndOS2, hwndSibling));
     1551                                return hwndSibling;
     1552                            }
     1553                        }
     1554                        hwndSibling = GetWindow(hwndSibling, GW_HWNDNEXT);
    15241555                    }
    15251556                }
    1526                 //TODO: Not correct for overlapping sibling windows!
    1527                 hwnd = GetParent(hwnd);
     1557                hwnd = hwndParent;
    15281558        }
    15291559    }
Note: See TracChangeset for help on using the changeset viewer.