[maemo-commits] [maemo-commits] r13787 - in projects/haf/trunk/gtk+: . gtk
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Thu Sep 13 14:46:14 EEST 2007
- Previous message: [maemo-commits] r13786 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r13788 - projects/haf/trunk/hildon-desktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: kris Date: 2007-09-13 14:45:21 +0300 (Thu, 13 Sep 2007) New Revision: 13787 Modified: projects/haf/trunk/gtk+/ChangeLog projects/haf/trunk/gtk+/gtk/gtkrange.c Log: Thu Sep 13 13:40:50 2007 Tim Janik <timj at imendio.com> Fix for NB#59279. * gtk/gtkrange.c (gtk_range_adjustment_value_changed): removed code that forced range repaints upon every motion event, because these tend to stall other repaints on slower devices. added a timer to still force repaints every once in a while (roughly 5Hz atm) to avoid leaving the user without feedback on the range. Modified: projects/haf/trunk/gtk+/ChangeLog =================================================================== --- projects/haf/trunk/gtk+/ChangeLog 2007-09-13 11:26:13 UTC (rev 13786) +++ projects/haf/trunk/gtk+/ChangeLog 2007-09-13 11:45:21 UTC (rev 13787) @@ -1,3 +1,13 @@ +Thu Sep 13 13:40:50 2007 Tim Janik <timj at imendio.com> + + Fix for NB#59279. + + * gtk/gtkrange.c (gtk_range_adjustment_value_changed): removed code + that forced range repaints upon every motion event, because these tend + to stall other repaints on slower devices. + added a timer to still force repaints every once in a while (roughly + 5Hz atm) to avoid leaving the user without feedback on the range. + 2007-09-12 13:14:34 Tim Janik <timj at imendio.com> * gtk/gtknotebook.c: make tabs scrollable and homogeneous by default Modified: projects/haf/trunk/gtk+/gtk/gtkrange.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkrange.c 2007-09-13 11:26:13 UTC (rev 13786) +++ projects/haf/trunk/gtk+/gtk/gtkrange.c 2007-09-13 11:45:21 UTC (rev 13787) @@ -108,6 +108,7 @@ GtkSensitivityType lower_sensitivity; GtkSensitivityType upper_sensitivity; + guint repaint_id; gdouble fill_level; }; @@ -1165,7 +1166,11 @@ gtk_range_remove_step_timer (range); gtk_range_remove_update_timer (range); - + + if (range->layout->repaint_id) + g_source_remove (range->layout->repaint_id); + range->layout->repaint_id = 0; + if (range->adjustment) { g_signal_handlers_disconnect_by_func (range->adjustment, @@ -1410,7 +1415,7 @@ gtk_range_expose (GtkWidget *widget, GdkEventExpose *event) { - GtkRange *range; + GtkRange *range = GTK_RANGE (widget); gboolean sensitive; GtkStateType state; GtkShadowType shadow_type; @@ -1423,17 +1428,17 @@ g_object_get (gtk_widget_get_settings (widget), "gtk-touchscreen-mode", &touchscreen, NULL); + if (GTK_WIDGET_CAN_FOCUS (range)) + gtk_widget_style_get (GTK_WIDGET (range), + "focus-line-width", &focus_line_width, + "focus-padding", &focus_padding, + NULL); - range = GTK_RANGE (widget); + /* we're now exposing, so there's no need to force early repaints */ + if (range->layout->repaint_id) + g_source_remove (range->layout->repaint_id); + range->layout->repaint_id = 0; - if (GTK_WIDGET_CAN_FOCUS (range)) - { - gtk_widget_style_get (GTK_WIDGET (range), - "focus-line-width", &focus_line_width, - "focus-padding", &focus_padding, - NULL); - } - expose_area = event->area; expose_area.x -= widget->allocation.x; expose_area.y -= widget->allocation.y; @@ -2274,6 +2279,25 @@ */ } +static gboolean +force_repaint (gpointer data) +{ + GtkRange *range; + + GDK_THREADS_ENTER (); + + range = GTK_RANGE (data); + + range->layout->repaint_id = 0; + + if (GTK_WIDGET_DRAWABLE (range)) + gdk_window_process_updates (GTK_WIDGET (range)->window, FALSE); + + GDK_THREADS_LEAVE (); + + return FALSE; +} + static void gtk_range_adjustment_value_changed (GtkAdjustment *adjustment, gpointer data) @@ -2289,10 +2313,14 @@ if (layout_changed (range->layout, &layout)) { gtk_widget_queue_draw (GTK_WIDGET (range)); - - /* This is so we don't lag the widget being scrolled. */ - if (GTK_WIDGET_REALIZED (range)) - gdk_window_process_updates (GTK_WIDGET (range)->window, FALSE); + + /* setup a timer to ensure the range isn't lagging too much behind + * the scroll position + */ + if (!range->layout->repaint_id) + range->layout->repaint_id = g_timeout_add_full (GDK_PRIORITY_EVENTS, + 181, force_repaint, + range, NULL); } /* Note that we don't round off to range->round_digits here.
- Previous message: [maemo-commits] r13786 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r13788 - projects/haf/trunk/hildon-desktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]