Posted On: Sunday, January 6th, 2008 (ResExcellence, Source Code, User Interface)
Posted by: Paul Lefebvre

by Seth Willits

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.
FastUserSwitchingCGSPrivate Window

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 IntegerdimDim transSpec As CGSTransitionSpectransSpec.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 CGSPrivate Project

Originally published by ResExcellence
Reprinted with permission

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

This entry was posted on Sunday, January 6th, 2008 at 11:00 am and is filed under ResExcellence, Source Code, User Interface. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply