]> source.dussan.org Git - tigervnc.git/commitdiff
Use central SetRootClip()
authorPierre Ossman <ossman@cendio.se>
Mon, 12 Jul 2021 15:03:36 +0000 (17:03 +0200)
committerPierre Ossman <ossman@cendio.se>
Tue, 13 Jul 2021 12:26:04 +0000 (14:26 +0200)
There's been a common one since X.org 1.11, so use that instead of our
own copy.

unix/xserver/hw/vnc/xvnc.c

index 666b5ec87233d599616efe183aac38870a6f86d0..e8f71edda4de79e7ff91bc146f99a56cfc7c6f3b 100644 (file)
@@ -695,92 +695,6 @@ vncRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
     return TRUE;
 }
 
-/* from hw/xfree86/common/xf86Helper.c */
-
-#include "mivalidate.h"
-static void
-xf86SetRootClip(ScreenPtr pScreen, Bool enable)
-{
-    WindowPtr pWin = pScreen->root;
-    WindowPtr pChild;
-    Bool WasViewable = (Bool) (pWin->viewable);
-    Bool anyMarked = FALSE;
-    WindowPtr pLayerWin;
-    BoxRec box;
-
-    if (WasViewable) {
-        for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
-            (void) (*pScreen->MarkOverlappedWindows) (pChild,
-                                                      pChild, &pLayerWin);
-        }
-        (*pScreen->MarkWindow) (pWin);
-        anyMarked = TRUE;
-        if (pWin->valdata) {
-            if (HasBorder(pWin)) {
-                RegionPtr borderVisible;
-
-                borderVisible = RegionCreate(NullBox, 1);
-                RegionSubtract(borderVisible,
-                               &pWin->borderClip, &pWin->winSize);
-                pWin->valdata->before.borderVisible = borderVisible;
-            }
-            pWin->valdata->before.resized = TRUE;
-        }
-    }
-
-    /*
-     * Use RegionBreak to avoid optimizations in ValidateTree
-     * that assume the root borderClip can't change well, normally
-     * it doesn't...)
-     */
-    if (enable) {
-        box.x1 = 0;
-        box.y1 = 0;
-        box.x2 = pScreen->width;
-        box.y2 = pScreen->height;
-        RegionInit(&pWin->winSize, &box, 1);
-        RegionInit(&pWin->borderSize, &box, 1);
-        if (WasViewable)
-            RegionReset(&pWin->borderClip, &box);
-        pWin->drawable.width = pScreen->width;
-        pWin->drawable.height = pScreen->height;
-        RegionBreak(&pWin->clipList);
-    }
-    else {
-        RegionEmpty(&pWin->borderClip);
-        RegionBreak(&pWin->clipList);
-    }
-
-    ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
-
-    if (WasViewable) {
-
-        if (pWin->firstChild) {
-            anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin->firstChild,
-                                                            pWin->firstChild,
-                                                            (WindowPtr *) NULL);
-        }
-        else {
-            (*pScreen->MarkWindow) (pWin);
-            anyMarked = TRUE;
-        }
-
-        if (anyMarked)
-            (*pScreen->ValidateTree) (pWin, NullWindow, VTOther);
-    }
-
-    if (WasViewable) {
-        if (anyMarked)
-            (*pScreen->HandleExposures) (pWin);
-
-        if (anyMarked && pScreen->PostValidateTree)
-            (*pScreen->PostValidateTree) (pWin, NullWindow, VTOther);
-    }
-    if (pWin->realized)
-        WindowsRestructured();
-    FlushAllOutput();
-}
-
 static Bool vncRandRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
                             int x, int y, Rotation rotation, int num_outputs,
                             RROutputPtr * outputs);
@@ -800,7 +714,7 @@ vncRandRScreenSetSize(ScreenPtr pScreen,
     int oldwidth, oldheight, oldmmWidth, oldmmHeight;
 
     /* Prevent updates while we fiddle */
-    xf86SetRootClip(pScreen, FALSE);
+    SetRootClip(pScreen, ROOT_CLIP_NONE);
 
     /* Store current state in case we fail */
     oldwidth = pScreen->width;
@@ -829,7 +743,7 @@ vncRandRScreenSetSize(ScreenPtr pScreen,
         pScreen->mmWidth = oldmmWidth;
         pScreen->mmHeight = oldmmHeight;
 
-        xf86SetRootClip(pScreen, TRUE);
+        SetRootClip(pScreen, ROOT_CLIP_FULL);
 
         return FALSE;
     }
@@ -846,7 +760,7 @@ vncRandRScreenSetSize(ScreenPtr pScreen,
         pScreen->mmWidth = oldmmWidth;
         pScreen->mmHeight = oldmmHeight;
 
-        xf86SetRootClip(pScreen, TRUE);
+        SetRootClip(pScreen, ROOT_CLIP_FULL);
 
         return FALSE;
     }
@@ -860,7 +774,7 @@ vncRandRScreenSetSize(ScreenPtr pScreen,
     vncFbstride[pScreen->myNum] = fb.paddedWidth;
 
     /* Restore ability to update screen, now with new dimensions */
-    xf86SetRootClip(pScreen, TRUE);
+    SetRootClip(pScreen, ROOT_CLIP_FULL);
 
     /*
      * Let RandR know we changed something (it doesn't assume that