diff options
author | runge <runge@karlrunge.com> | 2010-12-29 10:05:52 -0500 |
---|---|---|
committer | runge <runge@karlrunge.com> | 2010-12-29 10:05:52 -0500 |
commit | 596331a5c3124f080cdcbb400c188c095048ef35 (patch) | |
tree | 66eb904b6c0181703d8f3c9ec81352a970d52601 /x11vnc/connections.c | |
parent | 0c03b989407f9e5ea66b403011baaaad09fcd536 (diff) | |
download | libtdevnc-596331a5c3124f080cdcbb400c188c095048ef35.tar.gz libtdevnc-596331a5c3124f080cdcbb400c188c095048ef35.zip |
x11vnc: Use opengl to read screen on macosx. non-deprecated macosx interfaces for input injection.
Diffstat (limited to 'x11vnc/connections.c')
-rw-r--r-- | x11vnc/connections.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/x11vnc/connections.c b/x11vnc/connections.c index abb7a27..d2a9b5c 100644 --- a/x11vnc/connections.c +++ b/x11vnc/connections.c @@ -93,6 +93,7 @@ void adjust_grabs(int grab, int quiet); void check_new_clients(void); int accept_client(rfbClientPtr client); void check_ipv6_listen(long usec); +void check_unix_sock(long usec); int run_user_command(char *cmd, rfbClientPtr client, char *mode, char *input, int len, FILE *output); int check_access(char *addr); @@ -1837,6 +1838,69 @@ void check_ipv6_listen(long usec) { if (usec) {} } +void check_unix_sock(long usec) { + fd_set fds; + struct timeval tv; + int nfds, csock = -1; + rfbClientPtr cl; + int nmax = 0; + char *name; + + if (!unix_sock || unix_sock_fd < 0) { + return; + } + + FD_ZERO(&fds); + if (unix_sock_fd >= 0) { + FD_SET(unix_sock_fd, &fds); + nmax = unix_sock_fd; + } + + tv.tv_sec = 0; + tv.tv_usec = 0; + + nfds = select(nmax+1, &fds, NULL, NULL, &tv); + + if (nfds <= 0) { + return; + } + + if (unix_sock_fd >= 0 && FD_ISSET(unix_sock_fd, &fds)) { + csock = accept_unix(unix_sock_fd); + if (csock < 0) { + return; + } + if (fcntl(csock, F_SETFL, O_NONBLOCK) < 0) { + rfbLogPerror("check_unix_sock: fcntl"); + close(csock); + return; + } + + /* rfbNewClient() will screw us with setsockopt TCP_NODELAY... + you need to comment out in libvncserver/rfbserver.c: + rfbLogPerror("setsockopt failed"); + close(sock); + return NULL; + */ + cl = rfbNewClient(screen, csock); + + if (cl == NULL) { + close(csock); + return; + } + + name = strdup(unix_sock); + + if (name) { + if (cl->host) { + free(cl->host); + } + cl->host = name; + rfbLog("unix sock client: %s\n", name); + } + } +} + /* * For the -connect <file> option: periodically read the file looking for * a connect string. If one is found set client_connect to it. |