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)
This commit is contained in:
parent
b7ad86ff8a
commit
aae878b890
|
@ -894,6 +894,7 @@ static void send_nsevent(NSEvent *e) {
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
int pointer_x, pointer_y, ev_button, ev_type;
|
int pointer_x, pointer_y, ev_button, ev_type;
|
||||||
float pressure, tilt_x, tilt_y;
|
float pressure, tilt_x, tilt_y;
|
||||||
|
DeviceIntPtr pDev;
|
||||||
|
|
||||||
/* 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];
|
location = [e locationInWindow];
|
||||||
|
@ -935,10 +936,13 @@ static void send_nsevent(NSEvent *e) {
|
||||||
case NSTabletPoint: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
|
case NSTabletPoint: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
|
||||||
|
|
||||||
handle_mouse:
|
handle_mouse:
|
||||||
|
pDev = darwinPointer;
|
||||||
if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
|
if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
|
||||||
pressure = [e pressure];
|
pressure = [e pressure];
|
||||||
tilt_x = [e tilt].x;
|
tilt_x = [e tilt].x;
|
||||||
tilt_y = [e tilt].y;
|
tilt_y = [e tilt].y;
|
||||||
|
|
||||||
|
pDev = darwinTabletCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if([e subtype] == NSTabletProximityEventSubtype) {
|
if([e subtype] == NSTabletProximityEventSubtype) {
|
||||||
|
@ -958,9 +962,11 @@ static void send_nsevent(NSEvent *e) {
|
||||||
|
|
||||||
DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut,
|
DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut,
|
||||||
pointer_x, pointer_y);
|
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);
|
pressure, tilt_x, tilt_y);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -407,11 +407,10 @@ static void DarwinPrepareValuators(int *valuators, ScreenPtr screen,
|
||||||
// valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
|
// 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) {
|
float pressure, float tilt_x, float tilt_y) {
|
||||||
static int darwinFakeMouseButtonDown = 0;
|
static int darwinFakeMouseButtonDown = 0;
|
||||||
int i, num_events;
|
int i, num_events;
|
||||||
DeviceIntPtr dev;
|
|
||||||
ScreenPtr screen;
|
ScreenPtr screen;
|
||||||
int valuators[5];
|
int valuators[5];
|
||||||
|
|
||||||
|
@ -422,12 +421,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pressure == 0 && tilt_x == 0 && tilt_y == 0)
|
screen = miPointerGetScreen(pDev);
|
||||||
dev = darwinPointer;
|
|
||||||
else
|
|
||||||
dev = darwinTabletCurrent;
|
|
||||||
|
|
||||||
screen = miPointerGetScreen(dev);
|
|
||||||
if(!screen) {
|
if(!screen) {
|
||||||
DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n");
|
DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n");
|
||||||
return;
|
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 (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
|
||||||
if(darwinFakeMouseButtonDown != 0) {
|
if(darwinFakeMouseButtonDown != 0) {
|
||||||
/* We're currently "down" with another button, so release it first */
|
/* 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;
|
darwinFakeMouseButtonDown=0;
|
||||||
}
|
}
|
||||||
if (darwin_modifier_flags & darwinFakeMouse2Mask) {
|
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);
|
DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
|
||||||
darwinEvents_lock(); {
|
darwinEvents_lock(); {
|
||||||
num_events = GetPointerEvents(darwinEvents, dev, ev_type, ev_button,
|
num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
|
||||||
POINTER_ABSOLUTE, 0, dev==darwinTabletCurrent?5:2, valuators);
|
POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue (dev, &darwinEvents[i]);
|
for(i=0; i<num_events; i++) mieqEnqueue (pDev, &darwinEvents[i]);
|
||||||
DarwinPokeEQ();
|
DarwinPokeEQ();
|
||||||
} darwinEvents_unlock();
|
} darwinEvents_unlock();
|
||||||
}
|
}
|
||||||
|
@ -534,13 +528,13 @@ void DarwinSendScrollEvents(float count_x, float count_y,
|
||||||
|
|
||||||
while ((count_x > 0.0f) || (count_y > 0.0f)) {
|
while ((count_x > 0.0f) || (count_y > 0.0f)) {
|
||||||
if (count_x > 0.0f) {
|
if (count_x > 0.0f) {
|
||||||
DarwinSendPointerEvents(ButtonPress, 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(ButtonRelease, 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;
|
count_x = count_x - 1.0f;
|
||||||
}
|
}
|
||||||
if (count_y > 0.0f) {
|
if (count_y > 0.0f) {
|
||||||
DarwinSendPointerEvents(ButtonPress, 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(ButtonRelease, 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;
|
count_y = count_y - 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ Bool DarwinEQInit(void);
|
||||||
void DarwinEQEnqueue(const xEventPtr e);
|
void DarwinEQEnqueue(const xEventPtr e);
|
||||||
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
|
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
|
||||||
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
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);
|
float pressure, float tilt_x, float tilt_y);
|
||||||
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y);
|
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y);
|
||||||
void DarwinSendKeyboardEvents(int ev_type, int keycode);
|
void DarwinSendKeyboardEvents(int ev_type, int keycode);
|
||||||
|
|
Loading…
Reference in New Issue