summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-03-31 20:43:19 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-03-31 20:43:19 -0400
commitc2c4133eb0efdb3d407deec65a3014dda868f44d (patch)
tree80c6448833154ab8816b2d884a271483522a1e65
parent058986714c5e21b91d3a4d85a410ee2e940394e0 (diff)
downloadgtk+-c2c4133eb0efdb3d407deec65a3014dda868f44d.tar.gz
Fix up the border/background-color removal
I overlooked one level of indirection here. Oops.
-rw-r--r--gtk/gtkflowbox.c5
-rw-r--r--gtk/gtkpopover.c5
-rw-r--r--gtk/gtkstylecontext.c10
-rw-r--r--gtk/gtktextdisplay.c16
-rw-r--r--gtk/gtktextutil.c6
-rw-r--r--gtk/gtktextview.c5
6 files changed, 30 insertions, 17 deletions
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 015a48e8ab..1cb1683606 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2362,7 +2362,7 @@ gtk_flow_box_snapshot (GtkWidget *widget,
{
cairo_path_t *path;
GtkBorder border;
- GdkRGBA border_color;
+ GdkRGBA *border_color;
if (vertical)
path_from_vertical_line_rects (cr, (GdkRectangle *)lines->data, lines->len);
@@ -2386,8 +2386,9 @@ gtk_flow_box_snapshot (GtkWidget *widget,
gtk_style_context_get_border (context, &border);
cairo_set_line_width (cr, border.left);
- gdk_cairo_set_source_rgba (cr, &border_color);
+ gdk_cairo_set_source_rgba (cr, border_color);
cairo_stroke (cr);
+ gdk_rgba_free (border_color);
}
g_array_free (lines, TRUE);
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index dba89e511c..d09c209733 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1309,14 +1309,15 @@ gtk_popover_snapshot (GtkWidget *widget,
/* Render the border of the arrow tip */
if (border.bottom > 0)
{
- GdkRGBA border_color;
+ GdkRGBA *border_color;
gtk_style_context_get (context, "border-color", &border_color, NULL);
gtk_popover_apply_tail_path (popover, cr);
- gdk_cairo_set_source_rgba (cr, &border_color);
+ gdk_cairo_set_source_rgba (cr, border_color);
cairo_set_line_width (cr, border.bottom + 1);
cairo_stroke (cr);
+ gdk_rgba_free (border_color);
}
cairo_restore (cr);
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 4e0c953e2c..27c73dbd80 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1928,16 +1928,18 @@ AtkAttributeSet *
_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
GtkStyleContext *context)
{
+ GdkRGBA *bg;
GdkRGBA color;
gchar *value;
- gtk_style_context_get (context, "background-color", &color, NULL);
+ gtk_style_context_get (context, "background-color", &bg, NULL);
value = g_strdup_printf ("%u,%u,%u",
- (guint) ceil (color.red * 65536 - color.red),
- (guint) ceil (color.green * 65536 - color.green),
- (guint) ceil (color.blue * 65536 - color.blue));
+ (guint) ceil (bg->red * 65536 - bg->red),
+ (guint) ceil (bg->green * 65536 - bg->green),
+ (guint) ceil (bg->blue * 65536 - bg->blue));
attributes = add_attribute (attributes, ATK_TEXT_ATTR_BG_COLOR, value);
g_free (value);
+ gdk_rgba_free (bg);
gtk_style_context_get_color (context, &color);
value = g_strdup_printf ("%u,%u,%u",
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 3f38112c88..de02bd3b47 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -569,7 +569,7 @@ render_para (GtkTextRenderer *text_renderer,
int byte_offset = 0;
PangoLayoutIter *iter;
int screen_width;
- GdkRGBA selection;
+ GdkRGBA *selection;
gboolean first = TRUE;
GtkCssNode *selection_node;
@@ -627,7 +627,7 @@ render_para (GtkTextRenderer *text_renderer,
cairo_t *cr = text_renderer->cr;
cairo_save (cr);
- gdk_cairo_set_source_rgba (cr, &selection);
+ gdk_cairo_set_source_rgba (cr, selection);
cairo_rectangle (cr,
line_display->left_margin, selection_y,
screen_width, selection_height);
@@ -683,7 +683,7 @@ render_para (GtkTextRenderer *text_renderer,
cairo_clip (cr);
cairo_region_destroy (clip_region);
- gdk_cairo_set_source_rgba (cr, &selection);
+ gdk_cairo_set_source_rgba (cr, selection);
cairo_rectangle (cr,
PANGO_PIXELS (line_rect.x),
selection_y,
@@ -706,7 +706,7 @@ render_para (GtkTextRenderer *text_renderer,
{
cairo_save (cr);
- gdk_cairo_set_source_rgba (cr, &selection);
+ gdk_cairo_set_source_rgba (cr, selection);
cairo_rectangle (cr,
line_display->left_margin,
selection_y,
@@ -730,7 +730,7 @@ render_para (GtkTextRenderer *text_renderer,
cairo_save (cr);
- gdk_cairo_set_source_rgba (cr, &selection);
+ gdk_cairo_set_source_rgba (cr, selection);
cairo_rectangle (cr,
PANGO_PIXELS (line_rect.x) + PANGO_PIXELS (line_rect.width),
selection_y,
@@ -771,11 +771,11 @@ render_para (GtkTextRenderer *text_renderer,
/* draw text under the cursor if any */
if (!line_display->cursor_at_line_end)
{
- GdkRGBA color;
+ GdkRGBA *color;
gtk_style_context_get (context, "background-color", &color, NULL);
- gdk_cairo_set_source_rgba (cr, &color);
+ gdk_cairo_set_source_rgba (cr, color);
text_renderer_set_state (text_renderer, CURSOR);
@@ -783,6 +783,7 @@ render_para (GtkTextRenderer *text_renderer,
line,
line_rect.x,
baseline);
+ gdk_rgba_free (color);
}
cairo_restore (cr);
@@ -793,6 +794,7 @@ render_para (GtkTextRenderer *text_renderer,
}
while (pango_layout_iter_next_line (iter));
+ gdk_rgba_free (selection);
pango_layout_iter_free (iter);
}
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 651b92abd9..bafe97552e 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -244,13 +244,17 @@ set_attributes_from_style (GtkStyleContext *context,
GtkTextAttributes *values)
{
const GdkRGBA black = { 0, };
+ GdkRGBA *bg;
if (!values->appearance.bg_rgba)
values->appearance.bg_rgba = gdk_rgba_copy (&black);
if (!values->appearance.fg_rgba)
values->appearance.fg_rgba = gdk_rgba_copy (&black);
- gtk_style_context_get (context, "background-color", values->appearance.bg_rgba, NULL);
+
+ gtk_style_context_get (context, "background-color", &bg, NULL);
+ *values->appearance.bg_rgba = *bg;
+ gdk_rgba_free (bg);
gtk_style_context_get_color (context, values->appearance.fg_rgba);
if (values->font)
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 00fa5ce0dd..b0fb9880fc 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -7302,6 +7302,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
{
GtkStyleContext *context;
const GdkRGBA black = { 0, };
+ GdkRGBA *bg;
if (!values->appearance.bg_rgba)
values->appearance.bg_rgba = gdk_rgba_copy (&black);
@@ -7310,7 +7311,9 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
context = gtk_widget_get_style_context (GTK_WIDGET (text_view));
- gtk_style_context_get (context, "background-color", values->appearance.bg_rgba, NULL);
+ gtk_style_context_get (context, "background-color", &bg, NULL);
+ *values->appearance.bg_rgba = *bg;
+ gdk_rgba_free (bg);
gtk_style_context_get_color (context, values->appearance.fg_rgba);
if (values->font)