[Bugfix] Honor dotWhenNoCursor option (and it's changes) every time.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3904 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/vncviewer/CConn.cxx b/unix/vncviewer/CConn.cxx
index 8231f4c..2454be2 100644
--- a/unix/vncviewer/CConn.cxx
+++ b/unix/vncviewer/CConn.cxx
@@ -684,6 +684,7 @@
desktop->resetLocalCursor();
}
dotWhenNoCursor.setParam(options.dotWhenNoCursor.checked());
+ desktop->setNoCursor();
checkEncodings();
}
diff --git a/unix/vncviewer/DesktopWindow.cxx b/unix/vncviewer/DesktopWindow.cxx
index 51f3b85..234e004 100644
--- a/unix/vncviewer/DesktopWindow.cxx
+++ b/unix/vncviewer/DesktopWindow.cxx
@@ -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;
}
diff --git a/unix/vncviewer/DesktopWindow.h b/unix/vncviewer/DesktopWindow.h
index 433ac33..eb8d59d 100644
--- a/unix/vncviewer/DesktopWindow.h
+++ b/unix/vncviewer/DesktopWindow.h
@@ -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);