clutter: Stop using Settings.get_default
Instead, get it from the context. See next commit For ClutterText, we had to switch to using constructed as the ClutterContext will be set for the ClutterActor in the constructor phase Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
This commit is contained in:
parent
8a71c89442
commit
8013049130
@ -13034,7 +13034,7 @@ update_pango_context (ClutterBackend *backend,
|
|||||||
gchar *font_name;
|
gchar *font_name;
|
||||||
gdouble resolution;
|
gdouble resolution;
|
||||||
|
|
||||||
settings = clutter_settings_get_default ();
|
settings = clutter_context_get_settings (backend->context);
|
||||||
|
|
||||||
/* update the text direction */
|
/* update the text direction */
|
||||||
dir = clutter_get_default_text_direction ();
|
dir = clutter_get_default_text_direction ();
|
||||||
|
@ -139,12 +139,11 @@ clutter_backend_set_property (GObject *object,
|
|||||||
static void
|
static void
|
||||||
clutter_backend_real_resolution_changed (ClutterBackend *backend)
|
clutter_backend_real_resolution_changed (ClutterBackend *backend)
|
||||||
{
|
{
|
||||||
ClutterContext *context;
|
ClutterContext *context = backend->context;
|
||||||
ClutterSettings *settings;
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
gdouble resolution;
|
gdouble resolution;
|
||||||
gint dpi;
|
gint dpi;
|
||||||
|
|
||||||
settings = clutter_settings_get_default ();
|
|
||||||
g_object_get (settings, "font-dpi", &dpi, NULL);
|
g_object_get (settings, "font-dpi", &dpi, NULL);
|
||||||
|
|
||||||
if (dpi < 0)
|
if (dpi < 0)
|
||||||
@ -152,7 +151,6 @@ clutter_backend_real_resolution_changed (ClutterBackend *backend)
|
|||||||
else
|
else
|
||||||
resolution = dpi / 1024.0;
|
resolution = dpi / 1024.0;
|
||||||
|
|
||||||
context = _clutter_context_get_default ();
|
|
||||||
if (context->font_map != NULL)
|
if (context->font_map != NULL)
|
||||||
cogl_pango_font_map_set_resolution (context->font_map, resolution);
|
cogl_pango_font_map_set_resolution (context->font_map, resolution);
|
||||||
}
|
}
|
||||||
@ -441,7 +439,7 @@ clutter_backend_get_resolution (ClutterBackend *backend)
|
|||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), -1.0);
|
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), -1.0);
|
||||||
|
|
||||||
settings = clutter_settings_get_default ();
|
settings = clutter_context_get_settings (backend->context);
|
||||||
g_object_get (settings, "font-dpi", &resolution, NULL);
|
g_object_get (settings, "font-dpi", &resolution, NULL);
|
||||||
|
|
||||||
if (resolution < 0)
|
if (resolution < 0)
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterClickAction:
|
* ClutterClickAction:
|
||||||
*
|
*
|
||||||
* Action for clickable actors
|
* Action for clickable actors
|
||||||
*
|
*
|
||||||
* #ClutterClickAction is a sub-class of [class@Action] that implements
|
* #ClutterClickAction is a sub-class of [class@Action] that implements
|
||||||
@ -204,13 +204,15 @@ click_action_query_long_press (ClutterClickAction *action)
|
|||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv =
|
ClutterClickActionPrivate *priv =
|
||||||
clutter_click_action_get_instance_private (action);
|
clutter_click_action_get_instance_private (action);
|
||||||
ClutterActor *actor;
|
ClutterActor *actor =
|
||||||
|
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||||
|
ClutterContext *context = clutter_actor_get_context (actor);
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
gint timeout;
|
gint timeout;
|
||||||
|
|
||||||
if (priv->long_press_duration < 0)
|
if (priv->long_press_duration < 0)
|
||||||
{
|
{
|
||||||
ClutterSettings *settings = clutter_settings_get_default ();
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
|
|
||||||
g_object_get (settings,
|
g_object_get (settings,
|
||||||
"long-press-duration", &timeout,
|
"long-press-duration", &timeout,
|
||||||
@ -219,7 +221,6 @@ click_action_query_long_press (ClutterClickAction *action)
|
|||||||
else
|
else
|
||||||
timeout = priv->long_press_duration;
|
timeout = priv->long_press_duration;
|
||||||
|
|
||||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
|
||||||
|
|
||||||
g_signal_emit (action, click_signals[LONG_PRESS], 0,
|
g_signal_emit (action, click_signals[LONG_PRESS], 0,
|
||||||
actor,
|
actor,
|
||||||
@ -284,6 +285,7 @@ clutter_click_action_handle_event (ClutterAction *action,
|
|||||||
clutter_click_action_get_instance_private (click_action);
|
clutter_click_action_get_instance_private (click_action);
|
||||||
ClutterActor *actor =
|
ClutterActor *actor =
|
||||||
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||||
|
ClutterContext *context = clutter_actor_get_context (actor);
|
||||||
gboolean has_button = TRUE;
|
gboolean has_button = TRUE;
|
||||||
ClutterModifierType modifier_state;
|
ClutterModifierType modifier_state;
|
||||||
ClutterActor *target;
|
ClutterActor *target;
|
||||||
@ -324,7 +326,7 @@ clutter_click_action_handle_event (ClutterAction *action,
|
|||||||
|
|
||||||
if (priv->long_press_threshold < 0)
|
if (priv->long_press_threshold < 0)
|
||||||
{
|
{
|
||||||
ClutterSettings *settings = clutter_settings_get_default ();
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
|
|
||||||
g_object_get (settings,
|
g_object_get (settings,
|
||||||
"dnd-drag-threshold", &priv->drag_threshold,
|
"dnd-drag-threshold", &priv->drag_threshold,
|
||||||
|
@ -271,7 +271,8 @@ static gint
|
|||||||
gesture_get_default_threshold (void)
|
gesture_get_default_threshold (void)
|
||||||
{
|
{
|
||||||
gint threshold;
|
gint threshold;
|
||||||
ClutterSettings *settings = clutter_settings_get_default ();
|
ClutterContext *context = _clutter_context_get_default ();
|
||||||
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
g_object_get (settings, "dnd-drag-threshold", &threshold, NULL);
|
g_object_get (settings, "dnd-drag-threshold", &threshold, NULL);
|
||||||
return threshold;
|
return threshold;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,8 @@ clutter_seat_get_property (GObject *object,
|
|||||||
static void
|
static void
|
||||||
clutter_seat_constructed (GObject *object)
|
clutter_seat_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
ClutterSettings *settings = clutter_settings_get_default ();
|
ClutterContext *context = _clutter_context_get_default ();
|
||||||
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_seat_parent_class)->constructed (object);
|
G_OBJECT_CLASS (clutter_seat_parent_class)->constructed (object);
|
||||||
clutter_settings_ensure_pointer_a11y_settings (settings,
|
clutter_settings_ensure_pointer_a11y_settings (settings,
|
||||||
@ -280,7 +281,7 @@ clutter_seat_class_init (ClutterSeatClass *klass)
|
|||||||
*
|
*
|
||||||
* The signal is emitted when the property to inhibit the unsetting
|
* The signal is emitted when the property to inhibit the unsetting
|
||||||
* of the focus-surface of the #ClutterSeat changed.
|
* of the focus-surface of the #ClutterSeat changed.
|
||||||
*
|
*
|
||||||
* To get the current state of this property, use [method@Seat.is_unfocus_inhibited].
|
* To get the current state of this property, use [method@Seat.is_unfocus_inhibited].
|
||||||
*/
|
*/
|
||||||
signals[IS_UNFOCUS_INHIBITED_CHANGED] =
|
signals[IS_UNFOCUS_INHIBITED_CHANGED] =
|
||||||
|
@ -859,9 +859,8 @@ clutter_text_settings_changed_cb (ClutterText *text)
|
|||||||
{
|
{
|
||||||
ClutterTextPrivate *priv = clutter_text_get_instance_private (text);
|
ClutterTextPrivate *priv = clutter_text_get_instance_private (text);
|
||||||
guint password_hint_time = 0;
|
guint password_hint_time = 0;
|
||||||
ClutterSettings *settings;
|
ClutterContext *context = clutter_actor_get_context (CLUTTER_ACTOR (text));
|
||||||
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
settings = clutter_settings_get_default ();
|
|
||||||
|
|
||||||
g_object_get (settings, "password-hint-time", &password_hint_time, NULL);
|
g_object_get (settings, "password-hint-time", &password_hint_time, NULL);
|
||||||
|
|
||||||
@ -1738,6 +1737,33 @@ clutter_text_get_property (GObject *gobject,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_text_constructed (GObject *gobject)
|
||||||
|
{
|
||||||
|
ClutterText *self = CLUTTER_TEXT (gobject);
|
||||||
|
ClutterTextPrivate *priv = clutter_text_get_instance_private (self);
|
||||||
|
ClutterContext *context = clutter_actor_get_context (CLUTTER_ACTOR (self));
|
||||||
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
|
gchar *font_name;
|
||||||
|
int password_hint_time;
|
||||||
|
|
||||||
|
/* get the default font name from the context; we don't use
|
||||||
|
* set_font_description() here because we are initializing
|
||||||
|
* the Text and we don't need notifications and sanity checks
|
||||||
|
*/
|
||||||
|
g_object_get (settings,
|
||||||
|
"font-name", &font_name,
|
||||||
|
"password-hint-time", &password_hint_time,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
priv->font_name = font_name; /* font_name is allocated */
|
||||||
|
priv->font_desc = pango_font_description_from_string (font_name);
|
||||||
|
priv->show_password_hint = password_hint_time > 0;
|
||||||
|
priv->password_hint_timeout = password_hint_time;
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (clutter_text_parent_class)->constructed (gobject);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_text_dispose (GObject *gobject)
|
clutter_text_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
@ -2220,12 +2246,12 @@ clutter_text_update_click_count (ClutterText *self,
|
|||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterTextPrivate *priv = clutter_text_get_instance_private (self);
|
ClutterTextPrivate *priv = clutter_text_get_instance_private (self);
|
||||||
ClutterSettings *settings;
|
ClutterContext *context = clutter_actor_get_context (CLUTTER_ACTOR (self));
|
||||||
|
ClutterSettings *settings = clutter_context_get_settings (context);
|
||||||
int double_click_time, double_click_distance;
|
int double_click_time, double_click_distance;
|
||||||
uint32_t evtime;
|
uint32_t evtime;
|
||||||
float x, y;
|
float x, y;
|
||||||
|
|
||||||
settings = clutter_settings_get_default ();
|
|
||||||
clutter_event_get_coords (event, &x, &y);
|
clutter_event_get_coords (event, &x, &y);
|
||||||
evtime = clutter_event_get_time (event);
|
evtime = clutter_event_get_time (event);
|
||||||
|
|
||||||
@ -3843,6 +3869,7 @@ clutter_text_class_init (ClutterTextClass *klass)
|
|||||||
|
|
||||||
gobject_class->set_property = clutter_text_set_property;
|
gobject_class->set_property = clutter_text_set_property;
|
||||||
gobject_class->get_property = clutter_text_get_property;
|
gobject_class->get_property = clutter_text_get_property;
|
||||||
|
gobject_class->constructed = clutter_text_constructed;
|
||||||
gobject_class->dispose = clutter_text_dispose;
|
gobject_class->dispose = clutter_text_dispose;
|
||||||
gobject_class->finalize = clutter_text_finalize;
|
gobject_class->finalize = clutter_text_finalize;
|
||||||
|
|
||||||
@ -4455,10 +4482,8 @@ 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;
|
||||||
gchar *font_name;
|
int i;
|
||||||
int i, password_hint_time;
|
|
||||||
|
|
||||||
priv = clutter_text_get_instance_private (self);
|
priv = clutter_text_get_instance_private (self);
|
||||||
|
|
||||||
@ -4484,18 +4509,6 @@ clutter_text_init (ClutterText *self)
|
|||||||
priv->selection_color = default_selection_color;
|
priv->selection_color = default_selection_color;
|
||||||
priv->selected_text_color = default_selected_text_color;
|
priv->selected_text_color = default_selected_text_color;
|
||||||
|
|
||||||
/* get the default font name from the context; we don't use
|
|
||||||
* set_font_description() here because we are initializing
|
|
||||||
* the Text and we don't need notifications and sanity checks
|
|
||||||
*/
|
|
||||||
settings = clutter_settings_get_default ();
|
|
||||||
g_object_get (settings,
|
|
||||||
"font-name", &font_name,
|
|
||||||
"password-hint-time", &password_hint_time,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
priv->font_name = font_name; /* font_name is allocated */
|
|
||||||
priv->font_desc = pango_font_description_from_string (font_name);
|
|
||||||
priv->is_default_font = TRUE;
|
priv->is_default_font = TRUE;
|
||||||
|
|
||||||
priv->position = -1;
|
priv->position = -1;
|
||||||
@ -4512,8 +4525,6 @@ clutter_text_init (ClutterText *self)
|
|||||||
priv->preedit_set = FALSE;
|
priv->preedit_set = FALSE;
|
||||||
|
|
||||||
priv->password_char = 0;
|
priv->password_char = 0;
|
||||||
priv->show_password_hint = password_hint_time > 0;
|
|
||||||
priv->password_hint_timeout = password_hint_time;
|
|
||||||
|
|
||||||
priv->text_y = 0;
|
priv->text_y = 0;
|
||||||
|
|
||||||
@ -5428,7 +5439,10 @@ 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 == NULL || font_name[0] == '\0')
|
if (font_name == NULL || font_name[0] == '\0')
|
||||||
{
|
{
|
||||||
ClutterSettings *settings = clutter_settings_get_default ();
|
ClutterContext *context =
|
||||||
|
clutter_actor_get_context (CLUTTER_ACTOR (self));
|
||||||
|
ClutterSettings *settings =
|
||||||
|
clutter_context_get_settings (context);
|
||||||
gchar *default_font_name = NULL;
|
gchar *default_font_name = NULL;
|
||||||
|
|
||||||
g_object_get (settings, "font-name", &default_font_name, NULL);
|
g_object_get (settings, "font-name", &default_font_name, NULL);
|
||||||
|
@ -164,6 +164,8 @@ meta_settings_get_global_scaling_factor (MetaSettings *settings,
|
|||||||
static gboolean
|
static gboolean
|
||||||
update_font_dpi (MetaSettings *settings)
|
update_font_dpi (MetaSettings *settings)
|
||||||
{
|
{
|
||||||
|
ClutterContext *clutter_context;
|
||||||
|
ClutterSettings *clutter_settings;
|
||||||
double text_scaling_factor;
|
double text_scaling_factor;
|
||||||
/* Number of logical pixels on an inch when unscaled */
|
/* Number of logical pixels on an inch when unscaled */
|
||||||
const double dots_per_inch = 96;
|
const double dots_per_inch = 96;
|
||||||
@ -181,8 +183,10 @@ update_font_dpi (MetaSettings *settings)
|
|||||||
if (font_dpi != settings->font_dpi)
|
if (font_dpi != settings->font_dpi)
|
||||||
{
|
{
|
||||||
settings->font_dpi = font_dpi;
|
settings->font_dpi = font_dpi;
|
||||||
|
clutter_context = meta_backend_get_clutter_context (settings->backend);
|
||||||
|
clutter_settings = clutter_context_get_settings (clutter_context);
|
||||||
|
|
||||||
g_object_set (clutter_settings_get_default (),
|
g_object_set (clutter_settings,
|
||||||
"font-dpi", font_dpi,
|
"font-dpi", font_dpi,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user