summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-12-22 09:25:53 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-12-23 17:37:02 +0100
commitea1421747985bd09ad40565da8536e857b5c2e9a (patch)
treeb10ff9d9d6a4d9ac1ca1e24ea46d9ceea20b9583 /vcl/source
parent25d4fae8d3f69dc4d03c1a04233e6ed670742ed5 (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>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/dlgctrl.cxx11
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;
+ }
}
}
}