https://bugs.winehq.org/show_bug.cgi?id=48252
beknonam@yevme.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |beknonam@yevme.com
--- Comment #7 from beknonam@yevme.com --- Created attachment 70457 --> https://bugs.winehq.org/attachment.cgi?id=70457 fix for negative orAltitude
The XEvents' axis_data array only updates values that have changed, and sets its size according to the maximum index of the changed axis +1.
For instance; the pointer's X value corresponds to the indice [0], the Y [1], the NormalPressure [2], and so on. If only the X value of the pointer changes then the reported size of the axis_data will be 1, axis_data[0] will hold the new X value of the pointer, and any indice after [0] will have stale data from the previous frame.
However if only the NormalPressure changes, then the reported size of the axis_data will be 3 and axis_data[2] will report the new NormalPressure, however the indices for the X and Y in the axis_data will be left unaltered as that axis has reported no change. Previously, the struct was cleared before use at each motion_event, button_event, and proximity_event, due to this whenever there was a change in a higher axis, but the the lower axis, such as X or Y were unchanged the pointer would erratically teleport to the top-left corner (0,0).
To fix this bug I added moved the memsets to the X11DRV_AttachEventQueueToTablet so that the struct would only be cleared once after initalization and not after each event callback, allowing for the previous positions to be retained when only the pressure, or Y-axis changes.
Furthermore I added simple checks to only update axis that were changed, so that axis with an index greater than the reported axis_data size will not modified. This fixes the the negative OrAltitude bug.