summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-09 15:07:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-09 16:59:48 +0200
commitebc2bbba2558dd6fe5cb41b453514211d1fb0c1c (patch)
tree6fa27b7225265fd2cf838ecc2afd9d33047a395a
parenta5b00f6e9790b17d47a8573b441ce886f5374014 (diff)
tdf#134688 run error dialog async and keep the events in the one event loop
instead of a sub loop which helps to not lose the mouse release where the dialog was shown on the mouse press Change-Id: If0baf15e85aff7a28ca058e2626b58802d0dad08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98439 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/ui/inc/tabview.hxx2
-rw-r--r--sc/source/ui/view/tabview2.cxx16
2 files changed, 11 insertions, 7 deletions
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 4f2a0aee30c5..b62dfc590115 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -138,6 +138,8 @@ private:
FuPoor* pDrawActual;
FuPoor* pDrawOld;
+ std::shared_ptr<weld::MessageDialog> m_xMessageBox;
+
std::array<VclPtr<ScGridWindow>, 4> pGridWin;
std::array<VclPtr<ScColBar>, 2> pColBar;
std::array<VclPtr<ScRowBar>, 2> pRowBar;
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index bf78bc7f21ee..16d626dc397d 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -1431,13 +1431,15 @@ void ScTabView::ErrorMessage(const char* pGlobStrId)
}
}
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent,
- VclMessageType::Info, VclButtonsType::Ok,
- ScResId(pGlobStrId)));
- xInfoBox->run();
-
- if (bFocus)
- pParent->grab_focus();
+ m_xMessageBox.reset(Application::CreateMessageDialog(pParent,
+ VclMessageType::Info, VclButtonsType::Ok,
+ ScResId(pGlobStrId)));
+ weld::Window* pGrabOnClose = bFocus ? pParent : nullptr;
+ m_xMessageBox->runAsync(m_xMessageBox, [this, pGrabOnClose](sal_Int32 /*nResult*/) {
+ m_xMessageBox.reset();
+ if (pGrabOnClose)
+ pGrabOnClose->grab_focus();
+ });
}
void ScTabView::UpdatePageBreakData( bool bForcePaint )