Changeset 8347 for trunk/src


Ignore:
Timestamp:
Apr 30, 2002, 4:54:07 PM (23 years ago)
Author:
sandervl
Message:

Implemented WH_MOUSE_LL hook; removed DInput hack for keyboard & mouse message translation

Location:
trunk/src/user32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/USER32.DEF

    r8049 r8347  
    1 ; $Id: USER32.DEF,v 1.71 2002-03-08 11:09:15 sandervl Exp $
     1; $Id: USER32.DEF,v 1.72 2002-04-30 14:54:05 sandervl Exp $
    22
    33LIBRARY USER32 INITINSTANCE TERMINSTANCE
     
    678678    _OS2ToWin32Handle@4                                          @2012 NONAME
    679679
    680     _MOUSE_Enable@4                                              @2007 NONAME
    681680;;    _KeyTranslatePMToWin@4                                       @2008 NONAME
    682681    _KeyTranslatePMToWinBuf@12                                   @2009 NONAME
     
    685684;Export for MSACM32
    686685    _wsnprintfA                                                  @2100 NONAME
    687 
    688     _KEYBOARD_Enable@4                                           @2011 NONAME
    689686
    690687    ;SvL: Used by GDI32
  • trunk/src/user32/oslibmsgtranslate.cpp

    r8129 r8347  
    1 /* $Id: oslibmsgtranslate.cpp,v 1.84 2002-03-28 11:25:59 sandervl Exp $ */
     1/* $Id: oslibmsgtranslate.cpp,v 1.85 2002-04-30 14:54:06 sandervl Exp $ */
    22/*
    33 * Window message translation functions for OS/2
     
    3737#include <winscan.h>
    3838#include <winkeyboard.h>
     39#include "hook.h"
    3940
    4041#define DBG_LOCALLOG    DBG_oslibmsgtranslate
     
    341342        }
    342343        EnableLogging();
    343         if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED())
    344         {
    345             if(DInputMouseHandler(win32wnd->getWindowHandle(), winMsg->message, winMsg->pt.x, winMsg->pt.y)) {
    346                 goto dummymessage; //dinput swallowed message
    347             }
    348         }
    349344
    350345        if(fWasDisabled) {
     
    385380        EnableLogging();
    386381
     382        if(fMsgRemoved == MSG_REMOVE)
     383        {
     384            MSLLHOOKSTRUCT hook;
     385
     386            hook.pt.x        = os2Msg->ptl.x & 0xFFFF;
     387            hook.pt.y        = mapScreenY(os2Msg->ptl.y);
     388            hook.mouseData   = 0;  //todo: XBUTTON1/2 (XP feature) or wheel data
     389            hook.flags       = 0;  //todo: injected (LLMHF_INJECTED)
     390            hook.time        = winMsg->time;
     391            hook.dwExtraInfo = 0;
     392
     393            if(HOOK_CallHooksW( WH_MOUSE_LL, HC_ACTION, winMsg->message, (LPARAM)&hook)) {
     394                goto dummymessage; //hook swallowed message
     395            }
     396        }
    387397        break;
    388398    }
     
    453463        }
    454464        EnableLogging();
    455         if((fMsgRemoved == MSG_REMOVE) && ISMOUSE_CAPTURED())
    456         {
    457             if(DInputMouseHandler(win32wnd->getWindowHandle(), winMsg->message, winMsg->pt.x, winMsg->pt.y)) {
    458                 goto dummymessage; //dinput swallowed message
    459             }
    460         }
    461465        if(fWasDisabled) {
    462                 if(win32wnd) {
    463                     winMsg->hwnd = win32wnd->getWindowHandle();
    464                 }
    465                 else {
    466                     goto dummymessage; //don't send mouse messages to disabled windows
    467                 }
    468         }
    469         //OS/2 Window coordinates -> Win32 Window coordinates
     466            if(win32wnd) {
     467                winMsg->hwnd = win32wnd->getWindowHandle();
     468            }
     469            else {
     470                goto dummymessage; //don't send mouse messages to disabled windows
     471            }
     472        }
     473        if(fMsgRemoved == MSG_REMOVE)
     474        {
     475            MSLLHOOKSTRUCT hook;
     476
     477            hook.pt.x        = os2Msg->ptl.x & 0xFFFF;
     478            hook.pt.y        = mapScreenY(os2Msg->ptl.y);
     479            hook.mouseData   = 0;
     480            hook.flags       = 0;  //todo: injected (LLMHF_INJECTED)
     481            hook.time        = winMsg->time;
     482            hook.dwExtraInfo = 0;
     483
     484            if(HOOK_CallHooksW( WH_MOUSE_LL, HC_ACTION, winMsg->message, (LPARAM)&hook)) {
     485                goto dummymessage; //hook swallowed message
     486            }
     487        }
    470488        break;
    471489    }
    472490
    473491    case WM_CONTROL:
    474       goto dummymessage;
     492        goto dummymessage;
    475493
    476494    case WM_COMMAND:
     
    742760        }
    743761
    744         if (ISKDB_CAPTURED())
    745         {
    746             if (DInputKeyBoardHandler(winMsg)) {
    747                 goto dummymessage; //dinput swallowed message
    748             }
    749         }
    750 
    751762#ifdef ALTGR_HACK
    752763        // it's a PMSCAN_ALTRIGHT WM_CHAR message?
  • trunk/src/user32/user32dbg.def

    r8049 r8347  
    1 ; $Id: user32dbg.def,v 1.4 2002-03-08 11:09:15 sandervl Exp $
     1; $Id: user32dbg.def,v 1.5 2002-04-30 14:54:06 sandervl Exp $
    22
    33LIBRARY USER32 INITINSTANCE TERMINSTANCE
     
    677677    _OS2ToWin32Handle@4                                          @2012 NONAME
    678678
    679     _MOUSE_Enable@4                                              @2007 NONAME
    680679;;    _KeyTranslatePMToWin@4                                       @2008 NONAME
    681680    _KeyTranslatePMToWinBuf@12                                   @2009 NONAME
     
    684683;Export for MSACM32
    685684    _wsnprintfA                                                  @2100 NONAME
    686 
    687     _KEYBOARD_Enable@4                                           @2011 NONAME
    688685
    689686    ;SvL: Used by GDI32
  • trunk/src/user32/winmouse.cpp

    r7875 r8347  
    1 /* $Id: winmouse.cpp,v 1.22 2002-02-11 16:06:00 sandervl Exp $ */
     1/* $Id: winmouse.cpp,v 1.23 2002-04-30 14:54:06 sandervl Exp $ */
    22/*
    33 * Win32 mouse functions
     
    4949 ****************************************************************************/
    5050
    51 LPMOUSE_EVENT_PROC mouseHandler = NULL;
    52 WNDPROC            keyboardHandler = NULL;
    53 
    54 
    55 //******************************************************************************
    56 //******************************************************************************
    57 VOID WIN32API MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc)
    58 {
    59   if(lpMouseEventProc == (LPMOUSE_EVENT_PROC)-1)
    60     mouseHandler = NULL;
    61   else 
    62     mouseHandler = lpMouseEventProc;
    63 }
    64 //******************************************************************************
    65 //******************************************************************************
    66 VOID WIN32API KEYBOARD_Enable(WNDPROC handler)
    67 {
    68   keyboardHandler = handler;
    69 }
    70 //******************************************************************************
    71 //******************************************************************************
    72 BOOL DInputKeyBoardHandler(MSG *msg)
    73 {
    74   if(!ISKDB_CAPTURED())
    75         return FALSE;
    76 
    77   return keyboardHandler(msg->hwnd, msg->message, msg->wParam, msg->lParam);
    78 }
    79 //******************************************************************************
    80 //******************************************************************************
    81 BOOL DInputMouseHandler(HWND hwnd, ULONG msg, ULONG x, ULONG y)
    82 {
    83  WINE_MOUSEEVENT mouseEvent;
    84  DWORD dwFlags = MOUSEEVENTF_ABSOLUTE;
    85 
    86   if(!ISMOUSE_CAPTURED())
    87         return FALSE;
    88 
    89   mouseEvent.magic = WINE_MOUSEEVENT_MAGIC;
    90   mouseEvent.hWnd  = hwnd;
    91   mouseEvent.time  = OSLibWinQueryMsgTime();
    92   mouseEvent.keyState = 0; //not used in dinput right now
    93   switch(msg)
    94   {
    95   case WM_NCLBUTTONDOWN:
    96   case WM_LBUTTONDOWN:
    97         dwFlags |= MOUSEEVENTF_LEFTDOWN;
    98         break;
    99   case WM_NCLBUTTONUP:
    100   case WM_LBUTTONUP:
    101         dwFlags |= MOUSEEVENTF_LEFTUP;
    102         break;
    103   case WM_NCRBUTTONUP:
    104   case WM_RBUTTONUP:
    105         dwFlags |= MOUSEEVENTF_RIGHTUP;
    106         break;
    107   case WM_NCRBUTTONDOWN:
    108   case WM_RBUTTONDOWN:
    109         dwFlags |= MOUSEEVENTF_RIGHTDOWN;
    110         break;
    111   case WM_NCMBUTTONUP:
    112   case WM_MBUTTONUP:
    113         dwFlags |= MOUSEEVENTF_MIDDLEUP;
    114         break;
    115   case WM_NCMBUTTONDOWN:
    116   case WM_MBUTTONDOWN:
    117         dwFlags |= MOUSEEVENTF_MIDDLEDOWN;
    118         break;
    119   case WM_MOUSEMOVE:
    120   case WM_NCMOUSEMOVE:
    121         dwFlags |= MOUSEEVENTF_MOVE;
    122         break;
    123   default:
    124         //TODO: handle double clicks???
    125         return FALSE;
    126   }
    127 
    128   x = (((long)x << 16) + ScreenWidth-1)  / ScreenWidth;
    129   y = (((long)y << 16) + ScreenHeight-1) / ScreenHeight;
    130 
    131   return mouseHandler(dwFlags, x, y, 0, (DWORD)&mouseEvent);
    132 }
    13351//******************************************************************************
    13452//******************************************************************************
     
    290208 * Remark    :
    291209 * Status    : UNTESTED STUB
     210 *             TODO: call hooks!!
    292211 *
    293212 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
  • trunk/src/user32/winmouse.h

    r3072 r8347  
    1 /* $Id: winmouse.h,v 1.7 2000-03-09 21:50:11 sandervl Exp $ */
     1/* $Id: winmouse.h,v 1.8 2002-04-30 14:54:07 sandervl Exp $ */
    22/*
    33 * Mouse handler for DINPUT
     
    1212#define __WINMOUSE_H__
    1313
    14 extern LPMOUSE_EVENT_PROC mouseHandler;
    15 extern WNDPROC            keyboardHandler;
    16 
    17 #define ISMOUSE_CAPTURED()      (mouseHandler!=NULL)
    18 #define ISKDB_CAPTURED()        (keyboardHandler!=0)
    19 
    20 BOOL DInputMouseHandler(HWND hwnd, ULONG msg, ULONG x, ULONG y);
    21 BOOL DInputKeyBoardHandler(MSG *msg);
    22 
    2314#endif //__WINMOUSE_H__
Note: See TracChangeset for help on using the changeset viewer.