summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-09-29 22:26:20 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-10-03 11:13:03 -0700
commitaae878b89081ffba16386e8d4987469313049bea (patch)
tree41a3ef58c0aab0aa81a23edac02e99e110506de6
parentb7ad86ff8a9115147c0cf02af9e80ec464129392 (diff)
XQuartz: Actually send the pointer event from the pen even if it happes to actually have 0 pressure and 0 tilt.
(cherry picked from commit f41583761955cb9c92c43239bfaa8ae0e5d95e33)
-rw-r--r--hw/xquartz/X11Application.m12
-rw-r--r--hw/xquartz/darwinEvents.c26
-rw-r--r--hw/xquartz/darwinEvents.h2
3 files changed, 20 insertions, 20 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 0436db8f9..6ca697583 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -894,6 +894,7 @@ static void send_nsevent(NSEvent *e) {
NSWindow *window;
int pointer_x, pointer_y, ev_button, ev_type;
float pressure, tilt_x, tilt_y;
+ DeviceIntPtr pDev;
/* convert location to be relative to top-left of primary display */
location = [e locationInWindow];
@@ -935,10 +936,13 @@ static void send_nsevent(NSEvent *e) {
case NSTabletPoint: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
handle_mouse:
+ pDev = darwinPointer;
if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
pressure = [e pressure];
tilt_x = [e tilt].x;
- tilt_y = [e tilt].y;
+ tilt_y = [e tilt].y;
+
+ pDev = darwinTabletCurrent;
}
if([e subtype] == NSTabletProximityEventSubtype) {
@@ -958,9 +962,11 @@ static void send_nsevent(NSEvent *e) {
DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut,
pointer_x, pointer_y);
+
+ pDev = darwinTabletCurrent;
}
-
- DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
+
+ DarwinSendPointerEvents(pDev, ev_type, ev_button, pointer_x, pointer_y,
pressure, tilt_x, tilt_y);
break;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 92179d38c..d5d17edc3 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -407,11 +407,10 @@ static void DarwinPrepareValuators(int *valuators, ScreenPtr screen,
// valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
}
-void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
+void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y) {
static int darwinFakeMouseButtonDown = 0;
int i, num_events;
- DeviceIntPtr dev;
ScreenPtr screen;
int valuators[5];
@@ -422,12 +421,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
return;
}
- if (pressure == 0 && tilt_x == 0 && tilt_y == 0)
- dev = darwinPointer;
- else
- dev = darwinTabletCurrent;
-
- screen = miPointerGetScreen(dev);
+ screen = miPointerGetScreen(pDev);
if(!screen) {
DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n");
return;
@@ -437,7 +431,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
if(darwinFakeMouseButtonDown != 0) {
/* We're currently "down" with another button, so release it first */
- DarwinSendPointerEvents(ButtonRelease, darwinFakeMouseButtonDown, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(pDev, ButtonRelease, darwinFakeMouseButtonDown, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
darwinFakeMouseButtonDown=0;
}
if (darwin_modifier_flags & darwinFakeMouse2Mask) {
@@ -467,9 +461,9 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
darwinEvents_lock(); {
- num_events = GetPointerEvents(darwinEvents, dev, ev_type, ev_button,
- POINTER_ABSOLUTE, 0, dev==darwinTabletCurrent?5:2, valuators);
- for(i=0; i<num_events; i++) mieqEnqueue (dev, &darwinEvents[i]);
+ num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
+ POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue (pDev, &darwinEvents[i]);
DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -534,13 +528,13 @@ void DarwinSendScrollEvents(float count_x, float count_y,
while ((count_x > 0.0f) || (count_y > 0.0f)) {
if (count_x > 0.0f) {
- DarwinSendPointerEvents(ButtonPress, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- DarwinSendPointerEvents(ButtonRelease, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_x, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
count_x = count_x - 1.0f;
}
if (count_y > 0.0f) {
- DarwinSendPointerEvents(ButtonPress, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
- DarwinSendPointerEvents(ButtonRelease, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(darwinPointer, ButtonPress, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+ DarwinSendPointerEvents(darwinPointer, ButtonRelease, sign_y, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
count_y = count_y - 1.0f;
}
}
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 61efa7526..003f5faa8 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -32,7 +32,7 @@ Bool DarwinEQInit(void);
void DarwinEQEnqueue(const xEventPtr e);
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
-void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
+void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, int pointer_x, int pointer_y,
float pressure, float tilt_x, float tilt_y);
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y);
void DarwinSendKeyboardEvents(int ev_type, int keycode);