Ignore:
Timestamp:
Sep 17, 2002, 7:37:10 PM (23 years ago)
Author:
sandervl
Message:

PF: Added WM_MOUSEWHEEL message support

File:
1 edited

Legend:

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

    r9230 r9258  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.93 2002-09-12 09:30:05 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.94 2002-09-17 17:37:10 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    4747//For wheel mouse translation
    4848#define WHEEL_DELTA  120
    49 #define OS2_WHEEL_CORRECTION 6
    50 //This happens because OS/2 Wheel scrolling of IBM driver issues 6 WM_VSCROLL
    51 //messages and they need to transform in 1 WM_MOUSEWHEEL. If however user
    52 //will tweak driver to produce less or more messages, we will also react
    53 
     49#define OS2_WHEEL_CORRECTION 1
     50//PF Correction is different for different mouse drivers. For now no correction
     51//is ok because lots of Odin controls rely on minimum delta. However in future
     52//we will possibly detect mouse driver and use correction if speed will be
     53//too high or too low.
     54 
    5455//******************************************************************************
    5556//******************************************************************************
     
    929930    case WM_VSCROLL:
    930931        //PF For win32 we support only vertical scrolling for WM_MOUSEWHEEL
    931         if((os2Msg->msg == WM_VSCROLL) && (fMsgRemoved == MSG_REMOVE))
    932         {
    933             MSLLHOOKSTRUCT hook;
    934 
    935             //TODO:
     932        if (os2Msg->msg == WM_VSCROLL)
     933        {
     934            POINT CursorPoint;
    936935            winMsg->message = WINWM_MOUSEWHEEL;
    937             winMsg->lParam  = 0;
    938             winMsg->wParam  = 0;
    939 
    940             hook.pt.x       = os2Msg->ptl.x & 0xFFFF;
    941             hook.pt.y       = mapScreenY(os2Msg->ptl.y);
     936            if (OSLibWinQueryPointerPos(&CursorPoint))
     937               mapScreenPoint((OSLIBPOINT*)&CursorPoint);
     938 
    942939            if (SHORT2FROMMP(os2Msg->mp2) == SB_LINEDOWN)
    943                 hook.mouseData   = MAKELONG(0, -WHEEL_DELTA/OS2_WHEEL_CORRECTION); 
     940                winMsg->wParam  = MAKELONG(0, -WHEEL_DELTA/OS2_WHEEL_CORRECTION); 
    944941            else
    945942            if (SHORT2FROMMP(os2Msg->mp2) == SB_LINEUP)
    946             {
    947                 hook.mouseData   = MAKELONG(0, WHEEL_DELTA/OS2_WHEEL_CORRECTION); 
    948             }
    949             else goto dummymessage; // IBM driver produces other messages as well sometimes
    950 
    951             hook.flags       = LLMHF_INJECTED;
    952             hook.time        = winMsg->time;
    953             hook.dwExtraInfo = 0;
    954             if(HOOK_CallHooksW( WH_MOUSE_LL, HC_ACTION, WINWM_MOUSEWHEEL, (LPARAM)&hook)) {
    955                 goto dummymessage; //hook swallowed message
    956             }
    957             goto dummymessage;
     943                winMsg->wParam  = MAKELONG(0, WHEEL_DELTA/OS2_WHEEL_CORRECTION); 
     944            else
     945                winMsg->wParam  = 0;
     946
     947            winMsg->lParam  = MAKELONG(CursorPoint.x, CursorPoint.y);
     948
     949            dprintf(("WM_MOUSEWHEEL message delta %d at (%d,%d)",HIWORD(winMsg->wParam),CursorPoint.x, CursorPoint.y)); 
     950            if (fMsgRemoved == MSG_REMOVE)
     951            {
     952                    MSLLHOOKSTRUCT hook;
     953
     954                    hook.pt.x       = os2Msg->ptl.x & 0xFFFF;
     955                    hook.pt.y       = mapScreenY(os2Msg->ptl.y);
     956                    if (SHORT2FROMMP(os2Msg->mp2) == SB_LINEDOWN)
     957                        hook.mouseData   = MAKELONG(0, -WHEEL_DELTA/OS2_WHEEL_CORRECTION); 
     958                    else
     959                    if (SHORT2FROMMP(os2Msg->mp2) == SB_LINEUP)
     960                        hook.mouseData   = MAKELONG(0, WHEEL_DELTA/OS2_WHEEL_CORRECTION); 
     961                    else goto dummymessage; // IBM driver produces other messages as well sometimes
     962
     963                    hook.flags       = LLMHF_INJECTED;
     964                    hook.time        = winMsg->time;
     965                    hook.dwExtraInfo = 0;
     966                    if(HOOK_CallHooksW( WH_MOUSE_LL, HC_ACTION, WINWM_MOUSEWHEEL, (LPARAM)&hook))
     967                        goto dummymessage; //hook swallowed message
     968           }
     969           break;
    958970        }
    959971        goto dummymessage; //eat this message
    960        
    961972        break;
    962973
Note: See TracChangeset for help on using the changeset viewer.