summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenedikt Meurer <benny@xfce.org>2004-05-26 12:57:00 +0000
committerBenedikt Meurer <benny@xfce.org>2004-05-26 12:57:00 +0000
commitfc8881affb5e7e2d7e30efbecafaaceda0cfb31c (patch)
tree1aeb2a3505cf922a5c3d2a8d60cd60dc2db00601
parent52c89fea8f467172ab530a923a11eade4b5dca6b (diff)
downloadxfce4-session-fc8881affb5e7e2d7e30efbecafaaceda0cfb31c.tar.gz
Renamed shutdown() -> xfsm_shutdown(), since it causes trouble with
functions, that use the libc shutdown(), like XCloseDisplay, really a weird bug. Added legacy session management based upon the one found in ksmserver. So from now on, do NOT EVER run smproxy, or you will be assimilated :-). (Old svn revision: 4581)
-rw-r--r--AUTHORS2
-rw-r--r--BUGS3
-rw-r--r--ChangeLog79
-rw-r--r--README16
-rw-r--r--config.h.in15
-rwxr-xr-xconfigure116
-rw-r--r--configure.ac19
-rw-r--r--xfce4-session/Makefile.am2
-rw-r--r--xfce4-session/Makefile.in29
-rw-r--r--xfce4-session/main.c2
-rw-r--r--xfce4-session/shutdown.c16
-rw-r--r--xfce4-session/shutdown.h2
-rw-r--r--xfce4-session/xfsm-compat-kde.c4
-rw-r--r--xfce4-session/xfsm-compat-kde.h2
-rw-r--r--xfce4-session/xfsm-legacy.c571
-rw-r--r--xfce4-session/xfsm-legacy.h34
-rw-r--r--xfce4-session/xfsm-manager.c13
17 files changed, 859 insertions, 66 deletions
diff --git a/AUTHORS b/AUTHORS
index f49abfaa..3db94b2d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
Benedikt Meurer <benny@xfce.org>
Oliver M. Bolzer <oliver@debian.org>
-Parts of the code were copied from gnome-session.
+Parts of the code were copied from gnome-session and ksmserver.
diff --git a/BUGS b/BUGS
index e17cbecc..e01725c5 100644
--- a/BUGS
+++ b/BUGS
@@ -1,6 +1,3 @@
-* xfce4-session does no longer work with smproxy. We have to write our own
- multihead-safe smproxy replacement.
-
* Make the logout dialog icon themable through GtkIconTheme
* Fix leftover Xinerama bugs in XfsmSplashScreen.
diff --git a/ChangeLog b/ChangeLog
index a0b8d772..f88a8740 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,82 @@
+2004-05-25 23:29 benny
+
+ * Makefile.in, config.h.in, configure, configure.ac,
+ xfce4-session.spec.in, defaults/Makefile.in, docs/Makefile.in,
+ settings/Makefile.in, settings/looknfeel.c, settings/session.c,
+ themes/Makefile.in, themes/Default/Makefile.in,
+ xfce4-session/Makefile.am, xfce4-session/Makefile.in,
+ xfce4-session/main.c, xfce4-session/shutdown.c,
+ xfce4-session/xfsm-compat-gnome.c,
+ xfce4-session/xfsm-compat-gnome.h, xfce4-session/xfsm-compat-kde.c,
+ xfce4-session/xfsm-compat-kde.h, xfce4-session/xfsm-global.c,
+ xfce4-session/xfsm-global.h, xfce4-session/xfsm-splash-screen.c,
+ xfce4-session/xfsm-startup.c, xfsm-shutdown-helper/Makefile.in:
+ Added Gnome compatibility. Improved KDE compatibility (Konqueror
+ seems somewhat broken, though, dunno why). Some cosmetic fixes on
+ the splash screen (avoid flicker, same y pos for all texts).
+
+2004-05-25 20:07 benny
+
+ * TODO, settings/Makefile.am, settings/Makefile.in,
+ settings/gnome-uri.c, settings/gnome-uri.h, settings/looknfeel.c,
+ settings/looknfeel.h, settings/session.c, settings/settings.h,
+ settings/xfce-session-settings.desktop,
+ settings/xfsm-install-theme, xfce4-session/xfsm-startup.c: Enable
+ installation of new themes by dragging&dropping a theme from a file
+ manager (tested with rox so far) to the theme treeview, currently
+ only theme directories (that are directories that contain a subdir
+ "xfsm4" and atleast a file "xfsm4/themerc") and theme tarballs
+ (actuall .tar.gz, which contents match the theme directory layout
+ described above) are supported. The "installation" of the theme is
+ done using the xfsm-install-theme script, so it should be easy to
+ add support for further "file formats", just send me a patch (but
+ remember that the stuff has to be plattform-independend, so no
+ bashism or GNUism).
+
+2004-05-25 14:27 pollux
+
+ * settings/session.c: when enlarging settings window, the Security
+ frame stay close to the Compatibility one
+
+2004-05-25 00:34 benny
+
+ * xfce4-session/xfsm-startup.c: Added some KDE application names.
+
+2004-05-25 00:25 benny
+
+ * settings/session.c, xfce4-session/xfsm-manager.c,
+ xfce4-session/xfsm-splash-screen.c, xfce4-session/xfsm-startup.c,
+ xfce4-session/xfsm-startup.h: Initial KDE support, will be improved
+ further soon.
+
+2004-05-24 23:57 benny
+
+ * BUGS, settings/Makefile.am, settings/Makefile.in,
+ settings/session.c, themes/Default/skip_icon.png,
+ themes/Default/skip_icon.svg, themes/Default/themerc,
+ xfce4-session/main.c, xfce4-session/shutdown.c,
+ xfce4-session/xfsm-splash-theme.c,
+ xfce4-session/xfsm-splash-theme.h: Mo[e]dified the settings dialog
+ based on some ideas I discussed with Moe. Changed the skip icon to
+ the new icon from Francois.
+
+2004-05-24 19:25 benny
+
+ * themes/Default/themerc: Francois prefers this gradient :-)
+
+2004-05-24 18:12 benny
+
+ * BUGS, ChangeLog, themes/Default/Makefile.am,
+ themes/Default/Makefile.in, themes/Default/chooser_icon.png,
+ themes/Default/chooser_icon.svg, themes/Default/logo.png,
+ themes/Default/skip_icon.png, themes/Default/skip_icon.svg,
+ themes/Default/themerc, xfce4-session/xfsm-fadeout.c,
+ xfce4-session/xfsm-splash-screen.c,
+ xfce4-session/xfsm-splash-theme.c,
+ xfce4-session/xfsm-splash-theme.h: New splash theme file format.
+ Added gradient option for bgcolor and focolor, as per Francois'
+ request. New default theme based on the one by Francois.
+
2004-05-22 08:52 benny
* xfce4-session/shutdown.c: Fix #200, using the gtk auth icon only
diff --git a/README b/README
index 50c60569..c368c264 100644
--- a/README
+++ b/README
@@ -15,3 +15,19 @@ $libexecdir/xfsm-shutdown-helper as user root (where $libexecdir is the
libexec subdir in the prefix you installed xfce4-session, for example
/usr/local/libexec).
+
+Legacy session management:
+--------------------------
+As of version 4.1.7, the session manager includes native support for
+applications that don't support the X11R6 session management protocol,
+but support legacy (X11R5) session management. If you don't need legacy
+session management support, you can disable it at compile time, giving
+--disable-legacy-sm to ./configure.
+
+The legacy sm code is ment as a replacement for smproxy (the X11 session
+management proxy), which caused all kinds of trouble. That says, do NOT
+EVER run smproxy in session that is managed by xfce4-session, or weird
+things will happen. The included legacy session management does everything
+that smproxy would do, and besides that, it also support multiscreen
+display and it is less error prone compared to smproxy (atleast once
+the various bugs I introduced are fixed :-).
diff --git a/config.h.in b/config.h.in
index 2b5ed5bd..21c810f7 100644
--- a/config.h.in
+++ b/config.h.in
@@ -18,9 +18,6 @@
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#undef HAVE_BIND_TEXTDOMAIN_CODESET
-/* Define to 1 if you have the `clearenv' function. */
-#undef HAVE_CLEARENV
-
/* Define to 1 if you have the `dcgettext' function. */
#undef HAVE_DCGETTEXT
@@ -60,9 +57,6 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
-/* Define to 1 if you have the `mkdir' function. */
-#undef HAVE_MKDIR
-
/* Define to 1 if you have the `sigaction' function. */
#undef HAVE_SIGACTION
@@ -87,6 +81,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the `sync' function. */
+#undef HAVE_SYNC
+
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
@@ -96,6 +93,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
@@ -111,6 +111,9 @@
/* Define to 1 if you have the `_IceTransNoListen' function. */
#undef HAVE__ICETRANSNOLISTEN
+/* Define for X11R5 sm compat */
+#undef LEGACY_SESSION_MANAGEMENT
+
/* Name of package */
#undef PACKAGE
diff --git a/configure b/configure
index a88d7557..98520c96 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.ac Id: configure.ac,v 1.45 2004/05/20 20:45:27 benny Exp .
+# From configure.ac Id: configure.ac,v 1.46 2004/05/25 21:29:03 benny Exp .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for xfce4-session 4.1.6.
+# Generated by GNU Autoconf 2.59 for xfce4-session 4.1.7.
#
# Report bugs to <xfce4-dev@xfce.org>.
#
@@ -429,8 +429,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='xfce4-session'
PACKAGE_TARNAME='xfce4-session'
-PACKAGE_VERSION='4.1.6'
-PACKAGE_STRING='xfce4-session 4.1.6'
+PACKAGE_VERSION='4.1.7'
+PACKAGE_STRING='xfce4-session 4.1.7'
PACKAGE_BUGREPORT='xfce4-dev@xfce.org'
# Factoring default headers for most tests.
@@ -959,7 +959,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures xfce4-session 4.1.6 to adapt to many kinds of systems.
+\`configure' configures xfce4-session 4.1.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1029,7 +1029,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xfce4-session 4.1.6:";;
+ short | recursive ) echo "Configuration of xfce4-session 4.1.7:";;
esac
cat <<\_ACEOF
@@ -1060,6 +1060,8 @@ Optional Features:
(default)
--enable-asserts Enable assert statements (default)
--disable-asserts Disable assert statements (USE WITH CARE!!!)
+ --enable-legacy-sm Enable X11R5 session management
+ --disable-legacy-sm Disable X11R5 session management
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1189,7 +1191,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-xfce4-session configure 4.1.6
+xfce4-session configure 4.1.7
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1208,7 +1210,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by xfce4-session $as_me 4.1.6, which was
+It was created by xfce4-session $as_me 4.1.7, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1547,7 +1549,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-XFSM_VERSION=4.1.6
+XFSM_VERSION=4.1.7
am__api_version="1.8"
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
@@ -5423,7 +5425,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5426 "configure"' > conftest.$ac_ext
+ echo '#line 5428 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -6515,7 +6517,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:6518:" \
+echo "$as_me:6520:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -7542,11 +7544,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7545: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7547: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7549: \$? = $ac_status" >&5
+ echo "$as_me:7551: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -7774,11 +7776,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7777: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7779: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7781: \$? = $ac_status" >&5
+ echo "$as_me:7783: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -7841,11 +7843,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7844: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7846: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7848: \$? = $ac_status" >&5
+ echo "$as_me:7850: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -9226,7 +9228,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 9229 "configure"' > conftest.$ac_ext
+ echo '#line 9231 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -10008,7 +10010,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10011 "configure"
+#line 10013 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10106,7 +10108,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10109 "configure"
+#line 10111 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12258,11 +12260,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12261: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12263: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:12265: \$? = $ac_status" >&5
+ echo "$as_me:12267: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -12325,11 +12327,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12328: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:12330: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:12332: \$? = $ac_status" >&5
+ echo "$as_me:12334: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -12896,7 +12898,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 12899 "configure"' > conftest.$ac_ext
+ echo '#line 12901 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -13678,7 +13680,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 13681 "configure"
+#line 13683 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13776,7 +13778,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 13779 "configure"
+#line 13781 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14598,11 +14600,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14601: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14603: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14605: \$? = $ac_status" >&5
+ echo "$as_me:14607: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -14665,11 +14667,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14668: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14670: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14672: \$? = $ac_status" >&5
+ echo "$as_me:14674: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16030,7 +16032,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 16033 "configure"' > conftest.$ac_ext
+ echo '#line 16035 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -16676,11 +16678,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16679: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16681: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16683: \$? = $ac_status" >&5
+ echo "$as_me:16685: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -16908,11 +16910,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16911: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16913: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16915: \$? = $ac_status" >&5
+ echo "$as_me:16917: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@@ -16975,11 +16977,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16978: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16980: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16982: \$? = $ac_status" >&5
+ echo "$as_me:16984: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -18360,7 +18362,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 18363 "configure"' > conftest.$ac_ext
+ echo '#line 18365 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -19142,7 +19144,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 19145 "configure"
+#line 19147 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19240,7 +19242,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 19243 "configure"
+#line 19245 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20416,8 +20418,7 @@ fi
-
-for ac_func in mkdir clearenv sigaction strdup
+for ac_func in sigaction strdup sync
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -20528,8 +20529,9 @@ done
+
for ac_header in errno.h fcntl.h limits.h signal.h stdarg.h sys/param.h \
- sys/resource.h sys/wait.h time.h unistd.h
+ sys/resource.h sys/time.h sys/wait.h time.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -24545,6 +24547,28 @@ _ACEOF
fi
+# Check whether --enable-legacy-sm or --disable-legacy-sm was given.
+if test "${enable_legacy_sm+set}" = set; then
+ enableval="$enable_legacy_sm"
+
+else
+ enable_legacy_sm=yes
+fi;
+echo "$as_me:$LINENO: checking whether to enable X11R5 session management" >&5
+echo $ECHO_N "checking whether to enable X11R5 session management... $ECHO_C" >&6
+if test x"$enable_legacy_sm" != x"yes"; then
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define LEGACY_SESSION_MANAGEMENT 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+fi
+
echo "$as_me:$LINENO: checking for custom 'poweroff' command" >&5
echo $ECHO_N "checking for custom 'poweroff' command... $ECHO_C" >&6
@@ -25004,7 +25028,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by xfce4-session $as_me 4.1.6, which was
+This file was extended by xfce4-session $as_me 4.1.7, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -25067,7 +25091,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-xfce4-session config.status 4.1.6
+xfce4-session config.status 4.1.7
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 3f52408c..816da0f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl
dnl Version information
m4_define([xfsm_version_major], [4])
m4_define([xfsm_version_minor], [1])
-m4_define([xfsm_version_micro], [6])
+m4_define([xfsm_version_micro], [7])
m4_define([xfsm_version], [xfsm_version_major.xfsm_version_minor.xfsm_version_micro])
dnl Initialize autoconf
@@ -39,9 +39,9 @@ AC_PROG_LIBTOOL
dnl check for standard header files
AC_HEADER_STDC
-AC_CHECK_FUNCS([mkdir clearenv sigaction strdup])
+AC_CHECK_FUNCS([sigaction strdup sync])
AC_CHECK_HEADERS([errno.h fcntl.h limits.h signal.h stdarg.h sys/param.h \
- sys/resource.h sys/wait.h time.h unistd.h])
+ sys/resource.h sys/time.h sys/wait.h time.h unistd.h])
dnl Check for X11 installed
BM_LIBX11_REQUIRE
@@ -80,6 +80,19 @@ if test x"$SUDO" != x""; then
AC_DEFINE_UNQUOTED([SUDO_CMD], ["$SUDO"], [path to sudo])
fi
+dnl Check for legacy session management
+AC_ARG_ENABLE([legacy-sm],
+AC_HELP_STRING([--enable-legacy-sm], [Enable X11R5 session management])
+AC_HELP_STRING([--disable-legacy-sm], [Disable X11R5 session management]),
+ [], [enable_legacy_sm=yes])
+AC_MSG_CHECKING([whether to enable X11R5 session management])
+if test x"$enable_legacy_sm" != x"yes"; then
+ AC_MSG_RESULT([no])
+else
+ AC_DEFINE([LEGACY_SESSION_MANAGEMENT], [1], [Define for X11R5 sm compat])
+ AC_MSG_RESULT([yes])
+fi
+
dnl
dnl arguments to set shutdown commands
dnl
diff --git a/xfce4-session/Makefile.am b/xfce4-session/Makefile.am
index e8955056..8ad45759 100644
--- a/xfce4-session/Makefile.am
+++ b/xfce4-session/Makefile.am
@@ -23,6 +23,8 @@ xfce4_session_SOURCES = \
xfsm-fadeout.h \
xfsm-global.c \
xfsm-global.h \
+ xfsm-legacy.c \
+ xfsm-legacy.h \
xfsm-manager.c \
xfsm-manager.h \
xfsm-properties.c \
diff --git a/xfce4-session/Makefile.in b/xfce4-session/Makefile.in
index 89257294..8ffdfd21 100644
--- a/xfce4-session/Makefile.in
+++ b/xfce4-session/Makefile.in
@@ -61,6 +61,7 @@ am_xfce4_session_OBJECTS = xfce4_session-ice-layer.$(OBJEXT) \
xfce4_session-xfsm-compat-kde.$(OBJEXT) \
xfce4_session-xfsm-fadeout.$(OBJEXT) \
xfce4_session-xfsm-global.$(OBJEXT) \
+ xfce4_session-xfsm-legacy.$(OBJEXT) \
xfce4_session-xfsm-manager.$(OBJEXT) \
xfce4_session-xfsm-properties.$(OBJEXT) \
xfce4_session-xfsm-shutdown-helper.$(OBJEXT) \
@@ -83,6 +84,7 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4_session-xfsm-compat-kde.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4_session-xfsm-fadeout.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4_session-xfsm-global.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/xfce4_session-xfsm-legacy.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4_session-xfsm-manager.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4_session-xfsm-properties.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/xfce4_session-xfsm-shutdown-helper.Po \
@@ -270,6 +272,8 @@ xfce4_session_SOURCES = \
xfsm-fadeout.h \
xfsm-global.c \
xfsm-global.h \
+ xfsm-legacy.c \
+ xfsm-legacy.h \
xfsm-manager.c \
xfsm-manager.h \
xfsm-properties.c \
@@ -388,6 +392,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4_session-xfsm-compat-kde.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4_session-xfsm-fadeout.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4_session-xfsm-global.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4_session-xfsm-legacy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4_session-xfsm-manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4_session-xfsm-properties.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfce4_session-xfsm-shutdown-helper.Po@am__quote@
@@ -660,6 +665,30 @@ xfce4_session-xfsm-global.lo: xfsm-global.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -c -o xfce4_session-xfsm-global.lo `test -f 'xfsm-global.c' || echo '$(srcdir)/'`xfsm-global.c
+xfce4_session-xfsm-legacy.o: xfsm-legacy.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -MT xfce4_session-xfsm-legacy.o -MD -MP -MF "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo" -c -o xfce4_session-xfsm-legacy.o `test -f 'xfsm-legacy.c' || echo '$(srcdir)/'`xfsm-legacy.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo" "$(DEPDIR)/xfce4_session-xfsm-legacy.Po"; else rm -f "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xfsm-legacy.c' object='xfce4_session-xfsm-legacy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfce4_session-xfsm-legacy.Po' tmpdepfile='$(DEPDIR)/xfce4_session-xfsm-legacy.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -c -o xfce4_session-xfsm-legacy.o `test -f 'xfsm-legacy.c' || echo '$(srcdir)/'`xfsm-legacy.c
+
+xfce4_session-xfsm-legacy.obj: xfsm-legacy.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -MT xfce4_session-xfsm-legacy.obj -MD -MP -MF "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo" -c -o xfce4_session-xfsm-legacy.obj `if test -f 'xfsm-legacy.c'; then $(CYGPATH_W) 'xfsm-legacy.c'; else $(CYGPATH_W) '$(srcdir)/xfsm-legacy.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo" "$(DEPDIR)/xfce4_session-xfsm-legacy.Po"; else rm -f "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xfsm-legacy.c' object='xfce4_session-xfsm-legacy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfce4_session-xfsm-legacy.Po' tmpdepfile='$(DEPDIR)/xfce4_session-xfsm-legacy.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -c -o xfce4_session-xfsm-legacy.obj `if test -f 'xfsm-legacy.c'; then $(CYGPATH_W) 'xfsm-legacy.c'; else $(CYGPATH_W) '$(srcdir)/xfsm-legacy.c'; fi`
+
+xfce4_session-xfsm-legacy.lo: xfsm-legacy.c
+@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -MT xfce4_session-xfsm-legacy.lo -MD -MP -MF "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo" -c -o xfce4_session-xfsm-legacy.lo `test -f 'xfsm-legacy.c' || echo '$(srcdir)/'`xfsm-legacy.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo" "$(DEPDIR)/xfce4_session-xfsm-legacy.Plo"; else rm -f "$(DEPDIR)/xfce4_session-xfsm-legacy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xfsm-legacy.c' object='xfce4_session-xfsm-legacy.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/xfce4_session-xfsm-legacy.Plo' tmpdepfile='$(DEPDIR)/xfce4_session-xfsm-legacy.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -c -o xfce4_session-xfsm-legacy.lo `test -f 'xfsm-legacy.c' || echo '$(srcdir)/'`xfsm-legacy.c
+
xfce4_session-xfsm-manager.o: xfsm-manager.c
@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xfce4_session_CFLAGS) $(CFLAGS) -MT xfce4_session-xfsm-manager.o -MD -MP -MF "$(DEPDIR)/xfce4_session-xfsm-manager.Tpo" -c -o xfce4_session-xfsm-manager.o `test -f 'xfsm-manager.c' || echo '$(srcdir)/'`xfsm-manager.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xfce4_session-xfsm-manager.Tpo" "$(DEPDIR)/xfce4_session-xfsm-manager.Po"; else rm -f "$(DEPDIR)/xfce4_session-xfsm-manager.Tpo"; exit 1; fi
diff --git a/xfce4-session/main.c b/xfce4-session/main.c
index 6d27f02e..3fa6d8c8 100644
--- a/xfce4-session/main.c
+++ b/xfce4-session/main.c
@@ -292,5 +292,5 @@ main (int argc, char **argv)
ice_cleanup ();
- return shutdown (shutdown_type);
+ return xfsm_shutdown (shutdown_type);
}
diff --git a/xfce4-session/shutdown.c b/xfce4-session/shutdown.c
index e7ddbefb..c51eeae6 100644
--- a/xfce4-session/shutdown.c
+++ b/xfce4-session/shutdown.c
@@ -36,6 +36,9 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/libxfcegui4.h>
@@ -44,8 +47,9 @@
#include <xfce4-session/shutdown.h>
#include <xfce4-session/xfsm-compat-gnome.h>
#include <xfce4-session/xfsm-compat-kde.h>
-#include <xfce4-session/xfsm-global.h>
#include <xfce4-session/xfsm-fadeout.h>
+#include <xfce4-session/xfsm-global.h>
+#include <xfce4-session/xfsm-legacy.h>
#include <xfce4-session/xfsm-shutdown-helper.h>
#include <xfce4-session/xfsm-util.h>
@@ -464,7 +468,7 @@ shutdownDialog(gint *shutdownType, gboolean *saveSession)
/*
*/
gint
-shutdown(gint type)
+xfsm_shutdown(gint type)
{
gboolean result;
@@ -476,6 +480,14 @@ shutdown(gint type)
if (compat_kde)
xfsm_compat_kde_shutdown ();
+ /* kill legacy clients */
+ xfsm_legacy_shutdown ();
+
+#ifdef HAVE_SYNC
+ /* sync disk block in-core status with that on disk */
+ sync ();
+#endif
+
if (type == SHUTDOWN_LOGOUT)
return EXIT_SUCCESS;
diff --git a/xfce4-session/shutdown.h b/xfce4-session/shutdown.h
index ed083bfc..6fc4b2bd 100644
--- a/xfce4-session/shutdown.h
+++ b/xfce4-session/shutdown.h
@@ -31,6 +31,6 @@
/* prototypes */
extern gboolean shutdownDialog(gint *, gboolean *);
-extern gint shutdown(gint);
+extern gint xfsm_shutdown(gint);
#endif /* !__XFSM_SHUTDOWN_H__ */
diff --git a/xfce4-session/xfsm-compat-kde.c b/xfce4-session/xfsm-compat-kde.c
index 08db0c9c..6fe148a0 100644
--- a/xfce4-session/xfsm-compat-kde.c
+++ b/xfce4-session/xfsm-compat-kde.c
@@ -1,6 +1,6 @@
/* $Id$ */
/*-
- * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
+ * Copyright (c) 2004 Benedikt Meurer <benny@xfce.org>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -45,7 +45,7 @@ xfsm_compat_kde_startup (XfsmSplashScreen *splash)
gchar command[256];
xfsm_splash_screen_next (splash, _("Starting KDE services"));
- run ("kdeinit +kcminit");
+ run ("kdeinit +kcminit +knotify");
/* tell klauncher about the session manager */
g_snprintf (command, 256, "dcop klauncher klauncher setLaunchEnv "
diff --git a/xfce4-session/xfsm-compat-kde.h b/xfce4-session/xfsm-compat-kde.h
index 59c8ec09..1e70f802 100644
--- a/xfce4-session/xfsm-compat-kde.h
+++ b/xfce4-session/xfsm-compat-kde.h
@@ -1,6 +1,6 @@
/* $Id$ */
/*-
- * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
+ * Copyright (c) 2004 Benedikt Meurer <benny@xfce.org>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
diff --git a/xfce4-session/xfsm-legacy.c b/xfce4-session/xfsm-legacy.c
new file mode 100644
index 00000000..7ca56638
--- /dev/null
+++ b/xfce4-session/xfsm-legacy.c
@@ -0,0 +1,571 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2004 Benedikt Meurer <benny@xfce.org>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ *
+ * Most of the code in this file is borred from ksmserver, the KDE session
+ * management server.
+ * Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+/* After all, this code is mostly a hack now, one should cleanup the
+ * stuff before 4.2!
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef LEGACY_SESSION_MANAGEMENT
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#include <gdk/gdkx.h>
+
+#include <libxfcegui4/libxfcegui4.h>
+
+#include <xfce4-session/xfsm-util.h>
+
+
+#define WM_SAVE_YOURSELF_TIMEOUT 4000
+
+enum
+{
+ SM_ERROR,
+ SM_WMCOMMAND,
+ SM_WMSAVEYOURSELF,
+};
+
+
+typedef struct _SmWindow SmWindow;
+struct _SmWindow
+{
+ gint type;
+ gchar **wm_command;
+ gchar *wm_client_machine;
+ gchar *wm_class1;
+ gchar *wm_class2;
+ Window wid;
+ gint screen_num;
+};
+
+#define SM_WINDOW(window) ((SmWindow *) (window))
+
+typedef struct
+{
+ gint screen_num;
+ gchar **command;
+} SmRestartApp;
+#define SM_RESTART_APP(a) ((SmRestartApp *) (a))
+
+static GList *restart_apps = NULL;
+
+
+
+static GList *window_list = NULL;
+
+/* X Atoms */
+static Atom _XA_WM_PROTOCOLS = None;
+static Atom _XA_WM_SAVE_YOURSELF = None;
+static Atom _XA_WM_CLIENT_LEADER = None;
+static Atom _XA_SM_CLIENT_ID = None;
+
+
+static SmWindow*
+sm_window_new (Window wid, gint screen_num, gint type,
+ gchar *wm_class1, gchar *wm_class2)
+{
+ SmWindow *smw;
+
+ smw = g_new0 (SmWindow, 1);
+ smw->wid = wid;
+ smw->type = type;
+ smw->wm_class1 = wm_class1;
+ smw->wm_class2 = wm_class2;
+ smw->screen_num = screen_num;
+
+ return smw;
+}
+
+
+static void
+sm_window_free (SmWindow *window)
+{
+ g_return_if_fail (window != NULL);
+
+ if (window->wm_command != NULL)
+ g_strfreev (window->wm_command);
+ if (window->wm_client_machine != NULL)
+ g_free (window->wm_client_machine);
+ if (window->wm_class1)
+ g_free (window->wm_class1);
+ if (window->wm_class2)
+ g_free (window->wm_class2);
+ g_free (window);
+}
+
+
+static void
+sm_window_list_clear (void)
+{
+ GList *lp;
+
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ sm_window_free (SM_WINDOW (lp->data));
+
+ g_list_free (window_list);
+ window_list = NULL;
+}
+
+
+static gboolean
+sm_window_list_contains (Window window)
+{
+ GList *lp;
+
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ if (SM_WINDOW (lp->data)->wid == window)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+static int
+wins_error_handler (Display *display, XErrorEvent *event)
+{
+ GList *lp;
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ if (SM_WINDOW (lp->data)->wid == event->resourceid)
+ SM_WINDOW (lp->data)->type = SM_ERROR;
+ return 0;
+}
+
+
+static gchar*
+get_string_property (Window window, Atom prop)
+{
+ static char buffer[256];
+ Atom type;
+ int format, status;
+ unsigned long nitems = 0;
+ unsigned long extra = 0;
+ unsigned char *data = NULL;
+
+ status = XGetWindowProperty (gdk_display, window, prop, 0, 10000,
+ False, XA_STRING, &type, &format,
+ &nitems, &extra, &data);
+
+ *buffer = '\0';
+
+ if (status == Success)
+ {
+ if (data != NULL)
+ {
+ g_strlcpy (buffer, (char *) data, 256);
+ XFree (data);
+ }
+ }
+
+ return buffer;
+}
+
+
+static gboolean
+has_sessionid (Window window, Window leader)
+{
+ gchar *result;
+
+ result = get_string_property (window, _XA_SM_CLIENT_ID);
+ if (*result == '\0' && leader != None && leader != window)
+ result = get_string_property (leader, _XA_SM_CLIENT_ID);
+ return (*result != '\0');
+}
+
+
+static gchar**
+get_wmcommand (Window window)
+{
+ gchar **result = NULL;
+ char **argv;
+ int argc, i;
+
+ if (XGetCommand (gdk_display, window, &argv, &argc) && argv && argc > 0)
+ {
+ result = g_new0 (gchar *, argc + 1);
+ for (i = 0; i < argc; ++i)
+ result[i] = g_strdup (argv[i]);
+ XFreeStringList (argv);
+ }
+
+ return result;
+}
+
+
+static gchar*
+get_wmclientmachine (Window window)
+{
+ gchar *result;
+
+ /* XXX - Use XGetWMClientMachine instead */
+ result = get_string_property (window, XA_WM_CLIENT_MACHINE);
+ if (*result == '\0')
+ return g_strdup ("localhost");
+ return g_strdup (result);
+}
+#endif
+
+
+void
+xfsm_legacy_perform_session_save (void)
+{
+#ifdef LEGACY_SESSION_MANAGEMENT
+ XErrorHandler old_handler;
+ NetkScreen *screen;
+ GList *windows;
+ GList *lp;
+ Window leader;
+ Display *display;
+ Atom *protocols;
+ int nprotocols;
+ XClassHint class_hint;
+ SmWindow *sm_window;
+ int n, i;
+ int type;
+ gchar *wmclass1;
+ gchar *wmclass2;
+ Window root, window;
+ XEvent ev;
+ int awaiting_replies = 0;
+ GTimer *timer;
+
+ /* clear window list */
+ sm_window_list_clear ();
+
+ /* query X atoms */
+ if (_XA_WM_SAVE_YOURSELF == None)
+ {
+ _XA_SM_CLIENT_ID = XInternAtom (gdk_display, "SM_CLIENT_ID", False);
+ _XA_WM_PROTOCOLS = XInternAtom (gdk_display, "WM_PROTOCOLS", False);
+ _XA_WM_SAVE_YOURSELF = XInternAtom (gdk_display, "WM_SAVE_YOURSELF",
+ False);
+ _XA_WM_CLIENT_LEADER = XInternAtom (gdk_display, "WM_CLIENT_LEADER",
+ False);
+ }
+
+ /* install custom X error handler */
+ old_handler = XSetErrorHandler (wins_error_handler);
+
+ /* query mapped windows on all screens */
+ for (n = 0; n < ScreenCount (gdk_display); ++n)
+ {
+ screen = netk_screen_get (n);
+ netk_screen_force_update (screen);
+
+ windows = netk_screen_get_windows (screen);
+
+ for (lp = windows; lp != NULL; lp = lp->next)
+ {
+ window = netk_window_get_xid (NETK_WINDOW (lp->data));
+ leader = netk_window_get_group_leader (NETK_WINDOW (lp->data));
+ if (sm_window_list_contains (leader) || has_sessionid (window,leader))
+ continue;
+
+ type = SM_WMCOMMAND;
+ wmclass1 = NULL;
+ wmclass2 = NULL;
+
+ nprotocols = 0;
+ protocols = NULL;
+
+ if (XGetWMProtocols (gdk_display, leader, &protocols, &nprotocols))
+ {
+ for (i = 0; i < nprotocols; ++i)
+ if (protocols[i] == _XA_WM_SAVE_YOURSELF)
+ {
+ type = SM_WMSAVEYOURSELF;
+ break;
+ }
+ XFree ((void *) protocols);
+ }
+
+ if (XGetClassHint (gdk_display, leader, &class_hint))
+ {
+ wmclass2 = g_strdup (class_hint.res_class);
+ wmclass1 = g_strdup (class_hint.res_name);
+ XFree (class_hint.res_class);
+ XFree (class_hint.res_name);
+ }
+
+ sm_window = sm_window_new (leader, n, type, wmclass1, wmclass2);
+ window_list = g_list_append (window_list, sm_window);
+ }
+ }
+
+ /* open fresh display for sending WM_SAVE_YOURSELF commands */
+ XSync (gdk_display, False);
+ display = XOpenDisplay (DisplayString (gdk_display));
+ if (display == NULL)
+ {
+ XSetErrorHandler (old_handler);
+ return;
+ }
+
+ /* grab keyboard/pointer (XXX - check pointer pos first?) */
+ root = DefaultRootWindow (display);
+ XGrabKeyboard (display, root, False, GrabModeAsync, GrabModeAsync,
+ CurrentTime);
+ XGrabPointer (display, root, False, Button1Mask | Button2Mask | Button3Mask,
+ GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ {
+ sm_window = SM_WINDOW (lp->data);
+ if (sm_window->type == SM_WMSAVEYOURSELF)
+ {
+ ++awaiting_replies;
+
+ bzero (&ev, sizeof (ev));
+
+ ev.xclient.type = ClientMessage;
+ ev.xclient.window = sm_window->wid;
+ ev.xclient.message_type = _XA_WM_PROTOCOLS;
+ ev.xclient.format = 32;
+ ev.xclient.data.l[0] = _XA_WM_SAVE_YOURSELF;
+ ev.xclient.data.l[1] = CurrentTime;
+ XSelectInput (display, sm_window->wid,
+ PropertyChangeMask | StructureNotifyMask);
+ XSendEvent (display, sm_window->wid, False, 0, &ev);
+ }
+ }
+
+ /* wait for change in WM_COMMAND with timeout */
+ XFlush (display);
+ timer = g_timer_new ();
+ while (awaiting_replies > 0)
+ {
+ if (XPending (display))
+ {
+ XNextEvent (display, &ev);
+ if (ev.type == UnmapNotify || (ev.type == PropertyNotify
+ && ev.xproperty.atom == XA_WM_COMMAND))
+ {
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ {
+ if (SM_WINDOW (lp->data)->wid == ev.xany.window)
+ {
+ --awaiting_replies;
+ if (SM_WINDOW (lp->data)->type != SM_ERROR)
+ SM_WINDOW (lp->data)->type = SM_WMCOMMAND;
+ }
+ }
+ }
+ }
+ else
+ {
+ struct timeval tv;
+ fd_set fds;
+ int msecs;
+ int fd;
+
+ msecs = (int)(g_timer_elapsed (timer, NULL) * 1000);
+ if (msecs >= WM_SAVE_YOURSELF_TIMEOUT)
+ break;
+
+ fd = ConnectionNumber (display);
+ FD_ZERO (&fds);
+ FD_SET (fd, &fds);
+ tv.tv_sec = (WM_SAVE_YOURSELF_TIMEOUT - msecs) / 1000;
+ tv.tv_usec = ((WM_SAVE_YOURSELF_TIMEOUT - msecs) % 1000) * 1000;
+ select (fd + 1, &fds, NULL, &fds, &tv);
+ }
+ }
+ g_timer_destroy (timer);
+
+ /* Terminate work in new display */
+ XAllowEvents (display, ReplayPointer, CurrentTime);
+ XAllowEvents (display, ReplayKeyboard, CurrentTime);
+ XSync (display, False);
+ XCloseDisplay (display);
+ XSetErrorHandler (old_handler);
+
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ {
+ sm_window = SM_WINDOW (lp->data);
+ if (sm_window->type != SM_ERROR)
+ {
+ sm_window->wm_command = get_wmcommand (sm_window->wid);
+ sm_window->wm_client_machine = get_wmclientmachine (sm_window->wid);
+ }
+ }
+}
+
+
+void
+xfsm_legacy_store_session (XfceRc *rc)
+{
+ int count = 0;
+ SmWindow *sm_window;
+ GList *lp;
+ gchar buffer[256];
+
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ {
+ sm_window = SM_WINDOW (lp->data);
+ if (sm_window->type != SM_ERROR)
+ {
+ /* XXX - exclude apps based on wmclass1 or wmclass2 */
+
+ if (sm_window->wm_command == NULL
+ || sm_window->wm_client_machine == NULL)
+ continue;
+
+ g_snprintf (buffer, 256, "Legacy%d_Screen", count);
+ xfce_rc_write_int_entry (rc, buffer, sm_window->screen_num);
+
+ g_snprintf (buffer, 256, "Legacy%d_Command", count);
+ xfce_rc_write_list_entry (rc, buffer, sm_window->wm_command, NULL);
+
+ g_snprintf (buffer, 256, "Legacy%d_ClientMachine", count);
+ xfce_rc_write_entry (rc, buffer, sm_window->wm_client_machine);
+
+ ++count;
+ }
+ }
+
+ xfce_rc_write_int_entry (rc, "LegacyCount", count);
+#endif
+}
+
+
+void
+xfsm_legacy_load_session (XfceRc *rc)
+{
+#ifdef LEGACY_SESSION_MANAGEMENT
+ gchar buffer[256];
+ int count;
+ int i;
+ gchar **command;
+ SmRestartApp *app;
+ int screen_num;
+
+ count = xfce_rc_read_int_entry (rc, "LegacyCount", 0);
+ for (i = 0; i < count; ++i)
+ {
+ g_snprintf (buffer, 256, "Legacy%d_Screen", i);
+ screen_num = xfce_rc_read_int_entry (rc, buffer, 0);
+
+ g_snprintf (buffer, 256, "Legacy%d_Command", i);
+ command = xfce_rc_read_list_entry (rc, buffer, NULL);
+ if (command == NULL)
+ continue;
+
+ app = g_new0 (SmRestartApp, 1);
+ app->screen_num = screen_num;
+ app->command = command;
+
+ restart_apps = g_list_append (restart_apps, app);
+ }
+#endif
+}
+
+
+void
+xfsm_legacy_startup (void)
+{
+#ifdef LEGACY_SESSION_MANAGEMENT
+ GdkScreen *screen;
+ GList *lp;
+
+ for (lp = restart_apps; lp != NULL; lp = lp->next)
+ {
+ screen = gdk_display_get_screen (gdk_display_get_default (),
+ SM_RESTART_APP (lp->data)->screen_num);
+ xfsm_start_application (SM_RESTART_APP (lp->data)->command, NULL,
+ screen, NULL, NULL, NULL);
+ g_strfreev (SM_RESTART_APP (lp->data)->command);
+ g_free (lp->data);
+ }
+
+ g_list_free (restart_apps);
+ restart_apps = NULL;
+#endif
+}
+
+
+void
+xfsm_legacy_shutdown (void)
+{
+#ifdef LEGACY_SESSION_MANAGEMENT
+ SmWindow *sm_window;
+ GList *lp;
+
+ gdk_error_trap_push ();
+
+ for (lp = window_list; lp != NULL; lp = lp->next)
+ {
+ sm_window = SM_WINDOW (lp->data);
+ if (sm_window->wid != None)
+ XKillClient (gdk_display, sm_window->wid);
+ }
+
+ sm_window_list_clear ();
+
+ gdk_flush ();
+
+ gdk_error_trap_pop ();
+#endif
+}
+
+
+
diff --git a/xfce4-session/xfsm-legacy.h b/xfce4-session/xfsm-legacy.h
new file mode 100644
index 00000000..72dbe35d
--- /dev/null
+++ b/xfce4-session/xfsm-legacy.h
@@ -0,0 +1,34 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2004 Benedikt Meurer <benny@xfce.org>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef __XFSM_LEGACY_H__
+#define __XFSM_LEGACY_H__
+
+#include <libxfce4util/libxfce4util.h>
+
+
+void xfsm_legacy_perform_session_save (void);
+void xfsm_legacy_store_session (XfceRc *rc);
+void xfsm_legacy_load_session (XfceRc *rc);
+void xfsm_legacy_startup (void);
+void xfsm_legacy_shutdown (void);
+
+#endif /* !__XFSM_LEGACY_H__ */
diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c
index d279edac..3deee21e 100644
--- a/xfce4-session/xfsm-manager.c
+++ b/xfce4-session/xfsm-manager.c
@@ -51,6 +51,7 @@
#include <xfce4-session/shutdown.h>
#include <xfce4-session/xfsm-global.h>
+#include <xfce4-session/xfsm-legacy.h>
#include <xfce4-session/xfsm-manager.h>
#include <xfce4-session/xfsm-startup.h>
#include <xfce4-session/xfsm-util.h>
@@ -154,6 +155,9 @@ xfsm_manager_startup_continue (const gchar *previous_id)
xfce_rc_set_group (rc, buffer);
xfsm_manager_restore_active_workspace (rc);
xfce_rc_close (rc);
+
+ /* start legacy applications now */
+ xfsm_legacy_startup ();
}
}
else
@@ -247,6 +251,9 @@ xfsm_manager_load_session (void)
xfsm_properties_free (properties);
}
+ /* load legacy applications */
+ xfsm_legacy_load_session (rc);
+
xfce_rc_close (rc);
return pending_properties != NULL;
@@ -668,6 +675,9 @@ xfsm_manager_save_yourself (XfsmClient *client,
{
state = shutdown ? XFSM_MANAGER_SHUTDOWN : XFSM_MANAGER_CHECKPOINT;
+ /* handle legacy applications first! */
+ xfsm_legacy_perform_session_save ();
+
for (lp = running_clients; lp != NULL; lp = lp->next)
{
XfsmClient *client = XFSM_CLIENT (lp->data);
@@ -1011,6 +1021,9 @@ xfsm_manager_store_session (void)
xfce_rc_write_int_entry (rc, "Count", count);
+ /* store legacy applications state */
+ xfsm_legacy_store_session (rc);
+
/* store current workspace numbers */
display = gdk_display_get_default ();
for (n = 0; n < gdk_display_get_n_screens (display); ++n)