vcl/source/window/dlgctrl.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
New commits: commit ea1421747985bd09ad40565da8536e857b5c2e9a Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Fri Dec 22 09:25:53 2023 +0100 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Sat Dec 23 17:37:02 2023 +0100 tdf#157649 Allow omitting Alt key when focus is in dialog action area Adapt to usual Windows experience: Allow triggering the Ok, Cancel, etc buttons in the dialog action area without pressing the Alt key - when the focus is in that area (and the accelerator is unique in that dialog). Change-Id: I85b544867cf5507a15240b2972a26a1c248c4f82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161146 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index adf416b21769..90cdf353f8c0 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -941,7 +941,7 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) } } } - else if (aKeyCode.IsMod2()) // tdf#151385 + else { sal_Unicode c = rKEvt.GetCharCode(); if ( c ) @@ -952,8 +952,13 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) GetFocusFlags nGetFocusFlags = GetFocusFlags::Mnemonic; if ( pSWindow == ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ) ) nGetFocusFlags |= GetFocusFlags::UniqueMnemonic; - pSWindow->ImplControlFocus( nGetFocusFlags ); - return true; + // tdf#157649 Allow omitting the Alt key when focus is in the dialog action area: + bool bIsButtonBox = dynamic_cast<VclButtonBox*>(pSWindow->GetParent()) != nullptr; + if ((bIsButtonBox && pSWindow->GetParent()->HasChildPathFocus(true)) || aKeyCode.IsMod2()) + { + pSWindow->ImplControlFocus( nGetFocusFlags ); + return true; + } } } }