Fix "escape" from dual screen mode, on Linux at least (#2183). v2.16.23
authorCarl Hetherington <cth@carlh.net>
Thu, 1 Sep 2022 22:35:30 +0000 (00:35 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 1 Sep 2022 22:36:30 +0000 (00:36 +0200)
This is a bit of a strange solution but the only one that I could make
work; the key seems to be setting focus on the child window of the frame.

src/tools/dcpomatic_player.cc

index 7603b9842ac6b345c416fed863c5e5a7c940c451..043e90b9efd97104557d08d2bf126b0aeec416b7 100644 (file)
@@ -804,6 +804,7 @@ private:
                        _dual_screen->SetBackgroundColour (wxColour(0, 0, 0));
                        _dual_screen->ShowFullScreen (true);
                        _viewer->panel()->Reparent (_dual_screen);
+                       _viewer->panel()->SetFocus();
                        _dual_screen->Show ();
                        if (wxDisplay::GetCount() > 1) {
                                switch (Config::instance()->image_display()) {
@@ -818,6 +819,7 @@ private:
                                        break;
                                }
                        }
+                       _dual_screen->Bind(wxEVT_CHAR_HOOK, boost::bind(&DOMFrame::dual_screen_key_press, this, _1));
                } else {
                        if (_dual_screen) {
                                _viewer->panel()->Reparent (_overall_panel);
@@ -829,6 +831,17 @@ private:
                setup_main_sizer (_mode);
        }
 
+       void dual_screen_key_press(wxKeyEvent& ev)
+       {
+               if (ev.GetKeyCode() == WXK_F11) {
+                       if (ev.ShiftDown()) {
+                               view_dual_screen();
+                       } else if (!ev.HasAnyModifiers()) {
+                               view_full_screen();
+                       }
+               }
+       }
+
        void view_closed_captions ()
        {
                _viewer->show_closed_captions ();