more transport button caironizing.
[ardour.git] / gtk2_ardour / ardour_window.cc
index 3bc80dfc46ee89a151cbdcf435aa4e9edec0b6ad..f6ced5fb492c7c7067fa0c6be4c97c9697a13a3f 100644 (file)
@@ -58,21 +58,31 @@ ArdourWindow::~ArdourWindow ()
 bool
 ArdourWindow::on_key_press_event (GdkEventKey* ev)
 {
-       return relay_key_press (ev, this);
+       bool handled = Gtk::Window::on_key_press_event (ev);
+
+       if (!handled) {
+               if (!get_modal()) {
+                       handled = relay_key_press (ev, this);
+               }
+       }
+
+       return handled;
 }
 
 bool
-ArdourWindow::on_enter_notify_event (GdkEventCrossing *ev)
+ArdourWindow::on_focus_in_event (GdkEventFocus *ev)
 {
-       Keyboard::the_keyboard().enter_window (ev, this);
-       return Window::on_enter_notify_event (ev);
+       Keyboard::the_keyboard().focus_in_window (ev, this);
+       return Window::on_focus_in_event (ev);
 }
 
 bool
-ArdourWindow::on_leave_notify_event (GdkEventCrossing *ev)
+ArdourWindow::on_focus_out_event (GdkEventFocus *ev)
 {
-       Keyboard::the_keyboard().leave_window (ev, this);
-       return Window::on_leave_notify_event (ev);
+       if (!get_modal()) {
+               Keyboard::the_keyboard().focus_out_window (ev, this);
+       }
+       return Window::on_focus_out_event (ev);
 }
 
 void
@@ -92,8 +102,9 @@ void
 ArdourWindow::init ()
 {
        set_border_width (10);
+       add_events (Gdk::FOCUS_CHANGE_MASK);
 
-        /* ArdourWindows are not dialogs (they have no "OK" or "Close" button) but
+      /* ArdourWindows are not dialogs (they have no "OK" or "Close" button) but
            they should be considered part of the same "window level" as a dialog. This
            works on X11 and Quartz, in that: