/**** * * Copyright (c) 1989 by Sun Microsystems, Inc. * @(#)sh_win_grab.h 22.1 89/08/10 Copyright 1989 Sun Micro * * WIN_GRAB.H Window Grabber * ****/ #ifndef _WGRAB #include #include "di/shapes.h" #include "di/sh_SCR.h" #include "di/sh_SHAPE.h" #include "sh_CTX.h" #include "sh_RAS.h" #include "sh_PATH.h" #include "sh_TRANS.h" #include "sh_CMAP.h" #include "sh_scr_dev.h" #include "sh_point.h" #ifdef WINDOWGRABBER struct wg_winfo { Unsgn32 w_flag; /* must be first in struct */ long w_magic; long w_version; struct wg_winfo *w_list; /* server info */ int w_sinfofd; int w_sdevfd; Unsgn32 *w_slockp; int w_srefcnt; /* client info */ char w_devname[20]; int w_cinfofd; int w_cdevfd; int w_crefcnt; Unsgn32 w_cookie; Unsgn32 w_filesuffix; Unsgn32 *w_clockp; /* clipping info */ ENTRY *w_clipoff; u_int w_clipsize; /* shapes stuff */ POINT_B2D w_org; POINT_B2D w_dim; /* produces w_shape_hdr and w_shape */ Static_Obj(w_shape,struct class_SHAPE); ENTRY w_cliparray; }; typedef struct wg_winfo WGINFO; #define WG_PAGESZ (8*1024) #define WGINFO_OFF (2*WG_PAGESZ) #define WG_LOCK(x) (*(int *)(x)) = 1 #define WG_UNLOCK(x) (*(int *)((x)+(WG_PAGESZ/sizeof(int)))) = 0 extern Unsgn32 *sh_wg_dummy; #define wg_init() sh_wg_init() #define wg_get_grab(ras) sh_wg_get_grab(ras) #ifdef SH_USER #define wg_initras(ras) \ ((ras)->ras_lock = sh_wg_dummy, \ (ras)->ras_infop = sh_wg_dummy+WGINFO_OFF/sizeof(Unsgn32)) #define wg_lock(ras) \ do { \ if ((((WGINFO*)((ras)->ras_infop))->w_crefcnt)++ == 0) { \ WG_LOCK((ras)->ras_lock); \ if (*(Unsgn32 *)(ras)->ras_infop) \ sh_wg_get_clip(ras); \ } \ } while (0) #define wg_unlock(ras) \ do { \ if (--(((WGINFO*)((ras)->ras_infop))->w_crefcnt) == 0) \ WG_UNLOCK((ras)->ras_lock); \ } while (0) #define wg_set_grab(ras,val) sh_wg_set_grab_usr(ras,val) #define wg_set_clip(ras) #define wg_raster_exists 0 #else /* SH_USER (System) */ #define wg_initras(ras) \ (ras)->ras_lock = sh_wg_dummy #define wg_lock(ras) \ do { \ if (((WGINFO *)(ras->ras_lock+WGINFO_OFF/sizeof(Unsgn32)))->w_srefcnt++ == 0)\ WG_LOCK(ras->ras_lock); \ } while (0) #define wg_unlock(ras) \ do { \ if (--((WGINFO *)(ras->ras_lock+WGINFO_OFF/sizeof(Unsgn32)))->w_srefcnt == 0)\ WG_UNLOCK(ras->ras_lock); \ } while (0) #define wg_set_grab(ras,val) sh_wg_set_grab_sys(ras,val) #define wg_set_clip(ras) \ do { \ if (ras->ras_lock != sh_wg_dummy) \ sh_wg_set_clip(ras); \ } while (0) #define wg_lockall(ras) sh_wg_lockall(ras) #define wg_unlockall(ras) sh_wg_unlockall(ras) extern Sgn8 *sh_wg_wlist; #define wg_raster_exists sh_wg_wlist #endif /* SH_USER */ #else /* WINDOWGRABBER */ #define wg_init() #define wg_initras(r) #define wg_set_clip(r) #define wg_lock(r) #define wg_unlock(r) #define wg_get_grab(r) #define wg_set_grab(r,v) #define wg_lockall(r) #define wg_unlockall(r) #define wg_raster_exists 0 #endif /* WINDOWGRABBER */ #define _WGRAB #endif /* _WGRAB */