aboutsummaryrefslogtreecommitdiff
path: root/src/textadept.c
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-06-16 17:13:03 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-06-16 17:13:03 -0400
commit9a61370b7d739b51228395b304915b2c4cc2e077 (patch)
treecc438ccbc9b0aefc279ffa826dc249d45ba795bd /src/textadept.c
parent8118374dd9aa43f0b11729f596c4cae6af61d097 (diff)
downloadtextadept-9a61370b7d739b51228395b304915b2c4cc2e077.tar.gz
textadept-9a61370b7d739b51228395b304915b2c4cc2e077.zip
Fixed bug for when gui.dialog steals focus; src/textadept.c
Diffstat (limited to 'src/textadept.c')
-rw-r--r--src/textadept.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/textadept.c b/src/textadept.c
index 826eafd7..7e70ce13 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -500,13 +500,14 @@ void set_statusbar_text(const char *text, int bar) {
* @param editor The Scintilla view to focus.
* @see s_notification
* @see s_command
+ * @see l_goto_view
*/
static void switch_to_view(GtkWidget *editor) {
- l_emit_event("view_before_switch", -1);
+ if (!closing) l_emit_event("view_before_switch", -1);
focused_editor = editor;
l_set_view_global(editor);
l_set_buffer_global(editor);
- l_emit_event("view_after_switch", -1);
+ if (!closing) l_emit_event("view_after_switch", -1);
}
/**
@@ -1059,9 +1060,10 @@ void l_goto_view(GtkWidget *editor, int n, int absolute) {
lua_rawgeti(lua, -1, n);
}
editor = l_checkview(lua, -1);
- if (!closing) l_emit_event("view_before_switch", -1);
gtk_widget_grab_focus(editor);
- if (!closing) l_emit_event("view_after_switch", -1);
+ // gui.dialog() interferes with focus so gtk_widget_grab_focus() does not
+ // always work. If this is the case, ensure switch_to_view() is called.
+ if (!gtk_widget_has_focus(editor)) switch_to_view(editor);
lua_pop(lua, 2); // view table and views
}