5

I need to monitor for any screen resolution changes in my app, coming with my app in front or not.

I searched a lot on the internet yesterday and tried all these options:

applicationDidChangeScreenParameters;
CGDisplayRegisterReconfigurationCallback;
NSApplicationDidChangeScreenParametersNotification;

I get notifications when I change the resolution manually or plug/unplug a new display.

But I do not get notifications when other applications changes the screen parameters (most games made before 2011).

Is there any way to know if Any mac application changes the screen resolution? Even if my app is in the background? Any notification? Hopefully without Accessibility API...?

Thank you very much


EDIT (June 9)

This answer Events when dock is showing or hiding helped me a little bit. Since I get the notification when another app enters/exits fullscreen, but not when it changes the resolution without changing the fullscreen state =/ And it relies on Carbon APIs which are deprecated on 10.8...

It is not exactly what I want but works for most cases... Is there any other way to achieve on cocoa? Any global notification for this?

4

1 回答 1

1

你可能已经看过这个页面:

https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/QuartzDisplayServicesConceptual/Articles/Notification.html%23//apple_ref/doc/uid/TP40004235-SW1

此外,您似乎需要考虑来自其他应用程序的通知,因此使用NSDistributedNotificationCenter而不仅仅是NSNotificationCenter.

于 2012-06-15T20:55:36.347 回答