summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2012-04-19 16:38:06 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2012-04-23 20:20:42 -0700
commite34519e525559b01a63d26639f13f0487468de28 (patch)
tree55d9389f79d5d15da92929246e07873ad0e4b349
parent662d41acdde1dcb9774fbe4054e251c708acaffe (diff)
XQuartz: darwinPointer now sends both absolute and relative motion
This should hopefully help out wine clients that were continuing to have issues after the earlier changes. http://xquartz.macosforge.org/trac/ticket/548 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--hw/xquartz/X11Application.m12
-rw-r--r--hw/xquartz/darwin.c57
-rw-r--r--hw/xquartz/darwinEvents.c36
-rw-r--r--hw/xquartz/darwinEvents.h3
4 files changed, 56 insertions, 52 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2a9ad73ad..0c3283ed0 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -215,7 +215,8 @@ message_kit_thread(SEL selector, NSObject *arg)
if (state) {
if (bgMouseLocationUpdated) {
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
- bgMouseLocation.x, bgMouseLocation.y);
+ bgMouseLocation.x, bgMouseLocation.y,
+ 0.0, 0.0);
bgMouseLocationUpdated = FALSE;
}
DarwinSendDDXEvent(kXquartzActivate, 0);
@@ -1595,14 +1596,16 @@ handle_mouse:
if (bgMouseLocationUpdated) {
if (!(ev_type == MotionNotify && ev_button == 0)) {
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
- location.x, location.y);
+ location.x, location.y,
+ 0.0, 0.0);
}
bgMouseLocationUpdated = FALSE;
}
if (pDev == darwinPointer) {
DarwinSendPointerEvents(pDev, ev_type, ev_button,
- location.x, location.y);
+ location.x, location.y,
+ [e deltaX], [e deltaY]);
} else {
DarwinSendTabletEvents(pDev, ev_type, ev_button,
location.x, location.y, pressure,
@@ -1667,7 +1670,8 @@ handle_mouse:
if (!XQuartzServerVisible && noTestExtensions) {
bgMouseLocationUpdated = FALSE;
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
- location.x, location.y);
+ location.x, location.y,
+ 0.0, 0.0);
}
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 03030ad22..41db72af8 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -309,7 +309,7 @@ static int
DarwinMouseProc(DeviceIntPtr pPointer, int what)
{
#define NBUTTONS 3
-#define NAXES 4
+#define NAXES 6
// 3 buttons: left, middle, right
CARD8 map[NBUTTONS + 1] = { 0, 1, 2, 3};
Atom btn_labels[NBUTTONS] = { 0 };
@@ -323,10 +323,12 @@ DarwinMouseProc(DeviceIntPtr pPointer, int what)
btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
- axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL);
- axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL);
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+ axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL);
+ axes_labels[5] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL);
// Set button map.
InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
@@ -334,21 +336,27 @@ DarwinMouseProc(DeviceIntPtr pPointer, int what)
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), NAXES,
axes_labels);
- InitValuatorAxisStruct(pPointer, 0, axes_labels[0],
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0],
NO_AXIS_LIMITS, NO_AXIS_LIMITS,
- 1, 0, 1, Relative);
- InitValuatorAxisStruct(pPointer, 1, axes_labels[1],
+ 0, 0, 0, Absolute);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1],
NO_AXIS_LIMITS, NO_AXIS_LIMITS,
- 1, 0, 1, Relative);
+ 0, 0, 0, Absolute);
InitValuatorAxisStruct(pPointer, 2, axes_labels[2],
NO_AXIS_LIMITS, NO_AXIS_LIMITS,
1, 0, 1, Relative);
InitValuatorAxisStruct(pPointer, 3, axes_labels[3],
NO_AXIS_LIMITS, NO_AXIS_LIMITS,
1, 0, 1, Relative);
+ InitValuatorAxisStruct(pPointer, 4, axes_labels[4],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS,
+ 1, 0, 1, Relative);
+ InitValuatorAxisStruct(pPointer, 5, axes_labels[5],
+ NO_AXIS_LIMITS, NO_AXIS_LIMITS,
+ 1, 0, 1, Relative);
- SetScrollValuator(pPointer, 2, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
- SetScrollValuator(pPointer, 3, SCROLL_TYPE_HORIZONTAL, -1.0, SCROLL_FLAG_NONE);
+ SetScrollValuator(pPointer, 4, SCROLL_TYPE_VERTICAL, -1.0, SCROLL_FLAG_PREFERRED);
+ SetScrollValuator(pPointer, 5, SCROLL_TYPE_HORIZONTAL, -1.0, SCROLL_FLAG_NONE);
break;
case DEVICE_ON:
@@ -399,23 +407,24 @@ DarwinTabletProc(DeviceIntPtr pPointer, int what)
axes_labels);
InitProximityClassDeviceStruct(pPointer);
- InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0,
- XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
- Absolute);
- InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0,
- XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
- Absolute);
- InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0,
- XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
- Absolute);
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0],
+ 0, XQUARTZ_VALUATOR_LIMIT,
+ 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1],
+ 0, XQUARTZ_VALUATOR_LIMIT,
+ 1, 0, 1, Absolute);
+ InitValuatorAxisStruct(pPointer, 2, axes_labels[2],
+ 0, XQUARTZ_VALUATOR_LIMIT,
+ 1, 0, 1, Absolute);
InitValuatorAxisStruct(pPointer, 3, axes_labels[3],
-XQUARTZ_VALUATOR_LIMIT,
- XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
- Absolute);
+ XQUARTZ_VALUATOR_LIMIT,
+ 1, 0, 1, Absolute);
InitValuatorAxisStruct(pPointer, 4, axes_labels[4],
-XQUARTZ_VALUATOR_LIMIT,
- XQUARTZ_VALUATOR_LIMIT, 1, 0, 1,
- Absolute);
+ XQUARTZ_VALUATOR_LIMIT,
+ 1, 0, 1, Absolute);
+
// pPointer->use = IsXExtensionDevice;
break;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 25f011be9..b41c6fdac 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -74,12 +74,6 @@
#include <IOKit/hidsystem/IOLLEvent.h>
-/* Fake button press/release for scroll wheel move. */
-#define SCROLLWHEELUPFAKE 4
-#define SCROLLWHEELDOWNFAKE 5
-#define SCROLLWHEELLEFTFAKE 6
-#define SCROLLWHEELRIGHTFAKE 7
-
#include <X11/extensions/applewmconst.h>
#include "applewmExt.h"
@@ -497,12 +491,6 @@ DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
pointer_x -= darwinMainScreenX + screen->x;
pointer_y -= darwinMainScreenY + screen->y;
- if (pointer_x < 0.0)
- pointer_x = 0.0;
-
- if (pointer_y < 0.0)
- pointer_y = 0.0;
-
/* Adjust our pointer location to the [0,1] range */
pointer_x = pointer_x / (double)screenInfo.width;
pointer_y = pointer_y / (double)screenInfo.height;
@@ -528,7 +516,8 @@ DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
void
DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
- double pointer_x, double pointer_y)
+ double pointer_x, double pointer_y,
+ double pointer_dx, double pointer_dy)
{
static int darwinFakeMouseButtonDown = 0;
ScreenPtr screen;
@@ -553,7 +542,7 @@ DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
/* We're currently "down" with another button, so release it first */
DarwinSendPointerEvents(pDev, ButtonRelease,
darwinFakeMouseButtonDown,
- pointer_x, pointer_y);
+ pointer_x, pointer_y, 0.0, 0.0);
darwinFakeMouseButtonDown = 0;
}
if (darwin_all_modifier_flags & darwinFakeMouse2Mask) {
@@ -591,22 +580,23 @@ DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
pointer_x -= darwinMainScreenX + screen->x;
pointer_y -= darwinMainScreenY + screen->y;
- if (pointer_x < 0.0)
- pointer_x = 0.0;
-
- if (pointer_y < 0.0)
- pointer_y = 0.0;
-
valuator_mask_zero(&valuators);
valuator_mask_set_double(&valuators, 0, pointer_x);
valuator_mask_set_double(&valuators, 1, pointer_y);
+ if (ev_type == MotionNotify) {
+ if (pointer_dx != 0.0)
+ valuator_mask_set_double(&valuators, 2, pointer_dx);
+ if (pointer_dy != 0.0)
+ valuator_mask_set_double(&valuators, 3, pointer_dy);
+ }
+
darwinEvents_lock();
{
QueuePointerEvents(pDev, ev_type, ev_button, POINTER_ABSOLUTE,
&valuators);
DarwinPokeEQ();
- } darwinEvents_unlock();
+ } darwinEvents_unlock();
}
void
@@ -647,8 +637,8 @@ DarwinSendScrollEvents(double scroll_x, double scroll_y) {
}
valuator_mask_zero(&valuators);
- valuator_mask_set_double(&valuators, 2, scroll_y);
- valuator_mask_set_double(&valuators, 3, scroll_x);
+ valuator_mask_set_double(&valuators, 4, scroll_y);
+ valuator_mask_set_double(&valuators, 5, scroll_x);
darwinEvents_lock();
{
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 812a5dc32..448e730bc 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -49,7 +49,8 @@ DarwinSendTabletEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
double tilt_x, double tilt_y);
void
DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button,
- double pointer_x, double pointer_y);
+ double pointer_x, double pointer_y,
+ double pointer_dx, double pointer_dy);
void
DarwinSendKeyboardEvents(int ev_type, int keycode);
void