-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
fix(mac): restore OSK keys that became invisible in mac OS 14 Sonoma #11388
Conversation
With the move to Xcode 15.3, there are many APIs called from Keyman for Mac that were deprecated before our minimum supported version of macOS (now set to 10.13)
User Test ResultsTest specification and instructions
Test Artifacts
|
set clipsToBounds to true for osk and osk key views This property began defaulting to false with the update to macOS 14 sonoma causing the osk keys to become so large that they obscured the entire osk view. Also replaced and few more deprecated properties and functions.
self = [super initWithFrame:frame]; | ||
if (self) { | ||
os_log_with_type(oskKeyLog, OS_LOG_TYPE_DEBUG, "KeyView initWithFrame: %{public}@, bounds: %{public}@, default clipsToBounds %{public}@", NSStringFromRect(frame), NSStringFromRect(self.bounds), self.clipsToBounds?@"YES":@"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.
I take it the new logs are intentionally being left in?
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, I am planning to include more log statements with the unified logging APIs because attaching the debugger to the input method is not practical. I will do this throughout the app for #10997.
With log statements of type DEBUG, the messages are not persisted and are immediately discarded unless debug messages are enabled (disabled by default) and the log is actually being streamed.
} | ||
|
||
return self; | ||
} | ||
|
||
- (void)drawRect:(NSRect)rect { | ||
os_log_t oskKeyLog = os_log_create("org.sil.keyman", "osk-key"); | ||
os_log_with_type(oskKeyLog, OS_LOG_TYPE_DEBUG, "KeyView drawRect: %{public}@, bounds: %{public}@, keyCode: 0x%lx, caption: %{public}@, label: %{public}@", NSStringFromRect(rect), NSStringFromRect(self.bounds), self.keyCode, self.caption.stringValue, self.label.stringValue); |
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.
More "new logs". This one looks like we're making a new logging object... with the same ID as the log noted for the previous comment?
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.
The os_log_create does not actually create a new log object if it has already been called. Internally, the logging framework creates a singleton for each log object of a certain subsystem/category.
To reduce clutter, I can create a private member variable to hold this reference so that within each method there is only one line of code to write a log statement. It will have no effect on performance, but could make it easier to read the code.
Test Results
Here, the on-screen keyboard appeared correctly, and it is not in a blank state now. It is showing the "amhairc" key buttons.
|
Have we been able to test this on pre-Sonoma devices as well? Since the issue arose with Sonoma, it'd be wise to verify that we don't break on older macOS as a consequence of the fix. |
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. Agree that we should test against older operating systems as well
Tested with Monterey, and the OSK passes both users tests there also. |
Changes in this pull request will be available for download in Keyman version 17.0.323-beta |
According to AppKit Release Notes for macOS 14 the property NSView.clipsToBounds which was defaulted to true was changed to default to false. This caused the Keyman OSK keys to not be drawn correctly under Sonoma, giving the appearance of a blank OSK. This change is to override the new default behavior and set the property back to true.
Fixes #11379
Also, with the move to Xcode 15.3, there are several APIs called from Keyman for Mac that were deprecated before our minimum supported version of macOS (now set to 10.13). These can be replaced without doing version checks because the replacements are available for all of our supported OS versions. It was suspected that these may have caused the OSK issue, but they had no effect.
To support the debugging of the OSK issue, log statements were also added using the Unified Logging API for which we now have support in our minimum target version of macOS.
User Testing