summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-06 14:11:25 -0800
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-06 14:11:25 -0800
commit70930f6d31cc2ca16b40c17e101b106506a8337a (patch)
tree4a7c77127abdd889169343bce4fc51d8d69fe230
parent9ac2e68d86ed1eb6e3f6c900c60908813eca140e (diff)
XQuartz: darwinPointer reports the actual pixel position now rather than a relative position
(cherry picked from commit a41e7f75decd340d064fdc0d2c4fe6c88d7dbc82)
-rw-r--r--hw/xquartz/darwin.c6
-rw-r--r--hw/xquartz/darwinEvents.c35
2 files changed, 24 insertions, 17 deletions
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 97791e6f4..07b243ba4 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -347,10 +347,10 @@ static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
InitPointerDeviceStruct((DevicePtr)pPointer, map, 7,
(PtrCtrlProcPtr)NoopDDA,
GetMotionHistorySize(), 2);
- InitAbsoluteClassDeviceStruct(pPointer);
pPointer->valuator->mode = Absolute; // Relative
- InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitAbsoluteClassDeviceStruct(pPointer);
+// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
break;
case DEVICE_ON:
pPointer->public.on = TRUE;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 21fd76826..7fc390d1e 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -370,7 +370,7 @@ static void DarwinPokeEQ(void) {
* Note: pointer_x and pointer_y are relative to the upper-left of primary
* display.
*/
-static void DarwinPrepareValuators(int *valuators, ScreenPtr screen,
+static void DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr screen,
float pointer_x, float pointer_y,
float pressure, float tilt_x, float tilt_y) {
/* Fix offset between darwin and X screens */
@@ -382,14 +382,21 @@ static void DarwinPrepareValuators(int *valuators, ScreenPtr screen,
if(pointer_y < 0.0)
pointer_y = 0.0;
-
- /* Setup our array of values */
- valuators[0] = pointer_x * XQUARTZ_VALUATOR_LIMIT / (float)screenInfo.screens[0]->width;
- valuators[1] = pointer_y * XQUARTZ_VALUATOR_LIMIT / (float)screenInfo.screens[0]->height;
- valuators[2] = pressure * XQUARTZ_VALUATOR_LIMIT;
- valuators[3] = tilt_x * XQUARTZ_VALUATOR_LIMIT;
- valuators[4] = tilt_y * XQUARTZ_VALUATOR_LIMIT;
+ if(pDev == darwinPointer) {
+ valuators[0] = pointer_x;
+ valuators[1] = pointer_y;
+ valuators[2] = 0;
+ valuators[3] = 0;
+ valuators[4] = 0;
+ } else {
+ /* Setup our array of values */
+ valuators[0] = XQUARTZ_VALUATOR_LIMIT * (pointer_x / (float)screenInfo.screens[0]->width);
+ valuators[1] = XQUARTZ_VALUATOR_LIMIT * (pointer_y / (float)screenInfo.screens[0]->height);
+ valuators[2] = XQUARTZ_VALUATOR_LIMIT * pressure;
+ valuators[3] = XQUARTZ_VALUATOR_LIMIT * tilt_x;
+ valuators[4] = XQUARTZ_VALUATOR_LIMIT * tilt_y;
+ }
//DEBUG_LOG("Pointer (%f, %f), Valuators: {%d,%d,%d,%d,%d}\n", pointer_x, pointer_y,
// valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
}
@@ -446,7 +453,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
darwinFakeMouseButtonDown = 0;
}
- DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
darwinEvents_lock(); {
num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
@@ -473,7 +480,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
int i, num_events;
ScreenPtr screen;
- DeviceIntPtr dev = darwinTabletCurrent;
+ DeviceIntPtr pDev = darwinTabletCurrent;
int valuators[5];
DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y);
@@ -483,17 +490,17 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
return;
}
- screen = miPointerGetScreen(dev);
+ screen = miPointerGetScreen(pDev);
if(!screen) {
DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n");
return;
}
- DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f);
+ DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f);
darwinEvents_lock(); {
- num_events = GetProximityEvents(darwinEvents, dev, ev_type,
+ num_events = GetProximityEvents(darwinEvents, pDev, ev_type,
0, 5, valuators);
- for(i=0; i<num_events; i++) mieqEnqueue (dev,darwinEvents[i].event);
+ for(i=0; i<num_events; i++) mieqEnqueue (pDev,darwinEvents[i].event);
DarwinPokeEQ();
} darwinEvents_unlock();
}