X11ResourceManager.h

Classes

X11ResourceManager -- Class to manage shared X11 resources among registered clients. (full description)

class X11ResourceManager

Interface

Public Members
static void refColormap(Screen * screen, XColormap id)
static void unrefColormap(Screen * screen, XColormap id)
static void addX11PixelCanvasColormap(X11PixelCanvasColorTable * pccm)
static void removeX11PixelCanvasColormap(X11PixelCanvasColorTable * pccm)
static uLong allocColor(X11PixelCanvasColorTable * pccm, uShort r, uShort g, uShort b)
static Bool getReadOnlyColorCells(Vector<Bool> mask, ::XDisplay * display, XColormap colormap)
static Bool getReadOnlyColorCells(uChar * mask, uInt n, ::XDisplay * display, XColormap colormap)
static uLong bestColorMatch(X11PixelCanvasColorTable * pcctbl, uShort r, uShort g, uShort b)
friend ostream & operator << (ostream & os, const X11ResourceManager & xrm)
Private Members
static int getROCCErrorHandler(::XDisplay * display, XErrorEvent * ev)
static int (*prevHandler_)(::XDisplay * display, XErrorEvent * ev)

Description

Prerequisite

Etymology

X11ResourceManager : X11 Resource Manager

Synopsis

This class is never directly accessed by application code. It is for internal use only.

X11ResourceManager maintains a list of X virtual colormaps and their reference counts. This ensures that X11PixelCanvasColorTables that share the same, new, virtual Xcolormap will have the map deleted properly.

Responsibility for allocating read-only colorcells falls on the shoulders of this class as well. This class has the ability to reduce allocation of a X11PixelCanvasColorTable to satisfy a request for a read-only colorcell.

Display classes call refColormap() and unrefColormap() when appropriate to manage the shared resources.

Motivation

Needed a way to implement sharing of virtual colormaps by independent X11PixelCanvasColorTables and maintain minimum X resource allocation. Wanted a way to allow pixelCanvas A to be resized to satisfy a color allocation request for pixelCanvas B.

Member Description

static void refColormap(Screen * screen, XColormap id)
static void unrefColormap(Screen * screen, XColormap id)

Make a reference to an X virtual colormap. This is necessary to allow multiple X11PixelCanvasColorTables to share a single X virtual hardware colormap.

static void addX11PixelCanvasColormap(X11PixelCanvasColorTable * pccm)
static void removeX11PixelCanvasColormap(X11PixelCanvasColorTable * pccm)

This is unused at the moment, but may be used to give allocColor the ability to adjust its colortables...

static uLong allocColor(X11PixelCanvasColorTable * pccm, uShort r, uShort g, uShort b)

Allocate a (possibly read-only color)

static Bool getReadOnlyColorCells(Vector<Bool> mask, ::XDisplay * display, XColormap colormap)

Return a Bool vector that describes which cells are read-only

static Bool getReadOnlyColorCells(uChar * mask, uInt n, ::XDisplay * display, XColormap colormap)

Return a char vector that describes which cells are read-only

static uLong bestColorMatch(X11PixelCanvasColorTable * pcctbl, uShort r, uShort g, uShort b)

Return the index that best matches the specified r,g,b color. Used to map r,g,b to colorindex when needed.

friend ostream & operator << (ostream & os, const X11ResourceManager & xrm)

print to the stream

static int getROCCErrorHandler(::XDisplay * display, XErrorEvent * ev)

error handler for read-only colorcell determination

static int (*prevHandler_)(::XDisplay * display, XErrorEvent * ev)

These two functions are involved in a test to see if a particular cell is read-only