mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix alert when installing an extension
Before this, the alert's parent window was the main window instead of the options window.
This commit is contained in:
parent
5e172d81ee
commit
fdbb3aec59
@ -1644,12 +1644,20 @@ void OptionsCommand::onExecute(Context* context)
|
||||
static int curSection = 0;
|
||||
|
||||
OptionsWindow window(context, curSection);
|
||||
window.openWindow();
|
||||
|
||||
if (!m_installExtensionFilename.empty()) {
|
||||
if (!window.showDialogToInstallExtension(m_installExtensionFilename))
|
||||
return;
|
||||
}
|
||||
// As showDialogToInstallExtension() will show an ui::Alert, we need
|
||||
// to call this function after window.openWindowInForeground(), so
|
||||
// the parent window of the alert will be our OptionsWindow (and not
|
||||
// the main window).
|
||||
window.Open.connect(
|
||||
[&]() {
|
||||
if (!m_installExtensionFilename.empty()) {
|
||||
if (!window.showDialogToInstallExtension(this->m_installExtensionFilename)) {
|
||||
window.closeWindow(&window);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.openWindowInForeground();
|
||||
if (window.ok())
|
||||
|
@ -284,6 +284,12 @@ void Window::onHitTest(HitTestEvent& ev)
|
||||
ev.setHit(ht);
|
||||
}
|
||||
|
||||
void Window::onOpen(Event& ev)
|
||||
{
|
||||
// Fire Open signal
|
||||
Open(ev);
|
||||
}
|
||||
|
||||
void Window::onWindowResize()
|
||||
{
|
||||
// Do nothing
|
||||
@ -366,6 +372,10 @@ void Window::openWindow()
|
||||
{
|
||||
if (!parent()) {
|
||||
Manager::getDefault()->_openWindow(this, m_isAutoRemap);
|
||||
|
||||
// Open event
|
||||
Event ev(this);
|
||||
onOpen(ev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ namespace ui {
|
||||
void loadNativeFrame(const gfx::Rect& frame) { m_lastFrame = frame; }
|
||||
|
||||
// Signals
|
||||
obs::signal<void (Event&)> Open;
|
||||
obs::signal<void (CloseEvent&)> Close;
|
||||
|
||||
protected:
|
||||
@ -87,6 +88,7 @@ namespace ui {
|
||||
virtual void onSetText() override;
|
||||
|
||||
// New events
|
||||
virtual void onOpen(Event& ev);
|
||||
virtual void onClose(CloseEvent& ev);
|
||||
virtual void onHitTest(HitTestEvent& ev);
|
||||
virtual void onWindowResize();
|
||||
|
Loading…
Reference in New Issue
Block a user