diff options
author | Pierre Ossman <ossman@cendio.se> | 2011-06-09 08:42:04 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2011-06-09 08:42:04 +0000 |
commit | 17a48f051071773ede9a348ce8cd64c0790b9774 (patch) | |
tree | 4ba98ac31510278ac727c27bf6a4e20cc500964b | |
parent | a51574a1bff4091a1e2c3b39bf8e4e299eec8665 (diff) | |
download | tigervnc-17a48f051071773ede9a348ce8cd64c0790b9774.tar.gz tigervnc-17a48f051071773ede9a348ce8cd64c0790b9774.zip |
We can get 0x0 cursor sometimes when the server wants to hide it.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4481 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | vncviewer/Viewport.cxx | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index f673dd84..d3c21edb 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -214,33 +214,40 @@ void Viewport::setCursor(int width, int height, const Point& hotspot, 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; - - 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); - - if (m[(m_width*y)+(x/8)] & 0x80>>(x%8)) - o[3] = 255; - else - o[3] = 0; - - o += 4; - i += pf.bpp/8; + 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(); + + 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; + + 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) |