[gnome-builder] sourceview: avoid multiple symbol queries
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] sourceview: avoid multiple symbol queries
- Date: Thu, 14 Jun 2018 09:23:30 +0000 (UTC)
commit ae012050b7a7f0b93191a74c67a56d33f865f414
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 14 02:22:46 2018 -0700
sourceview: avoid multiple symbol queries
We can get a lot of motion events quickly, so we need to avoid doing any
extra work until the previous request finishes. Otherwise, we just spin
our wheels doing a whole lot of nothing.
src/libide/sourceview/ide-source-view.c | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index d40fe60cb..fc186a008 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -168,6 +168,7 @@ typedef struct
guint show_grid_lines : 1;
guint snippet_completion : 1;
guint waiting_for_capture : 1;
+ guint waiting_for_symbol : 1;
} IdeSourceViewPrivate;
typedef struct
@@ -2386,6 +2387,8 @@ ide_source_view_get_definition_on_mouse_over_cb (GObject *object,
priv = ide_source_view_get_instance_private (data->self);
+ priv->waiting_for_symbol = FALSE;
+
symbol = ide_buffer_get_symbol_at_location_finish (buffer, result, &error);
if (symbol == NULL)
@@ -2568,6 +2571,12 @@ ide_source_view_real_motion_notify_event (GtkWidget *widget,
ide_source_view_reset_definition_highlight (self);
}
+ /* Skip work if we're already active */
+ if (priv->waiting_for_symbol)
+ return ret;
+
+ priv->waiting_for_symbol = TRUE;
+
data = g_slice_new0 (DefinitionHighlightData);
data->self = self;
data->word_start_mark = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (priv->buffer),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]