Fix reversed hands scroll in Virtualization framework VM windows
This commit is contained in:
@@ -159,9 +159,15 @@ func drag(_ from: CGPoint, _ to: CGPoint) async throws {
|
||||
}
|
||||
}
|
||||
|
||||
// Marks the deltas as inverted from the device, as natural scrolling does: VM windows undo that to recover the device's
|
||||
// direction and the guest applies its own natural scrolling, so without it a scroll lands reversed there.
|
||||
let scrollDirectionInverted = CGEventField(rawValue: 137)!
|
||||
|
||||
func scroll(_ p: CGPoint, dx: Int32, dy: Int32) {
|
||||
post(CGEvent(mouseEventSource: nil, mouseType: .mouseMoved, mouseCursorPosition: p, mouseButton: .left))
|
||||
post(CGEvent(scrollWheelEvent2Source: nil, units: .line, wheelCount: 2, wheel1: dy, wheel2: dx, wheel3: 0))
|
||||
let e = CGEvent(scrollWheelEvent2Source: nil, units: .line, wheelCount: 2, wheel1: dy, wheel2: dx, wheel3: 0)
|
||||
e?.setIntegerValueField(scrollDirectionInverted, value: 1)
|
||||
post(e)
|
||||
}
|
||||
|
||||
func type(_ s: String) async throws {
|
||||
|
||||
Reference in New Issue
Block a user