Re: What triggers -applicationDidChangeScreenParameters: delegate method?
Re: What triggers -applicationDidChangeScreenParameters: delegate method?
- Subject: Re: What triggers -applicationDidChangeScreenParameters: delegate method?
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 11 Dec 2014 08:32:33 -0500
> On Dec 11, 2014, at 6:53 AM, Ken Thomases <email@hidden> wrote:
>
> 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.
I believe I mentioned previously that my testing showed that adding and removing icons from the Dock did not trigger the -applicationDidChangeScreenParameters: delegate method. I was right as to the Mac I tested, but the conclusion I drew was erroneous because I tested on a Mac with so many icons already in the Dock that the Dock doesn't change size. I now see that the delegate method is in fact triggered by such things as changing the Dock's size, position on screen and autohide preference settings, all affecting the NSScreen 'visibleFrame'.
Unfortunately, the documentation gives us very little guidance as to what the delegate method does and does not cover. I still don't know what it is in my rewritten application that is triggering the delegate method. I know it isn't the addition of the application's icon to the Dock when I launch the application, for two reasons: (1) my Dock has so many icons in it that adding an icon does not change its height and in fact does not trigger the delegate method; and (2) my application's icon is always kept in the dock anyway whether or not it is running.
You're right that the delegate method can be triggered by changes that my application does not care about. As I mentioned in another message this morning, I am therefore currently rewriting the application to keep track of relevant screen parameters in user defaults and to respond only to changes in the number and size of screens and to changes in which screen has the menu bar (the first screen in the 'screens' list; I mischaracterized it as the "main" screen in my previous post). That should resolve the difficulty I brought up in my original post as well as the difficulty you pointed out regarding changes to the NSScreen 'visibleFrame'.
I will not respond to your comments on application design choices, as they are not the subject of my question.
--
Bill Cheeseman - email@hidden
_______________________________________________
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