Avoid using deprecated API internally
Use the proper API to implement deprecated functions.
This commit is contained in:
parent
72da6f808e
commit
e0283993f4
@ -10200,6 +10200,26 @@ clutter_actor_shader_post_paint (ClutterActor *actor)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
clutter_actor_set_shader_param_internal (ClutterActor *self,
|
||||
const gchar *param,
|
||||
const GValue *value)
|
||||
{
|
||||
ShaderData *shader_data;
|
||||
GValue *var;
|
||||
|
||||
shader_data = g_object_get_qdata (G_OBJECT (self), quark_shader_data);
|
||||
if (shader_data == NULL)
|
||||
return;
|
||||
|
||||
var = g_slice_new0 (GValue);
|
||||
g_value_init (var, G_VALUE_TYPE (value));
|
||||
g_value_copy (value, var);
|
||||
g_hash_table_insert (shader_data->value_hash, g_strdup (param), var);
|
||||
|
||||
clutter_actor_queue_redraw (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_set_shader_param:
|
||||
* @self: a #ClutterActor
|
||||
@ -10218,9 +10238,6 @@ clutter_actor_set_shader_param (ClutterActor *self,
|
||||
const gchar *param,
|
||||
const GValue *value)
|
||||
{
|
||||
ShaderData *shader_data;
|
||||
GValue *var;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
g_return_if_fail (param != NULL);
|
||||
g_return_if_fail (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value) ||
|
||||
@ -10229,16 +10246,7 @@ clutter_actor_set_shader_param (ClutterActor *self,
|
||||
G_VALUE_HOLDS_FLOAT (value) ||
|
||||
G_VALUE_HOLDS_INT (value));
|
||||
|
||||
shader_data = g_object_get_qdata (G_OBJECT (self), quark_shader_data);
|
||||
if (shader_data == NULL)
|
||||
return;
|
||||
|
||||
var = g_slice_new0 (GValue);
|
||||
g_value_init (var, G_VALUE_TYPE (value));
|
||||
g_value_copy (value, var);
|
||||
g_hash_table_insert (shader_data->value_hash, g_strdup (param), var);
|
||||
|
||||
clutter_actor_queue_redraw (self);
|
||||
clutter_actor_set_shader_param_internal (self, param, value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -10264,7 +10272,7 @@ clutter_actor_set_shader_param_float (ClutterActor *self,
|
||||
g_value_init (&var, G_TYPE_FLOAT);
|
||||
g_value_set_float (&var, value);
|
||||
|
||||
clutter_actor_set_shader_param (self, param, &var);
|
||||
clutter_actor_set_shader_param_internal (self, param, &var);
|
||||
|
||||
g_value_unset (&var);
|
||||
}
|
||||
@ -10292,7 +10300,7 @@ clutter_actor_set_shader_param_int (ClutterActor *self,
|
||||
g_value_init (&var, G_TYPE_INT);
|
||||
g_value_set_int (&var, value);
|
||||
|
||||
clutter_actor_set_shader_param (self, param, &var);
|
||||
clutter_actor_set_shader_param_internal (self, param, &var);
|
||||
|
||||
g_value_unset (&var);
|
||||
}
|
||||
|
@ -2855,6 +2855,7 @@ void
|
||||
clutter_grab_pointer_for_device (ClutterActor *actor,
|
||||
gint id_)
|
||||
{
|
||||
ClutterDeviceManager *manager;
|
||||
ClutterInputDevice *dev;
|
||||
|
||||
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
|
||||
@ -2870,7 +2871,8 @@ clutter_grab_pointer_for_device (ClutterActor *actor,
|
||||
return;
|
||||
}
|
||||
|
||||
dev = clutter_get_input_device_for_id (id_);
|
||||
manager = clutter_device_manager_get_default ();
|
||||
dev = clutter_device_manager_get_device (manager, id_);
|
||||
if (dev == NULL)
|
||||
return;
|
||||
|
||||
@ -2910,7 +2912,13 @@ clutter_ungrab_pointer (void)
|
||||
void
|
||||
clutter_ungrab_pointer_for_device (gint id_)
|
||||
{
|
||||
clutter_grab_pointer_for_device (NULL, id_);
|
||||
ClutterDeviceManager *manager;
|
||||
ClutterInputDevice *device;
|
||||
|
||||
manager = clutter_device_manager_get_default ();
|
||||
device = clutter_device_manager_get_device (manager, id_);
|
||||
if (device != NULL)
|
||||
clutter_input_device_ungrab (device);
|
||||
}
|
||||
|
||||
|
||||
@ -3061,29 +3069,47 @@ clutter_set_font_flags (ClutterFontFlags flags)
|
||||
ClutterFontFlags old_flags, changed_flags;
|
||||
const cairo_font_options_t *font_options;
|
||||
cairo_font_options_t *new_font_options;
|
||||
cairo_hint_style_t hint_style;
|
||||
gboolean use_mipmapping;
|
||||
ClutterBackend *backend;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
|
||||
font_map = clutter_context_get_pango_fontmap ();
|
||||
use_mipmapping = (flags & CLUTTER_FONT_MIPMAPPING) != 0;
|
||||
cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
|
||||
|
||||
old_flags = clutter_get_font_flags ();
|
||||
|
||||
font_options = clutter_backend_get_font_options (backend);
|
||||
old_flags = 0;
|
||||
|
||||
if (cogl_pango_font_map_get_use_mipmapping (font_map))
|
||||
old_flags |= CLUTTER_FONT_MIPMAPPING;
|
||||
|
||||
hint_style = cairo_font_options_get_hint_style (font_options);
|
||||
if (hint_style != CAIRO_HINT_STYLE_DEFAULT &&
|
||||
hint_style != CAIRO_HINT_STYLE_NONE)
|
||||
old_flags |= CLUTTER_FONT_HINTING;
|
||||
|
||||
if (old_flags == flags)
|
||||
return;
|
||||
|
||||
new_font_options = cairo_font_options_copy (font_options);
|
||||
|
||||
/* Only set the font options that have actually changed so we don't
|
||||
override a detailed setting from the backend */
|
||||
changed_flags = old_flags ^ flags;
|
||||
|
||||
if ((changed_flags & CLUTTER_FONT_MIPMAPPING))
|
||||
{
|
||||
use_mipmapping = (changed_flags & CLUTTER_FONT_MIPMAPPING) != 0;
|
||||
|
||||
cogl_pango_font_map_set_use_mipmapping (font_map, use_mipmapping);
|
||||
}
|
||||
|
||||
if ((changed_flags & CLUTTER_FONT_HINTING))
|
||||
cairo_font_options_set_hint_style (new_font_options,
|
||||
(flags & CLUTTER_FONT_HINTING)
|
||||
? CAIRO_HINT_STYLE_FULL
|
||||
: CAIRO_HINT_STYLE_NONE);
|
||||
{
|
||||
hint_style = (flags & CLUTTER_FONT_HINTING)
|
||||
? CAIRO_HINT_STYLE_FULL
|
||||
: CAIRO_HINT_STYLE_NONE;
|
||||
|
||||
cairo_font_options_set_hint_style (new_font_options, hint_style);
|
||||
}
|
||||
|
||||
clutter_backend_set_font_options (backend, new_font_options);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user