Re: What triggers -applicationDidChangeScreenParameters: delegate method?
Re: What triggers -applicationDidChangeScreenParameters: delegate method?
- Subject: Re: What triggers -applicationDidChangeScreenParameters: delegate method?
- From: Ken Thomases <email@hidden>
- Date: Thu, 11 Dec 2014 05:53:10 -0600
On Dec 11, 2014, at 3:31 AM, Bill Cheeseman <email@hidden> wrote:
>> On Dec 10, 2014, at 3:48 PM, Ken Thomases <email@hidden> wrote:
>>
>> By the way, why is it important to understand why the behavior has changed? It has always been the case that that notification could come at any time, so your code has to cope in any case.
>
> When my application launches for the first time, it places a floating status information window in its default location near the bottom-right corner of the main screen. After that, the user can move it to another location if desired, and at every relaunch thereafter it will appear in the new location. But, if the user changes screen resolution or rearranges multiple monitors at any time, the window automatically moves back to its default location on the new main screen in response to the delegate method. I made the design decision to force this application's window to reside by default in the lower-right corner, instead of being moved automatically by the system to the top-left corner as windows normally are in response to screen changes.
>
> 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. (And the move back to the default location happens after the window first appears in the user's desired location, so at every launch we see the move back to the default location, although I can easily fix this cosmetic issue.)
This was never a good strategy. That notification does not necessarily only occur when the user changes screen resolution or rearranges the displays. As I mentioned, it happens when the Dock changes size or if the user toggles its auto-hide behavior. It could happen when a system with dual GPUs switches between them. Etc.
You should move the window minimally to keep it within the visible frame of its screen. Or you might use a heuristic where you identify the closest edges and maintain the distance from those edges. In most cases, this will mean not moving it at all, which is good.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden