Window Resizing on Resolution Change
This post kicks off the "App Yups and Nopes" section in which I'll post both good and bad things I see applications doing. This differs from the other Yups and Nopes sections in that it talkes specifically about observed application behavior. My intent is to show why a specific behavior is undesirable, then present a solution.
In this situation, I connect my laptop to a projector to watch a movie. My screen resolution changes to match that of the projector. I see applications with the following behaviors:
– Nope: Resize application windows to fit on screen, regardless of window or application visibility.
The goal of resizing an application window on screen resolution change is to make sure the window is placed so that the user is able to manipulate it (move and resize.) An application is only required to resize and reposition windows that are actually visible. If a window is offscreen or the application is hidden, the window size and position should not be modified. When an offscreen window or a window of a hidden application is modified in this way, useless computation results. If the window cannot be seen, what use is there in constraining its bounds?
+ Yup: Resize application windows as they are made visible, making only the smallest change necessary to satisfy visibility and interaction requirements.
A common trick I use before connecting an external monitor of smaller resolution is to hide all applications -- for most applications this prevents their window state from being altered. In this way when I have finished using the projector, I can unhide these applications and continue using them with a window state identical to before the resolution change. This works great for applications that implement correct window resizing behavior. Most Cocoa applications do this correctly by default. Noted offenders are iTunes and iPhoto, both of which require me to pointlessly resize their windows after the resolution is restored.
Note also that only the height must be constrained to the visible screen height -- windows are allowed to be wider than the screen. Furthermore, it is not necessary to reposition the window such that its entire contents are visible -- windows can hang off the edge of the screen on the left and right sides. This, of course, becomes more complicated when multiple displays are attached as these restrictions change.