mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
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.
This commit is contained in:
parent
c9f6a9f7c5
commit
b1606db839
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -145,12 +145,6 @@ void gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *sc
|
||||
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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user