style: Remove GtkStylePropertyContext again
We need to solve this differently. I have no idea yet how, but I'll invent something later. This only affects win32 theming and that's broken anyway.
This commit is contained in:
@ -1440,24 +1440,6 @@ gtk_style_context_get_property (GtkStyleContext *context,
|
|||||||
gtk_style_properties_get_property (data->store, property, 0, value);
|
gtk_style_properties_get_property (data->store, property, 0, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_style_context_get_valist (GtkStyleContext *context,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *property_context,
|
|
||||||
va_list args)
|
|
||||||
{
|
|
||||||
GtkStyleContextPrivate *priv;
|
|
||||||
StyleData *data;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
|
||||||
|
|
||||||
priv = context->priv;
|
|
||||||
g_return_if_fail (priv->widget_path != NULL);
|
|
||||||
|
|
||||||
data = style_data_lookup (context, state);
|
|
||||||
_gtk_style_properties_get_valist (data->store, 0, property_context, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_style_context_get_valist:
|
* gtk_style_context_get_valist:
|
||||||
* @context: a #GtkStyleContext
|
* @context: a #GtkStyleContext
|
||||||
|
|||||||
@ -25,17 +25,6 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _GtkStylePropertyContext GtkStylePropertyContext;
|
|
||||||
struct _GtkStylePropertyContext
|
|
||||||
{
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
};
|
|
||||||
|
|
||||||
void _gtk_style_context_get_valist (GtkStyleContext *context,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *property_context,
|
|
||||||
va_list args);
|
|
||||||
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||||
GType widget_type,
|
GType widget_type,
|
||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
|
|||||||
@ -628,12 +628,25 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
|
|||||||
return property_data_match_state (prop, state);
|
return property_data_match_state (prop, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_style_properties_get_property:
|
||||||
|
* @props: a #GtkStyleProperties
|
||||||
|
* @property: style property name
|
||||||
|
* @state: state to retrieve the property value for
|
||||||
|
* @value: (out) (transfer full): return location for the style property value.
|
||||||
|
*
|
||||||
|
* Gets a style property from @props for the given state. When done with @value,
|
||||||
|
* g_value_unset() needs to be called to free any allocated memory.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the property exists in @props, %FALSE otherwise
|
||||||
|
*
|
||||||
|
* Since: 3.0
|
||||||
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
_gtk_style_properties_get_property (GtkStyleProperties *props,
|
gtk_style_properties_get_property (GtkStyleProperties *props,
|
||||||
const gchar *property,
|
const gchar *property,
|
||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
GtkStylePropertyContext *context,
|
GValue *value)
|
||||||
GValue *value)
|
|
||||||
{
|
{
|
||||||
GtkStyleProperty *node;
|
GtkStyleProperty *node;
|
||||||
|
|
||||||
@ -657,75 +670,6 @@ _gtk_style_properties_get_property (GtkStyleProperties *props,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_style_properties_get_property:
|
|
||||||
* @props: a #GtkStyleProperties
|
|
||||||
* @property: style property name
|
|
||||||
* @state: state to retrieve the property value for
|
|
||||||
* @value: (out) (transfer full): return location for the style property value.
|
|
||||||
*
|
|
||||||
* Gets a style property from @props for the given state. When done with @value,
|
|
||||||
* g_value_unset() needs to be called to free any allocated memory.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the property exists in @props, %FALSE otherwise
|
|
||||||
*
|
|
||||||
* Since: 3.0
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
gtk_style_properties_get_property (GtkStyleProperties *props,
|
|
||||||
const gchar *property,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GValue *value)
|
|
||||||
{
|
|
||||||
GtkStylePropertyContext context = { 100, 100};
|
|
||||||
|
|
||||||
g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
|
|
||||||
g_return_val_if_fail (property != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (value != NULL, FALSE);
|
|
||||||
|
|
||||||
return _gtk_style_properties_get_property (props,
|
|
||||||
property,
|
|
||||||
state, &context, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_style_properties_get_valist (GtkStyleProperties *props,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *context,
|
|
||||||
va_list args)
|
|
||||||
{
|
|
||||||
const gchar *property_name;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
|
||||||
|
|
||||||
property_name = va_arg (args, const gchar *);
|
|
||||||
|
|
||||||
while (property_name)
|
|
||||||
{
|
|
||||||
gchar *error = NULL;
|
|
||||||
GValue value = G_VALUE_INIT;
|
|
||||||
|
|
||||||
if (!_gtk_style_properties_get_property (props,
|
|
||||||
property_name,
|
|
||||||
state,
|
|
||||||
context,
|
|
||||||
&value))
|
|
||||||
break;
|
|
||||||
|
|
||||||
G_VALUE_LCOPY (&value, args, 0, &error);
|
|
||||||
g_value_unset (&value);
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
g_warning ("Could not get style property \"%s\": %s", property_name, error);
|
|
||||||
g_free (error);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
property_name = va_arg (args, const gchar *);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_style_properties_get_valist:
|
* gtk_style_properties_get_valist:
|
||||||
* @props: a #GtkStyleProperties
|
* @props: a #GtkStyleProperties
|
||||||
@ -741,24 +685,35 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
|
|||||||
GtkStateFlags state,
|
GtkStateFlags state,
|
||||||
va_list args)
|
va_list args)
|
||||||
{
|
{
|
||||||
GtkStylePropertyContext context = { 100, 100};
|
const gchar *property_name;
|
||||||
|
|
||||||
return _gtk_style_properties_get_valist (props, state, &context, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_style_properties_get (GtkStyleProperties *props,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *context,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
|
||||||
|
|
||||||
va_start (args, context);
|
property_name = va_arg (args, const gchar *);
|
||||||
_gtk_style_properties_get_valist (props, state, context, args);
|
|
||||||
va_end (args);
|
while (property_name)
|
||||||
|
{
|
||||||
|
gchar *error = NULL;
|
||||||
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
|
if (!gtk_style_properties_get_property (props,
|
||||||
|
property_name,
|
||||||
|
state,
|
||||||
|
&value))
|
||||||
|
break;
|
||||||
|
|
||||||
|
G_VALUE_LCOPY (&value, args, 0, &error);
|
||||||
|
g_value_unset (&value);
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
g_warning ("Could not get style property \"%s\": %s", property_name, error);
|
||||||
|
g_free (error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
property_name = va_arg (args, const gchar *);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -27,17 +27,9 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
void _gtk_style_properties_get (GtkStyleProperties *props,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *context,
|
|
||||||
...);
|
|
||||||
void _gtk_style_properties_set_color_lookup_func (GtkStyleProperties *props,
|
void _gtk_style_properties_set_color_lookup_func (GtkStyleProperties *props,
|
||||||
GtkSymbolicColorLookupFunc func,
|
GtkSymbolicColorLookupFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
void _gtk_style_properties_get_valist (GtkStyleProperties *props,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *context,
|
|
||||||
va_list args);
|
|
||||||
|
|
||||||
const GValue * _gtk_style_properties_peek_property (GtkStyleProperties *props,
|
const GValue * _gtk_style_properties_peek_property (GtkStyleProperties *props,
|
||||||
GtkCssStyleProperty *property,
|
GtkCssStyleProperty *property,
|
||||||
|
|||||||
@ -64,9 +64,9 @@ _gtk_theming_background_apply_running_transformation (GtkThemingBackground *bg,
|
|||||||
other_flags = bg->flags | GTK_STATE_FLAG_PRELIGHT;
|
other_flags = bg->flags | GTK_STATE_FLAG_PRELIGHT;
|
||||||
|
|
||||||
gtk_theming_engine_get_background_color (bg->engine, other_flags, &other_bg);
|
gtk_theming_engine_get_background_color (bg->engine, other_flags, &other_bg);
|
||||||
_gtk_theming_engine_get (bg->engine, other_flags, &bg->prop_context,
|
gtk_theming_engine_get (bg->engine, other_flags,
|
||||||
"background-image", &other_pattern,
|
"background-image", &other_pattern,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (bg->pattern && other_pattern)
|
if (bg->pattern && other_pattern)
|
||||||
{
|
{
|
||||||
@ -258,8 +258,6 @@ _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bg->image_rect = image_rect;
|
bg->image_rect = image_rect;
|
||||||
bg->prop_context.width = image_rect.width;
|
|
||||||
bg->prop_context.height = image_rect.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -389,9 +387,9 @@ _gtk_theming_background_init_engine (GtkThemingBackground *bg)
|
|||||||
_gtk_theming_background_apply_clip (bg);
|
_gtk_theming_background_apply_clip (bg);
|
||||||
_gtk_theming_background_apply_origin (bg);
|
_gtk_theming_background_apply_origin (bg);
|
||||||
|
|
||||||
_gtk_theming_engine_get (bg->engine, bg->flags, &bg->prop_context,
|
gtk_theming_engine_get (bg->engine, bg->flags,
|
||||||
"background-image", &bg->pattern,
|
"background-image", &bg->pattern,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -50,8 +50,6 @@ struct _GtkThemingBackground {
|
|||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
GtkBorder padding;
|
GtkBorder padding;
|
||||||
GdkRGBA bg_color;
|
GdkRGBA bg_color;
|
||||||
|
|
||||||
GtkStylePropertyContext prop_context;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void _gtk_theming_background_init (GtkThemingBackground *bg,
|
void _gtk_theming_background_init (GtkThemingBackground *bg,
|
||||||
|
|||||||
@ -392,25 +392,6 @@ gtk_theming_engine_get_valist (GtkThemingEngine *engine,
|
|||||||
gtk_style_context_get_valist (priv->context, state, args);
|
gtk_style_context_get_valist (priv->context, state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_theming_engine_get (GtkThemingEngine *engine,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *property_context,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
GtkThemingEnginePrivate *priv;
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_THEMING_ENGINE (engine));
|
|
||||||
|
|
||||||
priv = engine->priv;
|
|
||||||
|
|
||||||
va_start (args, property_context);
|
|
||||||
_gtk_style_context_get_valist (priv->context, state, property_context, args);
|
|
||||||
va_end (args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_theming_engine_get:
|
* gtk_theming_engine_get:
|
||||||
* @engine: a #GtkThemingEngine
|
* @engine: a #GtkThemingEngine
|
||||||
@ -1556,19 +1537,15 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
|
|||||||
GtkJunctionSides junction;
|
GtkJunctionSides junction;
|
||||||
GtkBorderImage *border_image;
|
GtkBorderImage *border_image;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
GtkStylePropertyContext context;
|
|
||||||
|
|
||||||
flags = gtk_theming_engine_get_state (engine);
|
flags = gtk_theming_engine_get_state (engine);
|
||||||
junction = gtk_theming_engine_get_junction_sides (engine);
|
junction = gtk_theming_engine_get_junction_sides (engine);
|
||||||
gtk_theming_engine_get_border (engine, flags, &border);
|
gtk_theming_engine_get_border (engine, flags, &border);
|
||||||
|
|
||||||
context.width = width;
|
gtk_theming_engine_get (engine, flags,
|
||||||
context.height = height;
|
"border-image", &border_image,
|
||||||
|
"border-style", &border_style,
|
||||||
_gtk_theming_engine_get (engine, flags, &context,
|
NULL);
|
||||||
"border-image", &border_image,
|
|
||||||
"border-style", &border_style,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (border_image != NULL)
|
if (border_image != NULL)
|
||||||
{
|
{
|
||||||
@ -1925,7 +1902,6 @@ gtk_theming_engine_render_frame_gap (GtkThemingEngine *engine,
|
|||||||
GtkCssBorderCornerRadius *top_left_radius, *top_right_radius;
|
GtkCssBorderCornerRadius *top_left_radius, *top_right_radius;
|
||||||
GtkCssBorderCornerRadius *bottom_left_radius, *bottom_right_radius;
|
GtkCssBorderCornerRadius *bottom_left_radius, *bottom_right_radius;
|
||||||
gdouble x0, y0, x1, y1, xc, yc, wc, hc;
|
gdouble x0, y0, x1, y1, xc, yc, wc, hc;
|
||||||
GtkStylePropertyContext context;
|
|
||||||
GtkBorderImage *border_image;
|
GtkBorderImage *border_image;
|
||||||
GtkBorder border;
|
GtkBorder border;
|
||||||
|
|
||||||
@ -1933,17 +1909,14 @@ gtk_theming_engine_render_frame_gap (GtkThemingEngine *engine,
|
|||||||
state = gtk_theming_engine_get_state (engine);
|
state = gtk_theming_engine_get_state (engine);
|
||||||
junction = gtk_theming_engine_get_junction_sides (engine);
|
junction = gtk_theming_engine_get_junction_sides (engine);
|
||||||
|
|
||||||
context.width = width;
|
|
||||||
context.height = height;
|
|
||||||
|
|
||||||
gtk_theming_engine_get_border (engine, state, &border);
|
gtk_theming_engine_get_border (engine, state, &border);
|
||||||
_gtk_theming_engine_get (engine, state, &context,
|
gtk_theming_engine_get (engine, state,
|
||||||
"border-image", &border_image,
|
"border-image", &border_image,
|
||||||
"border-top-left-radius", &top_left_radius,
|
"border-top-left-radius", &top_left_radius,
|
||||||
"border-top-right-radius", &top_right_radius,
|
"border-top-right-radius", &top_right_radius,
|
||||||
"border-bottom-right-radius", &bottom_right_radius,
|
"border-bottom-right-radius", &bottom_right_radius,
|
||||||
"border-bottom-left-radius", &bottom_left_radius,
|
"border-bottom-left-radius", &bottom_left_radius,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
border_width = MIN (MIN (border.top, border.bottom),
|
border_width = MIN (MIN (border.top, border.bottom),
|
||||||
MIN (border.left, border.right));
|
MIN (border.left, border.right));
|
||||||
|
|||||||
@ -21,13 +21,6 @@
|
|||||||
#define __GTK_THEMING_ENGINE_PRIVATE_H__
|
#define __GTK_THEMING_ENGINE_PRIVATE_H__
|
||||||
|
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include "gtkstylecontextprivate.h"
|
|
||||||
|
|
||||||
void _gtk_theming_engine_get (GtkThemingEngine *engine,
|
|
||||||
GtkStateFlags state,
|
|
||||||
GtkStylePropertyContext *property_context,
|
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
|
||||||
|
|
||||||
|
|
||||||
void _gtk_theming_engine_paint_spinner (cairo_t *cr,
|
void _gtk_theming_engine_paint_spinner (cairo_t *cr,
|
||||||
gdouble radius,
|
gdouble radius,
|
||||||
|
|||||||
Reference in New Issue
Block a user