[lib/libxtrans] Add TransIsListening()

Submitted by Jon Turney on July 10, 2013, 3:29 p.m.

Details

Message ID 1373470152-5188-1-git-send-email-jon.turney@dronecode.org.uk
State Superseded, archived
Headers show

Not browsing as part of any series.

Commit Message

Jon Turney July 10, 2013, 3:29 p.m.
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@dronecode.org.uk>
---
 Xtrans.c | 16 ++++++++++++++++
 Xtrans.h |  4 ++++
 2 files changed, 20 insertions(+)

Patch hide | download patch | download mbox

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 */
 );