Avoid reopening inspector window when being opened
This commit is contained in:
@@ -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)
|
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)
|
||||||
{
|
{
|
||||||
set_name("Inspector");
|
set_name("Inspector");
|
||||||
|
|
||||||
@@ -98,6 +98,7 @@ Inspector::Inspector () : currImage(nullptr), scaled(false), scale(1.0), zoomSca
|
|||||||
window->add_events(Gdk::KEY_PRESS_MASK);
|
window->add_events(Gdk::KEY_PRESS_MASK);
|
||||||
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));
|
||||||
|
|
||||||
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);
|
||||||
@@ -120,7 +121,7 @@ Inspector::~Inspector()
|
|||||||
|
|
||||||
void Inspector::showWindow(bool scaled, bool fullscreen, bool pinned)
|
void Inspector::showWindow(bool scaled, bool fullscreen, bool pinned)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window || windowShowing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// initialize when shown first
|
// initialize when shown first
|
||||||
@@ -138,6 +139,7 @@ void Inspector::showWindow(bool scaled, bool fullscreen, bool pinned)
|
|||||||
this->fullscreen = fullscreen;
|
this->fullscreen = fullscreen;
|
||||||
window->set_visible(true);
|
window->set_visible(true);
|
||||||
this->pinned = pinned;
|
this->pinned = pinned;
|
||||||
|
windowShowing = true;
|
||||||
|
|
||||||
// update content when becoming visible
|
// update content when becoming visible
|
||||||
switchImage(next_image_path);
|
switchImage(next_image_path);
|
||||||
@@ -218,6 +220,11 @@ bool Inspector::on_key_press(GdkEventKey *event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Inspector::on_window_hide()
|
||||||
|
{
|
||||||
|
windowShowing = false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Inspector::on_button_press_event(GdkEventButton *event)
|
bool Inspector::on_button_press_event(GdkEventButton *event)
|
||||||
{
|
{
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@@ -56,6 +56,7 @@ private:
|
|||||||
bool initialized;
|
bool initialized;
|
||||||
bool fullscreen; // window is shown in fullscreen mode
|
bool fullscreen; // window is shown in fullscreen mode
|
||||||
bool keyDown;
|
bool keyDown;
|
||||||
|
bool windowShowing;
|
||||||
|
|
||||||
sigc::connection delayconn;
|
sigc::connection delayconn;
|
||||||
Glib::ustring next_image_path;
|
Glib::ustring next_image_path;
|
||||||
@@ -65,6 +66,8 @@ private:
|
|||||||
bool on_key_release(GdkEventKey *event);
|
bool on_key_release(GdkEventKey *event);
|
||||||
bool on_key_press(GdkEventKey *event);
|
bool on_key_press(GdkEventKey *event);
|
||||||
|
|
||||||
|
void on_window_hide();
|
||||||
|
|
||||||
rtengine::Coord button_pos;
|
rtengine::Coord button_pos;
|
||||||
bool on_button_press_event(GdkEventButton *event) override;
|
bool on_button_press_event(GdkEventButton *event) override;
|
||||||
bool on_motion_notify_event(GdkEventMotion *event) override;
|
bool on_motion_notify_event(GdkEventMotion *event) override;
|
||||||
|
Reference in New Issue
Block a user