summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-15 20:16:44 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2021-02-17 10:59:40 +0100
commit97a1d170b5f45c6cf9fc2c56dc4526d0e3f8423a (patch)
treea288c3c26e70e13863bc6d241a22ae4002cb3454 /sfx2
parent640951c1ac64ff0f7ab2c033c9a2f00ccf0363dc (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/+/110956 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'sfx2')
-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 d9577bc852e3..a281f2b5dd46 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -373,6 +373,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();