summaryrefslogtreecommitdiffstats
path: root/x0vncserver
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2006-02-10 12:19:11 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2006-02-10 12:19:11 +0000
commitaf2ebebeb578df8c14b0e340e99161bdcdc245ba (patch)
tree9e0c7caf32c79a21dfa93a351baccf9bebec2151 /x0vncserver
parenta4f0736e6316ac16320ed56c51682e15e901efd9 (diff)
downloadtigervnc-af2ebebeb578df8c14b0e340e99161bdcdc245ba.tar.gz
tigervnc-af2ebebeb578df8c14b0e340e99161bdcdc245ba.zip
Do not poll screen area near the pointer if the pointer did not move
for about 5 seconds. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@481 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'x0vncserver')
-rw-r--r--x0vncserver/PollingManager.cxx15
-rw-r--r--x0vncserver/PollingManager.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/x0vncserver/PollingManager.cxx b/x0vncserver/PollingManager.cxx
index 2d8b87af..0c972dd3 100644
--- a/x0vncserver/PollingManager.cxx
+++ b/x0vncserver/PollingManager.cxx
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
+#include <time.h>
#include <sys/time.h>
#include <X11/Xlib.h>
#include <rfb/VNCServer.h>
@@ -126,14 +127,13 @@ void PollingManager::setVNCServer(VNCServer *s)
void PollingManager::setPointerPos(const Point &pos)
{
+ m_pointerPosTime = time(NULL);
m_pointerPos = pos;
m_pointerPosKnown = true;
}
//
// Indicate that current pointer position is unknown.
-// FIXME: Perhaps this should be done automatically after a number of
-// polling cycles if the cursor position have not been changed?
//
void PollingManager::unsetPointerPos()
@@ -190,8 +190,17 @@ void PollingManager::poll()
}
// Second step: optional thorough polling of the area around the pointer.
+ // We do that only if the pointer position is known and was set recently.
- bool changes2 = pollPointer && m_pointerPosKnown && pollPointerArea();
+ bool changes2 = false;
+ if (pollPointer) {
+ if (m_pointerPosKnown && time(NULL) - m_pointerPosTime >= 5) {
+ unsetPointerPos();
+ }
+ if (m_pointerPosKnown) {
+ changes2 = pollPointerArea();
+ }
+ }
// Update if needed.
diff --git a/x0vncserver/PollingManager.h b/x0vncserver/PollingManager.h
index a35fafee..04cc767d 100644
--- a/x0vncserver/PollingManager.h
+++ b/x0vncserver/PollingManager.h
@@ -76,6 +76,7 @@ protected:
// Tracking pointer position for polling improvements.
bool m_pointerPosKnown;
Point m_pointerPos;
+ time_t m_pointerPosTime;
private: