Re: About applications remembering size



I believe the window manager should be responsible for saving window
size and state.  I have a spec and patch for Metacity to perform this
action somewhat reliably.  However, there are many problems with doing
this in a reliable manner.  (You can see the history of the patch and
the patch itself at: http://bugzilla.gnome.org/show_bug.cgi?id=91481 )

The problem description is pretty basic.  You need to save the following
pieces of state data:
	* Window position
	* Window size
	* Window is full screen
	* Window is maximized
	* Window is sticky

Next you need a way to uniquely identify a window.  There are several
ways of doing this, but I'll talk about this later.

Next you need a way to figure out when to apply, and when to save this
data.  Obviously if the user has specified a window size on the command
line, that size should be restored.  Also, if the user has not moved,
resized, maximized, or made the window sticky, there is no reason to
save any data.  Thus, changes should be saved only when the window state
has changed.  Also, if restoring state would place a window over another
window, window position should probably not be respected.

I decided to identify windows using this identifier:

class / name / role / number

where class and name are the two values set in WM_CLASS and role is
WM_WINDOW_ROLE.  Number is an interaction of the number of windows
matching this.  So if this is the fourth window on the screen with the
same class, name, and role, number will be 3.  

Havoc pointed out that applications should be able to override this
mechanism easily, so we added: _NET_WM_SAVE_ID which, when set to
nothing, makes no state be saved.  When set to any other value will use
that string as the unique identifier.  

As I said, this worked pretty well.  So what's wrong with it?  Well,
many recent Gnome applications set random strings as a role.  Thus, no
state will be saved, but memory and disk will be used trying to remember
all the bogus values.  GNOME-Terminal and GEdit are two offenders here. 
Next, Evolution developers thought that window SIZE should be remembered
for all similar windows.  (Thus, when you set the size of the composer
once, all the new composers will open with that size.)  Good idea, I
thought.  But that doesn't work for most apps.  

	Anyway, so I've let the patch sit there for a while until I can come up
with any better ideas.  Maybe the applications should do it themselves
after all.


On Mon, 2003-07-21 at 16:04, Christophe Fergeau wrote:
> > Is people going to fix the apps after we decide to standarize in some 
> > way? inclusion in the HIG?
> 
> One thing many app developers don't know for sure is who should be doing
> what (where who == the window manager, the app, ...). Some
> clarifications about that easily available on a website would be nice :)
> 
> Christophe
-- 
Benjamin Kahn <xkahn ximian com>




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