vcl/source/window/dlgctrl.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit b3267935f5ec1b7376b2040219d3b523c1320a0b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Feb 28 11:12:19 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Feb 28 16:25:40 2022 +0100

    Related: tdf#147667 don't toggle radiobutton on mnemonic if it's not unique
    
    which we already do with checkbuttons, and is what gtk also does when
    this arises
    
    Change-Id: I1b5a4c98bd5062f3a340a53a5d6d977a4af3e384
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130691
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index e9db1eebf5c8..328fcd35ff6a 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -520,9 +520,11 @@ void Window::ImplControlFocus( GetFocusFlags nFlags )
         if (mpWindowImpl->maMnemonicActivateHdl.Call(*this))
             return;
 
+        const bool bUniqueMnemonic(nFlags & GetFocusFlags::UniqueMnemonic);
+
         if ( GetType() == WindowType::RADIOBUTTON )
         {
-            if ( !static_cast<RadioButton*>(this)->IsChecked() )
+            if (bUniqueMnemonic && 
!static_cast<RadioButton*>(this)->IsChecked())
                 static_cast<RadioButton*>(this)->ImplCallClick( true, nFlags );
             else
                 ImplGrabFocus( nFlags );
@@ -530,7 +532,7 @@ void Window::ImplControlFocus( GetFocusFlags nFlags )
         else
         {
             ImplGrabFocus( nFlags );
-            if ( nFlags & GetFocusFlags::UniqueMnemonic )
+            if (bUniqueMnemonic)
             {
                 if ( GetType() == WindowType::CHECKBOX )
                     static_cast<CheckBox*>(this)->ImplCheck();

Reply via email to