diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-09-30 08:46:08 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-10-03 11:14:38 -0700 |
commit | 1657dfb843c0127ea31bfd0a8ef81d0c394cbc7b (patch) | |
tree | 623f8f4296d6a1c0252e646775212640b1488cdc /hw/xquartz/darwinEvents.c | |
parent | 88bb8c6f485a7aaf40f684d484a33cfedfa74a70 (diff) |
XQuartz: Using absolute ranges for pointer location to increase resolution and better support tablets.
(cherry picked from commit d79ccb45f68b65d65718b5b77efe2fae6eeda762)
Diffstat (limited to 'hw/xquartz/darwinEvents.c')
-rw-r--r-- | hw/xquartz/darwinEvents.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index d5d17edc3..c31dffd48 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -68,10 +68,6 @@ in this Software without prior written authorization from The Open Group. #define SCROLLWHEELLEFTFAKE 6 #define SCROLLWHEELRIGHTFAKE 7 -/* These values were chosen to match the output of xinput under Linux */ -#define SCALEFACTOR_TILT 64.0 -#define SCALEFACTOR_PRESSURE 1023.0 - #define _APPLEWM_SERVER_ #include "applewmExt.h" #include <X11/extensions/applewm.h> @@ -390,31 +386,31 @@ static void DarwinPokeEQ(void) { * display. */ static void DarwinPrepareValuators(int *valuators, ScreenPtr screen, - int pointer_x, int pointer_y, + float pointer_x, float pointer_y, float pressure, float tilt_x, float tilt_y) { /* Fix offset between darwin and X screens */ pointer_x -= darwinMainScreenX + dixScreenOrigins[screen->myNum].x; pointer_y -= darwinMainScreenY + dixScreenOrigins[screen->myNum].y; /* Setup our array of values */ - valuators[0] = pointer_x; - valuators[1] = pointer_y; - valuators[2] = pressure * SCALEFACTOR_PRESSURE; - valuators[3] = tilt_x * SCALEFACTOR_TILT; - valuators[4] = tilt_y * SCALEFACTOR_TILT; + 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; -// DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n", -// valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]); + DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n", + valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]); } -void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, int pointer_x, int pointer_y, +void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y, float pressure, float tilt_x, float tilt_y) { static int darwinFakeMouseButtonDown = 0; int i, num_events; ScreenPtr screen; int valuators[5]; -// DEBUG_LOG("x=%d, y=%d, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y); + DEBUG_LOG("x=%f, y=%f, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y); if(!darwinEvents) { DEBUG_LOG("DarwinSendPointerEvents called before darwinEvents was initialized\n"); @@ -483,13 +479,13 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) { } darwinEvents_unlock(); } -void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y) { +void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) { int i, num_events; ScreenPtr screen; DeviceIntPtr dev = darwinTabletCurrent; int valuators[5]; - DEBUG_LOG("DarwinSendProximityEvents(%d, %d, %d)\n", ev_type, pointer_x, pointer_y); + DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y); if(!darwinEvents) { DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n"); @@ -514,7 +510,7 @@ void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y) { /* Send the appropriate number of button clicks to emulate scroll wheel */ void DarwinSendScrollEvents(float count_x, float count_y, - int pointer_x, int pointer_y, + float pointer_x, float pointer_y, float pressure, float tilt_x, float tilt_y) { if(!darwinEvents) { DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n"); |