summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2020-09-07 16:04:07 (GMT)
committermarc_culler <marc.culler@gmail.com>2020-09-07 16:04:07 (GMT)
commitbc231dc106f1dbdad5eb6bf83f1a2ef179fb72ff (patch)
treeff52ed4c9ec5c60b85264e10dbd19e5aaad31a87
parent0e5e252c47d4b11c94b2ca25e1f01a4123c85e98 (diff)
downloadtk-bc231dc106f1dbdad5eb6bf83f1a2ef179fb72ff.zip
tk-bc231dc106f1dbdad5eb6bf83f1a2ef179fb72ff.tar.gz
tk-bc231dc106f1dbdad5eb6bf83f1a2ef179fb72ff.tar.bz2
Work around the fact that we do need to process synthesized mouse events for testing
-rw-r--r--macosx/tkMacOSXMouseEvent.c10
-rw-r--r--macosx/tkMacOSXTest.c2
2 files changed, 8 insertions, 4 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 05c4e0f..15ae5ce 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -68,12 +68,16 @@ enum {
#endif
/*
- * If this event is not for a Tk toplevel, just pass it up the responder
- * chain.
+ * If this event is not for a Tk toplevel, it should just be passed up the
+ * responder chain. However, there is an exception for synthesized events,
+ * which are used in testing. Those events are recognized by having their
+ * (unused) pressure field set to the impossible value -1.0.
*/
if (![eventWindow isMemberOfClass:[TKWindow class]]) {
- return theEvent;
+ if (eventWindow && [eventWindow pressure] != -1.0) {
+ return theEvent;
+ }
}
/*
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 434504f..cefcfad 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -229,7 +229,7 @@ PressButtonObjCmd(
pt.x = loc.x = x;
pt.y = y;
loc.y = ScreenHeight - y;
- wNum = 0;
+ wNum = -1;
CGWarpMouseCursorPosition(pt);
motion = [NSEvent mouseEventWithType:NSMouseMoved
location:loc