-
Notifications
You must be signed in to change notification settings - Fork 514
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
macOS: Missing bindings for CGEvent & NSEvent APIs #12650
Comments
It's
CGEvent is defined in the documentation as opaque type. Essentially this uses the
That would be
There's static method |
Thanks for the quick response.
Maybe it is possible to adjust the type of the
Here it would be desired if the
Would be very much appreciated if it could be added in a future release!
Thanks - I must have missed that one. But again, it uses a |
Is there any hope the
|
I'll have a look. |
Thanks! I just managed to workaround the missing bindings myself somehow:
Ideally, I could transform this code to the following:
Besides the missing bindings, the
|
Create a better binding for `[NSEvent eventWithGCEvent:]` by binding it as `NSEvent.Create(CGEvent)` instead of `NSEvent.EventWithGCEvent(IntPtr)`. Partial fix for xamarin#12650.
Provide an NSEvent.GetCGEventObject method that returns the CGEvent object for the NSEvent.CGEvent field (which returns a NativeHandle). Contributes towards xamarin#12650.
…alueField. Fixes xamarin#12650. Also expose both getter and setter methods using the enum itself, so we don't have to make getter and setter properties for each of the enum fields. This required making CGEventField a public enum, so do that. And finally document all the new APIs, and some of the old ones. Fixes xamarin#12650.
…alueField. Fixes xamarin#12650. (xamarin#20424) Also expose both getter and setter methods using the enum itself, so we don't have to make getter and setter properties for each of the enum fields. This required making CGEventField a public enum, so do that. And finally document all the new APIs, and some of the old ones. Fixes xamarin#12650.
Provide an NSEvent.GetCGEventObject method that returns the CGEvent object for the NSEvent.CGEvent field (which returns a NativeHandle). Contributes towards #12650.
I am trying to do what is described here in Xamarin:
https://isapozhnik.com/articles/how-to-swap-horizontal-and-vertical-scroll-in-nsscrollview/
In my app, I want to make a horizontal scrollview to respond to mouse wheel interaction.
Unfortunately, I am hitting a few obstacles while "translating" the code to Xamarin & C#:
if event.subtype == .mouseEvent
subtype is of type
short
andNSEventSubtype
doesn't have "mouse" valueif let cgEvent = event.cgEvent?.copy() {
cgEvent is of type
IntPtr
and notCGEvent
- I need to call the constructor of CGEvent myselfcgEvent.setDoubleValueField(.scrollWheelEventDeltaAxis2, value: Double(event.scrollingDeltaY))
setDoubleValueField
does not exist in the Xamarin APIif let event = NSEvent(cgEvent: cgEvent) {
I am unable to create a
NSEvent
from aCGEvent
. The constructor does not existEnvironment
The text was updated successfully, but these errors were encountered: