diff --git a/dix/window.c b/dix/window.c index a2b1507e4..e1bdd8b7c 100644 --- a/dix/window.c +++ b/dix/window.c @@ -137,6 +137,8 @@ Equipment Corporation. * ChangeWindowDeviceCursor ******/ +Bool bgNoneRoot = FALSE; + static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11}; static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88}; @@ -463,6 +465,10 @@ InitRootWindow(WindowPtr pWin) if (party_like_its_1989) { MakeRootTile(pWin); backFlag |= CWBackPixmap; + } else if (pScreen->canDoBGNoneRoot && bgNoneRoot) { + pWin->backgroundState = XaceBackgroundNoneState(pWin); + pWin->background.pixel = pScreen->whitePixel; + backFlag |= CWBackPixmap; } else { if (whiteRoot) pWin->background.pixel = pScreen->whitePixel; diff --git a/include/opaque.h b/include/opaque.h index abaee453f..5c707172c 100644 --- a/include/opaque.h +++ b/include/opaque.h @@ -69,6 +69,7 @@ extern _X_EXPORT Bool defeatAccessControl; extern _X_EXPORT long maxBigRequestSize; extern _X_EXPORT Bool party_like_its_1989; extern _X_EXPORT Bool whiteRoot; +extern _X_EXPORT Bool bgNoneRoot; extern _X_EXPORT Bool CoreDump; diff --git a/include/scrnintstr.h b/include/scrnintstr.h index e36b15f5e..cd4fb70b1 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -601,6 +601,12 @@ typedef struct _Screen { /* Device cursor procedures */ DeviceCursorInitializeProcPtr DeviceCursorInitialize; DeviceCursorCleanupProcPtr DeviceCursorCleanup; + + /* set it in driver side if X server can copy the framebuffer content. + * Meant to be used together with '-background none' option, avoiding + * malicious users to steal framebuffer's content if that would be the + * default */ + Bool canDoBGNoneRoot; } ScreenRec; static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) { diff --git a/os/utils.c b/os/utils.c index c2158dc72..afdff0c5a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -498,6 +498,7 @@ void UseMsg(void) ErrorF("-nolock disable the locking mechanism\n"); ErrorF("-nolisten string don't listen on protocol\n"); ErrorF("-noreset don't reset after last client exists\n"); + ErrorF("-background [none] create root window with no background\n"); ErrorF("-reset reset after last client exists\n"); ErrorF("-p # screen-saver pattern duration (minutes)\n"); ErrorF("-pn accept failure to listen on all ports\n"); @@ -828,6 +829,14 @@ ProcessCommandLine(int argc, char *argv[]) defaultBackingStore = WhenMapped; else if ( strcmp( argv[i], "-wr") == 0) whiteRoot = TRUE; + else if ( strcmp( argv[i], "-background") == 0) { + if(++i < argc) { + if (!strcmp ( argv[i], "none")) + bgNoneRoot = TRUE; + else + UseMsg(); + } + } else if ( strcmp( argv[i], "-maxbigreqsize") == 0) { if(++i < argc) { long reqSizeArg = atol(argv[i]);