Feeds

Fun with CoreGraphics, Part II

Split personality framework

High performance access to file storage

Cross-application notifications

Different applications can register for the same notifications (e.g., loginwindow and Activity Monitor are both interested in when new processes start running or existing processes die), and you can even register for the same notification more than once from different classes within the same program. In this specific case, though, you really would have to make use of the userData parameter to determine which object is interested in the notification - if you see what I mean.

To unregister a notification procedure (typically you’d do this in your object’s dealloc method), use the CGSRemoveNotifyProc call. This routine has the exact same function prototype as CGSRegisterNotifyProc - just pass the same three parameters.

The notification procedure type looks like this:

typedef void (* CGSNotifyProcPtr)(CGSNotificationType type, void * data, NSUInteger dataLength, void *userData);

In other words, the first parameter is the notification type, corresponding to the second parameter to CGSRegisterNotifyProc. The last parameter, userData, will be whatever you passed as the third parameter to CGSRegisterNotifyProc.

You’ll probably want to use the same notification procedure for several different notifications, in which case you can check the first parameter to see what notification you’re dealing with. Obviously, if you’ve only registered one notification for each notification procedure, the check is superfluous.

The "meat" of the notification is in the data and dataLength parameters. The significance of these parameters varies depending upon the notification type that’s being received. More on that next time. The bad news is that I’ve said so much, I’m out of space. There’s no sample project this time, but next month I’ll provide source for an app which receives CoreGraphics notifications, and I’ll delineate some of the notification types available. I’ll also wrap up this mini-series on CoreGraphics by pointing you to some of the other goodies contained therein. ®

High performance access to file storage

More from The Register

next story
Android engineer: We DIDN'T copy Apple OR follow Samsung's orders
Veep testifies for Samsung during Apple patent trial
Windows 8.1, which you probably haven't upgraded to yet, ALREADY OBSOLETE
Pre-Update versions of new Windows version will no longer support patches
Microsoft lobs pre-release Windows Phone 8.1 at devs who dare
App makers can load it before anyone else, but if they do they're stuck with it
This time it's 'Personal': new Office 365 sub covers just two devices
Redmond also brings Office into Google's back yard
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
Batten down the hatches, Ubuntu 14.04 LTS due in TWO DAYS
Admins dab straining server brows in advance of Trusty Tahr's long-term support landing
Windows XP still has 27 per cent market share on its deathbed
Windows 7 making some gains on XP Death Day
Internet-of-stuff startup dumps NoSQL for ... SQL?
NoSQL taste great at first but lacks proper nutrients, says startup cloud whiz
US taxman blows Win XP deadline, must now spend millions on custom support
Gov't IT likened to 'a Model T with a lot of things on top of it'
prev story

Whitepapers

Securing web applications made simple and scalable
In this whitepaper learn how automated security testing can provide a simple and scalable way to protect your web applications.
Five 3D headsets to be won!
We were so impressed by the Durovis Dive headset we’ve asked the company to give some away to Reg readers.
HP ArcSight ESM solution helps Finansbank
Based on their experience using HP ArcSight Enterprise Security Manager for IT security operations, Finansbank moved to HP ArcSight ESM for fraud management.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Mobile application security study
Download this report to see the alarming realities regarding the sheer number of applications vulnerable to attack, as well as the most common and easily addressable vulnerability errors.