diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-01-18 11:05:53 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-01-18 11:05:53 -0500 |
commit | ff5d14f1a8064d41c3ee3d94f496994581cfd3a0 (patch) | |
tree | 2c5151576233e28a6c93642d41e353cfe7cb7fcf /gtk/gtktextview.c | |
parent | b08fe985cc375f02c9c385c85f9e3a481ba77b3c (diff) | |
download | gtk+-ff5d14f1a8064d41c3ee3d94f496994581cfd3a0.tar.gz |
text view: Update selection node visibility
Make the node invisible if we don't have a selection.
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r-- | gtk/gtktextview.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 77aa9bde32..8bae967a14 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1751,6 +1751,7 @@ gtk_text_view_init (GtkTextView *text_view) gtk_css_node_set_name (priv->selection_node, I_("selection")); gtk_css_node_set_parent (priv->selection_node, priv->text_window->css_node); gtk_css_node_set_state (priv->selection_node, gtk_css_node_get_state (priv->text_window->css_node)); + gtk_css_node_set_visible (priv->selection_node, FALSE); g_object_unref (priv->selection_node); } @@ -9086,6 +9087,7 @@ gtk_text_view_mark_set_handler (GtkTextBuffer *buffer, { GtkTextView *text_view = GTK_TEXT_VIEW (data); gboolean need_reset = FALSE; + gboolean has_selection; if (mark == gtk_text_buffer_get_insert (buffer)) { @@ -9105,6 +9107,9 @@ gtk_text_view_mark_set_handler (GtkTextBuffer *buffer, if (text_view->priv->text_handle) gtk_text_view_update_handles (text_view, _gtk_text_handle_get_mode (text_view->priv->text_handle)); + + has_selection = gtk_text_buffer_get_selection_bounds (get_buffer (text_view), NULL, NULL); + gtk_css_node_set_visible (text_view->priv->selection_node, has_selection); } } |