Page MenuHome

Window manager: window size/position persistence
Needs ReviewPublic

Authored by Andrew Williams (sobakasu) on Feb 12 2019, 12:04 AM.

Details

Summary

from D4291, this code saves window positions, sizes, and state (maximised/normal) to disk.

keeping the window positions/sizes saved separately from the blend file was a deliberate choice.

Note that functions that read and write to the wmWindowSize structure are in D4291, this code just reads and writes them to disk.

Diff Detail

Repository
rB Blender

Event Timeline

Campbell Barton (campbellbarton) requested changes to this revision.Feb 15 2019, 8:43 AM

Seems reasonable, I don't have a strong opinion on this, but storing window locations in a text file seems fine, as we do for bookmarks.

The patch isn't complete though.

source/blender/windowmanager/intern/wm_files.c
1085–1086

Could do some sanity checks here that the rectangle is a usable window size.

source/blender/windowmanager/wm_window.h
67

This function isn't available in master, could this patch become self contained.

This revision now requires changes to proceed.Feb 15 2019, 8:43 AM
Andrew Williams (sobakasu) edited the summary of this revision. (Show Details)
  • Updated diff so that it can be applied to master separately from D4291
  • Added sanity checks on window size when reading/writing window position preferences
Andrew Williams (sobakasu) marked 2 inline comments as done.Feb 17 2019, 2:10 AM

Sorry, but is it possible speedup patch review? With old Preferences dialogue and old open window their position was not so important. But in 2.81/2.82 modal window is default and always adjusting their size highly impact workflow speed.

Now I might have to be a bit of a party pooper again. I like the idea of remembering the window state, separated from the preferences and startup file (since this is system dependent data).
However I see this as a higher level issue than how it's being addressed here.

It's been an old idea to store system dependent data separated from preferences, workflow and project data. We should have some way of storing settings like:

  • Window configuration
  • Cycles/OpenSubdiv device defaults
  • OpenGL settings
  • Settings/overrides for usage of 3D-mice, pen tablet, HMD, ...

From the 2.8 UI workshop highlights post:

While storing a few things in text files might be fine, it adds a bit of overhead to our startup time. So better not go too far.

So basically my point is that we should look into a solution that allows storing more than just windows. If we want to keep compatibility, this isn't something we can easily change later on. So we have to consider these things now.

CCing @Brecht Van Lommel (brecht) here as lead architect.

I gave my opinion on this in D4291#98161, I don't think this will work correctly for opening arbitrary .blend files with different windows.

I don't see how storing the list of windows and their contents separately from their position and size can work predictably, they are closely tied.

Remembering this for temporary windows like preferences and the file browser window could work ok. I think we already remember the file browser size.

Position could be done too, but maybe only use it if the screen resolution (or some unique identifier) is the same. It's not that uncommon to switch monitors on a laptop for example, and this could put windows in strange positions.

Revising how to store system specific settings could be useful, but I'm not sure it helps for this particular problem.

Gotta agree with Brecht here. Reiterating over what I said earlier, the actual useful thing to store in the system configuration would be the monitor setup, so that we can do a smarter job at reopening windows when loading .blends.
E.g. if loading a .blend that was saved with some kind of temporary windows open in another monitor, we wouldn't reopen that window if only one monitor was plugged in.

So given the higher level design objections we have, I don't think this patch should be accepted. I'd love to see somebody work on the system configuration thing though.

This drives me nuts. I use a graphics tablet. Every time I go to open a file, like an image texture or whatever, i have to put down the pen and grab the mouse because the File window opens on a different monitor. So. Annoying.