MACOSX: Update some comments about macOS 10.4/10.5 behavior

Found while doing a review of our existing workarounds for those
versions, and the system features which can be used there.

Also fix indentation and some typos while there.
This commit is contained in:
Donovan Watteau 2022-11-05 10:09:58 +01:00
parent 5def1ad027
commit 4f5ccdbe75
4 changed files with 12 additions and 10 deletions

View file

@ -43,7 +43,7 @@
typedef unsigned long NSUInteger;
// Those are not defined in the 10.4 SDK, but they are defined when targeting
// Mac OS X 10.4 or above in the 10.5 SDK. So hopefully that means it works with 10.4 as well.
// Mac OS X 10.4 or above in the 10.5 SDK, and they do work with 10.4.
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
enum {
NSUTF32StringEncoding = 0x8c000100,
@ -234,6 +234,8 @@ void replaceApplicationMenuItems() {
addMenuItem(_("Minimize"), nil, @selector(performMiniaturize:), @"m", windowMenu);
}
// Note: this part is expected not to work at run-time on 10.5 and earlier,
// because setHelpMenu is only available on 10.6+ (see Bug#11260).
NSMenu *helpMenu = addMenu(_("Help"), @"", @selector(setHelpMenu:));
if (helpMenu) {
if (!delegate) {

View file

@ -40,7 +40,7 @@
typedef unsigned long NSUInteger;
// Those are not defined in the 10.4 SDK, but they are defined when targeting
// Mac OS X 10.4 or above in the 10.5 SDK. So hopefully that means it works with 10.4 as well.
// Mac OS X 10.4 or above in the 10.5 SDK, and they do work with 10.4.
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
enum {
NSUTF32StringEncoding = 0x8c000100,

View file

@ -39,7 +39,9 @@
#include <CoreFoundation/CFString.h>
// NSDockTile was introduced with Mac OS X 10.5.
// Try provide backward compatibility by avoiding NSDockTile symbols.
// The following makes it possible to compile this feature with the 10.4
// SDK (by avoiding any NSDockTile symbol), while letting the same build
// use this feature at run-time on 10.5+.
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
typedef id NSDockTilePtr;
#else
@ -67,8 +69,6 @@ MacOSXTaskbarManager::MacOSXTaskbarManager() : _progress(-1.0) {
_dockTile = nil;
_applicationIconView = nil;
_overlayIconView = nil;
}
MacOSXTaskbarManager::~MacOSXTaskbarManager() {
@ -119,7 +119,7 @@ void MacOSXTaskbarManager::setOverlayIcon(const Common::String &name, const Comm
if (!hasDockTile())
return;
if (name.empty()) {
if (name.empty()) {
clearOverlayIconView();
[_dockTile performSelector:@selector(display)];
return;
@ -149,7 +149,7 @@ void MacOSXTaskbarManager::setProgressValue(int completed, int total) {
else if (_progress < 0)
_progress = 0.0;
NSImage *mainIcon = [[NSApp applicationIconImage] copy];
NSImage *mainIcon = [[NSApp applicationIconImage] copy];
double barSize = [mainIcon size].width;
double progressSize = barSize * _progress;
[mainIcon lockFocus];
@ -209,7 +209,7 @@ void MacOSXTaskbarManager::clearError() {
if (!hasDockTile())
return;
clearOverlayIconView();
clearOverlayIconView();
[_dockTile performSelector:@selector(display)];
return;
}

View file

@ -134,7 +134,7 @@ bool MacOSXTextToSpeechManager::startNextSpeech() {
bool MacOSXTextToSpeechManager::stop() {
_messageQueue.clear();
if (isSpeaking()) {
_currentSpeech.clear(); // so that it immediately reports that it is no longer speeking
_currentSpeech.clear(); // so that it immediately reports that it is no longer speaking
// Stop as soon as possible
// Also tell the MacOSXTextToSpeechManagerDelegate to ignore the next finishedSpeaking as
// it has already been handled, but we might have started another speach by the time we
@ -159,7 +159,7 @@ bool MacOSXTextToSpeechManager::resume() {
}
bool MacOSXTextToSpeechManager::isSpeaking() {
// Because the NSSpeechSynthesizer is asynchronous, it doesn't start speeking immediately
// Because the NSSpeechSynthesizer is asynchronous, it doesn't start speaking immediately
// and thus using [synthesizer isSpeaking] just after [synthesizer startSpeakingString:]] is
// likely to return NO. So instead we check the _currentSpeech string (set when calling
// startSpeakingString, and cleared when we receive the didFinishSpeaking message).