Update hidden ColorPopup bounds correctly if the window is closed with the close button

This commit is contained in:
David Capello 2017-07-04 14:00:01 -03:00
parent a519822a0e
commit cce73c4a75
2 changed files with 9 additions and 4 deletions

View File

@ -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)

View File

@ -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; }