|
|
|
|
File: [XFree86 CVS] / xc / programs / Xserver / lbx / lbxtags.c
(download)
Revision: 1.1.1.1 (vendor branch), Sun Dec 22 04:07:20 1996 UTC (16 years, 5 months ago) by dawes Branch: X11R6 CVS Tags: xf-3_9z, xf-3_9y, xf-3_9x, xf-3_9w, xf-3_9v, xf-3_9u, xf-3_9t, xf-3_9s, xf-3_9r, xf-3_9q, xf-3_9p, xf-3_9o, xf-3_9n, xf-3_9m, xf-3_9l, xf-3_9k, xf-3_9jw, xf-3_9jv, xf-3_9ju, xf-3_9jt, xf-3_9js, xf-3_9jr, xf-3_9jq, xf-3_9jp, xf-3_9jo, xf-3_9jn, xf-3_9jm, xf-3_9jl, xf-3_9jk, xf-3_9jj, xf-3_9ji, xf-3_9jh, xf-3_9jg, xf-3_9jf, xf-3_9je, xf-3_9jd, xf-3_9jc, xf-3_9jb, xf-3_9ja, xf-3_9j-branch, xf-3_9j, xf-3_9i, xf-3_9h, xf-3_9g, xf-3_9f, xf-3_9e, xf-3_9d, xf-3_9c, xf-3_9b, xf-3_9a, xf-3_9Ng, xf-3_9Nf, xf-3_9Ne, xf-3_9Nd, xf-3_9Nc, xf-3_9Nb, xf-3_9Na, xf-3_9N, xf-3_9Ak, xf-3_9Aj, xf-3_9Ai, xf-3_9Ah, xf-3_9Ag, xf-3_9Af, xf-3_9Ae, xf-3_9Ad, xf-3_9Ac, xf-3_9Ab, xf-3_9Aa, xf-3_3g, xf-3_3f, xf-3_3e, xf-3_3d, xf-3_3c, xf-3_3b, xf-3_3a, xf-3_3_6b, xf-3_3_6a, xf-3_3_6, xf-3_3_5c, xf-3_3_5b, xf-3_3_5a, xf-3_3_5Za, xf-3_3_5Z, xf-3_3_5, xf-3_3_4d, xf-3_3_4c, xf-3_3_4b, xf-3_3_4a, xf-3_3_4Z, xf-3_3_4, xf-3_3_3b, xf-3_3_3a, xf-3_3_3_1f, xf-3_3_3_1e, xf-3_3_3_1d, xf-3_3_3_1c, xf-3_3_3_1b, xf-3_3_3_1a, xf-3_3_3_1Z, xf-3_3_3_1, xf-3_3_3Z, xf-3_3_3, xf-3_3_2j, xf-3_3_2i, xf-3_3_2h, xf-3_3_2g, xf-3_3_2f, xf-3_3_2e, xf-3_3_2d, xf-3_3_2c, xf-3_3_2b, xf-3_3_2a, xf-3_3_2_4, xf-3_3_2_3, xf-3_3_2_2, xf-3_3_2_1, xf-3_3_2Zc, xf-3_3_2Zb, xf-3_3_2Za, xf-3_3_2Z, xf-3_3_2, xf-3_3_1z, xf-3_3_1g, xf-3_3_1f, xf-3_3_1e, xf-3_3_1d, xf-3_3_1c, xf-3_3_1b, xf-3_3_1a, xf-3_3_1, xf-3_3-branch, xf-3_3, xf-3_2y, xf-3_2x, xf-3_2w, xf-3_2v, xf-3_2u, xf-3_2t, xf-3_2s, xf-3_2r, xf-3_2q, xf-3_2p, xf-3_2o, xf-3_2n, xf-3_2m, xf-3_2l, xf-3_2k, xf-3_2j, xf-3_2Zc, xf-3_2Zb, xf-3_2Za, xf-3_2Z, xf-3_2Xn, xf-3_2Xm, xf-3_2Xl, xf-3_2Xk, xf-3_2Xj, xf-3_2Xi, xf-3_2Xh, xf-3_2Xg, xf-3_2Xf, xf-3_2Xe, xf-3_2Xd, xf-3_2Xc, xf-3_2Xb, xf-3_2Xa, xf-3_2At, xf-3_2As, xf-3_2Ar, xf-3_2Aq, xf-3_2Ap, xf-3_2Ao, xf-3_2An, xf-3_2Am, xf-3_2Al, xf-3_2Ak, xf-3_2Aj, xf-3_2Ai, xf-3_2Ah, xf-3_2Ag, xf-3_2Af, xf-3_2Ae, xf-3_2Ad, xf-3_2Ac, xf-3_2Ab, xf-3_2Aa, xf-3_2A-branch, xf-3_2A, xf-39ja, xf-3331_shark, seq-4321, seq-4316, seq-4304, seq-4282, X11R6-3_2, X11R6-3_1, X11R6-3_0 Changes since 1.1: +0 -0 lines X11R6 pre-R6.3 seq-4282 |
/* $XConsortium: lbxtags.c /main/11 1996/12/15 21:26:45 rws $ */
/*
* Copyright 1993 Network Computing Devices, Inc.
* Copyright 1996 X Consortium, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name Network Computing Devices, Inc. not be
* used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
*
* THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
* COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
* SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
* OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
* WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
#include "X.h"
#include "misc.h"
#include "lbxdata.h"
#include "resource.h"
#include "lbxtags.h"
#define _XLBX_SERVER_
#include "lbxstr.h"
#include "propertyst.h"
static int tag_free();
static RESTYPE TagResType;
/* ARGSUSED */
static int
tag_free(data, id)
pointer data;
XID id;
{
TagData td = (TagData) data;
FontTagInfoPtr ftip;
char *t;
extern int _lbx_fi_junklen;
if (td->global)
*(td->global) = 0;
/* some types need to be freed, others are shared */
if (td->data_type == LbxTagTypeFont) {
/* remove any back links */
ftip = (FontTagInfoPtr) td->tdata;
FontSetPrivate(ftip->pfont, lbx_font_private, NULL);
t = (char *) ftip->fontinfo;
if (!ftip->compression) /* points to xQueryFont, so back up to it */
t -= _lbx_fi_junklen;
xfree(t);
xfree(ftip);
}
xfree(data);
return 0;
}
TagInit()
{
TagResType = CreateNewResourceType(tag_free);
}
XID
TagNewTag()
{
return FakeClientID(0);
}
void
TagClearProxy(tid, pid)
XID tid;
int pid;
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
if (td)
td->sent_to_proxy[pid >> 3] &= ~(1 << (pid & 7));
}
void
TagMarkProxy(tid, pid)
XID tid;
int pid;
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
td->sent_to_proxy[pid >> 3] |= 1 << (pid & 7);
}
Bool
TagProxyMarked(tid, pid)
XID tid;
int pid;
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
return (td->sent_to_proxy[pid >> 3] & (1 << (pid & 7))) != 0;
}
XID
TagSaveTag(dtype, size, data, global)
int dtype;
int size;
pointer data;
XID *global;
{
TagData td;
td = (TagData) xalloc(sizeof(TagDataRec));
if (!td) {
if (global)
*global = 0;
return 0;
}
bzero((char *) td->sent_to_proxy, (MAX_NUM_PROXIES + 7) / 8);
td->tid = TagNewTag();
td->data_type = dtype;
td->tdata = data;
td->size = size;
td->global = global;
if (!AddResource(td->tid, TagResType, (pointer) td))
return 0;
if (global)
*global = td->tid;
return td->tid;
}
void
TagDeleteTag(tid)
XID tid;
{
int pid;
TagData td;
LbxProxyPtr proxy;
ClientPtr client;
LbxClientPtr lbxcp;
td = (TagData) LookupIDByType(tid, TagResType);
if (!td) /* shouldn't happen, but play it safe */
return;
for (pid = 1; pid < MAX_NUM_PROXIES; pid++) {
if (td->sent_to_proxy[pid >> 3] & (1 << (pid & 7))) {
proxy = LbxPidToProxy(pid);
lbxcp = proxy->lbxClients[0];
if (lbxcp && (client = lbxcp->client))
LbxSendInvalidateTag(client, tid, td->data_type);
td->sent_to_proxy[pid >> 3] &= ~(1 << (pid & 7));
}
}
if (td->data_type != LbxTagTypeProperty || !LbxFlushQTag(tid))
FreeResource(tid, 0);
else if (td->global) {
*(td->global) = 0;
td->global = NULL;
}
}
TagData
TagGetTag(tid)
XID tid;
{
TagData td;
td = (TagData) LookupIDByType(tid, TagResType);
return td;
}
static void
LbxFlushTag(value, tid, cdata)
pointer value;
XID tid;
pointer cdata;
{
TagData td = (TagData)value;
LbxProxyPtr proxy = (LbxProxyPtr)cdata;
int i;
if ((td->data_type == LbxTagTypeProperty) && td->global) {
PropertyPtr pProp = (PropertyPtr)td->tdata;
if ((pProp->tag_id == tid) && (pProp->owner_pid == proxy->pid)) {
LbxFlushQTag(tid);
pProp->size = 0;
FreeResource(tid, 0);
return;
}
}
td->sent_to_proxy[proxy->pid >> 3] &= ~(1 << (proxy->pid & 7));
for (i = 0; i < (MAX_NUM_PROXIES + 7) / 8; i++) {
if (td->sent_to_proxy[i])
return;
}
FreeResource(tid, 0);
}
/*
* clear out markers for proxies
*/
LbxFlushTags(proxy)
LbxProxyPtr proxy;
{
FindClientResourcesByType(NULL, TagResType, LbxFlushTag, (pointer)proxy);
}
|
Powered by ViewCVS 0.9.2 |