summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-30 16:15:33 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-04-30 21:52:50 +0200
commit0527539a8d228daadcd30428553bff7d96bf8434 (patch)
tree84cea031bdea79ab70141ebe28929ec7bd64d8d4 /vcl
parent25b0f8787946b1627ea6ac0324d871a70cc5d9dd (diff)
don't grab focus if we already have focus
for cases like the combobox of tdf#138281 so we don't end up selecting the content if we already had focus Change-Id: I2294b2d17d56e5282d7d84859eb9002ebb3b9ada Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114938 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index f482d4ee7145..e3541057da60 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -271,7 +271,12 @@ void SalInstanceWidget::set_can_focus(bool bCanFocus)
m_xWidget->SetStyle(nStyle);
}
-void SalInstanceWidget::grab_focus() { m_xWidget->GrabFocus(); }
+void SalInstanceWidget::grab_focus()
+{
+ if (has_focus())
+ return;
+ m_xWidget->GrabFocus();
+}
bool SalInstanceWidget::has_focus() const { return m_xWidget->HasFocus(); }