CGSPrivate Functions by Seth Willits
01-15-06




Mac OS X is full of private APIs available only to Apple to use in their own software and the operating system. Clever developers, much more knowledgeable than I, have been able to reverse engineer some of these APIs and do some neat things with them. I was fiddling with the CGSPrivate functions that were made popuplar by a program called Desktop Manager which makes virtual desktops, and made a REALbasic module of (almost) all of the functions in that header as well as some others.

One of the neat things in this header are functions to transition the entire screen, like fast user switching does. I haven't yet done anything useful with these methods, but I did write a tiny sample application that demonstrates these effects.





Full Screen Effects

The code below is pretty simple, and with a fair amount of work using more of the functions, you could do some wickedly cool stuff, like... a virtual desktop manager program made in REALbasic. :)

dim cid as Integer = _CGSDefaultConnection()
dim transNo as Integer

dim transSpec as CGSTransitionSpec
transSpec.Type = CGSTransitionType(PopupMenu1.ListIndex + 1)
transSpec.Option = CGSTransitionOption(PopupMenu2.ListIndex)
transSpec.WindowID = 0 // Fullscreen
transSpec.BackColorPtr = 0

dim err as Integer
err = CGSNewTransition(cid, transSpec, transNo)
err = CGSSetWorkspace(cid, 0)
err = CGSInvokeTransition(cid, transNo, 0.5)
CGSPrivate.Delay(0.5)
err = CGSReleaseTransition(cid, transNo)

Finished

Download the project.