[gtksourceview/wip/chergert/gsv-gtk4] completion: speed up some no-change scenarios



commit 5ed3592a05a01ede8d06dbe4528da70cc0b851e9
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 10 18:40:08 2020 -0700

    completion: speed up some no-change scenarios
    
    If we can detect no changes, then try to avoid all the resizing.

 gtksourceview/gtksourcecompletioncell.c    | 16 +++++++++++++---
 gtksourceview/gtksourcecompletionlistbox.c |  9 +--------
 2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletioncell.c b/gtksourceview/gtksourcecompletioncell.c
index 96b3e820..1db71e82 100644
--- a/gtksourceview/gtksourcecompletioncell.c
+++ b/gtksourceview/gtksourcecompletioncell.c
@@ -258,8 +258,15 @@ gtk_source_completion_cell_set_text (GtkSourceCompletionCell *self,
                gtk_source_completion_cell_set_widget (self, child);
        }
 
-       gtk_label_set_use_markup (GTK_LABEL (self->child), FALSE);
-       gtk_label_set_text (GTK_LABEL (self->child), text);
+       if (gtk_label_get_use_markup (GTK_LABEL (self->child)))
+       {
+               gtk_label_set_use_markup (GTK_LABEL (self->child), FALSE);
+       }
+
+       if (g_strcmp0 (gtk_label_get_label (GTK_LABEL (self->child)), text) != 0)
+       {
+               gtk_label_set_label (GTK_LABEL (self->child), text);
+       }
 }
 
 void
@@ -414,7 +421,10 @@ gtk_source_completion_cell_set_icon_name (GtkSourceCompletionCell *self,
                gtk_source_completion_cell_set_widget (self, image);
        }
 
-       gtk_image_set_from_icon_name (GTK_IMAGE (self->child), icon_name);
+       if (g_strcmp0 (icon_name, gtk_image_get_icon_name (GTK_IMAGE (self->child))) != 0)
+       {
+               gtk_image_set_from_icon_name (GTK_IMAGE (self->child), icon_name);
+       }
 }
 
 void
diff --git a/gtksourceview/gtksourcecompletionlistbox.c b/gtksourceview/gtksourcecompletionlistbox.c
index c0979739..f831ed45 100644
--- a/gtksourceview/gtksourcecompletionlistbox.c
+++ b/gtksourceview/gtksourcecompletionlistbox.c
@@ -867,14 +867,7 @@ gtk_source_completion_list_box_do_update (GtkSourceCompletionListBox *self,
                                                                     self->show_icons,
                                                                     has_alternates);
 
-                       if (gtk_widget_get_visible (iter))
-                       {
-                               gtk_widget_queue_resize (iter);
-                       }
-                       else
-                       {
-                               gtk_widget_show (iter);
-                       }
+                       gtk_widget_show (iter);
                }
                else
                {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]