[haiku-commits] Re: r39462 - in haiku/trunk: headers/os/app headers/private/app src/kits/app

  • From: "Clemens Zeidler" <clemens.zeidler@xxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 19 Nov 2010 10:08:54 +1300

Am 19.11.2010, 07:22 Uhr, schrieb Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:

clemens.zeidler@xxxxxxxxxxxxxx wrote:
Subclass implementations can use the global restore_window_geometry,
save_window_geometry function for convenience. Please review. Will
commit
a simple session manager tomorrow.

In addition to the comments from Ingo - why not just use the existing
archiving mechanism for this?
It should deliver all the needed functionality for this feature.


Yes at least for the Archive() part its sounds reasonable. I can just add the geometry part to the default BApplication Archive function. One disadvantage here is that in some cases the geometry data will be stored twice. Currently, the default SaveState uses the window tile as an id to store the geometry data. This id is not unique but for most application this works. In some cases one needs other ways to store the window info. In this case the developer has to overwrite the SaveState function and store the data in a app specific way. When using the Archive function one has to call the base Archive function so the geometry data would be stored twice, one time in the default way and one time in the app specific way.

I think, Instantiate can't be used to restore the app because it just creates an application object. Many programs just have a simple BApplication class and windows are initialized from the main function. If Instantiate would be used to create an BApplication object all these apps have to be adapted. Apps who create windows from outside of the BApplication wouldn't start probably when restoring them (windows just never would be created). So I think here one has to introduce at least a RestoreState hook function. (At the moment, the session manager starts application using the roster launch function passing the restore message at the same time. This message triggers the RestoreState hook.)

+++ haiku/trunk/src/kits/app/Application.cpp    2010-11-17 04:38:48 UTC
(rev 39462)
@@ -572,7 +615,9 @@
        // supposed to be implemented by subclasses
 }

+#include "ApplicationPrivate.h"

Don't use includes in the middle of files, they belong to the start of
a file unless you have very good reasons.


sorry was a left over

Regards,
        Clemens

Other related posts: