On Mon, Aug 5, 2019 at 2:19 PM Zebediah Figura zfigura@codeweavers.com wrote:
On 8/5/19 12:22 PM, Derek Lesho wrote:
What we do now is send a win32-defined INPUT structure to __wine_send_input and send_hardware_message. If we want to send raw data alongside it we'll have probably need to send in a RAWINPUT structure as well as an INPUT structure to these functions. Most invocations of __wine_send_input and send_hardware_message aren't sending raw-input data at all, but since C doesn't have optional parameters we'd have to refactor all invocations of it.
This doesn't seem particularly hard. You could even have winemac and wineandroid pass NULL, and have user32 fall back to copying from the INPUT structure in that case.
For that matter, if the only thing that actually matters is the cursor position, you don't even have to pass in a whole RAWINPUT structure, but instead just extra x/y parameters, or a POINT structure.
Take a look at patch 8, we are also sending raw mouse wheel and mouse button data, so we might as well use the RAWINPUT structure in case there are any future quirks with say rawinput keyboard messages.
As yet another alternative, we could just pass in a hw_input_t. If it were my code that's probably what I'd do.
This also doesn't solve your primary concern, which is the static variable to indicate whether we want to emulate raw-input mouse movement. Yes we could duplicate the raw-input emulation code into all the display drivers for the mouse now and the keyboard in the future, but the current solution completely avoids this, and allows display drivers that have raw-input capabilities to seamlessly send what they want.
By the "emulate_raw_mouse" variable I metonymically mean all the logic introduced by this patch series, but essentially, yes. I disagree here with this concern: I don't think deduplication should always be the primary goal, and in this case I think it makes the logic more complicated than it needs to be.
This is a matter of preference, but I think that adding 3 lines of code to disable emulation when we get native events is not overly complicated.
Besides, if ultimately the goal is to send raw input from all USER drivers (and I see no reason why this should not be the case), then there's barely any point trying to make "emulation" simpler.
(By the way, it'd be appreciated if you could bottom-post in replies.)
Sorry, I use G-Mail which top-posts by default.