[gnome-builder/editor-layout] block completion if we are not the focused window
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/editor-layout] block completion if we are not the focused window
- Date: Sun, 30 Nov 2014 04:05:04 +0000 (UTC)
commit cf6ba903038621092fdf86bed2caf372152cf119
Author: Christian Hergert <christian hergert me>
Date: Sat Nov 29 20:04:44 2014 -0800
block completion if we are not the focused window
helps with 2 views and a single buffer
src/editor/gb-source-view.c | 45 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-source-view.c b/src/editor/gb-source-view.c
index 67148d8..74d4720 100644
--- a/src/editor/gb-source-view.c
+++ b/src/editor/gb-source-view.c
@@ -1157,6 +1157,8 @@ gb_source_view_notify_buffer (GObject *object,
GTK_SOURCE_COMPLETION_WORDS (priv->words_provider),
GTK_TEXT_BUFFER (buffer));
+ gb_source_view_reload_snippets (view);
+
gb_source_view_connect_settings (view);
}
}
@@ -1667,6 +1669,42 @@ gb_source_view_constructed (GObject *object)
NULL);
}
+static gboolean
+gb_source_view_focus_in_event (GtkWidget *widget,
+ GdkEventFocus *event)
+{
+ GtkSourceCompletion *completion;
+ gboolean ret;
+
+ g_return_if_fail (GB_IS_SOURCE_VIEW (widget));
+ g_return_if_fail (event);
+
+ ret = GTK_WIDGET_CLASS (gb_source_view_parent_class)->focus_in_event (widget, event);
+
+ completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (widget));
+ gtk_source_completion_unblock_interactive (completion);
+
+ return ret;
+}
+
+static gboolean
+gb_source_view_focus_out_event (GtkWidget *widget,
+ GdkEventFocus *event)
+{
+ GtkSourceCompletion *completion;
+ gboolean ret;
+
+ g_return_if_fail (GB_IS_SOURCE_VIEW (widget));
+ g_return_if_fail (event);
+
+ ret = GTK_WIDGET_CLASS (gb_source_view_parent_class)->focus_out_event (widget, event);
+
+ completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (widget));
+ gtk_source_completion_block_interactive (completion);
+
+ return ret;
+}
+
static void
gb_source_view_finalize (GObject *object)
{
@@ -1780,6 +1818,8 @@ gb_source_view_class_init (GbSourceViewClass *klass)
object_class->get_property = gb_source_view_get_property;
object_class->set_property = gb_source_view_set_property;
+ widget_class->focus_in_event = gb_source_view_focus_in_event;
+ widget_class->focus_out_event = gb_source_view_focus_out_event;
widget_class->grab_focus = gb_source_view_grab_focus;
widget_class->key_press_event = gb_source_view_key_press_event;
@@ -1892,6 +1932,8 @@ gb_source_view_class_init (GbSourceViewClass *klass)
static void
gb_source_view_init (GbSourceView *view)
{
+ GtkSourceCompletion *completion;
+
view->priv = gb_source_view_get_instance_private (view);
view->priv->snippets = g_queue_new ();
@@ -1915,4 +1957,7 @@ gb_source_view_init (GbSourceView *view)
"enabled", FALSE,
"text-view", view,
NULL);
+
+ completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (view));
+ gtk_source_completion_block_interactive (completion);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]