From: Pierre Ossman Date: Thu, 16 Aug 2018 10:05:49 +0000 (+0200) Subject: Center overlay on primary screen X-Git-Tag: v1.9.90~96 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=29b5d84eaac8eb317f31ee51e97e49adc621818a;p=tigervnc.git Center overlay on primary screen Makes sure it is readable in a multi screen configuration, as otherwise it might end up crossing multiple screens. --- diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx index d5edfb87..11773d33 100644 --- a/vncviewer/DesktopWindow.cxx +++ b/vncviewer/DesktopWindow.cxx @@ -365,9 +365,28 @@ void DesktopWindow::draw() // Overlay (if active) if (overlay) { int ox, oy, ow, oh; + int sx, sy, sw; - ox = X = (w() - overlay->width()) / 2; - oy = Y = 50; + // Make sure it's properly seen by adjusting it relative to the + // primary screen rather than the entire window + if (fullscreen_active()) { + ScreenSet layout; + + layout = cc->cp.screenLayout; + + assert(layout.num_screens() >= 1); + + sx = layout.begin()->dimensions.tl.x; + sy = layout.begin()->dimensions.tl.y; + sw = layout.begin()->dimensions.width(); + } else { + sx = 0; + sy = 0; + sw = w(); + } + + ox = X = sx + (sw - overlay->width()) / 2; + oy = Y = sy + 50; ow = overlay->width(); oh = overlay->height();