1515N/A* Copyright (c) 1990, 2015, Oracle and/or its affiliates. All rights reserved. 550N/A* Permission is hereby granted, free of charge, to any person obtaining a 919N/A* copy of this software and associated documentation files (the "Software"), 919N/A* to deal in the Software without restriction, including without limitation 919N/A* the rights to use, copy, modify, merge, publish, distribute, sublicense, 919N/A* and/or sell copies of the Software, and to permit persons to whom the 919N/A* Software is furnished to do so, subject to the following conditions: 919N/A* The above copyright notice and this permission notice (including the next 919N/A* paragraph) shall be included in all copies or substantial portions of the 919N/A* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 919N/A* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 919N/A* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 919N/A* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 919N/A* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 919N/A* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 919N/A* DEALINGS IN THE SOFTWARE. 550N/A** Handle I/O errors when opening display 550N/A** Handle X request errors. 550N/A** Just set a flag to let the routine making an X 550N/A** call know that the call resulted in a BadAccess error. 550N/A** Any other errors are processed normally. 550N/A** Examines the given colormap to determine the number of 550N/A** read-only cells, their locations, and their color values. 550N/A** All non-read-only cells (privately allocated, unallocated 550N/A** or reserved) are ignored. 550N/A /* start out assuming all are read-only */ 550N/A /* allocate local scratch memory */ 550N/A ** First, find the free cells by allocating them all private. 550N/A ** We allocate by decreasing powers of 2 so the allocation 550N/A ** time will be proportional to the number of display planes 550N/A ** instead of the number of display cells. 550N/A ** Mark the free cells we find. These allocations will 550N/A ** be freed when the connection is closed. 550N/A ** Get the Hardware color for the color of each allocated cell. 550N/A ** This can only work if the returned color is a previously 550N/A ** allocated r/o cell (we have all cells allocated). 550N/A /* Eliminate reserved cells */ 550N/A /* else if alloc succeeded, it must be read-only */ 550N/A /* allocate the memory for the read-only cells */ 550N/A ** Get the color values for the read-only cells, ignoring private 550N/A** Examines the default colormap with the server grabbed 550N/A** to prevent changes during the examination process. 550N/A** For each screen for which the default colormap is dynamic indexed 550N/A** record all read-only color cells in the default colormap. 550N/A /* For some strange reason, colorscells_get_protected fails if not 550N/A /* Open file to save in */ 550N/A /* Save magic number and version */ 550N/A /* For each screen of display ... */ 550N/A /* Do nothing if default visual is not dynamic */ 550N/A warning(
"default visual for screen %d is not dynamic indexed",
550N/A ** Discover what read-only cells are in the default colormap. 550N/A ** These will be considered the "workspace colors." 550N/A /* Save read-only cells for screen in workspace color file */