session management
Oswald Buddenhagen
ossi at kde.org
Sun Oct 26 09:44:38 UTC 2003
On Sat, Oct 25, 2003 at 10:03:32PM -0400, Pavel Roskin wrote:
> On Sat, 25 Oct 2003, Oswald Buddenhagen wrote:
> > in a "heavily x-windowed environment" you want session management. for
> > mc, that consists mostly of:
> > - the locations of both panels, including the the cursor position (yes,
> > i demand a lot :) (1)
>
> In fact, mc already saves too much for my liking if "auto save setup" is
> enabled. If I run new mc I don't want it to go where I left the previous
> instance.
>
generally i agree with that. but you're confusing the "poor man's
session management" that auto-saving is with proper session management.
they are two unrelated things (even though based on the same technology).
> > - an open viewer/editor, including state (position, options) specific to
> > that particular instance (2)
>
> I'm afraid I don't understand this.
>
you do ;)
> Currently, file positions are saved in one file, which is shared
> between all processes.
>
yes, and that's the problem. one state for multiple instances can't be
correct.
> If you are you saying that it's the session manages that should run mc
> and tell it what to do,
>
i do.
> I think it's insane.
>
but it's how session management works. the application is responsible
for saving and restoring its state itself, but the session manager
starts it and tells it which instance it is.
> > - that unsaved changes in an editor are not lost. i.e., a nice
> > yes/no/cancel dialog at shutdown time (3)
>
> Maybe it's a good idea, although I have never lost anything valuable by
> closing terminal with mc.
>
i never did as well. but that's because i always explicitly close all
windows before i end my session - but i do only, because i know that mc
does not have session management yet. i'd like to change that, i want to
simply press shift-alt-ctrl-del (logout without confirmation in kde :)
and have the system care for the rest.
> > mc is an x client, so theoretically xsmp can be used to do real session
> > management.
>
> Could you please post a link that would explain why session management is
> considered a good idea?
>
i consider this "challenge" a bit nonsensical ... ;}
> > in fact, (3) can be done perfectly, i think; even raising the correct
> > window for the dialog can be done, as all sane terminal emulators export
> > WINDOWID. getting notified about a shutdown and the ability to interrupt
> > it are part of xsmp.
>
> I'm not very good at X programming.
>
i'm either ...
> What mc do with the xterm window when a file is modified?
>
XRaiseWindow(mydpy, getenv("WINDOWID")) ...
uhmm, well
XSetInputFocus(mydpy, getenv("WINDOWID"), RevertToParent, CurrentTime);
is necessary as well, i think - a raised window without focus is not
really useful.
> How can it intercept closing its window?
>
not at all.
when a session shutdown is requested, the session manager first asks all
registered clients, whether this would be ok. xterm will of course say
yes, and we don't care - we would be a session management client
ourselves, so we are asked as well.
in the next phase the clients are asked to save their state, and to tell
the session manager the command needed to restart the application with
exactly that state - the latter would be a noop for us, as with the
wrapper script and the restart command xterm generated, we don't need to
provide our own restart command.
google for xsmp to get a full spec. if you are not that masochistic,
simply read the sources of gtk or qt or some other toolkit that provides
session management.
note that somebody simply clicking away the xterm window is no relevant
case for us. well, one could still do some crash recovery, but that
would be A Goog Thing (TM) independently of session management.
> > saving and restoring the status to implement (1) & (2) is quite simple
> > as well, it just requires some work. :)
>
> I believe that are more important things than that.
>
as always. i didn't say, that you need to implement this instantly.
> For example, proper support for UTF-8.
>
i can confirm that. ;)
greetings
--
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
More information about the mc-devel
mailing list