fix crash on OS X el capitan when using command line arguments
[ardour.git] / gtk2_ardour / audio_clock.cc
index 7cdf66123dc7f309b34b5a20e22fa953c2aa14ec..ed81b6db2102d3cf40edd773c88a58a53cf09d89 100644 (file)
 #include "ardour/tempo.h"
 #include "ardour/types.h"
 
+#include "ardour_ui.h"
 #include "audio_clock.h"
-#include "utils.h"
-#include "keyboard.h"
 #include "gui_thread.h"
+#include "keyboard.h"
 #include "ui_config.h"
-#include "i18n.h"
+#include "utils.h"
+
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
@@ -709,15 +711,8 @@ AudioClock::drop_focus ()
        Keyboard::magic_widget_drop_focus ();
 
        if (has_focus()) {
-
                /* move focus back to the default widget in the top level window */
-
-               Widget* top = get_toplevel();
-
-               if (top->is_toplevel ()) {
-                       Window* win = dynamic_cast<Window*> (top);
-                       win->grab_focus ();
-               }
+               ARDOUR_UI::instance()->reset_focus (this);
        }
 }
 
@@ -1258,12 +1253,12 @@ AudioClock::set_bbt (framepos_t when, bool /*force*/)
                        BBT.beats = 0;
                        BBT.ticks = 0;
                } else {
-                       _session->tempo_map().bbt_time (when, BBT);
+                       BBT = _session->tempo_map().bbt_at_frame (when);
                        BBT.bars--;
                        BBT.beats--;
                }
        } else {
-               _session->tempo_map().bbt_time (when, BBT);
+               BBT = _session->tempo_map().bbt_at_frame (when);
        }
 
        if (negative) {