void SMsgHandler::setVideoRectangle(const Rect& r)
{
}
-
-void SMsgHandler::unsetVideoRectangle()
-{
-}
-
virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
virtual void setVideoRectangle(const Rect& r);
- virtual void unsetVideoRectangle();
// InputHandler interface
// The InputHandler methods will be called for the corresponding messages.
int y = is->readU16();
int w = is->readU16();
int h = is->readU16();
- bool enable = w > 0 && h > 0;
+ Rect rect(x, y, x+w, y+h);
- if (enable) {
+ if (!rect.is_empty()) {
vlog.debug("Video area selected by client: %dx%d at (%d,%d)",
w, h, x, y);
- handler->setVideoRectangle(Rect(x, y, x+w, y+h));
+ } else if (x != 0 || y != 0 || w != 0 || h != 0) {
+ vlog.debug("Empty video area selected by client: %dx%d at (%d,%d)",
+ w, h, x, y);
+ rect.clear();
} else {
vlog.debug("Video area discarded by client");
- handler->unsetVideoRectangle();
}
+ handler->setVideoRectangle(rect);
}
server->setVideoRectangle(r);
}
-void VNCSConnectionST::unsetVideoRectangle()
-{
- server->unsetVideoRectangle();
-}
-
void VNCSConnectionST::setInitialColourMap()
{
setColourMapEntries(0, 0);
virtual void supportsLocalCursor();
virtual void setVideoRectangle(const Rect& r);
- virtual void unsetVideoRectangle();
// setAccessRights() allows a security package to limit the access rights
// of a VNCSConnectioST to the server. These access rights are applied
if (pb) {
comparer = new ComparingUpdateTracker(pb);
+ applyVideoRectangle();
cursor.setPF(pb->getPF());
renderedCursor.setPF(pb->getPF());
void VNCServerST::add_changed(const Region& region)
{
- comparer->add_changed(region);
+ if (comparer != 0) {
+ comparer->add_changed(region);
+ }
}
void VNCServerST::add_copied(const Region& dest, const Point& delta)
{
- comparer->add_copied(dest, delta);
+ if (comparer != 0) {
+ comparer->add_copied(dest, delta);
+ }
}
void VNCServerST::set_video_area(const Rect &rect)
{
- comparer->set_video_area(rect);
+ if (comparer != 0) {
+ comparer->set_video_area(rect);
+ }
}
bool VNCServerST::clientsReadyForUpdate()
}
}
-void VNCServerST::setVideoRectangle(const Rect& r)
+void VNCServerST::enableVideoSelection(bool enable)
{
- if (isVideoSelectionEnabled()) {
- // FIXME: Duplication between m_videoRect and comparer->video_area.
- m_videoRect = r;
- set_video_area(m_videoRect);
- }
+ slog.debug("Enabling video selection");
+ m_videoSelectionEnabled = enable;
+ applyVideoRectangle();
}
-void VNCServerST::unsetVideoRectangle()
+bool VNCServerST::isVideoSelectionEnabled() const
{
- if (isVideoSelectionEnabled()) {
- // FIXME: Duplication between m_videoRect and comparer->video_area.
- m_videoRect.clear();
- set_video_area(m_defaultVideoRect);
- }
+ return m_videoSelectionEnabled;
+}
+
+void VNCServerST::setVideoRectangle(const Rect& r)
+{
+ m_videoRect = r;
+ applyVideoRectangle();
}
-void VNCServerST::setDefaultVideoRect(const Rect& r)
+void VNCServerST::setDefaultVideoRectangle(const Rect& r)
{
m_defaultVideoRect = r;
- if (m_videoRect.is_empty()) {
- set_video_area(m_defaultVideoRect);
+ applyVideoRectangle();
+}
+
+void VNCServerST::applyVideoRectangle()
+{
+ if (pb != 0) {
+ if (isVideoSelectionEnabled() && !m_videoRect.is_empty()) {
+ slog.debug("Applying video selection");
+ set_video_area(m_videoRect);
+ } else {
+ if (!m_defaultVideoRect.is_empty()) {
+ slog.debug("Applying default video area");
+ } else {
+ slog.debug("Applying empty video area");
+ }
+ set_video_area(m_defaultVideoRect);
+ }
}
}
// request, as we expect that video data is changing continuously. By
// default, this option is disabled, as it's rather a specialized feature
// and video selection GUI can confuse users of the TightVNC client.
- void enableVideoSelection(bool enable) { m_videoSelectionEnabled = enable; }
- bool isVideoSelectionEnabled() { return m_videoSelectionEnabled; }
+ void enableVideoSelection(bool enable);
+ bool isVideoSelectionEnabled() const;
void setVideoRectangle(const Rect& r);
- void unsetVideoRectangle();
-
- void setDefaultVideoRect(const Rect& r);
+ void setDefaultVideoRectangle(const Rect& r);
protected:
bool m_videoSelectionEnabled;
Rect m_videoRect;
Rect m_defaultVideoRect;
+
+ void applyVideoRectangle();
};
};
server = (VNCServerST *)vs;
server->setPixelBuffer(pb);
- server->setDefaultVideoRect(geometry->getVideoRect());
+ server->setDefaultVideoRectangle(geometry->getVideoRect());
running = true;
}