FS#1411 - [OSX] Replace all usages of APIs deprecated in 10.5/10.6

Attached to Project: OpenTTD
Opened by Emil Djupfeldt (egladil) - Wednesday, 07 November 2007, 22:45 GMT
Last edited by Michael Lutz (michi_cc) - Sunday, 20 December 2009, 16:12 GMT
Type Work in progress
Category Core
Status Closed
Assigned To No-one
Operating System Mac OS X
Severity Medium
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The OS X port is using APIs deprecated in the latest version of OS X (and possible earlier versions). Those should be replaced to newer versions of the API to make the game more future proof on this platform.
This task depends upon

This task blocks these from closing
 FS#2782 - [OSX] Port hopelessly outdated 
Closed by  Michael Lutz (michi_cc)
Sunday, 20 December 2009, 16:12 GMT
Reason for closing:  Fixed
Additional comments about closing:  At least till 10.7 comes around.
Comment by Bjarni (Bjarni) - Friday, 23 November 2007, 06:51 GMT
r11498 breaks right click scrolling on intel macs (I remember something about blackis having endian problems with scrolling). Scrollwheel scrolling works.

Also all the deprecated warnings for quickdraw showed up again (minor issue I guess we just need the right ifdef).

Also speed tests will be needed as blackis patch was a real slowdown.
Comment by Emil Djupfeldt (egladil) - Friday, 23 November 2007, 07:11 GMT
Strange that it should break scrolling, since the event handling code isn't touched at all except for the mouse coordinate translation function, and that should effect more than just scrolling if it breaks.

The deprecated warnings would probably be better to handle by conditional compilation of the entire quickdraw subdriver. (If it's deprecated we shouldn't use it.)
Comment by Emil Djupfeldt (egladil) - Friday, 23 November 2007, 10:14 GMT
This should remove the deprecated warnings, and use the correct driver for the running os x version.
Comment by Remko Bijker (Rubidium) - Tuesday, 08 September 2009, 19:39 GMT
  • Field changed: Summary (Replace all usages of APIs deprecated in OS X 10.5 (Leopard) → Replace all usages of APIs deprecated in OS X 10.5/10.6)
  • Assignment removed
Since MacOS 10.6(?) some cocoa functions have become deprecated, used by the full screen driver:

[SRC] Compiling video/cocoa/
/Users/ingo/ottd/trunk/src/video/cocoa/ In member function ‘virtual void FullscreenSubdriver::UpdatePalette(uint, uint)’:
/Users/ingo/ottd/trunk/src/video/cocoa/ warning: ‘CGTableCount’ is deprecated (declared at /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:459)

This task is a sub-task of FS 2782
Comment by Ingo von Borstel (planetmaker) - Wednesday, 09 September 2009, 09:34 GMT
Actually that's more of a Quartz issue than a cocoa one. And yes, it's been deprecated in 10.6 (only).
Comment by Dirkjan Krijnders (pyth) - Sunday, 27 September 2009, 10:23 GMT
This patch removes the calls to CPS* process manager related stuff. These calls still work, but cause deprecation message in the console. The patched code should be good 10.3 - 10.6. The DEBUG line gives a compiler warning since DEBUG() does not know about the OSStatus type and casting it to (long int) doesn't work because of the #define. What would be the preferred way to solve this? Patch is only tested on 10.5...
Comment by Dirkjan Krijnders (pyth) - Sunday, 27 September 2009, 11:21 GMT
Improved version, making openTTD the front process even if started from the command line.
Comment by Michael Lutz (michi_cc) - Sunday, 27 September 2009, 21:37 GMT
Seems to work as far as I can see.

Added to the other OSX patches at
Comment by Michael Lutz (michi_cc) - Sunday, 04 October 2009, 22:00 GMT
Removing the CPS* calls was implemented in r17712. CGTableCount vanished in r17717.
Some remaining deprecated string functions where removed in r17711.

Besides the obvious QuickDraw stuff (that should have proper version guards and not be reported),
there shouldn't be any deprecated warnings left. Please report here if something is still missing.
Comment by Ingo von Borstel (planetmaker) - Saturday, 14 November 2009, 11:30 GMT
I tested compilation on 10.6 for
with/out iconv
with/out freetype (link failure, see FS 3313)
with/out icu
with/out fontconfig
with/out png
with/out zlib
with/out cocoa (linking failure, see FS 3314)
with/out osx-sysroot
with/out network
with/out cocoa-quickdraw
with/out cocoa-quartz

and I didn't find any messages about the use of deprecated functions. From this POV, I think, this issue can be closed.