Merge branch 'gesture-click' into 'master'

Rename GtkGestureMultiPress to GtkGestureClick

See merge request GNOME/gtk!878
This commit is contained in:
Matthias Clasen 2019-05-29 18:39:09 +00:00
commit 90f330e27a
69 changed files with 684 additions and 673 deletions

View File

@ -80,7 +80,7 @@ find_toplevel_at_pointer (GdkDisplay *display)
}
static void
released_cb (GtkGestureMultiPress *gesture,
released_cb (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -123,7 +123,7 @@ query_for_toplevel (GdkDisplay *display,
GDK_SEAT_CAPABILITY_ALL_POINTING,
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
{
GtkGesture *gesture = gtk_gesture_multi_press_new ();
GtkGesture *gesture = gtk_gesture_click_new ();
gboolean clicked = FALSE;
g_signal_connect (gesture, "released",

View File

@ -319,7 +319,7 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (drag_data_received), image);
/* context menu on image */
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
@ -344,7 +344,7 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (drag_data_received), image);
/* context menu on image */
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));

View File

@ -250,7 +250,7 @@ static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (DemoTaggedEntryTag, demo_tagged_entry_tag, GTK_TYPE_WIDGET)
static void
on_released (GtkGestureMultiPress *gesture,
on_released (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -270,7 +270,7 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
tag->label = gtk_label_new ("");
gtk_container_add (GTK_CONTAINER (tag->box), tag->label);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag);
gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture));

View File

@ -356,7 +356,7 @@ do_dnd (GtkWidget *do_widget)
gtk_widget_set_hexpand (fixed, TRUE);
gtk_widget_set_vexpand (fixed, TRUE);
multipress = gtk_gesture_multi_press_new ();
multipress = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (multipress), 0);
g_signal_connect (multipress, "pressed", G_CALLBACK (pressed_cb), NULL);
g_signal_connect (multipress, "released", G_CALLBACK (released_cb), NULL);

View File

@ -136,7 +136,7 @@ static void set_cursor_if_appropriate (GtkTextView *text_view,
gint y);
static void
released_cb (GtkGestureMultiPress *gesture,
released_cb (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -247,7 +247,7 @@ do_hypertext (GtkWidget *do_widget)
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), view);
gtk_widget_add_controller (view, controller);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_multi_press_new ());
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
g_signal_connect (controller, "released",
G_CALLBACK (released_cb), view);
gtk_widget_add_controller (view, controller);

View File

@ -218,7 +218,7 @@ puzzle_key_pressed (GtkEventControllerKey *controller,
}
static void
puzzle_button_pressed (GtkGestureMultiPress *gesture,
puzzle_button_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -302,7 +302,7 @@ start_puzzle (GdkPaintable *puzzle)
grid);
gtk_widget_add_controller (GTK_WIDGET (grid), controller);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_multi_press_new ());
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
g_signal_connect (controller, "pressed",
G_CALLBACK (puzzle_button_pressed),
grid);

View File

@ -1284,7 +1284,7 @@ textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *butt
}
static gboolean
osd_frame_pressed (GtkGestureMultiPress *gesture,
osd_frame_pressed (GtkGestureClick *gesture,
int press,
double x,
double y,

View File

@ -2962,7 +2962,7 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<signal name="pressed" handler="osd_frame_pressed" object="osd_frame" swapped="no"/>
</object>
</child>

View File

@ -332,7 +332,7 @@
<xi:include href="xml/gtkgesturesingle.xml" />
<xi:include href="xml/gtkgesturedrag.xml" />
<xi:include href="xml/gtkgesturelongpress.xml" />
<xi:include href="xml/gtkgesturemultipress.xml" />
<xi:include href="xml/gtkgestureclick.xml" />
<xi:include href="xml/gtkgesturepan.xml" />
<xi:include href="xml/gtkgestureswipe.xml" />
<xi:include href="xml/gtkgesturerotate.xml" />

View File

@ -6720,23 +6720,23 @@ gtk_gesture_long_press_get_type
</SECTION>
<SECTION>
<FILE>gtkgesturemultipress</FILE>
<TITLE>GtkGestureMultiPress</TITLE>
GtkGestureMultiPress
gtk_gesture_multi_press_new
gtk_gesture_multi_press_set_area
gtk_gesture_multi_press_get_area
<FILE>gtkgestureclick</FILE>
<TITLE>GtkGestureClick</TITLE>
GtkGestureClick
gtk_gesture_click_new
gtk_gesture_click_set_area
gtk_gesture_click_get_area
<SUBSECTION Standard>
GTK_TYPE_GESTURE_MULTI_PRESS
GTK_GESTURE_MULTI_PRESS
GTK_GESTURE_MULTI_PRESS_CLASS
GTK_IS_GESTURE_MULTI_PRESS
GTK_IS_GESTURE_MULTI_PRESS_CLASS
GTK_GESTURE_MULTI_PRESS_GET_CLASS
GTK_TYPE_GESTURE_CLICK
GTK_GESTURE_CLICK
GTK_GESTURE_CLICK_CLASS
GTK_IS_GESTURE_CLICK
GTK_IS_GESTURE_CLICK_CLASS
GTK_GESTURE_CLICK_GET_CLASS
<SUBSECTION Private>
gtk_gesture_multi_press_get_type
gtk_gesture_click_get_type
</SECTION>
<SECTION>

View File

@ -75,9 +75,9 @@ gtk_font_chooser_dialog_get_type
gtk_font_chooser_widget_get_type
gtk_frame_get_type
gtk_gesture_get_type
gtk_gesture_click_get_type
gtk_gesture_drag_get_type
gtk_gesture_long_press_get_type
gtk_gesture_multi_press_get_type
gtk_gesture_pan_get_type
gtk_gesture_rotate_get_type
gtk_gesture_single_get_type

View File

@ -331,6 +331,21 @@
</para>
</section>
<section>
<title>Adapt to event controller API changes</title>
<para>
A few changes to the event controller and #GtkGesture APIs
did not make it back to GTK3, and have to be taken into account
when moving to GTK4. One is that the
#GtkEventControllerMotion::enter,
#GtkEventControllerMotion::leave,
#GtkEventControllerKey::focus-in and
#GtkEventControllerKey::focus-out signals
have gained new arguments. Another is that #GtkGestureMultiPress
has been renamed to #GtkGestureClick.
</para>
</section>
<section>
<title>Stop using GtkEventBox</title>
<para>

View File

@ -110,7 +110,7 @@ drag_end (GtkGestureDrag *gesture,
}
static void
pressed (GtkGestureMultiPress *gesture,
pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -164,7 +164,7 @@ activate (GtkApplication *app,
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), drawing_area);
g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), drawing_area);
press = gtk_gesture_multi_press_new ();
press = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (press), GDK_BUTTON_SECONDARY);
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (press));

View File

@ -85,7 +85,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGLArea, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGesture, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureDrag, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureLongPress, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureMultiPress, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureClick, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGesturePan, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureRotate, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkGestureSingle, g_object_unref)

View File

@ -119,9 +119,9 @@
#include <gtk/gtkfontchooserwidget.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkgesture.h>
#include <gtk/gtkgestureclick.h>
#include <gtk/gtkgesturedrag.h>
#include <gtk/gtkgesturelongpress.h>
#include <gtk/gtkgesturemultipress.h>
#include <gtk/gtkgesturepan.h>
#include <gtk/gtkgesturerotate.h>
#include <gtk/gtkgesturesingle.h>

View File

@ -60,7 +60,7 @@
#include "gtkdialogprivate.h"
#include "gtkeventcontrollermotion.h"
#include "gtkeventcontrollerkey.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
/**
@ -260,7 +260,7 @@ static gboolean text_view_key_pressed (GtkEventController
guint keycode,
GdkModifierType state,
GtkAboutDialog *about);
static void text_view_released (GtkGestureMultiPress *press,
static void text_view_released (GtkGestureClick *press,
int n,
double x,
double y,
@ -1938,7 +1938,7 @@ text_view_key_pressed (GtkEventController *controller,
}
static void
text_view_released (GtkGestureMultiPress *gesture,
text_view_released (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -37,7 +37,7 @@
#include "gtkorientable.h"
#include "gtkscrolledwindow.h"
#include "gtklabel.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include <string.h>
#include <glib/gi18n-lib.h>
@ -1213,7 +1213,7 @@ gtk_app_chooser_widget_init (GtkAppChooserWidget *self)
g_signal_connect (priv->monitor, "changed",
G_CALLBACK (app_info_changed), self);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_app_chooser_row_pressed_cb), self);

View File

@ -58,7 +58,7 @@
#include "gtkactionhelperprivate.h"
#include "gtkcheckbutton.h"
#include "gtkcontainerprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkeventcontrollerkey.h"
#include "gtkimage.h"
#include "gtkintl.h"
@ -287,7 +287,7 @@ gtk_button_class_init (GtkButtonClass *klass)
}
static void
multipress_pressed_cb (GtkGestureMultiPress *gesture,
click_pressed_cb (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -335,7 +335,7 @@ touch_release_in_button (GtkButton *button)
}
static void
multipress_released_cb (GtkGestureMultiPress *gesture,
click_released_cb (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -357,7 +357,7 @@ multipress_released_cb (GtkGestureMultiPress *gesture,
}
static void
multipress_gesture_cancel_cb (GtkGesture *gesture,
click_gesture_cancel_cb (GtkGesture *gesture,
GdkEventSequence *sequence,
GtkButton *button)
{
@ -419,13 +419,13 @@ gtk_button_init (GtkButton *button)
priv->use_underline = FALSE;
priv->child_type = WIDGET_CHILD;
priv->gesture = gtk_gesture_multi_press_new ();
priv->gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->gesture), TRUE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->gesture), GDK_BUTTON_PRIMARY);
g_signal_connect (priv->gesture, "pressed", G_CALLBACK (multipress_pressed_cb), button);
g_signal_connect (priv->gesture, "released", G_CALLBACK (multipress_released_cb), button);
g_signal_connect (priv->gesture, "cancel", G_CALLBACK (multipress_gesture_cancel_cb), button);
g_signal_connect (priv->gesture, "pressed", G_CALLBACK (click_pressed_cb), button);
g_signal_connect (priv->gesture, "released", G_CALLBACK (click_released_cb), button);
g_signal_connect (priv->gesture, "cancel", G_CALLBACK (click_gesture_cancel_cb), button);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->gesture), GTK_PHASE_CAPTURE);
gtk_widget_add_controller (GTK_WIDGET (button), GTK_EVENT_CONTROLLER (priv->gesture));

View File

@ -83,7 +83,7 @@
#include "gtksnapshot.h"
#include "gtkstylecontextprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturedrag.h"
#include "gtkeventcontrollerscroll.h"
#include "gtkeventcontrollerkey.h"
@ -292,12 +292,12 @@ static void gtk_calendar_size_allocate (GtkWidget *widget,
int baseline);
static void gtk_calendar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static void gtk_calendar_button_press (GtkGestureMultiPress *gesture,
static void gtk_calendar_button_press (GtkGestureClick *gesture,
int n_press,
double x,
double y,
gpointer user_data);
static void gtk_calendar_button_release (GtkGestureMultiPress *gesture,
static void gtk_calendar_button_release (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -681,7 +681,7 @@ gtk_calendar_init (GtkCalendar *calendar)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (calendar)),
GTK_STYLE_CLASS_VIEW);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_calendar_button_press), calendar);
g_signal_connect (gesture, "released", G_CALLBACK (gtk_calendar_button_release), calendar);
gtk_widget_add_controller (GTK_WIDGET (calendar), GTK_EVENT_CONTROLLER (gesture));
@ -2602,7 +2602,7 @@ calendar_main_button_press (GtkCalendar *calendar,
static void
gtk_calendar_button_press (GtkGestureMultiPress *gesture,
gtk_calendar_button_press (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -2639,7 +2639,7 @@ gtk_calendar_button_press (GtkGestureMultiPress *gesture,
}
static void
gtk_calendar_button_release (GtkGestureMultiPress *gesture,
gtk_calendar_button_release (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -26,7 +26,7 @@
#include "gtkdragdest.h"
#include "gtkdragsource.h"
#include "gtkgesturelongpress.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturesingle.h"
#include "gtkicontheme.h"
#include "gtkimage.h"
@ -324,7 +324,7 @@ hold_action (GtkGestureLongPress *gesture,
}
static void
tap_action (GtkGestureMultiPress *gesture,
tap_action (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -580,7 +580,7 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
G_CALLBACK (hold_action), swatch);
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (gesture));
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed",
G_CALLBACK (tap_action), swatch);

View File

@ -28,7 +28,6 @@
#include "gtkstack.h"
#include "gtklabel.h"
#include "gtkgesturelongpress.h"
#include "gtkgesturemultipress.h"
#include "gtkpopover.h"
#include "gtkscrolledwindow.h"
#include "gtkintl.h"

View File

@ -45,7 +45,6 @@
#include "gtkemojicompletion.h"
#include "gtkentrybuffer.h"
#include "gtkgesturedrag.h"
#include "gtkgesturemultipress.h"
#include "gtkimageprivate.h"
#include "gtkimcontextsimple.h"
#include "gtkintl.h"
@ -73,6 +72,7 @@
#include "gtkwidgetprivate.h"
#include "gtkwindow.h"
#include "gtknative.h"
#include "gtkgestureclick.h"
#include "a11y/gtkentryaccessible.h"
@ -1407,7 +1407,7 @@ get_icon_position_from_controller (GtkEntry *entry,
}
static void
icon_pressed_cb (GtkGestureMultiPress *gesture,
icon_pressed_cb (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -1427,7 +1427,7 @@ icon_pressed_cb (GtkGestureMultiPress *gesture,
}
static void
icon_released_cb (GtkGestureMultiPress *gesture,
icon_released_cb (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -1497,11 +1497,9 @@ construct_icon_info (GtkWidget *widget,
update_icon_style (widget, icon_pos);
update_node_ordering (entry);
press = gtk_gesture_multi_press_new ();
g_signal_connect (press, "pressed",
G_CALLBACK (icon_pressed_cb), entry);
g_signal_connect (press, "released",
G_CALLBACK (icon_released_cb), entry);
press = gtk_gesture_click_new ();
g_signal_connect (press, "pressed", G_CALLBACK (icon_pressed_cb), entry);
g_signal_connect (press, "released", G_CALLBACK (icon_released_cb), entry);
gtk_widget_add_controller (icon_info->widget, GTK_EVENT_CONTROLLER (press));
drag = gtk_gesture_drag_new ();

View File

@ -83,8 +83,8 @@
#include "gtkentry.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkgesturemultipress.h"
#include "gtkeventcontrollerkey.h"
#include "gtkgestureclick.h"
#include "gtkprivate.h"
#include "gtkwindowprivate.h"
@ -594,7 +594,7 @@ gtk_entry_completion_constructed (GObject *object)
G_CALLBACK (propagate_to_entry), completion);
gtk_widget_add_controller (priv->popup_window, controller);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_multi_press_new ());
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
g_signal_connect_swapped (controller, "released",
G_CALLBACK (_gtk_entry_completion_popdown),
completion);

View File

@ -118,7 +118,7 @@
#include "gtkdnd.h"
#include "gtkdragdest.h"
#include "gtkiconprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturesingle.h"
#include "gtkintl.h"
#include "gtklabel.h"
@ -226,7 +226,7 @@ static void gtk_expander_measure (GtkWidget *widget,
int *natural_baseline);
/* Gestures */
static void gesture_multipress_released_cb (GtkGestureMultiPress *gesture,
static void gesture_click_released_cb (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -378,13 +378,13 @@ gtk_expander_init (GtkExpander *expander)
gtk_drag_dest_set (GTK_WIDGET (expander), 0, NULL, 0);
gtk_drag_dest_set_track_motion (GTK_WIDGET (expander), TRUE);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
GDK_BUTTON_PRIMARY);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
FALSE);
g_signal_connect (gesture, "released",
G_CALLBACK (gesture_multipress_released_cb), expander);
G_CALLBACK (gesture_click_released_cb), expander);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
gtk_widget_add_controller (GTK_WIDGET (priv->title_widget), GTK_EVENT_CONTROLLER (gesture));
@ -522,7 +522,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
}
static void
gesture_multipress_released_cb (GtkGestureMultiPress *gesture,
gesture_click_released_cb (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,

View File

@ -77,7 +77,7 @@
#include "gtkseparator.h"
#include "gtkmodelbutton.h"
#include "gtkgesturelongpress.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkeventcontrollerkey.h"
#include "gtkdebug.h"
#include "gtkfilechoosererrorstackprivate.h"
@ -2303,7 +2303,7 @@ file_list_show_popover_in_idle (gpointer data)
}
static void
multi_press_cb (GtkGesture *gesture,
click_cb (GtkGesture *gesture,
int n_press,
double x,
double y,
@ -8336,7 +8336,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
gtk_widget_class_bind_template_callback (widget_class, rename_file_name_changed);
gtk_widget_class_bind_template_callback (widget_class, rename_file_rename_clicked);
gtk_widget_class_bind_template_callback (widget_class, rename_file_end);
gtk_widget_class_bind_template_callback (widget_class, multi_press_cb);
gtk_widget_class_bind_template_callback (widget_class, click_cb);
gtk_widget_class_bind_template_callback (widget_class, long_press_cb);
gtk_widget_class_bind_template_callback (widget_class, key_press_cb);
gtk_widget_class_bind_template_callback (widget_class, widget_key_press_cb);

View File

@ -82,7 +82,7 @@
#include "gtkcontainerprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkgesturedrag.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkintl.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
@ -2638,7 +2638,7 @@ gtk_flow_box_drag_gesture_update (GtkGestureDrag *gesture,
}
static void
gtk_flow_box_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_flow_box_click_gesture_pressed (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -2668,7 +2668,7 @@ gtk_flow_box_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
}
static void
gtk_flow_box_multipress_unpaired_release (GtkGestureMultiPress *gesture,
gtk_flow_box_click_unpaired_release (GtkGestureClick *gesture,
gdouble x,
gdouble y,
guint button,
@ -2688,7 +2688,7 @@ gtk_flow_box_multipress_unpaired_release (GtkGestureMultiPress *gesture,
}
static void
gtk_flow_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
gtk_flow_box_click_gesture_released (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -2732,7 +2732,7 @@ gtk_flow_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
}
static void
gtk_flow_box_multipress_gesture_stopped (GtkGestureMultiPress *gesture,
gtk_flow_box_click_gesture_stopped (GtkGestureClick *gesture,
GtkFlowBox *box)
{
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
@ -3728,7 +3728,7 @@ gtk_flow_box_init (GtkFlowBox *box)
priv->children = g_sequence_new (NULL);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
FALSE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
@ -3736,13 +3736,13 @@ gtk_flow_box_init (GtkFlowBox *box)
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_flow_box_multipress_gesture_pressed), box);
G_CALLBACK (gtk_flow_box_click_gesture_pressed), box);
g_signal_connect (gesture, "released",
G_CALLBACK (gtk_flow_box_multipress_gesture_released), box);
G_CALLBACK (gtk_flow_box_click_gesture_released), box);
g_signal_connect (gesture, "stopped",
G_CALLBACK (gtk_flow_box_multipress_gesture_stopped), box);
G_CALLBACK (gtk_flow_box_click_gesture_stopped), box);
g_signal_connect (gesture, "unpaired-release",
G_CALLBACK (gtk_flow_box_multipress_unpaired_release), box);
G_CALLBACK (gtk_flow_box_click_unpaired_release), box);
gtk_widget_add_controller (GTK_WIDGET (box), GTK_EVENT_CONTROLLER (gesture));
priv->drag_gesture = gtk_gesture_drag_new ();

View File

@ -53,7 +53,7 @@
#include "gtkdialog.h"
#include "gtkradiobutton.h"
#include "gtkcombobox.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkeventcontrollerscroll.h"
#include "gtkroot.h"
@ -2054,7 +2054,7 @@ add_check_group (GtkFontChooserWidget *fontchooser,
g_signal_connect_swapped (feat, "notify::inconsistent", G_CALLBACK (update_font_features), fontchooser);
g_signal_connect (feat, "clicked", G_CALLBACK (feat_clicked), NULL);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (feat_pressed), feat);
gtk_widget_add_controller (feat, GTK_EVENT_CONTROLLER (gesture));

View File

@ -18,32 +18,32 @@
*/
/**
* SECTION:gtkgesturemultipress
* SECTION:gtkgestureclick
* @Short_description: Multipress gesture
* @Title: GtkGestureMultiPress
* @Title: GtkGestureClick
*
* #GtkGestureMultiPress is a #GtkGesture implementation able to recognize
* multiple clicks on a nearby zone, which can be listened for through the
* #GtkGestureMultiPress::pressed signal. Whenever time or distance between
* clicks exceed the GTK+ defaults, #GtkGestureMultiPress::stopped is emitted,
* and the click counter is reset.
* #GtkGestureClick is a #GtkGesture implementation able to recognize
* multiple clicks on a nearby zone, which can be listened for through
* the #GtkGestureClick::pressed signal. Whenever time or distance
* between clicks exceed the GTK+ defaults, #GtkGestureClick::stopped
* is emitted, and the click counter is reset.
*
* Callers may also restrict the area that is considered valid for a >1
* touch/button press through gtk_gesture_multi_press_set_area(), so any
* click happening outside that area is considered to be a first click of
* its own.
* touch/button press through gtk_gesture_click_set_area(), so any
* click happening outside that area is considered to be a first click
* of its own.
*/
#include "config.h"
#include "gtkgestureprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgesturemultipressprivate.h"
#include "gtkgestureclick.h"
#include "gtkgestureclickprivate.h"
#include "gtkprivate.h"
#include "gtkintl.h"
typedef struct _GtkGestureMultiPressPrivate GtkGestureMultiPressPrivate;
typedef struct _GtkGestureClickPrivate GtkGestureClickPrivate;
struct _GtkGestureMultiPressPrivate
struct _GtkGestureClickPrivate
{
GdkRectangle rect;
GdkDevice *current_device;
@ -66,16 +66,16 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE_WITH_PRIVATE (GtkGestureMultiPress, gtk_gesture_multi_press, GTK_TYPE_GESTURE_SINGLE)
G_DEFINE_TYPE_WITH_PRIVATE (GtkGestureClick, gtk_gesture_click, GTK_TYPE_GESTURE_SINGLE)
static void
gtk_gesture_multi_press_finalize (GObject *object)
gtk_gesture_click_finalize (GObject *object)
{
GtkGestureMultiPressPrivate *priv;
GtkGestureMultiPress *gesture;
GtkGestureClickPrivate *priv;
GtkGestureClick *gesture;
gesture = GTK_GESTURE_MULTI_PRESS (object);
priv = gtk_gesture_multi_press_get_instance_private (gesture);
gesture = GTK_GESTURE_CLICK (object);
priv = gtk_gesture_click_get_instance_private (gesture);
if (priv->double_click_timeout_id)
{
@ -83,19 +83,19 @@ gtk_gesture_multi_press_finalize (GObject *object)
priv->double_click_timeout_id = 0;
}
G_OBJECT_CLASS (gtk_gesture_multi_press_parent_class)->finalize (object);
G_OBJECT_CLASS (gtk_gesture_click_parent_class)->finalize (object);
}
static gboolean
gtk_gesture_multi_press_check (GtkGesture *gesture)
gtk_gesture_click_check (GtkGesture *gesture)
{
GtkGestureMultiPress *multi_press;
GtkGestureMultiPressPrivate *priv;
GtkGestureClick *click;
GtkGestureClickPrivate *priv;
GList *sequences;
gboolean active;
multi_press = GTK_GESTURE_MULTI_PRESS (gesture);
priv = gtk_gesture_multi_press_get_instance_private (multi_press);
click = GTK_GESTURE_CLICK (gesture);
priv = gtk_gesture_click_get_instance_private (click);
sequences = gtk_gesture_get_sequences (gesture);
active = g_list_length (sequences) == 1 || priv->double_click_timeout_id;
@ -105,11 +105,11 @@ gtk_gesture_multi_press_check (GtkGesture *gesture)
}
static void
_gtk_gesture_multi_press_stop (GtkGestureMultiPress *gesture)
_gtk_gesture_click_stop (GtkGestureClick *gesture)
{
GtkGestureMultiPressPrivate *priv;
GtkGestureClickPrivate *priv;
priv = gtk_gesture_multi_press_get_instance_private (gesture);
priv = gtk_gesture_click_get_instance_private (gesture);
if (priv->n_presses == 0)
return;
@ -124,25 +124,25 @@ _gtk_gesture_multi_press_stop (GtkGestureMultiPress *gesture)
static gboolean
_double_click_timeout_cb (gpointer user_data)
{
GtkGestureMultiPress *gesture = user_data;
GtkGestureMultiPressPrivate *priv;
GtkGestureClick *gesture = user_data;
GtkGestureClickPrivate *priv;
priv = gtk_gesture_multi_press_get_instance_private (gesture);
priv = gtk_gesture_click_get_instance_private (gesture);
priv->double_click_timeout_id = 0;
_gtk_gesture_multi_press_stop (gesture);
_gtk_gesture_click_stop (gesture);
return FALSE;
}
static void
_gtk_gesture_multi_press_update_timeout (GtkGestureMultiPress *gesture)
_gtk_gesture_click_update_timeout (GtkGestureClick *gesture)
{
GtkGestureMultiPressPrivate *priv;
GtkGestureClickPrivate *priv;
guint double_click_time;
GtkSettings *settings;
GtkWidget *widget;
priv = gtk_gesture_multi_press_get_instance_private (gesture);
priv = gtk_gesture_click_get_instance_private (gesture);
if (priv->double_click_timeout_id)
g_source_remove (priv->double_click_timeout_id);
@ -156,16 +156,16 @@ _gtk_gesture_multi_press_update_timeout (GtkGestureMultiPress *gesture)
}
static gboolean
_gtk_gesture_multi_press_check_within_threshold (GtkGestureMultiPress *gesture,
gdouble x,
gdouble y)
_gtk_gesture_click_check_within_threshold (GtkGestureClick *gesture,
double x,
double y)
{
GtkGestureMultiPressPrivate *priv;
GtkGestureClickPrivate *priv;
guint double_click_distance;
GtkSettings *settings;
GtkWidget *widget;
priv = gtk_gesture_multi_press_get_instance_private (gesture);
priv = gtk_gesture_click_get_instance_private (gesture);
if (priv->n_presses == 0)
return TRUE;
@ -189,11 +189,11 @@ _gtk_gesture_multi_press_check_within_threshold (GtkGestureMultiPress *gesture,
}
static void
gtk_gesture_multi_press_begin (GtkGesture *gesture,
gtk_gesture_click_begin (GtkGesture *gesture,
GdkEventSequence *sequence)
{
GtkGestureMultiPress *multi_press;
GtkGestureMultiPressPrivate *priv;
GtkGestureClick *click;
GtkGestureClickPrivate *priv;
guint n_presses, button = 1;
GdkEventSequence *current;
const GdkEvent *event;
@ -204,8 +204,8 @@ gtk_gesture_multi_press_begin (GtkGesture *gesture,
if (!gtk_gesture_handles_sequence (gesture, sequence))
return;
multi_press = GTK_GESTURE_MULTI_PRESS (gesture);
priv = gtk_gesture_multi_press_get_instance_private (multi_press);
click = GTK_GESTURE_CLICK (gesture);
priv = gtk_gesture_click_get_instance_private (click);
event = gtk_gesture_get_last_event (gesture, sequence);
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
device = gdk_event_get_source_device (event);
@ -221,19 +221,19 @@ gtk_gesture_multi_press_begin (GtkGesture *gesture,
/* Reset the gesture if the button number changes mid-recognition */
if (priv->n_presses > 0 &&
priv->current_button != button)
_gtk_gesture_multi_press_stop (multi_press);
_gtk_gesture_click_stop (click);
/* Reset also if the device changed */
if (priv->current_device && priv->current_device != device)
_gtk_gesture_multi_press_stop (multi_press);
_gtk_gesture_click_stop (click);
priv->current_device = device;
priv->current_button = button;
_gtk_gesture_multi_press_update_timeout (multi_press);
_gtk_gesture_click_update_timeout (click);
gtk_gesture_get_point (gesture, current, &x, &y);
if (!_gtk_gesture_multi_press_check_within_threshold (multi_press, x, y))
_gtk_gesture_multi_press_stop (multi_press);
if (!_gtk_gesture_click_check_within_threshold (click, x, y))
_gtk_gesture_click_stop (click);
/* Increment later the real counter, just if the gesture is
* reset on the pressed handler */
@ -251,34 +251,34 @@ gtk_gesture_multi_press_begin (GtkGesture *gesture,
}
static void
gtk_gesture_multi_press_update (GtkGesture *gesture,
gtk_gesture_click_update (GtkGesture *gesture,
GdkEventSequence *sequence)
{
GtkGestureMultiPress *multi_press;
GtkGestureClick *click;
GdkEventSequence *current;
gdouble x, y;
multi_press = GTK_GESTURE_MULTI_PRESS (gesture);
click = GTK_GESTURE_CLICK (gesture);
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
gtk_gesture_get_point (gesture, current, &x, &y);
if (!_gtk_gesture_multi_press_check_within_threshold (multi_press, x, y))
_gtk_gesture_multi_press_stop (multi_press);
if (!_gtk_gesture_click_check_within_threshold (click, x, y))
_gtk_gesture_click_stop (click);
}
static void
gtk_gesture_multi_press_end (GtkGesture *gesture,
gtk_gesture_click_end (GtkGesture *gesture,
GdkEventSequence *sequence)
{
GtkGestureMultiPress *multi_press;
GtkGestureMultiPressPrivate *priv;
GtkGestureClick *click;
GtkGestureClickPrivate *priv;
GdkEventSequence *current;
gdouble x, y;
gboolean interpreted;
GtkEventSequenceState state;
multi_press = GTK_GESTURE_MULTI_PRESS (gesture);
priv = gtk_gesture_multi_press_get_instance_private (multi_press);
click = GTK_GESTURE_CLICK (gesture);
priv = gtk_gesture_click_get_instance_private (click);
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
interpreted = gtk_gesture_get_point (gesture, current, &x, &y);
state = gtk_gesture_get_sequence_state (gesture, current);
@ -290,32 +290,32 @@ gtk_gesture_multi_press_end (GtkGesture *gesture,
}
static void
gtk_gesture_multi_press_cancel (GtkGesture *gesture,
gtk_gesture_click_cancel (GtkGesture *gesture,
GdkEventSequence *sequence)
{
_gtk_gesture_multi_press_stop (GTK_GESTURE_MULTI_PRESS (gesture));
GTK_GESTURE_CLASS (gtk_gesture_multi_press_parent_class)->cancel (gesture, sequence);
_gtk_gesture_click_stop (GTK_GESTURE_CLICK (gesture));
GTK_GESTURE_CLASS (gtk_gesture_click_parent_class)->cancel (gesture, sequence);
}
static void
gtk_gesture_multi_press_reset (GtkEventController *controller)
gtk_gesture_click_reset (GtkEventController *controller)
{
_gtk_gesture_multi_press_stop (GTK_GESTURE_MULTI_PRESS (controller));
GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_multi_press_parent_class)->reset (controller);
_gtk_gesture_click_stop (GTK_GESTURE_CLICK (controller));
GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_click_parent_class)->reset (controller);
}
static gboolean
gtk_gesture_multi_press_handle_event (GtkEventController *controller,
gtk_gesture_click_handle_event (GtkEventController *controller,
const GdkEvent *event)
{
GtkEventControllerClass *parent_controller;
GtkGestureMultiPressPrivate *priv;
GtkGestureClickPrivate *priv;
GdkEventSequence *sequence;
guint button;
gdouble x, y;
priv = gtk_gesture_multi_press_get_instance_private (GTK_GESTURE_MULTI_PRESS (controller));
parent_controller = GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_multi_press_parent_class);
priv = gtk_gesture_click_get_instance_private (GTK_GESTURE_CLICK (controller));
parent_controller = GTK_EVENT_CONTROLLER_CLASS (gtk_gesture_click_parent_class);
sequence = gdk_event_get_event_sequence (event);
if (priv->n_presses == 0 &&
@ -334,25 +334,25 @@ gtk_gesture_multi_press_handle_event (GtkEventController *controller,
}
static void
gtk_gesture_multi_press_class_init (GtkGestureMultiPressClass *klass)
gtk_gesture_click_class_init (GtkGestureClickClass *klass)
{
GtkEventControllerClass *controller_class = GTK_EVENT_CONTROLLER_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkGestureClass *gesture_class = GTK_GESTURE_CLASS (klass);
object_class->finalize = gtk_gesture_multi_press_finalize;
object_class->finalize = gtk_gesture_click_finalize;
gesture_class->check = gtk_gesture_multi_press_check;
gesture_class->begin = gtk_gesture_multi_press_begin;
gesture_class->update = gtk_gesture_multi_press_update;
gesture_class->end = gtk_gesture_multi_press_end;
gesture_class->cancel = gtk_gesture_multi_press_cancel;
gesture_class->check = gtk_gesture_click_check;
gesture_class->begin = gtk_gesture_click_begin;
gesture_class->update = gtk_gesture_click_update;
gesture_class->end = gtk_gesture_click_end;
gesture_class->cancel = gtk_gesture_click_cancel;
controller_class->reset = gtk_gesture_multi_press_reset;
controller_class->handle_event = gtk_gesture_multi_press_handle_event;
controller_class->reset = gtk_gesture_click_reset;
controller_class->handle_event = gtk_gesture_click_handle_event;
/**
* GtkGestureMultiPress::pressed:
* GtkGestureClick::pressed:
* @gesture: the object which received the signal
* @n_press: how many touch/button presses happened with this one
* @x: The X coordinate, in widget allocation coordinates
@ -364,13 +364,13 @@ gtk_gesture_multi_press_class_init (GtkGestureMultiPressClass *klass)
g_signal_new (I_("pressed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkGestureMultiPressClass, pressed),
G_STRUCT_OFFSET (GtkGestureClickClass, pressed),
NULL, NULL, NULL,
G_TYPE_NONE, 3, G_TYPE_INT,
G_TYPE_DOUBLE, G_TYPE_DOUBLE);
/**
* GtkGestureMultiPress::released:
* GtkGestureClick::released:
* @gesture: the object which received the signal
* @n_press: number of press that is paired with this release
* @x: The X coordinate, in widget allocation coordinates
@ -378,19 +378,19 @@ gtk_gesture_multi_press_class_init (GtkGestureMultiPressClass *klass)
*
* This signal is emitted when a button or touch is released. @n_press
* will report the number of press that is paired to this event, note
* that #GtkGestureMultiPress::stopped may have been emitted between the
* that #GtkGestureClick::stopped may have been emitted between the
* press and its release, @n_press will only start over at the next press.
*/
signals[RELEASED] =
g_signal_new (I_("released"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkGestureMultiPressClass, released),
G_STRUCT_OFFSET (GtkGestureClickClass, released),
NULL, NULL, NULL,
G_TYPE_NONE, 3, G_TYPE_INT,
G_TYPE_DOUBLE, G_TYPE_DOUBLE);
/**
* GtkGestureMultiPress::stopped:
* GtkGestureClick::stopped:
* @gesture: the object which received the signal
*
* This signal is emitted whenever any time/distance threshold has
@ -400,12 +400,12 @@ gtk_gesture_multi_press_class_init (GtkGestureMultiPressClass *klass)
g_signal_new (I_("stopped"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkGestureMultiPressClass, stopped),
G_STRUCT_OFFSET (GtkGestureClickClass, stopped),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
* GtkGestureMultiPress::unpaired-release
* GtkGestureClick::unpaired-release
* @gesture: the object which received the signal
* @x: X coordinate of the event
* @y: Y coordinate of the event
@ -429,28 +429,28 @@ gtk_gesture_multi_press_class_init (GtkGestureMultiPressClass *klass)
}
static void
gtk_gesture_multi_press_init (GtkGestureMultiPress *gesture)
gtk_gesture_click_init (GtkGestureClick *gesture)
{
}
/**
* gtk_gesture_multi_press_new:
* gtk_gesture_click_new:
*
* Returns a newly created #GtkGesture that recognizes single and multiple
* presses.
*
* Returns: a newly created #GtkGestureMultiPress
* Returns: a newly created #GtkGestureClick
**/
GtkGesture *
gtk_gesture_multi_press_new (void)
gtk_gesture_click_new (void)
{
return g_object_new (GTK_TYPE_GESTURE_MULTI_PRESS,
return g_object_new (GTK_TYPE_GESTURE_CLICK,
NULL);
}
/**
* gtk_gesture_multi_press_set_area:
* @gesture: a #GtkGestureMultiPress
* gtk_gesture_click_set_area:
* @gesture: a #GtkGestureClick
* @rect: (allow-none): rectangle to receive coordinates on
*
* If @rect is non-%NULL, the press area will be checked to be
@ -464,14 +464,14 @@ gtk_gesture_multi_press_new (void)
* akin to an input shape.
**/
void
gtk_gesture_multi_press_set_area (GtkGestureMultiPress *gesture,
gtk_gesture_click_set_area (GtkGestureClick *gesture,
const GdkRectangle *rect)
{
GtkGestureMultiPressPrivate *priv;
GtkGestureClickPrivate *priv;
g_return_if_fail (GTK_IS_GESTURE_MULTI_PRESS (gesture));
g_return_if_fail (GTK_IS_GESTURE_CLICK (gesture));
priv = gtk_gesture_multi_press_get_instance_private (gesture);
priv = gtk_gesture_click_get_instance_private (gesture);
if (!rect)
priv->rect_is_set = FALSE;
@ -483,26 +483,26 @@ gtk_gesture_multi_press_set_area (GtkGestureMultiPress *gesture,
}
/**
* gtk_gesture_multi_press_get_area:
* @gesture: a #GtkGestureMultiPress
* gtk_gesture_click_get_area:
* @gesture: a #GtkGestureClick
* @rect: (out): return location for the press area
*
* If an area was set through gtk_gesture_multi_press_set_area(),
* If an area was set through gtk_gesture_click_set_area(),
* this function will return %TRUE and fill in @rect with the
* press area. See gtk_gesture_multi_press_set_area() for more
* press area. See gtk_gesture_click_set_area() for more
* details on what the press area represents.
*
* Returns: %TRUE if @rect was filled with the press area
**/
gboolean
gtk_gesture_multi_press_get_area (GtkGestureMultiPress *gesture,
gtk_gesture_click_get_area (GtkGestureClick *gesture,
GdkRectangle *rect)
{
GtkGestureMultiPressPrivate *priv;
GtkGestureClickPrivate *priv;
g_return_val_if_fail (GTK_IS_GESTURE_MULTI_PRESS (gesture), FALSE);
g_return_val_if_fail (GTK_IS_GESTURE_CLICK (gesture), FALSE);
priv = gtk_gesture_multi_press_get_instance_private (gesture);
priv = gtk_gesture_click_get_instance_private (gesture);
if (rect)
{

56
gtk/gtkgestureclick.h Normal file
View File

@ -0,0 +1,56 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author(s): Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef __GTK_GESTURE_CLICK_H__
#define __GTK_GESTURE_CLICK_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkwidget.h>
#include <gtk/gtkgesturesingle.h>
G_BEGIN_DECLS
#define GTK_TYPE_GESTURE_CLICK (gtk_gesture_click_get_type ())
#define GTK_GESTURE_CLICK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_CLICK, GtkGestureClick))
#define GTK_GESTURE_CLICK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_CLICK, GtkGestureClickClass))
#define GTK_IS_GESTURE_CLICK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_CLICK))
#define GTK_IS_GESTURE_CLICK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_CLICK))
#define GTK_GESTURE_CLICK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_CLICK, GtkGestureClickClass))
typedef struct _GtkGestureClick GtkGestureClick;
typedef struct _GtkGestureClickClass GtkGestureClickClass;
GDK_AVAILABLE_IN_ALL
GType gtk_gesture_click_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkGesture * gtk_gesture_click_new (void);
GDK_AVAILABLE_IN_ALL
void gtk_gesture_click_set_area (GtkGestureClick *gesture,
const GdkRectangle *rect);
GDK_AVAILABLE_IN_ALL
gboolean gtk_gesture_click_get_area (GtkGestureClick *gesture,
GdkRectangle *rect);
G_END_DECLS
#endif /* __GTK_GESTURE_CLICK_H__ */

View File

@ -16,33 +16,33 @@
*
* Author(s): Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef __GTK_GESTURE_MULTI_PRESS_PRIVATE_H__
#define __GTK_GESTURE_MULTI_PRESS_PRIVATE_H__
#ifndef __GTK_GESTURE_CLICK_PRIVATE_H__
#define __GTK_GESTURE_CLICK_PRIVATE_H__
#include "gtkgesturesingleprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
struct _GtkGestureMultiPress
struct _GtkGestureClick
{
GtkGestureSingle parent_instance;
};
struct _GtkGestureMultiPressClass
struct _GtkGestureClickClass
{
GtkGestureSingleClass parent_class;
void (* pressed) (GtkGestureMultiPress *gesture,
void (* pressed) (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y);
void (* released) (GtkGestureMultiPress *gesture,
void (* released) (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y);
void (* stopped) (GtkGestureMultiPress *gesture);
void (* stopped) (GtkGestureClick *gesture);
/*<private>*/
gpointer padding[10];
};
#endif /* __GTK_GESTURE_MULTI_PRESS_PRIVATE_H__ */
#endif /* __GTK_GESTURE_CLICK_PRIVATE_H__ */

View File

@ -1,56 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author(s): Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef __GTK_GESTURE_MULTI_PRESS_H__
#define __GTK_GESTURE_MULTI_PRESS_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkwidget.h>
#include <gtk/gtkgesturesingle.h>
G_BEGIN_DECLS
#define GTK_TYPE_GESTURE_MULTI_PRESS (gtk_gesture_multi_press_get_type ())
#define GTK_GESTURE_MULTI_PRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURE_MULTI_PRESS, GtkGestureMultiPress))
#define GTK_GESTURE_MULTI_PRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_GESTURE_MULTI_PRESS, GtkGestureMultiPressClass))
#define GTK_IS_GESTURE_MULTI_PRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURE_MULTI_PRESS))
#define GTK_IS_GESTURE_MULTI_PRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GTK_TYPE_GESTURE_MULTI_PRESS))
#define GTK_GESTURE_MULTI_PRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURE_MULTI_PRESS, GtkGestureMultiPressClass))
typedef struct _GtkGestureMultiPress GtkGestureMultiPress;
typedef struct _GtkGestureMultiPressClass GtkGestureMultiPressClass;
GDK_AVAILABLE_IN_ALL
GType gtk_gesture_multi_press_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkGesture * gtk_gesture_multi_press_new (void);
GDK_AVAILABLE_IN_ALL
void gtk_gesture_multi_press_set_area (GtkGestureMultiPress *gesture,
const GdkRectangle *rect);
GDK_AVAILABLE_IN_ALL
gboolean gtk_gesture_multi_press_get_area (GtkGestureMultiPress *gesture,
GdkRectangle *rect);
G_END_DECLS
#endif /* __GTK_GESTURE_MULTI_PRESS_H__ */

View File

@ -167,12 +167,12 @@ static void gtk_icon_view_leave (GtkEventControl
GdkCrossingMode mode,
GdkNotifyType detail,
gpointer user_data);
static void gtk_icon_view_button_press (GtkGestureMultiPress *gesture,
static void gtk_icon_view_button_press (GtkGestureClick *gesture,
int n_press,
double x,
double y,
gpointer user_data);
static void gtk_icon_view_button_release (GtkGestureMultiPress *gesture,
static void gtk_icon_view_button_release (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -958,7 +958,7 @@ gtk_icon_view_init (GtkIconView *icon_view)
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (icon_view)),
GTK_STYLE_CLASS_VIEW);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_icon_view_button_press),
icon_view);
g_signal_connect (gesture, "released", G_CALLBACK (gtk_icon_view_button_release),
@ -2101,7 +2101,7 @@ gtk_icon_view_get_cursor (GtkIconView *icon_view,
}
static void
gtk_icon_view_button_press (GtkGestureMultiPress *gesture,
gtk_icon_view_button_press (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -2271,7 +2271,7 @@ button_event_modifies_selection (const GdkEventButton *event)
}
static void
gtk_icon_view_button_release (GtkGestureMultiPress *gesture,
gtk_icon_view_button_release (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -17,7 +17,7 @@
#include "gtk/gtkiconview.h"
#include "gtk/gtkcssnodeprivate.h"
#include "gtk/gtkgesturemultipress.h"
#include "gtk/gtkgestureclick.h"
#include "gtk/gtkeventcontrollermotion.h"
#ifndef __GTK_ICON_VIEW_PRIVATE_H__

View File

@ -482,7 +482,7 @@ gtk_im_context_wayland_finalize (GObject *object)
}
static void
pressed_cb (GtkGestureMultiPress *gesture,
pressed_cb (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -496,7 +496,7 @@ pressed_cb (GtkGestureMultiPress *gesture,
}
static void
released_cb (GtkGestureMultiPress *gesture,
released_cb (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -547,7 +547,7 @@ gtk_im_context_wayland_set_client_widget (GtkIMContext *context,
{
GtkGesture *gesture;
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_CAPTURE);
g_signal_connect (gesture, "pressed",

View File

@ -35,7 +35,7 @@
#include "gtkdnd.h"
#include "gtkeventcontrollermotion.h"
#include "gtkgesturedrag.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturesingle.h"
#include "gtkimage.h"
#include "gtkintl.h"
@ -363,7 +363,7 @@ struct _GtkLabelSelectionInfo
GtkLabelLink *active_link;
GtkGesture *drag_gesture;
GtkGesture *multipress_gesture;
GtkGesture *click_gesture;
GtkEventController *motion_controller;
gint drag_start_x;
@ -553,12 +553,12 @@ static void emit_activate_link (GtkLabel *label,
GtkLabelLink *link);
/* Event controller callbacks */
static void gtk_label_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_label_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
GtkLabel *label);
static void gtk_label_multipress_gesture_released (GtkGestureMultiPress *gesture,
static void gtk_label_click_gesture_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -4458,7 +4458,7 @@ out:
}
static void
gtk_label_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_label_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble widget_x,
gdouble widget_y,
@ -4536,7 +4536,7 @@ gtk_label_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
}
static void
gtk_label_multipress_gesture_released (GtkGestureMultiPress *gesture,
gtk_label_click_gesture_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -5047,14 +5047,14 @@ gtk_label_ensure_select_info (GtkLabel *label)
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->select_info->drag_gesture), TRUE);
gtk_widget_add_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->drag_gesture));
priv->select_info->multipress_gesture = gtk_gesture_multi_press_new ();
g_signal_connect (priv->select_info->multipress_gesture, "pressed",
G_CALLBACK (gtk_label_multipress_gesture_pressed), label);
g_signal_connect (priv->select_info->multipress_gesture, "released",
G_CALLBACK (gtk_label_multipress_gesture_released), label);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->select_info->multipress_gesture), 0);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->select_info->multipress_gesture), TRUE);
gtk_widget_add_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->multipress_gesture));
priv->select_info->click_gesture = gtk_gesture_click_new ();
g_signal_connect (priv->select_info->click_gesture, "pressed",
G_CALLBACK (gtk_label_click_gesture_pressed), label);
g_signal_connect (priv->select_info->click_gesture, "released",
G_CALLBACK (gtk_label_click_gesture_released), label);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->select_info->click_gesture), 0);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->select_info->click_gesture), TRUE);
gtk_widget_add_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->click_gesture));
priv->select_info->motion_controller = gtk_event_controller_motion_new ();
g_signal_connect (priv->select_info->motion_controller, "motion",
@ -5079,7 +5079,7 @@ gtk_label_clear_select_info (GtkLabel *label)
if (!priv->select_info->selectable && !priv->select_info->links)
{
gtk_widget_remove_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->drag_gesture));
gtk_widget_remove_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->multipress_gesture));
gtk_widget_remove_controller (GTK_WIDGET (label), GTK_EVENT_CONTROLLER (priv->select_info->click_gesture));
gtk_widget_remove_controller (GTK_WIDGET (label), priv->select_info->motion_controller);
GTK_LABEL_CONTENT (priv->select_info->provider)->label = NULL;
g_object_unref (priv->select_info->provider);

View File

@ -54,7 +54,7 @@
#include "gtklinkbutton.h"
#include "gtkdragsource.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturesingle.h"
#include "gtkintl.h"
#include "gtklabel.h"
@ -135,7 +135,7 @@ static gboolean gtk_link_button_query_tooltip_cb (GtkWidget *widget,
gboolean keyboard_tip,
GtkTooltip *tooltip,
gpointer data);
static void gtk_link_button_pressed_cb (GtkGestureMultiPress *gesture,
static void gtk_link_button_pressed_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -249,7 +249,7 @@ gtk_link_button_init (GtkLinkButton *link_button)
gdk_content_formats_unref (targets);
gtk_drag_source_set_icon_name (GTK_WIDGET (link_button), "text-x-generic");
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_BUBBLE);
@ -382,7 +382,7 @@ gtk_link_button_do_popup (GtkLinkButton *link_button,
}
static void
gtk_link_button_pressed_cb (GtkGestureMultiPress *gesture,
gtk_link_button_pressed_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -26,7 +26,7 @@
#include "gtkcontainerprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkdnd.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkintl.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
@ -282,23 +282,23 @@ static void gtk_list_box_selected_rows_changed (GtkList
static void gtk_list_box_set_accept_unpaired_release (GtkListBox *box,
gboolean accept);
static void gtk_list_box_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_list_box_click_gesture_pressed (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
GtkListBox *box);
static void gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
static void gtk_list_box_click_gesture_released (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
GtkListBox *box);
static void gtk_list_box_multipress_unpaired_release (GtkGestureMultiPress *gesture,
static void gtk_list_box_click_unpaired_release (GtkGestureClick *gesture,
gdouble x,
gdouble y,
guint button,
GdkEventSequence *sequence,
GtkListBox *box);
static void gtk_list_box_multipress_gesture_stopped (GtkGestureMultiPress *gesture,
static void gtk_list_box_click_gesture_stopped (GtkGestureClick *gesture,
GtkListBox *box);
static void gtk_list_box_update_row_styles (GtkListBox *box);
@ -658,7 +658,7 @@ gtk_list_box_init (GtkListBox *box)
priv->children = g_sequence_new (NULL);
priv->header_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
@ -666,13 +666,13 @@ gtk_list_box_init (GtkListBox *box)
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
GDK_BUTTON_PRIMARY);
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_list_box_multipress_gesture_pressed), box);
G_CALLBACK (gtk_list_box_click_gesture_pressed), box);
g_signal_connect (gesture, "released",
G_CALLBACK (gtk_list_box_multipress_gesture_released), box);
G_CALLBACK (gtk_list_box_click_gesture_released), box);
g_signal_connect (gesture, "stopped",
G_CALLBACK (gtk_list_box_multipress_gesture_stopped), box);
G_CALLBACK (gtk_list_box_click_gesture_stopped), box);
g_signal_connect (gesture, "unpaired-release",
G_CALLBACK (gtk_list_box_multipress_unpaired_release), box);
G_CALLBACK (gtk_list_box_click_unpaired_release), box);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
g_signal_connect (box, "notify::parent", G_CALLBACK (gtk_list_box_parent_cb), NULL);
@ -1773,7 +1773,7 @@ gtk_list_box_select_and_activate_full (GtkListBox *box,
}
static void
gtk_list_box_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_list_box_click_gesture_pressed (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -1817,7 +1817,7 @@ get_current_selection_modifiers (GtkWidget *widget,
}
static void
gtk_list_box_multipress_unpaired_release (GtkGestureMultiPress *gesture,
gtk_list_box_click_unpaired_release (GtkGestureClick *gesture,
gdouble x,
gdouble y,
guint button,
@ -1837,7 +1837,7 @@ gtk_list_box_multipress_unpaired_release (GtkGestureMultiPress *gesture,
}
static void
gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
gtk_list_box_click_gesture_released (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -1890,7 +1890,7 @@ gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
}
static void
gtk_list_box_multipress_gesture_stopped (GtkGestureMultiPress *gesture,
gtk_list_box_click_gesture_stopped (GtkGestureClick *gesture,
GtkListBox *box)
{
GtkListBoxPrivate *priv = BOX_PRIV (box);

View File

@ -47,7 +47,7 @@
*
* |[<!-- language="C" -->
* // connect our handler which will popup the menu
* gesture = gtk_gesture_multi_press_new (window);
* gesture = gtk_gesture_click_new (window);
* gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
* GDK_BUTTON_SECONDARY);
* g_signal_connect (gesture, "begin", G_CALLBACK (my_popup_handler), menu);
@ -281,12 +281,12 @@ static void gtk_menu_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
static void gtk_menu_pressed_cb (GtkGestureMultiPress *gesture,
static void gtk_menu_pressed_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,
gpointer user_data);
static void gtk_menu_released_cb (GtkGestureMultiPress *gesture,
static void gtk_menu_released_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -942,7 +942,7 @@ gtk_menu_init (GtkMenu *menu)
gtk_widget_set_parent (priv->bottom_arrow_widget, GTK_WIDGET (menu));
gtk_widget_set_child_visible (priv->bottom_arrow_widget, FALSE);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_BUBBLE);
@ -2621,7 +2621,7 @@ pointer_in_menu_surface (GtkWidget *widget,
static void
gtk_menu_pressed_cb (GtkGestureMultiPress *gesture,
gtk_menu_pressed_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -2660,7 +2660,7 @@ gtk_menu_pressed_cb (GtkGestureMultiPress *gesture,
}
static void
gtk_menu_released_cb (GtkGestureMultiPress *gesture,
gtk_menu_released_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -27,7 +27,7 @@
#include <gtk/gtkmenu.h>
#include <gtk/gtkcssnodeprivate.h>
#include <gtk/gtkgesturemultipress.h>
#include <gtk/gtkgestureclick.h>
G_BEGIN_DECLS

View File

@ -76,7 +76,7 @@
#include "gtkwindow.h"
#include "gtkwindowprivate.h"
#include "gtkeventcontrollerkey.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "a11y/gtkmenushellaccessible.h"
@ -119,17 +119,17 @@ static gboolean gtk_menu_shell_key_press (GtkEventControllerKey *key,
GdkModifierType modifiers,
GtkWidget *widget);
static void gtk_menu_shell_root (GtkWidget *widget);
static void multi_press_pressed (GtkGestureMultiPress *gesture,
static void click_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
GtkMenuShell *menu_shell);
static void multi_press_released (GtkGestureMultiPress *gesture,
static void click_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
GtkMenuShell *menu_shell);
static void multi_press_stopped (GtkGestureMultiPress *gesture,
static void click_stopped (GtkGestureClick *gesture,
GtkMenuShell *menu_shell);
@ -428,15 +428,15 @@ gtk_menu_shell_init (GtkMenuShell *menu_shell)
G_CALLBACK (gtk_menu_shell_key_press), widget);
gtk_widget_add_controller (widget, controller);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_multi_press_new ());
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
gtk_event_controller_set_propagation_limit (controller, GTK_LIMIT_NONE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
g_signal_connect (controller, "pressed",
G_CALLBACK (multi_press_pressed), menu_shell);
G_CALLBACK (click_pressed), menu_shell);
g_signal_connect (controller, "released",
G_CALLBACK (multi_press_released), menu_shell);
G_CALLBACK (click_released), menu_shell);
g_signal_connect (controller, "stopped",
G_CALLBACK (multi_press_stopped), menu_shell);
G_CALLBACK (click_stopped), menu_shell);
gtk_widget_add_controller (widget, controller);
}
@ -622,7 +622,7 @@ gtk_menu_shell_get_toplevel_shell (GtkMenuShell *menu_shell)
}
static void
multi_press_stopped (GtkGestureMultiPress *gesture,
click_stopped (GtkGestureClick *gesture,
GtkMenuShell *menu_shell)
{
GtkMenuShellPrivate *priv = menu_shell->priv;
@ -647,7 +647,7 @@ multi_press_stopped (GtkGestureMultiPress *gesture,
}
static void
multi_press_pressed (GtkGestureMultiPress *gesture,
click_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -723,7 +723,7 @@ multi_press_pressed (GtkGestureMultiPress *gesture,
}
static void
multi_press_released (GtkGestureMultiPress *gesture,
click_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,

View File

@ -52,7 +52,7 @@
#include "gtksettings.h"
#include "gtkstylecontextprivate.h"
#include "gtkdialogprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include <glib/gprintf.h>
@ -1342,7 +1342,7 @@ on_popup_menu_for_process_tree_view (GtkWidget *widget,
}
static void
multi_press_cb (GtkGesture *gesture,
click_cb (GtkGesture *gesture,
int n_press,
double x,
double y,
@ -1470,10 +1470,10 @@ create_show_processes_dialog (GtkMountOperation *op,
G_CALLBACK (on_popup_menu_for_process_tree_view),
op);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed",
G_CALLBACK (multi_press_cb), op);
G_CALLBACK (click_cb), op);
gtk_widget_add_controller (tree_view, GTK_EVENT_CONTROLLER (gesture));
list_store = gtk_list_store_new (3,

View File

@ -35,7 +35,7 @@
#include "gtkdnd.h"
#include "gtkdragdest.h"
#include "gtkeventcontrollermotion.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgizmoprivate.h"
#include "gtkiconprivate.h"
#include "gtkintl.h"
@ -844,12 +844,12 @@ static void gtk_notebook_buildable_add_child (GtkBuildable *buildable,
GObject *child,
const gchar *type);
static void gtk_notebook_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
gpointer user_data);
static void gtk_notebook_gesture_released (GtkGestureMultiPress *gesture,
static void gtk_notebook_gesture_released (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -1356,7 +1356,7 @@ gtk_notebook_init (GtkNotebook *notebook)
gtk_widget_set_vexpand (priv->stack_widget, TRUE);
gtk_container_add (GTK_CONTAINER (priv->box), priv->stack_widget);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_CAPTURE);
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_notebook_gesture_pressed), notebook);
@ -2488,7 +2488,7 @@ get_tab_at_pos (GtkNotebook *notebook,
}
static void
gtk_notebook_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_notebook_gesture_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -2779,7 +2779,7 @@ gtk_notebook_stop_reorder (GtkNotebook *notebook)
}
static void
gtk_notebook_gesture_released (GtkGestureMultiPress *gesture,
gtk_notebook_gesture_released (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -26,7 +26,7 @@
#include "gtkbindings.h"
#include "gtktextprivate.h"
#include "gtkeditable.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkbox.h"
#include "gtkimage.h"
#include "gtkcheckmenuitem.h"
@ -475,7 +475,7 @@ gtk_password_entry_set_show_peek_icon (GtkPasswordEntry *entry,
gtk_widget_set_tooltip_text (priv->peek_icon, _("Show text"));
gtk_widget_set_parent (priv->peek_icon, GTK_WIDGET (entry));
press = gtk_gesture_multi_press_new ();
press = gtk_gesture_click_new ();
g_signal_connect_swapped (press, "released",
G_CALLBACK (gtk_password_entry_toggle_peek), entry);
gtk_widget_add_controller (priv->peek_icon, GTK_EVENT_CONTROLLER (press));

View File

@ -62,7 +62,7 @@
#include "gtkmodelbutton.h"
#include "gtkprivate.h"
#include "gtkeventcontrollerkey.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturedrag.h"
#include "gtknative.h"
@ -286,12 +286,12 @@ static void check_unmount_and_eject (GMount *mount,
GDrive *drive,
gboolean *show_unmount,
gboolean *show_eject);
static void on_row_pressed (GtkGestureMultiPress *gesture,
static void on_row_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
GtkSidebarRow *row);
static void on_row_released (GtkGestureMultiPress *gesture,
static void on_row_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -511,7 +511,7 @@ add_place (GtkPlacesSidebar *sidebar,
g_signal_connect_swapped (eject_button, "clicked",
G_CALLBACK (eject_or_unmount_bookmark), row);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed",
G_CALLBACK (on_row_pressed), row);
@ -3731,7 +3731,7 @@ on_row_activated (GtkListBox *list_box,
}
static void
on_row_pressed (GtkGestureMultiPress *gesture,
on_row_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -3758,7 +3758,7 @@ on_row_pressed (GtkGestureMultiPress *gesture,
}
static void
on_row_released (GtkGestureMultiPress *gesture,
on_row_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,

View File

@ -32,7 +32,7 @@
#include "gtkeventcontrollerscroll.h"
#include "gtkgesturedrag.h"
#include "gtkgesturelongpressprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgizmoprivate.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
@ -162,12 +162,12 @@ static void gtk_range_size_allocate (GtkWidget *widget,
int baseline);
static void gtk_range_unmap (GtkWidget *widget);
static void gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
GtkRange *range);
static void gtk_range_multipress_gesture_released (GtkGestureMultiPress *gesture,
static void gtk_range_click_gesture_released (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -558,7 +558,7 @@ gtk_range_init (GtkRange *range)
/* Note: Order is important here.
* The ::drag-begin handler relies on the state set up by the
* multipress ::pressed handler. Gestures are handling events
* click ::pressed handler. Gestures are handling events
* in the oppposite order in which they are added to their
* widget.
*/
@ -570,12 +570,12 @@ gtk_range_init (GtkRange *range)
G_CALLBACK (gtk_range_drag_gesture_update), range);
gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (priv->drag_gesture));
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_range_multipress_gesture_pressed), range);
G_CALLBACK (gtk_range_click_gesture_pressed), range);
g_signal_connect (gesture, "released",
G_CALLBACK (gtk_range_multipress_gesture_released), range);
G_CALLBACK (gtk_range_click_gesture_released), range);
gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (gesture));
gtk_gesture_group (priv->drag_gesture, gesture);
@ -1874,7 +1874,7 @@ gtk_range_long_press_gesture_pressed (GtkGestureLongPress *gesture,
}
static void
gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -2006,7 +2006,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
}
static void
gtk_range_multipress_gesture_released (GtkGestureMultiPress *gesture,
gtk_range_click_gesture_released (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,

View File

@ -33,7 +33,7 @@
#include "gtkbindings.h"
#include "gtkeditable.h"
#include "gtkbox.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtktextprivate.h"
#include "gtkimage.h"
#include "gtkintl.h"
@ -491,7 +491,7 @@ gtk_search_entry_editable_init (GtkEditableInterface *iface)
}
static void
gtk_search_entry_icon_release (GtkGestureMultiPress *press,
gtk_search_entry_icon_release (GtkGestureClick *press,
int n_press,
double x,
double y,
@ -595,7 +595,7 @@ gtk_search_entry_init (GtkSearchEntry *entry)
gtk_widget_set_parent (priv->icon, GTK_WIDGET (entry));
gtk_widget_set_child_visible (priv->icon, FALSE);
press = gtk_gesture_multi_press_new ();
press = gtk_gesture_click_new ();
g_signal_connect (press, "released", G_CALLBACK (gtk_search_entry_icon_release), entry);
gtk_widget_add_controller (priv->icon, GTK_EVENT_CONTROLLER (press));

View File

@ -40,7 +40,7 @@
#include "gtkeventcontrollerkey.h"
#include "gtkeventcontrollermotion.h"
#include "gtkeventcontrollerscroll.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgestureswipe.h"
#include "gtkicontheme.h"
#include "gtkintl.h"
@ -773,7 +773,7 @@ start_spinning (GtkSpinButton *spin,
}
static void
button_pressed_cb (GtkGestureMultiPress *gesture,
button_pressed_cb (GtkGestureClick *gesture,
int n_pressses,
double x,
double y,
@ -802,7 +802,7 @@ button_pressed_cb (GtkGestureMultiPress *gesture,
}
static void
button_released_cb (GtkGestureMultiPress *gesture,
button_released_cb (GtkGestureClick *gesture,
int n_pressses,
double x,
double y,
@ -909,7 +909,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
gtk_style_context_add_class (gtk_widget_get_style_context (priv->down_button), "down");
gtk_container_add (GTK_CONTAINER (priv->box), priv->down_button);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
@ -926,7 +926,7 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "up");
gtk_container_add (GTK_CONTAINER (priv->box), priv->up_button);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),

View File

@ -55,7 +55,7 @@
#include "gtkactionable.h"
#include "gtkactionhelperprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturepan.h"
#include "gtkgesturesingle.h"
#include "gtkgizmoprivate.h"
@ -81,7 +81,7 @@ struct _GtkSwitchPrivate
GtkActionHelper *action_helper;
GtkGesture *pan_gesture;
GtkGesture *multipress_gesture;
GtkGesture *click_gesture;
double handle_pos;
guint tick_id;
@ -206,7 +206,7 @@ gtk_switch_begin_toggle_animation (GtkSwitch *sw)
}
static void
gtk_switch_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_switch_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -229,7 +229,7 @@ gtk_switch_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
}
static void
gtk_switch_multipress_gesture_released (GtkGestureMultiPress *gesture,
gtk_switch_click_gesture_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -291,7 +291,7 @@ gtk_switch_pan_gesture_drag_end (GtkGestureDrag *gesture,
*/
active = priv->handle_pos >= 0.5;
}
else if (!gtk_gesture_handles_sequence (priv->multipress_gesture, sequence))
else if (!gtk_gesture_handles_sequence (priv->click_gesture, sequence))
active = priv->is_active;
else
return;
@ -639,17 +639,17 @@ gtk_switch_init (GtkSwitch *self)
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_switch_multipress_gesture_pressed), self);
G_CALLBACK (gtk_switch_click_gesture_pressed), self);
g_signal_connect (gesture, "released",
G_CALLBACK (gtk_switch_multipress_gesture_released), self);
G_CALLBACK (gtk_switch_click_gesture_released), self);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
priv->multipress_gesture = gesture;
priv->click_gesture = gesture;
gesture = gtk_gesture_pan_new (GTK_ORIENTATION_HORIZONTAL);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);

View File

@ -38,7 +38,7 @@
#include "gtkeventcontrollerkey.h"
#include "gtkeventcontrollermotion.h"
#include "gtkgesturedrag.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturesingle.h"
#include "gtkimageprivate.h"
#include "gtkimcontextsimple.h"
@ -443,7 +443,7 @@ static void gtk_text_motion_controller_motion (GtkEventControllerMotion *c
double x,
double y,
GtkText *self);
static void gtk_text_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -1709,9 +1709,9 @@ gtk_text_init (GtkText *self)
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->drag_gesture), TRUE);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (priv->drag_gesture));
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_text_multipress_gesture_pressed), self);
G_CALLBACK (gtk_text_click_gesture_pressed), self);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
@ -2449,7 +2449,7 @@ gesture_get_current_point_in_layout (GtkGestureSingle *gesture,
}
static void
gtk_text_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
int n_press,
double widget_x,
double widget_y,

View File

@ -378,7 +378,7 @@ static void gtk_text_view_direction_changed (GtkWidget *widget,
static void gtk_text_view_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_text_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -1669,10 +1669,10 @@ gtk_text_view_init (GtkTextView *text_view)
priv->text_window = text_window_new (GTK_TEXT_WINDOW_TEXT, widget);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_text_view_multipress_gesture_pressed),
G_CALLBACK (gtk_text_view_click_gesture_pressed),
widget);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
@ -5075,7 +5075,7 @@ get_iter_from_gesture (GtkTextView *text_view,
}
static void
gtk_text_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,

View File

@ -58,7 +58,7 @@
#include "gtkwidgetpath.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkbuttonprivate.h"
@ -245,7 +245,7 @@ static void gtk_toolbar_measure (GtkWidget *widget,
int *natural,
int *minimum_baseline,
int *natural_baseline);
static void gtk_toolbar_pressed_cb (GtkGestureMultiPress *gesture,
static void gtk_toolbar_pressed_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -575,7 +575,7 @@ gtk_toolbar_init (GtkToolbar *toolbar)
priv->timer = g_timer_new ();
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_BUBBLE);
@ -2206,7 +2206,7 @@ gtk_toolbar_arrow_button_press (GtkGesture *gesture,
static void
gtk_toolbar_pressed_cb (GtkGestureMultiPress *gesture,
gtk_toolbar_pressed_cb (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -40,7 +40,7 @@
#include "gtkeventcontrollerscroll.h"
#include "gtkframe.h"
#include "gtkgesturedrag.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgesturesingle.h"
#include "gtkintl.h"
#include "gtklabel.h"
@ -503,7 +503,7 @@ struct _GtkTreeViewPrivate
GDestroyNotify row_separator_destroy;
/* Gestures */
GtkGesture *multipress_gesture;
GtkGesture *click_gesture;
GtkGesture *drag_gesture; /* Rubberbanding, row DnD */
GtkGesture *column_drag_gesture; /* Column reordering, resizing */
@ -927,18 +927,18 @@ static void remove_scroll_timeout (GtkTreeView *tree_view);
static void grab_focus_and_unset_draw_keyfocus (GtkTreeView *tree_view);
/* Gestures */
static void gtk_tree_view_column_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_tree_view_column_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
GtkTreeView *tree_view);
static void gtk_tree_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
static void gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
GtkTreeView *tree_view);
static void gtk_tree_view_multipress_gesture_released (GtkGestureMultiPress *gesture,
static void gtk_tree_view_click_gesture_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -1763,17 +1763,17 @@ gtk_tree_view_init (GtkTreeView *tree_view)
gtk_css_node_set_state (priv->header_node, gtk_css_node_get_state (widget_node));
g_object_unref (priv->header_node);
priv->multipress_gesture = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), 0);
g_signal_connect (priv->multipress_gesture, "pressed",
G_CALLBACK (gtk_tree_view_multipress_gesture_pressed), tree_view);
g_signal_connect (priv->multipress_gesture, "released",
G_CALLBACK (gtk_tree_view_multipress_gesture_released), tree_view);
gtk_widget_add_controller (GTK_WIDGET (tree_view), GTK_EVENT_CONTROLLER (priv->multipress_gesture));
priv->click_gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->click_gesture), 0);
g_signal_connect (priv->click_gesture, "pressed",
G_CALLBACK (gtk_tree_view_click_gesture_pressed), tree_view);
g_signal_connect (priv->click_gesture, "released",
G_CALLBACK (gtk_tree_view_click_gesture_released), tree_view);
gtk_widget_add_controller (GTK_WIDGET (tree_view), GTK_EVENT_CONTROLLER (priv->click_gesture));
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_tree_view_column_multipress_gesture_pressed), tree_view);
G_CALLBACK (gtk_tree_view_column_click_gesture_pressed), tree_view);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_CAPTURE);
gtk_widget_add_controller (GTK_WIDGET (tree_view), GTK_EVENT_CONTROLLER (gesture));
@ -2796,7 +2796,7 @@ get_current_selection_modifiers (GtkWidget *widget,
}
static void
gtk_tree_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -3098,7 +3098,7 @@ gtk_tree_view_drag_gesture_begin (GtkGestureDrag *gesture,
}
static void
gtk_tree_view_column_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
gtk_tree_view_column_click_gesture_pressed (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -3298,7 +3298,7 @@ gtk_tree_view_drag_gesture_end (GtkGestureDrag *gesture,
}
static void
gtk_tree_view_multipress_gesture_released (GtkGestureMultiPress *gesture,
gtk_tree_view_click_gesture_released (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -4157,7 +4157,7 @@ gtk_tree_view_motion_controller_motion (GtkEventControllerMotion *controller,
/* If we are currently pressing down a button, we don't want to prelight anything else. */
if (gtk_gesture_is_active (tree_view->priv->drag_gesture) ||
gtk_gesture_is_active (tree_view->priv->multipress_gesture))
gtk_gesture_is_active (tree_view->priv->click_gesture))
node = NULL;
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
@ -7043,8 +7043,8 @@ gtk_tree_view_maybe_begin_dragging_row (GtkTreeView *tree_view)
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (tree_view->priv->drag_gesture));
/* Deny the multipress gesture */
gtk_gesture_set_state (GTK_GESTURE (tree_view->priv->multipress_gesture),
/* Deny the click gesture */
gtk_gesture_set_state (GTK_GESTURE (tree_view->priv->click_gesture),
GTK_EVENT_SEQUENCE_DENIED);
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, start_x, start_y,
@ -10174,7 +10174,7 @@ gtk_tree_view_ensure_interactive_directory (GtkTreeView *tree_view)
tree_view);
gtk_widget_add_controller (tree_view->priv->search_window, controller);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed",
G_CALLBACK (gtk_tree_view_search_pressed_cb), tree_view);
gtk_widget_add_controller (tree_view->priv->search_window, GTK_EVENT_CONTROLLER (gesture));
@ -11783,7 +11783,7 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
selection_changed = gtk_tree_view_unref_and_check_selection_tree (tree_view, node->children);
/* Stop a pending double click */
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (tree_view->priv->multipress_gesture));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (tree_view->priv->click_gesture));
_gtk_tree_view_accessible_remove (tree_view, node->children, NULL);
_gtk_tree_view_accessible_remove_state (tree_view,

View File

@ -45,7 +45,7 @@
#include "gtkeventcontrollerkey.h"
#include "gtkeventcontrollermotion.h"
#include "gtkgesturedrag.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkgestureprivate.h"
#include "gtkheaderbarprivate.h"
#include "gtkicontheme.h"
@ -269,7 +269,7 @@ typedef struct
GdkSurfaceTypeHint type_hint;
GtkGesture *multipress_gesture;
GtkGesture *click_gesture;
GtkGesture *drag_gesture;
GtkGesture *bubble_drag_gesture;
GtkEventController *key_controller;
@ -1333,7 +1333,7 @@ gtk_window_titlebar_action (GtkWindow *window,
}
static void
multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture,
click_gesture_pressed_cb (GtkGestureClick *gesture,
gint n_press,
gdouble x,
gdouble y,
@ -1548,7 +1548,7 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
gtk_get_current_event_time ());
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (priv->multipress_gesture));
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (priv->click_gesture));
}
}
@ -1908,13 +1908,13 @@ gtk_window_constructed (GObject *object)
if (priv->type == GTK_WINDOW_TOPLEVEL)
{
priv->multipress_gesture = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), 0);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->multipress_gesture),
priv->click_gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->click_gesture), 0);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->click_gesture),
GTK_PHASE_BUBBLE);
g_signal_connect (priv->multipress_gesture, "pressed",
G_CALLBACK (multipress_gesture_pressed_cb), object);
gtk_widget_add_controller (GTK_WIDGET (object), GTK_EVENT_CONTROLLER (priv->multipress_gesture));
g_signal_connect (priv->click_gesture, "pressed",
G_CALLBACK (click_gesture_pressed_cb), object);
gtk_widget_add_controller (GTK_WIDGET (object), GTK_EVENT_CONTROLLER (priv->click_gesture));
priv->drag_gesture = create_drag_gesture (window);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->drag_gesture),

View File

@ -32,7 +32,6 @@
#include "gtkstack.h"
#include "gtkmain.h"
#include "gtkwidgetprivate.h"
#include "gtkgesturemultipress.h"
#include "gtkeventcontrollermotion.h"
#include "gtkeventcontrollerkey.h"
#include "gtknative.h"

View File

@ -42,7 +42,7 @@
#include "gtklistbox.h"
#include "gtksizegroup.h"
#include "gtkroot.h"
#include "gtkgesturemultipress.h"
#include "gtkgestureclick.h"
#include "gtkstylecontext.h"
enum
@ -124,7 +124,7 @@ apply_sort (GtkInspectorPropList *pl,
}
static void
sort_changed (GtkGestureMultiPress *gesture,
sort_changed (GtkGestureClick *gesture,
int n_press,
double x,
double y,

View File

@ -17,7 +17,7 @@
<object class="GtkBox" id="name_heading">
<property name="hexpand">0</property>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<signal name="pressed" handler="sort_changed" swapped="no"/>
</object>
@ -48,7 +48,7 @@
<object class="GtkBox" id="origin_heading">
<property name="hexpand">0</property>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<signal name="pressed" handler="sort_changed" swapped="no"/>
</object>

View File

@ -238,7 +238,7 @@ gtk_public_sources = files([
'gtkgesture.c',
'gtkgesturedrag.c',
'gtkgesturelongpress.c',
'gtkgesturemultipress.c',
'gtkgestureclick.c',
'gtkgesturepan.c',
'gtkgesturerotate.c',
'gtkgesturesingle.c',
@ -496,7 +496,7 @@ gtk_public_headers = files([
'gtkgesture.h',
'gtkgesturedrag.h',
'gtkgesturelongpress.h',
'gtkgesturemultipress.h',
'gtkgestureclick.h',
'gtkgesturepan.h',
'gtkgesturerotate.h',
'gtkgesturesingle.h',

View File

@ -166,7 +166,7 @@
<property name="right-margin">8</property>
<property name="cursor-visible">0</property>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<signal name="released" handler="text_view_released" swapped="no"/>
</object>
</child>
@ -209,7 +209,7 @@
<property name="right-margin">8</property>
<property name="cursor-visible">0</property>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<signal name="released" handler="text_view_released" swapped="no"/>
</object>
</child>

View File

@ -45,7 +45,7 @@
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<property name="button">3</property>
<signal name="pressed" handler="pressed_cb"/>
</object>
@ -69,7 +69,7 @@
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<property name="button">3</property>
<signal name="pressed" handler="pressed_cb"/>
</object>
@ -93,7 +93,7 @@
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<property name="button">3</property>
<signal name="pressed" handler="pressed_cb"/>
</object>

View File

@ -146,9 +146,9 @@
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<property name="button">3</property>
<signal name="pressed" handler="multi_press_cb" swapped="no"/>
<signal name="pressed" handler="click_cb" swapped="no"/>
</object>
</child>
<child>

View File

@ -82,7 +82,7 @@
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<object class="GtkGestureClick">
<property name="button">3</property>
<signal name="pressed" handler="pressed_cb" swapped="no"/>
</object>

View File

@ -308,7 +308,7 @@ main (int argc, char **argv)
gtk_widget_set_tooltip_text (image, "Click me");
GtkGesture *gesture;
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (icon_pressed_cb), NULL);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
gtk_container_add (GTK_CONTAINER (box), image);

View File

@ -32,7 +32,7 @@ test_widget (const gchar *label, const gchar *color)
static GtkOrientation o;
static void
toggle_orientation (GtkGestureMultiPress *gesture,
toggle_orientation (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -55,7 +55,7 @@ simple_grid (void)
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (toggle_orientation), grid);
gtk_widget_add_controller (window, GTK_EVENT_CONTROLLER (gesture));

View File

@ -3320,7 +3320,7 @@ create_cursors (GtkWidget *widget)
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (darea), 80);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), cursor_draw, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), darea);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed", G_CALLBACK (cursor_pressed_cb), entry);
gtk_widget_add_controller (darea, GTK_EVENT_CONTROLLER (gesture));

View File

@ -356,7 +356,7 @@ do_popup_menu (GtkWidget *icon_list,
}
static void
press_handler (GtkGestureMultiPress *gesture,
press_handler (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -434,7 +434,7 @@ main (gint argc, gchar **argv)
tvc = gtk_tree_view_column_new ();
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), tvc);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed",

View File

@ -249,7 +249,7 @@ main (gint argc, gchar **argv)
tree_model = create_model ();
tree_view = gtk_tree_view_new_with_model (tree_model);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), tree_view);
gtk_widget_add_controller (tree_view, GTK_EVENT_CONTROLLER (gesture));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), TRUE);

View File

@ -53,7 +53,7 @@ clicked_icon (GtkTreeView *tv,
}
static void
release_event (GtkGestureMultiPress *gesture,
release_event (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
@ -129,7 +129,7 @@ int main (int argc, char *argv[])
gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_CAPTURE);
g_signal_connect (gesture, "released",

View File

@ -1,7 +1,7 @@
#include <gtk/gtk.h>
static void
start_resize (GtkGestureMultiPress *gesture,
start_resize (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -39,7 +39,7 @@ resize_button (GdkSurfaceEdge edge)
button = gtk_image_new_from_icon_name ("view-fullscreen-symbolic");
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_vexpand (button, TRUE);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (start_resize), GINT_TO_POINTER (edge));
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (gesture));
@ -47,7 +47,7 @@ resize_button (GdkSurfaceEdge edge)
}
static void
start_move (GtkGestureMultiPress *gesture,
start_move (GtkGestureClick *gesture,
int n_press,
double x,
double y,
@ -83,7 +83,7 @@ move_button (void)
button = gtk_image_new_from_icon_name ("view-grid-symbolic");
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_vexpand (button, TRUE);
gesture = gtk_gesture_multi_press_new ();
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "pressed", G_CALLBACK (start_move), NULL);
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (gesture));

View File

@ -341,7 +341,7 @@ add_gesture (GtkWidget *w, const gchar *name, GtkPropagationPhase phase, GString
data->str = str;
data->state = state;
g = gtk_gesture_multi_press_new ();
g = gtk_gesture_click_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (g), FALSE);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (g), 1);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (g), phase);