diff options
author | Pierre Ossman <ossman@cendio.se> | 2018-11-01 16:05:02 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2018-11-01 16:11:42 +0100 |
commit | 0fe375a209dd917de5cbabbfbe5915b9b58f8fa8 (patch) | |
tree | ba7a53811ad4938e70716c9055e83d3ed40977bf | |
parent | ea7ede9838ac51bab0427ecc8b46cc737497a375 (diff) | |
download | tigervnc-0fe375a209dd917de5cbabbfbe5915b9b58f8fa8.tar.gz tigervnc-0fe375a209dd917de5cbabbfbe5915b9b58f8fa8.zip |
Respect geometry setting in screen layout
We might only be using part of the X server's screen, so make sure
the layout we calculate is contained within this part.
-rw-r--r-- | unix/x0vncserver/XDesktop.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx index 5f67f299..f8b579d7 100644 --- a/unix/x0vncserver/XDesktop.cxx +++ b/unix/x0vncserver/XDesktop.cxx @@ -381,6 +381,20 @@ 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 return layout; |