Skip to content

Commit f219b72

Browse files
Fix the sign of x wheel events in OSX to be inline with "natural scrolling" preference.
- The VM should generate positive deltaX for Left to Right trackpad motion - The VM should generate positive deltaY for Bottom to Up trackpad motion For historical reasons, if VM does not send mouse wheel events, but fake keyboard arrow events, then: - The VM should generate a left arrow key for Left to Right trackpad motion - The VM should generate a bottom arrow key for Bottom to Up trackpad motion Not that the preferred direction preference of OSX is taken into account by the VM See https://developer.apple.com/documentation/appkit/nsevent/1525151-isdirectioninvertedfromdevice Above description is for "natural scrolling" preference (the trackpad does drag the screen contents). It will be inverted if the preference is unset (the trackpad does drag the scroll bar). Note that the `isFlipped` method of the Cocoa/Quartz view presumably ha an impact on sign of vertical motions See https://developer.apple.com/documentation/appkit/nsview/1483532-isflipped OpenSmalltalk VM does use isFlipped YES.
1 parent 9f4fae8 commit f219b72

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,10 @@ - (void) recordWheelEvent:(NSEvent *) theEvent fromView: (NSView <sqSqueakOSXVie
310310
evt.type = EventTypeMouseWheel;
311311
evt.timeStamp = ioMSecs();
312312

313-
evt.x = prevXDelta;
314-
evt.y = prevYDelta;
313+
/* Note: if natural scrolling preference is enabled, the VM should generate a positive x for motion from left to right
314+
* and a positive y for a motion from bottom to up */
315+
evt.x = - prevXDelta; /* we have to change the x convention, presumably because natural is inverted */
316+
evt.y = + prevYDelta; /* but not that of y presumably because the view isFlipped (see implementation of isFlipped) */
315317

316318
prevXDelta = 0;
317319
prevYDelta = 0;

0 commit comments

Comments
 (0)