mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
scrolledwindow: Stop using _gtk_widget_set_captured_event_handler
We can use an event controller with phase = CAPTURE these days.
This commit is contained in:
parent
6e872715ef
commit
6669ddad09
@ -1173,13 +1173,12 @@ get_scroll_unit (GtkScrolledWindow *sw,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
captured_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
captured_scroll_cb (GtkEventControllerScroll *scroll,
|
||||
double delta_x,
|
||||
double delta_y,
|
||||
GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW (widget);
|
||||
|
||||
if (gdk_event_get_event_type (event) == GDK_SCROLL)
|
||||
gtk_scrolled_window_cancel_deceleration (sw);
|
||||
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
||||
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
@ -1972,8 +1971,6 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
gtk_scrolled_window_set_kinetic_scrolling (scrolled_window, TRUE);
|
||||
gtk_scrolled_window_set_capture_button_press (scrolled_window, TRUE);
|
||||
|
||||
_gtk_widget_set_captured_event_handler (widget, captured_event_cb);
|
||||
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
|
||||
g_signal_connect_swapped (controller, "motion",
|
||||
@ -2012,6 +2009,12 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
G_CALLBACK (scroll_controller_decelerate), scrolled_window);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_KINETIC);
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (captured_scroll_cb), scrolled_window);
|
||||
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "leave",
|
||||
G_CALLBACK (motion_controller_leave), scrolled_window);
|
||||
|
Loading…
Reference in New Issue
Block a user