aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-01-25 18:09:09 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-01-25 18:09:09 -0500
commitfbbbd83847fa32fc3472e6bcace8a7df2997ffb6 (patch)
tree203c3e9a9480041dce78471c0b2de3b867cba8f6 /src
parentfc1f891fb32b536317cc1e42c1c288755e27b25e (diff)
downloadtextadept-fbbbd83847fa32fc3472e6bcace8a7df2997ffb6.tar.gz
textadept-fbbbd83847fa32fc3472e6bcace8a7df2997ffb6.zip
Fixed bug for SCN_URIDROPPED into an unfocused split view; src/textadept.c
Diffstat (limited to 'src')
-rw-r--r--src/textadept.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/textadept.c b/src/textadept.c
index e5975001..00e1d4ff 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -505,10 +505,26 @@ static gbool cec_match_selected(GtkEntryCompletion*, GtkTreeModel *model,
}
/**
+ * 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<SCNotification*>(lParam));
+static void t_notification(GtkWidget *editor, gint, gpointer lParam, gpointer) {
+ SCNotification *n = reinterpret_cast<SCNotification*>(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);
}
/**