diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2023-12-22 09:25:53 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2024-01-08 17:45:48 +0100 |
commit | aaefd2080ecb39a3deade23368a83acee91367ef (patch) | |
tree | b3ad2e0d6fde234ddd2ee319af14d110ac4572ed /vcl | |
parent | a566ea0108387cc9d52dfdd6c52a24b119f9e071 (diff) |
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.mehrbrodt@allotropia.de>
(cherry picked from commit ea1421747985bd09ad40565da8536e857b5c2e9a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161568
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/dlgctrl.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
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; + } } } } |