[gtk+] GtkWidget: Add a vfunc for queue_draw_region
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkWidget: Add a vfunc for queue_draw_region
- Date: Tue, 7 May 2013 14:43:58 +0000 (UTC)
commit cb2882a273a380bd022b6a7adfc064c5bf04081a
Author: Alexander Larsson <alexl redhat com>
Date: Thu May 2 11:08:10 2013 +0200
GtkWidget: Add a vfunc for queue_draw_region
Since widgets now cache drawn state we allow them to override
queue_draw_region to detect when some region of the widget
should be redrawn. For instance, if a widget draws the
background color in a pixel cache we will need to invalidate
that when the style context changes which queues a repaint.
gtk/gtkwidget.c | 14 +++++++++++++-
gtk/gtkwidget.h | 3 ++-
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 737d5b2..19e026a 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -751,6 +751,8 @@ static void gtk_widget_real_get_width_for_height (GtkWidget
gint *natural_width);
static void gtk_widget_real_state_flags_changed (GtkWidget *widget,
GtkStateFlags old_state);
+static void gtk_widget_real_queue_draw_region (GtkWidget *widget,
+ const cairo_region_t *region);
static const GtkWidgetAuxInfo* _gtk_widget_get_aux_info_or_defaults (GtkWidget *widget);
static GtkWidgetAuxInfo* gtk_widget_get_aux_info (GtkWidget *widget,
gboolean create);
@@ -1078,6 +1080,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->adjust_baseline_request = gtk_widget_real_adjust_baseline_request;
klass->adjust_size_allocation = gtk_widget_real_adjust_size_allocation;
klass->adjust_baseline_allocation = gtk_widget_real_adjust_baseline_allocation;
+ klass->queue_draw_region = gtk_widget_real_queue_draw_region;
g_object_class_install_property (gobject_class,
PROP_NAME,
@@ -4972,6 +4975,15 @@ gtk_widget_unrealize (GtkWidget *widget)
* Draw queueing.
*****************************************/
+static void
+gtk_widget_real_queue_draw_region (GtkWidget *widget,
+ const cairo_region_t *region)
+{
+ GtkWidgetPrivate *priv = widget->priv;
+
+ gdk_window_invalidate_region (priv->window, region, TRUE);
+}
+
/**
* gtk_widget_queue_draw_region:
* @widget: a #GtkWidget
@@ -5009,7 +5021,7 @@ gtk_widget_queue_draw_region (GtkWidget *widget,
if (!gtk_widget_get_mapped (w))
return;
- gdk_window_invalidate_region (priv->window, region, TRUE);
+ WIDGET_CLASS (widget)->queue_draw_region (widget, region);
}
/**
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 0365e06..25247d5 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -444,13 +444,14 @@ struct _GtkWidgetClass
gint *natural_baseline);
void (* adjust_baseline_allocation) (GtkWidget *widget,
gint *baseline);
+ void (*queue_draw_region) (GtkWidget *widget,
+ const cairo_region_t *region);
/*< private >*/
GtkWidgetClassPrivate *priv;
/* Padding for future expansion */
- void (*_gtk_reserved5) (void);
void (*_gtk_reserved6) (void);
void (*_gtk_reserved7) (void);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]