Changeset 5404 for trunk/src


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

WM_NCHITTEST changes; no longer rely on PM

Location:
trunk/src/user32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/Makefile

    r4899 r5404  
    1 # $Id: Makefile,v 1.80 2001-01-09 18:14:01 sandervl Exp $
     1# $Id: Makefile,v 1.81 2001-03-30 11:14:35 sandervl Exp $
    22
    33#
     
    1818#
    1919!ifndef WAT
    20 CDEFINES = $(CDEFINES) -DINVERT
     20CDEFINES = $(CDEFINES) -DINVERT -DODIN_HITTEST
    2121!else
    22 CDEFINES += -DINVERT
     22CDEFINES += -DINVERT -DODIN_HITTEST
    2323!endif
    2424
  • trunk/src/user32/oslibmsgtranslate.cpp

    r5382 r5404  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.42 2001-03-25 22:41:50 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.43 2001-03-30 11:14:35 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    2222#include <misc.h>
    2323#include <winconst.h>
     24#include <win32api.h>
    2425#include "oslibmsg.h"
    2526#include <winuser32.h>
     
    360361    //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen
    361362    //**************************************************************************
     363#ifndef ODIN_HITTEST
    362364    case WM_HITTEST:
    363365      winMsg->message = WINWM_NCHITTEST;
     
    371373      }
    372374      break;
     375#endif
    373376
    374377    case WM_BUTTON1DOWN:
     
    381384    case WM_BUTTON3UP:
    382385    case WM_BUTTON3DBLCLK:
     386    {
    383387        //WM_NC*BUTTON* is posted when the cursor is in a non-client area of the window
    384388
    385389#ifdef ODIN_HITTEST
    386         //Send WM_HITTEST message
    387         win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
     390        HWND hwnd;
     391
     392        hwnd = WindowFromPoint(winMsg->pt);
     393        if(win32wnd->getWindowHandle() != hwnd) {
     394            win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     395            if(win32wnd == NULL) {
     396                DebugInt3();
     397                goto dummymessage;
     398            }
     399        }
    388400#endif
    389         win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
    390401
    391402        //if a window is disabled, it's parent receives the mouse messages
    392403        if(!win32wnd->IsWindowEnabled()) {
    393                 if(win32wnd->getParent()) {
    394                         win32wnd = win32wnd->getParent();
    395                 }
    396                 fWasDisabled = TRUE;
     404            if(win32wnd->getParent()) {
     405                win32wnd = win32wnd->getParent();
     406            }
     407            fWasDisabled = TRUE;
    397408        }
    398409
     
    403414        }
    404415        else {
     416#ifdef ODIN_HITTEST
     417            ClientPoint.x = winMsg->pt.x;
     418            ClientPoint.y = winMsg->pt.y;
     419            MapWindowPoints(0, win32wnd->getWindowHandle(), (LPPOINT)&ClientPoint, 1);
     420#else
    405421            point.x         = (*(POINTS *)&os2Msg->mp1).x;
    406422            point.y         = (*(POINTS *)&os2Msg->mp1).y;
    407423            ClientPoint.x   = mapOS2ToWin32X(win32wnd, point.x);
    408424            ClientPoint.y   = mapOS2ToWin32Y(win32wnd, point.y);
    409 
     425#endif
    410426            winMsg->message = WINWM_LBUTTONDOWN + (os2Msg->msg - WM_BUTTON1DOWN);
    411427            winMsg->wParam  = GetMouseKeyState();
     
    420436
    421437        if(fWasDisabled) {
    422                 if(win32wnd) {
    423                         winMsg->hwnd = win32wnd->getWindowHandle();
    424                 }
    425                 else    goto dummymessage; //don't send mouse messages to disabled windows
    426         }
    427         break;
     438            if(win32wnd) {
     439                winMsg->hwnd = win32wnd->getWindowHandle();
     440            }
     441            else goto dummymessage; //don't send mouse messages to disabled windows
     442        }
     443        break;
     444    }
    428445
    429446    case WM_BUTTON2CLICK:
     
    447464
    448465#ifdef ODIN_HITTEST
    449         //Send WM_HITTEST message
    450         win32wnd->sendHitTest(MAKELONG(winMsg->pt.x,winMsg->pt.y));
     466        HWND hwnd;
     467
     468        hwnd = WindowFromPoint(winMsg->pt);
     469        if(win32wnd->getWindowHandle() != hwnd) {
     470            win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);
     471            if(win32wnd == NULL) {
     472                DebugInt3();
     473                goto dummymessage;
     474            }
     475        }
    451476#endif
    452477
    453478        //if a window is disabled, it's parent receives the mouse messages
    454479        if(!win32wnd->IsWindowEnabled()) {
    455                 if(win32wnd->getParent()) {
    456                         win32wnd = win32wnd->getParent();
    457                 }
    458                 fWasDisabled = TRUE;
     480            if(win32wnd->getParent()) {
     481                win32wnd = win32wnd->getParent();
     482            }
     483            fWasDisabled = TRUE;
    459484        }
    460485        if(IsNCMouseMsg(win32wnd))
    461486        {
    462           winMsg->message = WINWM_NCMOUSEMOVE;
    463           winMsg->wParam  = (WPARAM)win32wnd->getLastHitTestVal();
    464           winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
     487            winMsg->message = WINWM_NCMOUSEMOVE;
     488            winMsg->wParam  = (WPARAM)win32wnd->getLastHitTestVal();
     489            winMsg->lParam  = MAKELONG(winMsg->pt.x,winMsg->pt.y);
    465490        }
    466491        else
    467492        {
    468           point.x         = (*(POINTS *)&os2Msg->mp1).x;
    469           point.y         = (*(POINTS *)&os2Msg->mp1).y;
    470           ClientPoint.x   = mapOS2ToWin32X(win32wnd, point.x);
    471           ClientPoint.y   = mapOS2ToWin32Y(win32wnd, point.y);
    472 
    473           winMsg->message = WINWM_MOUSEMOVE;
    474           winMsg->wParam  = GetMouseKeyState();
    475           winMsg->lParam  = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
     493#ifdef ODIN_HITTEST
     494            ClientPoint.x = winMsg->pt.x;
     495            ClientPoint.y = winMsg->pt.y;
     496            MapWindowPoints(0, win32wnd->getWindowHandle(), (LPPOINT)&ClientPoint, 1);
     497#else
     498            point.x         = (*(POINTS *)&os2Msg->mp1).x;
     499            point.y         = (*(POINTS *)&os2Msg->mp1).y;
     500            ClientPoint.x   = mapOS2ToWin32X(win32wnd, point.x);
     501            ClientPoint.y   = mapOS2ToWin32Y(win32wnd, point.y);
     502#endif
     503
     504            winMsg->message = WINWM_MOUSEMOVE;
     505            winMsg->wParam  = GetMouseKeyState();
     506            winMsg->lParam  = MAKELONG(ClientPoint.x, ClientPoint.y); //client coordinates
    476507        }
    477508        if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED())
  • trunk/src/user32/pmwindow.cpp

    r5258 r5404  
    1 /* $Id: pmwindow.cpp,v 1.120 2001-02-23 14:52:41 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.121 2001-03-30 11:14:35 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    105105        (PSZ)WIN32_STDCLASS,               /* Window class name            */
    106106        (PFNWP)Win32WindowProc,            /* Address of window procedure  */
     107#ifdef ODIN_HITTEST
     108        0,
     109#else
    107110        CS_HITTEST,
     111#endif
    108112        NROF_WIN32WNDBYTES))
    109113    {
     
    125129        (PSZ)WIN32_STDFRAMECLASS,          /* Window class name            */
    126130        (PFNWP)Win32FrameWindowProc,       /* Address of window procedure  */
     131#ifdef ODIN_HITTEST
     132        CS_FRAME,
     133#else
    127134        CS_HITTEST | CS_FRAME,
     135#endif
    128136        FrameClassInfo.cbWindowData+NROF_WIN32WNDBYTES))
    129137    {
     
    930938    //Mouse messages (OS/2 Window coordinates -> Win32 coordinates relative to screen
    931939    //**************************************************************************
     940#ifndef ODIN_HITTEST
    932941    case WM_HITTEST:
    933942    {
     
    944953        return (MRESULT)HT_NORMAL;
    945954    }
     955#endif
    946956
    947957    case WM_BUTTON1DOWN:
  • trunk/src/user32/static.cpp

    r5373 r5404  
    1 /* $Id: static.cpp,v 1.22 2001-03-25 08:50:42 sandervl Exp $ */
     1/* $Id: static.cpp,v 1.23 2001-03-30 11:14:36 sandervl Exp $ */
    22/*
    33 * Static control
     
    414414  LRESULT lResult;
    415415
     416#ifndef ODIN_HITTEST
    416417  //SvL: If a static window has children, then we can't return HTTRANSPARENT
    417418  //     here. For some reason PM then sends all mouse messages to the parent
     
    423424       return HTCLIENT;
    424425  }
     426#endif
    425427
    426428  if (dwStyle & SS_NOTIFY)
     
    656658                             hdc, hwnd );
    657659        if (!hBrush) hBrush = GetStockObject(WHITE_BRUSH);
    658         FillRect( hdc, &rc, hBrush );   
     660        FillRect( hdc, &rc, hBrush );
    659661    }
    660662#else
  • trunk/src/user32/win32wbase.cpp

    r5397 r5404  
    1 /* $Id: win32wbase.cpp,v 1.246 2001-03-29 17:39:19 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.247 2001-03-30 11:14:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    906906//******************************************************************************
    907907//******************************************************************************
     908#ifndef ODIN_HITTEST
    908909ULONG Win32BaseWindow::MsgHitTest(MSG *msg)
    909910{
     
    917918    return HTOS_NORMAL;
    918919}
     920#endif
    919921//******************************************************************************
    920922//******************************************************************************
     
    12201222//******************************************************************************
    12211223//******************************************************************************
    1222 LONG Win32BaseWindow::sendHitTest(ULONG lParam)
    1223 {
    1224     lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, lParam);
    1225     return lastHitTestVal;
    1226 }
    1227 //******************************************************************************
    1228 //******************************************************************************
    12291224BOOL Win32BaseWindow::isMDIClient()
    12301225{
     
    19671962                break;
    19681963        }
     1964        case WM_NCHITTEST:
     1965                rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);
     1966                break;
    19691967
    19701968        case WM_DESTROY:
     
    20232021                NotifyParent(Msg, wParam, lParam);
    20242022                rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);
     2023                break;
     2024
     2025        case WM_NCHITTEST:
     2026                rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);
    20252027                break;
    20262028
  • trunk/src/user32/win32wbase.h

    r5258 r5404  
    1 /* $Id: win32wbase.h,v 1.111 2001-02-23 14:52:42 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.112 2001-03-30 11:14:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    134134         ULONG  MsgPaint(ULONG tmp1, BOOL select = TRUE);
    135135         ULONG  MsgEraseBackGround(HDC hdc);
     136#ifndef ODIN_HITTEST
    136137         ULONG  MsgHitTest(MSG *msg);
     138#endif
    137139         ULONG  MsgNCPaint();
    138140         ULONG  MsgFormatFrame(WINDOWPOS *lpWndPos);
     
    161163
    162164         LONG   getLastHitTestVal()             { return lastHitTestVal; }
    163          LONG   sendHitTest(ULONG lParam);
    164165
    165166         DWORD  getWindowContextHelpId()        { return contextHelpId; };
  • trunk/src/user32/win32wbasenonclient.cpp

    r5236 r5404  
    1 /* $Id: win32wbasenonclient.cpp,v 1.29 2001-02-21 20:51:07 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.30 2001-03-30 11:14:36 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    450450  if (dwStyle & WS_MINIMIZE) return HTCAPTION;
    451451
     452  //TODO: is this correct???
     453  if (dwStyle & WS_DISABLED) return HTERROR;
     454
    452455  GetWindowRect(getWindowHandle(), &rect);
    453456
  • 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.