summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-03-23 20:34:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-03-23 22:47:11 +0100
commit3a8bf7fdf6c07cfc5df919263676fdece658aada (patch)
treec07416acaada65c8014524454144f6502a753a13
parent876f23915ab39d317207c191f378c53e33059a0d (diff)
ComboBoxes have subwidgets in them, combine together for has_focus
Change-Id: Id57190ebf478641ad2a1ac79ef6a01fbb69af1ed Reviewed-on: https://gerrit.libreoffice.org/69592 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/app/salvtables.cxx9
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx5
2 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index b645b0384ae5..6a27b64f2974 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -667,7 +667,7 @@ void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent)
bool SalInstanceWidget::HandleKeyEventListener(VclWindowEvent& rEvent)
{
// we get all key events here, ignore them unless we have focus
- if (!m_xWidget->HasFocus())
+ if (!has_focus())
return false;
if (rEvent.GetId() == VclEventId::WindowKeyInput)
{
@@ -3849,6 +3849,13 @@ public:
return static_cast<const OUString*>(m_xComboBox->GetEntryData(index));
}
+ // ComboBoxes are comprised of multiple subwidgets, consider the lot as
+ // one thing for focus
+ virtual bool has_focus() const override
+ {
+ return m_xWidget->HasChildPathFocus();
+ }
+
virtual OUString get_active_id() const override
{
sal_Int32 nPos = m_xComboBox->GetSelectedEntryPos();
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e0fda96cafac..18aaf556223d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8369,6 +8369,11 @@ public:
weld::Widget::connect_focus_out(rLink);
}
+ virtual bool has_focus() const override
+ {
+ return gtk_widget_has_focus(m_pToggleButton) || GtkInstanceWidget::has_focus();
+ }
+
virtual ~GtkInstanceComboBox() override
{
if (m_nAutoCompleteIdleId)