diff options
author | Pierre Ossman <ossman@cendio.se> | 2015-01-26 15:15:47 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2015-01-26 15:15:47 +0100 |
commit | 9018af44dadebb5ed50ba9336007fc9da653a9a0 (patch) | |
tree | 72679584f53464b51dc926a1da44540d6feb95c8 | |
parent | 5789572d977a77896efbeaf53c055904057f29c3 (diff) | |
download | tigervnc-9018af44dadebb5ed50ba9336007fc9da653a9a0.tar.gz tigervnc-9018af44dadebb5ed50ba9336007fc9da653a9a0.zip |
More debug logging for screen layout changes
-rw-r--r-- | common/rfb/ScreenSet.h | 20 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/XserverDesktop.cc | 8 | ||||
-rw-r--r-- | vncviewer/DesktopWindow.cxx | 7 |
3 files changed, 26 insertions, 9 deletions
diff --git a/common/rfb/ScreenSet.h b/common/rfb/ScreenSet.h index 8997aa64..ad340c2b 100644 --- a/common/rfb/ScreenSet.h +++ b/common/rfb/ScreenSet.h @@ -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)); } }; diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index 3774b7f6..b8988131 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -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) { diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index 423d2df3..e2046624 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -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!")); |