From fbbbd83847fa32fc3472e6bcace8a7df2997ffb6 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 25 Jan 2009 18:09:09 -0500 Subject: Fixed bug for SCN_URIDROPPED into an unfocused split view; src/textadept.c --- src/textadept.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/textadept.c b/src/textadept.c index e5975001..00e1d4ff 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -504,11 +504,27 @@ static gbool cec_match_selected(GtkEntryCompletion*, GtkTreeModel *model, return TRUE; } +/** + * Helper function for switching the focused view to the given one. + * @param editor The Scintilla window to focus. + * @see t_notification + * @see t_command + */ +static void switch_view(GtkWidget *editor) { + focused_editor = editor; + l_set_view_global(editor); + l_set_buffer_global(SCINTILLA(editor)); + l_handle_event("view_switch"); +} + /** * Signal for a Scintilla notification. */ -static void t_notification(GtkWidget*, gint, gpointer lParam, gpointer) { - l_handle_scnnotification(reinterpret_cast(lParam)); +static void t_notification(GtkWidget *editor, gint, gpointer lParam, gpointer) { + SCNotification *n = reinterpret_cast(lParam); + if (focused_editor != editor && n->nmhdr.code == SCN_URIDROPPED) + switch_view(editor); + l_handle_scnnotification(n); } /** @@ -516,12 +532,7 @@ static void t_notification(GtkWidget*, gint, gpointer lParam, gpointer) { * Currently handles SCEN_SETFOCUS. */ static void t_command(GtkWidget *editor, gint wParam, gpointer, gpointer) { - if (wParam >> 16 == SCEN_SETFOCUS) { - focused_editor = editor; - l_set_view_global(editor); - l_set_buffer_global(SCINTILLA(editor)); - l_handle_event("view_switch"); - } + if (wParam >> 16 == SCEN_SETFOCUS) switch_view(editor); } /** -- cgit v1.2.3