diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-30 16:15:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-04-30 21:52:50 +0200 |
commit | 0527539a8d228daadcd30428553bff7d96bf8434 (patch) | |
tree | 84cea031bdea79ab70141ebe28929ec7bd64d8d4 /vcl | |
parent | 25b0f8787946b1627ea6ac0324d871a70cc5d9dd (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.cxx | 7 |
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(); } |