diff options
Diffstat (limited to 'unix/x0vncserver/XDesktop.cxx')
-rw-r--r-- | unix/x0vncserver/XDesktop.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 1fdc9e2c..564b2d51 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -423,8 +423,27 @@ ScreenSet XDesktop::computeScreenLayout() layout = ::computeScreenLayout(&outputIdMap); XRRFreeScreenResources(res); + + // Adjust the layout relative to the geometry + ScreenSet::iterator iter, iter_next; + Point offset(-geometry->offsetLeft(), -geometry->offsetTop()); + for (iter = layout.begin();iter != layout.end();iter = iter_next) { + iter_next = iter; ++iter_next; + iter->dimensions = iter->dimensions.translate(offset); + if (iter->dimensions.enclosed_by(geometry->getRect())) + continue; + iter->dimensions = iter->dimensions.intersect(geometry->getRect()); + if (iter->dimensions.is_empty()) { + layout.remove_screen(iter->id); + } + } #endif + // Make sure that we have at least one screen + if (layout.num_screens() == 0) + layout.add_screen(rfb::Screen(0, 0, 0, geometry->width(), + geometry->height(), 0)); + return layout; } |