Feeds

Fun with CoreGraphics, Part II

Split personality framework

Internet Security Threat Report 2014

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. ®

Choosing a cloud hosting partner with confidence

More from The Register

next story
Netscape Navigator - the browser that started it all - turns 20
It was 20 years ago today, Marc Andreeesen taught the band to play
Sway: Microsoft's new Office app doesn't have an Undo function
Content aggregation, meet the workplace ... oh
Sign off my IT project or I’ll PHONE your MUM
Honestly, it’s a piece of piss
Return of the Jedi – Apache reclaims web server crown
.london, .hamburg and .公司 - that's .com in Chinese - storm the web server charts
NetWare sales revive in China thanks to that man Snowden
If it ain't Microsoft, it's in fashion behind the Great Firewall
Chrome 38's new HTML tag support makes fatties FIT and SKINNIER
First browser to protect networks' bandwith using official spec
Admins! Never mind POODLE, there're NEW OpenSSL bugs to splat
Four new patches for open-source crypto libraries
prev story

Whitepapers

Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
Why cloud backup?
Combining the latest advancements in disk-based backup with secure, integrated, cloud technologies offer organizations fast and assured recovery of their critical enterprise data.
Win a year’s supply of chocolate
There is no techie angle to this competition so we're not going to pretend there is, but everyone loves chocolate so who cares.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.