XI2 DirectInput mouse implementation RFC (Tarballed)

Vitaliy Margolen wine-devel at kievinfo.com
Sun Apr 19 11:48:11 CDT 2009

Paul TBBle Hampson wrote:
> On Sun, Apr 19, 2009 at 12:46:20PM +0200, Stefan Dösinger wrote:
>> Am Sonntag, 19. April 2009 10:41:34 schrieb Paul TBBle Hampson:
>>> I've thrown together a rather-rough-but-working-in-a-limited-sense
>>> implementation of XInput2-based DirectInput.
>>> * Doesn't check for XInput2.h, so it won't build without it. (Laziness)
>>>   It will _run_ without XInput2, falling back to the current dinput
>>>   WndProc hooks even if compiled with XInput2 support.
>> I'm not that much into all the input code, but I always understood it the way 
>> that dinput should always use WndProc hooks, and winex11.drv implements the 
>> relative movement part either with XI2 or warping if XI2 is not available. 
>> Ie, there should be no difference between XI2 and legacy operation in 
>> dinput.dll. That would, I think, make native dinput work as well as the 
>> builtin one, and help apps that rely on hooks the same way native dinput 
>> does(if there are any).
>> The problem is that this means the warping has to be moved to winex11, which 
>> is something Vitaliy tried before and failed
>> I could be entirely wrong with that though. And I have no idea how that would 
>> affect mouse grabbing, or window focus issues etc.
> A WndProc hook can only work for Foreground-mode DI. In background mode,
> you still expect to get movement messages without being in a position to
Not necessarily. Hook is for raw mouse & keyboard events, and they are being
generated by the devices themselves. On native this works regardless of
where the pointer is.

> Moving the WndProc hook and mouse-warping behaviour to X11 would
> certainly be possible, and I suspect it'd end up somewhat with a mouse
> driver in dinput which is almost exactly what my gdimouse is, which is
> basically the existing mouse driver except that it feeds Acquire and
> Deacquire to X11drv and receives messages from X11drv when an event
> happens.
It would need to go into X11drv to implement another input API - RawInput.

> I haven't read Vitaly's old patches for moving mouse warping to X11drv
> recently, but I did read them a while ago. The problem with moving the
> warping to X11drv is that then every graphics driver _must_ implement
> the hooks I've added in my patches, where as right now we have a
> fallback mouse support mode which will work with any graphics driver,
> and in fact would also work on Windows (I believe) because it simply
> hooks WndProc, and does not need "real hardware" access, and has
> well-documented and under-documented limitations because of it.
You'll always have current option of receiving standard pointer events. This
doesn't go away.

> It also demonstrates another problem with current Wine DI. If you put
> its window up to the edge of the screen, and push your mouse against the
> edge of the screen, your mouse movement against the edge of the screen
> is lost.
Yup, that's one of the biggest problems with current implementation. Which
can't be resolved in non-exclusive mode without XI2.


More information about the wine-devel mailing list