> On Dec 11, 2014, at 4:31 AM, Bill Cheeseman <wjcheese...@gmail.com> wrote:
> 
> The problem is that the delegate method is being triggered now at every 
> single launch of my application, but the screen resolution and monitor 
> arrangement have not changed. The user's ability to choose a new location for 
> the window has been overwhelmed by this inappropriate triggering of the 
> delegate method at every launch.



Further testing shows that the primary screen's visibleFrame property does in 
fact change between -awakeFromNib and the triggering of the 
-applicationDidChangeScreenParameters: delegate method a moment later, even 
though I have done nothing explicit in my code to cause a change to the screen 
size. The primary screen's visibleFrame in -awakeFromNib is {{0, 40}, {2560, 
1377}}, but by the time the delegate method is triggered it has changed to {{0, 
41}, {2560, 1376}}. In other words, the bottom of the visibleFrame has moved up 
one point, making the screen's visibleFrame height one point shorter.

This suggests that Ken was correct in proposing that the addition of my 
application's icon to the Dock at launch changed the Dock's size (by increasing 
the height of the Dock by one point), which would cause the change in 
visibleFrame and trigger the delegate method. (I am a little surprised, 
however, that the change in the Dock's size was not apparent to my application 
at the time of -awakeFromNib. Maybe I should test in 
-applicationDidFinishLaunching: instead.)

So I can avoid the problem in my application by changing the filtering code in 
the delegate method to test for a change in the screen's frame property, 
previously saved, instead of its visibleFrame property. I only care about major 
changes in the screens array or screen sizes, namely, those caused by user 
changes in System Preferences connecting or disconnecting monitors. I don't 
care about  minor changes in the Dock's size or changes in its location because 
my application design calls for the window to maintain a larger distance from 
any edge of any screen at all times.

-- 

Bill Cheeseman - b...@cheeseman.name

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to