Build fix for GtkCssValues

This commit is contained in:
Matthias Clasen 2020-01-31 09:35:41 +01:00
parent 0c5ba00d59
commit 6104c12392
3 changed files with 17 additions and 9 deletions

View File

@ -172,6 +172,8 @@ static int other_props[] = {
GTK_CSS_PROPERTY_FILTER,
};
#define GET_VALUES(v) (GtkCssValue **)((guint8*)(v) + sizeof (GtkCssValues))
#define DEFINE_VALUES(ENUM, TYPE, NAME) \
void \
gtk_css_## NAME ## _values_compute_changes_and_affects (GtkCssStyle *style1, \
@ -179,13 +181,13 @@ gtk_css_## NAME ## _values_compute_changes_and_affects (GtkCssStyle *style1, \
GtkBitmask **changes, \
GtkCssAffects *affects) \
{ \
GtkCssValues *g1 = (GtkCssValues *)style1->NAME; \
GtkCssValues *g2 = (GtkCssValues *)style2->NAME; \
GtkCssValue **g1 = GET_VALUES (style1->NAME); \
GtkCssValue **g2 = GET_VALUES (style2->NAME); \
int i; \
for (i = 0; i < G_N_ELEMENTS (NAME ## _props); i++) \
{ \
GtkCssValue *v1 = g1->values[i] ? g1->values[i] : style1->core->color; \
GtkCssValue *v2 = g2->values[i] ? g2->values[i] : style2->core->color; \
GtkCssValue *v1 = g1[i] ? g1[i] : style1->core->color; \
GtkCssValue *v2 = g2[i] ? g2[i] : style2->core->color; \
if (!_gtk_css_value_equal (v1, v2)) \
{ \
guint id = NAME ## _props[i]; \

View File

@ -704,6 +704,8 @@ static int values_size[] = {
#define N_VALUES(type) ((values_size[type] - sizeof (GtkCssValues)) / sizeof (GtkCssValue *))
#define GET_VALUES(v) (GtkCssValue **)((guint8 *)(v) + sizeof (GtkCssValues))
GtkCssValues *gtk_css_values_ref (GtkCssValues *values)
{
values->ref_count++;
@ -715,11 +717,12 @@ static void
gtk_css_values_free (GtkCssValues *values)
{
int i;
GtkCssValue **v = GET_VALUES (values);
for (i = 0; i < N_VALUES (values->type); i++)
{
if (values->values[i])
gtk_css_value_unref (values->values[i]);
if (v[i])
gtk_css_value_unref (v[i]);
}
g_free (values);
@ -740,14 +743,18 @@ GtkCssValues *
gtk_css_values_copy (GtkCssValues *values)
{
GtkCssValues *copy;
GtkCssValue **v, **v2;
int i;
copy = gtk_css_values_new (values->type);
v = GET_VALUES (values);
v2 = GET_VALUES (copy);
for (i = 0; i < N_VALUES (values->type); i++)
{
if (values->values[i])
copy->values[i] = gtk_css_value_ref (values->values[i]);
if (v[i])
v2[i] = gtk_css_value_ref (v[i]);
}
return copy;

View File

@ -65,7 +65,6 @@ typedef struct _GtkCssOtherValues GtkCssOtherValues;
struct _GtkCssValues {
int ref_count;
GtkCssValuesType type;
GtkCssValue *values[];
};
struct _GtkCssCoreValues {