diff --git a/src/app/ui/color_button.cpp b/src/app/ui/color_button.cpp index 01c1248ee..869c015fa 100644 --- a/src/app/ui/color_button.cpp +++ b/src/app/ui/color_button.cpp @@ -25,7 +25,6 @@ #include "doc/site.h" #include "doc/sprite.h" #include "gfx/rect_io.h" -#include "ui/size_hint_event.h" #include "ui/ui.h" namespace app { @@ -292,6 +291,7 @@ void ColorButton::openPopup(const bool forcePinned) if (m_window == NULL) { m_window = new ColorPopup(m_options); + m_window->Close.connect(&ColorButton::onWindowClose, this); m_window->ColorChange.connect(&ColorButton::onWindowColorChange, this); } @@ -336,10 +336,13 @@ void ColorButton::openPopup(const bool forcePinned) void ColorButton::closePopup() { - if (m_window) { - m_hiddenPopupBounds = m_window->bounds(); + if (m_window) m_window->closeWindow(nullptr); - } +} + +void ColorButton::onWindowClose(ui::CloseEvent& ev) +{ + m_hiddenPopupBounds = m_window->bounds(); } void ColorButton::onWindowColorChange(const app::Color& color) diff --git a/src/app/ui/color_button.h b/src/app/ui/color_button.h index e0b6c5b88..fa7b2443d 100644 --- a/src/app/ui/color_button.h +++ b/src/app/ui/color_button.h @@ -17,6 +17,7 @@ #include "ui/button.h" namespace ui { + class CloseEvent; class InitThemeEvent; } @@ -60,6 +61,7 @@ namespace app { void onSaveLayout(ui::SaveLayoutEvent& ev) override; private: + void onWindowClose(ui::CloseEvent& ev); void onWindowColorChange(const app::Color& color); void onActiveSiteChange(const Site& site) override; bool canPin() const { return m_options.canPinSelector; }