<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.trinitydesktop.net/index.php?action=history&amp;feed=atom&amp;title=Session_Management_Protocol_%28KDE3_Architecture%29</id>
	<title>Session Management Protocol (KDE3 Architecture) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.trinitydesktop.net/index.php?action=history&amp;feed=atom&amp;title=Session_Management_Protocol_%28KDE3_Architecture%29"/>
	<link rel="alternate" type="text/html" href="https://wiki.trinitydesktop.net/index.php?title=Session_Management_Protocol_(KDE3_Architecture)&amp;action=history"/>
	<updated>2026-05-24T23:54:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.13</generator>
	<entry>
		<id>https://wiki.trinitydesktop.net/index.php?title=Session_Management_Protocol_(KDE3_Architecture)&amp;diff=2246&amp;oldid=prev</id>
		<title>Blu256: + KDE3</title>
		<link rel="alternate" type="text/html" href="https://wiki.trinitydesktop.net/index.php?title=Session_Management_Protocol_(KDE3_Architecture)&amp;diff=2246&amp;oldid=prev"/>
		<updated>2022-04-21T16:29:10Z</updated>

		<summary type="html">&lt;p&gt;+ KDE3&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:29, 21 April 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-addedline diff-side-added&quot;&gt;&lt;div&gt;{{KDE3}}&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-addedline diff-side-added&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-context diff-side-deleted&quot;&gt;&lt;div&gt;KDE, since version 2.0, supports and uses the standard X11R6 session management&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-context diff-side-added&quot;&gt;&lt;div&gt;KDE, since version 2.0, supports and uses the standard X11R6 session management&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-context diff-side-deleted&quot;&gt;&lt;div&gt;protocol XSMP. The official documentation of the standard can be&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-context diff-side-added&quot;&gt;&lt;div&gt;protocol XSMP. The official documentation of the standard can be&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Blu256</name></author>
	</entry>
	<entry>
		<id>https://wiki.trinitydesktop.net/index.php?title=Session_Management_Protocol_(KDE3_Architecture)&amp;diff=653&amp;oldid=prev</id>
		<title>imported&gt;Eliddell: Created page with &quot;KDE, since version 2.0, supports and uses the standard X11R6 session management protocol XSMP. The official documentation of the standard can be download from the X Consortium...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.trinitydesktop.net/index.php?title=Session_Management_Protocol_(KDE3_Architecture)&amp;diff=653&amp;oldid=prev"/>
		<updated>2014-06-10T21:22:40Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;KDE, since version 2.0, supports and uses the standard X11R6 session management protocol XSMP. The official documentation of the standard can be download from the X Consortium...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;KDE, since version 2.0, supports and uses the standard X11R6 session management&lt;br /&gt;
protocol XSMP. The official documentation of the standard can be&lt;br /&gt;
download from the X Consortium&amp;#039;s FTP server [http://stuff.mit.edu/afs/sipb/contrib/doc/X11/hardcopy/SM/xsmp.PS.gz ftp.x.org].&lt;br /&gt;
&lt;br /&gt;
KDE also supports the legacy X11R4 and ICCCM session&lt;br /&gt;
management protocols.  Legacy applications that define the &amp;lt;tt&amp;gt;WM_COMMAND&amp;lt;/tt&amp;gt;&lt;br /&gt;
property or support the &amp;lt;tt&amp;gt;WM_SAVE_YOURSELF&amp;lt;/tt&amp;gt; protocol will be restarted&lt;br /&gt;
with the specified command.  The window geometries will be restored on a best&lt;br /&gt;
effort basis.&lt;br /&gt;
&lt;br /&gt;
Unlike these legacy protocols, the new X11R6 session management gives a&lt;br /&gt;
chance to save application dependent settings when you log out.  A text&lt;br /&gt;
editor, for instance, would save the names of the loaded files and would&lt;br /&gt;
reload them when you log in again.  Another major advantage of the new&lt;br /&gt;
protocol is the support for a clean and safe logout procedure even if the&lt;br /&gt;
users decides not to restore the session next time. The protocol gives&lt;br /&gt;
applications the possibility to interact with the user in case they are in&lt;br /&gt;
danger to lose some data, and to cancel the shutdown process if necessary.&lt;br /&gt;
&lt;br /&gt;
An introductive overview of session management functionality and&lt;br /&gt;
the Qt API for it is available from [https://web.archive.org/web/20090119223949/http://doc.trolltech.com/3.3/session.html doc.trolltech.com].&lt;br /&gt;
&lt;br /&gt;
In KDE, the classes [http://api.kde.org/3.5-api/kdelibs-apidocs/kdecore/html/classKApplication.html KApplication]&lt;br /&gt;
and [http://api.kde.org/3.5-api/kdelibs-apidocs/kdeui/html/classKMainWindow.html KMainWindow]&lt;br /&gt;
hide all the ugly details from the programmer. Basically, a&lt;br /&gt;
KApplication manages a KConfig configuration object sessionConfig()&lt;br /&gt;
for you, that your application can utilize to store session specific data.&lt;br /&gt;
&lt;br /&gt;
Please read the respective class documentation, especially the one of&lt;br /&gt;
KMainWindow, for a detailed interface description. With the advanced&lt;br /&gt;
functionality in KMainWindow, it&amp;#039;s really just a matter of a few lines&lt;br /&gt;
to get even a multi-window application to retains its state between&lt;br /&gt;
different user sessions.&lt;br /&gt;
&lt;br /&gt;
Here&amp;#039;s just a brief overview how things are done. Again, see the&lt;br /&gt;
respective class documentation for details. Imagine you have an&lt;br /&gt;
application with a main window MyWindow inherited from KMainWindow. In&lt;br /&gt;
your main() function, you would then create/restore the application&lt;br /&gt;
windows with something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
if (kapp-&amp;gt;isRestored()) {&lt;br /&gt;
  RESTORE(MyWindow)&lt;br /&gt;
} else {&lt;br /&gt;
  // create default application as usual&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and reimplement the store/restore handlers in MyWindow to save and&lt;br /&gt;
restore all additional settings. For a text editor, that would be the&lt;br /&gt;
loaded files, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
void MyWindow::saveProperties( KConfig* ) {&lt;br /&gt;
  // save properties here&lt;br /&gt;
}&lt;br /&gt;
void MyWindow::readProperties( KConfig* ) {&lt;br /&gt;
  // read properties here&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that standard settings like window sizes, toolbar settings&lt;br /&gt;
etc. are automatically handled by the system. &lt;br /&gt;
&lt;br /&gt;
With KMainWindow::classNameOfToplevel(), it is also possible to&lt;br /&gt;
restore different types of toplevel windows within one application. In&lt;br /&gt;
that case, the RESTORE macro is too primitive, use something like this&lt;br /&gt;
in your main() function instead:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp-qt&amp;quot;&amp;gt;&lt;br /&gt;
if (kapp-&amp;gt;isRestored()){&lt;br /&gt;
  int n = 1;&lt;br /&gt;
  while (KMainWindow::canBeRestored(n)) {&lt;br /&gt;
    if ( KMainWindow::classNameOfToplevel(n) == &amp;quot;MyWindow1&amp;quot; )&lt;br /&gt;
      (new MyWindow1)-&amp;gt;restore(n);&lt;br /&gt;
    else if ( KMainWindow::classNameOfToplevel(n) == &amp;quot;MyWindow2&amp;quot; )&lt;br /&gt;
      (new MyWindow2)-&amp;gt;restore(n);&lt;br /&gt;
    // and so on....&lt;br /&gt;
    n++;&lt;br /&gt;
  }&lt;br /&gt;
} else {&lt;br /&gt;
  // create default application as usual&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The session management server in KDE is called &amp;#039;&amp;#039;&amp;#039;ksmserver&amp;#039;&amp;#039;&amp;#039; and it is&lt;br /&gt;
part of the &amp;#039;&amp;#039;&amp;#039;kdebase&amp;#039;&amp;#039;&amp;#039; package.  The server interacts with the KDE window&lt;br /&gt;
manager &amp;#039;&amp;#039;&amp;#039;kwin&amp;#039;&amp;#039;&amp;#039; to save and restore the window geometries and to perform&lt;br /&gt;
legacy session management.  To make session management work, &amp;#039;&amp;#039;&amp;#039;ksmserver&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
has to be started as last process of the X login procedure. This happens&lt;br /&gt;
automatically at the end of the &amp;#039;&amp;#039;&amp;#039;startkde&amp;#039;&amp;#039;&amp;#039; script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Initial Author:&amp;#039;&amp;#039; [mailto:ettrich@kde.org Matthias Ettrich]&lt;br /&gt;
&lt;br /&gt;
[[Category:KDE3]]&lt;br /&gt;
[[Category:Architecture]]&lt;br /&gt;
[[Category:Developers]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Eliddell</name></author>
	</entry>
</feed>