Re: Panther's NSScreen vs. screen resolution changes
Re: Panther's NSScreen vs. screen resolution changes
- Subject: Re: Panther's NSScreen vs. screen resolution changes
- From: Peter Maurer <email@hidden>
- Date: Wed, 16 Jun 2004 13:43:54 +0200
has anyone ever noticed that Panther's NSScreen class doesn't seem to
perceive screen resolution changes while an application is running? I
always have to restart my application to make [[[NSScreen screens]
objectAtIndex: 0] frame] return the actual screen size after changing
the screen resolution. I've never had this problem with Jaguar.
Could this be due to excessive caching, or is it just me?
You should listen for
NSApplicationDidChangeScreenParametersNotification or
NSWindowDidChangeScreensNotification (in your NSWindow delegate), and
use either of those to refresh your list of NSScreen objects. They're
both triggered by the same event. I think that this behavior is a big
hairy bug, and that this notification (name?) is misleading,
redundant, and it would be more useful if it actually did what it
says: notified when a window frame has moved onto a different
screen's frame. If that's the type of notification you need, you have
to listen for NSWindowDidMoveNotification (which are coalesced,
thankfully), and compare the current NSScreen to the cached previous
screen for your window.
I did listen to the NSApplicationDidChangeScreenParameters notification
-- sort of. Actually, I used NSApplications's
applicationDidChangeScreenParameters: delegate method, but this method
wasn't ever called.
Turns out that my NSApplication subclass's sendEvent: method was eating
NSSystemDefined events. Now that I'm sending these to super, everything
is fine again. Thanks for your help,
Peter Maurer.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.