mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 01:31:13 +00:00
symboliccolor: Change prototype of _gtk_symbolic_color_resolve_full()
We can juts pass a GtkStyleProviderPrivate, that one has the vfunc we want already. So no need to pass vfuncs anymore.
This commit is contained in:
parent
448cdb0737
commit
0cc32eae62
@ -25,6 +25,7 @@ G_BEGIN_DECLS
|
||||
|
||||
/* forward declaration for GtkCssValue */
|
||||
typedef struct _GtkCssComputedValues GtkCssComputedValues;
|
||||
typedef struct _GtkStyleProviderPrivate GtkStyleProviderPrivate; /* dummy typedef */
|
||||
|
||||
typedef enum { /*< skip >*/
|
||||
GTK_CSS_CHANGE_CLASS = (1 << 0),
|
||||
|
@ -399,9 +399,6 @@ static void gtk_style_context_impl_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static GtkSymbolicColor *
|
||||
gtk_style_context_color_lookup_func (gpointer contextp,
|
||||
const char *name);
|
||||
static StyleData *style_data_lookup (GtkStyleContext *context);
|
||||
|
||||
|
||||
@ -2708,15 +2705,6 @@ gtk_style_context_get_junction_sides (GtkStyleContext *context)
|
||||
return context->priv->info->junction_sides;
|
||||
}
|
||||
|
||||
static GtkSymbolicColor *
|
||||
gtk_style_context_color_lookup_func (gpointer contextp,
|
||||
const char *name)
|
||||
{
|
||||
GtkStyleContext *context = contextp;
|
||||
|
||||
return _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade), name);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_style_context_resolve_color_value (GtkStyleContext *context,
|
||||
GtkCssValue *current,
|
||||
@ -2729,10 +2717,9 @@ _gtk_style_context_resolve_color_value (GtkStyleContext *context,
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
|
||||
return _gtk_symbolic_color_resolve_full ((GtkSymbolicColor *) color,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade),
|
||||
current,
|
||||
current_deps,
|
||||
gtk_style_context_color_lookup_func,
|
||||
context,
|
||||
dependencies);
|
||||
}
|
||||
|
||||
@ -2750,10 +2737,9 @@ _gtk_style_context_resolve_color (GtkStyleContext *context,
|
||||
g_return_val_if_fail (result != NULL, FALSE);
|
||||
|
||||
val = _gtk_symbolic_color_resolve_full (color,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade),
|
||||
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
gtk_style_context_color_lookup_func,
|
||||
context,
|
||||
dependencies);
|
||||
if (val == NULL)
|
||||
return FALSE;
|
||||
@ -2784,7 +2770,7 @@ gtk_style_context_lookup_color (GtkStyleContext *context,
|
||||
g_return_val_if_fail (color_name != NULL, FALSE);
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
|
||||
sym_color = gtk_style_context_color_lookup_func (context, color_name);
|
||||
sym_color = _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade), color_name);
|
||||
if (sym_color == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -50,6 +50,10 @@ _gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
|
||||
{
|
||||
GtkStyleProviderPrivateInterface *iface;
|
||||
|
||||
/* for compat with gtk_symbolic_color_resolve() */
|
||||
if (provider == NULL)
|
||||
return NULL;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
||||
|
||||
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
|
||||
|
@ -34,7 +34,7 @@ G_BEGIN_DECLS
|
||||
#define GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GTK_TYPE_STYLE_PROVIDER_PRIVATE, GtkStyleProviderPrivateInterface))
|
||||
|
||||
typedef struct _GtkStyleProviderPrivateInterface GtkStyleProviderPrivateInterface;
|
||||
typedef struct _GtkStyleProviderPrivate GtkStyleProviderPrivate; /* dummy typedef */
|
||||
/* typedef struct _GtkStyleProviderPrivate GtkStyleProviderPrivate; */ /* dummy typedef */
|
||||
|
||||
struct _GtkStyleProviderPrivateInterface
|
||||
{
|
||||
|
@ -674,15 +674,6 @@ _shade_color (GdkRGBA *color,
|
||||
*color = temp;
|
||||
}
|
||||
|
||||
static GtkSymbolicColor *
|
||||
resolve_lookup_color (gpointer data, const char *name)
|
||||
{
|
||||
if (data == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_style_properties_lookup_color (data, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_resolve:
|
||||
* @color: a #GtkSymbolicColor
|
||||
@ -717,10 +708,9 @@ gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
|
||||
current = _gtk_css_rgba_value_new_from_rgba (&pink);
|
||||
v =_gtk_symbolic_color_resolve_full (color,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (props),
|
||||
current,
|
||||
0,
|
||||
resolve_lookup_color,
|
||||
props,
|
||||
NULL);
|
||||
_gtk_css_value_unref (current);
|
||||
if (v == NULL)
|
||||
@ -732,19 +722,18 @@ gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkSymbolicColorLookupFunc func,
|
||||
gpointer data,
|
||||
GtkCssDependencies *dependencies)
|
||||
_gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssDependencies unused;
|
||||
GtkCssValue *value;
|
||||
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), FALSE);
|
||||
g_return_val_if_fail (current != NULL, FALSE);
|
||||
g_return_val_if_fail (func != NULL, FALSE);
|
||||
|
||||
if (dependencies == NULL)
|
||||
dependencies = &unused;
|
||||
@ -759,12 +748,12 @@ _gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
{
|
||||
GtkSymbolicColor *named_color;
|
||||
|
||||
named_color = func (data, color->name);
|
||||
named_color = _gtk_style_provider_private_get_color (provider, color->name);
|
||||
|
||||
if (!named_color)
|
||||
return NULL;
|
||||
|
||||
return _gtk_symbolic_color_resolve_full (named_color, current, current_deps, func, data, dependencies);
|
||||
return _gtk_symbolic_color_resolve_full (named_color, provider, current, current_deps, dependencies);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -773,7 +762,7 @@ _gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
GtkCssValue *val;
|
||||
GdkRGBA shade;
|
||||
|
||||
val = _gtk_symbolic_color_resolve_full (color->shade.color, current, current_deps, func, data, dependencies);
|
||||
val = _gtk_symbolic_color_resolve_full (color->shade.color, provider, current, current_deps, dependencies);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -792,7 +781,7 @@ _gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
GtkCssValue *val;
|
||||
GdkRGBA alpha;
|
||||
|
||||
val = _gtk_symbolic_color_resolve_full (color->alpha.color, current, current_deps, func, data, dependencies);
|
||||
val = _gtk_symbolic_color_resolve_full (color->alpha.color, provider, current, current_deps, dependencies);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
@ -812,13 +801,13 @@ _gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
GdkRGBA color1, color2, res;
|
||||
GtkCssDependencies dep1, dep2;
|
||||
|
||||
val = _gtk_symbolic_color_resolve_full (color->mix.color1, current, current_deps, func, data, &dep1);
|
||||
val = _gtk_symbolic_color_resolve_full (color->mix.color1, provider, current, current_deps, &dep1);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
color1 = *_gtk_css_rgba_value_get_rgba (val);
|
||||
_gtk_css_value_unref (val);
|
||||
|
||||
val = _gtk_symbolic_color_resolve_full (color->mix.color2, current, current_deps, func, data, &dep2);
|
||||
val = _gtk_symbolic_color_resolve_full (color->mix.color2, provider, current, current_deps, &dep2);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
color2 = *_gtk_css_rgba_value_get_rgba (val);
|
||||
|
@ -24,13 +24,10 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef GtkSymbolicColor * (* GtkSymbolicColorLookupFunc) (gpointer data, const char *name);
|
||||
|
||||
GtkCssValue * _gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkSymbolicColorLookupFunc func,
|
||||
gpointer data,
|
||||
GtkCssDependencies *dependencies);
|
||||
|
||||
GtkSymbolicColor * _gtk_symbolic_color_get_current_color (void);
|
||||
|
Loading…
Reference in New Issue
Block a user