diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-09-25 17:23:00 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-09-25 18:57:40 +0200 |
commit | b1606db839c83d40feef7968cb8afde91f9a2f95 (patch) | |
tree | 9e856934a5a7aca43fffa5dff2650344cb817561 | |
parent | c9f6a9f7c523bf6b59aa7fb4cc07092bbaf35378 (diff) | |
download | gtk+-b1606db839c83d40feef7968cb8afde91f9a2f95.tar.gz |
gtkscrolledwindow: Drop gtk_scrolled_window_set_capture_button_press()
This API is kinda stuck in the GdkEvent days, we now negotiate ownership
of the input sequence via GtkGestures. Remove it as it reflects a way to
work that was not exactly accurate and it will turn plainly wrong soon.
-rw-r--r-- | docs/reference/gtk/gtk4-sections.txt | 2 | ||||
-rw-r--r-- | gtk/gtkscrolledwindow.c | 61 | ||||
-rw-r--r-- | gtk/gtkscrolledwindow.h | 6 | ||||
-rw-r--r-- | tests/testkineticscrolling.c | 3 |
4 files changed, 1 insertions, 71 deletions
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index a5246c6dae..081afd9518 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -2491,8 +2491,6 @@ gtk_scrolled_window_get_has_frame gtk_scrolled_window_set_has_frame gtk_scrolled_window_get_kinetic_scrolling gtk_scrolled_window_set_kinetic_scrolling -gtk_scrolled_window_get_capture_button_press -gtk_scrolled_window_set_capture_button_press gtk_scrolled_window_get_overlay_scrolling gtk_scrolled_window_set_overlay_scrolling gtk_scrolled_window_get_min_content_width diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 2e24b21b38..7b38c36812 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -282,7 +282,6 @@ typedef struct double drag_start_y; guint kinetic_scrolling : 1; - guint capture_button_press : 1; guint in_drag : 1; guint deceleration_id; @@ -916,10 +915,8 @@ scrolled_window_drag_begin_cb (GtkScrolledWindow *scrolled_window, if (event_widget == priv->vscrollbar || event_widget == priv->hscrollbar || (!may_hscroll (scrolled_window) && !may_vscroll (scrolled_window))) state = GTK_EVENT_SEQUENCE_DENIED; - else if (priv->capture_button_press) - state = GTK_EVENT_SEQUENCE_CLAIMED; else - return; + state = GTK_EVENT_SEQUENCE_CLAIMED; gtk_gesture_set_sequence_state (gesture, sequence, state); } @@ -955,15 +952,6 @@ scrolled_window_drag_update_cb (GtkScrolledWindow *scrolled_window, gtk_scrolled_window_invalidate_overshoot (scrolled_window); - if (!priv->capture_button_press) - { - GdkEventSequence *sequence; - - sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture)); - gtk_gesture_set_sequence_state (gesture, sequence, - GTK_EVENT_SEQUENCE_CLAIMED); - } - hadjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar)); if (hadjustment && may_hscroll (scrolled_window)) { @@ -2024,7 +2012,6 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window) 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); controller = gtk_event_controller_motion_new (); gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE); @@ -2551,52 +2538,6 @@ gtk_scrolled_window_get_kinetic_scrolling (GtkScrolledWindow *scrolled_window) return priv->kinetic_scrolling; } -/** - * gtk_scrolled_window_set_capture_button_press: - * @scrolled_window: a #GtkScrolledWindow - * @capture_button_press: %TRUE to capture button presses - * - * Changes the behaviour of @scrolled_window with regard to the initial - * event that possibly starts kinetic scrolling. When @capture_button_press - * is set to %TRUE, the event is captured by the scrolled window, and - * then later replayed if it is meant to go to the child widget. - * - * This should be enabled if any child widgets perform non-reversible - * actions on button press events. If they don't, it might be better to - * set @capture_button_press to %FALSE. - * - * This setting only has an effect if kinetic scrolling is enabled. - */ -void -gtk_scrolled_window_set_capture_button_press (GtkScrolledWindow *scrolled_window, - gboolean capture_button_press) -{ - GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window); - - g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window)); - - priv->capture_button_press = capture_button_press; -} - -/** - * gtk_scrolled_window_get_capture_button_press: - * @scrolled_window: a #GtkScrolledWindow - * - * Return whether button presses are captured during kinetic - * scrolling. See gtk_scrolled_window_set_capture_button_press(). - * - * Returns: %TRUE if button presses are captured during kinetic scrolling - */ -gboolean -gtk_scrolled_window_get_capture_button_press (GtkScrolledWindow *scrolled_window) -{ - GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window); - - g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), FALSE); - - return priv->capture_button_press; -} - static void gtk_scrolled_window_dispose (GObject *object) { diff --git a/gtk/gtkscrolledwindow.h b/gtk/gtkscrolledwindow.h index 06a0c778a4..30cfb334c6 100644 --- a/gtk/gtkscrolledwindow.h +++ b/gtk/gtkscrolledwindow.h @@ -146,12 +146,6 @@ GDK_AVAILABLE_IN_ALL gboolean gtk_scrolled_window_get_kinetic_scrolling (GtkScrolledWindow *scrolled_window); GDK_AVAILABLE_IN_ALL -void gtk_scrolled_window_set_capture_button_press (GtkScrolledWindow *scrolled_window, - gboolean capture_button_press); -GDK_AVAILABLE_IN_ALL -gboolean gtk_scrolled_window_get_capture_button_press (GtkScrolledWindow *scrolled_window); - -GDK_AVAILABLE_IN_ALL void gtk_scrolled_window_set_overlay_scrolling (GtkScrolledWindow *scrolled_window, gboolean overlay_scrolling); GDK_AVAILABLE_IN_ALL diff --git a/tests/testkineticscrolling.c b/tests/testkineticscrolling.c index 1189cc9d14..e492e5135f 100644 --- a/tests/testkineticscrolling.c +++ b/tests/testkineticscrolling.c @@ -66,7 +66,6 @@ kinetic_scrolling (void) swindow = gtk_scrolled_window_new (); gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE); - gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), button_grid); gtk_grid_attach (GTK_GRID (grid), swindow, 0, 1, 1, 1); @@ -104,7 +103,6 @@ kinetic_scrolling (void) swindow = gtk_scrolled_window_new (); gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE); - gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), treeview); gtk_grid_attach (GTK_GRID (grid), swindow, 1, 1, 1, 1); @@ -114,7 +112,6 @@ kinetic_scrolling (void) textview = gtk_text_view_new (); swindow = gtk_scrolled_window_new (); gtk_scrolled_window_set_kinetic_scrolling (GTK_SCROLLED_WINDOW (swindow), TRUE); - gtk_scrolled_window_set_capture_button_press (GTK_SCROLLED_WINDOW (swindow), TRUE); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview); gtk_grid_attach (GTK_GRID (grid), swindow, 2, 1, 1, 1); |