Fix up the border/background-color removal

I overlooked one level of indirection here. Oops.
This commit is contained in:
Matthias Clasen 2019-03-31 20:43:19 -04:00
parent 058986714c
commit c2c4133eb0
6 changed files with 30 additions and 17 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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",

View File

@ -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);
}

View File

@ -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)

View File

@ -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)