summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2023-11-09 23:18:32 (GMT)
committerculler <culler>2023-11-09 23:18:32 (GMT)
commit521d6174ca0c4f1927555fa7713c89fef1c843e1 (patch)
treea3252aaf75f0fdd6c59a4e73e1e0885e0a54b478 /macosx
parent2fda4b1460a44e8d143882fc8fa3162f7ebe4c1d (diff)
downloadtk-521d6174ca0c4f1927555fa7713c89fef1c843e1.zip
tk-521d6174ca0c4f1927555fa7713c89fef1c843e1.tar.gz
tk-521d6174ca0c4f1927555fa7713c89fef1c843e1.tar.bz2
Revert text.tcl, compensate by using the MSteryFactor.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXMouseEvent.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 2adeb3c..f0bcddf 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -543,6 +543,22 @@ enum {
Tk_UpdatePointer(target, global.x, global.y, state);
}
} else {
+
+ /*
+ * For consistency with Windows behavior we are supposed to
+ * multiply the number of pixels to scroll by times 120.0.
+ * Then ::tk::MouseWheel will divide the scroll size by 120.0
+ * unless another factor is specified. The Text widget uses
+ * a factor of 4.0 in the proc which it binds to the MouseWheel
+ * event. This has the effect of making the minimum scroll
+ * size for the Text widget be 30 px. For smooth scrolling
+ * we want to scroll the Text widget by the number of pixels
+ * specified in the scrollingDelta properties of the
+ * NSScrollWheel event, not that number times 30. So
+ * instead of multiplying by 120.0 we multiply by 4.0.
+ */
+#define MSteryFactor 4.0
+
Bool deltaIsPrecise = [theEvent hasPreciseScrollingDeltas];
CGFloat delta;
XEvent xEvent = {0};
@@ -560,7 +576,7 @@ enum {
}
if (delta != 0.0) {
xEvent.xbutton.state = state;
- xEvent.xkey.keycode = delta;
+ xEvent.xkey.keycode = delta * MSteryFactor;
xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
}
@@ -570,7 +586,7 @@ enum {
}
if (delta != 0.0) {
xEvent.xbutton.state = state | ShiftMask;
- xEvent.xkey.keycode = delta;
+ xEvent.xkey.keycode = delta * MSteryFactor;
xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin));
Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
}