forked from AuroraMiddleware/gtk
Merge branch 'wip/carlosg/controller' into 'master'
carlosg/controller See merge request GNOME/gtk!131
This commit is contained in:
commit
1dcb76bc26
@ -321,10 +321,10 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_multi_press_new (image);
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Create the second image */
|
||||
image = gtk_image_new_from_icon_name ("process-stop");
|
||||
@ -346,10 +346,10 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_multi_press_new (image);
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@ -356,10 +356,11 @@ do_dnd (GtkWidget *do_widget)
|
||||
gtk_widget_set_hexpand (fixed, TRUE);
|
||||
gtk_widget_set_vexpand (fixed, TRUE);
|
||||
|
||||
multipress = gtk_gesture_multi_press_new (fixed);
|
||||
multipress = gtk_gesture_multi_press_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);
|
||||
gtk_widget_add_controller (fixed, GTK_EVENT_CONTROLLER (multipress));
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/dnd/dnd.css");
|
||||
|
@ -244,13 +244,14 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
g_signal_connect (da, "size-allocate",
|
||||
G_CALLBACK (scribble_size_allocate), NULL);
|
||||
|
||||
drag = gtk_gesture_drag_new (da);
|
||||
drag = gtk_gesture_drag_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
|
||||
g_object_set_data_full (G_OBJECT (da), "drag", drag, g_object_unref);
|
||||
gtk_widget_add_controller (da, GTK_EVENT_CONTROLLER (drag));
|
||||
|
||||
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), da);
|
||||
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), da);
|
||||
g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), da);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@ -581,8 +581,7 @@ init_pad_controller (GtkWidget *window,
|
||||
gint i;
|
||||
|
||||
action_group = g_simple_action_group_new ();
|
||||
pad_controller = gtk_pad_controller_new (GTK_WINDOW (window),
|
||||
G_ACTION_GROUP (action_group),
|
||||
pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
|
||||
@ -607,8 +606,7 @@ init_pad_controller (GtkWidget *window,
|
||||
|
||||
gtk_pad_controller_set_action_entries (pad_controller, pad_actions,
|
||||
G_N_ELEMENTS (pad_actions));
|
||||
g_object_set_data_full (G_OBJECT (window), "pad-controller",
|
||||
pad_controller, g_object_unref);
|
||||
gtk_widget_add_controller (window, GTK_EVENT_CONTROLLER (pad_controller));
|
||||
|
||||
g_object_unref (action_group);
|
||||
}
|
||||
|
@ -1718,9 +1718,10 @@ do_font_features (GtkWidget *do_widget)
|
||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
||||
|
||||
controller = gtk_event_controller_key_new (entry);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (entry), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
||||
gtk_widget_add_controller (entry, controller);
|
||||
|
||||
add_check_group (feature_list, _("Kerning"), (const char *[]){ "kern", NULL });
|
||||
add_check_group (feature_list, _("Ligatures"), (const char *[]){ "liga",
|
||||
|
@ -207,23 +207,27 @@ plane_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
static void
|
||||
gtk_font_plane_init (GtkFontPlane *plane)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (plane), FALSE);
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
|
||||
|
||||
plane->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->drag_gesture, "drag-begin",
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (gesture, "drag-begin",
|
||||
G_CALLBACK (plane_drag_gesture_begin), plane);
|
||||
g_signal_connect (plane->drag_gesture, "drag-update",
|
||||
g_signal_connect (gesture, "drag-update",
|
||||
G_CALLBACK (plane_drag_gesture_update), plane);
|
||||
g_signal_connect (plane->drag_gesture, "drag-end",
|
||||
g_signal_connect (gesture, "drag-end",
|
||||
G_CALLBACK (plane_drag_gesture_end), plane);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (plane->drag_gesture), 0);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
plane->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->long_press_gesture, "pressed",
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (hold_action), plane);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (plane->long_press_gesture),
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
TRUE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -234,9 +238,6 @@ plane_finalize (GObject *object)
|
||||
g_clear_object (&plane->weight_adj);
|
||||
g_clear_object (&plane->width_adj);
|
||||
|
||||
g_clear_object (&plane->drag_gesture);
|
||||
g_clear_object (&plane->long_press_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_font_plane_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ struct _GtkFontPlane
|
||||
GtkAdjustment *width_adj;
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkGesture *long_press_gesture;
|
||||
};
|
||||
|
||||
struct _GtkFontPlaneClass
|
||||
|
@ -157,12 +157,12 @@ do_gestures (GtkWidget *do_widget)
|
||||
NULL, NULL);
|
||||
|
||||
/* Swipe */
|
||||
gesture = gtk_gesture_swipe_new (drawing_area);
|
||||
gesture = gtk_gesture_swipe_new ();
|
||||
g_signal_connect (gesture, "swipe",
|
||||
G_CALLBACK (swipe_gesture_swept), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* 3fg swipe for touchpads */
|
||||
gesture = g_object_new (GTK_TYPE_GESTURE_SWIPE,
|
||||
@ -178,30 +178,30 @@ do_gestures (GtkWidget *do_widget)
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
|
||||
/* Long press */
|
||||
gesture = gtk_gesture_long_press_new (drawing_area);
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (long_press_gesture_pressed), drawing_area);
|
||||
g_signal_connect (gesture, "end",
|
||||
G_CALLBACK (long_press_gesture_end), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Rotate */
|
||||
rotate = gesture = gtk_gesture_rotate_new (drawing_area);
|
||||
rotate = gesture = gtk_gesture_rotate_new ();
|
||||
g_signal_connect (gesture, "angle-changed",
|
||||
G_CALLBACK (rotation_angle_changed), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Zoom */
|
||||
zoom = gesture = gtk_gesture_zoom_new (drawing_area);
|
||||
zoom = gesture = gtk_gesture_zoom_new ();
|
||||
g_signal_connect (gesture, "scale-changed",
|
||||
G_CALLBACK (zoom_scale_changed), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@ -256,9 +256,9 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
|
||||
controller = gtk_event_controller_key_new (view);
|
||||
g_object_set_data_full (G_OBJECT (view), "controller", controller, g_object_unref);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), view);
|
||||
gtk_widget_add_controller (view, controller);
|
||||
g_signal_connect (view, "event",
|
||||
G_CALLBACK (event_cb), NULL);
|
||||
|
||||
|
@ -11,8 +11,6 @@ typedef struct
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
GdkRGBA draw_color;
|
||||
|
||||
GtkGesture *stylus_gesture;
|
||||
} DrawingArea;
|
||||
|
||||
typedef struct
|
||||
@ -207,13 +205,16 @@ stylus_gesture_motion (GtkGestureStylus *gesture,
|
||||
static void
|
||||
drawing_area_init (DrawingArea *area)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (area), FALSE);
|
||||
|
||||
area->stylus_gesture = gtk_gesture_stylus_new (GTK_WIDGET (area));
|
||||
g_signal_connect (area->stylus_gesture, "down",
|
||||
gesture = gtk_gesture_stylus_new ();
|
||||
g_signal_connect (gesture, "down",
|
||||
G_CALLBACK (stylus_gesture_down), area);
|
||||
g_signal_connect (area->stylus_gesture, "motion",
|
||||
g_signal_connect (gesture, "motion",
|
||||
G_CALLBACK (stylus_gesture_motion), area);
|
||||
gtk_widget_add_controller (GTK_WIDGET (area), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ struct _IconBrowserWindow
|
||||
GtkWidget *image6;
|
||||
GtkWidget *label6;
|
||||
GtkWidget *description;
|
||||
GtkEventController *controller;
|
||||
};
|
||||
|
||||
struct _IconBrowserWindowClass
|
||||
@ -455,6 +454,7 @@ static void
|
||||
icon_browser_window_init (IconBrowserWindow *win)
|
||||
{
|
||||
GdkContentFormats *list;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
@ -484,8 +484,9 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
|
||||
symbolic_toggled (GTK_TOGGLE_BUTTON (win->symbolic_radio), win);
|
||||
|
||||
win->controller = gtk_event_controller_key_new (GTK_WIDGET (win));
|
||||
g_signal_connect (win->controller, "key-pressed", G_CALLBACK (key_event_cb), win);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_event_cb), win);
|
||||
gtk_widget_add_controller (GTK_WIDGET (win), controller);
|
||||
|
||||
populate (win);
|
||||
}
|
||||
@ -497,8 +498,6 @@ icon_browser_window_finalize (GObject *object)
|
||||
|
||||
g_hash_table_unref (win->contexts);
|
||||
|
||||
g_object_unref (win->controller);
|
||||
|
||||
G_OBJECT_CLASS (icon_browser_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -1646,7 +1646,6 @@ activate (GApplication *app)
|
||||
gint i;
|
||||
GPermission *permission;
|
||||
GAction *action;
|
||||
GtkGesture *gesture;
|
||||
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
@ -1671,6 +1670,7 @@ activate (GApplication *app)
|
||||
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
|
||||
gtk_builder_add_callback_symbol (builder, "scale_format_value", (GCallback)scale_format_value);
|
||||
gtk_builder_add_callback_symbol (builder, "scale_format_value_blank", (GCallback)scale_format_value_blank);
|
||||
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
|
||||
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
@ -1888,10 +1888,6 @@ activate (GApplication *app)
|
||||
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
|
||||
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
|
||||
gesture = gtk_gesture_multi_press_new (widget);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (osd_frame_pressed), widget);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
|
||||
g_object_unref (builder);
|
||||
|
@ -3101,6 +3101,11 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGestureMultiPress">
|
||||
<signal name="pressed" handler="osd_frame_pressed" object="osd_frame" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -4273,6 +4273,8 @@ gtk_widget_get_toplevel
|
||||
gtk_widget_get_ancestor
|
||||
gtk_widget_is_ancestor
|
||||
gtk_widget_translate_coordinates
|
||||
gtk_widget_add_controller
|
||||
gtk_widget_remove_controller
|
||||
gtk_widget_set_direction
|
||||
GtkTextDirection
|
||||
gtk_widget_get_direction
|
||||
|
@ -157,17 +157,16 @@ activate (GtkApplication *app,
|
||||
g_signal_connect_after (drawing_area, "size-allocate",
|
||||
G_CALLBACK (size_allocate_cb), NULL);
|
||||
|
||||
drag = gtk_gesture_drag_new (drawing_area);
|
||||
drag = gtk_gesture_drag_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
|
||||
g_object_set_data_full (G_OBJECT (drawing_area), "drag", drag, g_object_unref);
|
||||
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (drag));
|
||||
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), drawing_area);
|
||||
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 (drawing_area);
|
||||
press = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (press), GDK_BUTTON_SECONDARY);
|
||||
g_object_set_data_full (G_OBJECT (drawing_area), "press", press, g_object_unref);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (press));
|
||||
|
||||
g_signal_connect (press, "pressed", G_CALLBACK (pressed), drawing_area);
|
||||
|
||||
|
@ -41,10 +41,11 @@ activate_cb (GtkApplication *app,
|
||||
|
||||
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry));
|
||||
|
||||
controller = gtk_event_controller_key_new (window);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (window), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (window_key_pressed), search_bar);
|
||||
gtk_widget_add_controller (window, controller);
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -185,13 +185,6 @@ struct _GtkAboutDialogPrivate
|
||||
|
||||
GSList *visited_links;
|
||||
|
||||
GtkGesture *license_press;
|
||||
GtkGesture *system_press;
|
||||
GtkEventController *license_motion;
|
||||
GtkEventController *system_motion;
|
||||
GtkEventController *license_key;
|
||||
GtkEventController *system_key;
|
||||
|
||||
GtkLicense license_type;
|
||||
|
||||
guint hovering_over_link : 1;
|
||||
@ -614,6 +607,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, system_view);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, emit_activate_link);
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_released);
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_motion);
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_key_pressed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, stack_visible_child_notify);
|
||||
}
|
||||
|
||||
@ -777,19 +773,6 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
switch_page (about, "main");
|
||||
update_stack_switcher_visibility (about);
|
||||
|
||||
priv->license_press = gtk_gesture_multi_press_new (priv->license_view);
|
||||
g_signal_connect (priv->license_press, "released", G_CALLBACK (text_view_released), about);
|
||||
priv->system_press = gtk_gesture_multi_press_new (priv->system_view);
|
||||
g_signal_connect (priv->system_press, "released", G_CALLBACK (text_view_released), about);
|
||||
priv->license_motion = gtk_event_controller_motion_new (priv->license_view);
|
||||
g_signal_connect (priv->license_motion, "motion", G_CALLBACK (text_view_motion), about);
|
||||
priv->system_motion = gtk_event_controller_motion_new (priv->system_view);
|
||||
g_signal_connect (priv->system_motion, "motion", G_CALLBACK (text_view_motion), about);
|
||||
priv->license_key = gtk_event_controller_key_new (priv->license_view);
|
||||
g_signal_connect (priv->license_key, "key-pressed", G_CALLBACK (text_view_key_pressed), about);
|
||||
priv->system_key = gtk_event_controller_key_new (priv->system_view);
|
||||
g_signal_connect (priv->system_key, "key-pressed", G_CALLBACK (text_view_key_pressed), about);
|
||||
|
||||
/* force defaults */
|
||||
gtk_about_dialog_set_program_name (about, NULL);
|
||||
gtk_about_dialog_set_logo (about, NULL);
|
||||
@ -826,13 +809,6 @@ gtk_about_dialog_finalize (GObject *object)
|
||||
g_slist_free_full (priv->credit_sections, destroy_credit_section);
|
||||
g_slist_free_full (priv->visited_links, g_free);
|
||||
|
||||
g_object_unref (priv->license_press);
|
||||
g_object_unref (priv->system_press);
|
||||
g_object_unref (priv->license_motion);
|
||||
g_object_unref (priv->system_motion);
|
||||
g_object_unref (priv->license_key);
|
||||
g_object_unref (priv->system_key);
|
||||
|
||||
G_OBJECT_CLASS (gtk_about_dialog_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -428,6 +428,8 @@ gtk_action_bar_init (GtkActionBar *action_bar)
|
||||
gtk_container_add (GTK_CONTAINER (priv->revealer), priv->center_box);
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void
|
||||
gtk_action_bar_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
@ -438,14 +440,10 @@ gtk_action_bar_buildable_add_child (GtkBuildable *buildable,
|
||||
|
||||
if (type && strcmp (type, "center") == 0)
|
||||
gtk_action_bar_set_center_widget (action_bar, GTK_WIDGET (child));
|
||||
else if (!type)
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (action_bar, type);
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void
|
||||
gtk_action_bar_buildable_interface_init (GtkBuildableIface *iface)
|
||||
{
|
||||
|
@ -97,7 +97,6 @@ struct _GtkAppChooserWidgetPrivate {
|
||||
GAppInfoMonitor *monitor;
|
||||
|
||||
GtkWidget *popup_menu;
|
||||
GtkGesture *multipress_gesture;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -886,7 +885,6 @@ gtk_app_chooser_widget_finalize (GObject *object)
|
||||
g_free (self->priv->default_text);
|
||||
g_signal_handlers_disconnect_by_func (self->priv->monitor, app_info_changed, self);
|
||||
g_object_unref (self->priv->monitor);
|
||||
g_object_unref (self->priv->multipress_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->finalize (object);
|
||||
}
|
||||
@ -1139,6 +1137,7 @@ gtk_app_chooser_widget_init (GtkAppChooserWidget *self)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *sort;
|
||||
GtkGesture *gesture;
|
||||
|
||||
self->priv = gtk_app_chooser_widget_get_instance_private (self);
|
||||
|
||||
@ -1176,10 +1175,11 @@ gtk_app_chooser_widget_init (GtkAppChooserWidget *self)
|
||||
g_signal_connect (self->priv->monitor, "changed",
|
||||
G_CALLBACK (app_info_changed), self);
|
||||
|
||||
self->priv->multipress_gesture = gtk_gesture_multi_press_new (self->priv->program_list);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->priv->multipress_gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (self->priv->multipress_gesture, "pressed",
|
||||
gesture = gtk_gesture_multi_press_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);
|
||||
gtk_widget_add_controller (self->priv->program_list, GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
static GAppInfo *
|
||||
|
@ -124,7 +124,6 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
static void gtk_button_finalize (GObject *object);
|
||||
static void gtk_button_dispose (GObject *object);
|
||||
static void gtk_button_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -215,7 +214,6 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = gtk_button_dispose;
|
||||
gobject_class->finalize = gtk_button_finalize;
|
||||
gobject_class->set_property = gtk_button_set_property;
|
||||
gobject_class->get_property = gtk_button_get_property;
|
||||
|
||||
@ -442,7 +440,7 @@ gtk_button_init (GtkButton *button)
|
||||
priv->use_underline = FALSE;
|
||||
priv->child_type = WIDGET_CHILD;
|
||||
|
||||
priv->gesture = gtk_gesture_multi_press_new (GTK_WIDGET (button));
|
||||
priv->gesture = gtk_gesture_multi_press_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);
|
||||
@ -451,18 +449,7 @@ gtk_button_init (GtkButton *button)
|
||||
g_signal_connect (priv->gesture, "update", G_CALLBACK (multipress_gesture_update_cb), button);
|
||||
g_signal_connect (priv->gesture, "cancel", G_CALLBACK (multipress_gesture_cancel_cb), button);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->gesture), GTK_PHASE_CAPTURE);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_finalize (GObject *object)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON (object);
|
||||
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
||||
|
||||
g_clear_object (&priv->gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_button_parent_class)->finalize (object);
|
||||
gtk_widget_add_controller (GTK_WIDGET (button), GTK_EVENT_CONTROLLER (priv->gesture));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -248,14 +248,8 @@ struct _GtkCalendarPrivate
|
||||
gint detail_height_rows;
|
||||
gint detail_width_chars;
|
||||
gint detail_overflow[6];
|
||||
|
||||
GtkGesture *press_gesture;
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *scroll_controller;
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
|
||||
static void gtk_calendar_finalize (GObject *calendar);
|
||||
static void gtk_calendar_destroy (GtkWidget *widget);
|
||||
static void gtk_calendar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -372,7 +366,6 @@ gtk_calendar_class_init (GtkCalendarClass *class)
|
||||
|
||||
gobject_class->set_property = gtk_calendar_set_property;
|
||||
gobject_class->get_property = gtk_calendar_get_property;
|
||||
gobject_class->finalize = gtk_calendar_finalize;
|
||||
|
||||
widget_class->destroy = gtk_calendar_destroy;
|
||||
widget_class->snapshot = gtk_calendar_snapshot;
|
||||
@ -643,6 +636,8 @@ static void
|
||||
gtk_calendar_init (GtkCalendar *calendar)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (calendar);
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
time_t secs;
|
||||
struct tm *tm;
|
||||
gint i;
|
||||
@ -672,33 +667,35 @@ gtk_calendar_init (GtkCalendar *calendar)
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (calendar)),
|
||||
GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
priv->press_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (calendar));
|
||||
g_signal_connect (priv->press_gesture, "pressed", G_CALLBACK (gtk_calendar_button_press), calendar);
|
||||
g_signal_connect (priv->press_gesture, "released", G_CALLBACK (gtk_calendar_button_release), calendar);
|
||||
gesture = gtk_gesture_multi_press_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));
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (calendar));
|
||||
g_signal_connect (priv->drag_gesture, "drag-begin", G_CALLBACK (gtk_calendar_drag_begin), calendar);
|
||||
g_signal_connect (priv->drag_gesture, "drag-update", G_CALLBACK (gtk_calendar_drag_update), calendar);
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (gesture, "drag-begin", G_CALLBACK (gtk_calendar_drag_begin), calendar);
|
||||
g_signal_connect (gesture, "drag-update", G_CALLBACK (gtk_calendar_drag_update), calendar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (calendar), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (GTK_WIDGET (calendar),
|
||||
GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
controller =
|
||||
gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
g_signal_connect (priv->scroll_controller, "scroll",
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (gtk_calendar_scroll_controller_scroll),
|
||||
calendar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
|
||||
|
||||
priv->key_controller =
|
||||
gtk_event_controller_key_new (GTK_WIDGET (calendar));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_calendar_key_controller_key_pressed),
|
||||
calendar);
|
||||
g_signal_connect (priv->key_controller, "focus-in",
|
||||
g_signal_connect (controller, "focus-in",
|
||||
G_CALLBACK (gtk_calendar_key_controller_focus),
|
||||
calendar);
|
||||
g_signal_connect (priv->key_controller, "focus-out",
|
||||
g_signal_connect (controller, "focus-out",
|
||||
G_CALLBACK (gtk_calendar_key_controller_focus),
|
||||
calendar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
|
||||
|
||||
if (!default_abbreviated_dayname[0])
|
||||
for (i=0; i<7; i++)
|
||||
@ -1327,19 +1324,6 @@ calendar_set_month_prev (GtkCalendar *calendar)
|
||||
* Basic object methods *
|
||||
****************************************/
|
||||
|
||||
static void
|
||||
gtk_calendar_finalize (GObject *object)
|
||||
{
|
||||
GtkCalendarPrivate *priv = GTK_CALENDAR (object)->priv;
|
||||
|
||||
g_object_unref (priv->press_gesture);
|
||||
g_object_unref (priv->drag_gesture);
|
||||
g_object_unref (priv->scroll_controller);
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_calendar_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_calendar_destroy (GtkWidget *widget)
|
||||
{
|
||||
|
@ -520,7 +520,6 @@ struct _GtkCellEditableWidget
|
||||
GtkCellRendererAccelMode accel_mode;
|
||||
gchar *path;
|
||||
GtkCellRenderer *cell;
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -718,7 +717,6 @@ gtk_cell_editable_widget_finalize (GObject *object)
|
||||
{
|
||||
GtkCellEditableWidget *box = (GtkCellEditableWidget*)object;
|
||||
|
||||
g_object_unref (box->key_controller);
|
||||
g_free (box->path);
|
||||
|
||||
G_OBJECT_CLASS (gtk_cell_editable_widget_parent_class)->finalize (object);
|
||||
@ -757,14 +755,16 @@ static void
|
||||
gtk_cell_editable_widget_init (GtkCellEditableWidget *box)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (box);
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_set_can_focus (widget, TRUE);
|
||||
|
||||
box->key_controller = gtk_event_controller_key_new (widget);
|
||||
g_signal_connect (box->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (key_controller_key_pressed), box);
|
||||
g_signal_connect (box->key_controller, "modifiers",
|
||||
g_signal_connect (controller, "modifiers",
|
||||
G_CALLBACK (key_controller_modifiers), box);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
gtk_widget_set_has_surface (widget, FALSE);
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ enum {
|
||||
};
|
||||
|
||||
#define GTK_CELL_RENDERER_SPIN_PATH "gtk-cell-renderer-spin-path"
|
||||
#define GTK_CELL_RENDERER_SPIN_KEY_CONTROLLER "gtk-cell-renderer-spin-key-controller"
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkCellRendererSpin, gtk_cell_renderer_spin, GTK_TYPE_CELL_RENDERER_TEXT)
|
||||
|
||||
@ -340,13 +339,12 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell,
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
key_controller = gtk_event_controller_key_new (spin);
|
||||
key_controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (key_controller, "key-pressed",
|
||||
G_CALLBACK (gtk_cell_renderer_spin_key_pressed),
|
||||
spin);
|
||||
gtk_widget_add_controller (spin, key_controller);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (spin), GTK_CELL_RENDERER_SPIN_KEY_CONTROLLER,
|
||||
key_controller, g_object_unref);
|
||||
g_object_set_data_full (G_OBJECT (spin), GTK_CELL_RENDERER_SPIN_PATH,
|
||||
g_strdup (path), g_free);
|
||||
|
||||
|
@ -268,11 +268,23 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
|
||||
gtk_widget_class_set_css_name (widget_class, I_("cellview"));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_view_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (GTK_IS_CELL_RENDERER (child))
|
||||
_gtk_cell_layout_buildable_add_child (buildable, builder, child, type);
|
||||
else
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_view_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
iface->add_child = _gtk_cell_layout_buildable_add_child;
|
||||
iface->add_child = gtk_cell_view_buildable_add_child;
|
||||
iface->custom_tag_start = gtk_cell_view_buildable_custom_tag_start;
|
||||
iface->custom_tag_end = gtk_cell_view_buildable_custom_tag_end;
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ enum {
|
||||
PROP_ORIENTATION
|
||||
};
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void gtk_center_box_buildable_init (GtkBuildableIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkCenterBox, gtk_center_box, GTK_TYPE_WIDGET,
|
||||
@ -107,12 +109,14 @@ gtk_center_box_buildable_add_child (GtkBuildable *buildable,
|
||||
else if (g_strcmp0 (type, "end") == 0)
|
||||
gtk_center_box_set_end_widget (GTK_CENTER_BOX (buildable), GTK_WIDGET (child));
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_CENTER_BOX (buildable), type);
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_center_box_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->add_child = gtk_center_box_buildable_add_child;
|
||||
}
|
||||
|
||||
|
@ -61,11 +61,6 @@ struct _GtkColorEditorPrivate
|
||||
GtkAdjustment *v_adj;
|
||||
GtkAdjustment *a_adj;
|
||||
|
||||
GtkEventController *h_key;
|
||||
GtkEventController *s_key;
|
||||
GtkEventController *v_key;
|
||||
GtkEventController *a_key;
|
||||
|
||||
gint popup_position;
|
||||
|
||||
guint text_changed : 1;
|
||||
@ -345,6 +340,8 @@ scaled_adjustment (GtkAdjustment *a,
|
||||
static void
|
||||
gtk_color_editor_init (GtkColorEditor *editor)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
|
||||
editor->priv = gtk_color_editor_get_instance_private (editor);
|
||||
editor->priv->use_alpha = TRUE;
|
||||
|
||||
@ -374,14 +371,18 @@ gtk_color_editor_init (GtkColorEditor *editor)
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->h_popup);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->a_popup);
|
||||
|
||||
editor->priv->h_key = gtk_event_controller_key_new (editor->priv->h_entry);
|
||||
g_signal_connect (editor->priv->h_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
editor->priv->s_key = gtk_event_controller_key_new (editor->priv->s_entry);
|
||||
g_signal_connect (editor->priv->s_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
editor->priv->v_key = gtk_event_controller_key_new (editor->priv->v_entry);
|
||||
g_signal_connect (editor->priv->v_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
editor->priv->a_key = gtk_event_controller_key_new (editor->priv->a_entry);
|
||||
g_signal_connect (editor->priv->a_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->h_entry, controller);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->s_entry, controller);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->v_entry, controller);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->a_entry, controller);
|
||||
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (editor->priv->swatch), "activatable");
|
||||
}
|
||||
@ -393,11 +394,6 @@ gtk_color_editor_dispose (GObject *object)
|
||||
|
||||
dismiss_current_popup (editor);
|
||||
|
||||
g_clear_object (&editor->priv->h_key);
|
||||
g_clear_object (&editor->priv->s_key);
|
||||
g_clear_object (&editor->priv->v_key);
|
||||
g_clear_object (&editor->priv->a_key);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_editor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,6 @@ struct _GtkColorPlanePrivate
|
||||
GtkAdjustment *v_adj;
|
||||
|
||||
GdkTexture *texture;
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkGesture *long_press_gesture;
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -394,6 +390,8 @@ plane_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
static void
|
||||
gtk_color_plane_init (GtkColorPlane *plane)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
AtkObject *atk_obj;
|
||||
|
||||
plane->priv = gtk_color_plane_get_instance_private (plane);
|
||||
@ -408,24 +406,27 @@ gtk_color_plane_init (GtkColorPlane *plane)
|
||||
atk_object_set_role (atk_obj, ATK_ROLE_COLOR_CHOOSER);
|
||||
}
|
||||
|
||||
plane->priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->priv->drag_gesture, "drag-begin",
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (gesture, "drag-begin",
|
||||
G_CALLBACK (plane_drag_gesture_begin), plane);
|
||||
g_signal_connect (plane->priv->drag_gesture, "drag-update",
|
||||
g_signal_connect (gesture, "drag-update",
|
||||
G_CALLBACK (plane_drag_gesture_update), plane);
|
||||
g_signal_connect (plane->priv->drag_gesture, "drag-end",
|
||||
g_signal_connect (gesture, "drag-end",
|
||||
G_CALLBACK (plane_drag_gesture_end), plane);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (plane->priv->drag_gesture), 0);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
plane->priv->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->priv->long_press_gesture, "pressed",
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (hold_action), plane);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (plane->priv->long_press_gesture),
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
TRUE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
plane->priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (key_controller_key_pressed), plane);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -439,10 +440,6 @@ plane_finalize (GObject *object)
|
||||
g_clear_object (&plane->priv->s_adj);
|
||||
g_clear_object (&plane->priv->v_adj);
|
||||
|
||||
g_clear_object (&plane->priv->drag_gesture);
|
||||
g_clear_object (&plane->priv->long_press_gesture);
|
||||
g_clear_object (&plane->priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_plane_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,6 @@ struct _GtkColorScalePrivate
|
||||
{
|
||||
GdkRGBA color;
|
||||
GtkColorScaleType type;
|
||||
|
||||
GtkGesture *long_press_gesture;
|
||||
};
|
||||
|
||||
enum
|
||||
@ -163,29 +161,21 @@ static void
|
||||
gtk_color_scale_init (GtkColorScale *scale)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkGesture *gesture;
|
||||
|
||||
scale->priv = gtk_color_scale_get_instance_private (scale);
|
||||
|
||||
scale->priv->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (scale));
|
||||
g_signal_connect (scale->priv->long_press_gesture, "pressed",
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (hold_action), scale);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (scale->priv->long_press_gesture),
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_TARGET);
|
||||
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (scale));
|
||||
gtk_style_context_add_class (context, "color");
|
||||
}
|
||||
|
||||
static void
|
||||
scale_finalize (GObject *object)
|
||||
{
|
||||
GtkColorScale *scale = GTK_COLOR_SCALE (object);
|
||||
|
||||
g_clear_object (&scale->priv->long_press_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_scale_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -259,7 +249,6 @@ gtk_color_scale_class_init (GtkColorScaleClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = scale_finalize;
|
||||
object_class->get_property = scale_get_property;
|
||||
object_class->set_property = scale_set_property;
|
||||
|
||||
|
@ -65,9 +65,6 @@ struct _GtkColorSwatchPrivate
|
||||
guint selectable : 1;
|
||||
guint has_menu : 1;
|
||||
|
||||
GtkGesture *long_press_gesture;
|
||||
GtkGesture *multipress_gesture;
|
||||
GtkEventController *key_controller;
|
||||
GtkWidget *overlay_widget;
|
||||
|
||||
GtkWidget *popover;
|
||||
@ -504,10 +501,6 @@ swatch_dispose (GObject *object)
|
||||
swatch->priv->popover = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&swatch->priv->long_press_gesture);
|
||||
g_clear_object (&swatch->priv->multipress_gesture);
|
||||
g_clear_object (&swatch->priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_swatch_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@ -562,6 +555,9 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
|
||||
static void
|
||||
gtk_color_swatch_init (GtkColorSwatch *swatch)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
swatch->priv = gtk_color_swatch_get_instance_private (swatch);
|
||||
swatch->priv->use_alpha = TRUE;
|
||||
swatch->priv->selectable = TRUE;
|
||||
@ -570,20 +566,23 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (swatch), TRUE);
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (swatch), FALSE);
|
||||
|
||||
swatch->priv->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (swatch));
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (swatch->priv->long_press_gesture),
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
TRUE);
|
||||
g_signal_connect (swatch->priv->long_press_gesture, "pressed",
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (hold_action), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
swatch->priv->multipress_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (swatch));
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (swatch->priv->multipress_gesture), 0);
|
||||
g_signal_connect (swatch->priv->multipress_gesture, "pressed",
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (tap_action), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
swatch->priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (swatch));
|
||||
g_signal_connect (swatch->priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (key_controller_key_pressed), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), controller);
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (swatch)), "activatable");
|
||||
|
||||
|
@ -157,8 +157,6 @@ struct _GtkComboBoxPrivate
|
||||
GtkTreeViewRowSeparatorFunc row_separator_func;
|
||||
gpointer row_separator_data;
|
||||
GDestroyNotify row_separator_destroy;
|
||||
|
||||
GtkEventController *scroll_controller;
|
||||
};
|
||||
|
||||
/* There are 2 modes to this widget, which can be characterized as follows:
|
||||
@ -895,6 +893,7 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
GtkComboBoxPrivate *priv;
|
||||
GtkStyleContext *context;
|
||||
GtkTreeMenu *menu;
|
||||
GtkEventController *controller;
|
||||
|
||||
combo_box->priv = gtk_combo_box_get_instance_private (combo_box);
|
||||
priv = combo_box->priv;
|
||||
@ -938,13 +937,12 @@ gtk_combo_box_init (GtkComboBox *combo_box)
|
||||
GTK_WIDGET (combo_box),
|
||||
NULL);
|
||||
|
||||
priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (GTK_WIDGET (combo_box),
|
||||
GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
g_signal_connect (priv->scroll_controller, "scroll",
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (gtk_combo_box_scroll_controller_scroll),
|
||||
combo_box);
|
||||
gtk_widget_add_controller (GTK_WIDGET (combo_box), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2720,8 +2718,6 @@ gtk_combo_box_dispose (GObject* object)
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (object);
|
||||
GtkComboBoxPrivate *priv = combo_box->priv;
|
||||
|
||||
g_clear_object (&priv->scroll_controller);
|
||||
|
||||
if (priv->popup_widget)
|
||||
{
|
||||
/* Stop menu destruction triggering toggle on a now-invalid button */
|
||||
@ -3053,13 +3049,10 @@ gtk_combo_box_buildable_add_child (GtkBuildable *buildable,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (GTK_IS_WIDGET (child))
|
||||
{
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
return;
|
||||
}
|
||||
|
||||
_gtk_cell_layout_buildable_add_child (buildable, builder, child, type);
|
||||
if (GTK_IS_CELL_RENDERER (child))
|
||||
_gtk_cell_layout_buildable_add_child (buildable, builder, child, type);
|
||||
else
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -392,18 +392,22 @@ gtk_container_buildable_add_child (GtkBuildable *buildable,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (type)
|
||||
if (GTK_IS_WIDGET (child) &&
|
||||
_gtk_widget_get_parent (GTK_WIDGET (child)) == NULL)
|
||||
{
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
|
||||
}
|
||||
else if (GTK_IS_WIDGET (child) &&
|
||||
_gtk_widget_get_parent (GTK_WIDGET (child)) == NULL)
|
||||
{
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
if (type)
|
||||
{
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
}
|
||||
}
|
||||
else
|
||||
g_warning ("Cannot add an object of type %s to a container of type %s",
|
||||
g_type_name (G_OBJECT_TYPE (child)), g_type_name (G_OBJECT_TYPE (buildable)));
|
||||
{
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -1560,7 +1560,7 @@ gtk_dialog_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkDialogPrivate *priv = dialog->priv;
|
||||
|
||||
if (type == NULL)
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
else if (g_str_equal (type, "titlebar"))
|
||||
{
|
||||
priv->headerbar = GTK_WIDGET (child);
|
||||
|
@ -108,7 +108,8 @@ gtk_drag_source_site_destroy (gpointer data)
|
||||
gdk_content_formats_unref (site->target_list);
|
||||
|
||||
gtk_image_definition_unref (site->image_def);
|
||||
g_clear_object (&site->drag_gesture);
|
||||
/* This gets called only during widget finalization.
|
||||
* And widget finalization takes care of gestures. */
|
||||
g_slice_free (GtkDragSourceSite, site);
|
||||
}
|
||||
|
||||
@ -144,7 +145,7 @@ gtk_drag_source_set (GtkWidget *widget,
|
||||
{
|
||||
site = g_slice_new0 (GtkDragSourceSite);
|
||||
site->image_def = gtk_image_definition_new_empty ();
|
||||
site->drag_gesture = gtk_gesture_drag_new (widget);
|
||||
site->drag_gesture = gtk_gesture_drag_new ();
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (site->drag_gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (site->drag_gesture), 0);
|
||||
@ -154,6 +155,7 @@ gtk_drag_source_set (GtkWidget *widget,
|
||||
g_signal_connect (site->drag_gesture, "update",
|
||||
G_CALLBACK (gtk_drag_source_gesture_update),
|
||||
site);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (site->drag_gesture));
|
||||
|
||||
g_object_set_data_full (G_OBJECT (widget),
|
||||
I_("gtk-site-data"),
|
||||
|
@ -64,13 +64,6 @@ struct _GtkEmojiChooser
|
||||
EmojiSection symbols;
|
||||
EmojiSection flags;
|
||||
|
||||
GtkGesture *recent_long_press;
|
||||
GtkGesture *recent_multi_press;
|
||||
GtkGesture *people_long_press;
|
||||
GtkGesture *people_multi_press;
|
||||
GtkGesture *body_long_press;
|
||||
GtkGesture *body_multi_press;
|
||||
|
||||
GVariant *data;
|
||||
|
||||
GSettings *settings;
|
||||
@ -97,13 +90,6 @@ gtk_emoji_chooser_finalize (GObject *object)
|
||||
g_variant_unref (chooser->data);
|
||||
g_object_unref (chooser->settings);
|
||||
|
||||
g_clear_object (&chooser->recent_long_press);
|
||||
g_clear_object (&chooser->recent_multi_press);
|
||||
g_clear_object (&chooser->people_long_press);
|
||||
g_clear_object (&chooser->people_multi_press);
|
||||
g_clear_object (&chooser->body_long_press);
|
||||
g_clear_object (&chooser->body_multi_press);
|
||||
|
||||
G_OBJECT_CLASS (gtk_emoji_chooser_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -633,24 +619,6 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
chooser->recent_long_press = gtk_gesture_long_press_new (chooser->recent.box);
|
||||
g_signal_connect (chooser->recent_long_press, "pressed", G_CALLBACK (long_pressed_cb), chooser);
|
||||
chooser->recent_multi_press = gtk_gesture_multi_press_new (chooser->recent.box);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (chooser->recent_multi_press), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (chooser->recent_multi_press, "pressed", G_CALLBACK (pressed_cb), chooser);
|
||||
|
||||
chooser->people_long_press = gtk_gesture_long_press_new (chooser->people.box);
|
||||
g_signal_connect (chooser->people_long_press, "pressed", G_CALLBACK (long_pressed_cb), chooser);
|
||||
chooser->people_multi_press = gtk_gesture_multi_press_new (chooser->people.box);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (chooser->people_multi_press), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (chooser->people_multi_press, "pressed", G_CALLBACK (pressed_cb), chooser);
|
||||
|
||||
chooser->body_long_press = gtk_gesture_long_press_new (chooser->body.box);
|
||||
g_signal_connect (chooser->body_long_press, "pressed", G_CALLBACK (long_pressed_cb), chooser);
|
||||
chooser->body_multi_press = gtk_gesture_multi_press_new (chooser->body.box);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (chooser->body_multi_press), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (chooser->body_multi_press, "pressed", G_CALLBACK (pressed_cb), chooser);
|
||||
|
||||
adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (chooser->scrolled_window));
|
||||
g_signal_connect (adj, "value-changed", G_CALLBACK (adj_value_changed), chooser);
|
||||
|
||||
@ -750,6 +718,8 @@ gtk_emoji_chooser_class_init (GtkEmojiChooserClass *klass)
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, emoji_activated);
|
||||
gtk_widget_class_bind_template_callback (widget_class, search_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, long_pressed_cb);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
@ -47,8 +47,6 @@ struct _GtkEmojiCompletion
|
||||
GtkWidget *active_variation;
|
||||
|
||||
GVariant *data;
|
||||
|
||||
GtkGesture *long_press;
|
||||
};
|
||||
|
||||
struct _GtkEmojiCompletionClass {
|
||||
@ -76,8 +74,6 @@ gtk_emoji_completion_finalize (GObject *object)
|
||||
g_free (completion->text);
|
||||
g_variant_unref (completion->data);
|
||||
|
||||
g_clear_object (&completion->long_press);
|
||||
|
||||
G_OBJECT_CLASS (gtk_emoji_completion_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -625,14 +621,16 @@ static void
|
||||
gtk_emoji_completion_init (GtkEmojiCompletion *completion)
|
||||
{
|
||||
g_autoptr(GBytes) bytes = NULL;
|
||||
GtkGesture *long_press;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (completion));
|
||||
|
||||
bytes = g_resources_lookup_data ("/org/gtk/libgtk/emoji/emoji.data", 0, NULL);
|
||||
completion->data = g_variant_ref_sink (g_variant_new_from_bytes (G_VARIANT_TYPE ("a(auss)"), bytes, TRUE));
|
||||
|
||||
completion->long_press = gtk_gesture_long_press_new (completion->list);
|
||||
g_signal_connect (completion->long_press, "pressed", G_CALLBACK (long_pressed_cb), completion);
|
||||
long_press = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (long_press, "pressed", G_CALLBACK (long_pressed_cb), completion);
|
||||
gtk_widget_add_controller (completion->list, GTK_EVENT_CONTROLLER (long_press));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -213,8 +213,6 @@ struct _GtkEntryPrivate
|
||||
GtkWidget *magnifier;
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkGesture *multipress_gesture;
|
||||
GtkEventController *motion_controller;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GtkWidget *progress_widget;
|
||||
@ -2517,6 +2515,8 @@ gtk_entry_init (GtkEntry *entry)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
GtkCssNode *widget_node;
|
||||
GtkGesture *gesture;
|
||||
GtkEventController *controller;
|
||||
gint i;
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (entry), TRUE);
|
||||
@ -2557,25 +2557,28 @@ gtk_entry_init (GtkEntry *entry)
|
||||
|
||||
gtk_entry_update_cached_style_values (entry);
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (entry));
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (priv->drag_gesture, "drag-update",
|
||||
G_CALLBACK (gtk_entry_drag_gesture_update), entry);
|
||||
g_signal_connect (priv->drag_gesture, "drag-end",
|
||||
G_CALLBACK (gtk_entry_drag_gesture_end), entry);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->drag_gesture), 0);
|
||||
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->drag_gesture), TRUE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (entry), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (entry));
|
||||
g_signal_connect (priv->multipress_gesture, "pressed",
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (gtk_entry_multipress_gesture_pressed), entry);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), 0);
|
||||
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (priv->multipress_gesture), TRUE);
|
||||
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 (entry), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (entry));
|
||||
g_signal_connect (priv->motion_controller, "motion",
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "motion",
|
||||
G_CALLBACK (entry_motion_cb), entry);
|
||||
gtk_widget_add_controller (GTK_WIDGET (entry), controller);
|
||||
|
||||
priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (entry));
|
||||
priv->key_controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
G_CALLBACK (gtk_entry_key_controller_key_pressed), entry);
|
||||
g_signal_connect_swapped (priv->key_controller, "im-update",
|
||||
@ -2586,6 +2589,7 @@ gtk_entry_init (GtkEntry *entry)
|
||||
G_CALLBACK (gtk_entry_focus_out), entry);
|
||||
gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (priv->key_controller),
|
||||
priv->im_context);
|
||||
gtk_widget_add_controller (GTK_WIDGET (entry), priv->key_controller);
|
||||
|
||||
widget_node = gtk_widget_get_css_node (GTK_WIDGET (entry));
|
||||
for (i = 0; i < 2; i++)
|
||||
@ -2795,10 +2799,6 @@ gtk_entry_finalize (GObject *object)
|
||||
g_free (priv->placeholder_text);
|
||||
g_free (priv->im_module);
|
||||
|
||||
g_clear_object (&priv->drag_gesture);
|
||||
g_clear_object (&priv->multipress_gesture);
|
||||
g_clear_object (&priv->motion_controller);
|
||||
|
||||
if (priv->tabs)
|
||||
pango_tab_array_free (priv->tabs);
|
||||
|
||||
|
@ -2471,10 +2471,12 @@ maybe_accept_completion (GtkEntry *entry,
|
||||
static void
|
||||
connect_completion_signals (GtkEntryCompletion *completion)
|
||||
{
|
||||
completion->priv->entry_key_controller =
|
||||
gtk_event_controller_key_new (completion->priv->entry);
|
||||
g_signal_connect (completion->priv->entry_key_controller, "key-pressed",
|
||||
GtkEventController *controller;
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_entry_completion_key_pressed), completion);
|
||||
gtk_widget_add_controller (completion->priv->entry, controller);
|
||||
|
||||
completion->priv->changed_id =
|
||||
g_signal_connect (completion->priv->entry, "changed",
|
||||
@ -2524,8 +2526,6 @@ unset_accessible_relation (GtkWidget *window,
|
||||
static void
|
||||
disconnect_completion_signals (GtkEntryCompletion *completion)
|
||||
{
|
||||
g_clear_object (&completion->priv->entry_key_controller);
|
||||
|
||||
if (completion->priv->changed_id > 0 &&
|
||||
g_signal_handler_is_connected (completion->priv->entry,
|
||||
completion->priv->changed_id))
|
||||
|
@ -56,8 +56,25 @@ struct _GtkEventControllerPrivate
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkEventController, gtk_event_controller, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gtk_event_controller_set_widget (GtkEventController *self,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (self);
|
||||
|
||||
priv->widget = widget;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_event_controller_unset_widget (GtkEventController *self)
|
||||
{
|
||||
GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (self);
|
||||
|
||||
priv->widget = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_event_controller_handle_event_default (GtkEventController *controller,
|
||||
gtk_event_controller_handle_event_default (GtkEventController *self,
|
||||
const GdkEvent *event)
|
||||
{
|
||||
return FALSE;
|
||||
@ -70,18 +87,9 @@ gtk_event_controller_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkEventController *self = GTK_EVENT_CONTROLLER (object);
|
||||
GtkEventControllerPrivate *priv = gtk_event_controller_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WIDGET:
|
||||
priv->widget = g_value_get_object (value);
|
||||
if (priv->widget)
|
||||
{
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->widget), (gpointer *) &priv->widget);
|
||||
_gtk_widget_add_controller (priv->widget, self);
|
||||
}
|
||||
break;
|
||||
case PROP_PROPAGATION_PHASE:
|
||||
gtk_event_controller_set_propagation_phase (self,
|
||||
g_value_get_enum (value));
|
||||
@ -113,34 +121,18 @@ gtk_event_controller_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_event_controller_dispose (GObject *object)
|
||||
{
|
||||
GtkEventController *controller = GTK_EVENT_CONTROLLER (object);
|
||||
GtkEventControllerPrivate *priv;
|
||||
|
||||
priv = gtk_event_controller_get_instance_private (controller);
|
||||
if (priv->widget)
|
||||
{
|
||||
_gtk_widget_remove_controller (priv->widget, controller);
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->widget), (gpointer *) &priv->widget);
|
||||
priv->widget = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_event_controller_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_event_controller_class_init (GtkEventControllerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
klass->set_widget = gtk_event_controller_set_widget;
|
||||
klass->unset_widget = gtk_event_controller_unset_widget;
|
||||
klass->filter_event = gtk_event_controller_handle_event_default;
|
||||
klass->handle_event = gtk_event_controller_handle_event_default;
|
||||
|
||||
object_class->set_property = gtk_event_controller_set_property;
|
||||
object_class->get_property = gtk_event_controller_get_property;
|
||||
object_class->dispose = gtk_event_controller_dispose;
|
||||
|
||||
/**
|
||||
* GtkEventController:widget:
|
||||
@ -152,7 +144,7 @@ gtk_event_controller_class_init (GtkEventControllerClass *klass)
|
||||
P_("Widget"),
|
||||
P_("Widget the gesture relates to"),
|
||||
GTK_TYPE_WIDGET,
|
||||
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
|
||||
GTK_PARAM_READABLE);
|
||||
/**
|
||||
* GtkEventController:propagation-phase:
|
||||
*
|
||||
|
@ -24,7 +24,6 @@
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
typedef struct _GtkEventController GtkEventController;
|
||||
typedef struct _GtkEventControllerClass GtkEventControllerClass;
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
@ -205,12 +205,9 @@ gtk_event_controller_key_init (GtkEventControllerKey *controller)
|
||||
}
|
||||
|
||||
GtkEventController *
|
||||
gtk_event_controller_key_new (GtkWidget *widget)
|
||||
gtk_event_controller_key_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_EVENT_CONTROLLER_KEY,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_event_controller_key_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkEventController *gtk_event_controller_key_new (GtkWidget *widget);
|
||||
GtkEventController *gtk_event_controller_key_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_event_controller_key_set_im_context (GtkEventControllerKey *controller,
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "gtkeventcontrollerlegacyprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkEventControllerLegacy, _gtk_event_controller_legacy,
|
||||
G_DEFINE_TYPE (GtkEventControllerLegacy, gtk_event_controller_legacy,
|
||||
GTK_TYPE_EVENT_CONTROLLER)
|
||||
|
||||
static gboolean
|
||||
@ -33,7 +33,7 @@ gtk_event_controller_legacy_handle_event (GtkEventController *controller,
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass)
|
||||
gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass)
|
||||
{
|
||||
GtkEventControllerClass *controller_class = GTK_EVENT_CONTROLLER_CLASS (klass);
|
||||
|
||||
@ -41,16 +41,13 @@ _gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_event_controller_legacy_init (GtkEventControllerLegacy *controller)
|
||||
gtk_event_controller_legacy_init (GtkEventControllerLegacy *controller)
|
||||
{
|
||||
}
|
||||
|
||||
GtkEventController *
|
||||
_gtk_event_controller_legacy_new (GtkWidget *widget)
|
||||
gtk_event_controller_legacy_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_EVENT_CONTROLLER_LEGACY,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_EVENT_CONTROLLER_LEGACY (_gtk_event_controller_legacy_get_type ())
|
||||
#define GTK_TYPE_EVENT_CONTROLLER_LEGACY (gtk_event_controller_legacy_get_type ())
|
||||
#define GTK_EVENT_CONTROLLER_LEGACY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_EVENT_CONTROLLER_LEGACY, GtkEventControllerLegacy))
|
||||
#define GTK_EVENT_CONTROLLER_LEGACY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GTK_TYPE_EVENT_CONTROLLER_LEGACY, GtkEventControllerLegacyClass))
|
||||
#define GTK_IS_EVENT_CONTROLLER_LEGACY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_EVENT_CONTROLLER_LEGACY))
|
||||
@ -45,7 +45,7 @@ struct _GtkEventControllerLegacyClass
|
||||
GtkEventControllerClass parent_class;
|
||||
};
|
||||
|
||||
GType _gtk_event_controller_legacy_get_type (void) G_GNUC_CONST;
|
||||
GtkEventController *_gtk_event_controller_legacy_new (GtkWidget *widget);
|
||||
GType gtk_event_controller_legacy_get_type (void) G_GNUC_CONST;
|
||||
GtkEventController *gtk_event_controller_legacy_new (void);
|
||||
|
||||
#endif /* __GTK_EVENT_CONTROLLER_LEGACY_H__ */
|
||||
|
@ -149,19 +149,14 @@ gtk_event_controller_motion_init (GtkEventControllerMotion *motion)
|
||||
|
||||
/**
|
||||
* gtk_event_controller_motion_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Creates a new event controller that will handle motion events
|
||||
* for the given @widget.
|
||||
* Creates a new event controller that will handle motion events.
|
||||
*
|
||||
* Returns: a new #GtkEventControllerMotion
|
||||
**/
|
||||
GtkEventController *
|
||||
gtk_event_controller_motion_new (GtkWidget *widget)
|
||||
gtk_event_controller_motion_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_EVENT_CONTROLLER_MOTION,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_event_controller_motion_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkEventController *gtk_event_controller_motion_new (GtkWidget *widget);
|
||||
GtkEventController *gtk_event_controller_motion_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -31,6 +31,9 @@ struct _GtkEventControllerClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* set_widget) (GtkEventController *controller,
|
||||
GtkWidget *widget);
|
||||
void (* unset_widget) (GtkEventController *controller);
|
||||
gboolean (* handle_event) (GtkEventController *controller,
|
||||
const GdkEvent *event);
|
||||
void (* reset) (GtkEventController *controller);
|
||||
|
@ -450,22 +450,16 @@ gtk_event_controller_scroll_init (GtkEventControllerScroll *scroll)
|
||||
|
||||
/**
|
||||
* gtk_event_controller_scroll_new:
|
||||
* @widget: a #GtkWidget
|
||||
* @flags: behavior flags
|
||||
*
|
||||
* Creates a new event controller that will handle scroll events
|
||||
* for the given @widget.
|
||||
* Creates a new event controller that will handle scroll events.
|
||||
*
|
||||
* Returns: a new #GtkEventControllerScroll
|
||||
**/
|
||||
GtkEventController *
|
||||
gtk_event_controller_scroll_new (GtkWidget *widget,
|
||||
GtkEventControllerScrollFlags flags)
|
||||
gtk_event_controller_scroll_new (GtkEventControllerScrollFlags flags)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_EVENT_CONTROLLER_SCROLL,
|
||||
"widget", widget,
|
||||
"flags", flags,
|
||||
NULL);
|
||||
}
|
||||
|
@ -64,8 +64,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_event_controller_scroll_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkEventController *gtk_event_controller_scroll_new (GtkWidget *widget,
|
||||
GtkEventControllerScrollFlags flags);
|
||||
GtkEventController *gtk_event_controller_scroll_new (GtkEventControllerScrollFlags flags);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_event_controller_scroll_set_flags (GtkEventControllerScroll *scroll,
|
||||
GtkEventControllerScrollFlags flags);
|
||||
|
@ -155,8 +155,6 @@ struct _GtkExpanderPrivate
|
||||
GtkWidget *arrow_widget;
|
||||
GtkWidget *child;
|
||||
|
||||
GtkGesture *multipress_gesture;
|
||||
|
||||
guint expand_timer;
|
||||
|
||||
guint expanded : 1;
|
||||
@ -338,6 +336,7 @@ static void
|
||||
gtk_expander_init (GtkExpander *expander)
|
||||
{
|
||||
GtkExpanderPrivate *priv = gtk_expander_get_instance_private (expander);
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (expander), TRUE);
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (expander), FALSE);
|
||||
@ -367,34 +366,37 @@ 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);
|
||||
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new (priv->title_widget);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture),
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
|
||||
GDK_BUTTON_PRIMARY);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->multipress_gesture),
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
FALSE);
|
||||
g_signal_connect (priv->multipress_gesture, "released",
|
||||
g_signal_connect (gesture, "released",
|
||||
G_CALLBACK (gesture_multipress_released_cb), expander);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->multipress_gesture),
|
||||
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));
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void
|
||||
gtk_expander_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (!type)
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
else if (strcmp (type, "label") == 0)
|
||||
if (g_strcmp0 (type, "label") == 0)
|
||||
gtk_expander_set_label_widget (GTK_EXPANDER (buildable), GTK_WIDGET (child));
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_EXPANDER (buildable), type);
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_expander_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->add_child = gtk_expander_buildable_add_child;
|
||||
}
|
||||
|
||||
@ -489,8 +491,6 @@ gtk_expander_destroy (GtkWidget *widget)
|
||||
priv->arrow_widget = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->multipress_gesture);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_expander_parent_class)->destroy (widget);
|
||||
}
|
||||
|
||||
|
@ -251,10 +251,6 @@ struct _GtkFileChooserWidgetPrivate {
|
||||
GtkWidget *rename_file_popover;
|
||||
GFile *rename_file_source_file;
|
||||
|
||||
GtkGesture *long_press_gesture;
|
||||
GtkGesture *multipress_gesture;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GtkFileSystemModel *browse_files_model;
|
||||
char *browse_files_last_selected_name;
|
||||
|
||||
@ -3552,10 +3548,6 @@ gtk_file_chooser_widget_dispose (GObject *object)
|
||||
priv->box = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->long_press_gesture);
|
||||
g_clear_object (&priv->multipress_gesture);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@ -8410,6 +8402,9 @@ 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, long_press_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, key_press_cb);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("filechooser"));
|
||||
}
|
||||
@ -8546,20 +8541,6 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
|
||||
priv->bookmarks_manager = _gtk_bookmarks_manager_new (NULL, NULL);
|
||||
|
||||
priv->long_press_gesture = gtk_gesture_long_press_new (priv->browse_files_tree_view);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->long_press_gesture), TRUE);
|
||||
g_signal_connect (priv->long_press_gesture, "pressed",
|
||||
G_CALLBACK (long_press_cb), impl);
|
||||
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new (priv->browse_files_tree_view);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (priv->multipress_gesture, "pressed",
|
||||
G_CALLBACK (multi_press_cb), impl);
|
||||
|
||||
priv->key_controller = gtk_event_controller_key_new (priv->browse_files_tree_view);
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
G_CALLBACK (key_press_cb), impl);
|
||||
|
||||
/* Setup various attributes and callbacks in the UI
|
||||
* which cannot be done with GtkBuilder
|
||||
*/
|
||||
|
@ -665,9 +665,7 @@ struct _GtkFlowBoxPrivate {
|
||||
gpointer sort_data;
|
||||
GDestroyNotify sort_destroy;
|
||||
|
||||
GtkGesture *multipress_gesture;
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GtkFlowBoxChild *rubberband_first;
|
||||
GtkFlowBoxChild *rubberband_last;
|
||||
@ -3378,10 +3376,6 @@ gtk_flow_box_finalize (GObject *obj)
|
||||
g_clear_object (&priv->hadjustment);
|
||||
g_clear_object (&priv->vadjustment);
|
||||
|
||||
g_object_unref (priv->drag_gesture);
|
||||
g_object_unref (priv->multipress_gesture);
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
if (priv->bound_model)
|
||||
{
|
||||
if (priv->create_widget_func_data_destroy)
|
||||
@ -3727,6 +3721,8 @@ static void
|
||||
gtk_flow_box_init (GtkFlowBox *box)
|
||||
{
|
||||
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (box), FALSE);
|
||||
|
||||
@ -3741,23 +3737,24 @@ gtk_flow_box_init (GtkFlowBox *box)
|
||||
|
||||
priv->children = g_sequence_new (NULL);
|
||||
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (box));
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->multipress_gesture),
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
FALSE);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture),
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
|
||||
GDK_BUTTON_PRIMARY);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->multipress_gesture),
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_signal_connect (priv->multipress_gesture, "pressed",
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (gtk_flow_box_multipress_gesture_pressed), box);
|
||||
g_signal_connect (priv->multipress_gesture, "released",
|
||||
g_signal_connect (gesture, "released",
|
||||
G_CALLBACK (gtk_flow_box_multipress_gesture_released), box);
|
||||
g_signal_connect (priv->multipress_gesture, "stopped",
|
||||
g_signal_connect (gesture, "stopped",
|
||||
G_CALLBACK (gtk_flow_box_multipress_gesture_stopped), box);
|
||||
g_signal_connect (priv->multipress_gesture, "unpaired-release",
|
||||
g_signal_connect (gesture, "unpaired-release",
|
||||
G_CALLBACK (gtk_flow_box_multipress_unpaired_release), box);
|
||||
gtk_widget_add_controller (GTK_WIDGET (box), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (box));
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->drag_gesture),
|
||||
FALSE);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->drag_gesture),
|
||||
@ -3770,10 +3767,12 @@ gtk_flow_box_init (GtkFlowBox *box)
|
||||
G_CALLBACK (gtk_flow_box_drag_gesture_update), box);
|
||||
g_signal_connect (priv->drag_gesture, "drag-end",
|
||||
G_CALLBACK (gtk_flow_box_drag_gesture_end), box);
|
||||
gtk_widget_add_controller (GTK_WIDGET (box), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (box));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_flow_box_key_controller_key_pressed), box);
|
||||
gtk_widget_add_controller (GTK_WIDGET (box), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -629,16 +629,6 @@ gtk_font_chooser_widget_map (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->map (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_scroll_resize (GtkWidget *widget,
|
||||
GtkFontChooserWidget *fontchooser)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
|
||||
controller = gtk_event_controller_scroll_new (widget, GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL);
|
||||
g_signal_connect (controller, "scroll", G_CALLBACK (resize_by_scroll_cb), fontchooser);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_font_chooser_widget_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
@ -767,6 +757,7 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
|
||||
gtk_widget_class_bind_template_callback (widget_class, size_change_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, output_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, selection_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, resize_by_scroll_cb);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("fontchooser"));
|
||||
}
|
||||
@ -889,9 +880,6 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
|
||||
fontchooser,
|
||||
NULL);
|
||||
|
||||
setup_scroll_resize (priv->preview, fontchooser);
|
||||
setup_scroll_resize (priv->size_slider, fontchooser);
|
||||
|
||||
priv->tweak_action = G_ACTION (g_simple_action_new_stateful ("tweak", NULL, g_variant_new_boolean (FALSE)));
|
||||
g_signal_connect (priv->tweak_action, "change-state", G_CALLBACK (change_tweak), fontchooser);
|
||||
|
||||
@ -2026,11 +2014,10 @@ 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 (feat);
|
||||
g_object_set_data_full (G_OBJECT (feat), "press", gesture, g_object_unref);
|
||||
|
||||
gesture = gtk_gesture_multi_press_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));
|
||||
|
||||
example = gtk_label_new ("");
|
||||
gtk_label_set_selectable (GTK_LABEL (example), TRUE);
|
||||
|
@ -206,9 +206,13 @@ gtk_frame_class_init (GtkFrameClass *class)
|
||||
gtk_widget_class_set_css_name (widget_class, I_("frame"));
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void
|
||||
gtk_frame_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->add_child = gtk_frame_buildable_add_child;
|
||||
}
|
||||
|
||||
@ -220,10 +224,8 @@ gtk_frame_buildable_add_child (GtkBuildable *buildable,
|
||||
{
|
||||
if (type && strcmp (type, "label") == 0)
|
||||
gtk_frame_set_label_widget (GTK_FRAME (buildable), GTK_WIDGET (child));
|
||||
else if (!type)
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_FRAME (buildable), type);
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1472,6 +1472,9 @@ _gtk_gesture_get_group_link (GtkGesture *gesture)
|
||||
* Adds @gesture to the same group than @group_gesture. Gestures
|
||||
* are by default isolated in their own groups.
|
||||
*
|
||||
* Both gestures must have been added to the same widget before they
|
||||
* can be grouped.
|
||||
*
|
||||
* When gestures are grouped, the state of #GdkEventSequences
|
||||
* is kept in sync for all of those, so calling gtk_gesture_set_sequence_state(),
|
||||
* on one will transfer the same value to the others.
|
||||
|
@ -195,19 +195,15 @@ gtk_gesture_drag_init (GtkGestureDrag *gesture)
|
||||
|
||||
/**
|
||||
* gtk_gesture_drag_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Returns a newly created #GtkGesture that recognizes drags.
|
||||
*
|
||||
* Returns: a newly created #GtkGestureDrag
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_drag_new (GtkWidget *widget)
|
||||
gtk_gesture_drag_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_GESTURE_DRAG,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_gesture_drag_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_drag_new (GtkWidget *widget);
|
||||
GtkGesture * gtk_gesture_drag_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_gesture_drag_get_start_point (GtkGestureDrag *gesture,
|
||||
|
@ -323,18 +323,14 @@ gtk_gesture_long_press_class_init (GtkGestureLongPressClass *klass)
|
||||
|
||||
/**
|
||||
* gtk_gesture_long_press_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Returns a newly created #GtkGesture that recognizes long presses.
|
||||
*
|
||||
* Returns: a newly created #GtkGestureLongPress
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_long_press_new (GtkWidget *widget)
|
||||
gtk_gesture_long_press_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_GESTURE_LONG_PRESS,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_gesture_long_press_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_long_press_new (GtkWidget *widget);
|
||||
GtkGesture * gtk_gesture_long_press_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -432,7 +432,6 @@ gtk_gesture_multi_press_init (GtkGestureMultiPress *gesture)
|
||||
|
||||
/**
|
||||
* gtk_gesture_multi_press_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Returns a newly created #GtkGesture that recognizes single and multiple
|
||||
* presses.
|
||||
@ -440,12 +439,9 @@ gtk_gesture_multi_press_init (GtkGestureMultiPress *gesture)
|
||||
* Returns: a newly created #GtkGestureMultiPress
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_multi_press_new (GtkWidget *widget)
|
||||
gtk_gesture_multi_press_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_GESTURE_MULTI_PRESS,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ 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 (GtkWidget *widget);
|
||||
GtkGesture * gtk_gesture_multi_press_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_gesture_multi_press_set_area (GtkGestureMultiPress *gesture,
|
||||
|
@ -276,13 +276,9 @@ gtk_gesture_pan_init (GtkGesturePan *gesture)
|
||||
* Returns: a newly created #GtkGesturePan
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_pan_new (GtkWidget *widget,
|
||||
GtkOrientation orientation)
|
||||
gtk_gesture_pan_new (GtkOrientation orientation)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_GESTURE_PAN,
|
||||
"widget", widget,
|
||||
"orientation", orientation,
|
||||
NULL);
|
||||
}
|
||||
|
@ -42,8 +42,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_gesture_pan_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_pan_new (GtkWidget *widget,
|
||||
GtkOrientation orientation);
|
||||
GtkGesture * gtk_gesture_pan_new (GtkOrientation orientation);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_gesture_pan_get_orientation (GtkGesturePan *gesture);
|
||||
|
@ -248,7 +248,6 @@ gtk_gesture_rotate_class_init (GtkGestureRotateClass *klass)
|
||||
|
||||
/**
|
||||
* gtk_gesture_rotate_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Returns a newly created #GtkGesture that recognizes 2-touch
|
||||
* rotation gestures.
|
||||
@ -256,12 +255,9 @@ gtk_gesture_rotate_class_init (GtkGestureRotateClass *klass)
|
||||
* Returns: a newly created #GtkGestureRotate
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_rotate_new (GtkWidget *widget)
|
||||
gtk_gesture_rotate_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_GESTURE_ROTATE,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_gesture_rotate_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_rotate_new (GtkWidget *widget);
|
||||
GtkGesture * gtk_gesture_rotate_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gdouble gtk_gesture_rotate_get_angle_delta (GtkGestureRotate *gesture);
|
||||
|
@ -131,7 +131,6 @@ gtk_gesture_stylus_init (GtkGestureStylus *gesture)
|
||||
|
||||
/**
|
||||
* gtk_gesture_stylus_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Creates a new #GtkGestureStylus.
|
||||
*
|
||||
@ -140,10 +139,9 @@ gtk_gesture_stylus_init (GtkGestureStylus *gesture)
|
||||
* Since: 3.94
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_stylus_new (GtkWidget *widget)
|
||||
gtk_gesture_stylus_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_GESTURE_STYLUS,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_gesture_stylus_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_stylus_new (GtkWidget *widget);
|
||||
GtkGesture * gtk_gesture_stylus_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_gesture_stylus_get_axis (GtkGestureStylus *gesture,
|
||||
|
@ -252,19 +252,15 @@ gtk_gesture_swipe_init (GtkGestureSwipe *gesture)
|
||||
|
||||
/**
|
||||
* gtk_gesture_swipe_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Returns a newly created #GtkGesture that recognizes swipes.
|
||||
*
|
||||
* Returns: a newly created #GtkGestureSwipe
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_swipe_new (GtkWidget *widget)
|
||||
gtk_gesture_swipe_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_GESTURE_SWIPE,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -40,15 +40,15 @@ typedef struct _GtkGestureSwipe GtkGestureSwipe;
|
||||
typedef struct _GtkGestureSwipeClass GtkGestureSwipeClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_gesture_swipe_get_type (void) G_GNUC_CONST;
|
||||
GType gtk_gesture_swipe_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_swipe_new (GtkWidget *widget);
|
||||
GtkGesture * gtk_gesture_swipe_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_gesture_swipe_get_velocity (GtkGestureSwipe *gesture,
|
||||
gdouble *velocity_x,
|
||||
gdouble *velocity_y);
|
||||
gboolean gtk_gesture_swipe_get_velocity (GtkGestureSwipe *gesture,
|
||||
gdouble *velocity_x,
|
||||
gdouble *velocity_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -218,7 +218,6 @@ gtk_gesture_zoom_class_init (GtkGestureZoomClass *klass)
|
||||
|
||||
/**
|
||||
* gtk_gesture_zoom_new:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Returns a newly created #GtkGesture that recognizes zoom
|
||||
* in/out gestures (usually known as pinch/zoom).
|
||||
@ -226,12 +225,9 @@ gtk_gesture_zoom_class_init (GtkGestureZoomClass *klass)
|
||||
* Returns: a newly created #GtkGestureZoom
|
||||
**/
|
||||
GtkGesture *
|
||||
gtk_gesture_zoom_new (GtkWidget *widget)
|
||||
gtk_gesture_zoom_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_GESTURE_ZOOM,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_gesture_zoom_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkGesture * gtk_gesture_zoom_new (GtkWidget *widget);
|
||||
GtkGesture * gtk_gesture_zoom_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gdouble gtk_gesture_zoom_get_scale_delta (GtkGestureZoom *gesture);
|
||||
|
@ -1988,6 +1988,8 @@ gtk_header_bar_init (GtkHeaderBar *bar)
|
||||
construct_label_box (bar);
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void
|
||||
gtk_header_bar_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
@ -1996,15 +1998,15 @@ gtk_header_bar_buildable_add_child (GtkBuildable *buildable,
|
||||
{
|
||||
if (type && strcmp (type, "title") == 0)
|
||||
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (buildable), GTK_WIDGET (child));
|
||||
else if (!type)
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_HEADER_BAR (buildable), type);
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_header_bar_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->add_child = gtk_header_bar_buildable_add_child;
|
||||
}
|
||||
|
||||
|
@ -888,11 +888,23 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
gtk_widget_class_set_css_name (widget_class, I_("iconview"));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (GTK_IS_CELL_RENDERER (child))
|
||||
_gtk_cell_layout_buildable_add_child (buildable, builder, child, type);
|
||||
else
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
iface->add_child = _gtk_cell_layout_buildable_add_child;
|
||||
iface->add_child = gtk_icon_view_buildable_add_child;
|
||||
iface->custom_tag_start = gtk_icon_view_buildable_custom_tag_start;
|
||||
iface->custom_tag_end = gtk_icon_view_buildable_custom_tag_end;
|
||||
}
|
||||
@ -906,6 +918,9 @@ gtk_icon_view_cell_layout_init (GtkCellLayoutIface *iface)
|
||||
static void
|
||||
gtk_icon_view_init (GtkIconView *icon_view)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
icon_view->priv = gtk_icon_view_get_instance_private (icon_view);
|
||||
|
||||
icon_view->priv->width = 0;
|
||||
@ -945,21 +960,24 @@ 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);
|
||||
|
||||
icon_view->priv->press_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (icon_view));
|
||||
g_signal_connect (icon_view->priv->press_gesture, "pressed", G_CALLBACK (gtk_icon_view_button_press),
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_icon_view_button_press),
|
||||
icon_view);
|
||||
g_signal_connect (icon_view->priv->press_gesture, "released", G_CALLBACK (gtk_icon_view_button_release),
|
||||
g_signal_connect (gesture, "released", G_CALLBACK (gtk_icon_view_button_release),
|
||||
icon_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (icon_view), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
icon_view->priv->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (icon_view));
|
||||
g_signal_connect (icon_view->priv->motion_controller, "leave", G_CALLBACK (gtk_icon_view_leave),
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (gtk_icon_view_leave),
|
||||
icon_view);
|
||||
g_signal_connect (icon_view->priv->motion_controller, "motion", G_CALLBACK (gtk_icon_view_motion),
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (gtk_icon_view_motion),
|
||||
icon_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (icon_view), controller);
|
||||
|
||||
icon_view->priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (icon_view));
|
||||
g_signal_connect (icon_view->priv->key_controller, "key-pressed", G_CALLBACK (gtk_icon_view_key_pressed),
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (gtk_icon_view_key_pressed),
|
||||
icon_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (icon_view), controller);
|
||||
}
|
||||
|
||||
/* GObject methods */
|
||||
@ -1008,8 +1026,6 @@ gtk_icon_view_dispose (GObject *object)
|
||||
priv->cell_area = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->press_gesture);
|
||||
g_clear_object (&priv->motion_controller);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_icon_view_parent_class)->dispose (object);
|
||||
|
@ -60,8 +60,6 @@ struct _GtkIconViewPrivate
|
||||
|
||||
GList *items;
|
||||
|
||||
GtkGesture *press_gesture;
|
||||
GtkEventController *motion_controller;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GtkAdjustment *hadjustment;
|
||||
|
@ -436,8 +436,11 @@ gtk_im_context_wayland_set_client_widget (GtkIMContext *context,
|
||||
if (widget == context_wayland->widget)
|
||||
return;
|
||||
|
||||
if (context_wayland->widget && context_wayland->widget != widget)
|
||||
g_clear_object (&context_wayland->gesture);
|
||||
if (context_wayland->widget)
|
||||
{
|
||||
gtk_widget_remove_controller (context_wayland->widget, GTK_EVENT_CONTROLLER (context_wayland->gesture));
|
||||
context_wayland->gesture = NULL;
|
||||
}
|
||||
|
||||
g_set_object (&context_wayland->widget, widget);
|
||||
|
||||
@ -445,13 +448,14 @@ gtk_im_context_wayland_set_client_widget (GtkIMContext *context,
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gesture = gtk_gesture_multi_press_new (widget);
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (pressed_cb), context);
|
||||
g_signal_connect (gesture, "released",
|
||||
G_CALLBACK (released_cb), context);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
|
||||
context_wayland->gesture = gesture;
|
||||
}
|
||||
}
|
||||
|
@ -3177,9 +3177,6 @@ gtk_label_finalize (GObject *object)
|
||||
|
||||
if (priv->select_info)
|
||||
{
|
||||
g_object_unref (priv->select_info->drag_gesture);
|
||||
g_object_unref (priv->select_info->multipress_gesture);
|
||||
g_object_unref (priv->select_info->motion_controller);
|
||||
g_object_unref (priv->select_info->provider);
|
||||
}
|
||||
|
||||
@ -5017,26 +5014,29 @@ gtk_label_ensure_select_info (GtkLabel *label)
|
||||
if (gtk_widget_get_realized (GTK_WIDGET (label)))
|
||||
gtk_label_set_selectable_hint (label);
|
||||
|
||||
priv->select_info->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (label));
|
||||
priv->select_info->drag_gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (priv->select_info->drag_gesture, "drag-begin",
|
||||
G_CALLBACK (gtk_label_drag_gesture_begin), label);
|
||||
g_signal_connect (priv->select_info->drag_gesture, "drag-update",
|
||||
G_CALLBACK (gtk_label_drag_gesture_update), 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 (GTK_WIDGET (label));
|
||||
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->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (label));
|
||||
priv->select_info->motion_controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (priv->select_info->motion_controller, "motion",
|
||||
G_CALLBACK (gtk_label_motion), label);
|
||||
g_signal_connect (priv->select_info->motion_controller, "leave",
|
||||
G_CALLBACK (gtk_label_leave), label);
|
||||
gtk_widget_add_controller (GTK_WIDGET (label), priv->select_info->motion_controller);
|
||||
|
||||
priv->select_info->provider = g_object_new (GTK_TYPE_LABEL_CONTENT, NULL);
|
||||
GTK_LABEL_CONTENT (priv->select_info->provider)->label = label;
|
||||
@ -5053,9 +5053,9 @@ gtk_label_clear_select_info (GtkLabel *label)
|
||||
|
||||
if (!priv->select_info->selectable && !priv->select_info->links)
|
||||
{
|
||||
g_object_unref (priv->select_info->drag_gesture);
|
||||
g_object_unref (priv->select_info->multipress_gesture);
|
||||
g_object_unref (priv->select_info->motion_controller);
|
||||
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), priv->select_info->motion_controller);
|
||||
GTK_LABEL_CONTENT (priv->select_info->provider)->label = NULL;
|
||||
g_object_unref (priv->select_info->provider);
|
||||
|
||||
|
@ -79,7 +79,6 @@ struct _GtkLinkButtonPrivate
|
||||
gboolean visited;
|
||||
|
||||
GtkWidget *popup_menu;
|
||||
GtkGesture *click_gesture;
|
||||
};
|
||||
|
||||
enum
|
||||
@ -209,9 +208,9 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass)
|
||||
static void
|
||||
gtk_link_button_init (GtkLinkButton *link_button)
|
||||
{
|
||||
GtkLinkButtonPrivate *priv = gtk_link_button_get_instance_private (link_button);
|
||||
GtkStyleContext *context;
|
||||
GdkContentFormats *targets;
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_button_set_relief (GTK_BUTTON (link_button), GTK_RELIEF_NONE);
|
||||
gtk_widget_set_state_flags (GTK_WIDGET (link_button), GTK_STATE_FLAG_LINK, FALSE);
|
||||
@ -232,12 +231,13 @@ 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");
|
||||
|
||||
priv->click_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (link_button));
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->click_gesture), FALSE);
|
||||
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->click_gesture, "pressed", G_CALLBACK (gtk_link_button_pressed_cb),
|
||||
gesture = gtk_gesture_multi_press_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);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_link_button_pressed_cb),
|
||||
link_button);
|
||||
gtk_widget_add_controller (GTK_WIDGET (link_button), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (link_button));
|
||||
gtk_style_context_add_class (context, "link");
|
||||
@ -252,8 +252,7 @@ gtk_link_button_finalize (GObject *object)
|
||||
GtkLinkButtonPrivate *priv = gtk_link_button_get_instance_private (link_button);
|
||||
|
||||
g_free (priv->uri);
|
||||
g_object_unref (priv->click_gesture);
|
||||
|
||||
|
||||
G_OBJECT_CLASS (gtk_link_button_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -114,8 +114,6 @@ typedef struct
|
||||
gboolean activate_single_click;
|
||||
gboolean accept_unpaired_release;
|
||||
|
||||
GtkGesture *multipress_gesture;
|
||||
|
||||
/* DnD */
|
||||
GtkListBoxRow *drag_highlighted_row;
|
||||
|
||||
@ -180,6 +178,8 @@ enum {
|
||||
#define BOX_PRIV(box) ((GtkListBoxPrivate*)gtk_list_box_get_instance_private ((GtkListBox*)(box)))
|
||||
#define ROW_PRIV(row) ((GtkListBoxRowPrivate*)gtk_list_box_row_get_instance_private ((GtkListBoxRow*)(row)))
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void gtk_list_box_buildable_interface_init (GtkBuildableIface *iface);
|
||||
|
||||
static void gtk_list_box_row_actionable_iface_init (GtkActionableInterface *iface);
|
||||
@ -377,7 +377,6 @@ gtk_list_box_finalize (GObject *obj)
|
||||
|
||||
g_clear_object (&priv->adjustment);
|
||||
g_clear_object (&priv->drag_highlighted_row);
|
||||
g_clear_object (&priv->multipress_gesture);
|
||||
|
||||
g_sequence_free (priv->children);
|
||||
g_hash_table_unref (priv->header_hash);
|
||||
@ -610,6 +609,7 @@ gtk_list_box_init (GtkListBox *box)
|
||||
{
|
||||
GtkListBoxPrivate *priv = BOX_PRIV (box);
|
||||
GtkWidget *widget = GTK_WIDGET (box);
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (widget, FALSE);
|
||||
priv->selection_mode = GTK_SELECTION_SINGLE;
|
||||
@ -618,21 +618,22 @@ 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);
|
||||
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new (widget);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->multipress_gesture),
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->multipress_gesture),
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
FALSE);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture),
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture),
|
||||
GDK_BUTTON_PRIMARY);
|
||||
g_signal_connect (priv->multipress_gesture, "pressed",
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (gtk_list_box_multipress_gesture_pressed), box);
|
||||
g_signal_connect (priv->multipress_gesture, "released",
|
||||
g_signal_connect (gesture, "released",
|
||||
G_CALLBACK (gtk_list_box_multipress_gesture_released), box);
|
||||
g_signal_connect (priv->multipress_gesture, "stopped",
|
||||
g_signal_connect (gesture, "stopped",
|
||||
G_CALLBACK (gtk_list_box_multipress_gesture_stopped), box);
|
||||
g_signal_connect (priv->multipress_gesture, "unpaired-release",
|
||||
g_signal_connect (gesture, "unpaired-release",
|
||||
G_CALLBACK (gtk_list_box_multipress_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);
|
||||
}
|
||||
@ -3474,15 +3475,15 @@ gtk_list_box_buildable_add_child (GtkBuildable *buildable,
|
||||
{
|
||||
if (type && strcmp (type, "placeholder") == 0)
|
||||
gtk_list_box_set_placeholder (GTK_LIST_BOX (buildable), GTK_WIDGET (child));
|
||||
else if (!type)
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_box_buildable_interface_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->add_child = gtk_list_box_buildable_add_child;
|
||||
}
|
||||
|
||||
|
@ -1085,6 +1085,8 @@ static void
|
||||
gtk_menu_init (GtkMenu *menu)
|
||||
{
|
||||
GtkMenuPrivate *priv;
|
||||
GtkGesture *gesture;
|
||||
GtkEventController *controller;
|
||||
|
||||
priv = gtk_menu_get_instance_private (menu);
|
||||
|
||||
@ -1129,29 +1131,29 @@ gtk_menu_init (GtkMenu *menu)
|
||||
gtk_widget_set_parent (priv->bottom_arrow_widget, GTK_WIDGET (menu));
|
||||
gtk_widget_hide (priv->bottom_arrow_widget);
|
||||
|
||||
priv->click_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (menu));
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->click_gesture), FALSE);
|
||||
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->click_gesture, "pressed", G_CALLBACK (gtk_menu_pressed_cb), menu);
|
||||
g_signal_connect (priv->click_gesture, "released", G_CALLBACK (gtk_menu_released_cb), menu);
|
||||
gesture = gtk_gesture_multi_press_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);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (gtk_menu_pressed_cb), menu);
|
||||
g_signal_connect (gesture, "released", G_CALLBACK (gtk_menu_released_cb), menu);
|
||||
gtk_widget_add_controller (GTK_WIDGET (menu), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (GTK_WIDGET (menu),
|
||||
GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
|
||||
g_signal_connect (priv->scroll_controller, "scroll",
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (gtk_menu_scroll_controller_scroll), menu);
|
||||
gtk_widget_add_controller (GTK_WIDGET (menu), controller);
|
||||
|
||||
priv->motion_controller =
|
||||
gtk_event_controller_motion_new (GTK_WIDGET (menu));
|
||||
g_signal_connect (priv->motion_controller, "enter", G_CALLBACK (gtk_menu_enter), menu);
|
||||
g_signal_connect (priv->motion_controller, "motion", G_CALLBACK (gtk_menu_motion), menu);
|
||||
g_signal_connect (priv->motion_controller, "leave", G_CALLBACK (gtk_menu_leave), menu);
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (gtk_menu_enter), menu);
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (gtk_menu_motion), menu);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (gtk_menu_leave), menu);
|
||||
gtk_widget_add_controller (GTK_WIDGET (menu), controller);
|
||||
|
||||
priv->key_controller =
|
||||
gtk_event_controller_key_new (GTK_WIDGET (menu));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_menu_key_pressed), menu);
|
||||
gtk_widget_add_controller (GTK_WIDGET (menu), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1223,10 +1225,6 @@ gtk_menu_finalize (GObject *object)
|
||||
|
||||
gtk_widget_unparent (priv->top_arrow_widget);
|
||||
gtk_widget_unparent (priv->bottom_arrow_widget);
|
||||
g_clear_object (&priv->click_gesture);
|
||||
g_clear_object (&priv->scroll_controller);
|
||||
g_clear_object (&priv->motion_controller);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_menu_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -661,6 +661,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
||||
static void
|
||||
gtk_menu_item_init (GtkMenuItem *menu_item)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
GtkMenuItemPrivate *priv;
|
||||
|
||||
priv = gtk_menu_item_get_instance_private (menu_item);
|
||||
@ -680,9 +681,10 @@ gtk_menu_item_init (GtkMenuItem *menu_item)
|
||||
priv->submenu_placement = GTK_TOP_BOTTOM;
|
||||
priv->timer = 0;
|
||||
|
||||
priv->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (menu_item));
|
||||
g_signal_connect (priv->motion_controller, "enter", G_CALLBACK (gtk_menu_item_enter), menu_item);
|
||||
g_signal_connect (priv->motion_controller, "leave", G_CALLBACK (gtk_menu_item_leave), menu_item);
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "enter", G_CALLBACK (gtk_menu_item_enter), menu_item);
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (gtk_menu_item_leave), menu_item);
|
||||
gtk_widget_add_controller (GTK_WIDGET (menu_item), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,9 +75,6 @@ struct _GtkMenuPrivate
|
||||
GtkWidget *top_arrow_widget;
|
||||
GtkWidget *bottom_arrow_widget;
|
||||
|
||||
GtkGesture *click_gesture;
|
||||
GtkEventController *scroll_controller;
|
||||
GtkEventController *motion_controller;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
gint scroll_offset;
|
||||
|
@ -411,13 +411,15 @@ static void
|
||||
gtk_menu_shell_init (GtkMenuShell *menu_shell)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (menu_shell);
|
||||
GtkEventController *controller;
|
||||
|
||||
menu_shell->priv = gtk_menu_shell_get_instance_private (menu_shell);
|
||||
menu_shell->priv->take_focus = TRUE;
|
||||
|
||||
menu_shell->priv->key_controller = gtk_event_controller_key_new (widget);
|
||||
g_signal_connect (menu_shell->priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_menu_shell_key_press), widget);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
gtk_widget_set_has_surface (widget, FALSE);
|
||||
}
|
||||
@ -471,8 +473,6 @@ gtk_menu_shell_finalize (GObject *object)
|
||||
if (priv->key_hash)
|
||||
_gtk_key_hash_free (priv->key_hash);
|
||||
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_menu_shell_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -132,8 +132,6 @@ struct _GtkMountOperationPrivate {
|
||||
/* for the show-processes dialog */
|
||||
GtkWidget *process_tree_view;
|
||||
GtkListStore *process_list_store;
|
||||
|
||||
GtkGesture *multipress_gesture;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -231,9 +229,6 @@ gtk_mount_operation_finalize (GObject *object)
|
||||
if (priv->handler)
|
||||
g_object_unref (priv->handler);
|
||||
|
||||
if (priv->multipress_gesture)
|
||||
g_object_unref (priv->multipress_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_mount_operation_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -1384,6 +1379,7 @@ create_show_processes_dialog (GtkMountOperation *op,
|
||||
GtkListStore *list_store;
|
||||
gchar *s;
|
||||
gboolean use_header;
|
||||
GtkGesture *gesture;
|
||||
|
||||
priv = op->priv;
|
||||
|
||||
@ -1474,10 +1470,11 @@ create_show_processes_dialog (GtkMountOperation *op,
|
||||
G_CALLBACK (on_popup_menu_for_process_tree_view),
|
||||
op);
|
||||
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new (tree_view);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (priv->multipress_gesture, "pressed",
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (multi_press_cb), op);
|
||||
gtk_widget_add_controller (tree_view, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
list_store = gtk_list_store_new (3,
|
||||
GDK_TYPE_TEXTURE,
|
||||
|
@ -207,9 +207,6 @@ struct _GtkNotebookPrivate
|
||||
guint switch_tab_timer;
|
||||
GList *switch_tab;
|
||||
|
||||
GtkGesture *press_gesture;
|
||||
GtkEventController *motion_controller;
|
||||
|
||||
guint32 timer;
|
||||
|
||||
guint child_has_focus : 1;
|
||||
@ -1042,6 +1039,8 @@ gtk_notebook_init (GtkNotebook *notebook)
|
||||
{
|
||||
GtkNotebookPrivate *priv;
|
||||
GdkContentFormats *targets;
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (notebook), FALSE);
|
||||
@ -1111,22 +1110,28 @@ gtk_notebook_init (GtkNotebook *notebook)
|
||||
gtk_widget_set_vexpand (priv->stack_widget, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), priv->stack_widget);
|
||||
|
||||
priv->press_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (notebook));
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->press_gesture), 0);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->press_gesture), GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->press_gesture, "pressed", G_CALLBACK (gtk_notebook_gesture_pressed), notebook);
|
||||
g_signal_connect (priv->press_gesture, "released", G_CALLBACK (gtk_notebook_gesture_released), notebook);
|
||||
gesture = gtk_gesture_multi_press_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);
|
||||
g_signal_connect (gesture, "released", G_CALLBACK (gtk_notebook_gesture_released), notebook);
|
||||
gtk_widget_add_controller (GTK_WIDGET (notebook), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (notebook));
|
||||
g_signal_connect (priv->motion_controller, "motion", G_CALLBACK (gtk_notebook_motion), notebook);
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (gtk_notebook_motion), notebook);
|
||||
gtk_widget_add_controller (GTK_WIDGET (notebook), controller);
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (notebook)),
|
||||
GTK_STYLE_CLASS_FRAME);
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void
|
||||
gtk_notebook_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->add_child = gtk_notebook_buildable_add_child;
|
||||
}
|
||||
|
||||
@ -1138,31 +1143,38 @@ gtk_notebook_buildable_add_child (GtkBuildable *buildable,
|
||||
{
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (buildable);
|
||||
|
||||
if (type && strcmp (type, "tab") == 0)
|
||||
if (GTK_IS_WIDGET (child))
|
||||
{
|
||||
GtkWidget * page;
|
||||
if (type && strcmp (type, "tab") == 0)
|
||||
{
|
||||
GtkWidget * page;
|
||||
|
||||
page = gtk_notebook_get_nth_page (notebook, -1);
|
||||
/* To set the tab label widget, we must have already a child
|
||||
* inside the tab container. */
|
||||
g_assert (page != NULL);
|
||||
/* warn when Glade tries to overwrite label */
|
||||
if (gtk_notebook_get_tab_label (notebook, page))
|
||||
g_warning ("Overriding tab label for notebook");
|
||||
gtk_notebook_set_tab_label (notebook, page, GTK_WIDGET (child));
|
||||
page = gtk_notebook_get_nth_page (notebook, -1);
|
||||
/* To set the tab label widget, we must have already a child
|
||||
* inside the tab container. */
|
||||
g_assert (page != NULL);
|
||||
/* warn when Glade tries to overwrite label */
|
||||
if (gtk_notebook_get_tab_label (notebook, page))
|
||||
g_warning ("Overriding tab label for notebook");
|
||||
gtk_notebook_set_tab_label (notebook, page, GTK_WIDGET (child));
|
||||
}
|
||||
else if (type && strcmp (type, "action-start") == 0)
|
||||
{
|
||||
gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_START);
|
||||
}
|
||||
else if (type && strcmp (type, "action-end") == 0)
|
||||
{
|
||||
gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_END);
|
||||
}
|
||||
else if (!type)
|
||||
gtk_notebook_append_page (notebook, GTK_WIDGET (child), NULL);
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (notebook, type);
|
||||
}
|
||||
else if (type && strcmp (type, "action-start") == 0)
|
||||
{
|
||||
gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_START);
|
||||
}
|
||||
else if (type && strcmp (type, "action-end") == 0)
|
||||
{
|
||||
gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_END);
|
||||
}
|
||||
else if (!type)
|
||||
gtk_notebook_append_page (notebook, GTK_WIDGET (child), NULL);
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (notebook, type);
|
||||
{
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1597,8 +1609,6 @@ gtk_notebook_finalize (GObject *object)
|
||||
GtkNotebook *notebook = GTK_NOTEBOOK (object);
|
||||
GtkNotebookPrivate *priv = notebook->priv;
|
||||
|
||||
g_clear_object (&priv->press_gesture);
|
||||
g_clear_object (&priv->motion_controller);
|
||||
gtk_widget_unparent (priv->box);
|
||||
|
||||
G_OBJECT_CLASS (gtk_notebook_parent_class)->finalize (object);
|
||||
|
@ -838,27 +838,38 @@ gtk_overlay_init (GtkOverlay *overlay)
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (overlay), FALSE);
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
static void
|
||||
gtk_overlay_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (type && strcmp (type, "overlay") == 0)
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (buildable), GTK_WIDGET (child));
|
||||
else if (!type)
|
||||
if (GTK_IS_WIDGET (child))
|
||||
{
|
||||
/* Make sure the main-child node is the first one */
|
||||
gtk_widget_insert_after (GTK_WIDGET (child), GTK_WIDGET (buildable), NULL);
|
||||
_gtk_bin_set_child (GTK_BIN (buildable), GTK_WIDGET (child));
|
||||
if (type && strcmp (type, "overlay") == 0)
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (buildable), GTK_WIDGET (child));
|
||||
else if (!type)
|
||||
{
|
||||
/* Make sure the main-child node is the first one */
|
||||
gtk_widget_insert_after (GTK_WIDGET (child), GTK_WIDGET (buildable), NULL);
|
||||
_gtk_bin_set_child (GTK_BIN (buildable), GTK_WIDGET (child));
|
||||
}
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
|
||||
}
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
|
||||
{
|
||||
parent_buildable_iface->add_child (buildable, builder, child, type);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_overlay_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->add_child = gtk_overlay_buildable_add_child;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
* g_signal_connect (action, "activate", on_invert_selection_activated, NULL);
|
||||
* g_action_map_add_action (G_ACTION_MAP (action_group), action);
|
||||
* …
|
||||
* pad_controller = gtk_pad_controller_new (window, action_group, NULL);
|
||||
* pad_controller = gtk_pad_controller_new (action_group, NULL);
|
||||
* ]|
|
||||
*
|
||||
* The actions belonging to rings/strips will be activated with a parameter
|
||||
@ -387,35 +387,34 @@ gtk_pad_controller_init (GtkPadController *controller)
|
||||
|
||||
/**
|
||||
* gtk_pad_controller_new:
|
||||
* @window: a #GtkWindow
|
||||
* @group: #GActionGroup to trigger actions from
|
||||
* @pad: (nullable): A %GDK_SOURCE_TABLET_PAD device, or %NULL to handle all pads
|
||||
*
|
||||
* Creates a new #GtkPadController that will associate events from @pad to
|
||||
* actions. A %NULL pad may be provided so the controller manages all pad devices
|
||||
* generically, it is discouraged to mix #GtkPadController objects with %NULL
|
||||
* and non-%NULL @pad argument on the same @window, as execution order is not
|
||||
* guaranteed.
|
||||
* and non-%NULL @pad argument on the same toplevel window, as execution order
|
||||
* is not guaranteed.
|
||||
*
|
||||
* The #GtkPadController is created with no mapped actions. In order to map pad
|
||||
* events to actions, use gtk_pad_controller_set_action_entries() or
|
||||
* gtk_pad_controller_set_action().
|
||||
*
|
||||
* Be aware that pad events will only be delivered to #GtkWindows, so adding a pad
|
||||
* controller to any other type of widget will not have an effect.
|
||||
*
|
||||
* Returns: A newly created #GtkPadController
|
||||
**/
|
||||
GtkPadController *
|
||||
gtk_pad_controller_new (GtkWindow *window,
|
||||
GActionGroup *group,
|
||||
gtk_pad_controller_new (GActionGroup *group,
|
||||
GdkDevice *pad)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
|
||||
g_return_val_if_fail (G_IS_ACTION_GROUP (group), NULL);
|
||||
g_return_val_if_fail (!pad || GDK_IS_DEVICE (pad), NULL);
|
||||
g_return_val_if_fail (!pad || gdk_device_get_source (pad) == GDK_SOURCE_TABLET_PAD, NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_PAD_CONTROLLER,
|
||||
"propagation-phase", GTK_PHASE_CAPTURE,
|
||||
"widget", window,
|
||||
"action-group", group,
|
||||
"pad", pad,
|
||||
NULL);
|
||||
|
@ -78,8 +78,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_pad_controller_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkPadController *gtk_pad_controller_new (GtkWindow *window,
|
||||
GActionGroup *group,
|
||||
GtkPadController *gtk_pad_controller_new (GActionGroup *group,
|
||||
GdkDevice *pad);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -145,7 +145,6 @@ struct _GtkPanedPrivate
|
||||
|
||||
GtkGesture *pan_gesture; /* Used for touch */
|
||||
GtkGesture *drag_gesture; /* Used for mice */
|
||||
GtkEventController *motion_controller;
|
||||
|
||||
gint child1_size;
|
||||
gint drag_pos;
|
||||
@ -993,10 +992,6 @@ gtk_paned_finalize (GObject *object)
|
||||
gtk_paned_set_saved_focus (paned, NULL);
|
||||
gtk_paned_set_first_paned (paned, NULL);
|
||||
|
||||
g_clear_object (&priv->pan_gesture);
|
||||
g_clear_object (&priv->drag_gesture);
|
||||
g_clear_object (&priv->motion_controller);
|
||||
|
||||
gtk_widget_unparent (priv->handle_widget);
|
||||
|
||||
G_OBJECT_CLASS (gtk_paned_parent_class)->finalize (object);
|
||||
@ -1455,6 +1450,7 @@ static void
|
||||
gtk_paned_init (GtkPaned *paned)
|
||||
{
|
||||
GtkPanedPrivate *priv = gtk_paned_get_instance_private (paned);
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (paned), FALSE);
|
||||
@ -1482,23 +1478,25 @@ gtk_paned_init (GtkPaned *paned)
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (paned));
|
||||
|
||||
/* Touch gesture */
|
||||
gesture = gtk_gesture_pan_new (GTK_WIDGET (paned),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
gesture = gtk_gesture_pan_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
connect_drag_gesture_signals (paned, gesture);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (paned), GTK_EVENT_CONTROLLER (gesture));
|
||||
priv->pan_gesture = gesture;
|
||||
|
||||
/* Pointer gesture */
|
||||
gesture = gtk_gesture_drag_new (GTK_WIDGET (paned));
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
connect_drag_gesture_signals (paned, gesture);
|
||||
gtk_widget_add_controller (GTK_WIDGET (paned), GTK_EVENT_CONTROLLER (gesture));
|
||||
priv->drag_gesture = gesture;
|
||||
|
||||
priv->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (paned));
|
||||
g_signal_connect (priv->motion_controller, "motion", G_CALLBACK (gtk_paned_motion), paned);
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (gtk_paned_motion), paned);
|
||||
gtk_widget_add_controller (GTK_WIDGET (paned), controller);
|
||||
|
||||
priv->handle_widget = gtk_gizmo_new ("separator",
|
||||
NULL,
|
||||
|
@ -75,8 +75,6 @@ struct _GtkPathBarPrivate
|
||||
GIcon *home_icon;
|
||||
GIcon *desktop_icon;
|
||||
|
||||
GtkEventController *scroll_controller;
|
||||
|
||||
GList *button_list;
|
||||
GList *first_scrolled_button;
|
||||
GList *fake_root;
|
||||
@ -217,6 +215,7 @@ static void
|
||||
gtk_path_bar_init (GtkPathBar *path_bar)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkEventController *controller;
|
||||
|
||||
path_bar->priv = gtk_path_bar_get_instance_private (path_bar);
|
||||
|
||||
@ -245,13 +244,12 @@ gtk_path_bar_init (GtkPathBar *path_bar)
|
||||
path_bar->priv->get_info_cancellable = NULL;
|
||||
path_bar->priv->cancellables = NULL;
|
||||
|
||||
path_bar->priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (GTK_WIDGET (path_bar),
|
||||
GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
g_signal_connect (path_bar->priv->scroll_controller, "scroll",
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (gtk_path_bar_scroll_controller_scroll),
|
||||
path_bar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (path_bar), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -326,8 +324,6 @@ gtk_path_bar_finalize (GObject *object)
|
||||
|
||||
g_clear_object (&path_bar->priv->file_system);
|
||||
|
||||
g_clear_object (&path_bar->priv->scroll_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_path_bar_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,6 @@ struct _GtkPlacesSidebar {
|
||||
gint drag_y;
|
||||
GtkWidget *row_placeholder;
|
||||
DropState drop_state;
|
||||
GtkGesture *long_press_gesture;
|
||||
|
||||
/* volume mounting - delayed open process */
|
||||
GtkPlacesOpenFlags go_to_after_mount_open_flags;
|
||||
@ -175,8 +174,6 @@ struct _GtkPlacesSidebar {
|
||||
|
||||
GActionGroup *action_group;
|
||||
|
||||
GtkEventController *list_box_key_controller;
|
||||
|
||||
guint mounting : 1;
|
||||
guint drag_data_received : 1;
|
||||
guint drop_occurred : 1;
|
||||
@ -4008,6 +4005,8 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
|
||||
GdkContentFormats *target_list;
|
||||
gboolean show_desktop;
|
||||
GtkStyleContext *context;
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
sidebar->cancellable = g_cancellable_new ();
|
||||
|
||||
@ -4046,15 +4045,16 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
|
||||
g_signal_connect (sidebar->list_box, "row-activated",
|
||||
G_CALLBACK (on_row_activated), sidebar);
|
||||
|
||||
sidebar->list_box_key_controller =
|
||||
gtk_event_controller_key_new (sidebar->list_box);
|
||||
g_signal_connect (sidebar->list_box_key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (on_key_pressed), sidebar);
|
||||
gtk_widget_add_controller (sidebar->list_box, controller);
|
||||
|
||||
sidebar->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (sidebar));
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (sidebar->long_press_gesture), TRUE);
|
||||
g_signal_connect (sidebar->long_press_gesture, "pressed",
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (long_press_cb), sidebar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (sidebar), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* DND support */
|
||||
gtk_drag_dest_set (sidebar->list_box,
|
||||
@ -4323,9 +4323,6 @@ gtk_places_sidebar_dispose (GObject *object)
|
||||
g_clear_object (&sidebar->current_location);
|
||||
g_clear_pointer (&sidebar->rename_uri, g_free);
|
||||
|
||||
g_clear_object (&sidebar->long_press_gesture);
|
||||
g_clear_object (&sidebar->list_box_key_controller);
|
||||
|
||||
if (sidebar->source_targets)
|
||||
{
|
||||
gdk_content_formats_unref (sidebar->source_targets);
|
||||
|
@ -82,7 +82,6 @@ struct _GtkPlacesViewPrivate
|
||||
|
||||
GtkEntryCompletion *address_entry_completion;
|
||||
GtkListStore *completion_store;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GCancellable *networks_fetching_cancellable;
|
||||
|
||||
@ -419,7 +418,6 @@ gtk_places_view_finalize (GObject *object)
|
||||
g_clear_object (&priv->networks_fetching_cancellable);
|
||||
g_clear_object (&priv->path_size_group);
|
||||
g_clear_object (&priv->space_size_group);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_places_view_parent_class)->finalize (object);
|
||||
}
|
||||
@ -2267,6 +2265,7 @@ static void
|
||||
gtk_places_view_init (GtkPlacesView *self)
|
||||
{
|
||||
GtkPlacesViewPrivate *priv;
|
||||
GtkEventController *controller;
|
||||
|
||||
priv = gtk_places_view_get_instance_private (self);
|
||||
|
||||
@ -2274,8 +2273,10 @@ gtk_places_view_init (GtkPlacesView *self)
|
||||
priv->open_flags = GTK_PLACES_OPEN_NORMAL;
|
||||
priv->path_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
priv->space_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (self));
|
||||
g_signal_connect (priv->key_controller, "key-pressed", G_CALLBACK (on_key_press_event), self);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (on_key_press_event), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
@ -28,13 +28,13 @@
|
||||
*/
|
||||
#ifdef GTK_COMPILATION
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkgesture.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkspinner.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkgesturemultipress.h"
|
||||
#else
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
@ -56,8 +56,6 @@ struct _GtkPlacesViewRow
|
||||
GMount *mount;
|
||||
GFile *file;
|
||||
|
||||
GtkGesture *gesture;
|
||||
|
||||
GCancellable *cancellable;
|
||||
|
||||
gint is_network : 1;
|
||||
@ -216,7 +214,6 @@ gtk_places_view_row_finalize (GObject *object)
|
||||
g_clear_object (&self->mount);
|
||||
g_clear_object (&self->file);
|
||||
g_clear_object (&self->cancellable);
|
||||
g_clear_object (&self->gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_places_view_row_parent_class)->finalize (object);
|
||||
}
|
||||
@ -392,16 +389,14 @@ gtk_places_view_row_class_init (GtkPlacesViewRowClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkPlacesViewRow, icon_image);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkPlacesViewRow, name_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkPlacesViewRow, path_label);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_places_view_row_init (GtkPlacesViewRow *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->gesture = gtk_gesture_multi_press_new (GTK_WIDGET (self));
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (self->gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (self->gesture, "pressed", G_CALLBACK (pressed_cb), self);
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
|
@ -115,11 +115,8 @@ struct _GtkRangePrivate
|
||||
/* Whether dragging is ongoing */
|
||||
guint in_drag : 1;
|
||||
|
||||
GtkGesture *long_press_gesture;
|
||||
GtkGesture *multipress_gesture;
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *scroll_controller;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GtkScrollType autoscroll_mode;
|
||||
guint autoscroll_id;
|
||||
@ -535,6 +532,8 @@ static void
|
||||
gtk_range_init (GtkRange *range)
|
||||
{
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
GtkGesture *gesture;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (range), FALSE);
|
||||
|
||||
@ -567,37 +566,39 @@ gtk_range_init (GtkRange *range)
|
||||
* in the oppposite order in which they are added to their
|
||||
* widget.
|
||||
*/
|
||||
priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (range));
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->drag_gesture), 0);
|
||||
g_signal_connect (priv->drag_gesture, "drag-begin",
|
||||
G_CALLBACK (gtk_range_drag_gesture_begin), range);
|
||||
g_signal_connect (priv->drag_gesture, "drag-update",
|
||||
G_CALLBACK (gtk_range_drag_gesture_update), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (range));
|
||||
priv->multipress_gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), 0);
|
||||
gtk_gesture_group (priv->drag_gesture, priv->multipress_gesture);
|
||||
g_signal_connect (priv->multipress_gesture, "pressed",
|
||||
G_CALLBACK (gtk_range_multipress_gesture_pressed), range);
|
||||
g_signal_connect (priv->multipress_gesture, "released",
|
||||
G_CALLBACK (gtk_range_multipress_gesture_released), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (priv->multipress_gesture));
|
||||
gtk_gesture_group (priv->drag_gesture, priv->multipress_gesture);
|
||||
|
||||
priv->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (range));
|
||||
g_object_set (priv->long_press_gesture, "delay-factor", 2.0, NULL);
|
||||
gtk_gesture_group (priv->drag_gesture, priv->long_press_gesture);
|
||||
g_signal_connect (priv->long_press_gesture, "pressed",
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_object_set (gesture, "delay-factor", 2.0, NULL);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (gtk_range_long_press_gesture_pressed), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (gesture));
|
||||
gtk_gesture_group (priv->drag_gesture, gesture);
|
||||
|
||||
priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (GTK_WIDGET (range),
|
||||
GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);
|
||||
g_signal_connect (priv->scroll_controller, "scroll",
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (gtk_range_scroll_controller_scroll), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), controller);
|
||||
|
||||
priv->key_controller =
|
||||
gtk_event_controller_key_new (GTK_WIDGET (range));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_range_key_controller_key_pressed), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1291,12 +1292,6 @@ gtk_range_finalize (GObject *object)
|
||||
GtkRange *range = GTK_RANGE (object);
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
|
||||
g_clear_object (&priv->drag_gesture);
|
||||
g_clear_object (&priv->multipress_gesture);
|
||||
g_clear_object (&priv->long_press_gesture);
|
||||
g_clear_object (&priv->scroll_controller);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
gtk_widget_unparent (priv->slider_widget);
|
||||
|
||||
if (priv->fill_widget)
|
||||
|
@ -124,8 +124,6 @@ struct _GtkScaleButtonPrivate
|
||||
gchar **icon_list;
|
||||
|
||||
GtkAdjustment *adjustment; /* needed because it must be settable in init() */
|
||||
|
||||
GtkEventController *scroll_controller;
|
||||
};
|
||||
|
||||
static void gtk_scale_button_constructed (GObject *object);
|
||||
@ -367,6 +365,7 @@ gtk_scale_button_init (GtkScaleButton *button)
|
||||
{
|
||||
GtkScaleButtonPrivate *priv;
|
||||
GtkStyleContext *context;
|
||||
GtkEventController *controller;
|
||||
|
||||
button->priv = priv = gtk_scale_button_get_instance_private (button);
|
||||
|
||||
@ -385,12 +384,11 @@ gtk_scale_button_init (GtkScaleButton *button)
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (button));
|
||||
gtk_style_context_add_class (context, "scale");
|
||||
|
||||
priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (GTK_WIDGET (button),
|
||||
GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
|
||||
g_signal_connect (priv->scroll_controller, "scroll",
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (gtk_scale_button_scroll_controller_scroll),
|
||||
button);
|
||||
gtk_widget_add_controller (GTK_WIDGET (button), controller);
|
||||
|
||||
g_signal_connect (gtk_button_get_gesture (GTK_BUTTON (priv->plus_button)),
|
||||
"pressed", G_CALLBACK (button_pressed_cb), button);
|
||||
@ -485,8 +483,6 @@ gtk_scale_button_finalize (GObject *object)
|
||||
priv->adjustment = NULL;
|
||||
}
|
||||
|
||||
g_object_unref (priv->scroll_controller);
|
||||
|
||||
if (priv->autoscroll_timeout)
|
||||
g_source_remove (priv->autoscroll_timeout);
|
||||
|
||||
|
@ -259,11 +259,6 @@ struct _GtkScrolledWindowPrivate
|
||||
GtkGesture *drag_gesture;
|
||||
GtkGesture *pan_gesture;
|
||||
|
||||
/* Scroll event controller */
|
||||
GtkEventController *scroll_controller;
|
||||
|
||||
GtkEventController *motion_controller;
|
||||
|
||||
gdouble drag_start_x;
|
||||
gdouble drag_start_y;
|
||||
|
||||
@ -327,7 +322,6 @@ static void gtk_scrolled_window_get_property (GObject *objec
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_scrolled_window_finalize (GObject *object);
|
||||
|
||||
static void gtk_scrolled_window_destroy (GtkWidget *widget);
|
||||
static void gtk_scrolled_window_snapshot (GtkWidget *widget,
|
||||
@ -521,7 +515,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
||||
|
||||
gobject_class->set_property = gtk_scrolled_window_set_property;
|
||||
gobject_class->get_property = gtk_scrolled_window_get_property;
|
||||
gobject_class->finalize = gtk_scrolled_window_finalize;
|
||||
|
||||
widget_class->destroy = gtk_scrolled_window_destroy;
|
||||
widget_class->snapshot = gtk_scrolled_window_snapshot;
|
||||
@ -1885,6 +1878,7 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
||||
GtkScrolledWindowPrivate *priv;
|
||||
GtkEventController *controller;
|
||||
GtkCssNode *widget_node;
|
||||
GQuark classes[4] = {
|
||||
g_quark_from_static_string (GTK_STYLE_CLASS_LEFT),
|
||||
@ -1919,7 +1913,7 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
|
||||
priv->overlay_scrolling = TRUE;
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new (widget);
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->drag_gesture), TRUE);
|
||||
g_signal_connect_swapped (priv->drag_gesture, "drag-begin",
|
||||
G_CALLBACK (scrolled_window_drag_begin_cb),
|
||||
@ -1930,19 +1924,22 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
g_signal_connect_swapped (priv->drag_gesture, "end",
|
||||
G_CALLBACK (scrolled_window_drag_end_cb),
|
||||
scrolled_window);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
priv->pan_gesture = gtk_gesture_pan_new (widget, GTK_ORIENTATION_VERTICAL);
|
||||
gtk_gesture_group (priv->pan_gesture, priv->drag_gesture);
|
||||
priv->pan_gesture = gtk_gesture_pan_new (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->pan_gesture), TRUE);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (priv->pan_gesture));
|
||||
gtk_gesture_group (priv->pan_gesture, priv->drag_gesture);
|
||||
|
||||
priv->swipe_gesture = gtk_gesture_swipe_new (widget);
|
||||
gtk_gesture_group (priv->swipe_gesture, priv->drag_gesture);
|
||||
priv->swipe_gesture = gtk_gesture_swipe_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->swipe_gesture), TRUE);
|
||||
g_signal_connect_swapped (priv->swipe_gesture, "swipe",
|
||||
G_CALLBACK (scrolled_window_swipe_cb),
|
||||
scrolled_window);
|
||||
priv->long_press_gesture = gtk_gesture_long_press_new (widget);
|
||||
gtk_gesture_group (priv->long_press_gesture, priv->drag_gesture);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (priv->swipe_gesture));
|
||||
gtk_gesture_group (priv->swipe_gesture, priv->drag_gesture);
|
||||
|
||||
priv->long_press_gesture = gtk_gesture_long_press_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->long_press_gesture), TRUE);
|
||||
g_signal_connect_swapped (priv->long_press_gesture, "pressed",
|
||||
G_CALLBACK (scrolled_window_long_press_cb),
|
||||
@ -1950,6 +1947,8 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
g_signal_connect_swapped (priv->long_press_gesture, "cancelled",
|
||||
G_CALLBACK (scrolled_window_long_press_cancelled_cb),
|
||||
scrolled_window);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (priv->long_press_gesture));
|
||||
gtk_gesture_group (priv->long_press_gesture, priv->drag_gesture);
|
||||
|
||||
gtk_scrolled_window_set_kinetic_scrolling (scrolled_window, TRUE);
|
||||
gtk_scrolled_window_set_capture_button_press (scrolled_window, TRUE);
|
||||
@ -1976,22 +1975,22 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
|
||||
gtk_scrolled_window_update_use_indicators (scrolled_window);
|
||||
|
||||
priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (widget,
|
||||
GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_KINETIC);
|
||||
g_signal_connect (priv->scroll_controller, "scroll-begin",
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_KINETIC);
|
||||
g_signal_connect (controller, "scroll-begin",
|
||||
G_CALLBACK (scroll_controller_scroll_begin), scrolled_window);
|
||||
g_signal_connect (priv->scroll_controller, "scroll",
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (scroll_controller_scroll), scrolled_window);
|
||||
g_signal_connect (priv->scroll_controller, "scroll-end",
|
||||
g_signal_connect (controller, "scroll-end",
|
||||
G_CALLBACK (scroll_controller_scroll_end), scrolled_window);
|
||||
g_signal_connect (priv->scroll_controller, "decelerate",
|
||||
g_signal_connect (controller, "decelerate",
|
||||
G_CALLBACK (scroll_controller_decelerate), scrolled_window);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
priv->motion_controller = gtk_event_controller_motion_new (widget);
|
||||
g_signal_connect (priv->motion_controller, "leave",
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "leave",
|
||||
G_CALLBACK (motion_controller_leave), scrolled_window);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2606,22 +2605,6 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->destroy (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrolled_window_finalize (GObject *object)
|
||||
{
|
||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
|
||||
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
||||
|
||||
g_clear_object (&priv->drag_gesture);
|
||||
g_clear_object (&priv->swipe_gesture);
|
||||
g_clear_object (&priv->long_press_gesture);
|
||||
g_clear_object (&priv->pan_gesture);
|
||||
g_clear_object (&priv->scroll_controller);
|
||||
|
||||
|
||||
G_OBJECT_CLASS (gtk_scrolled_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrolled_window_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
@ -727,7 +727,8 @@ gtk_search_bar_set_key_capture_widget (GtkSearchBar *bar,
|
||||
|
||||
if (priv->capture_widget)
|
||||
{
|
||||
g_clear_object (&priv->capture_widget_controller);
|
||||
gtk_widget_remove_controller (priv->capture_widget,
|
||||
priv->capture_widget_controller);
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
}
|
||||
@ -739,13 +740,14 @@ gtk_search_bar_set_key_capture_widget (GtkSearchBar *bar,
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new (widget);
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_propagation_phase (priv->capture_widget_controller,
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-pressed",
|
||||
G_CALLBACK (capture_widget_key_handled), bar);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-released",
|
||||
G_CALLBACK (capture_widget_key_handled), bar);
|
||||
gtk_widget_add_controller (widget, priv->capture_widget_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,8 @@ gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
|
||||
|
||||
if (priv->capture_widget)
|
||||
{
|
||||
g_object_unref (priv->capture_widget_controller);
|
||||
gtk_widget_remove_controller (priv->capture_widget,
|
||||
priv->capture_widget_controller);
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
}
|
||||
@ -516,13 +517,14 @@ gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new (widget);
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_propagation_phase (priv->capture_widget_controller,
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-pressed",
|
||||
G_CALLBACK (capture_widget_key_handled), entry);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-released",
|
||||
G_CALLBACK (capture_widget_key_handled), entry);
|
||||
gtk_widget_add_controller (widget, priv->capture_widget_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,6 @@ struct _GtkShortcutsSection
|
||||
|
||||
gboolean has_filtered_group;
|
||||
gboolean need_reflow;
|
||||
|
||||
GtkGesture *pan_gesture;
|
||||
};
|
||||
|
||||
struct _GtkShortcutsSectionClass
|
||||
@ -232,7 +230,6 @@ gtk_shortcuts_section_finalize (GObject *object)
|
||||
g_clear_pointer (&self->name, g_free);
|
||||
g_clear_pointer (&self->title, g_free);
|
||||
g_clear_pointer (&self->view_name, g_free);
|
||||
g_clear_object (&self->pan_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shortcuts_section_parent_class)->finalize (object);
|
||||
}
|
||||
@ -417,6 +414,8 @@ gtk_shortcuts_section_class_init (GtkShortcutsSectionClass *klass)
|
||||
static void
|
||||
gtk_shortcuts_section_init (GtkShortcutsSection *self)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
self->max_height = 15;
|
||||
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
|
||||
@ -454,9 +453,10 @@ gtk_shortcuts_section_init (GtkShortcutsSection *self)
|
||||
gtk_box_pack_end (GTK_BOX (self->footer), self->show_all);
|
||||
gtk_widget_set_halign (self->show_all, GTK_ALIGN_END);
|
||||
|
||||
self->pan_gesture = gtk_gesture_pan_new (GTK_WIDGET (self->stack), GTK_ORIENTATION_HORIZONTAL);
|
||||
g_signal_connect (self->pan_gesture, "pan",
|
||||
gesture = gtk_gesture_pan_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
g_signal_connect (gesture, "pan",
|
||||
G_CALLBACK (gtk_shortcuts_section_pan_gesture_pan), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self->stack), GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -115,7 +115,6 @@ typedef struct
|
||||
GtkListBox *list_box;
|
||||
GtkBox *search_gestures;
|
||||
GtkBox *search_shortcuts;
|
||||
GtkEventController *controller;
|
||||
|
||||
GtkWindow *window;
|
||||
gulong keys_changed_id;
|
||||
@ -651,7 +650,6 @@ gtk_shortcuts_window_finalize (GObject *object)
|
||||
|
||||
g_clear_object (&priv->search_image_group);
|
||||
g_clear_object (&priv->search_text_group);
|
||||
g_clear_object (&priv->controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shortcuts_window_parent_class)->finalize (object);
|
||||
}
|
||||
@ -882,13 +880,15 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
||||
GtkWidget *label;
|
||||
GtkWidget *empty;
|
||||
PangoAttrList *attributes;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (self), GDK_SURFACE_TYPE_HINT_DIALOG);
|
||||
|
||||
priv->controller = gtk_event_controller_key_new (GTK_WIDGET (self));
|
||||
g_signal_connect (priv->controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (window_key_pressed), NULL);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
priv->keywords = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
||||
priv->search_items_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
|
@ -187,9 +187,7 @@ struct _GtkSpinButtonPrivate
|
||||
GtkWidget *entry;
|
||||
|
||||
GtkWidget *up_button;
|
||||
GtkGesture *up_click_gesture;
|
||||
GtkWidget *down_button;
|
||||
GtkGesture *down_click_gesture;
|
||||
|
||||
GtkWidget *click_child;
|
||||
|
||||
@ -202,9 +200,6 @@ struct _GtkSpinButtonPrivate
|
||||
|
||||
GtkOrientation orientation;
|
||||
|
||||
GtkGesture *swipe_gesture;
|
||||
GtkEventController *scroll_controller;
|
||||
|
||||
guint digits : 10;
|
||||
guint need_timer : 1;
|
||||
guint numeric : 1;
|
||||
@ -775,8 +770,7 @@ button_pressed_cb (GtkGestureMultiPress *gesture,
|
||||
{
|
||||
GtkSpinButton *spin_button = user_data;
|
||||
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
|
||||
GtkWidget *pressed_button = GTK_GESTURE (gesture) == priv->up_click_gesture ?
|
||||
priv->up_button : priv->down_button;
|
||||
GtkWidget *pressed_button = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
gtk_widget_grab_focus (GTK_WIDGET (spin_button));
|
||||
|
||||
@ -811,14 +805,15 @@ button_released_cb (GtkGestureMultiPress *gesture,
|
||||
|
||||
if (button == GDK_BUTTON_SECONDARY)
|
||||
{
|
||||
GtkWidget *button = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
double diff;
|
||||
if (GTK_GESTURE (gesture) == priv->down_click_gesture)
|
||||
if (button == priv->down_button)
|
||||
{
|
||||
diff = gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment);
|
||||
if (diff > EPSILON)
|
||||
gtk_spin_button_real_spin (spin_button, -diff);
|
||||
}
|
||||
else if (GTK_GESTURE (gesture) == priv->up_click_gesture)
|
||||
else if (button == priv->up_button)
|
||||
{
|
||||
diff = gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_value (priv->adjustment);
|
||||
if (diff > EPSILON)
|
||||
@ -831,6 +826,8 @@ static void
|
||||
gtk_spin_button_init (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (spin_button), FALSE);
|
||||
|
||||
@ -867,44 +864,46 @@ 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);
|
||||
|
||||
priv->down_click_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (priv->down_button));
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->down_click_gesture), 0);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->down_click_gesture), FALSE);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->down_click_gesture),
|
||||
gesture = gtk_gesture_multi_press_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),
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->down_click_gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button);
|
||||
g_signal_connect (priv->down_click_gesture, "released", G_CALLBACK (button_released_cb), spin_button);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button);
|
||||
g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button);
|
||||
gtk_widget_add_controller (GTK_WIDGET (priv->down_button), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->up_button = gtk_button_new_from_icon_name ("list-add-symbolic");
|
||||
gtk_widget_set_can_focus (priv->up_button, FALSE);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (priv->up_button), "up");
|
||||
gtk_container_add (GTK_CONTAINER (priv->box), priv->up_button);
|
||||
|
||||
priv->up_click_gesture = gtk_gesture_multi_press_new (GTK_WIDGET (priv->up_button));
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->up_click_gesture), 0);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->up_click_gesture), FALSE);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->up_click_gesture),
|
||||
gesture = gtk_gesture_multi_press_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),
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->up_click_gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button);
|
||||
g_signal_connect (priv->up_click_gesture, "released", G_CALLBACK (button_released_cb), spin_button);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (button_pressed_cb), spin_button);
|
||||
g_signal_connect (gesture, "released", G_CALLBACK (button_released_cb), spin_button);
|
||||
gtk_widget_add_controller (GTK_WIDGET (priv->up_button), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
gtk_spin_button_set_adjustment (spin_button, NULL);
|
||||
|
||||
priv->swipe_gesture = gtk_gesture_swipe_new (GTK_WIDGET (spin_button));
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->swipe_gesture), TRUE);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->swipe_gesture),
|
||||
gesture = gtk_gesture_swipe_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->swipe_gesture, "begin",
|
||||
g_signal_connect (gesture, "begin",
|
||||
G_CALLBACK (swipe_gesture_begin), spin_button);
|
||||
g_signal_connect (priv->swipe_gesture, "update",
|
||||
g_signal_connect (gesture, "update",
|
||||
G_CALLBACK (swipe_gesture_update), spin_button);
|
||||
gtk_widget_add_controller (GTK_WIDGET (spin_button), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->scroll_controller =
|
||||
gtk_event_controller_scroll_new (GTK_WIDGET (spin_button),
|
||||
GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
g_signal_connect (priv->scroll_controller, "scroll",
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (scroll_controller_scroll), spin_button);
|
||||
gtk_widget_add_controller (GTK_WIDGET (spin_button), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -915,11 +914,6 @@ gtk_spin_button_finalize (GObject *object)
|
||||
|
||||
gtk_spin_button_unset_adjustment (spin_button);
|
||||
|
||||
g_object_unref (priv->scroll_controller);
|
||||
g_object_unref (priv->swipe_gesture);
|
||||
g_object_unref (priv->up_click_gesture);
|
||||
g_object_unref (priv->down_click_gesture);
|
||||
|
||||
gtk_widget_unparent (priv->box);
|
||||
|
||||
G_OBJECT_CLASS (gtk_spin_button_parent_class)->finalize (object);
|
||||
|
@ -475,9 +475,6 @@ gtk_switch_dispose (GObject *object)
|
||||
|
||||
g_clear_object (&priv->action_helper);
|
||||
|
||||
g_clear_object (&priv->pan_gesture);
|
||||
g_clear_object (&priv->multipress_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_switch_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@ -620,7 +617,7 @@ gtk_switch_init (GtkSwitch *self)
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
|
||||
|
||||
gesture = gtk_gesture_multi_press_new (GTK_WIDGET (self));
|
||||
gesture = gtk_gesture_multi_press_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",
|
||||
@ -629,10 +626,10 @@ gtk_switch_init (GtkSwitch *self)
|
||||
G_CALLBACK (gtk_switch_multipress_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;
|
||||
|
||||
gesture = gtk_gesture_pan_new (GTK_WIDGET (self),
|
||||
GTK_ORIENTATION_HORIZONTAL);
|
||||
gesture = gtk_gesture_pan_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
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, "pan",
|
||||
@ -641,6 +638,7 @@ gtk_switch_init (GtkSwitch *self)
|
||||
G_CALLBACK (gtk_switch_pan_gesture_drag_end), self);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
||||
priv->pan_gesture = gesture;
|
||||
|
||||
/* Translators: if the "on" state label requires more than three
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user