Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Mitch, how hard would it be to expose the Zoom gesture in GTK?
For all clarity, you mean the two-finger pinch gesture that is exposed through NSEventTypeMagnify, right?
I would think we can handle this for example by adding a new GdkEvent. Perhaps Mitch has a different idea of how this is best handled.
Yes, the trackpad gestures appear to be handleable via overridable methods on NSResponder. Swipe and Rotate may be useful too.
Link to Apple docs, for reference:
It's absolutely no problem to add a new event, I'm just afraid
we're accumulating special hacks that won't make porting to gtk3
easier at some point :)
Yes, that's a valid concern. How would we do this in an xplat way that could be landed into GTK3?
I think in GTK+ 3, you would either use the GTK+/GDK-based gesture framework that is in the works. Or we need to make sure the GTK+/GDK-based gesture framework can "forward" existing native gestures without trying to re-invent the wheel.
This is not something that is easily backported to GTK+ 2.x, that is why I suggested to look into a GdkEvent-based approach.
Created attachment 1954 [details]
This patch seems to do the trick, it comes with a simple test program (test gestures).
If you want to see the test program in action, see http://lanedo.com/~kris/testgestures.mov All three gestures are used: magnify (pinch), rotate and (three finger) swipe.
Items of consideration:
- Currently there are three different events for Magnify, Rotate, Swipe. Seemed cleanest to me, though merging into a single event is possible if desired.
- Perhaps we want to prefix the event names with "gesture-" to avoid possible namespace clashes? So you get gesture-magnify-event and GDK_GESTURE_MAGNIFY.
- Double check the event handling, but it seems to be doing the trick.
I will ask Mitch to review the code so it has seen two pairs of eyes.
About GTK+ 3 support; this patch will never make it upstream because a proper, generic gesture framework is in the works. What would be needed to do this in GTK+ 3 is:
- The gesture framework has to be landed in GTK+ 3.
- We need a GdkDevice class specific to the OS X touchpad API, such that multi touch events can be fed into the gesture framework. (Two years ago I started working on this, but didn't complete it. The code which I still have around somewhere could work as a foundation to get this completed).
Until the gesture framework is in GTK+ 3, the proposed patch could also be applied to have a custom GTK+ 3 distribution.
This looks very proper to me.
Thanks, I've been able to apply it in bockbuild and build successfully.
The gesture- prefix sounds good. I don't know about merging into a single event. One thing that would be useful would be a gdk_supports_quartz_gestures() function, so we can test for the existence of the functionality before using the signal enum values.
Next, we'll have to add wrappers in GtkWorkarounds, and consume them from the zoomable widgets (text editor and pad trees).
Created attachment 1965 [details]
Updated patch, changes:
- Prefix event names and signal names with "gesture-"
- Added symbol gdk_quartz_supports_gesture_events() so availability of functionality can be checked by attempting to resolve the symbol.
The patch works great, thanks!
I had some trouble debugging marshalling the event into managed code, and it turned out Mono's struct layout didn't match the gcc one - it was trying to align the doubles to 8 bytes (filed as bug 5405). I was able to fix that without C getter functions, by overriding the struct packing, but it'll probably cause problems if/when we do a 64-bit port. But that's incredibly low on the priority list right now, and we have a bunch of similar cases in MD already, so IMO we should leave the patch as-is.
I've landed the patch in bockbuild and landed the wrapper code in MD. I'll land the patches for text editor zoom support after some cleanup.
Fixed in master.
This feels pretty horrid, guys...