Commit graph

52 commits

Author SHA1 Message Date
Marc Durdin
01b192796a feat(mac): user-controllable legacy app list
Fixes #1953.

Makes it possible to specify additional apps that need 'legacy' handling
without requiring an updated build of Keyman for Mac. The list should be
stored in user defaults under the `KMLegacyApps` key. It can be viewed
with the command:

```
defaults read keyman.inputmethod.Keyman KMLegacyApps
```

And updated with

```
defaults write keyman.inputmethod.Keyman KMLegacyApps -array value1 value2 ...
defaults write keyman.inputmethod.Keyman KMLegacyApps -array-add value1 value2 ...
```

Each entry should be a regex that matches the client app id.

For example:

```
defaults write keyman.inputmethod.Keyman KMLegacyApps -array com.microsoft.Word '^com.github.atom$'
```

(Note for purity, the `.` should be escaped in the regex but it'll
actually be fine without...)

This commit also adds the `keymanDataPath` method on
`KMInputMethodAppDelegate`, so we can place additional configuration
data there in the future (as opposed to in the shared config which is
less easy for users to edit.)
2020-11-25 16:56:52 +11:00
Marc Durdin
044631cd54 fix(mac): turn on legacy mode for Java apps
Relates to #3935.

This switches Java apps into legacy mode. However, Java itself will need
patching to support Keyman, as it makes assumptions about input methods,
including matching specific input methods by name, before enabling its
complex text support.

I am in process of submitting a bug report and may try and submit a
patch (although the process seems a little convoluted). It requires a
change to a single file, AWTView.m, with the following diff (against
JDK 16.0):

diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
index 3e80b5a6cf3..2ae1f4f3f12 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
@@ -263,6 +263,16 @@ - (void) keyDown: (NSEvent *)event {
     fProcessingKeystroke = YES;
     fKeyEventsNeeded = YES;

+    if([(NSString *)kbdLayout containsString:@"keyman"]) {
+        // Keyman handles all key events; none should be
+        // passed through as default before Keyman processes them
+        fKeyEventsNeeded = NO;
+    }
     // Allow TSM to look at the event and potentially send back NSTextInputClient messages.
     [self interpretKeyEvents:[NSArray arrayWithObject:event]];

@@ -960,7 +989,9 @@ - (void) insertText:(id)aString replacementRange:(NSRange)replacementRange

     if ((utf16Length > 2) ||
         ((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:codePoint]) ||
-        ((codePoint == 0x5c) && ([(NSString *)kbdLayout containsString:@"Kotoeri"]))) {
+        ((codePoint == 0x5c) && ([(NSString *)kbdLayout containsString:@"Kotoeri"])) ||
+        ([(NSString *)kbdLayout containsString:@"keyman"])
+        ) {
         aStringIsComplex = YES;
     }
2020-11-25 09:59:10 +11:00
Marc Durdin
ea86ce0fbe chore: typo 2020-11-18 20:18:43 +11:00
Marc Durdin
bede3948d2 feat(mac): Sentry support
I wasn't going to do this, but realised that crash reporting was going
to be a problem on mac because it still used crashlytics/fabric. Turned
out to be a good exercise to get me back into macOS world, and fairly
straightforward to get right (helps that the other platforms broke the
ice for me).
2020-11-18 17:13:20 +11:00
Marc Durdin
255e4f4b7a chore: Merge branch 'master' into chore/beta-to-master-p9s2-1 2020-02-17 10:11:15 +11:00
Marc Durdin
4899ae5841 refactor(mac): initial steps of input pathway
The handleEvent function has somewhat convoluted logic around emitting
the final transform to the client application. This starts to refactor
that code to move all client interaction to a single point at the end
of the event sequence.

Next phase will be to update delete and insert events to turn them into
a single action where possible.
2020-02-12 19:56:53 +11:00
Marc Durdin
f856785742 fix(mac): Modifier keys were resetting cached context
Fixes #2375.

For applications that do not provide context to Keyman, Keyman was losing
the context buffer whenever a modifier key was pressed or released. This
change modifies the cache reset to occur only when the Command modifier is
pressed.
2020-02-05 19:32:03 +11:00
Marc Durdin
5d5db2757d [mac] Fix typos 2019-08-08 19:47:35 +10:00
Marc Durdin
256ba2ef1e [mac] Support Adobe products in legacy mode (and VS Code) 2019-08-08 19:36:27 +10:00
Marc Durdin
c3376eba18 [Mac] Add notarization for 10.14.5 and later versions 2019-07-24 20:57:46 +10:00
Marc Durdin
599482b818
Merge pull request #1840 from kamholz/selection-fix
[Mac] fix out-of-date context buffer after keyboard commands
2019-07-09 06:28:41 +10:00
David Kamholz
03e6139cf0 refresh contextBuffer on flagsChanged 2019-06-21 20:20:49 -07:00
David Kamholz
93e8361800 persist save() values across sessions 2019-06-21 11:18:58 -07:00
Tom Bogle
724b50224c [Mac] Removed unneeded code for handling mouse events in IM
The low-level event tap already handles detection of mouse events that could make the context out of date.
2018-07-05 14:22:52 -04:00
Tom Bogle
bd2fe2ee69 [Mac] Cleanup to remove old comment and fix indent (aesthetic only) 2018-07-05 14:18:10 -04:00
Tom Bogle
0a0c2e0668 [Mac] #991 - Reverted changes for #872 (to solve more serious bugs) 2018-06-27 16:30:58 -04:00
Tom Bogle
96d7462bf1
Merge pull request #1019 from keymanapp/mac-1005-prevent-calling-cfrelease-with-null
[Mac] Fixes #1005: Crash - CFRelease() called with NULL. Fixed existing unit test and added more.
2018-06-25 22:55:02 -04:00
Tom Bogle
fc2147ce97 [Mac] Removed call to "containsString" because it won't work in older OS 2018-06-25 17:18:44 -04:00
Tom Bogle
26ad29a744 [Mac] Added lots of IM tests (legacy, no-context, Apple-compliant [WIP])
Fixes #1005 (at least in part). Still one failing test.
2018-06-25 17:15:00 -04:00
Tom Bogle
0ce9fd1cd2 [Mac] Added some new passing unit tests and one still WIP
Need to make a delegate to test posting delete back.
2018-06-23 00:00:43 -04:00
Tom Bogle
90a080d449 [Mac] Fixes existing IM unit test. WIP for #1005 - unit test incomplete 2018-06-22 17:36:20 -04:00
Tom Bogle
dd6ec9ea5d [Mac] #931 - Made anything that appears to be "lLibreOffice" use legacy 2018-06-15 16:49:24 -04:00
Tom Bogle
186c1b2f65 Added explanatory comment 2018-05-31 16:40:30 -04:00
Tom Bogle
70b1af08c3 [Mac] #872 - Added Pages and Keynote as legacy apps
This allows them to retain font/style information when a character sequence causes the character(s) holding that info to be replaced.
2018-05-31 16:25:27 -04:00
Tom Bogle
1ba068994d
Merge pull request #884 from keymanapp/mac-769-add-dysm-for-engine
[Mac] #769 added dSYM for engine so symbols will be available in Crashlytics
2018-05-28 22:48:50 -04:00
Tom Bogle
200dc30193
Merge pull request #883 from keymanapp/mac-882-fix-crash-in-eventTapFunction
[Mac] Prevented crash in eventTapFunction processing "out of band" event
2018-05-25 12:03:53 -04:00
Tom Bogle
d2ed7fc527 Improvements to event tap code
1) Enable/disable event tap depending on whether Keyman is the active IM; 2) Made code dealing with keeping track of activating/deactivating servers thread-safe; 3) Improved clean-up when event tap cannot be re-enabled; 4) Improved and cleaned up some comments and code aesthetics.
2018-05-23 14:16:41 -04:00
Tom Bogle
0cdb3d46c4
Merge pull request #876 from keymanapp/mac-782-InDesign-issues
[Mac] #782 - Improvements to TestInput to illustrate issues with InDesign
2018-05-22 16:24:59 -04:00
Tom Bogle
5a72d5499d [Mac] Prevented crash in eventTapFunction processing "out of band" event
When a special event comes in indicating the event tap has been disabled by timeout or by the user, we attempt to re-enable it. Otherwise, use fallback logic.
2018-05-22 16:20:56 -04:00
Tom Bogle
f7762ad4b3 Added dSYM file and prevented stripping of symbols for engine.
Also added code to enable forcing a test crash in the engine itself
2018-05-22 14:12:26 -04:00
Tom Bogle
b75eb7272f Changed hardcoded KMX file name for "Easter egg" to constant 2018-05-17 09:15:19 -04:00
Tom Bogle
953ba5d9c9 Added diagnostics and experimenting with things related to InDesign 2018-05-17 09:10:42 -04:00
Tom Bogle
c589bef9b0 Suppressed output of all environment variable when running build script
Also show Fabric API key in Console when forcing crash via Easter egg.
2018-05-15 17:39:50 -04:00
Tom Bogle
e13918c4b5 Made Crashlytics "Easter egg" only happen when verbose logging is on. 2018-05-15 16:59:08 -04:00
Tom Bogle
5ac9c10775 [Mac] [WIP] #769 - Added code to using Fabric with Crashlytics
This commit does not include the project and plist changes necessary to build/work because they have the APIKey in them and we don't want to publish that. Also, I haven't completely worked out where the frameworks should go or how that plumbing should be hooked up to work well on the build machines and for other developers.
2018-05-09 12:11:55 -04:00
Tom Bogle
827d532265 [Mac] Issue 175: Solved compatibility problem with Open Office 2018-04-26 15:28:51 -04:00
Tom Bogle
3e210d3e53 Call respondsToSelector before calling methods that might not be implemented. 2018-03-21 12:42:53 +07:00
Tom Bogle
fef69ced96 Removed commented out code and fixed a typo. 2018-03-02 01:32:26 -05:00
Tom Bogle
98ad59a86c Removed commented-out code 2018-03-02 01:22:03 -05:00
Tom Bogle
f06ca65c31 [WIP] Use low-level mouse events to detect likely context changes
Replaced logic in updateContextBufferIfNeeded to be based on tapping of low-level mouse events instead of relying on list of clients that might have unexpected selection changes.
2018-03-02 01:22:03 -05:00
Tom Bogle
fe8fccbf51 Limited context to 80 chars in KMInputMethodBrowserClientEventHandler
I had previously made a change to do this in the base class but overloooked that it was also a factor in this subclass, so I refactored a little to have a single method  in the base class that handles this. (Note: the base class method also checks to be sure that the client responds to the attributedSubstringFromRange method before calling it. This used to be done only in the subclass, but it seems like a useful safeguard in case some other client fails to implement this.
2018-03-01 12:07:13 -05:00
Tom Bogle
846dacd889 Limited context to a maximum of 80 characters
This improves performance and prevents failures in some apps, which return no context at all if the total document size is too great.
2018-02-28 02:09:33 -05:00
Tom Bogle
8fc9cf8129 [Mac] Removed commented out code
These were changes I made but failed to stage in my final commit for the PR 550.
2018-02-06 22:32:58 -05:00
Tom Bogle
0cf3cee56b Removed call to [sender length] and debug call to [sender markedRange]
Turns out that length is not really a supported method/property on IMKTextInput, and it returns unreliable information. (It appears that perhaps this was actually causing Word to work incorrectly.) The diagnostic call to markedRange was pointless since Keyman keyboards to not compose text in this way.
2018-01-29 22:21:04 -05:00
Tom Bogle
db9475e0c6 Solved the chirality problem on Mac (#178)
Also made the Scheme for the IM build shared in preparation for adding unit tests to thta project.
2018-01-25 00:00:44 -05:00
Tom Bogle
72cef42d25 Broke up long methods
Major refactoring to break long methods up by factoring out into meaningful sub-methods. Also removed small amount of unused code left over from previous refactoring step.
2018-01-11 12:58:52 -05:00
Tom Bogle
50cd075d03 Split browser-specific code into separate subclasses
Safari and Chrome get their own subclasses, but I need to compare performance.
2018-01-09 15:52:14 -05:00
Tom Bogle
3ef48599f6 Cmd-A in Safari, insert chars individually in Chrome
Added logic to correct bug in Safari Google Docs introduced a few months back to clear selection after replacement. Refactored code and fixed bug to correctly handle Chrome's need to replace characters individually.
2018-01-08 21:35:28 -05:00
Tom Bogle
e716f42038 Google Chrome pending chars logic -> BrowserClientEventHandler.
Moved special logic for dealing with pending character buffer in Google Chrome into the BrowserClientEventHandler.
2018-01-08 15:12:39 -05:00
Tom Bogle
6176310073 Broke out browser client support into subclass
There is a problem with Google Docs in Safari now - did I break something?
2018-01-05 15:51:08 -05:00