sw/inc/AnnotationWin.hxx | 1 + sw/source/uibase/docvw/AnnotationWin2.cxx | 13 +++++++++++++ 2 files changed, 14 insertions(+)
New commits: commit 6c455f66887f980946bd549f38eeb61c32d40f65 Author: Caolán McNamara <[email protected]> AuthorDate: Tue Mar 3 11:58:45 2026 +0000 Commit: Adolfo Jayme Barrientos <[email protected]> CommitDate: Wed Mar 4 12:13:39 2026 +0100 tdf#170645 During a save the comment can lose focus During the save the ui is set disabled/insensitive, and the gtk widget in the comment will lose focus, and not automatically regain it when enabled/sensitive. So manually restore it when enabled and it should still have focus. Change-Id: Icf08d6695cb1d6883636747bb3d70e18f64fb75c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200884 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit 56f2abbf3f107d849305df507818f00e6f6086df) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200926 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index 622cb88f7396..ad6c03e10d75 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -212,6 +212,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow virtual void LoseFocus() override; virtual void GetFocus() override; + virtual void StateChanged(StateChangedType nStateChange) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; void SetSizePixel( const Size& rNewSize ) override; diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index f665c6e9f22a..d10f89b4c05c 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -970,6 +970,19 @@ void SwAnnotationWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rec } } +// tdf#170645 During a save the UI is disabled/insensitive so in GTK the +// widget with focus will lose it, so restore that when enabled/sensitive +void SwAnnotationWin::StateChanged(StateChangedType nStateChange) +{ + InterimItemWindow::StateChanged(nStateChange); + if (nStateChange == StateChangedType::Enable && IsEnabled() + && mrMgr.GetActiveSidebarWin() == this + && mxSidebarTextControl && !mxSidebarTextControl->HasFocus()) + { + mxSidebarTextControl->GrabFocus(); + } +} + void SwAnnotationWin::ShowNote() { SetPosAndSize();
