ImageFactory *factory,
int offsetLeft, int offsetTop)
: m_dpy(dpy),
- m_server(0),
m_image(buffer->getImage()),
m_bytesPerPixel(buffer->getPF().bpp / 8),
m_offsetLeft(offsetLeft),
delete m_columnImage;
}
-//
-// Register VNCServer object.
-//
-
-void PollingManager::setVNCServer(VNCServer *s)
-{
- m_server = s;
-}
-
//
// DEBUG: Measuring time spent in the poll() function,
// as well as time intervals between poll() calls.
// Search for changed rectangles on the screen.
//
-void PollingManager::poll()
+void PollingManager::poll(VNCServer *server)
{
#ifdef DEBUG
debugBeforePoll();
#endif
// Perform polling and try update clients if changes were detected.
- if (pollScreen())
- m_server->tryUpdate();
+ if (pollScreen(server))
+ server->tryUpdate();
#ifdef DEBUG
debugAfterPoll();
#define DBG_REPORT_CHANGES(title)
#endif
-bool PollingManager::pollScreen()
+bool PollingManager::pollScreen(VNCServer *server)
{
- if (!m_server)
+ if (!server)
return false;
// Clear the m_changeFlags[] array, indicating that no changes have
checkNeighbors();
DBG_REPORT_CHANGES("After checking neighbors");
// Inform the server about the changes.
- nTilesChanged = sendChanges();
+ nTilesChanged = sendChanges(server);
}
#ifdef DEBUG_PRINT_NUM_CHANGED_TILES
return nTilesChanged;
}
-int PollingManager::sendChanges()
+int PollingManager::sendChanges(VNCServer *server)
{
const bool *pChangeFlags = m_changeFlags;
int nTilesChanged = 0;
if (rect.br.y > m_height)
rect.br.y = m_height;
// Add to the changed region maintained by the server.
- m_server->add_changed(rect);
+ server->add_changed(rect);
// Skip processed tiles.
x += count;
}
int offsetLeft = 0, int offsetTop = 0);
virtual ~PollingManager();
- void setVNCServer(VNCServer *s);
-
// Currently, these functions do nothing. In past versions, we used
// to poll area around the pointer if its position has been changed
// recently. But that rather decreased overal polling performance,
void setPointerPos(const Point &pos) {}
void unsetPointerPos() {}
- void poll();
+ void poll(VNCServer *server);
protected:
// Screen polling. Returns true if some changes were detected.
- bool pollScreen();
+ bool pollScreen(VNCServer *server);
Display *m_dpy;
- VNCServer *m_server;
const Image *m_image;
const int m_bytesPerPixel;
int checkRow(int x, int y, int w);
int checkColumn(int x, int y, int h, bool *pChangeFlags);
- int sendChanges();
+ int sendChanges(VNCServer *server);
// Check neighboring tiles and update m_changeFlags[].
void checkNeighbors();