gnome-session r4810 - in branches/dbus_based: . gnome-session



Author: mccann
Date: Thu Jul 17 19:55:24 2008
New Revision: 4810
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4810&view=rev

Log:
2008-07-17  William Jon McCann  <jmccann redhat com>

	* gnome-session/gsm-xsmp-client.c (xsmp_shutdown_cancelled),
	(interact_request_callback), (save_yourself_done_callback):
	Try to work around some buggy grab behavior in session clients.



Modified:
   branches/dbus_based/ChangeLog
   branches/dbus_based/gnome-session/gsm-xsmp-client.c

Modified: branches/dbus_based/gnome-session/gsm-xsmp-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-xsmp-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-xsmp-client.c	Thu Jul 17 19:55:24 2008
@@ -488,6 +488,16 @@
         SmsInteract (xsmp->priv->conn);
 }
 
+static void
+xsmp_shutdown_cancelled (GsmClient *client)
+{
+        GsmXSMPClient *xsmp = (GsmXSMPClient *) client;
+
+        g_debug ("GsmXSMPClient: xsmp_shutdown_cancelled ('%s')", xsmp->priv->description);
+
+        SmsShutdownCancelled (xsmp->priv->conn);
+}
+
 static gboolean
 xsmp_stop (GsmClient *client,
            GError   **error)
@@ -825,7 +835,12 @@
                                          _("This program is blocking log out."));
 
         /* Can't just call back with Interact because session client
-           grabs keyboard in that case! */
+           grabs the keyboard!  So, we try to get it to release
+           grabs by telling it we've cancelled the shutdown.
+           This grabbing is clearly bullshit and is not supported by
+           the client spec or protocol spec.
+        */
+        xsmp_shutdown_cancelled (GSM_CLIENT (client));
 }
 
 static void
@@ -862,9 +877,15 @@
                 client->priv->current_save_yourself = -1;
         }
 
-        gdm_client_end_session_response (GSM_CLIENT (client),
-                                         TRUE,
-                                         NULL);
+        /* If success is false then the application still has
+           unsafe data.  We may also have tricked it into sending
+           us this message when we faked the ShutdownCancel to
+           break its grabs. */
+        if (success) {
+                gdm_client_end_session_response (GSM_CLIENT (client),
+                                                 TRUE,
+                                                 NULL);
+        }
 
         if (client->priv->next_save_yourself) {
                 int save_type = client->priv->next_save_yourself;



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