if (mayUseShm) {
image = new IrixOverlayShmImage(d, width, height);
if (image->xim != NULL) {
- vlog.info("Using IRIX overlay image with SHM support");
return image;
}
}
#elif defined(HAVE_SUN_OVL)
image = new SolarisOverlayImage(d, width, height);
if (image->xim != NULL) {
- vlog.info("Using Solaris overlay image");
return image;
}
#endif
if (mayUseShm) {
image = new ShmImage(d, width, height);
if (image->xim != NULL) {
- vlog.info("Using shared memory image");
return image;
}
// Fall back to Xlib image.
- vlog.info("Using Xlib-based image");
image = new Image(d, width, height);
return image;
}
Image(Display *d, int width, int height);
virtual ~Image();
- bool isTrueColor() { return trueColor; }
+ bool isTrueColor() const { return trueColor; }
+
+ virtual const char *className() const {
+ return "Image";
+ }
+ virtual const char *classDesc() const {
+ return "basic Xlib image";
+ }
virtual void get(Window wnd, int x = 0, int y = 0);
virtual void get(Window wnd, int x, int y, int w, int h);
ShmImage(Display *d, int width, int height);
virtual ~ShmImage();
+ virtual const char *className() const {
+ return "ShmImage";
+ }
+ virtual const char *classDesc() const {
+ return "shared memory image";
+ }
+
virtual void get(Window wnd, int x = 0, int y = 0);
virtual void get(Window wnd, int x, int y, int w, int h);
IrixOverlayShmImage(Display *d, int width, int height);
virtual ~IrixOverlayShmImage();
+ virtual const char *className() const {
+ return "IrixOverlayShmImage";
+ }
+ virtual const char *classDesc() const {
+ return "IRIX-specific SHM-aware overlay image";
+ }
+
virtual void get(Window wnd, int x = 0, int y = 0);
virtual void get(Window wnd, int x, int y, int w, int h);
SolarisOverlayImage(Display *d, int width, int height);
virtual ~SolarisOverlayImage();
+ virtual const char *className() const {
+ return "SolarisOverlayImage";
+ }
+ virtual const char *classDesc() const {
+ return "Solaris-specific non-SHM overlay image";
+ }
+
virtual void get(Window wnd, int x = 0, int y = 0);
virtual void get(Window wnd, int x, int y, int w, int h);
#include <string.h>
#include <time.h>
#include <X11/Xlib.h>
+#include <rfb/LogWriter.h>
#include <rfb/VNCServer.h>
#include <rfb/Configuration.h>
#include <rfb/ServerCore.h>
#include <x0vncserver/PollingManager.h>
+static LogWriter vlog("PollingMgr");
+
BoolParameter PollingManager::pollPointer
("PollPointer",
"DEBUG: Poll area under the pointer with higher priority",
// Get initial screen image.
m_image->get(DefaultRootWindow(m_dpy), m_offsetLeft, m_offsetTop);
- // Create additional images used in the polling algorithm.
- // FIXME: verify that these images use the same pixel format as in m_image.
+ // Create additional images used in polling algorithms, warn if
+ // underlying class names are different from the class name of the
+ // primary image.
m_rowImage = factory->newImage(m_dpy, m_width, 1);
m_tileImage = factory->newImage(m_dpy, 32, 32);
m_areaImage = factory->newImage(m_dpy, 128, 128);
+ if (strcmp(m_image->className(), m_rowImage->className()) != 0 ||
+ strcmp(m_image->className(), m_tileImage->className()) != 0 ||
+ strcmp(m_image->className(), m_areaImage->className()) != 0) {
+ vlog.error("Image types do not match (%s, %s, %s)",
+ m_rowImage->className(),
+ m_tileImage->className(),
+ m_areaImage->className());
+ }
// FIXME: Extend the comment.
// Create a matrix with one byte per each 32x32 tile. It will be
using namespace rfb;
using namespace network;
-LogWriter vlog("main");
+LogWriter vlog("Main");
IntParameter pollingCycle("PollingCycle", "Milliseconds per one polling "
"cycle; actual interval may be dynamically "
10);
StringParameter hostsFile("HostsFile", "File with IP access control rules", "");
+//
+// CleanupSignalHandler allows C++ object cleanup to happen because
+// it calls exit() rather than the default which is to abort.
+//
+
static void CleanupSignalHandler(int sig)
{
- // CleanupSignalHandler allows C++ object cleanup to happen because it calls
- // exit() rather than the default which is to abort.
+#ifdef DEBUG
fprintf(stderr,"CleanupSignalHandler called\n");
+#endif
exit(1);
}
// Create an image for maintaining framebuffer data.
ImageFactory factory((bool)useShm, (bool)useOverlay);
image = factory.newImage(dpy, geometry->width(), geometry->height());
+ vlog.info("Allocated %s", image->classDesc());
// Create polling manager object. It will track screen changes and
// keep pixels of the `image' object up to date.