[gnome-games] libgames-support: Update smclient from libegg master



commit a3c5ef0e2427999e25550e2874880fa641ef6a49
Author: Christian Persch <chpe gnome org>
Date:   Thu Jan 21 16:24:52 2010 +0100

    libgames-support: Update smclient from libegg master

 libgames-support/eggsmclient-osx.c |    2 +-
 libgames-support/eggsmclient.c     |   29 ++++++++++++++++++++++-------
 2 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/libgames-support/eggsmclient-osx.c b/libgames-support/eggsmclient-osx.c
index 6f3c481..7d3ff4b 100644
--- a/libgames-support/eggsmclient-osx.c
+++ b/libgames-support/eggsmclient-osx.c
@@ -37,7 +37,7 @@
 #include "config.h"
 
 #include "eggsmclient-private.h"
-#include <gdk/gdkquartz.h>
+#include <glib.h>
 #include <Carbon/Carbon.h>
 #include <CoreServices/CoreServices.h>
 
diff --git a/libgames-support/eggsmclient.c b/libgames-support/eggsmclient.c
index 85aaee4..2198a55 100644
--- a/libgames-support/eggsmclient.c
+++ b/libgames-support/eggsmclient.c
@@ -202,7 +202,8 @@ sm_client_post_parse_func (GOptionContext  *context,
    * use the same client id. */
   g_unsetenv ("DESKTOP_AUTOSTART_ID");
 
-  if (EGG_SM_CLIENT_GET_CLASS (client)->startup)
+  if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
+      EGG_SM_CLIENT_GET_CLASS (client)->startup)
     EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id);
   return TRUE;
 }
@@ -265,9 +266,9 @@ egg_sm_client_get_option_group (void)
  * Sets the "mode" of #EggSMClient as follows:
  *
  *    %EGG_SM_CLIENT_MODE_DISABLED: Session management is completely
- *    disabled. The application will not even connect to the session
- *    manager. (egg_sm_client_get() will still return an #EggSMClient,
- *    but it will just be a dummy object.)
+ *    disabled, until the mode is changed again. The application will
+ *    not even connect to the session manager. (egg_sm_client_get()
+ *    will still return an #EggSMClient object.)
  *
  *    %EGG_SM_CLIENT_MODE_NO_RESTART: The application will connect to
  *    the session manager (and thus will receive notification when the
@@ -277,12 +278,27 @@ egg_sm_client_get_option_group (void)
  *    %EGG_SM_CLIENT_MODE_NORMAL: The default. #EggSMCLient will
  *    function normally.
  *
- * This must be called before the application's main loop begins.
+ * This must be called before the application's main loop begins and
+ * before any call to egg_sm_client_get(), unless the mode was set
+ * earlier to %EGG_SM_CLIENT_MODE_DISABLED and this call enables
+ * session management. Note that option parsing will call
+ * egg_sm_client_get().
  **/
 void
 egg_sm_client_set_mode (EggSMClientMode mode)
 {
+  EggSMClientMode old_mode = global_client_mode;
+
+  g_return_if_fail (global_client == NULL || global_client_mode == EGG_SM_CLIENT_MODE_DISABLED);
+  g_return_if_fail (!(global_client != NULL && mode == EGG_SM_CLIENT_MODE_DISABLED));
+
   global_client_mode = mode;
+
+  if (global_client != NULL && old_mode == EGG_SM_CLIENT_MODE_DISABLED)
+    {
+      if (EGG_SM_CLIENT_GET_CLASS (global_client)->startup)
+        EGG_SM_CLIENT_GET_CLASS (global_client)->startup (global_client, sm_client_id);
+    }
 }
 
 /**
@@ -317,8 +333,7 @@ egg_sm_client_get (void)
 {
   if (!global_client)
     {
-      if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
-	  !sm_client_disable)
+      if (!sm_client_disable)
 	{
 #if defined (GDK_WINDOWING_WIN32)
 	  global_client = egg_sm_client_win32_new ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]