Re: Setting window position and size



On Wed, 2007-07-18 at 10:03 +0200, Jeffrey Ratcliffe wrote:
This is slightly off topic, but...

A couple of months ago, Debian started packaging my (Gtk2-Perl) scanning app.

The app saves and restores its window position, size and whether it is
maximised or not between sessions. A Debian developer has requested
that this be left to the window manager. What is the Right Way here?
I'm tempted to add an option whether to restore window settings.

there is no clear cut answer. many programs save their window state[1]
not because they don't trust the window managers, but because it's not
always the job of the window manager to remember options across
sessions. GTK+, as a toolkit, utilises the EWMH[2], so window managers
can actually force their own options even if you set some options
programmatically.

what you should save are the dimensions of your window, and whether the
window was maximised or not (both, so that the user can restore the
previous state).

also: *don't* *ever* *use* *gconf* for session data saving. use a key
file in a private directory (under $HOME/.gnome2), use xml, use a plain
text file where you serialise a geometry - pick your poison. but never
use gconf, because you can never know whether the user has a writable
gconf access or not.

ciao,
 Emmanuele.

+++

[1] nautilus, gedit, etc.
[2] extended window manager hints

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




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