Feeds

Fun with CoreGraphics, Part II

Split personality framework

Maximizing your infrastructure through virtualization

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

Reducing security risks from open source software

More from The Register

next story
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
Do YOU work at Microsoft? Um. Are you SURE about that?
Nokia and marketing types first to get the bullet, says report
Microsoft takes on Chromebook with low-cost Windows laptops
Redmond's chief salesman: We're taking 'hard' decisions
Cheer up, Nokia fans. It can start making mobes again in 18 months
The real winner of the Nokia sale is *drumroll* ... Nokia
EU dons gloves, pokes Google's deals with Android mobe makers
El Reg cops a squint at investigatory letters
Chrome browser has been DRAINING PC batteries for YEARS
Google is only now fixing ancient, energy-sapping bug
Big Blue Apple: IBM to sell iPads, iPhones to enterprises
iOS/2 gear loaded with apps for big biz ... uh oh BlackBerry
prev story

Whitepapers

Seven Steps to Software Security
Seven practical steps you can begin to take today to secure your applications and prevent the damages a successful cyber-attack can cause.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Designing a Defense for Mobile Applications
Learn about the various considerations for defending mobile applications - from the application architecture itself to the myriad testing technologies.
Build a business case: developing custom apps
Learn how to maximize the value of custom applications by accelerating and simplifying their development.
Consolidation: the foundation for IT and business transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.