Do not use deprecated API internally
This commit is contained in:
parent
0bd18fbcc9
commit
d76f64a10c
@ -121,12 +121,18 @@ get_units_per_em (ClutterBackend *backend,
|
|||||||
|
|
||||||
if (font_desc == NULL)
|
if (font_desc == NULL)
|
||||||
{
|
{
|
||||||
const gchar *font_name = clutter_backend_get_font_name (backend);
|
ClutterSettings *settings;
|
||||||
|
gchar *font_name = NULL;
|
||||||
|
|
||||||
|
settings = clutter_settings_get_default ();
|
||||||
|
g_object_get (settings, "font-name", &font_name, NULL);
|
||||||
|
|
||||||
if (G_LIKELY (font_name != NULL && *font_name != '\0'))
|
if (G_LIKELY (font_name != NULL && *font_name != '\0'))
|
||||||
{
|
{
|
||||||
font_desc = pango_font_description_from_string (font_name);
|
font_desc = pango_font_description_from_string (font_name);
|
||||||
free_font_desc = TRUE;
|
free_font_desc = TRUE;
|
||||||
|
|
||||||
|
g_free (font_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,12 +821,15 @@ static void
|
|||||||
update_pango_context (ClutterBackend *backend,
|
update_pango_context (ClutterBackend *backend,
|
||||||
PangoContext *context)
|
PangoContext *context)
|
||||||
{
|
{
|
||||||
|
ClutterSettings *settings;
|
||||||
PangoFontDescription *font_desc;
|
PangoFontDescription *font_desc;
|
||||||
const cairo_font_options_t *font_options;
|
const cairo_font_options_t *font_options;
|
||||||
const gchar *font_name;
|
gchar *font_name;
|
||||||
PangoDirection pango_dir;
|
PangoDirection pango_dir;
|
||||||
gdouble resolution;
|
gdouble resolution;
|
||||||
|
|
||||||
|
settings = clutter_settings_get_default ();
|
||||||
|
|
||||||
/* update the text direction */
|
/* update the text direction */
|
||||||
if (clutter_text_direction == CLUTTER_TEXT_DIRECTION_RTL)
|
if (clutter_text_direction == CLUTTER_TEXT_DIRECTION_RTL)
|
||||||
pango_dir = PANGO_DIRECTION_RTL;
|
pango_dir = PANGO_DIRECTION_RTL;
|
||||||
@ -835,8 +838,9 @@ update_pango_context (ClutterBackend *backend,
|
|||||||
|
|
||||||
pango_context_set_base_dir (context, pango_dir);
|
pango_context_set_base_dir (context, pango_dir);
|
||||||
|
|
||||||
|
g_object_get (settings, "font-name", &font_name, NULL);
|
||||||
|
|
||||||
/* get the configuration for the PangoContext from the backend */
|
/* get the configuration for the PangoContext from the backend */
|
||||||
font_name = clutter_backend_get_font_name (backend);
|
|
||||||
font_options = clutter_backend_get_font_options (backend);
|
font_options = clutter_backend_get_font_options (backend);
|
||||||
resolution = clutter_backend_get_resolution (backend);
|
resolution = clutter_backend_get_resolution (backend);
|
||||||
|
|
||||||
@ -850,6 +854,7 @@ update_pango_context (ClutterBackend *backend,
|
|||||||
pango_cairo_context_set_resolution (context, resolution);
|
pango_cairo_context_set_resolution (context, resolution);
|
||||||
|
|
||||||
pango_font_description_free (font_desc);
|
pango_font_description_free (font_desc);
|
||||||
|
g_free (font_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
PangoContext *
|
PangoContext *
|
||||||
@ -2160,13 +2165,18 @@ event_click_count_generate (ClutterEvent *event)
|
|||||||
static gint previous_button_number = -1;
|
static gint previous_button_number = -1;
|
||||||
|
|
||||||
ClutterInputDevice *device = NULL;
|
ClutterInputDevice *device = NULL;
|
||||||
|
ClutterSettings *settings;
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
guint double_click_time;
|
guint double_click_time;
|
||||||
guint double_click_distance;
|
guint double_click_distance;
|
||||||
|
|
||||||
|
settings = clutter_settings_get_default ();
|
||||||
backend = clutter_get_default_backend ();
|
backend = clutter_get_default_backend ();
|
||||||
double_click_distance = clutter_backend_get_double_click_distance (backend);
|
|
||||||
double_click_time = clutter_backend_get_double_click_time (backend);
|
g_object_get (settings,
|
||||||
|
"double-click-distance", &double_click_distance,
|
||||||
|
"double-click-time", &double_click_time,
|
||||||
|
NULL);
|
||||||
|
|
||||||
device = clutter_event_get_device (event);
|
device = clutter_event_get_device (event);
|
||||||
if (device != NULL)
|
if (device != NULL)
|
||||||
|
@ -495,16 +495,21 @@ clutter_text_font_changed_cb (ClutterText *text)
|
|||||||
{
|
{
|
||||||
if (text->priv->is_default_font)
|
if (text->priv->is_default_font)
|
||||||
{
|
{
|
||||||
const gchar *font_name;
|
|
||||||
PangoFontDescription *font_desc;
|
PangoFontDescription *font_desc;
|
||||||
|
ClutterSettings *settings;
|
||||||
|
gchar *font_name = NULL;
|
||||||
|
|
||||||
|
settings = clutter_settings_get_default ();
|
||||||
|
g_object_get (settings, "font-name", &font_name, NULL);
|
||||||
|
|
||||||
font_name = clutter_backend_get_font_name (clutter_get_default_backend ());
|
|
||||||
CLUTTER_NOTE (ACTOR, "Text[%p]: default font changed to '%s'",
|
CLUTTER_NOTE (ACTOR, "Text[%p]: default font changed to '%s'",
|
||||||
text,
|
text,
|
||||||
font_name);
|
font_name);
|
||||||
|
|
||||||
font_desc = pango_font_description_from_string (font_name);
|
font_desc = pango_font_description_from_string (font_name);
|
||||||
clutter_text_set_font_description_internal (text, font_desc);
|
clutter_text_set_font_description_internal (text, font_desc);
|
||||||
|
|
||||||
|
g_free (font_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_text_dirty_cache (text);
|
clutter_text_dirty_cache (text);
|
||||||
@ -3109,8 +3114,9 @@ clutter_text_class_init (ClutterTextClass *klass)
|
|||||||
static void
|
static void
|
||||||
clutter_text_init (ClutterText *self)
|
clutter_text_init (ClutterText *self)
|
||||||
{
|
{
|
||||||
|
ClutterSettings *settings;
|
||||||
ClutterTextPrivate *priv;
|
ClutterTextPrivate *priv;
|
||||||
const gchar *font_name;
|
gchar *font_name;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
self->priv = priv = CLUTTER_TEXT_GET_PRIVATE (self);
|
self->priv = priv = CLUTTER_TEXT_GET_PRIVATE (self);
|
||||||
@ -3140,8 +3146,10 @@ clutter_text_init (ClutterText *self)
|
|||||||
* set_font_description() here because we are initializing
|
* set_font_description() here because we are initializing
|
||||||
* the Text and we don't need notifications and sanity checks
|
* the Text and we don't need notifications and sanity checks
|
||||||
*/
|
*/
|
||||||
font_name = clutter_backend_get_font_name (clutter_get_default_backend ());
|
settings = clutter_settings_get_default ();
|
||||||
priv->font_name = g_strdup (font_name);
|
g_object_get (settings, "font-name", &font_name, NULL);
|
||||||
|
|
||||||
|
priv->font_name = font_name; /* font_name is allocated */
|
||||||
priv->font_desc = pango_font_description_from_string (font_name);
|
priv->font_desc = pango_font_description_from_string (font_name);
|
||||||
priv->is_default_font = TRUE;
|
priv->is_default_font = TRUE;
|
||||||
|
|
||||||
@ -3846,7 +3854,11 @@ clutter_text_set_font_name (ClutterText *self,
|
|||||||
/* get the default font name from the backend */
|
/* get the default font name from the backend */
|
||||||
if (!font_name || font_name[0] == '\0')
|
if (!font_name || font_name[0] == '\0')
|
||||||
{
|
{
|
||||||
font_name = clutter_backend_get_font_name (clutter_get_default_backend ());
|
ClutterSettings *settings = clutter_settings_get_default ();
|
||||||
|
gchar *default_font_name = NULL;
|
||||||
|
|
||||||
|
g_object_get (settings, "font-name", default_font_name, NULL);
|
||||||
|
font_name = default_font_name;
|
||||||
is_default_font = TRUE;
|
is_default_font = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3855,7 +3867,7 @@ clutter_text_set_font_name (ClutterText *self,
|
|||||||
priv = self->priv;
|
priv = self->priv;
|
||||||
|
|
||||||
if (priv->font_name && strcmp (priv->font_name, font_name) == 0)
|
if (priv->font_name && strcmp (priv->font_name, font_name) == 0)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
desc = pango_font_description_from_string (font_name);
|
desc = pango_font_description_from_string (font_name);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
@ -3863,7 +3875,7 @@ clutter_text_set_font_name (ClutterText *self,
|
|||||||
g_warning ("Attempting to create a PangoFontDescription for "
|
g_warning ("Attempting to create a PangoFontDescription for "
|
||||||
"font name '%s', but failed.",
|
"font name '%s', but failed.",
|
||||||
font_name);
|
font_name);
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this will set the font_name field as well */
|
/* this will set the font_name field as well */
|
||||||
@ -3871,6 +3883,10 @@ clutter_text_set_font_name (ClutterText *self,
|
|||||||
priv->is_default_font = is_default_font;
|
priv->is_default_font = is_default_font;
|
||||||
|
|
||||||
_clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]);
|
_clutter_notify_by_pspec (G_OBJECT (self), obj_props[PROP_FONT_NAME]);
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (is_default_font)
|
||||||
|
g_free ((gchar *) font_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user