On Tue, 19 Mar 2013 05:34:31 +1300, Ryan Leavengood <leavengood@xxxxxxxxx> wrote:
On Mon, Mar 18, 2013 at 12:11 PM, John Scipione <jscipione@xxxxxxxxx> wrote:If I do one by one this way I'll create a bunch of settings files in home/config just for storing window positions... this seems less than elegant to me. I'm hoping for a more thoughtful solution to this problem.This is essentially session management, which I believe Clemens has worked on, but did not completely finish. I think before you do it "the hard way", we should consider if some sort of partial and simple session management could be implemented as a starting point. Something which just stores window positions with the same sort of logic you implemented in the Deskbar preferences window, but at the system level.
as Axel said, don't know if all window positions should always be stored. However, in case you want to restore the state of a whole application you can use something similar to:
https://github.com/czeidler/haiku/blob/SessionManager/src/kits/app/Application.cppstatus_t BApplication::RestoreState(const BMessage* state, const BApplicationState* storage) status_t BApplication::SaveState(BMessage* state, BApplicationState* storage) const
there are also some helper functions in this file: save_window_geometry restore_window_geometry(just saw that checking the screen boundaries in restore_window_geometry is broken...)
btw. the session manager should be functional. However, some applications should implement {Save,Restore}State to do a real test. The default implementation just stores the window position of all windows of an applications. However, in general that does not work very well and the application has to implement its own version...
Cheers, Clemens