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/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())
Note: See TracChangeset for help on using the changeset viewer.