Ignore:
Timestamp:
Aug 16, 2002, 6:49:05 PM (23 years ago)
Author:
sandervl
Message:

SetCursorPos fix for DirectInput

File:
1 edited

Legend:

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

    r8702 r9019  
    1 /* $Id: winmouse.cpp,v 1.25 2002-06-18 09:32:26 sandervl Exp $ */
     1/* $Id: winmouse.cpp,v 1.26 2002-08-16 16:49:05 sandervl Exp $ */
    22/*
    33 * Win32 mouse functions
     
    6969BOOL WIN32API SetCursorPos( int X, int Y)
    7070{
    71     BOOL ret;
    72     dprintf(("USER32: SetCursorPos (%d,%d)", X,Y));
     71    BOOL           ret;
     72    POINT          point;
     73    MSLLHOOKSTRUCT hook;
     74
     75    GetCursorPos(&point);
     76    dprintf(("USER32: SetCursorPos (%d,%d)->(%d,%d)", point.x, point.y, X,Y));
     77
     78    //The current cursor position may not have been passed to the application
     79    //just yet. The position change discards any previous events which may
     80    //lead to inconsistent mouse behaviour (like in DirectInput).
     81    //To fix this, we pass down a mouse move event to any hook handlers.
     82    hook.pt.x        = point.x;
     83    hook.pt.y        = point.y;
     84    hook.mouseData   = 0;
     85    hook.flags       = 0;
     86    hook.time        = GetCurrentTime();
     87    hook.dwExtraInfo = 0;
     88    HOOK_CallHooksW( WH_MOUSE_LL, HC_ACTION, WM_MOUSEMOVE, (LPARAM)&hook);
    7389
    7490    ret = OSLibWinSetPointerPos(X, mapScreenY(Y));
    7591    if(ret == TRUE) {
    76         MSLLHOOKSTRUCT hook;
    77 
    7892        hook.pt.x        = X;
    7993        hook.pt.y        = Y;
Note: See TracChangeset for help on using the changeset viewer.