[PATCH v2] dix: delete logo hack screen saver

Tiago Vignatti tiago.vignatti at nokia.com
Wed Oct 20 15:20:00 PDT 2010


Protocol doesn't mention about screen saver with logo being required and
people are already using more intelligent ways to draw screen saver themes. So
consider -logo as deprecated option, deleting its code.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
since v1: 
- fixed with alanc comments, to delete man page entries.

 dix/globals.c       |    4 -
 dix/window.c        |  200 ---------------------------------------------------
 doc/Xserver.man.pre |    8 --
 include/opaque.h    |    3 -
 include/site.h      |    3 -
 os/utils.c          |   14 ----
 6 files changed, 0 insertions(+), 232 deletions(-)

diff --git a/dix/globals.c b/dix/globals.c
index b128569..0a6b170 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -106,10 +106,6 @@ CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
 CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
 int  defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
 int  defaultScreenSaverAllowExposures = DEFAULT_SCREEN_SAVER_EXPOSURES;
-#ifndef NOLOGOHACK
-int  logoScreenSaver = DEFAULT_LOGO_SCREEN_SAVER;
-#endif
-
 #ifdef SCREENSAVER
 Bool screenSaverSuspended = FALSE;
 #endif
diff --git a/dix/window.c b/dix/window.c
index 4a47dd5..8ea6117 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3085,13 +3085,6 @@ SendVisibilityNotify(WindowPtr pWin)
 }
 
 #define RANDOM_WIDTH 32
-
-#ifndef NOLOGOHACK
-static void DrawLogo(
-    WindowPtr pWin
-);
-#endif
-
 int
 dixSaveScreens(ClientPtr client, int on, int mode)
 {
@@ -3153,18 +3146,10 @@ dixSaveScreens(ClientPtr client, int on, int mode)
 		 * for the root window, so miPaintWindow works
 		 */
 		screenIsSaved = SCREEN_SAVER_OFF;
-#ifndef NOLOGOHACK
-		if (logoScreenSaver)
-		    (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE);
-#endif
 		(*pWin->drawable.pScreen->MoveWindow)(pWin,
 			   (short)(-(rand() % RANDOM_WIDTH)),
 			   (short)(-(rand() % RANDOM_WIDTH)),
 			   pWin->nextSib, VTMove);
-#ifndef NOLOGOHACK
-		if (logoScreenSaver)
-		    DrawLogo(pWin);
-#endif
 		screenIsSaved = SCREEN_SAVER_ON;
 	    }
 	    /*
@@ -3322,10 +3307,6 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
 	(*pWin->drawable.pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap);
     }
     MapWindow(pWin, serverClient);
-#ifndef NOLOGOHACK
-    if (kind == SCREEN_IS_TILED && logoScreenSaver)
-	DrawLogo(pWin);
-#endif
     return TRUE;
 }
 
@@ -3671,184 +3652,3 @@ WindowParentHasDeviceCursor(WindowPtr pWin,
     }
     return FALSE;
 }
-
-#ifndef NOLOGOHACK
-static void
-DrawLogo(WindowPtr pWin)
-{
-    DrawablePtr pDraw;
-    ScreenPtr pScreen;
-    int x, y;
-    unsigned int width, height, size;
-    GC *pGC;
-    int rc, thin, gap, d31;
-    DDXPointRec poly[4];
-    ChangeGCVal fore[2], back[2];
-    xrgb rgb[2];
-    BITS32 fmask, bmask;
-    ColormapPtr cmap;
-
-    pDraw = (DrawablePtr)pWin;
-    pScreen = pDraw->pScreen;
-    x = -pWin->origin.x;
-    y = -pWin->origin.y;
-    width = pScreen->width;
-    height = pScreen->height;
-    pGC = GetScratchGC(pScreen->rootDepth, pScreen);
-    if (!pGC)
-	return;
-
-    if ((rand() % 100) <= 17) /* make the probability for white fairly low */
-	fore[0].val = pScreen->whitePixel;
-    else
-	fore[0].val = pScreen->blackPixel;
-    if (pWin->backgroundState == BackgroundPixel) {
-	rc = dixLookupResourceByType((pointer *)&cmap, wColormap(pWin),
-				     RT_COLORMAP, serverClient, DixReadAccess);
-	if (rc == Success) {
-	    Pixel querypixels[2];
-
-	    querypixels[0] = fore[0].val;
-	    querypixels[1] = pWin->background.pixel;
-	    QueryColors(cmap, 2, querypixels, rgb, serverClient);
-	    if ((rgb[0].red == rgb[1].red) &&
-		(rgb[0].green == rgb[1].green) &&
-		(rgb[0].blue == rgb[1].blue)) {
-		if (fore[0].val == pScreen->blackPixel)
-		    fore[0].val = pScreen->whitePixel;
-		else
-		    fore[0].val = pScreen->blackPixel;
-	    }
-	}
-    }
-    fore[1].val = FillSolid;
-    fmask = GCForeground|GCFillStyle;
-    if (pWin->backgroundState == BackgroundPixel) {
-	back[0].val = pWin->background.pixel;
-	back[1].val = FillSolid;
-	bmask = GCForeground|GCFillStyle;
-    } else {
-	back[0].val = 0;
-	back[1].val = 0;
-	ChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin, back);
-	back[0].val = FillTiled;
-	back[1].ptr = pWin->background.pixmap;
-	bmask = GCFillStyle|GCTile;
-    }
-
-    /* should be the same as the reference function XmuDrawLogo() */
-
-    size = width;
-    if (height < width)
-	 size = height;
-    size = RANDOM_WIDTH + rand() % (size - RANDOM_WIDTH);
-    size &= ~1;
-    x += rand() % (width - size);
-    y += rand() % (height - size);
-
-/*
- * Draw what will be the thin strokes.
- *
- *           -----
- *          /    /
- *         /    /
- *        /    /
- *       /    /
- *      /____/
- *           d
- *
- * Point d is 9/44 (~1/5) of the way across.
- */
-
-    thin = (size / 11);
-    if (thin < 1) thin = 1;
-    gap = (thin+3) / 4;
-    d31 = thin + thin + gap;
-    poly[0].x = x + size;	       poly[0].y = y;
-    poly[1].x = x + size-d31;	       poly[1].y = y;
-    poly[2].x = x + 0;		       poly[2].y = y + size;
-    poly[3].x = x + d31;	       poly[3].y = y + size;
-    ChangeGC(NullClient, pGC, fmask, fore);
-    ValidateGC(pDraw, pGC);
-    (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Erase area not needed for lower thin stroke.
- *
- *           ------
- *          /	  /
- *         /  __ /
- *        /  /	/
- *       /  /  /
- *      /__/__/
- */
-
-    poly[0].x = x + d31/2;			 poly[0].y = y + size;
-    poly[1].x = x + size / 2;			 poly[1].y = y + size/2;
-    poly[2].x = x + (size/2)+(d31-(d31/2));	 poly[2].y = y + size/2;
-    poly[3].x = x + d31;			 poly[3].y = y + size;
-    ChangeGC(NullClient, pGC, bmask, back);
-    ValidateGC(pDraw, pGC);
-    (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Erase area not needed for upper thin stroke.
- *
- *	     ------
- *	    /  /  /
- *	   /--/	 /
- *	  /	/
- *	 /     /
- *	/_____/
- */
-
-    poly[0].x = x + size - d31/2;		 poly[0].y = y;
-    poly[1].x = x + size / 2;			 poly[1].y = y + size/2;
-    poly[2].x = x + (size/2)-(d31-(d31/2));	 poly[2].y = y + size/2;
-    poly[3].x = x + size - d31;			 poly[3].y = y;
-    ValidateGC(pDraw, pGC);
-    (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Draw thick stroke.
- * Point b is 1/4 of the way across.
- *
- *      b
- * -----
- * \	\
- *  \	 \
- *   \	  \
- *    \	   \
- *     \____\
- */
-
-    poly[0].x = x;		       poly[0].y = y;
-    poly[1].x = x + size/4;	       poly[1].y = y;
-    poly[2].x = x + size;	       poly[2].y = y + size;
-    poly[3].x = x + size - size/4;     poly[3].y = y + size;
-    ChangeGC(NullClient, pGC, fmask, fore);
-    ValidateGC(pDraw, pGC);
-    (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Erase to create gap.
- *
- *	    /
- *	   /
- *	  /
- *	 /
- *	/
- */
-
-    poly[0].x = x + size- thin;	      poly[0].y = y;
-    poly[1].x = x + size-( thin+gap);  poly[1].y = y;
-    poly[2].x = x + thin;	      poly[2].y = y + size;
-    poly[3].x = x + thin + gap;	      poly[3].y = y + size;
-    ChangeGC(NullClient, pGC, bmask, back);
-    ValidateGC(pDraw, pGC);
-    (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-    FreeScratchGC(pGC);
-}
-
-#endif
diff --git a/doc/Xserver.man.pre b/doc/Xserver.man.pre
index ce3b3a1..240f05c 100644
--- a/doc/Xserver.man.pre
+++ b/doc/Xserver.man.pre
@@ -285,14 +285,6 @@ sets the stack space limit of the server to the specified number of kilobytes.
 A value of zero makes the stack size as large as possible.  The default value
 of \-1 leaves the stack space limit unchanged.
 .TP 8
-.B \-logo
-turns on the X Window System logo display in the screen-saver.
-There is currently no way to change this from a client.
-.TP 8
-.B nologo
-turns off the X Window System logo display in the screen-saver.
-There is currently no way to change this from a client.
-.TP 8
 .B \-render 
 .BR default | mono | gray | color
 sets the color allocation policy that will be used by the render extension.
diff --git a/include/opaque.h b/include/opaque.h
index f8c0000..3d1ffc1 100644
--- a/include/opaque.h
+++ b/include/opaque.h
@@ -56,9 +56,6 @@ extern _X_EXPORT Bool disableBackingStore;
 extern _X_EXPORT Bool enableBackingStore;
 extern _X_EXPORT Bool PartialNetwork;
 extern _X_EXPORT Bool RunFromUpstart;
-#ifndef NOLOGOHACK
-extern _X_EXPORT int logoScreenSaver;
-#endif
 #ifdef RLIMIT_DATA
 extern _X_EXPORT int limitDataSpace;
 #endif
diff --git a/include/site.h b/include/site.h
index b134212..9c2836f 100644
--- a/include/site.h
+++ b/include/site.h
@@ -112,9 +112,6 @@ SOFTWARE.
 #define DEFAULT_SCREEN_SAVER_INTERVAL (10 * (60 * 1000))
 #define DEFAULT_SCREEN_SAVER_BLANKING PreferBlanking
 #define DEFAULT_SCREEN_SAVER_EXPOSURES AllowExposures
-#ifndef NOLOGOHACK
-#define DEFAULT_LOGO_SCREEN_SAVER 1
-#endif
 #ifndef DEFAULT_ACCESS_CONTROL
 #define DEFAULT_ACCESS_CONTROL TRUE
 #endif
diff --git a/os/utils.c b/os/utils.c
index f176af4..ed3f9f9 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -496,10 +496,6 @@ void UseMsg(void)
     ErrorF("-ls int                limit stack space to N Kb\n");
 #endif
     ErrorF("-nolock                disable the locking mechanism\n");
-#ifndef NOLOGOHACK
-    ErrorF("-logo                  enable logo in screen saver\n");
-    ErrorF("nologo                 disable logo in screen saver\n");
-#endif
     ErrorF("-nolisten string       don't listen on protocol\n");
     ErrorF("-noreset               don't reset after last client exists\n");
     ErrorF("-reset                 reset after last client exists\n");
@@ -755,16 +751,6 @@ ProcessCommandLine(int argc, char *argv[])
 #endif
 	    nolock = TRUE;
 	}
-#ifndef NOLOGOHACK
-	else if ( strcmp( argv[i], "-logo") == 0)
-	{
-	    logoScreenSaver = 1;
-	}
-	else if ( strcmp( argv[i], "nologo") == 0)
-	{
-	    logoScreenSaver = 0;
-	}
-#endif
 	else if ( strcmp( argv[i], "-nolisten") == 0)
 	{
             if(++i < argc) {
-- 
1.7.0.4



More information about the xorg-devel mailing list