]> source.dussan.org Git - tigervnc.git/commitdiff
Move screen layout bootstraping around so that it can handle if all screens
authorPierre Ossman <ossman@cendio.se>
Fri, 20 Mar 2009 22:05:08 +0000 (22:05 +0000)
committerPierre Ossman <ossman@cendio.se>
Fri, 20 Mar 2009 22:05:08 +0000 (22:05 +0000)
are purged on framebuffer resize.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3707 3789f03b-4d11-0410-bbf8-ca57d06f2519

common/rfb/VNCServerST.cxx

index edd5fc3719a5c1c6b3fdfffbb01eb2999ac3ddf7..7edac56b74bd8b359ffbcf0347d96e142820cbc2 100644 (file)
@@ -263,29 +263,29 @@ void VNCServerST::setPixelBuffer(PixelBuffer* pb_)
     cursor.setPF(pb->getPF());
     renderedCursor.setPF(pb->getPF());
 
+    // Check that the screen layout is still valid
+    if (!screenLayout.validate(pb->width(), pb->height())) {
+      Rect fbRect;
+      ScreenSet::iterator iter, iter_next;
+
+      fbRect.setXYWH(0, 0, pb->width(), pb->height());
+
+      for (iter = screenLayout.begin();iter != screenLayout.end();iter = iter_next) {
+        iter_next = iter; ++iter_next;
+        if (iter->dimensions.enclosed_by(fbRect))
+            continue;
+        iter->dimensions = iter->dimensions.intersect(fbRect);
+        if (iter->dimensions.is_empty()) {
+          slog.info("Removing screen %d (%x) as it is completely outside the new framebuffer",
+                    (int)iter->id, (unsigned)iter->id);
+          screenLayout.remove_screen(iter->id);
+        }
+      }
+    }
+
     if (screenLayout.num_screens() == 0) {
       // Boot strap the screen layout
       screenLayout.add_screen(Screen(0, 0, 0, pb->width(), pb->height(), 0));
-    } else {
-      // Check that the screen layout is still valid
-      if (!screenLayout.validate(pb->width(), pb->height())) {
-        Rect fbRect;
-        ScreenSet::iterator iter, iter_next;
-
-        fbRect.setXYWH(0, 0, pb->width(), pb->height());
-
-        for (iter = screenLayout.begin();iter != screenLayout.end();iter = iter_next) {
-          iter_next = iter; ++iter_next;
-          if (iter->dimensions.enclosed_by(fbRect))
-              continue;
-          iter->dimensions = iter->dimensions.intersect(fbRect);
-          if (iter->dimensions.is_empty()) {
-            slog.info("Removing screen %d (%x) as it is completely outside the new framebuffer",
-                      (int)iter->id, (unsigned)iter->id);
-            screenLayout.remove_screen(iter->id);
-          }
-        }
-      }
     }
 
     std::list<VNCSConnectionST*>::iterator ci, ci_next;