mirror of
https://github.com/brl/mutter.git
synced 2025-02-18 06:04:10 +00:00
text: Unify conditions for visible cursor
We have a bunch of similar checks in various places, and they should all be coalesced into one.
This commit is contained in:
parent
3b6ed43edd
commit
388fe9b542
@ -314,9 +314,9 @@ clutter_text_should_draw_cursor (ClutterText *self)
|
|||||||
{
|
{
|
||||||
ClutterTextPrivate *priv = self->priv;
|
ClutterTextPrivate *priv = self->priv;
|
||||||
|
|
||||||
return priv->editable ||
|
return (priv->editable || priv->selectable) &&
|
||||||
priv->selectable ||
|
priv->cursor_visible &&
|
||||||
priv->cursor_visible;
|
priv->has_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define clutter_actor_queue_redraw \
|
#define clutter_actor_queue_redraw \
|
||||||
@ -1614,9 +1614,6 @@ selection_paint (ClutterText *self)
|
|||||||
guint8 paint_opacity = clutter_actor_get_paint_opacity (actor);
|
guint8 paint_opacity = clutter_actor_get_paint_opacity (actor);
|
||||||
const ClutterColor *color;
|
const ClutterColor *color;
|
||||||
|
|
||||||
if (!priv->has_focus)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!clutter_text_should_draw_cursor (self))
|
if (!clutter_text_should_draw_cursor (self))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2306,7 +2303,7 @@ clutter_text_paint (ClutterActor *self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((priv->editable || priv->selectable) && priv->cursor_visible)
|
if (clutter_text_should_draw_cursor (text))
|
||||||
clutter_text_ensure_cursor_position (text);
|
clutter_text_ensure_cursor_position (text);
|
||||||
|
|
||||||
if (priv->editable && priv->single_line_mode)
|
if (priv->editable && priv->single_line_mode)
|
||||||
@ -2499,14 +2496,11 @@ clutter_text_get_paint_volume (ClutterActor *self,
|
|||||||
|
|
||||||
/* If the cursor is visible then that will likely be drawn
|
/* If the cursor is visible then that will likely be drawn
|
||||||
outside of the ink rectangle so we should merge that in */
|
outside of the ink rectangle so we should merge that in */
|
||||||
if ((priv->editable || priv->selectable) &&
|
if (clutter_text_should_draw_cursor (text))
|
||||||
priv->cursor_visible &&
|
|
||||||
priv->has_focus)
|
|
||||||
{
|
{
|
||||||
ClutterPaintVolume cursor_paint_volume;
|
ClutterPaintVolume cursor_paint_volume;
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (&cursor_paint_volume,
|
_clutter_paint_volume_init_static (&cursor_paint_volume, self);
|
||||||
self);
|
|
||||||
|
|
||||||
clutter_text_get_paint_volume_for_cursor (text, &cursor_paint_volume);
|
clutter_text_get_paint_volume_for_cursor (text, &cursor_paint_volume);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user