PATCH: Add xorg-xserver 1.19 support to tigervnc
Keith Packard
keithp at keithp.com
Mon Oct 3 16:44:32 UTC 2016
Hans de Goede <hdegoede at redhat.com> writes:
> +void XserverDesktop::handleSocketFd(int fd, int xevents)
> +{
> + std::list<Socket*> sockets;
> + std::list<Socket*>::iterator i;
> + SocketServer *fd_server = NULL;
> + bool is_http = false;
> +
> + server->getSockets(&sockets);
> + for (i = sockets.begin(); i != sockets.end(); i++) {
> + if ((*i)->getFd() == fd) {
> + fd_server = server;
> + break;
> + }
> + }
Seems like it might be nice to avoid this loop by making this a method
on fd_server instead of the top-level object?
> + if (httpServer && !fd_server) {
> + httpServer->getSockets(&sockets);
> + for (i = sockets.begin(); i != sockets.end(); i++) {
> + if ((*i)->getFd() == fd) {
> + fd_server = httpServer;
> + is_http = true;
> + break;
> + }
> + }
> + }
> + if (!fd_server) {
> + vlog.error("XserverDesktop::handleSocketFd: Error cannot find fd");
> + return;
> + }
> +
> + if (xevents & X_NOTIFY_READ)
> + fd_server->processSocketReadEvent(*i);
> +
> + if (xevents & X_NOTIFY_WRITE)
> + fd_server->processSocketWriteEvent(*i);
> +
> + if ((*i)->isShutdown()) {
> + vlog.debug("%sclient gone, sock %d", is_http ? "http " : "", fd);
> + RemoveNotifyFd(fd);
> + fd_server->removeSocket(*i);
> + if (!is_http)
> + vncClientGone(fd);
> + delete (*i);
> + }
> +}
> +
> +void XserverDesktop::blockHandler(int* timeout)
> +{
> + // We don't have a good callback for when we can init input devices[1],
> + // so we abuse the fact that this routine will be called first thing
> + // once the dix is done initialising.
> + // [1] Technically Xvnc has InitInput(), but libvnc.so has nothing.
> + vncInitInputDevice();
> +
> + int nextTimeout = server->checkTimeouts();
> + if (nextTimeout > 0 && (*timeout == -1 || nextTimeout < *timeout))
> + *timeout = nextTimeout;
> +}
> +
> +#else
> +
> void XserverDesktop::readBlockHandler(fd_set* fds, struct timeval ** timeout)
> {
> // We don't have a good callback for when we can init input devices[1],
> @@ -600,10 +738,15 @@
> }
> }
>
> +#endif
> +
> void XserverDesktop::addClient(Socket* sock, bool reverse)
> {
> vlog.debug("new client, sock %d reverse %d",sock->getFd(),reverse);
> server->addSocket(sock, reverse);
> +#if XORG >= 119
> + SetNotifyFd(sock->getFd(), HandleSocketFd, X_NOTIFY_READ, this);
> +#endif
> }
>
> void XserverDesktop::disconnectClients()
> diff -ur tigervnc-1.7.0/unix/xserver/hw/vnc/XserverDesktop.h tigervnc-1.7.0.new/unix/xserver/hw/vnc/XserverDesktop.h
> --- tigervnc-1.7.0/unix/xserver/hw/vnc/XserverDesktop.h 2016-09-08 12:31:18.000000000 +0200
> +++ tigervnc-1.7.0.new/unix/xserver/hw/vnc/XserverDesktop.h 2016-10-03 13:58:58.434844924 +0200
> @@ -38,6 +38,7 @@
> #include <rfb/VNCServerST.h>
> #include <rdr/SubstitutingInStream.h>
> #include "Input.h"
> +#include "xorg-version.h"
>
> namespace rfb {
> class VNCServerST;
> @@ -69,10 +70,16 @@
> const unsigned char *rgbaData);
> void add_changed(const rfb::Region ®ion);
> void add_copied(const rfb::Region &dest, const rfb::Point &delta);
> +#if XORG >= 119
> + void handleListenFd(int fd);
> + void handleSocketFd(int fd, int xevents);
> + void blockHandler(int* timeout);
> +#else
> void readBlockHandler(fd_set* fds, struct timeval ** timeout);
> void readWakeupHandler(fd_set* fds, int nfds);
> void writeBlockHandler(fd_set* fds, struct timeval ** timeout);
> void writeWakeupHandler(fd_set* fds, int nfds);
> +#endif
> void addClient(network::Socket* sock, bool reverse);
> void disconnectClients();
>
> diff -ur tigervnc-1.7.0/unix/xserver/hw/vnc/vncBlockHandler.c tigervnc-1.7.0.new/unix/xserver/hw/vnc/vncBlockHandler.c
> --- tigervnc-1.7.0/unix/xserver/hw/vnc/vncBlockHandler.c 2016-09-08 12:31:18.000000000 +0200
> +++ tigervnc-1.7.0.new/unix/xserver/hw/vnc/vncBlockHandler.c 2016-10-03 14:06:30.461357037 +0200
> @@ -30,6 +30,23 @@
>
--
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20161003/a2a83f89/attachment.sig>
More information about the xorg-devel
mailing list