From 17c1fcb344bf72a5bb3de04f9b8c6f8a91982d2e Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <fourdan.olivier@wanadoo.fr>
Date: Wed, 8 Dec 2004 19:57:32 +0000
Subject: [PATCH] Do not enter daemon mode if connected to a session manager.

(Old svn revision: 12187)
---
 src/client.c | 16 ++++++++++------
 src/main.c   | 10 +++++++++-
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/client.c b/src/client.c
index 4c022be38..38dc2b501 100644
--- a/src/client.c
+++ b/src/client.c
@@ -1432,13 +1432,17 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
         return NULL;
     }
 
-    if (checkKdeSystrayWindow (display_info, w) && (screen_info->systray != None))
+    if (checkKdeSystrayWindow (display_info, w))
     {
-        TRACE ("Not managing KDE systray windows");
-        sendSystrayReqDock (display_info, w, screen_info->systray);
-        myDisplayUngrabServer (display_info);
-        gdk_error_trap_pop ();
-        return NULL;
+        TRACE ("Detected KDE systray windows");
+        if (screen_info->systray != None)
+        {
+            sendSystrayReqDock (display_info, w, screen_info->systray);
+            myDisplayUngrabServer (display_info);
+            gdk_error_trap_pop ();
+            return NULL;
+        }
+        TRACE ("No systray found for this screen");
     }
 
     c = g_new0 (Client, 1);
diff --git a/src/main.c b/src/main.c
index ddcd11f66..9fa7cc3d9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -461,6 +461,7 @@ initialize (int argc, char **argv, gint compositor_mode)
     if (session_init (client_session))
     {
         load_saved_session (client_session);
+        return 1;
     }
 
     return 0;
@@ -495,6 +496,11 @@ main (int argc, char **argv)
     }
 
     status = initialize (argc, argv, compositor);
+    /* 
+       status  < 0   =>   Error, cancel execution
+       status == 0   =>   Run w/out session manager
+       status == 1   =>   Connected to session manager
+     */
     switch (status)
     {
         case -1:
@@ -537,7 +543,9 @@ main (int argc, char **argv)
                 }
 #endif /* !HAVE_DAEMON */
             }
-
+            /* Walk through */
+        case 1:
+        g_print ("Main loop\n");
             /* enter GTK main loop */
             gtk_main ();
             break;
-- 
GitLab