Sophie

Sophie

distrib > Mageia > 9 > armv7hl > by-pkgid > 70db79aeb6f762d1452a58a64b648349 > files > 10

afterstep-2.2.12-22.mga9.src.rpm

From e8ac3c951d307a09944413c5968d239dba7a41c1 Mon Sep 17 00:00:00 2001
From: Sasha Vasko <sasha@aftercode.net>
Date: Mon, 25 Nov 2013 23:47:19 -0600
Subject: [PATCH 10/18] Introduced dbus red-write into X message loop to avoid
 delays. Session management is tsill broken under Gnome 3 due to the fact that
 everything is tied to gnome-shell which we are replacing. Idiots.

---
 src/afterstep/dbus.c   | 13 +++++++------
 src/afterstep/events.c |  2 ++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/afterstep/dbus.c b/src/afterstep/dbus.c
index 916614f9..9cd24f10 100644
--- a/src/afterstep/dbus.c
+++ b/src/afterstep/dbus.c
@@ -281,7 +281,7 @@ static void asdbus_set_dbus_timer (struct timeval *expires, DBusTimeout *timeout
 	int interval = dbus_timeout_get_interval(timeout);
 	gettimeofday (expires, NULL);
 	tv_add_ms(expires, interval);
-	show_debug(__FILE__,__FUNCTION__,__LINE__,"adding dbus timeout data=%p, interval = %d\n", timeout, interval);
+	show_debug(__FILE__,__FUNCTION__,__LINE__,"time = %d, adding dbus timeout data=%p, interval = %d\n", time(NULL), timeout, interval);
 	timer_new (interval, asdbus_handle_timer, timeout);
 }
 
@@ -433,20 +433,18 @@ void asdbus_EndSessionOk ();
 
 void asdbus_process_messages (ASDBusFd* fd)
 {
-	show_progress ("checking dbus messages for fd = %d", fd->fd);
+	//show_progress ("checking dbus messages for fd = %d", fd->fd);
 #ifndef ASDBUS_DISPATCH
 	while (ASDBus.session_conn) {
 		DBusMessage *msg;
 		const char *interface, *member;
 		/* non blocking read of the next available message */
-		dbus_connection_read_write (ASDBus.session_conn, 200);
+		dbus_connection_read_write (ASDBus.session_conn, 0);
 		msg = dbus_connection_pop_message (ASDBus.session_conn);
 
 		if (NULL == msg) {
 			/* show_progress ("no more Dbus messages..."); */
-			show_progress
-					("time(%ld):dbus message not received during the timeout - sleeping...",
-					 time (NULL));
+			//show_progress("time(%ld):dbus message not received during the timeout - sleeping...", time (NULL));
 			return;
 		}
 		interface = dbus_message_get_interface (msg);
@@ -671,6 +669,7 @@ void asdbus_UnregisterSMClient (const char *sm_client_path)
 
 void asdbus_EndSessionOk ()
 {
+		show_debug(__FILE__, __FUNCTION__, __LINE__, "dbus EndSessionOk");
 #ifdef HAVE_DBUS_CONTEXT
 	if (ASDBus.session_conn) {
 		DBusMessage *message =
@@ -678,6 +677,8 @@ void asdbus_EndSessionOk ()
 																			ASDBus.gnomeSessionPath,	/*"/org/gnome/SessionManager", */
 																			IFACE_SESSION_PRIVATE,
 																			"EndSessionResponse");
+		show_debug(__FILE__, __FUNCTION__, __LINE__, "dbus EndSessionResponse to iface = \"%s\", path = \"%s\", manager = \"%s\"", 
+			    IFACE_SESSION_PRIVATE, ASDBus.gnomeSessionPath, SESSIONMANAGER_NAME);
 		if (message) {
 			DBusMessageIter iter;
 			char *reason = "";
diff --git a/src/afterstep/events.c b/src/afterstep/events.c
index 955da831..e9ed3c71 100644
--- a/src/afterstep/events.c
+++ b/src/afterstep/events.c
@@ -73,6 +73,7 @@ _exec_while_x_pending ()
 			DispatchEvent (&event, False);
 			++handled_count;
 		}
+		asdbus_process_messages (0);
 		ASSync (False);
 		/* before we exec any function - we ought to process any Unmap and Destroy
 		 * events to handle all the pending window destroys : */
@@ -83,6 +84,7 @@ _exec_while_x_pending ()
 			DispatchEvent (&event, False);
 			++handled_count;
 		}
+		asdbus_process_messages (0);
 		ExecutePendingFunctions ();
 	}
 	return handled_count;
-- 
2.22.0