diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2013-07-10 16:29:12 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2014-01-27 12:10:08 +0100 |
commit | 8f3bbed42c308f9c90293f23b7eaceff006aa232 (patch) | |
tree | 6eb01989d71a0e6fbe297b788d6769afecdef085 | |
parent | e1e6121a1638d43d9929589b4723da2b38cb6b44 (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.c | 16 | ||||
-rw-r--r-- | Xtrans.h | 4 |
2 files changed, 20 insertions, 0 deletions
@@ -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) { @@ -311,6 +311,10 @@ int TRANS(NoListen) ( const char* /* protocol*/ ); +int TRANS(IsListening) ( + const char* /* protocol*/ +); + int TRANS(ResetListener)( XtransConnInfo /* ciptr */ ); |