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: Jim Correia <email@hidden>
- Date: Tue, 8 Jun 2004 16:56:49 -0400
On Jun 8, 2004, at 9:01 AM, Peter Maurer wrote:
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?
It could be due to your excessive caching.
Are you caching the NSScreen object returned by [[NSScreen screens]
objectAtIndex: 0], or fetching it each time you need it?
<
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/ObjC_classic/Classes/NSScreen.html>
The documentation warns (perhaps not explicitly enough) about caching
the screens you get back from the class methods.
In a test application, I have a button which dumps the screen frame.
- (IBAction)dumpScreenFrame:(id)sender
{
NSLog(@"%@", NSStringFromRect([[[NSScreen screens] objectAtIndex: 0]
frame]));
}
It appears to do the right thing, within one run of the app, when the
resolution changes. I am testing on 10.3.4.
2004-06-08 16:53:22.419 ScreenTest[14789] {{0, 0}, {1600, 1200}}
2004-06-08 16:53:23.714 ScreenTest[14789] {{0, 0}, {1600, 1200}}
2004-06-08 16:53:24.010 ScreenTest[14789] {{0, 0}, {1600, 1200}}
2004-06-08 16:53:40.731 ScreenTest[14789] {{0, 0}, {1024, 768}}
2004-06-08 16:53:41.587 ScreenTest[14789] {{0, 0}, {1024, 768}}
2004-06-08 16:53:42.059 ScreenTest[14789] {{0, 0}, {1024, 768}}
2004-06-08 16:53:50.643 ScreenTest[14789] {{0, 0}, {1600, 1200}}
2004-06-08 16:53:51.195 ScreenTest[14789] {{0, 0}, {1600, 1200}}
2004-06-08 16:53:51.443 ScreenTest[14789] {{0, 0}, {1600, 1200}}
Jim
_______________________________________________
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.