Try another way of fixing accelerators stealing text control arrow keys (#1263).
[dcpomatic.git] / src / tools / dcpomatic.cc
index 0fffe6cfc4aa195f062483cf4144103e1ae53173..4f034b2b5a3d013c699b01f560cb26ee0c2cefb6 100644 (file)
@@ -44,6 +44,7 @@
 #include "wx/nag_dialog.h"
 #include "wx/export_dialog.h"
 #include "wx/paste_dialog.h"
+#include "wx/focus_manager.h"
 #include "lib/film.h"
 #include "lib/config.h"
 #include "lib/util.h"
@@ -331,6 +332,15 @@ public:
 
                overall_panel->SetSizer (main_sizer);
 
+               UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this));
+
+               FocusManager::instance()->SetFocus.connect (boost::bind (&DOMFrame::remove_accelerators, this));
+               FocusManager::instance()->KillFocus.connect (boost::bind (&DOMFrame::add_accelerators, this));
+               add_accelerators ();
+       }
+
+       void add_accelerators ()
+       {
 #ifdef __WXOSX__
                int accelerators = 7;
 #else
@@ -355,8 +365,11 @@ public:
                wxAcceleratorTable accel_table (accelerators, accel);
                SetAcceleratorTable (accel_table);
                delete[] accel;
+       }
 
-               UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this));
+       void remove_accelerators ()
+       {
+               SetAcceleratorTable (wxAcceleratorTable ());
        }
 
        void remove_clicked (wxCommandEvent& ev)