mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
Rename the PangoContext creation functions
The _clutter_context_create_pango_context() should create a new context; the function returning the PangoContext stored inside the MainContext structure should be named _get_pango_context() instead.
This commit is contained in:
parent
33459f63d6
commit
d622a4dd89
@ -424,21 +424,20 @@ clutter_get_text_direction (void)
|
||||
}
|
||||
|
||||
static void
|
||||
update_pango_context (ClutterBackend *backend,
|
||||
ClutterMainContext *main_context)
|
||||
update_pango_context (ClutterBackend *backend,
|
||||
PangoContext *context)
|
||||
{
|
||||
PangoContext *context = main_context->pango_context;
|
||||
PangoFontDescription *font_desc;
|
||||
cairo_font_options_t *font_options;
|
||||
const gchar *font_name;
|
||||
gdouble resolution;
|
||||
|
||||
font_name = clutter_backend_get_font_name (backend);
|
||||
font_options = clutter_backend_get_font_options (backend);
|
||||
resolution = clutter_backend_get_resolution (backend);
|
||||
|
||||
font_desc = pango_font_description_from_string (font_name);
|
||||
|
||||
font_options = clutter_backend_get_font_options (backend);
|
||||
|
||||
resolution = clutter_backend_get_resolution (backend);
|
||||
if (resolution < 0)
|
||||
resolution = 96.0; /* fall back */
|
||||
|
||||
@ -450,26 +449,35 @@ update_pango_context (ClutterBackend *backend,
|
||||
pango_font_description_free (font_desc);
|
||||
}
|
||||
|
||||
PangoContext *
|
||||
_clutter_context_get_pango_context (ClutterMainContext *self)
|
||||
{
|
||||
if (G_LIKELY (self->pango_context))
|
||||
{
|
||||
PangoContext *context;
|
||||
|
||||
context = cogl_pango_font_map_create_context (self->font_map);
|
||||
self->pango_context = context;
|
||||
|
||||
g_signal_connect (self->backend, "resolution-changed",
|
||||
G_CALLBACK (update_pango_context),
|
||||
self->pango_context);
|
||||
g_signal_connect (self->backend, "font-changed",
|
||||
G_CALLBACK (update_pango_context),
|
||||
self->pango_context);
|
||||
}
|
||||
|
||||
update_pango_context (self->backend, self->pango_context);
|
||||
|
||||
return self->pango_context;
|
||||
}
|
||||
|
||||
PangoContext *
|
||||
_clutter_context_create_pango_context (ClutterMainContext *self)
|
||||
{
|
||||
PangoContext *context;
|
||||
|
||||
if (G_LIKELY (self->pango_context != NULL))
|
||||
context = self->pango_context;
|
||||
else
|
||||
{
|
||||
context = cogl_pango_font_map_create_context (self->font_map);
|
||||
self->pango_context = context;
|
||||
}
|
||||
|
||||
g_signal_connect (self->backend, "resolution-changed",
|
||||
G_CALLBACK (update_pango_context),
|
||||
self);
|
||||
g_signal_connect (self->backend, "font-changed",
|
||||
G_CALLBACK (update_pango_context),
|
||||
self);
|
||||
|
||||
context = cogl_pango_font_map_create_context (self->font_map);
|
||||
update_pango_context (self->backend, self);
|
||||
|
||||
return context;
|
||||
|
@ -136,6 +136,7 @@ struct _ClutterMainContext
|
||||
#define CLUTTER_CONTEXT() (clutter_context_get_default ())
|
||||
ClutterMainContext *clutter_context_get_default (void);
|
||||
PangoContext *_clutter_context_create_pango_context (ClutterMainContext *self);
|
||||
PangoContext *_clutter_context_get_pango_context (ClutterMainContext *self);
|
||||
|
||||
#define CLUTTER_PRIVATE_FLAGS(a) (((ClutterActor *) (a))->private_flags)
|
||||
#define CLUTTER_SET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) |= (f))
|
||||
|
Loading…
Reference in New Issue
Block a user