/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#include <stdio.h>
#ifndef SYSV
#include <alloca.h>
#endif
#include "cmc.h"
#include "cmcutil.h"
#define MIN(a,b) ((a)<(b)?(a):(b))
static void
int ncolors,
{
register Pixel *p;
register XColor *c;
register int nalloc;
register int total_alloc = 0;
register int ntotal;
unsigned long mask;
int nc;
#ifdef SYSV
#else
#endif
/* Grab as many private cells as we can */
p, nalloc))
continue;
p += nalloc;
total_alloc += nalloc;
}
/*
** May not be able to get as many colors as requested.
*/
}
/* Free enough space for workspace colors */
/* Allocate the workspace colors */
fatal_error("attempt to allocate color failed");
/* Free placeholder pixels */
/*
** Tell everybody how many workspace colors there are.
** high end.
*/
ncolors++;
ncolors++;
}
#ifdef SYSV
#endif
}
static void
int ncolors;
{
}
/*
** For each screen for which there is saved workspace colors,
** allocates these colors as high as possible in the default
** colormap of the screen.
*/
void
cmc_init (void)
{
FILE *f;
const char *filename;
/* Open display */
/* For some strange reason, cmc_alloc_protected fails if not
run synchronously */
/* Open file where workspace colors are stored */
/* Do nothing if not found */
return;
/* Check magic number and version */
cmc_header_test(f);
/* Abandon any previously allocated workspace colors (all screens) */
/* For each screen of display ... */
for (;;) {
int scr_num;
int ncolors;
break;
/* See if screen is still present */
warning("Warning: cannot allocated saved colors for screen %d because\nthe display no longer has this many screens\n", scr_num);
continue;
}
/*
** Existence of workspace colors for the screen implies
** that its default visual was dynamic indexed. Make sure
** it still is.
*/
if (!dynamic_indexed_default_visual(screen)) {
warning("default visual for screen %d is no longer dynamic indexed\nsaved colors not allocated for screen %d", scr_num, scr_num);
continue;
}
/* Allocate workspace colors at high end of colormap */
}
/* Preserve newly allocated client resources */
}