Add RandR support for x0vncserver

Change Xserver screen through libXrandr. For complex configurations,
all outputs must have corresponding size modes. As a special case, if
the client requests a single screen with an odd size (for example when
adjusting the size of a non-fullscreen vncviewer), find a smaller
suitable mode, and reduce the framebuffer size as well.
diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h
index c9106f8..ff52c01 100644
--- a/unix/x0vncserver/XDesktop.h
+++ b/unix/x0vncserver/XDesktop.h
@@ -23,6 +23,7 @@
 
 #include <rfb/VNCServerST.h>
 #include <tx/TXWindow.h>
+#include <unixcommon.h>
 
 #include <X11/XKBlib.h>
 #ifdef HAVE_XDAMAGE
@@ -49,6 +50,9 @@
   KeyCode XkbKeysymToKeycode(Display* dpy, KeySym keysym);
   virtual void keyEvent(rdr::U32 keysym, rdr::U32 xtcode, bool down);
   virtual void clientCutText(const char* str, int len);
+  virtual unsigned int setScreenLayout(int fb_width, int fb_height,
+                                       const rfb::ScreenSet& layout);
+
   // -=- TXGlobalEventHandler interface
   virtual bool handleGlobalEvent(XEvent* ev);
 
@@ -71,11 +75,17 @@
 #ifdef HAVE_XFIXES
   int xfixesEventBase;
 #endif
+#ifdef HAVE_XRANDR
+  int xrandrEventBase;
+  OutputIdMap outputIdMap;
+  unsigned long randrSyncSerial;
+#endif
   int ledMasks[XDESKTOP_N_LEDS];
   unsigned ledState;
   const unsigned short *codeMap;
   unsigned codeMapLen;
   bool setCursor();
+  rfb::ScreenSet computeScreenLayout();
 };
 
 #endif // __XDESKTOP_H__