Make inspector window size consistent

This commit is contained in:
Lawrence Lee 2021-05-08 11:15:41 -07:00
parent b2988ddbb3
commit 36cb32b31b
4 changed files with 21 additions and 11 deletions

View File

@ -2100,5 +2100,5 @@ void FileBrowser::openRequested( std::vector<FileBrowserEntry*> mselected)
void FileBrowser::inspectRequested(std::vector<FileBrowserEntry*> mselected) void FileBrowser::inspectRequested(std::vector<FileBrowserEntry*> mselected)
{ {
getInspector()->showWindow(false, false, true); getInspector()->showWindow(true);
} }

View File

@ -2515,10 +2515,10 @@ bool FileCatalog::handleShortcutKey (GdkEventKey* event)
if (!ctrl && !alt) { if (!ctrl && !alt) {
switch (event->keyval) { switch (event->keyval) {
case GDK_KEY_f: case GDK_KEY_f:
fileBrowser->getInspector()->showWindow(true); fileBrowser->getInspector()->showWindow(false, true);
return true; return true;
case GDK_KEY_F: case GDK_KEY_F:
fileBrowser->getInspector()->showWindow(false); fileBrowser->getInspector()->showWindow(false, false);
return true; return true;
} }
} }

View File

@ -83,7 +83,7 @@ InspectorBuffer::~InspectorBuffer() {
// return deg; // return deg;
//} //}
Inspector::Inspector () : currImage(nullptr), scaled(false), scale(1.0), zoomScale(1.0), zoomScaleBegin(1.0), active(false), pinned(false), dirty(false), keyDown(false), windowShowing(false) Inspector::Inspector () : currImage(nullptr), scaled(false), scale(1.0), zoomScale(1.0), zoomScaleBegin(1.0), active(false), pinned(false), dirty(false), fullscreen(true), keyDown(false), windowShowing(false)
{ {
set_name("Inspector"); set_name("Inspector");
@ -99,6 +99,7 @@ Inspector::Inspector () : currImage(nullptr), scaled(false), scale(1.0), zoomSca
window->signal_key_release_event().connect(sigc::mem_fun(*this, &Inspector::on_key_release)); window->signal_key_release_event().connect(sigc::mem_fun(*this, &Inspector::on_key_release));
window->signal_key_press_event().connect(sigc::mem_fun(*this, &Inspector::on_key_press)); window->signal_key_press_event().connect(sigc::mem_fun(*this, &Inspector::on_key_press));
window->signal_hide().connect(sigc::mem_fun(*this, &Inspector::on_window_hide)); window->signal_hide().connect(sigc::mem_fun(*this, &Inspector::on_window_hide));
window->signal_window_state_event().connect(sigc::mem_fun(*this, &Inspector::on_inspector_window_state_event));
add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_MOTION_MASK | Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK); add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_MOTION_MASK | Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK);
gestureZoom = Gtk::GestureZoom::create(*this); gestureZoom = Gtk::GestureZoom::create(*this);
@ -107,6 +108,7 @@ Inspector::Inspector () : currImage(nullptr), scaled(false), scale(1.0), zoomSca
window->add(*this); window->add(*this);
window->set_size_request(500, 500); window->set_size_request(500, 500);
window->fullscreen();
initialized = false; // delay init to avoid flickering on some systems initialized = false; // delay init to avoid flickering on some systems
active = true; // always track inspected thumbnails active = true; // always track inspected thumbnails
} }
@ -119,7 +121,7 @@ Inspector::~Inspector()
delete window; delete window;
} }
void Inspector::showWindow(bool scaled, bool fullscreen, bool pinned) void Inspector::showWindow(bool pinned, bool scaled)
{ {
if (!window || windowShowing) if (!window || windowShowing)
return; return;
@ -132,11 +134,6 @@ void Inspector::showWindow(bool scaled, bool fullscreen, bool pinned)
// show inspector window // show inspector window
this->scaled = scaled; this->scaled = scaled;
if (fullscreen)
window->fullscreen();
else
window->unfullscreen();
this->fullscreen = fullscreen;
window->set_visible(true); window->set_visible(true);
this->pinned = pinned; this->pinned = pinned;
windowShowing = true; windowShowing = true;
@ -225,6 +222,17 @@ void Inspector::on_window_hide()
windowShowing = false; windowShowing = false;
} }
bool Inspector::on_inspector_window_state_event(GdkEventWindowState *event)
{
if (!window->get_window() || window->get_window()->gobj() != event->window) {
return false;
}
fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
return true;
}
bool Inspector::on_button_press_event(GdkEventButton *event) bool Inspector::on_button_press_event(GdkEventButton *event)
{ {
if (!window) if (!window)

View File

@ -67,6 +67,7 @@ private:
bool on_key_press(GdkEventKey *event); bool on_key_press(GdkEventKey *event);
void on_window_hide(); void on_window_hide();
bool on_inspector_window_state_event(GdkEventWindowState *event);
rtengine::Coord button_pos; rtengine::Coord button_pos;
bool on_button_press_event(GdkEventButton *event) override; bool on_button_press_event(GdkEventButton *event) override;
@ -90,9 +91,10 @@ public:
~Inspector() override; ~Inspector() override;
/** @brief Show or hide window /** @brief Show or hide window
* @param pinned pin window
* @param scaled fit image into window * @param scaled fit image into window
*/ */
void showWindow(bool scaled, bool fullscreen = true, bool pinned = false); void showWindow(bool pinned, bool scaled = true);
/** /**
* Hide the window. * Hide the window.