forked from AuroraMiddleware/gtk
Revert "Add scaling adjustment for touch dragging a scrolled window"
This reverts commit d4943ef2fb
.
This commit has broken scrolling in GtkTreeView. VTE has
`scroll-unit-pixels` property now, so the original issue is fixed
separately.
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3707
This commit is contained in:
parent
48de9796c2
commit
d0cf3007c6
@ -1005,9 +1005,7 @@ scrolled_window_drag_update_cb (GtkScrolledWindow *scrolled_window,
|
||||
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
GtkScrollable *child;
|
||||
GtkBorder border;
|
||||
double dx, dy, scale, size;
|
||||
gdouble dx, dy;
|
||||
|
||||
gtk_scrolled_window_invalidate_overshoot (scrolled_window);
|
||||
|
||||
@ -1020,25 +1018,10 @@ scrolled_window_drag_update_cb (GtkScrolledWindow *scrolled_window,
|
||||
GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
}
|
||||
|
||||
child = GTK_SCROLLABLE (gtk_bin_get_child (GTK_BIN (scrolled_window)));
|
||||
|
||||
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
||||
if (hadjustment && may_hscroll (scrolled_window))
|
||||
{
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
size = gtk_widget_get_allocated_width (GTK_WIDGET (child));
|
||||
if (gtk_scrollable_get_border (child, &border))
|
||||
size -= border.left + border.right;
|
||||
|
||||
scale = gtk_adjustment_get_page_size (hadjustment) / size;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = 1.0;
|
||||
}
|
||||
|
||||
dx = priv->drag_start_x - offset_x * scale;
|
||||
dx = priv->drag_start_x - offset_x;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window,
|
||||
hadjustment, dx);
|
||||
}
|
||||
@ -1046,20 +1029,7 @@ scrolled_window_drag_update_cb (GtkScrolledWindow *scrolled_window,
|
||||
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
||||
if (vadjustment && may_vscroll (scrolled_window))
|
||||
{
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
size = gtk_widget_get_allocated_height (GTK_WIDGET (child));
|
||||
if (gtk_scrollable_get_border (child, &border))
|
||||
size -= border.top + border.bottom;
|
||||
|
||||
scale = gtk_adjustment_get_page_size (vadjustment) / size;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = 1.0;
|
||||
}
|
||||
|
||||
dy = priv->drag_start_y - offset_y * scale;
|
||||
dy = priv->drag_start_y - offset_y;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window,
|
||||
vadjustment, dy);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user