forked from AuroraMiddleware/gtk
draggesture: Port to new API model
This commit is contained in:
parent
bf82149271
commit
1e6eb1f8b9
@ -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))
|
||||
|
@ -212,14 +212,15 @@ gtk_font_plane_init (GtkFontPlane *plane)
|
||||
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));
|
||||
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
@ -237,8 +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_OBJECT_CLASS (gtk_font_plane_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,9 @@ 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);
|
||||
|
@ -249,7 +249,6 @@ struct _GtkCalendarPrivate
|
||||
gint detail_width_chars;
|
||||
gint detail_overflow[6];
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *scroll_controller;
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
@ -677,9 +676,10 @@ gtk_calendar_init (GtkCalendar *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),
|
||||
@ -1333,7 +1333,6 @@ gtk_calendar_finalize (GObject *object)
|
||||
{
|
||||
GtkCalendarPrivate *priv = GTK_CALENDAR (object)->priv;
|
||||
|
||||
g_object_unref (priv->drag_gesture);
|
||||
g_object_unref (priv->scroll_controller);
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
|
@ -37,7 +37,6 @@ struct _GtkColorPlanePrivate
|
||||
|
||||
GdkTexture *texture;
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
|
||||
@ -408,14 +407,15 @@ 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));
|
||||
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
@ -440,7 +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->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_plane_parent_class)->finalize (object);
|
||||
|
@ -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_BUBBLE);
|
||||
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"),
|
||||
|
@ -2557,13 +2557,14 @@ 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));
|
||||
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
@ -2796,7 +2797,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->motion_controller);
|
||||
|
||||
if (priv->tabs)
|
||||
|
@ -3377,7 +3377,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->key_controller);
|
||||
|
||||
if (priv->bound_model)
|
||||
@ -3757,7 +3756,7 @@ gtk_flow_box_init (GtkFlowBox *box)
|
||||
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,6 +3769,7 @@ 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",
|
||||
|
@ -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,
|
||||
|
@ -3177,7 +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->motion_controller);
|
||||
g_object_unref (priv->select_info->provider);
|
||||
}
|
||||
@ -5016,12 +5015,13 @@ 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 ();
|
||||
g_signal_connect (priv->select_info->multipress_gesture, "pressed",
|
||||
@ -5053,7 +5053,7 @@ gtk_label_clear_select_info (GtkLabel *label)
|
||||
|
||||
if (!priv->select_info->selectable && !priv->select_info->links)
|
||||
{
|
||||
g_object_unref (priv->select_info->drag_gesture);
|
||||
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));
|
||||
g_object_unref (priv->select_info->motion_controller);
|
||||
GTK_LABEL_CONTENT (priv->select_info->provider)->label = NULL;
|
||||
|
@ -993,7 +993,6 @@ gtk_paned_finalize (GObject *object)
|
||||
gtk_paned_set_saved_focus (paned, NULL);
|
||||
gtk_paned_set_first_paned (paned, NULL);
|
||||
|
||||
g_clear_object (&priv->drag_gesture);
|
||||
g_clear_object (&priv->motion_controller);
|
||||
|
||||
gtk_widget_unparent (priv->handle_widget);
|
||||
@ -1490,10 +1489,11 @@ gtk_paned_init (GtkPaned *paned)
|
||||
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));
|
||||
|
@ -567,12 +567,13 @@ 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_gesture_single_set_button (GTK_GESTURE_SINGLE (priv->multipress_gesture), 0);
|
||||
@ -1293,7 +1294,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->scroll_controller);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
|
@ -1919,7 +1919,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,6 +1930,7 @@ 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 (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->pan_gesture), TRUE);
|
||||
@ -2616,7 +2617,6 @@ 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->scroll_controller);
|
||||
|
||||
|
||||
|
@ -1678,13 +1678,14 @@ gtk_text_view_init (GtkTextView *text_view)
|
||||
widget);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new (widget);
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (priv->drag_gesture, "drag-update",
|
||||
G_CALLBACK (gtk_text_view_drag_gesture_update),
|
||||
widget);
|
||||
g_signal_connect (priv->drag_gesture, "drag-end",
|
||||
G_CALLBACK (gtk_text_view_drag_gesture_end),
|
||||
widget);
|
||||
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
priv->motion_controller = gtk_event_controller_motion_new (widget);
|
||||
g_signal_connect (priv->motion_controller, "motion", G_CALLBACK (gtk_text_view_motion), widget);
|
||||
@ -3600,7 +3601,6 @@ gtk_text_view_finalize (GObject *object)
|
||||
|
||||
cancel_pending_scroll (text_view);
|
||||
|
||||
g_object_unref (priv->drag_gesture);
|
||||
g_object_unref (priv->motion_controller);
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
|
@ -1730,15 +1730,16 @@ gtk_tree_view_init (GtkTreeView *tree_view)
|
||||
GTK_PHASE_CAPTURE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (tree_view), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (tree_view));
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (priv->drag_gesture, "drag-begin",
|
||||
G_CALLBACK (gtk_tree_view_drag_gesture_begin), tree_view);
|
||||
g_signal_connect (priv->drag_gesture, "drag-update",
|
||||
G_CALLBACK (gtk_tree_view_drag_gesture_update), tree_view);
|
||||
g_signal_connect (priv->drag_gesture, "drag-end",
|
||||
G_CALLBACK (gtk_tree_view_drag_gesture_end), tree_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (tree_view), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
priv->column_drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (tree_view));
|
||||
priv->column_drag_gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (priv->column_drag_gesture, "drag-begin",
|
||||
G_CALLBACK (gtk_tree_view_column_drag_gesture_begin), tree_view);
|
||||
g_signal_connect (priv->column_drag_gesture, "drag-update",
|
||||
@ -1747,6 +1748,7 @@ gtk_tree_view_init (GtkTreeView *tree_view)
|
||||
G_CALLBACK (gtk_tree_view_column_drag_gesture_end), tree_view);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->column_drag_gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (tree_view), GTK_EVENT_CONTROLLER (priv->column_drag_gesture));
|
||||
|
||||
priv->motion_controller = gtk_event_controller_motion_new (GTK_WIDGET (tree_view));
|
||||
g_signal_connect (priv->motion_controller, "enter",
|
||||
@ -2138,8 +2140,6 @@ gtk_tree_view_destroy (GtkWidget *widget)
|
||||
tree_view->priv->vadjustment = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&tree_view->priv->drag_gesture);
|
||||
g_clear_object (&tree_view->priv->column_drag_gesture);
|
||||
g_clear_object (&tree_view->priv->motion_controller);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->destroy (widget);
|
||||
|
@ -1971,13 +1971,14 @@ gtk_window_constructed (GObject *object)
|
||||
G_CALLBACK (multipress_gesture_pressed_cb), object);
|
||||
gtk_widget_add_controller (GTK_WIDGET (object), GTK_EVENT_CONTROLLER (priv->multipress_gesture));
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (object));
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->drag_gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->drag_gesture, "drag-begin",
|
||||
G_CALLBACK (drag_gesture_begin_cb), object);
|
||||
g_signal_connect (priv->drag_gesture, "drag-update",
|
||||
G_CALLBACK (drag_gesture_update_cb), object);
|
||||
gtk_widget_add_controller (GTK_WIDGET (object), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5953,9 +5954,6 @@ gtk_window_finalize (GObject *object)
|
||||
priv->mnemonics_display_timeout_id = 0;
|
||||
}
|
||||
|
||||
if (priv->drag_gesture)
|
||||
g_object_unref (priv->drag_gesture);
|
||||
|
||||
g_clear_object (&priv->renderer);
|
||||
|
||||
G_OBJECT_CLASS (gtk_window_parent_class)->finalize (object);
|
||||
|
@ -282,13 +282,14 @@ main (int argc, char *argv[])
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area), draw, NULL, NULL);
|
||||
g_signal_connect (drawing_area, "size-allocate", G_CALLBACK (size_allocate), NULL);
|
||||
|
||||
gesture = gtk_gesture_drag_new (drawing_area);
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
g_object_set_data_full (G_OBJECT (drawing_area), "gesture",
|
||||
gesture, g_object_unref);
|
||||
g_signal_connect (gesture, "drag-begin",
|
||||
G_CALLBACK (drag_begin), drawing_area);
|
||||
g_signal_connect (gesture, "drag-update",
|
||||
G_CALLBACK (drag_update), drawing_area);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
g_signal_connect (drawing_area, "key_press_event",
|
||||
G_CALLBACK (key_press_event), NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user