]> source.dussan.org Git - tigervnc.git/commitdiff
More debug logging for screen layout changes 109/head
authorPierre Ossman <ossman@cendio.se>
Mon, 26 Jan 2015 14:15:47 +0000 (15:15 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 26 Jan 2015 14:15:47 +0000 (15:15 +0100)
common/rfb/ScreenSet.h
unix/xserver/hw/vnc/XserverDesktop.cc
vncviewer/DesktopWindow.cxx

index 8997aa64a0a1a98418c5514b7f8e6782124156c3..ad340c2b6249ba597ac79d6dd410a397abc80882 100644 (file)
@@ -22,6 +22,7 @@
 #define __RFB_SCREENSET_INCLUDED__
 
 #include <stdio.h>
+#include <string.h>
 
 #include <rdr/types.h>
 #include <rfb/Rect.h>
@@ -108,15 +109,20 @@ namespace rfb {
       return true;
     };
 
-    inline void debug_print(void) const {
+    inline void print(char* str, size_t len) const {
+      char buffer[128];
       std::list<Screen>::const_iterator iter;
-      fprintf(stderr, "%d screens\n", num_screens());
+      snprintf(buffer, sizeof(buffer), "%d screen(s)\n", num_screens());
+      str[0] = '\0';
+      strncat(str, buffer, len - 1 - strlen(str));
       for (iter = screens.begin();iter != screens.end();++iter) {
-        fprintf(stderr, "    %10d (0x%08x): %dx%d+%d+%d (flags 0x%08x)\n",
-                (int)iter->id, (unsigned)iter->id,
-                iter->dimensions.width(), iter->dimensions.height(),
-                iter->dimensions.tl.x, iter->dimensions.tl.y,
-                (unsigned)iter->flags);
+        snprintf(buffer, sizeof(buffer),
+                 "    %10d (0x%08x): %dx%d+%d+%d (flags 0x%08x)\n",
+                 (int)iter->id, (unsigned)iter->id,
+                 iter->dimensions.width(), iter->dimensions.height(),
+                 iter->dimensions.tl.x, iter->dimensions.tl.y,
+                 (unsigned)iter->flags);
+        strncat(str, buffer, len - 1 - strlen(str));
       }
     };
 
index 3774b7f6ffa718210c32d9065b8e1c3e396755ba..b89881311c3d30af5855dd8ae07cb1e53f635a4e 100644 (file)
@@ -653,6 +653,12 @@ unsigned int XserverDesktop::setScreenLayout(int fb_width, int fb_height,
   if (vncRandRGetOutputCount(screenIndex) == 0)
     return rfb::resultProhibited;
 
+  char buffer[2048];
+  vlog.debug("Got request for framebuffer resize to %dx%d",
+             fb_width, fb_height);
+  layout.print(buffer, sizeof(buffer));
+  vlog.debug("%s", buffer);
+
   /*
    * First check that we don't have any active clone modes. That's just
    * too messy to deal with.
@@ -667,6 +673,8 @@ unsigned int XserverDesktop::setScreenLayout(int fb_width, int fb_height,
 
   /* Try to create more outputs if needed... (only works on Xvnc) */
   if (layout.num_screens() > availableOutputs) {
+    vlog.debug("Insufficient screens. Need to create %d more.",
+               layout.num_screens() - availableOutputs);
     ret = vncRandRCreateOutputs(screenIndex,
                                 layout.num_screens() - availableOutputs);
     if (ret < 0) {
index 423d2df311f665026013a21d5d0a0be0f117396c..e204662414974193bb67e369def3caa0d731e89f 100644 (file)
@@ -798,8 +798,11 @@ void DesktopWindow::remoteResize(int width, int height)
       (layout == cc->cp.screenLayout))
     return;
 
-  vlog.debug("Requesting framebuffer resize from %dx%d to %dx%d (%d screens)",
-             cc->cp.width, cc->cp.height, width, height, layout.num_screens());
+  char buffer[2048];
+  vlog.debug("Requesting framebuffer resize from %dx%d to %dx%d",
+             cc->cp.width, cc->cp.height, width, height);
+  layout.print(buffer, sizeof(buffer));
+  vlog.debug("%s", buffer);
 
   if (!layout.validate(width, height)) {
     vlog.error(_("Invalid screen layout computed for resize request!"));