Revision: 4481
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4481&view=rev
Author:   ossman_
Date:     2011-06-09 08:42:04 +0000 (Thu, 09 Jun 2011)

Log Message:
-----------
We can get 0x0 cursor sometimes when the server wants to hide it.

Modified Paths:
--------------
    trunk/vncviewer/Viewport.cxx

Modified: trunk/vncviewer/Viewport.cxx
===================================================================
--- trunk/vncviewer/Viewport.cxx        2011-06-09 08:39:35 UTC (rev 4480)
+++ trunk/vncviewer/Viewport.cxx        2011-06-09 08:42:04 UTC (rev 4481)
@@ -214,33 +214,40 @@
     cursor = new Fl_RGB_Image(&pxm);
     cursorHotspot.x = cursorHotspot.y = 2;
   } else {
-    U8 *buffer = new U8[width*height*4];
-    U8 *i, *o, *m;
-    int m_width;
+    if ((width == 0) || (height == 0)) {
+      U8 *buffer = new U8[4];
+      memset(buffer, 0, 4);
+      cursor = new Fl_RGB_Image(buffer, 1, 1, 4);
+      cursorHotspot.x = cursorHotspot.y = 0;
+    } else {
+      U8 *buffer = new U8[width*height*4];
+      U8 *i, *o, *m;
+      int m_width;
 
-    const PixelFormat &pf = frameBuffer->getPF();
+      const PixelFormat &pf = frameBuffer->getPF();
 
-    i = (U8*)data;
-    o = buffer;
-    m = (U8*)mask;
-    m_width = (width+7)/8;
-    for (int y = 0;y < height;y++) {
-      for (int x = 0;x < width;x++) {
-        pf.rgbFromBuffer(o, i, 1, &colourMap);
+      i = (U8*)data;
+      o = buffer;
+      m = (U8*)mask;
+      m_width = (width+7)/8;
+      for (int y = 0;y < height;y++) {
+        for (int x = 0;x < width;x++) {
+          pf.rgbFromBuffer(o, i, 1, &colourMap);
 
-        if (m[(m_width*y)+(x/8)] & 0x80>>(x%8))
-          o[3] = 255;
-        else
-          o[3] = 0;
+          if (m[(m_width*y)+(x/8)] & 0x80>>(x%8))
+            o[3] = 255;
+          else
+            o[3] = 0;
 
-        o += 4;
-        i += pf.bpp/8;
+          o += 4;
+          i += pf.bpp/8;
+        }
       }
-    }
 
-    cursor = new Fl_RGB_Image(buffer, width, height, 4);
+      cursor = new Fl_RGB_Image(buffer, width, height, 4);
 
-    cursorHotspot = hotspot;
+      cursorHotspot = hotspot;
+    }
   }
 
   if (Fl::belowmouse() == this)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to