mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
text: Dirty layout cache on text direction changes
When the text direction changes we should evict the cached layouts to avoid stale entries in case the direction change produces a layout with the same size.
This commit is contained in:
parent
f94f7692a6
commit
adab87b520
@ -171,6 +171,9 @@ struct _ClutterTextPrivate
|
||||
|
||||
/* Signal handler for when the backend changes its font settings */
|
||||
guint font_changed_id;
|
||||
|
||||
/* Signal handler for when the :text-direction changes */
|
||||
guint direction_changed_id;
|
||||
};
|
||||
|
||||
enum
|
||||
@ -428,6 +431,15 @@ clutter_text_font_changed_cb (ClutterText *text)
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (text));
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_text_direction_changed_cb (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
clutter_text_dirty_cache (CLUTTER_TEXT (gobject));
|
||||
|
||||
/* no need to queue a relayout: set_text_direction() will do that for us */
|
||||
}
|
||||
|
||||
/*
|
||||
* clutter_text_create_layout:
|
||||
* @text: a #ClutterText
|
||||
@ -1098,6 +1110,12 @@ clutter_text_dispose (GObject *gobject)
|
||||
/* get rid of the entire cache */
|
||||
clutter_text_dirty_cache (self);
|
||||
|
||||
if (priv->direction_changed_id)
|
||||
{
|
||||
g_signal_handler_disconnect (self, priv->direction_changed_id);
|
||||
priv->direction_changed_id = 0;
|
||||
}
|
||||
|
||||
if (priv->font_changed_id)
|
||||
{
|
||||
g_signal_handler_disconnect (clutter_get_default_backend (),
|
||||
@ -2722,6 +2740,11 @@ clutter_text_init (ClutterText *self)
|
||||
"font-changed",
|
||||
G_CALLBACK (clutter_text_font_changed_cb),
|
||||
self);
|
||||
|
||||
priv->direction_changed_id =
|
||||
g_signal_connect (self, "notify::text-direction",
|
||||
G_CALLBACK (clutter_text_direction_changed_cb),
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user