[gtk+] widget: Optimize away unndeeded redraws
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Optimize away unndeeded redraws
- Date: Fri, 30 Nov 2012 19:46:39 +0000 (UTC)
commit 35362337ecc9ef9a5b4366f6ad19d197e9a1e955
Author: Benjamin Otte <otte redhat com>
Date: Fri Nov 30 20:40:18 2012 +0100
widget: Optimize away unndeeded redraws
If only styles were updated that don't require resizes, don't queue one.
gtk/gtkwidget.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e9a6eec..2f55579 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -35,6 +35,7 @@
#include "gtkcontainer.h"
#include "gtkaccelmapprivate.h"
#include "gtkclipboard.h"
+#include "gtkcssstylepropertyprivate.h"
#include "gtkiconfactory.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
@@ -6716,15 +6717,27 @@ gtk_widget_real_style_updated (GtkWidget *widget)
if (widget->priv->context)
{
+ const GtkBitmask *changes = _gtk_style_context_get_changes (widget->priv->context);
+
if (gtk_widget_get_realized (widget) &&
gtk_widget_get_has_window (widget) &&
!gtk_widget_get_app_paintable (widget))
gtk_style_context_set_background (widget->priv->context,
widget->priv->window);
- }
- if (widget->priv->anchored)
- gtk_widget_queue_resize (widget);
+ if (widget->priv->anchored)
+ {
+ if (changes && _gtk_css_style_property_changes_affect_size (changes))
+ gtk_widget_queue_resize (widget);
+ else
+ gtk_widget_queue_draw (widget);
+ }
+ }
+ else
+ {
+ if (widget->priv->anchored)
+ gtk_widget_queue_resize (widget);
+ }
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]