-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(mac): clean up code obsoleted by core #10877
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am slightly uncertain about the scope of some of these changes and how we verify that they haven't changed interactions with client apps -- particularly the changes in sendKeymanKeyCodeForEvent
.
handledEvent = NO; | ||
} else { | ||
[self.appDelegate logDebugMessage:@"KXMInputMethodHandler applyOutputToTextInputClient, delete only scenario"]; | ||
[self sendEvents:event forOutput:output]; | ||
} | ||
} else if (output.isDeleteAndInsertScenario) { | ||
/* | ||
// needs further testing to fix backspace bug in google docs (without breaking other apps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an issue number for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, #10246, adding it in the comment
// use nil as source, as this generated event is not directly tied to the originating event | ||
CGEventRef keyDownEvent = CGEventCreateKeyboardEvent(nil, kKeymanEventKeyCode, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change in behaviour. Are there possible ramifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change from my previous version of the code, but Keyman 16 specifies nil as the source for this event, so I decided to switch back to that as I could see no difference in the behavior. The impact of the event source is not clearly documented. It seems reasonable that if any event we generate is going to have a nil event source it would be this one because it is a message to ourselves, and we do not want it to be interpreted by anyone but Keyman.
// use nil as source, as this generated event is not directly tied to the originating event | ||
CGEventRef keyDownEvent = CGEventCreateKeyboardEvent(nil, kKeymanEventKeyCode, true); | ||
|
||
CGEventPostToPSN(&psn, keyDownEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been changed from CGEventPostToPid
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CGEventPostToPid is only supported with macOS 10.11 and later, and we still support macOS 10.10 in 17. CGEventPostToPSN, though deprecated, still works ok with Sonoma. I prefer CGEventPostToPid, and it is a cleaner interface, but I'll wait until 18 when we move to the Xcode 15 and stop supporting 10.10.
@@ -90,23 +63,20 @@ - (void)postKeyboardEventWithSource: (CGEventSourceRef)source code:(CGKeyCode) v | |||
- (void)sendKeymanKeyCodeForEvent:(NSEvent *)event { | |||
[self.appDelegate logDebugMessage:@"KeySender sendKeymanKeyCodeForEvent"]; | |||
|
|||
[self sendKeyDown:kKeymanEventKeyCode forSourceEvent:event includeKeyUp:NO]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a significant change for beta?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This did not seem to be causing an issue, but it was definitely a bug and resulted in duplicate generation of the event that triggers insertion of the text.
OK happy to go ahead on this. |
Changes in this pull request will be available for download in Keyman version 17.0.291-beta |
Remove code that is no longer used because of the adoption of Keyman Core and design changes around it. Instead of several classes descending from
KMInputMethodEventHandler
to handle different degrees of compliance, we now use the classTextApiCompliance
to repeatedly evaluate what the current state of compliance is. This is better because compliance can vary within the same application: for example, moving from the url search bar in Google Chrome to a Google Docs document in the content area, causes a change in compliance. When this happens, we do not want to switch event handlers because we are actually in the process of handling an event.@keymanapp-test-bot skip