Window positioning and screen resizing

  • It seems that Cocoa or the OS or someone repositions my windows with some rules when the screen resolution changes. Does anyone know what the rules are? Stuff is kept in roughly the same quadrant of the screen, near as I can tell, and perhaps the offset within the quadrant is adjusted by some factor, but it seems to be repeatable (that is, windows don't crawl with repeated changes).

    Is this documented somewhere? I couldn't even think of how to search for this (my feeble attempts turned up nothing).

    --
    Rick
  • On May 13, 2013, at 5:57 PM, Rick Mann wrote:

    > It seems that Cocoa or the OS or someone repositions my windows with some rules when the screen resolution changes. Does anyone know what the rules are? Stuff is kept in roughly the same quadrant of the screen, near as I can tell, and perhaps the offset within the quadrant is adjusted by some factor, but it seems to be repeatable (that is, windows don't crawl with repeated changes).
    >
    > Is this documented somewhere? I couldn't even think of how to search for this (my feeble attempts turned up nothing).

    I can't imagine why it would be documented anywhere. Is there some reason you need to know what it's doing?

    --
    Seth Willits
  • On May 13, 2013, at 19:12 , Seth Willits <slists...> wrote:

    > I can't imagine why it would be documented anywhere. Is there some reason you need to know what it's doing?

    Yes. But I'm reluctant to talk about it just yet. In any case, it would be helpful to me to know.

    --
    Rick
  • On May 13, 2013, at 21:58 , Rick Mann <rmann...> wrote:

    > In any case, it would be helpful to me to know.

    So try it with a random sampling of 20 window sizes and positions, and log the window and screen frames before and after the screen change. If you post the results here on this list, someone may spot a pattern.
  • On May 13, 2013, at 7:57 PM, Rick Mann wrote:

    > It seems that Cocoa or the OS or someone repositions my windows with some rules when the screen resolution changes. Does anyone know what the rules are? Stuff is kept in roughly the same quadrant of the screen, near as I can tell, and perhaps the offset within the quadrant is adjusted by some factor, but it seems to be repeatable (that is, windows don't crawl with repeated changes).

    I believe the top-left corner is kept in the same relative position to the top-left corner of the screen, unless that would leave part of the window off-screen.  If it would, then the top-left corner is moved to get the window fully on-screen, unless the window is too large to fit entirely on screen.  In that case, the top-left corner is moved to a few pixels in from the top-left corner of the screen (excluding the menu bar).  I don't recall if the window is resized to fit on the screen or just left with its bottom and/or right side off the screen.

    > Is this documented somewhere? I couldn't even think of how to search for this (my feeble attempts turned up nothing).

    I could swear I've seen a rough description of this somewhere, but I'm not finding it now.

    Regards,
    Ken
  • On May 13, 2013, at 23:19 , Ken Thomases <ken...> wrote:

    > I believe the top-left corner is kept in the same relative position to the top-left corner of the screen, unless that would leave part of the window off-screen.  If it would, then the top-left corner is moved to get the window fully on-screen, unless the window is too large to fit entirely on screen.  In that case, the top-left corner is moved to a few pixels in from the top-left corner of the screen (excluding the menu bar).  I don't recall if the window is resized to fit on the screen or just left with its bottom and/or right side off the screen.

    Thanks, Ken. It seems like it keeps windows pegged to the nearest corner. I haven't tried it with windows larger than a screen quadrant, only a tiny window.

    --
    Rick
  • On 2013/05/14, at 9:57, Rick Mann <rmann...> wrote:

    > It seems that Cocoa or the OS or someone repositions my windows with some rules when the screen resolution changes. Does anyone know what the rules are? Stuff is kept in roughly the same quadrant of the screen, near as I can tell, and perhaps the offset within the quadrant is adjusted by some factor, but it seems to be repeatable (that is, windows don't crawl with repeated changes).
    >
    > Is this documented somewhere? I couldn't even think of how to search for this (my feeble attempts turned up nothing).
    >
    > --
    > Rick
    >
    >

    NSApplication class has a notification you can observe:

    NSApplicationDidChangeScreenParametersNotification

    Posted when the configuration of the displays attached to the computer is changed.
    The configuration change can be made either programmatically or when the user changes settings in the Displays control panel. The notification object is sharedApplication. This notification does not contain a userInfo dictionary.

    Then you can respond according to your app's needs.
    Presumably, you should not rely on or infer the logic of what the system does for you, but rather just respond as appropriate for your own needs.
  • On May 14, 2013, at 00:09 , John Joyce <dangerwillrobinsondanger...> wrote:

    > Presumably, you should not rely on or infer the logic of what the system does for you, but rather just respond as appropriate for your own needs.

    Thanks, John. I'm fairly familiar, at this point, with the various screen change notifications available. It's just that if I want to take action when the screen changes, I don't want to be fighting with the OS to position my windows.

    --
    Rick
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today