aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2025-02-13 11:16:56 +0100
committerPierre Ossman <ossman@cendio.se>2025-02-25 16:58:30 +0100
commit0fcb68f8a4e86a3090f9cc3542be9c1a851c8a1d (patch)
tree470b27a8ce699bf19c2f8cc8fad81ad116d43376
parent8638c42cbe8e63ae4a90fee7de0436c4cf6eece2 (diff)
downloadtigervnc-0fcb68f8a4e86a3090f9cc3542be9c1a851c8a1d.tar.gz
tigervnc-0fcb68f8a4e86a3090f9cc3542be9c1a851c8a1d.zip
Move timers to core library
Make it clearer what is protocol handling and what is just general plumbing. This is one step of several.
-rw-r--r--common/core/CMakeLists.txt1
-rw-r--r--common/core/Timer.cxx (renamed from common/rfb/Timer.cxx)5
-rw-r--r--common/core/Timer.h (renamed from common/rfb/Timer.h)6
-rw-r--r--common/rfb/CMakeLists.txt1
-rw-r--r--common/rfb/EncodeManager.cxx2
-rw-r--r--common/rfb/EncodeManager.h8
-rw-r--r--common/rfb/SConnection.cxx2
-rw-r--r--common/rfb/SConnection.h7
-rw-r--r--common/rfb/VNCSConnectionST.cxx2
-rw-r--r--common/rfb/VNCSConnectionST.h13
-rw-r--r--common/rfb/VNCServerST.cxx2
-rw-r--r--common/rfb/VNCServerST.h15
-rw-r--r--tests/unit/CMakeLists.txt4
-rw-r--r--tests/unit/emulatemb.cxx12
-rw-r--r--tests/unit/gesturehandler.cxx34
-rw-r--r--unix/vncconfig/QueryConnectDialog.cxx3
-rw-r--r--unix/vncconfig/QueryConnectDialog.h9
-rw-r--r--unix/vncconfig/vncconfig.cxx4
-rw-r--r--unix/x0vncserver/x0vncserver.cxx6
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc4
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.h9
-rw-r--r--vncviewer/CConn.cxx4
-rw-r--r--vncviewer/EmulateMB.cxx4
-rw-r--r--vncviewer/EmulateMB.h9
-rw-r--r--vncviewer/GestureHandler.cxx2
-rw-r--r--vncviewer/GestureHandler.h10
-rw-r--r--vncviewer/vncviewer.cxx4
-rw-r--r--win/rfb_win32/SocketManager.cxx2
28 files changed, 92 insertions, 92 deletions
diff --git a/common/core/CMakeLists.txt b/common/core/CMakeLists.txt
index 78c92652..7f3e9983 100644
--- a/common/core/CMakeLists.txt
+++ b/common/core/CMakeLists.txt
@@ -6,6 +6,7 @@ add_library(core STATIC
Logger_stdio.cxx
LogWriter.cxx
Region.cxx
+ Timer.cxx
util.cxx)
target_link_libraries(core os)
diff --git a/common/rfb/Timer.cxx b/common/core/Timer.cxx
index 483be87c..5c0fcc29 100644
--- a/common/rfb/Timer.cxx
+++ b/common/core/Timer.cxx
@@ -29,13 +29,10 @@
#include <algorithm>
#include <core/LogWriter.h>
+#include <core/Timer.h>
#include <core/util.h>
-#include <rfb/Timer.h>
-
-// Temporary during transition to new structure:
using namespace core;
-using namespace rfb;
#ifndef __NO_DEFINE_VLOG__
static LogWriter vlog("Timer");
diff --git a/common/rfb/Timer.h b/common/core/Timer.h
index 362cb84e..cde672b2 100644
--- a/common/rfb/Timer.h
+++ b/common/core/Timer.h
@@ -17,13 +17,13 @@
* USA.
*/
-#ifndef __RFB_TIMER_H__
-#define __RFB_TIMER_H__
+#ifndef __CORE_TIMER_H__
+#define __CORE_TIMER_H__
#include <list>
#include <sys/time.h>
-namespace rfb {
+namespace core {
/* Timer
diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt
index dfdc463b..42f2409d 100644
--- a/common/rfb/CMakeLists.txt
+++ b/common/rfb/CMakeLists.txt
@@ -44,7 +44,6 @@ add_library(rfb STATIC
SSecurityStack.cxx
SSecurityVncAuth.cxx
SSecurityVeNCrypt.cxx
- Timer.cxx
TightDecoder.cxx
TightEncoder.cxx
TightJPEGEncoder.cxx
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
index 2d2c7e8a..a482991e 100644
--- a/common/rfb/EncodeManager.cxx
+++ b/common/rfb/EncodeManager.cxx
@@ -298,7 +298,7 @@ void EncodeManager::writeLosslessRefresh(const core::Region& req,
{}, {}, pb, renderedCursor);
}
-void EncodeManager::handleTimeout(Timer* t)
+void EncodeManager::handleTimeout(core::Timer* t)
{
if (t == &recentChangeTimer) {
// Any lossy region that wasn't recently updated can
diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h
index 1bc221aa..959c13d6 100644
--- a/common/rfb/EncodeManager.h
+++ b/common/rfb/EncodeManager.h
@@ -25,9 +25,9 @@
#include <stdint.h>
#include <core/Region.h>
+#include <core/Timer.h>
#include <rfb/PixelBuffer.h>
-#include <rfb/Timer.h>
namespace rfb {
@@ -39,7 +39,7 @@ namespace rfb {
struct RectInfo;
- class EncodeManager : public Timer::Callback {
+ class EncodeManager : public core::Timer::Callback {
public:
EncodeManager(SConnection* conn);
~EncodeManager();
@@ -63,7 +63,7 @@ namespace rfb {
size_t maxUpdateSize);
protected:
- void handleTimeout(Timer* t) override;
+ void handleTimeout(core::Timer* t) override;
void doUpdate(bool allowLossy, const core::Region& changed,
const core::Region& copied,
@@ -126,7 +126,7 @@ namespace rfb {
core::Region recentlyChangedRegion;
core::Region pendingRefreshRegion;
- Timer recentChangeTimer;
+ core::Timer recentChangeTimer;
struct EncoderStats {
unsigned rects;
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 876521a8..3017f6ae 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -280,7 +280,7 @@ bool SConnection::processInitMsg()
return reader_->readClientInit();
}
-void SConnection::handleAuthFailureTimeout(Timer* /*t*/)
+void SConnection::handleAuthFailureTimeout(core::Timer* /*t*/)
{
if (state_ != RFBSTATE_SECURITY_FAILURE) {
close("SConnection::handleAuthFailureTimeout: Invalid state");
diff --git a/common/rfb/SConnection.h b/common/rfb/SConnection.h
index df3dfe92..0f4de5a5 100644
--- a/common/rfb/SConnection.h
+++ b/common/rfb/SConnection.h
@@ -26,10 +26,11 @@
#include <string>
+#include <core/Timer.h>
+
#include <rfb/AccessRights.h>
#include <rfb/SMsgHandler.h>
#include <rfb/SecurityServer.h>
-#include <rfb/Timer.h>
namespace rdr {
class InStream;
@@ -245,7 +246,7 @@ namespace rfb {
bool processSecurityFailure();
bool processInitMsg();
- void handleAuthFailureTimeout(Timer* t);
+ void handleAuthFailureTimeout(core::Timer* t);
int defaultMajorVersion, defaultMinorVersion;
@@ -258,7 +259,7 @@ namespace rfb {
SecurityServer security;
SSecurity* ssecurity;
- MethodTimer<SConnection> authFailureTimer;
+ core::MethodTimer<SConnection> authFailureTimer;
std::string authFailureMsg;
stateEnum state_;
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 8b47284d..20439d18 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -798,7 +798,7 @@ void VNCSConnectionST::supportsLEDState()
writer()->writeLEDState();
}
-void VNCSConnectionST::handleTimeout(Timer* t)
+void VNCSConnectionST::handleTimeout(core::Timer* t)
{
try {
if ((t == &congestionTimer) ||
diff --git a/common/rfb/VNCSConnectionST.h b/common/rfb/VNCSConnectionST.h
index 7335051a..b618923f 100644
--- a/common/rfb/VNCSConnectionST.h
+++ b/common/rfb/VNCSConnectionST.h
@@ -29,16 +29,17 @@
#include <map>
+#include <core/Timer.h>
+
#include <rfb/Congestion.h>
#include <rfb/EncodeManager.h>
#include <rfb/SConnection.h>
-#include <rfb/Timer.h>
namespace rfb {
class VNCServerST;
class VNCSConnectionST : private SConnection,
- public Timer::Callback {
+ public core::Timer::Callback {
public:
VNCSConnectionST(VNCServerST* server_, network::Socket* s, bool reverse,
AccessRights ar);
@@ -144,7 +145,7 @@ namespace rfb {
void supportsLEDState() override;
// Timer callbacks
- void handleTimeout(Timer* t) override;
+ void handleTimeout(core::Timer* t) override;
// Internal methods
@@ -181,8 +182,8 @@ namespace rfb {
uint8_t *fenceData;
Congestion congestion;
- Timer congestionTimer;
- Timer losslessTimer;
+ core::Timer congestionTimer;
+ core::Timer losslessTimer;
VNCServerST* server;
SimpleUpdateTracker updates;
@@ -195,7 +196,7 @@ namespace rfb {
std::map<uint32_t, uint32_t> pressedKeys;
- Timer idleTimer;
+ core::Timer idleTimer;
time_t pointerEventTime;
core::Point pointerEventPos;
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index b0581513..b45d926d 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -629,7 +629,7 @@ SConnection* VNCServerST::getConnection(network::Socket* sock) {
return nullptr;
}
-void VNCServerST::handleTimeout(Timer* t)
+void VNCServerST::handleTimeout(core::Timer* t)
{
if (t == &frameTimer) {
int timeout;
diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h
index 3d6fbeee..5db4513a 100644
--- a/common/rfb/VNCServerST.h
+++ b/common/rfb/VNCServerST.h
@@ -26,10 +26,11 @@
#include <sys/time.h>
+#include <core/Timer.h>
+
#include <rfb/VNCServer.h>
#include <rfb/Blacklist.h>
#include <rfb/Cursor.h>
-#include <rfb/Timer.h>
#include <rfb/ScreenSet.h>
namespace rfb {
@@ -42,7 +43,7 @@ namespace rfb {
class SDesktop;
class VNCServerST : public VNCServer,
- public Timer::Callback {
+ public core::Timer::Callback {
public:
// -=- Constructors
@@ -157,7 +158,7 @@ namespace rfb {
protected:
// Timer callbacks
- void handleTimeout(Timer* t) override;
+ void handleTimeout(core::Timer* t) override;
// - Internal methods
@@ -204,12 +205,12 @@ namespace rfb {
KeyRemapper* keyRemapper;
- Timer idleTimer;
- Timer disconnectTimer;
- Timer connectTimer;
+ core::Timer idleTimer;
+ core::Timer disconnectTimer;
+ core::Timer connectTimer;
uint64_t msc, queuedMsc;
- Timer frameTimer;
+ core::Timer frameTimer;
};
};
diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index ac7a91cf..12ba5699 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -11,7 +11,7 @@ add_executable(convertlf convertlf.cxx)
target_link_libraries(convertlf core)
add_executable(gesturehandler gesturehandler.cxx ../../vncviewer/GestureHandler.cxx)
-target_link_libraries(gesturehandler core rfb)
+target_link_libraries(gesturehandler core)
add_executable(hostport hostport.cxx)
target_link_libraries(hostport network)
@@ -24,4 +24,4 @@ target_link_libraries(unicode core)
add_executable(emulatemb emulatemb.cxx ../../vncviewer/EmulateMB.cxx)
target_include_directories(emulatemb SYSTEM PUBLIC ${GETTEXT_INCLUDE_DIR})
-target_link_libraries(emulatemb core rfb ${GETTEXT_LIBRARIES})
+target_link_libraries(emulatemb core ${GETTEXT_LIBRARIES})
diff --git a/tests/unit/emulatemb.cxx b/tests/unit/emulatemb.cxx
index 25b191b7..ac4c8a32 100644
--- a/tests/unit/emulatemb.cxx
+++ b/tests/unit/emulatemb.cxx
@@ -117,7 +117,7 @@ void testNormalLeftPress()
emulateMiddleButton.setParam(true);
test.filterPointerEvent({10, 20}, left);
usleep(100000); // 0.1s
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.results.size(), 2);
@@ -159,7 +159,7 @@ void testNormalRightPress()
emulateMiddleButton.setParam(true);
test.filterPointerEvent({0, 0}, right);
usleep(100000); // 0.1s
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.results.size(), 2);
@@ -328,7 +328,7 @@ void testBothPressAfterLeftTimeout()
emulateMiddleButton.setParam(true);
test.filterPointerEvent({10, 20}, left);
usleep(100000); // 0.1s
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.filterPointerEvent({10, 20}, both);
ASSERT_EQ(test.results.size(), 3);
@@ -357,7 +357,7 @@ void testBothPressAfterRightTimeout()
emulateMiddleButton.setParam(true);
test.filterPointerEvent({10, 20}, right);
usleep(100000); // 0.1s
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.filterPointerEvent({10, 20}, both);
ASSERT_EQ(test.results.size(), 3);
@@ -386,7 +386,7 @@ void testTimeoutAndDrag()
emulateMiddleButton.setParam(true);
test.filterPointerEvent({0, 0}, left);
usleep(100000); //0.1s
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.filterPointerEvent({10, 10}, left);
ASSERT_EQ(test.results.size(), 3);
@@ -416,7 +416,7 @@ void testDragAndTimeout()
test.filterPointerEvent({10, 10}, left);
test.filterPointerEvent({30, 30}, left);
usleep(100000); //0.1s
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.results.size(), 3);
diff --git a/tests/unit/gesturehandler.cxx b/tests/unit/gesturehandler.cxx
index 73b8c62c..f4b5f92e 100644
--- a/tests/unit/gesturehandler.cxx
+++ b/tests/unit/gesturehandler.cxx
@@ -115,7 +115,7 @@ void testTwoTapSlowBegin()
test.handleTouchBegin(1, 20.0, 30.0);
usleep(500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchBegin(2, 30.0, 50.0);
test.handleTouchEnd(1);
@@ -137,7 +137,7 @@ void testTwoTapSlowEnd()
test.handleTouchEnd(1);
usleep(500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchEnd(2);
@@ -156,7 +156,7 @@ void testTwoTapTimeout()
test.handleTouchBegin(2, 30.0, 50.0);
usleep(1500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchEnd(1);
test.handleTouchEnd(2);
@@ -213,7 +213,7 @@ void testThreeTapSlowBegin()
test.handleTouchBegin(2, 30.0, 50.0);
usleep(500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchBegin(3, 40.0, 40.0);
test.handleTouchEnd(1);
@@ -238,7 +238,7 @@ void testThreeTapSlowEnd()
test.handleTouchEnd(2);
usleep(500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchEnd(3);
@@ -281,7 +281,7 @@ void testThreeTapTimeout()
test.handleTouchBegin(3, 40.0, 40.0);
usleep(1500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchEnd(1);
test.handleTouchEnd(2);
@@ -429,7 +429,7 @@ void testLongPressNormal()
ASSERT_EQ(test.events.size(), 0);
usleep(1500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 1);
@@ -463,7 +463,7 @@ void testLongPressDrag()
ASSERT_EQ(test.events.size(), 0);
usleep(1500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 1);
@@ -673,7 +673,7 @@ void testTwoDragFastAlmost()
ASSERT_EQ(test.events.size(), 0);
usleep(500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 0);
@@ -694,7 +694,7 @@ void testTwoDragSlowHoriz()
ASSERT_EQ(test.events.size(), 0);
usleep(60000); // 60ms
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 2);
ASSERT_EQ(test.events[0].type, GestureBegin);
@@ -728,7 +728,7 @@ void testTwoDragSlowVert()
ASSERT_EQ(test.events.size(), 0);
usleep(60000); // 60ms
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 2);
ASSERT_EQ(test.events[0].type, GestureBegin);
@@ -762,7 +762,7 @@ void testTwoDragSlowDiag()
ASSERT_EQ(test.events.size(), 0);
usleep(60000); // 60ms
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 2);
ASSERT_EQ(test.events[0].type, GestureBegin);
@@ -791,7 +791,7 @@ void testTwoDragTooSlow()
test.handleTouchBegin(1, 20.0, 30.0);
usleep(500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchBegin(2, 30.0, 30.0);
test.handleTouchUpdate(2, 50.0, 30.0);
@@ -917,7 +917,7 @@ void testPinchFastAlmost()
ASSERT_EQ(test.events.size(), 0);
usleep(500000);
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 0);
@@ -941,7 +941,7 @@ void testPinchSlowIn()
ASSERT_EQ(test.events.size(), 0);
usleep(60000); // 60ms
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 2);
@@ -978,7 +978,7 @@ void testPinchSlowOut()
ASSERT_EQ(test.events.size(), 0);
usleep(60000); // 60ms
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
ASSERT_EQ(test.events.size(), 2);
@@ -1008,7 +1008,7 @@ void testPinchTooSlow()
test.handleTouchBegin(1, 0.0, 0.0);
usleep(60000); // 60ms
- rfb::Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
test.handleTouchBegin(2, 130.0, 130.0);
test.handleTouchUpdate(2, 100.0, 130.0);
diff --git a/unix/vncconfig/QueryConnectDialog.cxx b/unix/vncconfig/QueryConnectDialog.cxx
index 8ecb27d5..7beee5f4 100644
--- a/unix/vncconfig/QueryConnectDialog.cxx
+++ b/unix/vncconfig/QueryConnectDialog.cxx
@@ -74,7 +74,8 @@ void QueryConnectDialog::buttonActivate(TXButton* b) {
callback->queryRejected();
}
-void QueryConnectDialog::handleTimeout(rfb::Timer* t) {
+void QueryConnectDialog::handleTimeout(core::Timer* t)
+{
if (timeUntilReject-- == 0) {
unmap();
callback->queryTimedOut();
diff --git a/unix/vncconfig/QueryConnectDialog.h b/unix/vncconfig/QueryConnectDialog.h
index 5763e1ce..7e9450b0 100644
--- a/unix/vncconfig/QueryConnectDialog.h
+++ b/unix/vncconfig/QueryConnectDialog.h
@@ -19,7 +19,8 @@
#ifndef __QUERYCONNECTDIALOG_H__
#define __QUERYCONNECTDIALOG_H__
-#include <rfb/Timer.h>
+#include <core/Timer.h>
+
#include "TXLabel.h"
#include "TXButton.h"
#include "TXDialog.h"
@@ -34,7 +35,7 @@ class QueryResultCallback {
class QueryConnectDialog : public TXDialog, public TXEventHandler,
public TXButtonCallback,
- public rfb::Timer::Callback
+ public core::Timer::Callback
{
public:
QueryConnectDialog(Display* dpy, const char* address_,
@@ -43,14 +44,14 @@ class QueryConnectDialog : public TXDialog, public TXEventHandler,
void handleEvent(TXWindow*, XEvent* ) override { }
void deleteWindow(TXWindow*) override;
void buttonActivate(TXButton* b) override;
- void handleTimeout(rfb::Timer* t) override;
+ void handleTimeout(core::Timer* t) override;
private:
void refreshTimeout();
TXLabel addressLbl, address, userLbl, user, timeoutLbl, timeout;
TXButton accept, reject;
QueryResultCallback* callback;
int timeUntilReject;
- rfb::Timer timer;
+ core::Timer timer;
};
#endif
diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx
index 51d444c3..b1a5232b 100644
--- a/unix/vncconfig/vncconfig.cxx
+++ b/unix/vncconfig/vncconfig.cxx
@@ -50,8 +50,6 @@
#include "TXLabel.h"
#include "QueryConnectDialog.h"
-using namespace rfb;
-
static core::LogWriter vlog("vncconfig");
core::StringParameter displayname("display", "The X display", "");
@@ -352,7 +350,7 @@ int main(int argc, char** argv)
TXWindow::handleXEvents(dpy);
// Process expired timers and get the time until the next one
- int timeoutMs = Timer::checkTimeouts();
+ int timeoutMs = core::Timer::checkTimeouts();
if (timeoutMs >= 0) {
tv.tv_sec = timeoutMs / 1000;
tv.tv_usec = (timeoutMs % 1000) * 1000;
diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx
index b6e33014..a78ea3ed 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -34,11 +34,11 @@
#include <core/Configuration.h>
#include <core/Logger_stdio.h>
#include <core/LogWriter.h>
+#include <core/Timer.h>
#include <rdr/FdOutStream.h>
#include <rfb/VNCServerST.h>
-#include <rfb/Timer.h>
#include <network/TcpSocket.h>
#include <network/UnixSocket.h>
@@ -445,7 +445,7 @@ int main(int argc, char** argv)
}
// Trigger timers and check when the next will expire
- nextTimeout = Timer::checkTimeouts();
+ nextTimeout = core::Timer::checkTimeouts();
if (nextTimeout >= 0 && (wait_ms == -1 || nextTimeout < wait_ms))
wait_ms = nextTimeout;
@@ -479,7 +479,7 @@ int main(int argc, char** argv)
}
}
- Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
// Client list could have been changed.
server.getSockets(&sockets);
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index de6c0c94..67d4c4f7 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -407,7 +407,7 @@ void XserverDesktop::blockHandler(int* timeout)
}
// Trigger timers and check when the next will expire
- int nextTimeout = Timer::checkTimeouts();
+ int nextTimeout = core::Timer::checkTimeouts();
if (nextTimeout >= 0 && (*timeout == -1 || nextTimeout < *timeout))
*timeout = nextTimeout;
} catch (std::exception& e) {
@@ -548,7 +548,7 @@ void XserverDesktop::keyEvent(uint32_t keysym, uint32_t keycode, bool down)
vncKeyboardEvent(keysym, keycode, down);
}
-void XserverDesktop::handleTimeout(Timer* t)
+void XserverDesktop::handleTimeout(core::Timer* t)
{
if (t == &queryConnectTimer) {
server->approveConnection(queryConnectSocket, false,
diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
index 1d83083b..37f5b1b5 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.h
+++ b/unix/xserver/hw/vnc/XserverDesktop.h
@@ -31,9 +31,10 @@
#include <stdint.h>
+#include <core/Timer.h>
+
#include <rfb/SDesktop.h>
#include <rfb/PixelBuffer.h>
-#include <rfb/Timer.h>
#include <unixcommon.h>
@@ -46,7 +47,7 @@ namespace rfb {
namespace network { class SocketListener; class Socket; }
class XserverDesktop : public rfb::SDesktop, public rfb::FullFramePixelBuffer,
- public rfb::Timer::Callback {
+ public core::Timer::Callback {
public:
XserverDesktop(int screenIndex,
@@ -117,7 +118,7 @@ protected:
rfb::VNCServer* sockserv,
bool read, bool write);
- void handleTimeout(rfb::Timer* t) override;
+ void handleTimeout(core::Timer* t) override;
private:
@@ -130,7 +131,7 @@ private:
network::Socket* queryConnectSocket;
std::string queryConnectAddress;
std::string queryConnectUsername;
- rfb::Timer queryConnectTimer;
+ core::Timer queryConnectTimer;
OutputIdMap outputIdMap;
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index e91f1972..522b18b3 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -28,6 +28,7 @@
#endif
#include <core/LogWriter.h>
+#include <core/Timer.h>
#include <core/util.h>
#include <rdr/FdInStream.h>
@@ -38,7 +39,6 @@
#include <rfb/Exception.h>
#include <rfb/Security.h>
#include <rfb/fenceTypes.h>
-#include <rfb/Timer.h>
#include <rfb/screenTypes.h>
#include <network/TcpSocket.h>
@@ -239,7 +239,7 @@ void CConn::socketEvent(FL_SOCKET fd, void *data)
// Make sure that the FLTK handling and the timers gets some CPU
// time in case of back to back messages
Fl::check();
- Timer::checkTimeouts();
+ core::Timer::checkTimeouts();
// Also check if we need to stop reading and terminate
if (should_disconnect())
diff --git a/vncviewer/EmulateMB.cxx b/vncviewer/EmulateMB.cxx
index a5efa7be..89470274 100644
--- a/vncviewer/EmulateMB.cxx
+++ b/vncviewer/EmulateMB.cxx
@@ -278,7 +278,7 @@ void EmulateMB::filterPointerEvent(const core::Point& pos,
}
}
-void EmulateMB::handleTimeout(rfb::Timer *t)
+void EmulateMB::handleTimeout(core::Timer* t)
{
int action1, action2;
uint16_t buttonMask;
@@ -334,4 +334,4 @@ int EmulateMB::createButtonMask(uint16_t buttonMask)
// Set the left and right buttons according to the action
return buttonMask |= emulatedButtonMask;
-} \ No newline at end of file
+}
diff --git a/vncviewer/EmulateMB.h b/vncviewer/EmulateMB.h
index 43f2d7da..393655e4 100644
--- a/vncviewer/EmulateMB.h
+++ b/vncviewer/EmulateMB.h
@@ -20,10 +20,9 @@
#define __EMULATEMB__
#include <core/Rect.h>
+#include <core/Timer.h>
-#include <rfb/Timer.h>
-
-class EmulateMB : public rfb::Timer::Callback {
+class EmulateMB : public core::Timer::Callback {
public:
EmulateMB();
@@ -33,7 +32,7 @@ protected:
virtual void sendPointerEvent(const core::Point& pos,
uint16_t buttonMask)=0;
- void handleTimeout(rfb::Timer *t) override;
+ void handleTimeout(core::Timer* t) override;
private:
void sendAction(const core::Point& pos, uint16_t buttonMask,
@@ -46,7 +45,7 @@ private:
uint16_t emulatedButtonMask;
uint16_t lastButtonMask;
core::Point lastPos, origPos;
- rfb::Timer timer;
+ core::Timer timer;
};
#endif
diff --git a/vncviewer/GestureHandler.cxx b/vncviewer/GestureHandler.cxx
index 464386a5..f39ec8f2 100644
--- a/vncviewer/GestureHandler.cxx
+++ b/vncviewer/GestureHandler.cxx
@@ -323,7 +323,7 @@ bool GestureHandler::hasDetectedGesture()
return true;
}
-void GestureHandler::handleTimeout(rfb::Timer* t)
+void GestureHandler::handleTimeout(core::Timer* t)
{
if (t == &longpressTimer)
longpressTimeout();
diff --git a/vncviewer/GestureHandler.h b/vncviewer/GestureHandler.h
index 2b31703a..1c2134c0 100644
--- a/vncviewer/GestureHandler.h
+++ b/vncviewer/GestureHandler.h
@@ -23,11 +23,11 @@
#include <set>
#include <map>
-#include <rfb/Timer.h>
+#include <core/Timer.h>
#include "GestureEvent.h"
-class GestureHandler : public rfb::Timer::Callback {
+class GestureHandler : public core::Timer::Callback {
public:
GestureHandler();
virtual ~GestureHandler();
@@ -42,7 +42,7 @@ class GestureHandler : public rfb::Timer::Callback {
private:
bool hasDetectedGesture();
- void handleTimeout(rfb::Timer* t) override;
+ void handleTimeout(core::Timer* t) override;
void longpressTimeout();
void twoTouchTimeout();
@@ -74,8 +74,8 @@ class GestureHandler : public rfb::Timer::Callback {
bool waitingRelease;
struct timeval releaseStart;
- rfb::Timer longpressTimer;
- rfb::Timer twoTouchTimer;
+ core::Timer longpressTimer;
+ core::Timer twoTouchTimer;
};
#endif // __GESTUREHANDLER_H__
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index a82efe89..13d7b2a7 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -51,11 +51,11 @@
#include <core/Exception.h>
#include <core/Logger_stdio.h>
#include <core/LogWriter.h>
+#include <core/Timer.h>
#ifdef HAVE_GNUTLS
#include <rfb/CSecurityTLS.h>
#endif
-#include <rfb/Timer.h>
#include <network/TcpSocket.h>
@@ -189,7 +189,7 @@ static void mainloop(const char* vncserver, network::Socket* sock)
while (!exitMainloop) {
int next_timer;
- next_timer = Timer::checkTimeouts();
+ next_timer = core::Timer::checkTimeouts();
if (next_timer < 0)
next_timer = INT_MAX;
diff --git a/win/rfb_win32/SocketManager.cxx b/win/rfb_win32/SocketManager.cxx
index 819154fb..2f80e28b 100644
--- a/win/rfb_win32/SocketManager.cxx
+++ b/win/rfb_win32/SocketManager.cxx
@@ -27,13 +27,13 @@
#include <core/Exception.h>
#include <core/LogWriter.h>
+#include <core/Timer.h>
#include <core/util.h>
#include <rdr/FdOutStream.h>
#include <network/Socket.h>
-#include <rfb/Timer.h>
#include <rfb/VNCServer.h>
#include <rfb_win32/SocketManager.h>