[PATCH lib/libxtrans] Add TransIsListening()

Jon TURNEY jon.turney at dronecode.org.uk
Wed Jul 10 08:29:12 PDT 2013


libxtrans provides TransNoListen() to set the 'don't listen' flag for a
particular transport, but there is no interface to query the state of that flag

This is a bit of a problem for the XWin server, as it wants to start some helper
clients (for clipboard integration and integrated window management), so needs
to know what transports the server is listening on to construct appropriate
display names for those clients.

Add TransIsListening() to discover if TransNoListen() has been called for a
particular protocol or not

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 Xtrans.c | 16 ++++++++++++++++
 Xtrans.h |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/Xtrans.c b/Xtrans.c
index 0799f04..eb40184 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -770,6 +770,22 @@ TRANS(NoListen) (const char * protocol)
 }
 
 int
+TRANS(IsListening) (char * protocol)
+{
+   Xtransport *trans;
+
+   if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
+   {
+	prmsg (1,"TransIsListening: unable to find transport: %s\n",
+	       protocol, 0, 0);
+
+	return 0;
+   }
+
+   return (trans->flags & TRANS_NOLISTEN);
+}
+
+int
 TRANS(ResetListener) (XtransConnInfo ciptr)
 
 {
diff --git a/Xtrans.h b/Xtrans.h
index 2945b2a..1b48429 100644
--- a/Xtrans.h
+++ b/Xtrans.h
@@ -307,6 +307,10 @@ int TRANS(NoListen) (
     const char*         /* protocol*/
 );
 
+int TRANS(IsListening) (
+    char*               /* protocol*/
+);
+
 int TRANS(ResetListener)(
     XtransConnInfo	/* ciptr */
 );
-- 
1.8.3.1



More information about the xorg-devel mailing list