summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfce4-session/sm-layer.c2
-rw-r--r--xfce4-session/sm-layer.h2
-rw-r--r--xfce4-session/xfsm-compat-gnome.c63
-rw-r--r--xfce4-session/xfsm-legacy.c36
-rw-r--r--xfce4-session/xfsm-legacy.h3
-rw-r--r--xfce4-session/xfsm-manager.c3
6 files changed, 107 insertions, 2 deletions
diff --git a/xfce4-session/sm-layer.c b/xfce4-session/sm-layer.c
index 6fd7f825..3093a77e 100644
--- a/xfce4-session/sm-layer.c
+++ b/xfce4-session/sm-layer.c
@@ -1,4 +1,4 @@
-/* $Id */
+/* $Id$ */
/*-
* Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
* All rights reserved.
diff --git a/xfce4-session/sm-layer.h b/xfce4-session/sm-layer.h
index 35b3b6e5..d67d2e71 100644
--- a/xfce4-session/sm-layer.h
+++ b/xfce4-session/sm-layer.h
@@ -1,4 +1,4 @@
-/* $Id */
+/* $Id$ */
/*-
* Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
* All rights reserved.
diff --git a/xfce4-session/xfsm-compat-gnome.c b/xfce4-session/xfsm-compat-gnome.c
index afef123e..09120c1b 100644
--- a/xfce4-session/xfsm-compat-gnome.c
+++ b/xfce4-session/xfsm-compat-gnome.c
@@ -47,6 +47,11 @@
#include <unistd.h>
#endif
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+
+#include <gdk/gdkx.h>
+
#include <libgnome/libgnome.h>
#include <libxfce4util/libxfce4util.h>
#include <gconf/gconf-client.h>
@@ -60,6 +65,8 @@
static GConfClient *gnome_conf_client = NULL;
static pid_t gnome_keyring_daemon_pid = 0;
+static Window gnome_smproxy_window = None;
+
static void
gnome_keyring_daemon_startup (void)
@@ -169,9 +176,63 @@ gnome_ast_startup (void)
}
+static void
+xfsm_compat_gnome_smproxy_startup (void)
+{
+ Atom gnome_sm_proxy;
+ Display *dpy;
+ Window root;
+
+ gdk_error_trap_push ();
+
+ /* Set GNOME_SM_PROXY property, since some apps (like OOo) seem to require
+ * it for property behaviour. Thanks to Jasper/Francois for reporting this.
+ * This has another advantage, since it prevents people from running
+ * gnome-smproxy in xfce4, which would cause trouble otherwise.
+ */
+ dpy = gdk_display;
+ root = RootWindow (dpy, 0);
+
+ if (gnome_smproxy_window != None)
+ XDestroyWindow (dpy, gnome_smproxy_window);
+
+ gnome_sm_proxy = XInternAtom (dpy, "GNOME_SM_PROXY", False);
+ gnome_smproxy_window = XCreateSimpleWindow (dpy, root, 1, 1, 1, 1, 0, 0, 0);
+
+ XChangeProperty (dpy, gnome_smproxy_window, gnome_sm_proxy,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) (void *) &gnome_smproxy_window, 1);
+ XChangeProperty (dpy, root, gnome_sm_proxy,
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) (void *) &gnome_smproxy_window, 1);
+
+ XSync (dpy, False);
+
+ gdk_error_trap_pop ();
+}
+
+
+static void
+xfsm_compat_gnome_smproxy_shutdown (void)
+{
+ gdk_error_trap_push ();
+
+ if (gnome_smproxy_window != None)
+ {
+ XDestroyWindow (gdk_display, gnome_smproxy_window);
+ XSync (gdk_display, False);
+ gnome_smproxy_window = None;
+ }
+
+ gdk_error_trap_pop ();
+}
+
+
void
xfsm_compat_gnome_startup (XfsmSplashScreen *splash)
{
+ xfsm_compat_gnome_smproxy_startup ();
+
/* fire up the keyring daemon */
xfsm_splash_screen_next (splash, _("Starting The Gnome Keyring Daemon"));
gnome_keyring_daemon_startup ();
@@ -218,6 +279,8 @@ xfsm_compat_gnome_shutdown (void)
g_warning ("Failed to shutdown the GConf daemon on logout: "
"gconftool-2 returned status %d", status);
}
+
+ xfsm_compat_gnome_smproxy_shutdown ();
}
#endif
diff --git a/xfce4-session/xfsm-legacy.c b/xfce4-session/xfsm-legacy.c
index b92aa514..da5a780a 100644
--- a/xfce4-session/xfsm-legacy.c
+++ b/xfce4-session/xfsm-legacy.c
@@ -459,12 +459,14 @@ xfsm_legacy_perform_session_save (void)
sm_window->wm_client_machine = get_wmclientmachine (sm_window->wid);
}
}
+#endif
}
void
xfsm_legacy_store_session (XfceRc *rc)
{
+#ifdef LEGACY_SESSION_MANAGEMENT
int count = 0;
SmWindow *sm_window;
GList *lp;
@@ -537,6 +539,40 @@ xfsm_legacy_load_session (XfceRc *rc)
void
+xfsm_legacy_init (void)
+{
+#ifdef LEGACY_SESSION_MANAGEMENT
+ Atom dt_save_mode;
+ Atom dt_restore_mode;
+ Display *dpy;
+ Window root;
+ int n;
+
+ dpy = gdk_display;
+
+ /* Some CDE apps are broken (thanks again to Craig for the Sun Box :).
+ * Bugfix found on http://bugzilla.gnome.org/long_list.cgi?buglist=81343
+ * and implemented in gnome-session. The following code extends what
+ * gnome does, since it seems to be necessary to set both properties
+ * per screen, not just for the first screen. Anybody with access to
+ * CDE source code to enlighten me?
+ * -- bm, 20040530
+ */
+ dt_save_mode = XInternAtom (dpy, "_DT_SAVE_MODE", False);
+ dt_restore_mode = XInternAtom (dpy, "_DT_RESTORE_MODE", False);
+ for (n = 0; n < ScreenCount (dpy); ++n)
+ {
+ root = RootWindow (dpy, n);
+ XChangeProperty (dpy, root, dt_save_mode, XA_STRING, 8,
+ PropModeReplace, "xfce4", sizeof ("xfce4"));
+ XChangeProperty (dpy, root, dt_restore_mode, XA_STRING, 8,
+ PropModeReplace, "xfce4", sizeof ("xfce4"));
+ }
+#endif
+}
+
+
+void
xfsm_legacy_startup (void)
{
#ifdef LEGACY_SESSION_MANAGEMENT
diff --git a/xfce4-session/xfsm-legacy.h b/xfce4-session/xfsm-legacy.h
index 72dbe35d..92a5af41 100644
--- a/xfce4-session/xfsm-legacy.h
+++ b/xfce4-session/xfsm-legacy.h
@@ -22,12 +22,15 @@
#ifndef __XFSM_LEGACY_H__
#define __XFSM_LEGACY_H__
+#include <gdk/gdk.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_init (void);
void xfsm_legacy_startup (void);
void xfsm_legacy_shutdown (void);
diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c
index 27a6b0ff..6e70339b 100644
--- a/xfce4-session/xfsm-manager.c
+++ b/xfce4-session/xfsm-manager.c
@@ -384,6 +384,9 @@ xfsm_manager_init (XfceRc *rc)
gboolean
xfsm_manager_restart (void)
{
+ /* setup legacy application handling */
+ xfsm_legacy_init ();
+
g_idle_add ((GSourceFunc) xfsm_manager_startup, NULL);
return TRUE;