Make sure we filter out any screens that aren't fully inside the new
framebuffer.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4945 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index 391c023..32e202a 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -489,9 +489,12 @@
     int i;
     rdr::U32 id;
     int sx, sy, sw, sh;
+    Rect fb_rect, screen_rect;
 
     // In full screen we report all screens that are fully covered.
 
+    fb_rect.setXYWH(x + , 0, width, height);
+
     // If we can find a matching screen in the existing set, we use
     // that, otherwise we create a brand new screen.
     //
@@ -501,6 +504,11 @@
     for (i = 0;i < Fl::screen_count();i++) {
       Fl::screen_xywh(sx, sy, sw, sh, i);
 
+      // Check that the screen is fully inside the framebuffer
+      screen_rect.setXYWH(sx, sy, sw, sh);
+      if (!screen_rect.enclosed_by(fb_rect))
+        continue;
+
       // Look for perfectly matching existing screen...
       for (iter = cc->cp.screenLayout.begin();
            iter != cc->cp.screenLayout.end(); ++iter) {