Commit Graph

73 Commits

Author SHA1 Message Date
Matthias Clasen
c891ceb31d Docs: Clarify life cycle issue
gtk_gesture_get_last_event() wasn't very clear about how long
it is safe to use the returned pointer.
2016-05-11 13:25:15 -04:00
Matthias Clasen
0fe0ee897d gesture: Don't leak stashed events
These events were never freed.
2016-05-01 13:26:35 -04:00
Timm Bäder
c5369356e8 Various documentation fixes
Always have Since: annotations at the very bottom, use the correct
ClassName::signal-name/ClassName:property-name syntax, fix a few typos
in type names, wrong function names, non-existing type names, etc.
2016-02-08 22:56:52 +01:00
Rico Tzschichholz
76fedc1882 gtk: Fix some return-values annotations (transfer none/full) 2016-02-08 14:03:55 +01:00
Alberto Ruiz
496f0892fc introspection: This patch fixes nullable return values fixes for the following symbols in gtk
gtk_accel_group_query
  gtk_accel_group_from_accel_closure
  gtk_accel_label_get_accel_widget
  gtk_accessible_get_widget
  gtk_actionable_get_action_name
  gtk_app_chooser_get_app_info
  gtk_app_chooser_button_get_heading
  gtk_app_chooser_dialog_get_heading
  gtk_application_get_window_by_id
  gtk_assistant_get_nth_page
  gtk_binding_set_find
  gtk_builder_get_object
  gtk_builder_lookup_callback_symbol
  gtk_builder_get_application
  gtk_button_get_image
  gtk_cell_area_get_focus_from_sibling
  gtk_cell_renderer_start_editing
  gtk_cell_view_get_model
  gtk_cell_view_get_displayed_row
  gtk_clipboard_get_owner
  gtk_container_get_focus_child
  gtk_container_get_focus_vadjustment
  gtk_container_get_focus_hadjustment
  gtk_dialog_get_widget_for_response
  gtk_drag_get_source_widget
  gtk_drag_dest_get_target_list
  gtk_drag_source_get_target_list
  gtk_entry_completion_get_model
  gtk_entry_completion_compute_prefix
  gtk_expander_get_label_widget
  gtk_file_chooser_get_filename
  gtk_file_chooser_get_current_folder
  gtk_file_chooser_get_uri
  gtk_file_chooser_get_current_folder_uri
  gtk_file_chooser_get_preview_widget
  gtk_file_chooser_get_preview_file
  gtk_file_chooser_get_preview_filename
  gtk_file_chooser_get_preview_uri
  gtk_file_chooser_get_extra_widget
  gtk_file_chooser_get_filter
  gtk_file_chooser_native_get_accept_label
  gtk_file_chooser_native_get_cancel_label
  gtk_file_filter_get_name
  gtk_font_chooser_get_font_family
  gtk_font_chooser_get_font_face
  gtk_font_chooser_get_font
  gtk_font_chooser_get_font_desc
  gtk_font_chooser_get_font_map
  gtk_frame_get_label
  gtk_gesture_get_device
  gtk_gesture_get_window
  gtk_gl_area_get_error
  gtk_header_bar_get_title
  gtk_header_bar_get_subtitle
  gtk_header_bar_get_custom_title
  gtk_icon_info_get_filename
  gtk_icon_view_get_path_at_pos
  gtk_icon_view_get_model
  gtk_image_get_pixbuf
  gtk_image_get_animation
  gtk_label_get_mnemonic_widget
  gtk_label_get_attributes
  gtk_check_version
  gtk_menu_button_get_popup
  gtk_menu_button_get_menu_model
  gtk_menu_button_get_align_widget
  gtk_menu_button_get_popover
  gtk_menu_item_get_submenu
  gtk_menu_item_get_accel_path
  gtk_native_dialog_get_title
  gtk_native_dialog_get_transient_for
  gtk_notebook_get_nth_page
  gtk_notebook_get_tab_label_text
  gtk_notebook_get_menu_label
  gtk_notebook_get_menu_label_text
  gtk_notebook_get_group_name
  gtk_notebook_get_action_widget
  gtk_offscreen_window_get_surface
  gtk_offscreen_window_get_pixbuf
  gtk_paned_get_child1
  gtk_paned_get_child2
  gtk_places_sidebar_get_location
  gtk_places_sidebar_get_nth_bookmark
  gtk_plug_get_socket_window
  gtk_popover_get_default_widget
  gtk_progress_bar_get_text
  gtk_recent_filter_get_name
  gtk_recent_manager_lookup_item
  gtk_settings_get_default
  gtk_socket_get_plug_window
  gtk_stack_sidebar_get_stack
  gtk_stack_switcher_get_stack
  gtk_style_context_get_section
  gtk_style_context_get_parent
  gtk_style_context_get_frame_clock
  gtk_test_find_widget
  gtk_text_buffer_get_mark
  gtk_text_tag_table_lookup
  gtk_text_view_get_tabs
  gtk_text_view_toggle_cursor_visible
  gtk_text_view_get_window
  gtk_toolbar_get_nth_item
  gtk_tool_button_get_label
  gtk_tool_button_get_icon_name
  gtk_tool_button_get_label_widget
  gtk_tool_button_get_icon_widget
  gtk_tool_palette_get_drop_item
  gtk_tool_palette_get_drop_group
  gtk_tree_model_filter_convert_child_path_to_path
  gtk_tree_model_filter_convert_path_to_child_path
  gtk_tree_model_sort_convert_child_path_to_path
  gtk_tree_model_sort_convert_path_to_child_path
  gtk_tree_view_get_column
  gtk_tree_view_get_bin_window
  gtk_tree_view_column_get_widget
  gtk_tree_view_column_get_tree_view
  gtk_widget_get_frame_clock
  gtk_window_group_get_current_device_grab
  GtkTextBufferSerializeFunc
2016-01-08 12:18:23 +00:00
Timm Bäder
c219bdbecc Gestures: Add some nullable annotations 2015-12-12 09:29:08 +01:00
Carlos Garnacho
defa1e9c0d gesture: strengthen against destroyed windows
Bail out when we receive an event with an already destroyed window,
we'll hopefully get reset/cancelled afterwards on grab broken events.

https://bugzilla.gnome.org/show_bug.cgi?id=755352
2015-09-21 15:53:28 +02:00
Matthias Clasen
66f0bdee0a Intern all signal names beforehand
This avoids pointless allocations
2015-09-12 12:50:39 -04:00
Carlos Garnacho
dc77989a1c gtkgesture: Add note to gtk_gesture_get_bounding_box()
This is the only function that's will be semantically confusing
with touchpad gesture events, explain what's to be expected there.
2015-08-12 23:20:25 +02:00
Carlos Garnacho
e55b3c6501 gtkgesture: Add touchpad gesture event bit to the controller evmask 2015-08-12 23:20:25 +02:00
Carlos Garnacho
d756463d9b gtkgesture: Add docs blurb about touchpad gestures
Not too long though, the precautions to take are minimal.
2015-08-12 23:20:25 +02:00
Carlos Garnacho
e736e8dcb9 gtkgesture: Accumulate touchpad events' dx/dy in point data
This will make the gesture "center" the pointer position, plus
the accumulated dx/dy throughout the gesture progress.
2015-08-12 23:20:25 +02:00
Carlos Garnacho
4457be688d gtkgesture: Handle touchpad events
These will be mutually exclusive with touch events, so it won't
be possible to trigger gestures through mixed input and whatnot.

The accounting of touchpad events is slightly different, there
will be a single internal PointData struct, stored in the hashtable
with the NULL event sequence/key (same than pointer events in
this regard), just that the events stored will be GdkEventTouchpad*,
so will hold information about all fingers at once.

But this difference is just internal, the GtkGesture API doesn't
make explicit assumptions about the number of points (the closest
to a per-point query API is gtk_gesture_get_sequences()). All
signals emitted just contain the last changed GdkEventSequence,
and API takes GdkEventSequences, so everything is consistent with
sequence=NULL for touchpad events.
2015-08-12 23:20:25 +02:00
Carlos Garnacho
67ae7322e9 gtkgesture: Refactor n-points querying into a single function
Along the code, we're basically asking for 1) the total count of
touchpoints, and 2) the number of active touchpoints (not denied
nor ended).

Wrap both usecases into a _gtk_gesture_get_n_physical_touchpoints(),
and replace all occurrences.
2015-08-12 23:20:25 +02:00
Carlos Garnacho
97e67e21a1 gtkgesture: Filter out touchpad events by default.
The gestures that don't want touchpad gesture events are majority,
even those that want such events will only listen to subsets (eg.
pinch, swipe,...).

So it makes sense to ignore touchpad events by default, and let
subclasses opt those in.
2015-08-12 23:20:25 +02:00
Carlos Garnacho
8b1c9c0687 gtkgesture: Refactor gtk_gesture_handle_event()
We'll be dealing with event types and touchpad gesture phases,
replace the switch by a battery of if/elses. Otherwise, it's
just an style change.
2015-08-12 23:20:25 +02:00
Carlos Garnacho
862cac7fe6 GtkGesture: minor cleanup
We're not really using the coordinates in that function, we just
double check it's not an unrelated event.
2015-07-24 13:44:22 +02:00
Carlos Garnacho
2e52e9964b gesture: On cancel, remove touchpoint before checking the recognized state
Otherwise the touch being removed doesn't account in recognition.
2015-03-02 12:01:07 +01:00
Carlos Garnacho
3985d69735 gesture: Document pitfalls on foreign gesture state changes
Add some docs/example about the possible event handling ordering issues
that may appear on GtkGesture::begin between multiple gesture groups.
Mostly relevant for state changes.
2014-09-29 16:20:54 +02:00
Matthias Clasen
fd49340edb Trivial: reword docs a bit 2014-09-26 19:24:00 -04:00
Matthias Clasen
70bfb02fde GtkGesture: Don't leak the group link
Found in a valgrind log.
2014-06-28 20:15:12 -04:00
Carlos Garnacho
80d6735ffc gesture: Consume the event triggering ::begin if reset within the handler
If the event triggers GtkGesture::begin, and the handler ends up resetting
the gesture (say, due to taking a grab somewhere else within the handler),
still take the event as "managed", as it actually triggered recognition,
even if just to end abruptly.

https://bugzilla.gnome.org/show_bug.cgi?id=731711
2014-06-25 18:36:44 +02:00
Carlos Garnacho
c773859c99 gesture: Ensure late gestures handling the sequence get the group state
It might happen that a gesture claims a sequence before any other gesture
in its group even handled a single event from that sequence. In that case,
ensure the state is set accordingly right when the sequence is handled in
those.

The "group" gesture testcase has been updated to observe this behavior.
2014-06-03 15:59:03 +02:00
Carlos Garnacho
e0fd901722 gesture: Fix wrong assert in gtk_gesture_set_window
The window must be part of the event controller widget, so
fix the inverted logic.
2014-05-27 17:47:12 +02:00
Carlos Garnacho
d05a9f9a7b gesture: Replace gtk_gesture_attach/detach with event controller API
Event controllers now auto-attach, and the GtkCapturePhase only determines
when are events dispatched, but all controllers are managed by the widget wrt
grabs.

All callers have been updated.
2014-05-27 17:47:12 +02:00
Carlos Garnacho
2e903243c6 eventcontroller: Make the event-mask property and methods private.
This will rarely have any use if no subclassing is allowed, so just make it
private for our own.
2014-05-27 17:47:12 +02:00
Carlos Garnacho
485da90a2e gesture: Use GdkEventSequence GType in signals 2014-05-23 19:54:33 +02:00
Carlos Garnacho
7e61216105 gesture: Introspection fixes
Set annotations on return values for gtk_gesture_get_device() and
gtk_gesture_get_window().
2014-05-23 19:54:33 +02:00
Matthias Clasen
0442431943 Docs: Cosmetic fixes 2014-05-23 19:54:33 +02:00
Matthias Clasen
9f3f634c16 docs: Correct a reference 2014-05-23 19:54:33 +02:00
Matthias Clasen
c83d3f054b Revert "docs: More GtkEventController removal"
This reverts commit 75f503fb1fc9068c9e1a0d02126c55addbe8eb3e.
2014-05-23 19:54:32 +02:00
Matthias Clasen
ae5f930d1b Docs: Add information about event propagation 2014-05-23 19:54:32 +02:00
Matthias Clasen
aead8a360b Docs: Minor changes 2014-05-23 19:54:32 +02:00
Matthias Clasen
729a3a98d9 Document gtk_gesture_set_state 2014-05-23 19:54:32 +02:00
Matthias Clasen
01cd5cf382 docs: More GtkEventController removal 2014-05-23 19:54:32 +02:00
Carlos Garnacho
f322e55e19 gesture: Declare GtkGesture:window as an object property 2014-05-23 19:54:32 +02:00
Carlos Garnacho
1c48cc253d gesture: Add GTK_PHASE_TARGET
This phase is meant to run in the default widget handlers, as opposed
to externally as in the bubble/capture phase. This will be most usually
the expected phase for every controller replacing code in event handlers
in GTK+, just so invocation and triggering order is kept unaltered.
2014-05-23 19:54:30 +02:00
Carlos Garnacho
3d34f26a6a gesture: Handle GdkEventGrabBroken
That may happen separately from grab-notify, and also due to external
reasons, so ensure all sequences are cancelled if a grab is taken
in some GdkWindows that would obscure events on the controller.
2014-05-23 19:54:30 +02:00
Carlos Garnacho
fe9685bca1 widget: tighten the conditions at which a press event is emulated
Make it really sure that the event is only emitted after every gesture
that consumed the button press is done with the sequence.
The event must only be emulated if a gesture in the capture phase happened
to consume the event, be cancelled, and
2014-05-23 19:54:30 +02:00
Carlos Garnacho
2a0bf33bc9 gesture: Prevent against sequence cancellation within gtk_gesture_set_state()
Sequences may be cancelled within the ::sequence-state-changed handler, which
would change the points hashtable as it's being iterated in this function. So
iterate over a list of sequences and let the hashtable change freely.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
44a960199b gesture: Make gtk_gesture_get_last_update_time() private 2014-05-23 19:54:29 +02:00
Carlos Garnacho
83d5795154 gesture: Remove gtk_gesture_get_last_event_type 2014-05-23 19:54:29 +02:00
Carlos Garnacho
8ab35016a6 gesture: make gtk_gesture_cancel_sequence() private 2014-05-23 19:54:29 +02:00
Carlos Garnacho
0288fd0a88 gesture: Make gtk_gesture_check() private 2014-05-23 19:54:29 +02:00
Carlos Garnacho
5369c77029 gesture: Simplify gesture/widget interaction public API
The propagation phase property/methods in GtkEventController are gone,
This is now set directly on the GtkWidget add/remove controller API,
which has been made private.

The only public bit now are the new functions gtk_gesture_attach() and
gtk_gesture_detach() that will use the private API underneath.

All callers have been updated.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
db55f8a4e5 gesture: Add explanatory note in GtkGesture::end
Explain that this signal may be triggered by an extra touch that causes
the gesture to surpass GtkGesture:n-points.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
5c9f4bd078 gesture: Cancel sequences that make a gesture exceed the number of touches as they happen
This makes it possible to track those through gtk_gesture_handles_sequence(),
without guessing from last event type or sequence state.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
e080eafef8 gesture: Handle GDK_TOUCH_CANCEL events
The wayland windowing backend emits such events for instance, so
have gestures cancel the sequence as those events get through.
2014-05-23 19:54:29 +02:00
Carlos Garnacho
d9e6395ee9 gesture: Protect against odd window hierarchies
If no match is found with the gesture widget when poking the event
window parents, bail out safely instead of falling in an infinite
loop. This was seen on Mutter.
2014-05-23 19:54:29 +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