diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-19 11:20:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-19 13:57:16 +0200 |
commit | 1f209723cb294559f6f6bbb42d9db7b78a3b5a61 (patch) | |
tree | 3af7666b0d0abf286f0812282c7f43bb08dd4997 /basctl | |
parent | 9c78d8d0a8bd69fc45d845b96bcbc3bdded5f521 (diff) |
Resolves: tdf#114258 defer LoseFocus treeview update
until the next event cycle in cas the LoseFocus is happening due to an
in-progress selection event from a mouse down in the treeview that would be
updated
Change-Id: Ia4448aa798a8af7cd35bc17215891f6c5ca8678a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94494
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 3 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 19 |
2 files changed, 21 insertions, 1 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index f5f3eea544e8..9f69d9e4086b 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -77,10 +77,13 @@ private: long nCurTextWidth; + ImplSVEvent* m_nSetSourceInBasicId; + SyntaxHighlighter aHighlighter; Idle aSyntaxIdle; std::set<sal_uInt16> aSyntaxLineTable; DECL_LINK(SyntaxTimerHdl, Timer *, void); + DECL_LINK(SetSourceInBasicHdl, void*, void); // progress bar class ProgressInfo; diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 2d500c4d2ca4..a3f227f9a0ef 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -233,6 +233,7 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) : Window(pParent, WB_BORDER), rModulWindow(*pModulWindow), nCurTextWidth(0), + m_nSetSourceInBasicId(nullptr), aHighlighter(HighlighterLanguage::Basic), bHighlighting(false), bDoSyntaxHighlight(true), @@ -263,6 +264,12 @@ EditorWindow::~EditorWindow() void EditorWindow::dispose() { + if (m_nSetSourceInBasicId) + { + Application::RemoveUserEvent(m_nSetSourceInBasicId); + m_nSetSourceInBasicId = nullptr; + } + Reference< beans::XMultiPropertySet > n; { osl::MutexGuard g(mutex_); @@ -929,10 +936,20 @@ void EditorWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan void EditorWindow::LoseFocus() { - SetSourceInBasic(); + // tdf#114258 wait until the next event loop cycle to do this so it doesn't + // happen during a mouse down/up selection in the treeview whose contents + // this may update + if (!m_nSetSourceInBasicId) + m_nSetSourceInBasicId = Application::PostUserEvent(LINK(this, EditorWindow, SetSourceInBasicHdl)); Window::LoseFocus(); } +IMPL_LINK_NOARG(EditorWindow, SetSourceInBasicHdl, void*, void) +{ + m_nSetSourceInBasicId = nullptr; + SetSourceInBasic(); +} + void EditorWindow::SetSourceInBasic() { if ( pEditEngine && pEditEngine->IsModified() |