]> source.dussan.org Git - tigervnc.git/commitdiff
Better logging -- less repeated information.
authorConstantin Kaplinsky <const@tightvnc.com>
Mon, 22 May 2006 09:07:19 +0000 (09:07 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Mon, 22 May 2006 09:07:19 +0000 (09:07 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@575 3789f03b-4d11-0410-bbf8-ca57d06f2519

x0vncserver/Image.cxx
x0vncserver/Image.h
x0vncserver/PollingManager.cxx
x0vncserver/x0vncserver.cxx

index 24d6c3778dedd4143e3072f06f48f800c2b932bf..fc66c5a9e82013e8c1acdcf893b7d0e2acea4c51 100644 (file)
@@ -512,14 +512,12 @@ Image *ImageFactory::newImage(Display *d, int width, int height)
     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
@@ -536,7 +534,6 @@ Image *ImageFactory::newImage(Display *d, int width, int height)
   if (mayUseShm) {
     image = new ShmImage(d, width, height);
     if (image->xim != NULL) {
-      vlog.info("Using shared memory image");
       return image;
     }
 
@@ -547,7 +544,6 @@ Image *ImageFactory::newImage(Display *d, int width, int height)
 
   // Fall back to Xlib image.
 
-  vlog.info("Using Xlib-based image");
   image = new Image(d, width, height);
   return image;
 }
index e3de17d0b5eff9972f971001589b59d025624661..535cee6ac4ed47c8ce86c9922933266eb9696db5 100644 (file)
@@ -38,7 +38,14 @@ public:
   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);
@@ -89,6 +96,13 @@ public:
   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);
 
@@ -118,6 +132,13 @@ public:
   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);
 
@@ -156,6 +177,13 @@ public:
   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);
 
index 8328101ae1e805e0dda36885c4bbb762c2bfc516..a823ed4274ef18be57ea4a2bb0f313c25dc79772 100644 (file)
 #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",
@@ -75,11 +78,20 @@ PollingManager::PollingManager(Display *dpy, Image *image,
   // 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
index 530f60e88f5fe4d8d00b7fd4aabe6687e67ca2e9..1f1d0f496ad90c26984f4dc2414d9559339d5070 100644 (file)
@@ -57,7 +57,7 @@
 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 "
@@ -75,11 +75,16 @@ IntParameter queryConnectTimeout("QueryConnectTimeout",
                                  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);
 }
 
@@ -172,6 +177,7 @@ public:
     // 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.