diff options
Diffstat (limited to 'unix/x0vncserver')
-rw-r--r-- | unix/x0vncserver/Geometry.cxx | 12 | ||||
-rw-r--r-- | unix/x0vncserver/Geometry.h | 12 |
2 files changed, 19 insertions, 5 deletions
diff --git a/unix/x0vncserver/Geometry.cxx b/unix/x0vncserver/Geometry.cxx index 728c1136..94e2df68 100644 --- a/unix/x0vncserver/Geometry.cxx +++ b/unix/x0vncserver/Geometry.cxx @@ -60,16 +60,20 @@ Geometry::Geometry(int fullWidth, int fullHeight) width(), height(), offsetLeft(), offsetTop()); // Handle the VideoArea parameter, save the result in m_videoRect. + // Note that we log absolute coordinates but save relative ones. param = m_videoAreaParam.getData(); bool videoAreaSpecified = (strlen(param) > 0); if (videoAreaSpecified) { - m_videoRect = parseString(param); - if (isVideoAreaSet()) { + Rect absVideoRect = parseString(param); + if (!absVideoRect.is_empty()) { vlog.info("Video area set to %dx%d+%d+%d", - m_videoRect.width(), m_videoRect.height(), - m_videoRect.tl.x, m_videoRect.tl.y); + absVideoRect.width(), absVideoRect.height(), + absVideoRect.tl.x, absVideoRect.tl.y); + Point base(-offsetLeft(), -offsetTop()); + m_videoRect = absVideoRect.translate(base); } else { vlog.info("Video area was not set"); + m_videoRect.clear(); } } delete[] param; diff --git a/unix/x0vncserver/Geometry.h b/unix/x0vncserver/Geometry.h index 82da9c6e..69ab687d 100644 --- a/unix/x0vncserver/Geometry.h +++ b/unix/x0vncserver/Geometry.h @@ -33,13 +33,23 @@ class Geometry public: Geometry(int fullWidth, int fullHeight); + // Return coordinates and dimensions that specify a rectangular part + // of the desktop that would be shown to RFB clients. This + // information is extracted in the constructor from the "Geometry" + // parameter. int width() const { return m_rect.width(); } int height() const { return m_rect.height(); } int offsetLeft() const { return m_rect.tl.x; } int offsetTop() const { return m_rect.tl.y; } + + // Return the same information as a Rect structure. const Rect& getRect() const { return m_rect; } - bool isVideoAreaSet() const { return !m_videoRect.is_empty(); } + // Return coordinates of the video rectangle if one was set with the + // "VideoArea" parameter. The coordinates are relative to the whole + // rectangle as returned by getRect(). In other words, the + // coordinate (0, 0) corresponds to the top left corner of the + // rectangle shown to RFB clients. const Rect& getVideoRect() const { return m_videoRect; } protected: |