From 8f3bbed42c308f9c90293f23b7eaceff006aa232 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 10 Jul 2013 16:29:12 +0100 Subject: Add TransIsListening() 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 HdG: -Invert the final check so that TransIsListening returns True when TRANS_NOLISTEN is not set, as one would expect of it. -Make the protocol argument a const char * as similar functions do -Fix "warning: too many arguments for format" warning Signed-off-by: Jon TURNEY Signed-off-by: Hans de Goede --- Xtrans.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Xtrans.c') diff --git a/Xtrans.c b/Xtrans.c index 225f4c8..d9e32d0 100644 --- a/Xtrans.c +++ b/Xtrans.c @@ -801,6 +801,22 @@ TRANS(NoListen) (const char * protocol) return ret; } +int +TRANS(IsListening) (const char * protocol) +{ + Xtransport *trans; + + if ((trans = TRANS(SelectTransport)(protocol)) == NULL) + { + prmsg (1,"TransIsListening: unable to find transport: %s\n", + protocol); + + return 0; + } + + return !(trans->flags & TRANS_NOLISTEN); +} + int TRANS(ResetListener) (XtransConnInfo ciptr) -- cgit v1.2.1