[gnome-builder] vim: clear in_ctrl_w on focus out
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vim: clear in_ctrl_w on focus out
- Date: Wed, 21 Jan 2015 07:34:13 +0000 (UTC)
commit 9159e7f986e9957c044bb3206c717dc7df2d7d69
Author: Christian Hergert <christian hergert me>
Date: Tue Jan 20 23:27:13 2015 -0800
vim: clear in_ctrl_w on focus out
This way if you press ^w and then focus with the mouse, we don't leave
ourselves in that intermediate state.
src/vim/gb-source-vim.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/vim/gb-source-vim.c b/src/vim/gb-source-vim.c
index 77d82c7..e619719 100644
--- a/src/vim/gb-source-vim.c
+++ b/src/vim/gb-source-vim.c
@@ -85,6 +85,7 @@ struct _GbSourceVimPrivate
gulong event_after_handler;
gulong key_release_event_handler;
gulong focus_in_event_handler;
+ gulong focus_out_event_handler;
gulong mark_set_handler;
gulong delete_range_handler;
guint target_line_offset;
@@ -3365,6 +3366,20 @@ gb_source_vim_focus_in_event_cb (GtkTextView *text_view,
return FALSE;
}
+static gboolean
+gb_source_vim_focus_out_event_cb (GtkTextView *text_view,
+ GdkEvent *event,
+ GbSourceVim *vim)
+{
+ g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
+ g_return_val_if_fail (event, FALSE);
+ g_return_val_if_fail (GB_IS_SOURCE_VIM (vim), FALSE);
+
+ vim->priv->in_ctrl_w = FALSE;
+
+ return FALSE;
+}
+
static void
gb_source_vim_maybe_adjust_insert (GbSourceVim *vim)
{
@@ -3555,6 +3570,13 @@ gb_source_vim_connect (GbSourceVim *vim)
vim,
0);
+ vim->priv->focus_out_event_handler =
+ g_signal_connect_object (vim->priv->text_view,
+ "focus-out-event",
+ G_CALLBACK (gb_source_vim_focus_out_event_cb),
+ vim,
+ 0);
+
vim->priv->mark_set_handler =
g_signal_connect_object (buffer,
"mark-set",
@@ -3604,6 +3626,10 @@ gb_source_vim_disconnect (GbSourceVim *vim)
vim->priv->focus_in_event_handler);
vim->priv->focus_in_event_handler = 0;
+ g_signal_handler_disconnect (vim->priv->text_view,
+ vim->priv->focus_out_event_handler);
+ vim->priv->focus_out_event_handler = 0;
+
g_signal_handler_disconnect (gtk_text_view_get_buffer (vim->priv->text_view),
vim->priv->mark_set_handler);
vim->priv->mark_set_handler = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]