Session Manager supports the ICCCM 1.1 WM_COMMAND
and WM_SAVE_YOURSELF
protocols, which permit:
Your application
to save state information at logout
Session Manager to restart your application at login
Session Manager also provides an API to assist your application
in saving and restoring its state at logout and login.
Session Manager is responsible for restarting applications
at login. To do this, your application must tell Session Manager
what command and command-line options are required to restart it.
Use Xlib's XSetCommand()
to set the WM_COMMAND property
on your application's top-level window.
When Session Manager saves a session, such as at logout, your
application might need to save some state information so it can
be restored to a similar state. Session Manager can optionally notify
your application that the session is being saved. Your application
must inform Session Manager that it wants such notification. It
does this by registering the WM_SAVE_YOURSELF
protocol with its top-level window WM_PROTOCOLS
property and setting up a callback procedure to handle the notification.
To do this, use the XmAddWMProtocols()
and XmAddWMProtocolsCallback()
functions. Your application should not interact with the user in
any way when processing the WM_SAVE_YOURSELF
callback. (For example, it should not display a Save As dialog box.)
It must set the WM_COMMAND
property on its top-level window to notify Session Manager that
it is done saving its state.
To enable your application to save state information, use
the DtSessionSavePath()
function to obtain the full path name of a file in which this information
can be saved. At session restore time, use the DtSessionRestorePath()
function to obtain the full path name of the state file your application
uses to restore its state.
The Common Desktop Environment Workspace Manager is responsible for
restoring an application's main top-level window (containing the
WM_COMMAND) property to the
proper workspace, geometry, and icon state. If an application has
multiple top-level windows, it is the application's responsibility
to restore the states of the other top-level windows. Refer to “Workspace
Manager” for additional
information.
Demo Programs |
 |
You can find the Session Manager demos in /usr/dt/examples/dtsession.
Read the README file for detailed
information on the demos.
For more information on Session Manager, see the relevant
man pages and the Programmer's Guide.