summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-09-16 12:46:39 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-09-16 12:46:39 -0400
commit4e411dfd7bab6793426979fe005faf2435c0df0d (patch)
tree214f036f5d898a1a21805aee7a6063c47f5cfa14 /gtk2_ardour
parent9204b2837ebbaa771d318cadf5cb2ea4d35e9fef (diff)
set the CairoWidget focus handler; reset focus when the mouse pointer leaves the Editor window
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index cfbbf6de03..425341e41a 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -484,6 +484,8 @@ Editor::Editor ()
initialize_canvas ();
+ CairoWidget::set_focus_handler (sigc::mem_fun (*this, &Editor::reset_focus));
+
_summary = new EditorSummary (this);
selection->TimeChanged.connect (sigc::mem_fun(*this, &Editor::time_selection_changed));
@@ -1149,9 +1151,28 @@ Editor::generic_event_handler (GdkEvent* ev)
case GDK_KEY_RELEASE:
gettimeofday (&last_event_time, 0);
break;
+
+ case GDK_LEAVE_NOTIFY:
+ switch (ev->crossing.detail) {
+ case GDK_NOTIFY_UNKNOWN:
+ case GDK_NOTIFY_INFERIOR:
+ case GDK_NOTIFY_ANCESTOR:
+ break;
+ case GDK_NOTIFY_VIRTUAL:
+ case GDK_NOTIFY_NONLINEAR:
+ case GDK_NOTIFY_NONLINEAR_VIRTUAL:
+ /* leaving window, so reset focus, thus ending any and
+ all text entry operations.
+ */
+ reset_focus();
+ break;
+ }
+ break;
+
default:
break;
}
+
return false;
}