summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-07-10 16:29:12 +0100
committerHans de Goede <hdegoede@redhat.com>2014-01-27 12:10:08 +0100
commit8f3bbed42c308f9c90293f23b7eaceff006aa232 (patch)
tree6eb01989d71a0e6fbe297b788d6769afecdef085
parente1e6121a1638d43d9929589b4723da2b38cb6b44 (diff)
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 <jon.turney@dronecode.org.uk> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--Xtrans.c16
-rw-r--r--Xtrans.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/Xtrans.c b/Xtrans.c
index 225f4c8..d9e32d0 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -802,6 +802,22 @@ TRANS(NoListen) (const char * protocol)
}
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)
{
diff --git a/Xtrans.h b/Xtrans.h
index 1754720..5807b67 100644
--- a/Xtrans.h
+++ b/Xtrans.h
@@ -311,6 +311,10 @@ int TRANS(NoListen) (
const char* /* protocol*/
);
+int TRANS(IsListening) (
+ const char* /* protocol*/
+);
+
int TRANS(ResetListener)(
XtransConnInfo /* ciptr */
);