From e6a532ae9d26f9aff3697038537412f4d4d5e4ba Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sun, 11 Jul 2021 20:19:10 +0200 Subject: [PATCH] Remove more color map code from Xvnc This hasn't been supported or used in many years, so clean out the final remnants. --- unix/xserver/hw/vnc/xvnc.c | 151 ------------------------------------- 1 file changed, 151 deletions(-) diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c index 0c8c10fb..f0b682bb 100644 --- a/unix/xserver/hw/vnc/xvnc.c +++ b/unix/xserver/hw/vnc/xvnc.c @@ -51,7 +51,6 @@ from the X Consortium. #include "servermd.h" #include "fb.h" #include "mi.h" -#include "colormapst.h" #include "gcstruct.h" #include "input.h" #include "mipointer.h" @@ -90,8 +89,6 @@ extern char buildtime[]; #define VFB_DEFAULT_WIDTH 1024 #define VFB_DEFAULT_HEIGHT 768 #define VFB_DEFAULT_DEPTH 24 -#define VFB_DEFAULT_WHITEPIXEL 0xffffffff -#define VFB_DEFAULT_BLACKPIXEL 0 #define VFB_DEFAULT_LINEBIAS 0 #define XWD_WINDOW_NAME_LEN 60 @@ -122,9 +119,6 @@ typedef struct { typedef struct { int scrnum; - Pixel blackPixel; - Pixel whitePixel; - unsigned int lineBias; CloseScreenProcPtr closeScreen; @@ -174,8 +168,6 @@ vfbInitializeDefaultScreens(void) for (i = 0; i < MAXSCREENS; i++) { vfbScreens[i].scrnum = i; - vfbScreens[i].blackPixel = VFB_DEFAULT_BLACKPIXEL; - vfbScreens[i].whitePixel = VFB_DEFAULT_WHITEPIXEL; vfbScreens[i].lineBias = VFB_DEFAULT_LINEBIAS; vfbScreens[i].fb.width = VFB_DEFAULT_WIDTH; vfbScreens[i].fb.height = VFB_DEFAULT_HEIGHT; @@ -298,8 +290,6 @@ ddxUseMsg(void) ErrorF("+/-render turn on/off RENDER extension support" "(default on)\n"); ErrorF("-linebias n adjust thin line pixelization\n"); - ErrorF("-blackpixel n pixel value for black\n"); - ErrorF("-whitepixel n pixel value for white\n"); #ifdef HAS_SHM ErrorF("-shmem put framebuffers in shared memory\n"); @@ -425,44 +415,6 @@ ddxProcessArgument(int argc, char *argv[], int i) return 1; } - if (strcmp(argv[i], "-blackpixel") == 0) { /* -blackpixel n */ - Pixel pix; - - CHECK_FOR_REQUIRED_ARGUMENTS(1); - ++i; - pix = atoi(argv[i]); - if (-1 == lastScreen) { - int j; - - for (j = 0; j < MAXSCREENS; j++) { - vfbScreens[j].blackPixel = pix; - } - } - else { - vfbScreens[lastScreen].blackPixel = pix; - } - return 2; - } - - if (strcmp(argv[i], "-whitepixel") == 0) { /* -whitepixel n */ - Pixel pix; - - CHECK_FOR_REQUIRED_ARGUMENTS(1); - ++i; - pix = atoi(argv[i]); - if (-1 == lastScreen) { - int j; - - for (j = 0; j < MAXSCREENS; j++) { - vfbScreens[j].whitePixel = pix; - } - } - else { - vfbScreens[lastScreen].whitePixel = pix; - } - return 2; - } - if (strcmp(argv[i], "-linebias") == 0) { /* -linebias n */ unsigned int linebias; @@ -647,91 +599,6 @@ ddxProcessArgument(int argc, char *argv[], int i) return 0; } -static DevPrivateKeyRec cmapScrPrivateKeyRec; - -#define cmapScrPrivateKey (&cmapScrPrivateKeyRec) -#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey)) -#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c)) - -static int -vfbListInstalledColormaps(ScreenPtr pScreen, Colormap * pmaps) -{ - /* By the time we are processing requests, we can guarantee that there - * is always a colormap installed */ - *pmaps = GetInstalledColormap(pScreen)->mid; - return (1); -} - -static void -vfbInstallColormap(ColormapPtr pmap) -{ - ColormapPtr oldpmap; - - oldpmap = GetInstalledColormap(pmap->pScreen); - - if (pmap != oldpmap) { - int entries; - VisualPtr pVisual; - Pixel *ppix; - xrgb *prgb; - xColorItem *defs; - int i; - - if (oldpmap != (ColormapPtr) None) - WalkTree(pmap->pScreen, TellLostMap, (char *) &oldpmap->mid); - /* Install pmap */ - SetInstalledColormap(pmap->pScreen, pmap); - WalkTree(pmap->pScreen, TellGainedMap, (char *) &pmap->mid); - - entries = pmap->pVisual->ColormapEntries; - pVisual = pmap->pVisual; - - ppix = (Pixel *) calloc(entries, sizeof(Pixel)); - prgb = (xrgb *) calloc(entries, sizeof(xrgb)); - defs = (xColorItem *) calloc(entries, sizeof(xColorItem)); - if (!ppix || !prgb || !defs) - FatalError("Not enough memory for color map\n"); - - for (i = 0; i < entries; i++) - ppix[i] = i; - /* XXX truecolor */ - QueryColors(pmap, entries, ppix, prgb, serverClient); - - for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */ - defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */ - defs[i].red = prgb[i].red; - defs[i].green = prgb[i].green; - defs[i].blue = prgb[i].blue; - defs[i].flags = DoRed | DoGreen | DoBlue; - } - (*pmap->pScreen->StoreColors) (pmap, entries, defs); - - free(ppix); - free(prgb); - free(defs); - } -} - -static void -vfbUninstallColormap(ColormapPtr pmap) -{ - ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen); - - if (pmap == curpmap) { - if (pmap->mid != pmap->pScreen->defColormap) { - int rc = - dixLookupResourceByType((void * *) &curpmap, - pmap->pScreen->defColormap, - RT_COLORMAP, serverClient, - DixUnknownAccess); - if (rc != Success) - ErrorF("Failed to uninstall color map\n"); - else - (*pmap->pScreen->InstallColormap) (curpmap); - } - } -} - static Bool vfbSaveScreen(ScreenPtr pScreen, int on) { @@ -1415,17 +1282,9 @@ static Bool vfbCloseScreen(ScreenPtr pScreen) { vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; - int i; pScreen->CloseScreen = pvfb->closeScreen; - /* - * XXX probably lots of stuff to clean. For now, - * clear installed colormaps so that server reset works correctly. - */ - for (i = 0; i < screenInfo.numScreens; i++) - SetInstalledColormap(screenInfo.screens[i], NULL); - /* * fb overwrites miCloseScreen, so do this here */ @@ -1447,9 +1306,6 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) rrScrPrivPtr rp; - if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - /* 96 is the default used by most other systems */ dpi = 96; if (monitorResolution) @@ -1508,18 +1364,11 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) * to a truely bizarre way of initialising SaveDoomedAreas and friends. */ - pScreen->InstallColormap = vfbInstallColormap; - pScreen->UninstallColormap = vfbUninstallColormap; - pScreen->ListInstalledColormaps = vfbListInstalledColormaps; - pScreen->SaveScreen = vfbSaveScreen; miPointerInitialize(pScreen, &vfbPointerSpriteFuncs, &vfbPointerCursorFuncs, FALSE); - pScreen->blackPixel = pvfb->blackPixel; - pScreen->whitePixel = pvfb->whitePixel; - if (!pvfb->pixelFormatDefined) { switch (pvfb->fb.depth) { case 16: -- 2.39.5