gtkwidget: read the draw border in place instead of copying it at every expose
This commit is contained in:
parent
65a92fda3f
commit
fe26bf13ae
1 changed files with 12 additions and 6 deletions
|
|
@ -393,6 +393,9 @@ typedef struct
|
|||
GtkRcPropertyParser parser;
|
||||
} StylePropertyCacheEntry;
|
||||
static StylePropertyCacheEntry style_property_cache[STYLE_PROPERTY_CACHE_SIZE];
|
||||
static GParamSpec *style_property_lookup (GType type,
|
||||
const gchar *name,
|
||||
GtkRcPropertyParser *parser);
|
||||
|
||||
static GQuark quark_property_parser = 0;
|
||||
static GQuark quark_aux_info = 0;
|
||||
|
|
@ -3760,21 +3763,24 @@ gtk_widget_get_draw_rectangle (GtkWidget *widget,
|
|||
{
|
||||
if (!gtk_widget_get_has_window (widget))
|
||||
{
|
||||
GtkBorder *draw_border = NULL;
|
||||
const GtkBorder *draw_border;
|
||||
GtkRcPropertyParser parser;
|
||||
GParamSpec *pspec;
|
||||
|
||||
*rect = widget->allocation;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"draw-border", &draw_border,
|
||||
NULL);
|
||||
/* this runs for every child at every expose: look at the
|
||||
* value instead of asking for a copy of it */
|
||||
pspec = style_property_lookup (G_OBJECT_TYPE (widget), "draw-border", &parser);
|
||||
draw_border = g_value_get_boxed (_gtk_style_peek_property_value (widget->style,
|
||||
G_OBJECT_TYPE (widget),
|
||||
pspec, parser));
|
||||
if (draw_border)
|
||||
{
|
||||
rect->x -= draw_border->left;
|
||||
rect->y -= draw_border->top;
|
||||
rect->width += draw_border->left + draw_border->right;
|
||||
rect->height += draw_border->top + draw_border->bottom;
|
||||
|
||||
gtk_border_free (draw_border);
|
||||
}
|
||||
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
|
|
|
|||
Loading…
Reference in a new issue