diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index dbea4ade9..cdcb00195 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -2524,6 +2524,21 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event) return fileBrowser->keyPressed(event); } +bool FileCatalog::handleShortcutKeyRelease(GdkEventKey* event) +{ + bool ctrl = event->state & GDK_CONTROL_MASK; + bool alt = event->state & GDK_MOD1_MASK; + + if (!ctrl && !alt) { + switch (event->keyval) { + case GDK_KEY_f: + case GDK_KEY_F: + fileBrowser->getInspector()->hideWindow(); + return true; + } + } +} + void FileCatalog::showToolBar() { if (hbToolBar1STB) { diff --git a/rtgui/filecatalog.h b/rtgui/filecatalog.h index c7c4f3155..23d56af73 100644 --- a/rtgui/filecatalog.h +++ b/rtgui/filecatalog.h @@ -276,6 +276,7 @@ public: void openNextPreviousEditorImage (Glib::ustring fname, bool clearFilters, eRTNav nextPrevious); bool handleShortcutKey (GdkEventKey* event); + bool handleShortcutKeyRelease(GdkEventKey *event); bool CheckSidePanelsVisibility(); void toggleSidePanels(); diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index a09a82597..974482f41 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -412,6 +412,15 @@ bool FilePanel::handleShortcutKey (GdkEventKey* event) return false; } +bool FilePanel::handleShortcutKeyRelease(GdkEventKey *event) +{ + if(fileCatalog->handleShortcutKeyRelease(event)) { + return true; + } + + return false; +} + void FilePanel::loadingThumbs(Glib::ustring str, double rate) { GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected diff --git a/rtgui/filepanel.h b/rtgui/filepanel.h index 65e1ea548..ba5dfa7c9 100644 --- a/rtgui/filepanel.h +++ b/rtgui/filepanel.h @@ -81,6 +81,7 @@ public: bool imageLoaded( Thumbnail* thm, ProgressConnector * ); bool handleShortcutKey (GdkEventKey* event); + bool handleShortcutKeyRelease(GdkEventKey *event); void updateTPVScrollbar (bool hide); private: diff --git a/rtgui/inspector.cc b/rtgui/inspector.cc index 711a96615..7ca0b92d0 100644 --- a/rtgui/inspector.cc +++ b/rtgui/inspector.cc @@ -144,6 +144,11 @@ void Inspector::showWindow(bool scaled, bool fullscreen) mouseMove(next_image_pos, 0); } +void Inspector::hideWindow() +{ + window->set_visible(false); +} + bool Inspector::on_key_release(GdkEventKey *event) { if (!window) diff --git a/rtgui/inspector.h b/rtgui/inspector.h index 726bc947c..52c95d14c 100644 --- a/rtgui/inspector.h +++ b/rtgui/inspector.h @@ -91,6 +91,11 @@ public: */ void showWindow(bool scaled, bool fullscreen = true); + /** + * Hide the window. + */ + void hideWindow(); + /** @brief Mouse movement to a new position * @param pos Location of the mouse, in percentage (i.e. [0;1] range) relative to the full size image ; -1,-1 == out of the image * @param transform H/V flip and coarse rotation transformation diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index c0042f949..cf77374ce 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -285,6 +285,7 @@ RTWindow::RTWindow () property_destroy_with_parent().set_value (false); signal_window_state_event().connect ( sigc::mem_fun (*this, &RTWindow::on_window_state_event) ); signal_key_press_event().connect ( sigc::mem_fun (*this, &RTWindow::keyPressed) ); + signal_key_release_event().connect(sigc::mem_fun(*this, &RTWindow::keyReleased)); if (simpleEditor) { epanel = Gtk::manage ( new EditorPanel (nullptr) ); @@ -756,6 +757,14 @@ bool RTWindow::keyPressed (GdkEventKey* event) return false; } +bool RTWindow::keyReleased(GdkEventKey *event) +{ + if (mainNB->get_current_page() == mainNB->page_num(*fpanel)) { + return fpanel->handleShortcutKeyRelease(event); + } + return false; +} + void RTWindow::addBatchQueueJob (BatchQueueEntry* bqe, bool head) { diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index e5e180747..aa1830d89 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -85,6 +85,7 @@ public: void addBatchQueueJobs (const std::vector& entries); bool keyPressed (GdkEventKey* event); + bool keyReleased(GdkEventKey *event); bool on_configure_event (GdkEventConfigure* event) override; bool on_delete_event (GdkEventAny* event) override; bool on_window_state_event (GdkEventWindowState* event) override;