summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-07-31 19:01:41 -0700
committerJay Sorg <jay.sorg@gmail.com>2012-07-31 19:01:41 -0700
commit17ee0e3aed6171b385486ec2f5251e78f9d2ef06 (patch)
tree4644c09a423020c17fa7843ff8f3baf0e510ef76
parent02751f91a3c90651becf552729f86a37ec7055e1 (diff)
downloadxrdp-proprietary-17ee0e3aed6171b385486ec2f5251e78f9d2ef06.tar.gz
xrdp-proprietary-17ee0e3aed6171b385486ec2f5251e78f9d2ef06.zip
sesman/tools: added xcon
-rw-r--r--sesman/tools/Makefile.am10
-rw-r--r--sesman/tools/xcon.c35
2 files changed, 44 insertions, 1 deletions
diff --git a/sesman/tools/Makefile.am b/sesman/tools/Makefile.am
index fdfa8eca..ab3612d0 100644
--- a/sesman/tools/Makefile.am
+++ b/sesman/tools/Makefile.am
@@ -15,7 +15,8 @@ bin_PROGRAMS = \
xrdp-sesrun \
xrdp-sestest \
xrdp-sesadmin \
- xrdp-dis
+ xrdp-dis \
+ xrdp-xcon
xrdp_sesrun_SOURCES = \
sesrun.c \
@@ -31,6 +32,9 @@ xrdp_sesadmin_SOURCES = \
xrdp_dis_SOURCES = \
dis.c
+xrdp_xcon_SOURCES = \
+ xcon.c
+
xrdp_sesrun_LDADD = \
$(top_builddir)/common/libcommon.la
@@ -41,3 +45,7 @@ xrdp_sestest_LDADD = \
xrdp_sesadmin_LDADD = \
$(top_builddir)/common/libcommon.la \
$(top_builddir)/sesman/libscp/libscp.la
+
+xrdp_xcon_LDADD = \
+ -L/usr/X11R6/lib \
+ -lX11
diff --git a/sesman/tools/xcon.c b/sesman/tools/xcon.c
new file mode 100644
index 00000000..7a45a1cd
--- /dev/null
+++ b/sesman/tools/xcon.c
@@ -0,0 +1,35 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <X11/Xlib.h>
+
+Display* g_display = 0;
+int g_x_socket = 0;
+
+int main(int argc, char** argv)
+{
+ fd_set rfds;
+ int i1;
+ XEvent xevent;
+
+ g_display = XOpenDisplay(0);
+ if (g_display == 0)
+ {
+ printf("XOpenDisplay failed\n");
+ return 0;
+ }
+ g_x_socket = XConnectionNumber(g_display);
+ while (1)
+ {
+ FD_ZERO(&rfds);
+ FD_SET(g_x_socket, &rfds);
+ i1 = select(g_x_socket + 1, &rfds, 0, 0, 0);
+ if (i1 < 0)
+ {
+ break;
+ }
+ XNextEvent(g_display, &xevent);
+ }
+ return 0;
+}