# Description: Make sure RestartStyleHint is set to RestartIfRunning when another WM
#			   replaces Metacity.
# Ubuntu: https://bugs.launchpad.net/ubuntu/+source/metacity/+bug/389686
diff -Nur -x '*.orig' -x '*~' metacity-2.27.0/src/core/session.c metacity-2.27.0.new/src/core/session.c
--- metacity-2.27.0/src/core/session.c	2009-02-20 15:26:32.000000000 +0000
+++ metacity-2.27.0.new/src/core/session.c	2009-07-08 19:18:58.449852247 +0100
@@ -376,14 +376,6 @@
   SmProp *props[1];
   char hint = SmRestartIfRunning;
 
-  if (!meta_get_display ())
-    {
-      meta_verbose ("Cannot close session because there is no display");
-      return;
-    }
-
-  warn_about_lame_clients_and_finish_interact (FALSE);
-
   if (session_connection == NULL)
     return;
   
@@ -397,6 +389,15 @@
   props[0] = &prop1;
   
   SmcSetProperties (session_connection, 1, props);
+  
+  if (!meta_get_display ())
+    {
+      meta_verbose ("Cannot close session because there is no display");
+      return;
+    }
+
+  warn_about_lame_clients_and_finish_interact (FALSE);
+
 }
 
 static void
