Re: Preserved Window Placement



On Wed, Oct 24, 2012 at 2:27 PM, Federico Mena Quintero <federico gnome org> wrote:

Disclaimer/introduction:  In the past I've said that saving window
geometries is the job of the window manager and shouldn't be done by
applications.  THIS IS WRONG.  I retract myself.  Applications should be
responsible for saving their own window geometries.


YES. Federico has it right. Apps: implement it please. ;-)

  char *gtk_window_get_geometry_string (GtkWindow *window);
  gtk_window_restore_geometry_from_string (GtkWindow *window, char *s);

This could be even higher-level in fact. All the app "must" do is specify which windows are "the same" from invocation to invocation. That is the fundamental problem (what is the "key" we are saving the window state underneath).  gtk_window_set_state_key() ? At that point GTK+ (in cooperation with the desktop e.g. WM, if you like) can do the actual saving.

I know there are old threads about this somewhere but google is failing me right now.
 
Then, the "only" problems from the application's point of view is
saving/restoring those geometries at the right time, saving the
(hopefully opaque) strings in the right place, garbage-collecting old
settings, doing something useful when the expected monitor size is
different from the current monitor size, doing something reasonable when
you have two instances of the same application...

GTK+ (possibly cooperating with other components) could in theory deal with all of this, as long as it has an identifying key to know which newly-created windows match some previously-saved window state, and which newly-created windows should start fresh or not save at all.

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]