<div dir="ltr">Thank you so much for your help, I'll make the relevant changes as soon as I get home.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 23, 2019 at 10:34 AM Rémi Bernon <<a href="mailto:rbernon@codeweavers.com">rbernon@codeweavers.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, 2019-07-23 at 09:26 +0200, Rémi Bernon wrote:<br>
> On Mon, 2019-07-22 at 22:16 -0400, Derek Lesho wrote:<br>
> > Thank you for looking into this, would the solution to this problem be to<br>
> > preserve the event from the slave pointer in merge_raw_events?<br>
> > <br>
> > On Mon, Jul 22, 2019 at 10:06 AM Rémi Bernon <<a href="mailto:rbernon@codeweavers.com" target="_blank">rbernon@codeweavers.com</a>><br>
> > wrote:<br>
> > <br>
> > > It looks like that if the cursor isn't clipped by the application (or<br>
> > > by wine in fullscreen), then both master and slave XI2 device events<br>
> > > are received (on the contrary, when the cursor is clipped then for some<br>
> > > unclear reason only the slave device events are received).<br>
> > > <br>
> > > In this case, one of the events is then discarded by<br>
> > > merge_raw_motion_events in dlls/winex11.drv/event.c and as<br>
> > > X11DRV_RawMotion is designed to track only slave devices (one per<br>
> > > thread with the xi2_current_slave field AFAICS?), depending on which<br>
> > > comes first, the event might not be processed and no raw input be sent.<br>
> > > --<br>
> > > Rémi Bernon <<a href="mailto:rbernon@codeweavers.com" target="_blank">rbernon@codeweavers.com</a>><br>
> > > <br>
> <br>
> I'm still not sure how everything works in winex11.drv, but I believe<br>
> raw input implementation could use some cleanup. For instance, I don't<br>
> understand why a single slave device is selected rather than listening<br>
> to the master device events, I find it a bit unreliable that the first<br>
> slave device that sends events is selected over the others.<br>
<br>
>From <a href="http://who-t.blogspot.com/2009/06/xi2-recipes-part-3.html" rel="noreferrer" target="_blank">http://who-t.blogspot.com/2009/06/xi2-recipes-part-3.html</a> it looks<br>
like every time the user starts using a different slave device, there's<br>
a DeviceChanged event being sent, so I guess it explains why.<br>
<br>
> I would say that, for simplicity, only the master device events should<br>
> be translated, but that would require to make it send events even when<br>
> the cursor is clipped, and first understand why it doesn't (AFAICS with<br>
> some Xlib test app, there's no differences before and after calling<br>
> XGrabPointer so there's something else going on). <br>
> <br>
> If that's not possible, or for a "better" implementation, then all and<br>
> only slave devices should be listened to, and their inputs translated<br>
> to the corresponding Windows raw input messages. Also, it may be useful<br>
> to implement WM_INPUT_DEVICE_CHANGE messages on the corresponding<br>
> XInput2 events (but that may be done later and only if deemed useful).<br>
<br>
Reading the series of posts about XInput2 linked above makes me think<br>
that listening to master devices is the correct way to proceed. It will<br>
also simplify the code, as we could even simplify the event mask by<br>
using XIAllMasterDevices instead of having to filter the events.<br>
<br>
Regarding why master device events aren't sent once XGrabPointer is<br>
active only, the reason looks to be that wine advertises to support<br>
XInput 2.0 client API only. Calling XIQueryVersion with major = 2 and<br>
minor >= 1 in X11DRV_XInput2_Enable fixes the issue.<br>
<br>
With all that, I believe that you should be able to make every window<br>
thread listen to XInput2 events without worrying anymore about<br>
duplicates, and the wineserver will dispatch the events to the right<br>
windows. You could maybe decide to report the raw inputs only to the<br>
foreground window in wineserver, or implement the RIDEV_INPUTSINK flag<br>
/ RIM_INPUTSINK wParam for background raw input.<br>
-- <br>
Rémi Bernon <<a href="mailto:rbernon@codeweavers.com" target="_blank">rbernon@codeweavers.com</a>><br>
<br>
</blockquote></div>