[Libreoffice-commits] core.git: vcl/win
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 30 19:48:43 UTC 2021
vcl/win/window/salframe.cxx | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
New commits:
commit ce9e6972148c657994beb74f671e51bec5be6689
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jun 30 15:58:57 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 30 21:48:05 2021 +0200
tdf#70633 unset Alt if detected as AltGr in both KeyInput branches
we are unsetting Alt if the modifier is AltGr in one SalEvent::KeyInput
case but not in another. If I replicate the unset of Alt if AlrGr in
the other place then both UTF-16 parts of the codepoint get accepted
and the described input case works
Change-Id: Ifa8a5afbb1853ef3d5f388fd5e7bd3bbc048e260
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118170
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 8e4abcdbd66e..45361d8baef0 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3353,6 +3353,16 @@ bool WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangT
return bRet;
}
+static void UnsetAltIfAltGr(SalKeyEvent& rKeyEvt, sal_uInt16 nModCode)
+{
+ if ((nModCode & (KEY_MOD1 | KEY_MOD2)) == (KEY_MOD1 | KEY_MOD2) &&
+ rKeyEvt.mnCharCode)
+ {
+ // this is actually AltGr and should not be handled as Alt
+ rKeyEvt.mnCode &= ~(KEY_MOD1 | KEY_MOD2);
+ }
+}
+
static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
WPARAM wParam, LPARAM lParam, LRESULT& rResult )
{
@@ -3441,8 +3451,12 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
aKeyEvt.mnCode |= nModCode;
aKeyEvt.mnCharCode = ImplGetCharCode( pFrame, wParam );
aKeyEvt.mnRepeat = nRepeat;
+
+ UnsetAltIfAltGr(aKeyEvt, nModCode);
+
nLastChar = 0;
nLastVKChar = 0;
+
bool nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
return nRet;
@@ -3593,12 +3607,7 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
aKeyEvt.mnCode |= nModCode;
aKeyEvt.mnRepeat = nRepeat;
- if ((nModCode & (KEY_MOD1 | KEY_MOD2)) == (KEY_MOD1 | KEY_MOD2) &&
- aKeyEvt.mnCharCode)
- {
- // this is actually AltGr and should not be handled as Alt
- aKeyEvt.mnCode &= ~(KEY_MOD1 | KEY_MOD2);
- }
+ UnsetAltIfAltGr(aKeyEvt, nModCode);
bIgnoreCharMsg = bCharPeek;
bool nRet = pFrame->CallCallback( nEvent, &aKeyEvt );
More information about the Libreoffice-commits
mailing list