Commit cb2882a2 authored by Alexander Larsson's avatar Alexander Larsson

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.
parent e13fb1d3
......@@ -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,
......@@ -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))
gdk_window_invalidate_region (priv->window, region, TRUE);
WIDGET_CLASS (widget)->queue_draw_region (widget, region);
......@@ -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);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment