Hi guys,

dotWhenNoCursor option, which controls how to behave when no cursor
exists, is sometimes ignored. Proposed patch should fix this issue,
should be commited to both 1.0 and trunk.

Do you have any comments?

Regards, Adam

-- 
Adam Tkac, Red Hat, Inc.
Index: unix/vncviewer/DesktopWindow.h
===================================================================
--- unix/vncviewer/DesktopWindow.h      (revision 3903)
+++ unix/vncviewer/DesktopWindow.h      (working copy)
@@ -29,6 +29,7 @@
 #include "TXWindow.h"
 #include "TXViewport.h"
 #include "TXImage.h"
+#include "parameters.h"
 
 class CConn;
 
@@ -54,6 +55,12 @@
   // resetLocalCursor() stops the rendering of the local cursor
   void resetLocalCursor();
 
+  // setNoCursor() sets what to display when no cursor is defined - if dot or
+  // nothing.
+  inline void setNoCursor() {
+    XDefineCursor(dpy, win(), dotWhenNoCursor ? dotCursor : noCursor);
+  }
+
   // Methods forwarded from CConn
   void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
   void serverCutText(const char* str, rdr::U32 len);
Index: unix/vncviewer/CConn.cxx
===================================================================
--- unix/vncviewer/CConn.cxx    (revision 3903)
+++ unix/vncviewer/CConn.cxx    (working copy)
@@ -684,6 +684,7 @@
       desktop->resetLocalCursor();
   }
   dotWhenNoCursor.setParam(options.dotWhenNoCursor.checked());
+  desktop->setNoCursor();
   checkEncodings();
 }
 
Index: unix/vncviewer/DesktopWindow.cxx
===================================================================
--- unix/vncviewer/DesktopWindow.cxx    (revision 3903)
+++ unix/vncviewer/DesktopWindow.cxx    (working copy)
@@ -79,7 +79,7 @@
                PointerMotionMask | KeyPressMask | KeyReleaseMask |
                EnterWindowMask | LeaveWindowMask);
   createXCursors();
-  XDefineCursor(dpy, win(), dotCursor);
+  setNoCursor();
   im = new TXImage(dpy, width(), height());
   if (!serverPF.trueColour)
     im->setPF(serverPF);
@@ -139,12 +139,9 @@
     if (((rdr::U8*)mask)[i]) break;
 
   if (i == mask_len) {
-    if (dotWhenNoCursor) {
+    if (dotWhenNoCursor)
       vlog.debug("cursor is empty - using dot");
-      XDefineCursor(dpy, win(), dotCursor);
-    } else {
-      XDefineCursor(dpy, win(), noCursor);
-    }
+    setNoCursor();
     cursorAvailable = false;
     return;
   }
@@ -206,7 +203,7 @@
 void DesktopWindow::resetLocalCursor()
 {
   hideLocalCursor();
-  XDefineCursor(dpy, win(), dotCursor);
+  setNoCursor();
   cursorAvailable = false;
 }
 
@@ -226,7 +223,7 @@
     if (!getPF().equal(cursor.getPF()) ||
         cursor.getRect().is_empty()) {
       vlog.error("attempting to render invalid local cursor");
-      XDefineCursor(dpy, win(), dotCursor);
+      setNoCursor();
       cursorAvailable = false;
       return;
     }
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to