Class: Gtk::Gesture
- Inherits:
-
Object
- Object
- Gtk::Gesture
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#device ⇒ Gdk::Device
Returns the master Gdk::Device that is currently operating on gesture, or nil if the gesture is not being interacted.
-
#get_bounding_box(rect) ⇒ TrueClass
If there are touch sequences being currently handled by gesture, this function returns true and fills in rect with the bounding box containing all active touches.
-
#get_bounding_box_center(x, y) ⇒ TrueClass
If there are touch sequences being currently handled by gesture, this function returns true and fills in x and y with the center of the bounding box containing all active touches.
-
#get_last_event(sequence) ⇒ Gdk::Event
Returns the last event that was processed for sequence.
-
#get_point(sequence, x, y) ⇒ TrueClass
If sequence is currently being interpreted by gesture, this function returns true and fills in x and y with the last coordinates stored for that event sequence.
-
#get_sequence_state(sequence) ⇒ Gtk::EventSequenceState
Returns the sequence state, as seen by gesture.
-
#group(gesture) ⇒ nil
Adds gesture to the same group than group_gesture.
-
#handles_sequence(sequence) ⇒ TrueClass
Returns true if gesture is currently handling events corresponding to sequence.
-
#is_active ⇒ TrueClass
Returns true if the gesture is currently active.
-
#is_grouped_with(other) ⇒ TrueClass
Returns true if both gestures pertain to the same group.
-
#is_recognized ⇒ TrueClass
Returns true if the gesture is currently recognized.
-
#last_updated_sequence ⇒ Gdk::EventSequence
Returns the Gdk::EventSequence that was last updated on gesture.
-
#n_points ⇒ Integer
The number of touch points that trigger recognition on this gesture,.
-
#n_points=(n_points) ⇒ Integer
The number of touch points that trigger recognition on this gesture,.
-
#sequences ⇒ GLib::List
Returns the list of Gdk::EventSequences currently being interpreted by gesture.
-
#set_sequence_state(sequence, state) ⇒ TrueClass
Sets the state of sequence in gesture.
-
#state=(state) ⇒ TrueClass
Sets the state of all sequences that gesture is currently interacting with.
-
#ungroup ⇒ nil
Separates gesture into an isolated group.
-
#window ⇒ Gdk::Window
If non-nil, the gesture will only listen for events that happen on this Gdk::Window, or a child of it.
-
#window=(window) ⇒ Gdk::Window
If non-nil, the gesture will only listen for events that happen on this Gdk::Window, or a child of it.
Instance Method Details
#device ⇒ Gdk::Device
Returns the master Gdk::Device that is currently operating on gesture, or nil if the gesture is not being interacted.
#get_bounding_box(rect) ⇒ TrueClass
If there are touch sequences being currently handled by gesture, this function returns true and fills in rect with the bounding box containing all active touches. Otherwise, false will be returned.
Note: This function will yield unexpected results on touchpad gestures. Since there is no correlation between physical and pixel distances, these will look as if constrained in an infinitely small area, rect width and height will thus be 0 regardless of the number of touchpoints.
#get_bounding_box_center(x, y) ⇒ TrueClass
If there are touch sequences being currently handled by gesture, this function returns true and fills in x and y with the center of the bounding box containing all active touches. Otherwise, false will be returned.
#get_last_event(sequence) ⇒ Gdk::Event
Returns the last event that was processed for sequence.
Note that the returned pointer is only valid as long as the sequence is still interpreted by the gesture. If in doubt, you should make a copy of the event.
#get_point(sequence, x, y) ⇒ TrueClass
If sequence is currently being interpreted by gesture, this function returns true and fills in x and y with the last coordinates stored for that event sequence. The coordinates are always relative to the widget allocation.
#get_sequence_state(sequence) ⇒ Gtk::EventSequenceState
Returns the sequence state, as seen by gesture.
#group(gesture) ⇒ nil
Adds gesture to the same group than group_gesture. Gestures are by default isolated in their own groups.
When gestures are grouped, the state of Gdk::EventSequences is kept in sync for all of those, so calling gtk_gesture_set_sequence_state(), on one will transfer the same value to the others.
Groups also perform an “implicit grabbing” of sequences, if a Gdk::EventSequence state is set to #GTK_EVENT_SEQUENCE_CLAIMED on one group, every other gesture group attached to the same Gtk::Widget will switch the state for that sequence to #GTK_EVENT_SEQUENCE_DENIED.
#handles_sequence(sequence) ⇒ TrueClass
Returns true if gesture is currently handling events corresponding to sequence.
#is_active ⇒ TrueClass
Returns true if the gesture is currently active. A gesture is active meanwhile there are touch sequences interacting with it.
#is_grouped_with(other) ⇒ TrueClass
Returns true if both gestures pertain to the same group.
#is_recognized ⇒ TrueClass
Returns true if the gesture is currently recognized. A gesture is recognized if there are as many interacting touch sequences as required by gesture, and Gtk::Gesture::check returned true for the sequences being currently interpreted.
#last_updated_sequence ⇒ Gdk::EventSequence
Returns the Gdk::EventSequence that was last updated on gesture.
#n_points ⇒ Integer
The number of touch points that trigger recognition on this gesture,
#n_points=(n_points) ⇒ Integer
The number of touch points that trigger recognition on this gesture,
#sequences ⇒ GLib::List
Returns the list of Gdk::EventSequences currently being interpreted by gesture.
#set_sequence_state(sequence, state) ⇒ TrueClass
Sets the state of sequence in gesture. Sequences start in state #GTK_EVENT_SEQUENCE_NONE, and whenever they change state, they can never go back to that state. Likewise, sequences in state #GTK_EVENT_SEQUENCE_DENIED cannot turn back to a not denied state. With these rules, the lifetime of an event sequence is constrained to the next four:
-
None
-
None → Denied
-
None → Claimed
-
None → Claimed → Denied
Note: Due to event handling ordering, it may be unsafe to set the state on another gesture within a Gtk::Gesture::begin signal handler, as the callback might be executed before the other gesture knows about the sequence. A safe way to perform this could be:
|[ static void first_gesture_begin_cb (GtkGesture *first_gesture,
GdkEventSequence *sequence,
gpointer user_data)
gtk_gesture_set_sequence_state (first_gesture, sequence, GTK_EVENT_SEQUENCE_CLAIMED);
gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
static void second_gesture_begin_cb (GtkGesture *second_gesture,
GdkEventSequence *sequence,
gpointer user_data)
if (gtk_gesture_get_sequence_state (first_gesture, sequence) == GTK_EVENT_SEQUENCE_CLAIMED)
gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
]|
If both gestures are in the same group, just set the state on the gesture emitting the event, the sequence will be already be initialized to the group’s global state when the second gesture processes the event.
#state=(state) ⇒ TrueClass
Sets the state of all sequences that gesture is currently interacting with. See gtk_gesture_set_sequence_state() for more details on sequence states.
#ungroup ⇒ nil
Separates gesture into an isolated group.
#window ⇒ Gdk::Window
If non-nil, the gesture will only listen for events that happen on this Gdk::Window, or a child of it.
#window=(window) ⇒ Gdk::Window
If non-nil, the gesture will only listen for events that happen on this Gdk::Window, or a child of it.