XQuartz: Fix mouse tracking for quake, et. al. in wine
Patch courtesy of Codeweavers Fix mouse movement tracking. For a non-window-related mouse-move event, calculate the new position by adding the event's delta-x and delta-y values to the previous mouse position. Do not rely on the current mouse position because it may have been changed by a XWarpPointer call. (cherry picked from commit 7a67935b05a475215b9bdbb959e4f7e15f32416f)
This commit is contained in:
parent
c74220b853
commit
0b6e14d46f
|
@ -961,26 +961,34 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
|
||||||
DeviceIntPtr pDev;
|
DeviceIntPtr pDev;
|
||||||
int modifierFlags;
|
int modifierFlags;
|
||||||
|
|
||||||
|
static NSPoint lastpt;
|
||||||
|
|
||||||
/* convert location to be relative to top-left of primary display */
|
/* convert location to be relative to top-left of primary display */
|
||||||
location = [e locationInWindow];
|
|
||||||
window = [e window];
|
window = [e window];
|
||||||
screen = [[[NSScreen screens] objectAtIndex:0] frame];
|
|
||||||
|
|
||||||
if (window != nil) {
|
if (window != nil) {
|
||||||
NSRect frame = [window frame];
|
NSRect frame = [window frame];
|
||||||
pointer_x = location.x + frame.origin.x;
|
location = [e locationInWindow];
|
||||||
pointer_y = (screen.origin.y + screen.size.height)
|
location.x += frame.origin.x;
|
||||||
- (location.y + frame.origin.y);
|
location.y += frame.origin.y;
|
||||||
|
lastpt = location;
|
||||||
} else {
|
} else {
|
||||||
pointer_x = location.x;
|
location.x = lastpt.x + [e deltaX];
|
||||||
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
location.y = lastpt.y - [e deltaY];
|
||||||
|
lastpt = [NSEvent mouseLocation];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Convert coordinate system */
|
||||||
|
screen = [[[NSScreen screens] objectAtIndex:0] frame];
|
||||||
|
location.y = (screen.origin.y + screen.size.height) - location.y;
|
||||||
|
|
||||||
/* Setup our valuators. These will range from 0 to 1 */
|
/* Setup our valuators. These will range from 0 to 1 */
|
||||||
pressure = 0;
|
pressure = 0;
|
||||||
tilt_x = 0;
|
tilt_x = 0;
|
||||||
tilt_y = 0;
|
tilt_y = 0;
|
||||||
|
pointer_x = location.x;
|
||||||
|
pointer_y = location.y;
|
||||||
|
|
||||||
modifierFlags = [e modifierFlags];
|
modifierFlags = [e modifierFlags];
|
||||||
|
|
||||||
#ifdef NX_DEVICELCMDKEYMASK
|
#ifdef NX_DEVICELCMDKEYMASK
|
||||||
|
|
Loading…
Reference in New Issue