---
 vncviewer/CConn.cxx         |    3 ++-
 vncviewer/CConn.h           |    2 ++
 vncviewer/DesktopWindow.cxx |   17 ++++++++++++++---
 vncviewer/Viewport.cxx      |    6 ++++++
 vncviewer/Viewport.h        |    2 ++
 vncviewer/vncviewer.man     |    1 +
 6 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index fbd9a8e..d676deb 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -303,7 +303,7 @@ void CConn::framebufferUpdateEnd()
 {
   desktop->updateWindow();
 
-  if (firstUpdate) {
+  if (firstUpdate || newDesktopSize) {
     int width, height;
 
     // We need fences to make extra update requests and continuous
@@ -342,6 +342,7 @@ void CConn::framebufferUpdateEnd()
     }
 
     firstUpdate = false;
+    if (newDesktopSize) newDesktopSize = false;
   }
 
   // A format change has been scheduled and we are now past the update
diff --git a/vncviewer/CConn.h b/vncviewer/CConn.h
index ea4edb5..8374beb 100644
--- a/vncviewer/CConn.h
+++ b/vncviewer/CConn.h
@@ -76,6 +76,8 @@ public:
                  void* data, void* mask);
 
   void fence(rdr::U32 flags, unsigned len, const char data[]);
+  
+  bool newDesktopSize;
 
 private:
 
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index d2975dc..32a4cb6 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -54,7 +54,7 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name,
   : Fl_Window(w, h)
 {
   // Allow resize
-  size_range(100, 100, w, h);
+  size_range(100, 100, 0, 0);
 
   Fl_Scroll *scroll = new Fl_Scroll(0, 0, w, h);
   scroll->color(FL_BLACK);
@@ -190,7 +190,7 @@ void DesktopWindow::resizeFramebuffer(int new_w, int new_h)
 #ifdef HAVE_FLTK_FULLSCREEN
   if (!fullscreen_active())
 #endif
-  size_range(100, 100, new_w, new_h);
+  size_range(100, 100, 0, 0);
 
   // repositionViewport() makes sure the scroll widget notices any changes
   // in position, but it might be just the size that changes so we also
@@ -210,6 +210,17 @@ void DesktopWindow::resize(int x, int y, int w, int h)
 {
   Fl_Window::resize(x, y, w, h);
 
+  int req_w = w &~ 63;
+  int req_h = h &~ 63;
+
+  if (req_w != viewport->w() && req_h != viewport->h()) {
+    // Request framebuffer resize
+    char buff[20];
+    snprintf(buff, 20, "%dx%d", req_w, req_h);
+    desktopSize.setParam(buff);
+    viewport->sendNewDesktopSize();
+  }
+
   // Deal with some scrolling corner cases
   repositionViewport();
 }
@@ -223,7 +234,7 @@ int DesktopWindow::handle(int event)
     fullScreen.setParam(fullscreen_active());
 
     if (!fullscreen_active()) {      
-      size_range(100, 100, viewport->w(), viewport->h());
+      size_range(100, 100, 0, 0);
       size(viewport->w(), viewport->h());
     } else {
       // We need to turn off the size limitations for proper
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 768bc34..1d097cc 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -975,3 +975,9 @@ void Viewport::handleOptions(void *data)
 
   self->setMenuKey();
 }
+
+void Viewport::sendNewDesktopSize()
+{
+  cc->newDesktopSize = true;
+}
+
diff --git a/vncviewer/Viewport.h b/vncviewer/Viewport.h
index c66c19a..d911640 100644
--- a/vncviewer/Viewport.h
+++ b/vncviewer/Viewport.h
@@ -117,6 +117,8 @@ public:
   void resize(int x, int y, int w, int h);
 
   int handle(int event);
+  
+  void sendNewDesktopSize();
 
 private:
 
diff --git a/vncviewer/vncviewer.man b/vncviewer/vncviewer.man
index 9a0c864..8d2c9e0 100644
--- a/vncviewer/vncviewer.man
+++ b/vncviewer/vncviewer.man
@@ -141,6 +141,7 @@ Instead of keeping the existing remote screen size, the 
client will attempt to
 switch to the specified since when connecting. If the server does not support
 the SetDesktopSize message then the screen will retain the original size.
 
+Note that servers are not required to accept the requested size.
 .TP
 .B \-AutoSelect
 Use automatic selection of encoding and pixel format (default is on).  Normally
-- 
1.7.9.2

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to