*
* 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.
*/
/*
* cmap_grab.h - colormap grabber structures and information
*/
#ifndef _CMAP_GRAB_H
#define _CMAP_GRAB_H
/****
*
* Colormap grabber header file.
*
*
*
* Macros defined here:
*
* sh_cm_lock(infop)
* sh_cm_unlock(infop)
* lock and unlock colormap info page. 'infop' is the Grabbedcmap
* pointer returned by cmapgrab_grab()
*
* sh_cmapgrab_cookie(infop)
* returns the colormap info page cookie used to map the info page.
* this is the value that should be returned to the requesting
* client.
*
****/
#ifdef MT
#include <synch.h>
#endif
#include "dga.h"
#include "dga_internal.h"
/* method to use to load colormaps */
typedef enum {
#define CMVERS 0
/* device types, from sh_scr_dev.h */
/* info in shared memory */
typedef struct _grabbedcmap
{
/* version 0 info starts here */
/* server-specific info, not meaningful to client */
int cm_sinfofd ;
int cm_sdevfd ;
int cm_slockcnt ;
int cm_clientcnt ;
int cm_filesuffix ;
color map "xnews_default" */
color map "xnews_installed" */
the start of the shadow colormap */
/* version 1 info starts here */
/* version 2 info starts here */
/* Do NOT add any fields below dev_info */
} Grabbedcmap ;
/* followed by three arrays of u_shorts, length cm_len, for
red, green and blue and one array of bytes which are
the change flags for their respective colors:
rr
rr
rr
:
gg
gg
gg
:
bb
bb
bb
:
f
f
f
:
Clients set a flag to non-zero to indicate that the color
has been changed. The server clears these when the chagnes
have been seen. */
typedef struct cmap_devlist{
int fd;
int refcnt;
} Cmap_Devlist;
#define CM_UNLOCK(x) (*(x)) = 0
do { \
if( (infop)->cm_lockcnt++ == 0 ) \
} while (0)
do { \
if( --(infop)->cm_lockcnt == 0 ) \
*(infop)->cm_unlockp = 0 ; \
} while (0)
Dga_cmap wx_cm_grab() ;
#endif /* _CMAP_GRAB_H */