Commit Graph

20 Commits

Author SHA1 Message Date
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Carlos Garnacho
ba988cd899 gtkgesturezoom: Do not check touchpad phase on generic events
This gesture handles both individual touch events and touchpad gesture
events, and was checking the touchpad phase in generic code paths. This
is dubious since event methods error out on the wrong GdkEventTypes.

Check the touchpad gesture phase within the branch handling touchpad
events, and make it clear which is the gesture phase of all that we are
ignoring.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2825
2020-06-10 14:30:58 +02:00
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05:00
Matthias Clasen
31bf9da63a Strip const from GdkEvent
Events are refcounted structs, and we generally don't
pass these as const.
2020-02-21 00:51:02 -05:00
Benjamin Otte
91efa37fcb zoomgesture: Port to new API model 2018-04-26 17:59:41 +02:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Debarshi Ray
7ee0e65631 GtkGestureZoom: Don't leak the list of sequences
https://bugzilla.gnome.org/show_bug.cgi?id=789149
2017-10-19 10:03:46 +02:00
Matthias Clasen
50701abcc3 gesture zoom: Use GdkEvent API 2017-09-19 18:39:03 +02:00
Carlos Garnacho
7545b908de gesture: Update to using GdkEvent API
To some extent, pad and touchpad gesture events need extra API.
2017-09-19 18:39:02 +02:00
Matthias Clasen
66f0bdee0a Intern all signal names beforehand
This avoids pointless allocations
2015-09-12 12:50:39 -04:00
Carlos Garnacho
068a844930 gtkgesturezoom: Handle touchpad pinch events
We let these through in GtkEventController::filter, and handle
these especially on GtkGesture::update.
2015-08-12 23:20:25 +02:00
Matthias Clasen
3bb404f40c Don't assert in gtk_event_controller_constructed
This prevents some of our generic object implementation tests
from working with gesture objects. Instead, add g_return_if_fail
checks in all the gesture constructors.
2014-05-27 14:33:32 -04:00
Matthias Clasen
4ce2f3e769 Silence gtk-doc warnings 2014-05-27 13:17:34 -04:00
Carlos Garnacho
9f8bd7a2bc gesturezoom: Just return a double in get_scale_delta()
Checking whether the gesture is active is a responsibility of the caller.
2014-05-27 17:47:12 +02:00
Matthias Clasen
0442431943 Docs: Cosmetic fixes 2014-05-23 19:54:33 +02:00
Matthias Clasen
42df9eda2d Prevent subclassing of gestures
For now, at least. We do this by hiding the instance and
class structures in private headers.
2014-05-23 19:54:28 +02:00
Carlos Garnacho
556eb398e5 zoom: doc fixes 2014-05-23 19:54:28 +02:00
Carlos Garnacho
c10998edb5 zoom: Add missing documentation 2014-05-23 19:54:27 +02:00
Carlos Garnacho
9db3c2d893 Add GtkGestureZoom
This gesture interprets and reports relative scale differences when fed
with events from two different GdkEventSequences.
2014-05-23 19:54:21 +02:00