Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The CGEvent implementation for scroll wheel events isn't correct for ARM64 #13121

Closed
rolfbjarne opened this issue Oct 26, 2021 · 0 comments · Fixed by #20361
Closed

The CGEvent implementation for scroll wheel events isn't correct for ARM64 #13121

rolfbjarne opened this issue Oct 26, 2021 · 0 comments · Fixed by #20361
Labels
bug If an issue is a bug or a pull request a bug fix good first issue This is a good first issue for someone to start working with our code
Milestone

Comments

@rolfbjarne
Copy link
Member

Current implementation:

public CGEvent (CGEventSource source, CGScrollEventUnit units, params int [] wheel)
{
IntPtr shandle = source == null ? IntPtr.Zero : source.Handle;
switch (wheel.Length){
case 0:
throw new ArgumentException ("At least one wheel must be provided");
case 1:
handle = CGEventCreateScrollWheelEvent (shandle, units, 1, wheel [0]);
break;
case 2:
handle = CGEventCreateScrollWheelEvent (shandle, units, 2, wheel [0], wheel [1]);
break;
case 3:
handle = CGEventCreateScrollWheelEvent (shandle, units, 3, wheel [0], wheel [1], wheel [2]);
break;
default:
throw new ArgumentException ("Only one to three wheels are supported on this constructor");
}
}

This needs to take into account that varargs parameters aren't in the same place on ARM64.

Example:

if (Runtime.IsARM64CallingConvention) {
Handle = CGColorConversionInfoCreateFromList_arm64 (o, first.Space.GetHandle (), (uint) first.Transform, (int) first.Intent,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero,
second.Space.GetHandle (), (uint) second.Transform, (int) second.Intent,
third.Space.GetHandle (), (uint) third.Transform, (int) third.Intent,
IntPtr.Zero);
} else {
Handle = CGColorConversionInfoCreateFromList (o, first.Space.GetHandle (), first.Transform, first.Intent,
second.Space.GetHandle (), second.Transform, second.Intent,
third.Space.GetHandle (), third.Transform, third.Intent,
IntPtr.Zero);
}

Also we need tests for this.

@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Oct 26, 2021
@rolfbjarne rolfbjarne added this to the Future milestone Oct 26, 2021
@rolfbjarne rolfbjarne added the good first issue This is a good first issue for someone to start working with our code label Oct 26, 2021
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Mar 22, 2024
…ScrollWheelEvent. Fixes xamarin#13121.

Also add tests and documentation.

Fixes xamarin#13121.
rolfbjarne added a commit that referenced this issue Apr 5, 2024
…ScrollWheelEvent. Fixes #13121. (#20361)

Also add tests and documentation.

Fixes #13121.

---------

Co-authored-by: Alex Soto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix good first issue This is a good first issue for someone to start working with our code
Projects
None yet
1 participant