mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 23:10:22 +00:00
gtk: Don't call gdk_window_process_updates() when scrolling
This can cause lagging when scrolling as it causes us to repaint on every scroll event. This wasn't historically a great problem, but with smooth scrolling we get a lot more events, so this now creates visible lagging on slower machines.
This commit is contained in:
parent
d55961adf9
commit
917ca6a802
@ -2360,20 +2360,6 @@ gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view)
|
||||
}
|
||||
}
|
||||
|
||||
/* Internal functions */
|
||||
static void
|
||||
gtk_icon_view_process_updates (GtkIconView *icon_view)
|
||||
{
|
||||
/* Prior to drawing, we check if a layout has been scheduled. If so,
|
||||
* do it now that all cell view items have valid sizes before we proceeed
|
||||
* (and resize the bin_window if required).
|
||||
*/
|
||||
if (icon_view->priv->layout_idle_id != 0)
|
||||
gtk_icon_view_layout (icon_view);
|
||||
|
||||
gdk_window_process_updates (icon_view->priv->bin_window, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_set_hadjustment_values (GtkIconView *icon_view)
|
||||
{
|
||||
@ -2511,8 +2497,6 @@ gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gtk_icon_view_update_rubberband (GTK_WIDGET (icon_view));
|
||||
|
||||
_gtk_icon_view_accessible_adjustment_changed (icon_view);
|
||||
|
||||
gtk_icon_view_process_updates (icon_view);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1312,9 +1312,6 @@ animation_timeout (gpointer data)
|
||||
gdk_threads_add_timeout (delay, animation_timeout, image);
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
gdk_window_process_updates (gtk_widget_get_window (widget), TRUE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -1123,7 +1123,5 @@ gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gdk_window_move (priv->bin_window,
|
||||
- gtk_adjustment_get_value (priv->hadjustment),
|
||||
- gtk_adjustment_get_value (priv->vadjustment));
|
||||
|
||||
gdk_window_process_updates (priv->bin_window, TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -116,8 +116,6 @@ struct _GtkRangePrivate
|
||||
gint slider_start; /* Slider range along the long dimension, in widget->window coords */
|
||||
gint slider_end;
|
||||
|
||||
guint repaint_id;
|
||||
|
||||
/* Steppers are: < > ---- < >
|
||||
* a b c d
|
||||
*/
|
||||
@ -1499,10 +1497,6 @@ gtk_range_destroy (GtkWidget *widget)
|
||||
|
||||
gtk_range_remove_step_timer (range);
|
||||
|
||||
if (priv->repaint_id)
|
||||
g_source_remove (priv->repaint_id);
|
||||
priv->repaint_id = 0;
|
||||
|
||||
if (priv->adjustment)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->adjustment,
|
||||
@ -2034,11 +2028,6 @@ gtk_range_draw (GtkWidget *widget,
|
||||
"focus-padding", &focus_padding,
|
||||
NULL);
|
||||
|
||||
/* we're now exposing, so there's no need to force early repaints */
|
||||
if (priv->repaint_id)
|
||||
g_source_remove (priv->repaint_id);
|
||||
priv->repaint_id = 0;
|
||||
|
||||
gtk_range_calc_marks (range);
|
||||
gtk_range_calc_layout (range, gtk_adjustment_get_value (priv->adjustment));
|
||||
|
||||
@ -2984,20 +2973,6 @@ gtk_range_adjustment_changed (GtkAdjustment *adjustment,
|
||||
*/
|
||||
}
|
||||
|
||||
static gboolean
|
||||
force_repaint (gpointer data)
|
||||
{
|
||||
GtkRange *range = GTK_RANGE (data);
|
||||
GtkRangePrivate *priv = range->priv;
|
||||
GtkWidget *widget = GTK_WIDGET (range);
|
||||
|
||||
priv->repaint_id = 0;
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
gdk_window_process_updates (gtk_widget_get_window (widget), FALSE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
@ -3014,11 +2989,6 @@ gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
(GTK_IS_SCALE (range) && gtk_scale_get_draw_value (GTK_SCALE (range))))
|
||||
{
|
||||
gtk_widget_queue_draw (GTK_WIDGET (range));
|
||||
/* setup a timer to ensure the range isn't lagging too much behind the scroll position */
|
||||
if (!priv->repaint_id)
|
||||
priv->repaint_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS,
|
||||
181, force_repaint,
|
||||
range, NULL);
|
||||
}
|
||||
|
||||
/* Note that we don't round off to priv->round_digits here.
|
||||
|
@ -7700,26 +7700,6 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment,
|
||||
*/
|
||||
gtk_text_view_validate_onscreen (text_view);
|
||||
|
||||
/* process exposes */
|
||||
if (gtk_widget_get_realized (GTK_WIDGET (text_view)))
|
||||
{
|
||||
DV (g_print ("Processing updates (%s)\n", G_STRLOC));
|
||||
|
||||
if (priv->left_window)
|
||||
gdk_window_process_updates (priv->left_window->bin_window, TRUE);
|
||||
|
||||
if (priv->right_window)
|
||||
gdk_window_process_updates (priv->right_window->bin_window, TRUE);
|
||||
|
||||
if (priv->top_window)
|
||||
gdk_window_process_updates (priv->top_window->bin_window, TRUE);
|
||||
|
||||
if (priv->bottom_window)
|
||||
gdk_window_process_updates (priv->bottom_window->bin_window, TRUE);
|
||||
|
||||
gdk_window_process_updates (priv->text_window->bin_window, TRUE);
|
||||
}
|
||||
|
||||
/* If this got installed, get rid of it, it's just a waste of time. */
|
||||
if (priv->first_validate_idle != 0)
|
||||
{
|
||||
|
@ -6810,21 +6810,6 @@ install_presize_handler (GtkTreeView *tree_view)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_view_bin_process_updates (GtkTreeView *tree_view)
|
||||
{
|
||||
/* Prior to drawing, we make sure the visible area is validated. */
|
||||
if (tree_view->priv->presize_handler_timer)
|
||||
{
|
||||
g_source_remove (tree_view->priv->presize_handler_timer);
|
||||
tree_view->priv->presize_handler_timer = 0;
|
||||
|
||||
do_presize_handler (tree_view);
|
||||
}
|
||||
|
||||
gdk_window_process_updates (tree_view->priv->bin_window, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
scroll_sync_handler (GtkTreeView *tree_view)
|
||||
{
|
||||
@ -9393,10 +9378,6 @@ gtk_tree_view_clamp_node_visible (GtkTreeView *tree_view,
|
||||
path = _gtk_tree_path_new_from_rbtree (tree, node);
|
||||
if (path)
|
||||
{
|
||||
/* We process updates because we want to clear old selected items when we scroll.
|
||||
* if this is removed, we get a "selection streak" at the bottom. */
|
||||
gtk_tree_view_bin_process_updates (tree_view);
|
||||
|
||||
gtk_tree_view_scroll_to_cell (tree_view, path, NULL, FALSE, 0.0, 0.0);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
@ -11311,9 +11292,6 @@ gtk_tree_view_adjustment_changed (GtkAdjustment *adjustment,
|
||||
if (!tree_view->priv->in_top_row_to_dy)
|
||||
gtk_tree_view_dy_to_top_row (tree_view);
|
||||
}
|
||||
|
||||
gdk_window_process_updates (tree_view->priv->header_window, TRUE);
|
||||
gtk_tree_view_bin_process_updates (tree_view);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -901,10 +901,7 @@ gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
|
||||
new_y = - gtk_adjustment_get_value (vadjustment);
|
||||
|
||||
if (new_x != old_x || new_y != old_y)
|
||||
{
|
||||
gdk_window_move (priv->bin_window, new_x, new_y);
|
||||
gdk_window_process_updates (priv->bin_window, TRUE);
|
||||
}
|
||||
gdk_window_move (priv->bin_window, new_x, new_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user