summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-15 20:16:44 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-02-16 10:07:52 +0100
commite8ffe26c0621e5eaa94bab5d24651e9abd4ea178 (patch)
tree91abf6f4563af692e05d933d9386d894c43a3926 /sfx2/source
parentbdf7c31defeaf91a4f35d3b3d8eba4e5fbe66937 (diff)
tdf#140387 grab focus to first panel widget on panel gaining focus
otherwise focus is getting lost in these currently mixed vcl+gtk widget panels. Change-Id: I6488ddfc98afdedb55bb3217f3877e96258dd65a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110955 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/dialog/templdlg.cxx1
-rw-r--r--sfx2/source/sidebar/PanelLayout.cxx9
2 files changed, 10 insertions, 0 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index c76f06b14bbe..27697a46dbfb 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -369,6 +369,7 @@ SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Wi
, pImpl(new SfxTemplateDialog_Impl(pBindings, this))
{
OSL_ASSERT(pBindings!=nullptr);
+ m_pInitialFocusWidget = pImpl->m_xActionTbL.get();
}
SfxTemplatePanelControl::~SfxTemplatePanelControl()
diff --git a/sfx2/source/sidebar/PanelLayout.cxx b/sfx2/source/sidebar/PanelLayout.cxx
index c419403bdf79..0e37e2278a73 100644
--- a/sfx2/source/sidebar/PanelLayout.cxx
+++ b/sfx2/source/sidebar/PanelLayout.cxx
@@ -18,6 +18,7 @@ using namespace sfx2::sidebar;
PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
const css::uno::Reference<css::frame::XFrame> &rFrame)
: Control(pParent)
+ , m_pInitialFocusWidget(nullptr)
, m_bInClose(false)
, mxFrame(rFrame)
{
@@ -34,6 +35,13 @@ PanelLayout::PanelLayout(vcl::Window* pParent, const OString& rID, const OUStrin
m_xContainer = m_xBuilder->weld_container(rID);
}
+void PanelLayout::GetFocus()
+{
+ Control::GetFocus();
+ if (m_pInitialFocusWidget)
+ m_pInitialFocusWidget->grab_focus();
+}
+
PanelLayout::~PanelLayout()
{
disposeOnce();
@@ -42,6 +50,7 @@ PanelLayout::~PanelLayout()
void PanelLayout::dispose()
{
m_bInClose = true;
+ m_pInitialFocusWidget = nullptr;
m_aPanelLayoutIdle.Stop();
m_xContainer.reset();
m_xBuilder.reset();