[Libreoffice-commits] core.git: vcl/osx

Ward van Wanrooij ward at ward.nu
Fri Jan 19 11:58:51 UTC 2018


 vcl/osx/salframeview.mm |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 52d9378a683c4e33e0a3dd7c6fc6f2c0dfc60125
Author: Ward van Wanrooij <ward at ward.nu>
Date:   Mon Nov 27 19:44:26 2017 +0100

    vcl osx: fix decimal separator key when localized
    
    If you use OS X and an international locale (e.g. Locale setting:
    Dutch (Netherlands) and select Decimal separator key: Same as
    locale setting (,) in Preferences/Language Settings/Languages using
    the decimal separator key on the numeric keypad still results in a
    '.' instead of the expected ','. Tested and confirmed using latest
    LO build on 10.11.6 and 10.12.6 using both the wired and wireless
    Apple keyboard.
    The cause for this is that the decimal separator key sends a
    KEY_POINT (like the regular . key on the alphanumeric part) and
    the code expects a KEY_DECIMAL for the decimal separator key.
    Fixed by changing the combination of KEY_POINT and mask
    NSNumericPadKeyMask to KEY_DECIMAL.
    
    Change-Id: Iaf1ecf538c3e1a49ad512851cf16dd4dd991cb06
    Reviewed-on: https://gerrit.libreoffice.org/45362
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index c79244a0011e..e33ccb188616 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -156,6 +156,8 @@ static const struct ExceptionalKey
 {
     const sal_uInt16        nKeyCode;
     const unsigned int  nModifierMask;
+    const sal_uInt16        nModifiedKeyCode;
+    const bool              bZeroCharacter;
 } aExceptionalKeys[] =
 {
 SAL_WNODEPRECATED_DECLARATIONS_PUSH
@@ -163,8 +165,10 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
         // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12
         // 'NSControlKeyMask' is deprecated: first deprecated in macOS 10.12
         // 'NSShiftKeyMask' is deprecated: first deprecated in macOS 10.12
-    { KEY_D, NSControlKeyMask | NSShiftKeyMask | NSAlternateKeyMask },
-    { KEY_D, NSCommandKeyMask | NSShiftKeyMask | NSAlternateKeyMask }
+        // 'NSNumericPadKeyMask' is deprecated: first deprecated in macOS 10.12
+    { KEY_D, NSControlKeyMask | NSShiftKeyMask | NSAlternateKeyMask, KEY_D, true },
+    { KEY_D, NSCommandKeyMask | NSShiftKeyMask | NSAlternateKeyMask, KEY_D, true },
+    { KEY_POINT, NSNumericPadKeyMask, KEY_DECIMAL, false }
 SAL_WNODEPRECATED_DECLARATIONS_POP
 };
 
@@ -1018,7 +1022,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
                 (mpFrame->mnLastModifierFlags & aExceptionalKeys[i].nModifierMask)
                 == aExceptionalKeys[i].nModifierMask )
             {
-                [self sendKeyInputAndReleaseToFrame: nKeyCode character: 0];
+                [self sendKeyInputAndReleaseToFrame: aExceptionalKeys[i].nModifiedKeyCode character: (aExceptionalKeys[i].bZeroCharacter ? 0 : keyChar) ];
 
                 return YES;
             }


More information about the Libreoffice-commits mailing list