mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-16 19:32:26 +00:00
R6.6 is the Xorg base-line
This commit is contained in:
parent
cb6ef07bf0
commit
ded6147bfb
609 changed files with 262690 additions and 0 deletions
1148
lbx/lbxcmap.c
Normal file
1148
lbx/lbxcmap.c
Normal file
File diff suppressed because it is too large
Load diff
44
lbx/lbxdata.h
Normal file
44
lbx/lbxdata.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/* $Xorg: lbxdata.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
|
||||
/*
|
||||
* Copyright 1994 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LBXDATA_H_
|
||||
#define _LBXDATA_H_
|
||||
#define NEED_REPLIES
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
#include "dixfontstr.h"
|
||||
|
||||
extern int lbx_font_private;
|
||||
|
||||
typedef struct _fonttaginfo {
|
||||
XID tid;
|
||||
FontPtr pfont;
|
||||
unsigned long size;
|
||||
int compression;
|
||||
xLbxFontInfo *fontinfo;
|
||||
} FontTagInfoRec, *FontTagInfoPtr;
|
||||
|
||||
#endif /* _LBXDATA_H_ */
|
||||
887
lbx/lbxdix.c
Normal file
887
lbx/lbxdix.c
Normal file
|
|
@ -0,0 +1,887 @@
|
|||
/* $Xorg: lbxdix.c,v 1.4 2001/02/09 02:05:16 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
/*
|
||||
* Copyright 1993 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* various bits of DIX-level mangling */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "inputstr.h"
|
||||
#include "servermd.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "propertyst.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
#include "lbxserve.h"
|
||||
#include "lbxtags.h"
|
||||
#include "lbxdata.h"
|
||||
#include "Xfuncproto.h"
|
||||
|
||||
extern void CopySwap32Write();
|
||||
extern int (*ProcVector[256]) ();
|
||||
extern int (*SwappedProcVector[256]) ();
|
||||
extern void (*ReplySwapVector[256]) ();
|
||||
|
||||
extern void LbxWriteSConnSetupPrefix();
|
||||
|
||||
int lbx_font_private;
|
||||
|
||||
void
|
||||
LbxDixInit()
|
||||
{
|
||||
TagInit();
|
||||
lbx_font_private = AllocateFontPrivateIndex();
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
LbxAllowMotion(client, num)
|
||||
ClientPtr client;
|
||||
int num;
|
||||
{
|
||||
LbxProxyPtr proxy = LbxProxy(client);
|
||||
proxy->motion_allowed_events += num;
|
||||
}
|
||||
|
||||
extern WindowPtr *WindowTable;
|
||||
extern xConnSetupPrefix connSetupPrefix;
|
||||
extern char *ConnectionInfo;
|
||||
extern int connBlockScreenStart;
|
||||
|
||||
int
|
||||
LbxSendConnSetup(client, reason)
|
||||
ClientPtr client;
|
||||
char *reason;
|
||||
{
|
||||
int dlength;
|
||||
int i, ndex, lim, wndex;
|
||||
CARD32 dataBuf[16];
|
||||
xLbxConnSetupPrefix csp;
|
||||
NewClientInfoRec nci;
|
||||
LbxProxyPtr proxy = LbxProxy(client);
|
||||
|
||||
if (reason) {
|
||||
SendConnSetup(client, reason);
|
||||
LbxForceOutput(proxy); /* expedient to avoid another state variable */
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
IncrementClientCount();
|
||||
|
||||
client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
|
||||
client->sequence = 0;
|
||||
dataBuf[0] = client->clientAsMask;
|
||||
|
||||
csp.success = TRUE;
|
||||
csp.majorVersion = connSetupPrefix.majorVersion;
|
||||
csp.minorVersion = connSetupPrefix.minorVersion;
|
||||
csp.tag = 0;
|
||||
#ifdef XAPPGROUP
|
||||
if (!client->appgroup) {
|
||||
#endif
|
||||
csp.changeType = 1; /* LbxNormalDeltas */
|
||||
csp.length = 2 + /* tag + resource-id-base */
|
||||
screenInfo.numScreens; /* input-mask per screen */
|
||||
wndex = 0; ndex = 1; lim = screenInfo.numScreens;
|
||||
#ifdef XAPPGROUP
|
||||
} else {
|
||||
csp.changeType = 2; /* LbxAppGroupDeltas */
|
||||
csp.length = 7 + /* tag, res-id-base, root, visual, colormap, b&w-pix */
|
||||
1 + screenInfo.numScreens - screenInfo.numVideoScreens;
|
||||
XagGetDeltaInfo (client, &dataBuf[1]);
|
||||
for (i = 0; i < MAXSCREENS; i++) {
|
||||
if ((CARD32) WindowTable[i]->drawable.id == dataBuf[1]) {
|
||||
dataBuf[6] = WindowTable[i]->eventMask | wOtherEventMasks(WindowTable[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
wndex = screenInfo.numVideoScreens;
|
||||
ndex = 7;
|
||||
lim = screenInfo.numScreens - screenInfo.numVideoScreens;
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < lim; i++, ndex++, wndex++) {
|
||||
dataBuf[ndex] =
|
||||
WindowTable[wndex]->eventMask | wOtherEventMasks(WindowTable[wndex]);
|
||||
}
|
||||
dlength = (csp.length - 1) << 2;
|
||||
|
||||
if (LbxProxyClient(proxy)->swapped) {
|
||||
swaps(&csp.length, i);
|
||||
}
|
||||
|
||||
if (client->swapped) {
|
||||
LbxWriteSConnSetupPrefix(client, &csp);
|
||||
SwapLongs(dataBuf, (1 + screenInfo.numScreens));
|
||||
WriteToClient(client, dlength, (pointer) dataBuf);
|
||||
} else {
|
||||
WriteToClient(client, sizeof(xLbxConnSetupPrefix), (char *) &csp);
|
||||
WriteToClient(client, dlength, (pointer) dataBuf);
|
||||
}
|
||||
|
||||
LbxForceOutput(proxy); /* expedient to avoid another state variable */
|
||||
client->clientState = ClientStateRunning;
|
||||
if (ClientStateCallback) {
|
||||
if (LbxProxyClient(proxy)->swapped != client->swapped) {
|
||||
swaps(&csp.length, i);
|
||||
}
|
||||
nci.client = client;
|
||||
nci.prefix = (xConnSetupPrefix*) &csp;
|
||||
nci.setup = (xConnSetup *) ConnectionInfo;
|
||||
CallCallbacks(&ClientStateCallback, (pointer) &nci);
|
||||
}
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
extern InputInfo inputInfo;
|
||||
|
||||
static XID modifier_map_tag;
|
||||
|
||||
int
|
||||
LbxGetModifierMapping(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
TagData td;
|
||||
pointer tagdata;
|
||||
xLbxGetModifierMappingReply rep;
|
||||
register KeyClassPtr keyc = inputInfo.keyboard->key;
|
||||
int dlength = keyc->maxKeysPerModifier << 3;
|
||||
Bool tag_known = FALSE,
|
||||
send_data;
|
||||
int n;
|
||||
|
||||
if (!modifier_map_tag) {
|
||||
tagdata = (pointer) keyc->modifierKeyMap;
|
||||
TagSaveTag(LbxTagTypeModmap, dlength, tagdata, &modifier_map_tag);
|
||||
} else {
|
||||
td = TagGetTag(modifier_map_tag);
|
||||
tagdata = td->tdata;
|
||||
tag_known = TagProxyMarked(modifier_map_tag, LbxProxyID(client));
|
||||
}
|
||||
if (modifier_map_tag)
|
||||
TagMarkProxy(modifier_map_tag, LbxProxyID(client));
|
||||
|
||||
send_data = (!modifier_map_tag || !tag_known);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.keyspermod = keyc->maxKeysPerModifier;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.tag = modifier_map_tag;
|
||||
rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
|
||||
|
||||
if (send_data)
|
||||
rep.length = dlength >> 2;
|
||||
else
|
||||
rep.length = 0;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.tag, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xLbxGetModifierMappingReply), (char *)&rep);
|
||||
|
||||
if (send_data)
|
||||
WriteToClient(client, dlength, (char *) tagdata);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
void
|
||||
LbxFlushModifierMapTag()
|
||||
{
|
||||
|
||||
if (modifier_map_tag)
|
||||
TagDeleteTag(modifier_map_tag);
|
||||
}
|
||||
|
||||
static XID keyboard_map_tag;
|
||||
|
||||
int
|
||||
LbxGetKeyboardMapping(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
TagData td;
|
||||
pointer tagdata;
|
||||
xLbxGetKeyboardMappingReply rep;
|
||||
|
||||
REQUEST(xLbxGetKeyboardMappingReq);
|
||||
KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
|
||||
int dlength;
|
||||
Bool tag_known = FALSE,
|
||||
send_data;
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xLbxGetKeyboardMappingReq);
|
||||
|
||||
if ((stuff->firstKeyCode < curKeySyms->minKeyCode) ||
|
||||
(stuff->firstKeyCode > curKeySyms->maxKeyCode)) {
|
||||
client->errorValue = stuff->firstKeyCode;
|
||||
return BadValue;
|
||||
}
|
||||
if (stuff->firstKeyCode + stuff->count > curKeySyms->maxKeyCode + 1) {
|
||||
client->errorValue = stuff->count;
|
||||
return BadValue;
|
||||
}
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.keysperkeycode = curKeySyms->mapWidth;
|
||||
/* length is a count of 4 byte quantities and KeySyms are 4 bytes */
|
||||
|
||||
if (!keyboard_map_tag) {
|
||||
tagdata = (pointer) &curKeySyms->map[(stuff->firstKeyCode -
|
||||
curKeySyms->minKeyCode) * curKeySyms->mapWidth];
|
||||
dlength = (curKeySyms->mapWidth * stuff->count);
|
||||
TagSaveTag(LbxTagTypeKeymap, dlength, tagdata, &keyboard_map_tag);
|
||||
} else {
|
||||
td = TagGetTag(keyboard_map_tag);
|
||||
tagdata = td->tdata;
|
||||
tag_known = TagProxyMarked(keyboard_map_tag, LbxProxyID(client));
|
||||
}
|
||||
if (keyboard_map_tag)
|
||||
TagMarkProxy(keyboard_map_tag, LbxProxyID(client));
|
||||
|
||||
send_data = (!keyboard_map_tag || !tag_known);
|
||||
rep.type = X_Reply;
|
||||
rep.keysperkeycode = curKeySyms->mapWidth;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.tag = keyboard_map_tag;
|
||||
rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
|
||||
|
||||
if (send_data)
|
||||
rep.length = (curKeySyms->mapWidth * stuff->count);
|
||||
else
|
||||
rep.length = 0;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.tag, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xLbxGetKeyboardMappingReply), (char *)&rep);
|
||||
|
||||
if (send_data) {
|
||||
client->pSwapReplyFunc = CopySwap32Write;
|
||||
WriteSwappedDataToClient(client,
|
||||
curKeySyms->mapWidth * stuff->count * sizeof(KeySym),
|
||||
&curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) *
|
||||
curKeySyms->mapWidth]);
|
||||
}
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
void
|
||||
LbxFlushKeyboardMapTag()
|
||||
{
|
||||
if (keyboard_map_tag)
|
||||
TagDeleteTag(keyboard_map_tag);
|
||||
}
|
||||
|
||||
/* counts number of bits needed to hold value */
|
||||
static int
|
||||
_bitsize(val)
|
||||
int val;
|
||||
{
|
||||
int bits = 1; /* always need one for sign bit */
|
||||
|
||||
if (val == 0)
|
||||
return (bits);
|
||||
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
}
|
||||
while (val) {
|
||||
bits++;
|
||||
val >>= 1;
|
||||
}
|
||||
|
||||
return bits;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* squashes the font (if possible), returning the new length and
|
||||
* a pointer to the new data (which has been allocated). if it can't
|
||||
* squish, it just returns a 0 and the data is sent in raw form.
|
||||
*/
|
||||
int _lbx_fi_junklen = sizeof(BYTE) * 2 + sizeof(CARD16) + sizeof(CARD32);
|
||||
|
||||
static int
|
||||
squish_font_info(qfr, rlen, sqrep)
|
||||
xQueryFontReply *qfr;
|
||||
int rlen;
|
||||
xLbxFontInfo **sqrep;
|
||||
{
|
||||
int len,
|
||||
hlen;
|
||||
xLbxFontInfo *new;
|
||||
xCharInfo *minb,
|
||||
*maxb,
|
||||
*ci,
|
||||
bbox;
|
||||
int i;
|
||||
char *t;
|
||||
xLbxCharInfo *chars;
|
||||
int num_chars;
|
||||
|
||||
num_chars = qfr->nCharInfos;
|
||||
|
||||
if (num_chars == 0)
|
||||
return 0;
|
||||
|
||||
minb = &qfr->minBounds;
|
||||
maxb = &qfr->maxBounds;
|
||||
/*
|
||||
* first do the quick check -- if the attribute fields aren't all the
|
||||
* same, punt
|
||||
*/
|
||||
|
||||
if (minb->attributes != maxb->attributes)
|
||||
return 0;
|
||||
|
||||
#define compute(field) \
|
||||
bbox.field = max(_bitsize(minb->field), _bitsize(maxb->field))
|
||||
|
||||
compute(characterWidth);
|
||||
compute(leftSideBearing);
|
||||
compute(rightSideBearing);
|
||||
compute(ascent);
|
||||
compute(descent);
|
||||
|
||||
#undef compute
|
||||
|
||||
/* make sure it fits */
|
||||
if (!((bbox.characterWidth <= LBX_WIDTH_BITS) &&
|
||||
(bbox.leftSideBearing <= LBX_LEFT_BITS) &&
|
||||
(bbox.rightSideBearing <= LBX_RIGHT_BITS) &&
|
||||
(bbox.ascent <= LBX_ASCENT_BITS) &&
|
||||
(bbox.descent <= LBX_DESCENT_BITS))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
hlen = sizeof(xLbxFontInfo) + qfr->nFontProps * sizeof(xFontProp);
|
||||
|
||||
len = hlen + (num_chars * sizeof(xLbxCharInfo));
|
||||
|
||||
new = (xLbxFontInfo *) xalloc(len);
|
||||
if (!new)
|
||||
return 0;
|
||||
|
||||
/* gross hack to avoid copying all the fields */
|
||||
t = (char *) qfr;
|
||||
t += _lbx_fi_junklen;
|
||||
|
||||
/* copy all but the char infos */
|
||||
memcpy((char *) new, (char *) t, hlen);
|
||||
|
||||
t = (char *) new;
|
||||
t += hlen;
|
||||
chars = (xLbxCharInfo *) t;
|
||||
|
||||
t = (char *) qfr;
|
||||
t += sizeof(xQueryFontReply) + qfr->nFontProps * sizeof(xFontProp);
|
||||
ci = (xCharInfo *) t;
|
||||
|
||||
/* now copy & pack the charinfos */
|
||||
for (i = 0; i < num_chars; i++, chars++, ci++) {
|
||||
chars->metrics = 0;
|
||||
chars->metrics |= (LBX_MASK_BITS(ci->characterWidth, LBX_WIDTH_BITS)
|
||||
<< LBX_WIDTH_SHIFT);
|
||||
chars->metrics |= (LBX_MASK_BITS(ci->leftSideBearing, LBX_LEFT_BITS)
|
||||
<< LBX_LEFT_SHIFT);
|
||||
chars->metrics |= (LBX_MASK_BITS(ci->rightSideBearing, LBX_RIGHT_BITS)
|
||||
<< LBX_RIGHT_SHIFT);
|
||||
chars->metrics |= (LBX_MASK_BITS(ci->ascent, LBX_ASCENT_BITS)
|
||||
<< LBX_ASCENT_SHIFT);
|
||||
chars->metrics |= (LBX_MASK_BITS(ci->descent, LBX_DESCENT_BITS)
|
||||
<< LBX_DESCENT_SHIFT);
|
||||
}
|
||||
|
||||
*sqrep = new;
|
||||
return len;
|
||||
}
|
||||
|
||||
int
|
||||
LbxQueryFont(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
xQueryFontReply *reply;
|
||||
xLbxQueryFontReply lbxrep;
|
||||
FontPtr pFont;
|
||||
register GC *pGC;
|
||||
Bool send_data = FALSE;
|
||||
Bool free_data = FALSE;
|
||||
int rlength = 0;
|
||||
FontTagInfoPtr ftip;
|
||||
int sqlen = 0;
|
||||
xLbxFontInfo *sqrep,
|
||||
*sreply = NULL;
|
||||
|
||||
REQUEST(xLbxQueryFontReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xLbxQueryFontReq);
|
||||
|
||||
client->errorValue = stuff->fid; /* EITHER font or gc */
|
||||
pFont = (FontPtr) SecurityLookupIDByType(client, stuff->fid, RT_FONT,
|
||||
SecurityReadAccess);
|
||||
if (!pFont) {
|
||||
/* can't use VERIFY_GC because it might return BadGC */
|
||||
pGC = (GC *) SecurityLookupIDByType(client, stuff->fid, RT_GC,
|
||||
SecurityReadAccess);
|
||||
if (!pGC || !pGC->font) { /* catch a non-existent builtin font */
|
||||
client->errorValue = stuff->fid;
|
||||
return (BadFont); /* procotol spec says only error is BadFont */
|
||||
}
|
||||
pFont = pGC->font;
|
||||
}
|
||||
|
||||
/* get tag (if any) */
|
||||
ftip = (FontTagInfoPtr) FontGetPrivate(pFont, lbx_font_private);
|
||||
|
||||
if (!ftip) {
|
||||
xCharInfo *pmax = FONTINKMAX(pFont);
|
||||
xCharInfo *pmin = FONTINKMIN(pFont);
|
||||
int nprotoxcistructs;
|
||||
|
||||
nprotoxcistructs = (
|
||||
pmax->rightSideBearing == pmin->rightSideBearing &&
|
||||
pmax->leftSideBearing == pmin->leftSideBearing &&
|
||||
pmax->descent == pmin->descent &&
|
||||
pmax->ascent == pmin->ascent &&
|
||||
pmax->characterWidth == pmin->characterWidth) ?
|
||||
0 : N2dChars(pFont);
|
||||
|
||||
rlength = sizeof(xQueryFontReply) +
|
||||
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
|
||||
nprotoxcistructs * sizeof(xCharInfo);
|
||||
reply = (xQueryFontReply *) xalloc(rlength);
|
||||
if (!reply) {
|
||||
return (BadAlloc);
|
||||
}
|
||||
free_data = TRUE;
|
||||
send_data = TRUE;
|
||||
QueryFont(pFont, reply, nprotoxcistructs);
|
||||
|
||||
sqlen = squish_font_info(reply, rlength, &sqrep);
|
||||
if (!sqlen) { /* if it failed to squish, send it raw */
|
||||
char *t;
|
||||
|
||||
lbxrep.compression = 0;
|
||||
|
||||
sqlen = rlength - _lbx_fi_junklen;
|
||||
t = (char *) reply;
|
||||
sqrep = (xLbxFontInfo *) (t + _lbx_fi_junklen);
|
||||
} else {
|
||||
lbxrep.compression = 1;
|
||||
xfree(reply); /* no longer needed */
|
||||
}
|
||||
} else { /* just get data from tag */
|
||||
sqrep = ftip->fontinfo;
|
||||
sqlen = ftip->size;
|
||||
lbxrep.compression = ftip->compression;
|
||||
}
|
||||
|
||||
if (!ftip) {
|
||||
/* data allocation is done when font is first queried */
|
||||
ftip = (FontTagInfoPtr) xalloc(sizeof(FontTagInfoRec));
|
||||
if (ftip &&
|
||||
TagSaveTag(LbxTagTypeFont, sqlen, (pointer) ftip, &ftip->tid)) {
|
||||
FontSetPrivate(pFont, lbx_font_private, (pointer) ftip);
|
||||
ftip->pfont = pFont;
|
||||
ftip->size = sqlen;
|
||||
ftip->fontinfo = sqrep;
|
||||
ftip->compression = lbxrep.compression;
|
||||
free_data = FALSE;
|
||||
} else {
|
||||
xfree(ftip);
|
||||
}
|
||||
}
|
||||
if (ftip) {
|
||||
if (!TagProxyMarked(ftip->tid, LbxProxyID(client)))
|
||||
send_data = TRUE;
|
||||
TagMarkProxy(ftip->tid, LbxProxyID(client));
|
||||
lbxrep.tag = ftip->tid;
|
||||
} else {
|
||||
lbxrep.tag = 0;
|
||||
send_data = TRUE;
|
||||
}
|
||||
|
||||
lbxrep.type = X_Reply;
|
||||
lbxrep.sequenceNumber = client->sequence;
|
||||
lbxrep.pad0 = lbxrep.pad1 = lbxrep.pad2 = lbxrep.pad3 = lbxrep.pad4 = 0;
|
||||
|
||||
if (send_data)
|
||||
lbxrep.length = sqlen >> 2;
|
||||
else
|
||||
lbxrep.length = 0;
|
||||
|
||||
if (client->swapped) {
|
||||
int n;
|
||||
|
||||
swaps(&lbxrep.sequenceNumber, n);
|
||||
swapl(&lbxrep.length, n);
|
||||
swapl(&lbxrep.tag, n);
|
||||
sreply = (xLbxFontInfo *) ALLOCATE_LOCAL(sqlen);
|
||||
if (!sreply)
|
||||
return BadAlloc;
|
||||
memcpy((char *) sreply, (char *) sqrep, sqlen);
|
||||
LbxSwapFontInfo(sreply, lbxrep.compression);
|
||||
sqrep = sreply;
|
||||
}
|
||||
WriteToClient(client, sizeof(xLbxQueryFontReply), (char *) &lbxrep);
|
||||
if (send_data)
|
||||
WriteToClient(client, sqlen, (char *)sqrep);
|
||||
if (free_data)
|
||||
xfree(sqrep);
|
||||
if (sreply)
|
||||
DEALLOCATE_LOCAL(sreply);
|
||||
return (client->noClientException);
|
||||
}
|
||||
|
||||
void
|
||||
LbxFreeFontTag(pfont)
|
||||
FontPtr pfont;
|
||||
{
|
||||
FontTagInfoPtr ftip;
|
||||
|
||||
ftip = (FontTagInfoPtr) FontGetPrivate(pfont, lbx_font_private);
|
||||
if (ftip)
|
||||
TagDeleteTag(ftip->tid);
|
||||
}
|
||||
|
||||
LbxInvalidateTag(client, tag)
|
||||
ClientPtr client;
|
||||
XID tag;
|
||||
{
|
||||
TagClearProxy(tag, LbxProxyID(client));
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
void
|
||||
LbxSendInvalidateTag(client, tag, tagtype)
|
||||
ClientPtr client;
|
||||
XID tag;
|
||||
int tagtype;
|
||||
{
|
||||
xLbxInvalidateTagEvent ev;
|
||||
int n;
|
||||
|
||||
ev.type = LbxEventCode;
|
||||
ev.lbxType = LbxInvalidateTagEvent;
|
||||
ev.sequenceNumber = client->sequence;
|
||||
ev.tag = tag;
|
||||
ev.tagType = tagtype;
|
||||
ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = ev.pad5 = 0;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&ev.sequenceNumber, n);
|
||||
swapl(&ev.tag, n);
|
||||
swapl(&ev.tagType, n);
|
||||
}
|
||||
DBG(DBG_CLIENT, (stderr, "Invalidating tag %d\n", tag));
|
||||
WriteToClient(client, sizeof(xLbxInvalidateTagEvent), (char *) &ev);
|
||||
LbxForceOutput(LbxProxy(client));
|
||||
}
|
||||
|
||||
static void
|
||||
LbxSendSendTagData(pid, tag, tagtype)
|
||||
int pid;
|
||||
XID tag;
|
||||
int tagtype;
|
||||
{
|
||||
xLbxSendTagDataEvent ev;
|
||||
int n;
|
||||
LbxProxyPtr proxy;
|
||||
ClientPtr client;
|
||||
LbxClientPtr lbxcp;
|
||||
|
||||
proxy = LbxPidToProxy(pid);
|
||||
lbxcp = (proxy != NULL) ? proxy->lbxClients[0] : NULL;
|
||||
if (lbxcp && (client = lbxcp->client)) {
|
||||
ev.type = LbxEventCode;
|
||||
ev.lbxType = LbxSendTagDataEvent;
|
||||
ev.sequenceNumber = client->sequence;
|
||||
ev.tag = tag;
|
||||
ev.tagType = tagtype;
|
||||
ev.pad1 = ev.pad2 = ev.pad3 = ev.pad4 = ev.pad5 = 0;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&ev.sequenceNumber, n);
|
||||
swapl(&ev.tag, n);
|
||||
swapl(&ev.tagType, n);
|
||||
}
|
||||
DBG(DBG_CLIENT, (stderr, "Requesting tag %d\n", tag));
|
||||
WriteToClient(client, sizeof(xLbxSendTagDataEvent), (char *) &ev);
|
||||
LbxForceOutput(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* keep track of clients stalled waiting for tags to come back from
|
||||
* a proxy. since multiple clinets can be waiting for the same tag,
|
||||
* we have to keep a list of all of them.
|
||||
*/
|
||||
|
||||
typedef struct _sendtagq {
|
||||
XID tag;
|
||||
int num_stalled;
|
||||
ClientPtr *stalled_clients;
|
||||
struct _sendtagq *next;
|
||||
} SendTagQRec, *SendTagQPtr;
|
||||
|
||||
static SendTagQPtr queried_tags = NULL;
|
||||
|
||||
#define LbxSendTagFailed -1
|
||||
#define LbxSendTagSendIt 0
|
||||
#define LbxSendTagAlreadySent 1
|
||||
|
||||
static Bool
|
||||
LbxQueueSendTag(client, tag)
|
||||
ClientPtr client;
|
||||
XID tag;
|
||||
{
|
||||
SendTagQPtr stqp, *prev, new;
|
||||
ClientPtr *newlist;
|
||||
|
||||
|
||||
/* see if we're asking for one already in the pipeline */
|
||||
for (prev = &queried_tags; stqp = *prev; prev = &stqp->next) {
|
||||
if (stqp->tag == tag) {
|
||||
/* add new client to list */
|
||||
newlist = (ClientPtr *) xrealloc(stqp->stalled_clients,
|
||||
(sizeof(ClientPtr) * (stqp->num_stalled + 1)));
|
||||
if (!newlist)
|
||||
return LbxSendTagFailed;
|
||||
newlist[stqp->num_stalled++] = client;
|
||||
stqp->stalled_clients = newlist;
|
||||
DBG(DBG_CLIENT, (stderr, "Additional client requesting tag %d\n", tag));
|
||||
return LbxSendTagAlreadySent;
|
||||
}
|
||||
}
|
||||
|
||||
/* make new one */
|
||||
new = (SendTagQPtr) xalloc(sizeof(SendTagQRec));
|
||||
newlist = (ClientPtr *) xalloc(sizeof(ClientPtr));
|
||||
if (!new || !newlist) {
|
||||
xfree(new);
|
||||
xfree(newlist);
|
||||
return LbxSendTagFailed;
|
||||
}
|
||||
*newlist = client;
|
||||
new->stalled_clients = newlist;
|
||||
new->num_stalled = 1;
|
||||
new->tag = tag;
|
||||
new->next = NULL;
|
||||
|
||||
/* stick on end of list */
|
||||
*prev = new;
|
||||
return LbxSendTagSendIt;
|
||||
}
|
||||
|
||||
SendTagQPtr
|
||||
LbxFindQTag(tag)
|
||||
XID tag;
|
||||
{
|
||||
SendTagQPtr stqp;
|
||||
|
||||
for (stqp = queried_tags; stqp; stqp = stqp->next) {
|
||||
if (stqp->tag == tag)
|
||||
return stqp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
LbxFreeQTag(stqp)
|
||||
SendTagQPtr stqp;
|
||||
{
|
||||
xfree(stqp->stalled_clients);
|
||||
xfree(stqp);
|
||||
}
|
||||
|
||||
static void
|
||||
LbxRemoveQTag(tag)
|
||||
XID tag;
|
||||
{
|
||||
SendTagQPtr stqp, *prev;
|
||||
|
||||
for (prev = &queried_tags; stqp = *prev; prev = &stqp->next) {
|
||||
if (stqp->tag == tag) {
|
||||
*prev = stqp->next;
|
||||
LbxFreeQTag(stqp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
LbxFlushQTag(tag)
|
||||
XID tag;
|
||||
{
|
||||
SendTagQPtr stqp;
|
||||
ClientPtr *cp;
|
||||
|
||||
stqp = LbxFindQTag(tag);
|
||||
if (!stqp)
|
||||
return FALSE;
|
||||
for (cp = stqp->stalled_clients; --stqp->num_stalled >= 0; cp++)
|
||||
AttendClient(*cp);
|
||||
LbxRemoveQTag(tag);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ProcessQTagZombies()
|
||||
{
|
||||
SendTagQPtr stqp;
|
||||
ClientPtr *out, *in;
|
||||
int i;
|
||||
|
||||
for (stqp = queried_tags; stqp; stqp = stqp->next) {
|
||||
out = stqp->stalled_clients;
|
||||
for (in = out, i = stqp->num_stalled; --i >= 0; in++) {
|
||||
if ((*in)->clientGone)
|
||||
--stqp->num_stalled;
|
||||
else
|
||||
*out++ = *in;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* server sends this
|
||||
*/
|
||||
|
||||
void
|
||||
LbxQueryTagData(client, owner_pid, tag, tagtype)
|
||||
ClientPtr client;
|
||||
int owner_pid;
|
||||
XID tag;
|
||||
int tagtype;
|
||||
{
|
||||
/* save the info and the client being stalled */
|
||||
if (LbxQueueSendTag(client, tag) == LbxSendTagSendIt)
|
||||
LbxSendSendTagData(owner_pid, tag, tagtype);
|
||||
}
|
||||
|
||||
/*
|
||||
* server recieves this
|
||||
*/
|
||||
int
|
||||
LbxTagData(client, tag, len, data)
|
||||
ClientPtr client;
|
||||
XID tag;
|
||||
unsigned long len;
|
||||
pointer data;
|
||||
{
|
||||
TagData td;
|
||||
PropertyPtr pProp;
|
||||
|
||||
td = TagGetTag(tag);
|
||||
if (!td || td->data_type != LbxTagTypeProperty)
|
||||
return Success;
|
||||
if (!td->global) {
|
||||
/* somebody changed contents while we were querying */
|
||||
TagDeleteTag(tag);
|
||||
return Success;
|
||||
}
|
||||
LbxFlushQTag(tag);
|
||||
pProp = (PropertyPtr) td->tdata;
|
||||
if (pProp->tag_id != tag || pProp->owner_pid != LbxProxyID(client))
|
||||
return Success;
|
||||
pProp->owner_pid = 0;
|
||||
if (len != td->size)
|
||||
pProp->size = len / (pProp->format >> 3);
|
||||
pProp->data = xrealloc(pProp->data, len);
|
||||
if (!pProp->data) {
|
||||
pProp->size = 0;
|
||||
return Success;
|
||||
}
|
||||
if (client->swapped) {
|
||||
switch (pProp->format) {
|
||||
case 32:
|
||||
SwapLongs((CARD32 *) data, len >> 2);
|
||||
break;
|
||||
case 16:
|
||||
SwapShorts((short *) data, len >> 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
memmove((char *) pProp->data, (char *) data, len);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/* when server resets, need to reset global tags */
|
||||
void
|
||||
LbxResetTags()
|
||||
{
|
||||
SendTagQPtr stqp;
|
||||
|
||||
modifier_map_tag = 0;
|
||||
keyboard_map_tag = 0;
|
||||
|
||||
/* clean out any pending tag requests */
|
||||
while (stqp = queried_tags) {
|
||||
queried_tags = stqp->next;
|
||||
LbxFreeQTag(stqp);
|
||||
}
|
||||
}
|
||||
270
lbx/lbxexts.c
Normal file
270
lbx/lbxexts.c
Normal file
|
|
@ -0,0 +1,270 @@
|
|||
/* $Xorg: lbxexts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
|
||||
/*
|
||||
* Copyright 1994 Network Computing Devices, 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 "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "dixstruct.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
#ifdef XCSECURITY
|
||||
#define _SECURITY_SERVER
|
||||
#include "extensions/security.h"
|
||||
#endif
|
||||
|
||||
typedef struct _lbxext {
|
||||
char *name;
|
||||
char **aliases;
|
||||
int num_aliases;
|
||||
int idx;
|
||||
int opcode;
|
||||
int ev_base;
|
||||
int err_base;
|
||||
int num_reqs;
|
||||
CARD8 *rep_mask;
|
||||
CARD8 *ev_mask;
|
||||
#ifdef XCSECURITY
|
||||
Bool secure;
|
||||
#endif
|
||||
} LbxExtensionEntry;
|
||||
|
||||
static LbxExtensionEntry **lbx_extensions = NULL;
|
||||
static int num_exts = 0;
|
||||
|
||||
|
||||
Bool
|
||||
LbxAddExtension(name, opcode, ev_base, err_base)
|
||||
char *name;
|
||||
int opcode;
|
||||
int ev_base,
|
||||
err_base;
|
||||
{
|
||||
int i;
|
||||
register LbxExtensionEntry *ext,
|
||||
**newexts;
|
||||
|
||||
ext = (LbxExtensionEntry *) xalloc(sizeof(LbxExtensionEntry));
|
||||
if (!ext)
|
||||
return FALSE;
|
||||
ext->name = (char *) xalloc(strlen(name) + 1);
|
||||
ext->num_aliases = 0;
|
||||
ext->aliases = (char **) NULL;
|
||||
if (!ext->name) {
|
||||
xfree(ext);
|
||||
return FALSE;
|
||||
}
|
||||
strcpy(ext->name, name);
|
||||
i = num_exts;
|
||||
newexts = (LbxExtensionEntry **) xrealloc(lbx_extensions,
|
||||
(i + 1) * sizeof(LbxExtensionEntry *));
|
||||
if (!newexts) {
|
||||
xfree(ext->name);
|
||||
xfree(ext);
|
||||
return FALSE;
|
||||
}
|
||||
num_exts++;
|
||||
lbx_extensions = newexts;
|
||||
lbx_extensions[i] = ext;
|
||||
ext->idx = i;
|
||||
|
||||
ext->opcode = opcode;;
|
||||
ext->ev_base = ev_base;;
|
||||
ext->err_base = err_base;
|
||||
ext->ev_mask = NULL;
|
||||
ext->rep_mask = NULL;
|
||||
ext->num_reqs = 0;
|
||||
#ifdef XCSECURITY
|
||||
ext->secure = FALSE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
LbxAddExtensionAlias(idx, alias)
|
||||
int idx;
|
||||
char *alias;
|
||||
{
|
||||
char *name;
|
||||
char **aliases;
|
||||
LbxExtensionEntry *ext = lbx_extensions[idx];
|
||||
|
||||
aliases = (char **) xrealloc(ext->aliases,
|
||||
(ext->num_aliases + 1) * sizeof(char *));
|
||||
if (!aliases)
|
||||
return FALSE;
|
||||
ext->aliases = aliases;
|
||||
name = (char *) xalloc(strlen(alias) + 1);
|
||||
if (!name)
|
||||
return FALSE;
|
||||
strcpy(name, alias);
|
||||
ext->aliases[ext->num_aliases] = name;
|
||||
ext->num_aliases++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
LbxFindExtension(extname, len)
|
||||
char *extname;
|
||||
int len;
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < num_exts; i++) {
|
||||
if ((strlen(lbx_extensions[i]->name) == len) &&
|
||||
(strncmp(lbx_extensions[i]->name, extname, len) == 0))
|
||||
return i;
|
||||
for (j = lbx_extensions[i]->num_aliases; --j >= 0;) {
|
||||
if ((strlen(lbx_extensions[i]->aliases[j]) == len) &&
|
||||
(strncmp(lbx_extensions[i]->aliases[j], extname, len) == 0))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
LbxDeclareExtensionSecurity(extname, secure)
|
||||
char *extname;
|
||||
Bool secure;
|
||||
{
|
||||
#ifdef XCSECURITY
|
||||
int i = LbxFindExtension(extname, strlen(extname));
|
||||
if (i >= 0)
|
||||
lbx_extensions[i]->secure = secure;
|
||||
#endif
|
||||
}
|
||||
|
||||
Bool
|
||||
LbxRegisterExtensionGenerationMasks(idx, num_reqs, rep_mask, ev_mask)
|
||||
int idx;
|
||||
int num_reqs;
|
||||
char *rep_mask,
|
||||
*ev_mask;
|
||||
{
|
||||
LbxExtensionEntry *ext = lbx_extensions[idx];
|
||||
CARD8 *nrm,
|
||||
*nem;
|
||||
int mlen = mlen = num_reqs / (8 * sizeof(CARD8)) + 1;
|
||||
|
||||
nrm = (CARD8 *) xalloc(sizeof(CARD8) * mlen);
|
||||
nem = (CARD8 *) xalloc(sizeof(CARD8) * mlen);
|
||||
|
||||
if (!nrm || !nem) {
|
||||
xfree(nrm);
|
||||
xfree(nem);
|
||||
return FALSE;
|
||||
}
|
||||
memcpy((char *) nrm, (char *) rep_mask, mlen);
|
||||
memcpy((char *) nem, (char *) ev_mask, mlen);
|
||||
ext->rep_mask = nrm;
|
||||
ext->ev_mask = nem;
|
||||
ext->num_reqs = num_reqs;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
LbxQueryExtension(client, ename, nlen)
|
||||
ClientPtr client;
|
||||
char *ename;
|
||||
int nlen;
|
||||
{
|
||||
xLbxQueryExtensionReply rep;
|
||||
int i;
|
||||
int mlen = 0;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.major_opcode = 0;
|
||||
rep.present = FALSE;
|
||||
rep.length = 0;
|
||||
rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
|
||||
|
||||
i = LbxFindExtension(ename, nlen);
|
||||
|
||||
if (i < 0
|
||||
#ifdef XCSECURITY
|
||||
/* don't show insecure extensions to untrusted clients */
|
||||
|| (client->trustLevel == XSecurityClientUntrusted &&
|
||||
!lbx_extensions[i]->secure)
|
||||
#endif
|
||||
)
|
||||
rep.present = FALSE;
|
||||
else {
|
||||
rep.present = TRUE;
|
||||
rep.major_opcode = lbx_extensions[i]->opcode;
|
||||
rep.first_event = lbx_extensions[i]->ev_base;
|
||||
rep.first_error = lbx_extensions[i]->err_base;
|
||||
rep.numReqs = lbx_extensions[i]->num_reqs;
|
||||
if (lbx_extensions[i]->rep_mask) {
|
||||
mlen = (lbx_extensions[i]->num_reqs + 7) >> 3;
|
||||
rep.length = ((mlen + 3) >> 2) * 2;
|
||||
}
|
||||
}
|
||||
if (client->swapped) {
|
||||
char n;
|
||||
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xLbxQueryExtensionReply), (char *)&rep);
|
||||
if (mlen) {
|
||||
WriteToClient(client, mlen, (char *)lbx_extensions[i]->rep_mask);
|
||||
WriteToClient(client, mlen, (char *)lbx_extensions[i]->ev_mask);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
LbxCloseDownExtensions()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_exts; i++) {
|
||||
xfree(lbx_extensions[i]->name);
|
||||
xfree(lbx_extensions[i]->aliases);
|
||||
xfree(lbx_extensions[i]->rep_mask);
|
||||
xfree(lbx_extensions[i]->ev_mask);
|
||||
xfree(lbx_extensions[i]);
|
||||
}
|
||||
xfree(lbx_extensions);
|
||||
lbx_extensions = NULL;
|
||||
num_exts = 0;
|
||||
}
|
||||
|
||||
void
|
||||
LbxSetReqMask(mask, req, on)
|
||||
CARD8 *mask;
|
||||
int req;
|
||||
Bool on;
|
||||
{
|
||||
int mword = req / (8 * sizeof(CARD8));
|
||||
|
||||
req = req % (8 * sizeof(CARD8));
|
||||
if (on) {
|
||||
mask[mword] |= (1 << req);
|
||||
} else {
|
||||
mask[mword] &= ~(1 << req);
|
||||
}
|
||||
}
|
||||
867
lbx/lbxgfx.c
Normal file
867
lbx/lbxgfx.c
Normal file
|
|
@ -0,0 +1,867 @@
|
|||
/* $Xorg: lbxgfx.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
|
||||
/*
|
||||
* Copyright 1993 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* various bits of DIX-level mangling */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "servermd.h"
|
||||
#include "windowstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
#include "lbxserve.h"
|
||||
#include "lbxtags.h"
|
||||
#include "Xfuncproto.h"
|
||||
#include "lbximage.h"
|
||||
#include "lbxsrvopts.h"
|
||||
|
||||
#define DrawableCache(client) (LbxClient(client)->drawableCache)
|
||||
#define GContextCache(client) (LbxClient(client)->gcontextCache)
|
||||
|
||||
extern int (*ProcVector[256])();
|
||||
|
||||
static void
|
||||
push (cache, xid)
|
||||
XID cache[GFX_CACHE_SIZE];
|
||||
XID xid;
|
||||
{
|
||||
memmove (cache+1, cache, (GFX_CACHE_SIZE - 1) * sizeof (cache[0]));
|
||||
cache[0] = xid;
|
||||
}
|
||||
|
||||
static XID
|
||||
use (cache, i)
|
||||
XID cache[GFX_CACHE_SIZE];
|
||||
int i;
|
||||
{
|
||||
XID tmp;
|
||||
|
||||
tmp = cache[i];
|
||||
if (i != 0)
|
||||
{
|
||||
memmove (cache + 1, cache, i * sizeof (cache[0]));
|
||||
cache[0] = tmp;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
extern char *ConnectionInfo;
|
||||
|
||||
int
|
||||
LbxDecodeGFXCache(client, cacheEnts, after, drawp, gcp)
|
||||
ClientPtr client;
|
||||
CARD8 cacheEnts;
|
||||
char *after;
|
||||
Drawable *drawp;
|
||||
GContext *gcp;
|
||||
{
|
||||
int skip;
|
||||
int dcache, gcache;
|
||||
|
||||
dcache = GFXdCacheEnt (cacheEnts);
|
||||
gcache = GFXgCacheEnt (cacheEnts);
|
||||
skip = 0;
|
||||
if (dcache == GFXCacheNone)
|
||||
{
|
||||
memcpy (drawp, after, sizeof (Drawable));
|
||||
push (DrawableCache(client), *drawp);
|
||||
after += sizeof (Drawable);
|
||||
skip += sizeof (Drawable);
|
||||
}
|
||||
else
|
||||
*drawp = use (DrawableCache(client), dcache);
|
||||
if (gcache == GFXCacheNone)
|
||||
{
|
||||
memcpy (gcp, after, sizeof (GContext));
|
||||
push (GContextCache(client), *gcp);
|
||||
skip += sizeof (GContext);
|
||||
}
|
||||
else
|
||||
*gcp = use (GContextCache(client), gcache);
|
||||
return skip;
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeDrawableCache(client, cacheEnts, after, drawp)
|
||||
ClientPtr client;
|
||||
CARD8 cacheEnts;
|
||||
char *after;
|
||||
Drawable *drawp;
|
||||
{
|
||||
int skip;
|
||||
int dcache;
|
||||
|
||||
dcache = GFXdCacheEnt (cacheEnts);
|
||||
skip = 0;
|
||||
if (dcache == GFXCacheNone)
|
||||
{
|
||||
memcpy (drawp, after, sizeof (Drawable));
|
||||
push (DrawableCache(client), *drawp);
|
||||
after += sizeof (Drawable);
|
||||
skip += sizeof (Drawable);
|
||||
}
|
||||
else
|
||||
*drawp = use (DrawableCache(client), dcache);
|
||||
return skip;
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeGCCache(client, cacheEnts, after, gcp)
|
||||
ClientPtr client;
|
||||
CARD8 cacheEnts;
|
||||
char *after;
|
||||
GContext *gcp;
|
||||
{
|
||||
int skip;
|
||||
int gcache;
|
||||
|
||||
gcache = GFXgCacheEnt (cacheEnts);
|
||||
skip = 0;
|
||||
if (gcache == GFXCacheNone)
|
||||
{
|
||||
memcpy (gcp, after, sizeof (GContext));
|
||||
push (GContextCache(client), *gcp);
|
||||
after += sizeof (GContext);
|
||||
skip += sizeof (GContext);
|
||||
}
|
||||
else
|
||||
*gcp = use (GContextCache(client), gcache);
|
||||
return skip;
|
||||
}
|
||||
|
||||
#define GFX_GET_DRAWABLE_AND_GC(type,in,len) {\
|
||||
int skip; \
|
||||
len = (client->req_len << 2) - SIZEOF(type); \
|
||||
in = ((char *) stuff) + SIZEOF(type);\
|
||||
skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
|
||||
&drawable, &gc); \
|
||||
in += skip; \
|
||||
len -= skip; \
|
||||
}
|
||||
|
||||
#define GFX_GET_DST_DRAWABLE_AND_GC(type,in,len) {\
|
||||
int skip; \
|
||||
len = (client->req_len << 2) - SIZEOF(type); \
|
||||
in = ((char *) stuff) + SIZEOF(type);\
|
||||
skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
|
||||
&dstDrawable, &gc); \
|
||||
in += skip; \
|
||||
len -= skip; \
|
||||
}
|
||||
|
||||
#define GFX_GET_SRC_DST_DRAWABLE_AND_GC(type, in, len) { \
|
||||
int skip; \
|
||||
len = (client->req_len << 2) - SIZEOF(type); \
|
||||
in = ((char *) stuff) + SIZEOF(type); \
|
||||
skip = LbxDecodeDrawableCache(client, stuff->srcCache, in, \
|
||||
&srcDrawable); \
|
||||
in += skip; \
|
||||
len -= skip; \
|
||||
skip = LbxDecodeGFXCache(client, stuff->cacheEnts, in, \
|
||||
&dstDrawable, &gc); \
|
||||
in += skip; \
|
||||
len -= skip; \
|
||||
}
|
||||
|
||||
#define GFX_GET_GC(type, in, len) { \
|
||||
int skip; \
|
||||
len = (client->req_len << 2) - SIZEOF(type); \
|
||||
in = ((char *) stuff) + SIZEOF(type); \
|
||||
skip = LbxDecodeGCCache(client, stuff->gcCache, in, &gc); \
|
||||
in += skip; \
|
||||
len -= skip; \
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodePoly(client, xreqtype, decode_rtn)
|
||||
register ClientPtr client;
|
||||
CARD8 xreqtype;
|
||||
int (*decode_rtn)();
|
||||
{
|
||||
REQUEST(xLbxPolyPointReq);
|
||||
char *in;
|
||||
xPolyPointReq *xreq;
|
||||
int len;
|
||||
int retval;
|
||||
Drawable drawable;
|
||||
GContext gc;
|
||||
|
||||
GFX_GET_DRAWABLE_AND_GC(xLbxPolyPointReq, in, len);
|
||||
if ((xreq = (xPolyPointReq *)
|
||||
xalloc(sizeof(xPolyPointReq) + (len << 1))) == NULL)
|
||||
return BadAlloc;
|
||||
len = (*decode_rtn)(in, in + len - stuff->padBytes, &xreq[1]);
|
||||
xreq->reqType = xreqtype;
|
||||
xreq->coordMode = 1;
|
||||
xreq->drawable = drawable;
|
||||
xreq->gc = gc;
|
||||
xreq->length = client->req_len = (sizeof(xPolyPointReq) + len) >> 2;
|
||||
client->requestBuffer = (pointer)xreq;
|
||||
|
||||
retval = (*ProcVector[xreqtype])(client);
|
||||
xfree(xreq);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeFillPoly(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xLbxFillPolyReq);
|
||||
char *in;
|
||||
xFillPolyReq *xreq;
|
||||
int len;
|
||||
int retval;
|
||||
Drawable drawable;
|
||||
GContext gc;
|
||||
|
||||
GFX_GET_DRAWABLE_AND_GC(xLbxFillPolyReq, in, len);
|
||||
if ((xreq = (xFillPolyReq *)
|
||||
xalloc(sizeof(xFillPolyReq) + (len << 1))) == NULL)
|
||||
return BadAlloc;
|
||||
len = LbxDecodePoints(in, in + len - stuff->padBytes, (short *) &xreq[1]);
|
||||
xreq->reqType = X_FillPoly;
|
||||
xreq->drawable = drawable;
|
||||
xreq->gc = gc;
|
||||
xreq->shape = stuff->shape;
|
||||
xreq->coordMode = 1;
|
||||
xreq->length = client->req_len = (sizeof(xFillPolyReq) + len) >> 2;
|
||||
client->requestBuffer = (pointer)xreq;
|
||||
|
||||
retval = (*ProcVector[X_FillPoly])(client);
|
||||
xfree(xreq);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Routines for decoding line drawing requests
|
||||
*/
|
||||
|
||||
#define DECODE_PSHORT(in, val) \
|
||||
if ((*(in) & 0xf0) != 0xf0) \
|
||||
(val) = *(CARD8 *)(in)++; \
|
||||
else { \
|
||||
(val) = ((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1); \
|
||||
if ((val) >= 0xe00) \
|
||||
(val) -= 0x1000; \
|
||||
else \
|
||||
(val) += 0xf0; \
|
||||
(in) += 2; \
|
||||
}
|
||||
|
||||
#define DECODE_SHORT(in, val) \
|
||||
if ((*(in) & 0xf0) != 0x80) \
|
||||
(val) = *(INT8 *)(in)++; \
|
||||
else { \
|
||||
(val) = ((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1); \
|
||||
if ((val) & 0x0800) \
|
||||
(val) = ((val) | 0xf000) - 0x70; \
|
||||
else \
|
||||
(val) += 0x80; \
|
||||
(in) += 2; \
|
||||
}
|
||||
|
||||
#define DECODE_USHORT(in, val) \
|
||||
if ((*(in) & 0xf0) != 0xf0) \
|
||||
(val) = *(CARD8 *)(in)++; \
|
||||
else { \
|
||||
(val) = (((*(CARD8 *)(in) & 0x0f) << 8) | *(CARD8 *)((in) + 1)) + 0xf0; \
|
||||
(in) += 2; \
|
||||
}
|
||||
|
||||
#define DECODE_ANGLE(in, val) \
|
||||
if (*(INT8 *)(in) >= 0x6e) \
|
||||
(val) = (*(INT8 *)(in)++ - 0x67) * (15 << 6); \
|
||||
else if (*(INT8 *)(in) >= 0x5a) \
|
||||
(val) = (*(INT8 *)(in)++ - 0x5a) * (5 << 6); \
|
||||
else if (*(INT8 *)(in) <= (INT8)0x91) \
|
||||
(val) = (*(INT8 *)(in)++ - (INT8)0x98) * (15 << 6); \
|
||||
else if (*(INT8 *)(in) <= (INT8)0xa5) \
|
||||
(val) = (*(INT8 *)(in)++ - (INT8)0xa6) * (5 << 6); \
|
||||
else { \
|
||||
(val) = (*(CARD8 *)(in) << 8) | *(CARD8 *)((in) + 1); \
|
||||
(in) += 2; \
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodePoints(in, inend, out)
|
||||
register char *in;
|
||||
char *inend;
|
||||
register short *out;
|
||||
{
|
||||
char *start_out = (char *)out;
|
||||
|
||||
while (in < inend) {
|
||||
DECODE_SHORT(in, *out);
|
||||
out++;
|
||||
DECODE_SHORT(in, *out);
|
||||
out++;
|
||||
}
|
||||
return ((char *)out - start_out);
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeSegment(in, inend, out)
|
||||
register char *in;
|
||||
char *inend;
|
||||
register short *out;
|
||||
{
|
||||
register short diff;
|
||||
short last_x = 0;
|
||||
short last_y = 0;
|
||||
char *start_out = (char *)out;
|
||||
|
||||
while (in < inend) {
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_x + diff;
|
||||
last_x += diff;
|
||||
out++;
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_y + diff;
|
||||
last_y += diff;
|
||||
out++;
|
||||
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_x + diff;
|
||||
out++;
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_y + diff;
|
||||
out++;
|
||||
}
|
||||
return ((char *)out - start_out);
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeRectangle(in, inend, out)
|
||||
register char *in;
|
||||
char *inend;
|
||||
register short *out;
|
||||
{
|
||||
register short diff;
|
||||
short last_x = 0;
|
||||
short last_y = 0;
|
||||
char *start_out = (char *)out;
|
||||
|
||||
while (in < inend) {
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_x + diff;
|
||||
last_x += diff;
|
||||
out++;
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_y + diff;
|
||||
last_y += diff;
|
||||
out++;
|
||||
|
||||
DECODE_USHORT(in, *(unsigned short *)out);
|
||||
out++;
|
||||
DECODE_USHORT(in, *(unsigned short *)out);
|
||||
out++;
|
||||
}
|
||||
return ((char *)out - start_out);
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeArc(in, inend, out)
|
||||
register char *in;
|
||||
char *inend;
|
||||
register short *out;
|
||||
{
|
||||
register short diff;
|
||||
short last_x = 0;
|
||||
short last_y = 0;
|
||||
char *start_out = (char *)out;
|
||||
|
||||
while (in < inend) {
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_x + diff;
|
||||
last_x += diff;
|
||||
out++;
|
||||
DECODE_SHORT(in, diff);
|
||||
*out = last_y + diff;
|
||||
last_y += diff;
|
||||
out++;
|
||||
|
||||
DECODE_USHORT(in, *(unsigned short *)out);
|
||||
out++;
|
||||
DECODE_USHORT(in, *(unsigned short *)out);
|
||||
out++;
|
||||
|
||||
DECODE_ANGLE(in, *out);
|
||||
out++;
|
||||
DECODE_ANGLE(in, *out);
|
||||
out++;
|
||||
}
|
||||
return ((char *)out - start_out);
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeCopyArea (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xLbxCopyAreaReq);
|
||||
char *in;
|
||||
xCopyAreaReq req;
|
||||
int len;
|
||||
Drawable srcDrawable, dstDrawable;
|
||||
GContext gc;
|
||||
|
||||
GFX_GET_SRC_DST_DRAWABLE_AND_GC(xLbxCopyAreaReq, in, len);
|
||||
req.reqType = X_CopyArea;
|
||||
req.length = client->req_len = SIZEOF(xCopyAreaReq) >> 2;
|
||||
req.srcDrawable = srcDrawable;
|
||||
req.dstDrawable = dstDrawable;
|
||||
req.gc = gc;
|
||||
DECODE_PSHORT (in, req.srcX);
|
||||
DECODE_PSHORT (in, req.srcY);
|
||||
DECODE_PSHORT (in, req.dstX);
|
||||
DECODE_PSHORT (in, req.dstY);
|
||||
DECODE_USHORT (in, req.width);
|
||||
DECODE_USHORT (in, req.height);
|
||||
client->requestBuffer = (pointer) &req;
|
||||
return (*ProcVector[X_CopyArea])(client);
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeCopyPlane (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xLbxCopyPlaneReq);
|
||||
char *in;
|
||||
xCopyPlaneReq req;
|
||||
int len;
|
||||
Drawable srcDrawable, dstDrawable;
|
||||
GContext gc;
|
||||
|
||||
GFX_GET_SRC_DST_DRAWABLE_AND_GC(xLbxCopyPlaneReq, in, len);
|
||||
req.reqType = X_CopyPlane;
|
||||
req.length = client->req_len = SIZEOF(xCopyPlaneReq) >> 2;
|
||||
req.srcDrawable = srcDrawable;
|
||||
req.dstDrawable = dstDrawable;
|
||||
req.gc = gc;
|
||||
DECODE_PSHORT (in, req.srcX);
|
||||
DECODE_PSHORT (in, req.srcY);
|
||||
DECODE_PSHORT (in, req.dstX);
|
||||
DECODE_PSHORT (in, req.dstY);
|
||||
DECODE_USHORT (in, req.width);
|
||||
DECODE_USHORT (in, req.height);
|
||||
req.bitPlane = stuff->bitPlane;
|
||||
client->requestBuffer = (pointer) &req;
|
||||
return (*ProcVector[X_CopyPlane])(client);
|
||||
}
|
||||
|
||||
static pointer
|
||||
get_gfx_buffer(client, len)
|
||||
ClientPtr client;
|
||||
int len;
|
||||
{
|
||||
LbxClientPtr lbxClient = LbxClient(client);
|
||||
pointer tmp;
|
||||
|
||||
/* XXX should probably shrink this sucker too */
|
||||
if (len > lbxClient->gb_size) {
|
||||
tmp = (pointer) xrealloc(lbxClient->gfx_buffer, len);
|
||||
if (!tmp)
|
||||
return (pointer) NULL;
|
||||
lbxClient->gfx_buffer = tmp;
|
||||
lbxClient->gb_size = len;
|
||||
}
|
||||
return lbxClient->gfx_buffer;
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodePolyText (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xLbxPolyTextReq);
|
||||
char *in, *pos;
|
||||
xPolyTextReq *xreq;
|
||||
int len;
|
||||
Drawable drawable;
|
||||
GContext gc;
|
||||
|
||||
GFX_GET_DRAWABLE_AND_GC(xLbxPolyTextReq, in, len);
|
||||
xreq = (xPolyTextReq *) get_gfx_buffer(client, sizeof (xPolyTextReq) + len);
|
||||
if (!xreq)
|
||||
return BadAlloc;
|
||||
xreq->reqType = stuff->lbxReqType == X_LbxPolyText8? X_PolyText8 : X_PolyText16;
|
||||
xreq->drawable = drawable;
|
||||
xreq->gc = gc;
|
||||
pos = in;
|
||||
DECODE_PSHORT(in, xreq->x);
|
||||
DECODE_PSHORT(in, xreq->y);
|
||||
len -= (in - pos);
|
||||
memmove ((char *) (xreq + 1), in, len);
|
||||
xreq->length = client->req_len = (sizeof (xPolyTextReq) + len) >> 2;
|
||||
client->requestBuffer = (pointer) xreq;
|
||||
return (*ProcVector[xreq->reqType])(client);
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeImageText (client)
|
||||
ClientPtr client;
|
||||
{
|
||||
REQUEST(xLbxImageTextReq);
|
||||
char *in, *pos;
|
||||
xImageTextReq *xreq;
|
||||
int len;
|
||||
Drawable drawable;
|
||||
GContext gc;
|
||||
|
||||
GFX_GET_DRAWABLE_AND_GC(xLbxImageTextReq, in, len);
|
||||
xreq = (xImageTextReq *) get_gfx_buffer(client, sizeof (xImageTextReq) + len);
|
||||
if (!xreq)
|
||||
return BadAlloc;
|
||||
xreq->reqType = stuff->lbxReqType == X_LbxImageText8? X_ImageText8 : X_ImageText16;
|
||||
xreq->drawable = drawable;
|
||||
xreq->gc = gc;
|
||||
xreq->nChars = stuff->nChars;
|
||||
pos = in;
|
||||
DECODE_PSHORT(in, xreq->x);
|
||||
DECODE_PSHORT(in, xreq->y);
|
||||
len -= (in - pos);
|
||||
memmove ((char *) (xreq + 1), in, len);
|
||||
xreq->length = client->req_len = (sizeof (xImageTextReq) + len) >> 2;
|
||||
client->requestBuffer = (pointer) xreq;
|
||||
return (*ProcVector[xreq->reqType])(client);
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodePutImage (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xLbxPutImageReq);
|
||||
char *in, *data;
|
||||
xPutImageReq xreq;
|
||||
int ppl, bpl, nbytes;
|
||||
int retval;
|
||||
int n;
|
||||
|
||||
xreq.reqType = X_PutImage;
|
||||
|
||||
in = (char *) stuff + sz_xLbxPutImageReq;
|
||||
|
||||
if (stuff->bitPacked & 0x80) {
|
||||
xreq.format = (stuff->bitPacked >> 5) & 0x3;
|
||||
xreq.depth = ((stuff->bitPacked >> 2) & 0x7) + 1;
|
||||
xreq.leftPad = 0;
|
||||
} else {
|
||||
xreq.depth = (stuff->bitPacked >> 2) + 1;
|
||||
xreq.format = (*in >> 5) & 0x3;
|
||||
xreq.leftPad = *in++ & 0x1f;
|
||||
}
|
||||
DECODE_USHORT(in, xreq.width);
|
||||
DECODE_USHORT(in, xreq.height);
|
||||
DECODE_PSHORT(in, xreq.dstX);
|
||||
DECODE_PSHORT(in, xreq.dstY);
|
||||
if (client->swapped) {
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone ||
|
||||
GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
{
|
||||
swapl (in, n);
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone &&
|
||||
GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
swapl (in + 4, n);
|
||||
}
|
||||
}
|
||||
in += LbxDecodeGFXCache(client, stuff->cacheEnts, in,
|
||||
&xreq.drawable, &xreq.gc);
|
||||
|
||||
ppl = xreq.width + xreq.leftPad;
|
||||
if (xreq.format != ZPixmap ||
|
||||
(xreq.depth == 1 && screenInfo.formats->bitsPerPixel == 1)) {
|
||||
#ifdef INTERNAL_VS_EXTERNAL_PADDING
|
||||
bpl = BitmapBytePadProto(ppl);
|
||||
#else
|
||||
bpl = BitmapBytePad(ppl);
|
||||
#endif
|
||||
nbytes = bpl;
|
||||
if (xreq.format == XYPixmap)
|
||||
nbytes *= xreq.depth;
|
||||
} else {
|
||||
#ifdef INTERNAL_VS_EXTERNAL_PADDING
|
||||
bpl = PixmapBytePadProto(ppl, xreq.depth);
|
||||
#else
|
||||
bpl = PixmapBytePad(ppl, xreq.depth);
|
||||
#endif
|
||||
nbytes = bpl;
|
||||
}
|
||||
nbytes *= xreq.height;
|
||||
xreq.length = ((nbytes + 3) >> 2) + (sz_xPutImageReq >> 2);
|
||||
/* +1 is because fillspan in DecodeFaxG42D seems to go 1 byte too far,
|
||||
* and I don't want to mess with that code */
|
||||
if ((data = (char *) xalloc ((xreq.length << 2) + 1)) == NULL)
|
||||
return BadAlloc;
|
||||
|
||||
*((xPutImageReq *)data) = xreq;
|
||||
|
||||
if (!stuff->compressionMethod)
|
||||
{
|
||||
memcpy(data + sz_xPutImageReq, in, nbytes);
|
||||
}
|
||||
else if (xreq.format != ZPixmap ||
|
||||
(xreq.depth == 1 && screenInfo.formats->bitsPerPixel == 1))
|
||||
{
|
||||
LbxBitmapCompMethod *compMethod;
|
||||
|
||||
compMethod = LbxSrvrLookupBitmapCompMethod (LbxProxy(client),
|
||||
stuff->compressionMethod);
|
||||
|
||||
if (!compMethod)
|
||||
{
|
||||
xfree (data);
|
||||
return (BadValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!compMethod->inited)
|
||||
{
|
||||
if (compMethod->compInit)
|
||||
(*compMethod->compInit)();
|
||||
compMethod->inited = 1;
|
||||
}
|
||||
|
||||
(*compMethod->decompFunc) (
|
||||
(unsigned char *) in, (unsigned char *) data + sz_xPutImageReq,
|
||||
nbytes,
|
||||
#if BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER
|
||||
(ppl + BITMAP_SCANLINE_UNIT - 1) & ~BITMAP_SCANLINE_UNIT,
|
||||
#else
|
||||
ppl,
|
||||
#endif
|
||||
bpl,
|
||||
((xConnSetup *) ConnectionInfo)->bitmapBitOrder == LSBFirst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LbxPixmapCompMethod *compMethod;
|
||||
|
||||
compMethod = LbxSrvrLookupPixmapCompMethod (LbxProxy(client),
|
||||
stuff->compressionMethod);
|
||||
|
||||
if (!compMethod)
|
||||
{
|
||||
xfree (data);
|
||||
return (BadValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!compMethod->inited)
|
||||
{
|
||||
if (compMethod->compInit)
|
||||
(*compMethod->compInit)();
|
||||
compMethod->inited = 1;
|
||||
}
|
||||
|
||||
(*compMethod->decompFunc) (
|
||||
in, (char *) data + sz_xPutImageReq,
|
||||
(int) xreq.height, bpl);
|
||||
}
|
||||
}
|
||||
|
||||
client->req_len = xreq.length;
|
||||
client->requestBuffer = (pointer) data;
|
||||
|
||||
retval = (*ProcVector[X_PutImage])(client);
|
||||
xfree(data);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int
|
||||
LbxDecodeGetImage (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST (xLbxGetImageReq);
|
||||
xLbxGetImageReply *reply = NULL;
|
||||
int lbxLen, xLen, n;
|
||||
int method, bytes, status;
|
||||
xGetImageReply *theImage;
|
||||
|
||||
REQUEST_SIZE_MATCH(xLbxGetImageReq);
|
||||
|
||||
status = DoGetImage(client, stuff->format, stuff->drawable,
|
||||
stuff->x, stuff->y,
|
||||
(int)stuff->width, (int)stuff->height,
|
||||
stuff->planeMask, &theImage);
|
||||
|
||||
if (status != Success)
|
||||
return (status);
|
||||
|
||||
if ((reply = (xLbxGetImageReply *) xalloc (
|
||||
sz_xLbxGetImageReply + theImage->length)) == NULL)
|
||||
{
|
||||
xfree(theImage);
|
||||
return (BadAlloc);
|
||||
}
|
||||
|
||||
if (stuff->format != ZPixmap ||
|
||||
(theImage->depth == 1 && screenInfo.formats->bitsPerPixel == 1))
|
||||
{
|
||||
LbxBitmapCompMethod *compMethod;
|
||||
|
||||
compMethod = LbxSrvrFindPreferredBitmapCompMethod (LbxProxy(client));
|
||||
|
||||
if (!compMethod)
|
||||
status = LBX_IMAGE_COMPRESS_NO_SUPPORT;
|
||||
else
|
||||
{
|
||||
if (!compMethod->inited)
|
||||
{
|
||||
if (compMethod->compInit)
|
||||
(*compMethod->compInit)();
|
||||
compMethod->inited = 1;
|
||||
}
|
||||
|
||||
status = (*compMethod->compFunc) (
|
||||
(unsigned char *) &theImage[1],
|
||||
(unsigned char *) &reply[1],
|
||||
theImage->length,
|
||||
theImage->length,
|
||||
#if BITMAP_BIT_ORDER != IMAGE_BYTE_ORDER
|
||||
(int) (stuff->width + BITMAP_SCANLINE_UNIT - 1) &
|
||||
~BITMAP_SCANLINE_UNIT,
|
||||
#else
|
||||
(int) stuff->width,
|
||||
#endif
|
||||
#ifdef INTERNAL_VS_EXTERNAL_PADDING
|
||||
BitmapBytePadProto(stuff->width),
|
||||
#else
|
||||
BitmapBytePad(stuff->width),
|
||||
#endif
|
||||
((xConnSetup *) ConnectionInfo)->bitmapBitOrder == LSBFirst,
|
||||
&bytes);
|
||||
|
||||
method = compMethod->methodOpCode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LbxPixmapCompMethod *compMethod;
|
||||
|
||||
compMethod = LbxSrvrFindPreferredPixmapCompMethod (
|
||||
LbxProxy(client), (int) stuff->format, theImage->depth);
|
||||
|
||||
if (!compMethod)
|
||||
status = LBX_IMAGE_COMPRESS_NO_SUPPORT;
|
||||
else
|
||||
{
|
||||
if (!compMethod->inited)
|
||||
{
|
||||
if (compMethod->compInit)
|
||||
(*compMethod->compInit)();
|
||||
compMethod->inited = 1;
|
||||
}
|
||||
|
||||
status = (*compMethod->compFunc) (
|
||||
(char *) &theImage[1],
|
||||
(char *) &reply[1],
|
||||
theImage->length,
|
||||
(int) stuff->format,
|
||||
theImage->depth,
|
||||
(int) stuff->height,
|
||||
#ifdef INTERNAL_VS_EXTERNAL_PADDING
|
||||
PixmapBytePadProto(stuff->width, theImage->depth),
|
||||
#else
|
||||
PixmapBytePad(stuff->width, theImage->depth),
|
||||
#endif
|
||||
&bytes);
|
||||
|
||||
method = compMethod->methodOpCode;
|
||||
}
|
||||
}
|
||||
|
||||
reply->type = X_Reply;
|
||||
reply->depth = theImage->depth;
|
||||
reply->sequenceNumber = client->sequence;
|
||||
reply->visual = theImage->visual;
|
||||
reply->pad1 = reply->pad2 = reply->pad3 = reply->pad4 = reply->pad5 = 0;
|
||||
|
||||
if (status != LBX_IMAGE_COMPRESS_SUCCESS)
|
||||
{
|
||||
reply->compressionMethod = LbxImageCompressNone;
|
||||
reply->lbxLength = reply->xLength = (theImage->length + 3) >> 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
reply->compressionMethod = method;
|
||||
reply->lbxLength = (bytes + 3) >> 2;
|
||||
reply->xLength = (theImage->length + 3) >> 2;
|
||||
}
|
||||
|
||||
lbxLen = reply->lbxLength;
|
||||
xLen = reply->xLength;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
swaps (&reply->sequenceNumber, n);
|
||||
swapl (&reply->lbxLength, n);
|
||||
swapl (&reply->xLength, n);
|
||||
swapl (&reply->visual, n);
|
||||
}
|
||||
|
||||
if (reply->compressionMethod != LbxImageCompressNone)
|
||||
{
|
||||
/*
|
||||
* If the compressed image is greater that 25% of the original
|
||||
* image, run the GetImage reply through the regular stream
|
||||
* compressor. Otherwise, just write the compressed image.
|
||||
*/
|
||||
|
||||
if (lbxLen > (xLen / 4))
|
||||
{
|
||||
WriteToClient (client,
|
||||
sz_xLbxGetImageReply + (lbxLen << 2), (char *)reply);
|
||||
}
|
||||
else
|
||||
{
|
||||
UncompressedWriteToClient (client,
|
||||
sz_xLbxGetImageReply + (lbxLen << 2), (char *)reply);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Write back the original uncompressed image.
|
||||
*/
|
||||
|
||||
WriteToClient (client, sz_xLbxGetImageReply, (char *)reply);
|
||||
WriteToClient (client, lbxLen << 2, (char *)&theImage[1]);
|
||||
}
|
||||
|
||||
xfree (theImage);
|
||||
|
||||
if (reply)
|
||||
xfree ((char *) reply);
|
||||
|
||||
return (Success);
|
||||
}
|
||||
1819
lbx/lbxmain.c
Normal file
1819
lbx/lbxmain.c
Normal file
File diff suppressed because it is too large
Load diff
817
lbx/lbxopts.c
Normal file
817
lbx/lbxopts.c
Normal file
|
|
@ -0,0 +1,817 @@
|
|||
/* $Xorg: lbxopts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
|
||||
/*
|
||||
* Copyright 1994 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef OPTDEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "lbxserve.h"
|
||||
#include "lbxstr.h"
|
||||
#include "lbximage.h"
|
||||
#include "lbxopts.h"
|
||||
#include "lbxsrvopts.h"
|
||||
#ifndef NO_ZLIB
|
||||
#include "lbxzlib.h"
|
||||
#endif /* NO_ZLIB */
|
||||
|
||||
static int LbxDeltaOpt();
|
||||
static int LbxProxyDeltaOpt();
|
||||
static int LbxServerDeltaOpt();
|
||||
static int LbxStreamCompOpt();
|
||||
static int LbxBitmapCompOpt();
|
||||
static int LbxPixmapCompOpt();
|
||||
static int LbxMessageCompOpt();
|
||||
static int LbxUseTagsOpt();
|
||||
static int LbxCmapAllOpt();
|
||||
|
||||
/*
|
||||
* List of LBX options we recognize and are willing to negotiate
|
||||
*/
|
||||
static struct _LbxOptionParser {
|
||||
CARD8 optcode;
|
||||
int (*parser)();
|
||||
} LbxOptions[] = {
|
||||
{ LBX_OPT_DELTA_PROXY, LbxProxyDeltaOpt },
|
||||
{ LBX_OPT_DELTA_SERVER, LbxServerDeltaOpt },
|
||||
{ LBX_OPT_STREAM_COMP, LbxStreamCompOpt },
|
||||
{ LBX_OPT_BITMAP_COMP, LbxBitmapCompOpt },
|
||||
{ LBX_OPT_PIXMAP_COMP, LbxPixmapCompOpt },
|
||||
{ LBX_OPT_MSG_COMP, LbxMessageCompOpt },
|
||||
{ LBX_OPT_USE_TAGS, LbxUseTagsOpt },
|
||||
{ LBX_OPT_CMAP_ALL, LbxCmapAllOpt }
|
||||
};
|
||||
|
||||
#define LBX_N_OPTS (sizeof(LbxOptions) / sizeof(struct _LbxOptionParser))
|
||||
|
||||
/*
|
||||
* Set option defaults
|
||||
*/
|
||||
LbxOptionInit(pno)
|
||||
LbxNegOptsPtr pno;
|
||||
{
|
||||
bzero(pno, sizeof(LbxNegOptsRec));
|
||||
pno->proxyDeltaN = pno->serverDeltaN = LBX_OPT_DELTA_NCACHE_DFLT;
|
||||
pno->proxyDeltaMaxLen = pno->serverDeltaMaxLen = LBX_OPT_DELTA_MSGLEN_DFLT;
|
||||
pno->squish = TRUE;
|
||||
pno->numBitmapCompMethods = 0;
|
||||
pno->bitmapCompMethods = NULL;
|
||||
pno->numPixmapCompMethods = 0;
|
||||
pno->pixmapCompMethods = NULL;
|
||||
pno->pixmapCompDepths = NULL;
|
||||
pno->useTags = TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
LbxOptionParse(pno, popt, optlen, preply)
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
{
|
||||
int i;
|
||||
int nopts = *popt++;
|
||||
unsigned char *pout = preply;
|
||||
|
||||
for (i = 0; i < nopts; i++) {
|
||||
int j;
|
||||
int len;
|
||||
int hdrlen;
|
||||
int replylen;
|
||||
|
||||
LBX_OPT_DECODE_LEN(popt + 1, len, hdrlen);
|
||||
if (len < ++hdrlen || len > optlen) {
|
||||
#ifdef OPTDEBUG
|
||||
fprintf(stderr, "bad option length, len = %d, hdrlen = %d, optlen = %d\n", len, hdrlen, optlen);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (j = 0; j < LBX_N_OPTS; j++) {
|
||||
if (popt[0] == LbxOptions[j].optcode) {
|
||||
replylen = (*LbxOptions[j].parser)(pno,
|
||||
popt + hdrlen,
|
||||
len - hdrlen,
|
||||
pout + LBX_OPT_SMALLHDR_LEN);
|
||||
if (replylen < 0)
|
||||
return -1;
|
||||
else if (replylen > 0) {
|
||||
/*
|
||||
* None of the current options require big headers,
|
||||
* so this works for now.
|
||||
*/
|
||||
*pout++ = i;
|
||||
*pout++ = LBX_OPT_SMALLHDR_LEN + replylen;
|
||||
pout += replylen;
|
||||
pno->nopts++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
optlen -= len;
|
||||
popt += len;
|
||||
}
|
||||
|
||||
return (pout - preply);
|
||||
}
|
||||
|
||||
static int
|
||||
LbxProxyDeltaOpt(pno, popt, optlen, preply)
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
{
|
||||
return LbxDeltaOpt(popt, optlen, preply,
|
||||
&pno->proxyDeltaN, &pno->proxyDeltaMaxLen);
|
||||
}
|
||||
|
||||
static int
|
||||
LbxServerDeltaOpt(pno, popt, optlen, preply)
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
{
|
||||
return LbxDeltaOpt(popt, optlen, preply,
|
||||
&pno->serverDeltaN, &pno->serverDeltaMaxLen);
|
||||
}
|
||||
|
||||
static int
|
||||
LbxDeltaOpt(popt, optlen, preply, pn, pmaxlen)
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
short *pn;
|
||||
short *pmaxlen;
|
||||
{
|
||||
short n;
|
||||
short maxlen;
|
||||
|
||||
/*
|
||||
* If there's more data than we expect, we just ignore it.
|
||||
*/
|
||||
if (optlen < LBX_OPT_DELTA_REQLEN) {
|
||||
#ifdef OPTDEBUG
|
||||
fprintf(stderr, "bad delta option length = %d\n", optlen);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Accept whatever value the proxy prefers, so skip the
|
||||
* min/max offerings. Note that the max message len value is
|
||||
* encoded as the number of 4-byte values.
|
||||
*/
|
||||
popt += 2;
|
||||
n = *popt++;
|
||||
popt += 2;
|
||||
maxlen = *popt++;
|
||||
if ((maxlen <<= 2) == 0)
|
||||
n = 0;
|
||||
else if (maxlen < 32) {
|
||||
#ifdef OPTDEBUG
|
||||
fprintf(stderr, "bad delta max msg length %d\n", maxlen);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put the response in the reply buffer
|
||||
*/
|
||||
*preply++ = n;
|
||||
*preply++ = maxlen >> 2;
|
||||
|
||||
*pn = n;
|
||||
*pmaxlen = maxlen;
|
||||
|
||||
return LBX_OPT_DELTA_REPLYLEN;
|
||||
}
|
||||
|
||||
static int ZlibParse();
|
||||
|
||||
static struct _LbxStreamCompParser {
|
||||
int typelen;
|
||||
char *type;
|
||||
int (*parser)();
|
||||
} LbxStreamComp[] = {
|
||||
#ifndef NO_ZLIB
|
||||
{ ZLIB_STRCOMP_OPT_LEN, ZLIB_STRCOMP_OPT, ZlibParse },
|
||||
#endif /* NO_ZLIB */
|
||||
};
|
||||
|
||||
#define LBX_N_STRCOMP \
|
||||
(sizeof(LbxStreamComp) / sizeof(struct _LbxStreamCompParser))
|
||||
|
||||
static int
|
||||
LbxStreamCompOpt(pno, popt, optlen, preply)
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
{
|
||||
int i;
|
||||
int typelen;
|
||||
int nopts = *popt++;
|
||||
|
||||
for (i = 0; i < nopts; i++) {
|
||||
int j;
|
||||
int len;
|
||||
int lensize;
|
||||
int replylen;
|
||||
|
||||
typelen = popt[0];
|
||||
for (j = 0; j < LBX_N_STRCOMP; j++) {
|
||||
if (typelen == LbxStreamComp[j].typelen &&
|
||||
!strncmp((char *) popt + 1, LbxStreamComp[j].type, typelen))
|
||||
break;
|
||||
}
|
||||
|
||||
popt += 1 + typelen;
|
||||
optlen -= 1 + typelen;
|
||||
LBX_OPT_DECODE_LEN(popt, len, lensize);
|
||||
|
||||
if (j < LBX_N_STRCOMP) {
|
||||
if (len > optlen)
|
||||
return -1;
|
||||
replylen = (*LbxStreamComp[j].parser)(pno,
|
||||
popt + lensize,
|
||||
len - lensize,
|
||||
preply + 1);
|
||||
if (replylen == -1)
|
||||
return -1;
|
||||
else if (replylen >= 0) {
|
||||
*preply = i;
|
||||
return replylen + 1;
|
||||
}
|
||||
}
|
||||
|
||||
optlen -= len;
|
||||
popt += len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern LbxStreamCompHandle ZlibInit();
|
||||
extern int ZlibStuffInput(), ZlibInputAvail(), ZlibFlush(),
|
||||
ZlibRead(), ZlibWriteV();
|
||||
extern void ZlibCompressOn(), ZlibCompressOff(), ZlibFree();
|
||||
|
||||
|
||||
static int
|
||||
ZlibParse(pno, popt, optlen, preply)
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
{
|
||||
int level; /* compression level */
|
||||
|
||||
if (*popt++ != 1) /* length should be 1 */
|
||||
return (-1);
|
||||
|
||||
level = *popt;
|
||||
if (level < 1 || level > 9)
|
||||
return (-1);
|
||||
|
||||
pno->streamOpts.streamCompInit = ZlibInit;
|
||||
pno->streamOpts.streamCompArg = (pointer) level;
|
||||
pno->streamOpts.streamCompStuffInput = ZlibStuffInput;
|
||||
pno->streamOpts.streamCompInputAvail = ZlibInputAvail;
|
||||
pno->streamOpts.streamCompFlush = ZlibFlush;
|
||||
pno->streamOpts.streamCompRead = ZlibRead;
|
||||
pno->streamOpts.streamCompWriteV = ZlibWriteV;
|
||||
pno->streamOpts.streamCompOn = ZlibCompressOn;
|
||||
pno->streamOpts.streamCompOff = ZlibCompressOff;
|
||||
pno->streamOpts.streamCompFreeHandle = ZlibFree;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
LbxMessageCompOpt(pno, popt, optlen, preply)
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
{
|
||||
|
||||
if (optlen == 0) {
|
||||
#ifdef OPTDEBUG
|
||||
fprintf(stderr, "bad message-comp option length specified %d\n", optlen);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
pno->squish = *preply = *popt;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
LbxUseTagsOpt(pno, popt, optlen, preply)
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
{
|
||||
|
||||
if (optlen == 0) {
|
||||
#ifdef OPTDEBUG
|
||||
fprintf(stderr, "bad use-tags option length specified %d\n", optlen);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
pno->useTags = *preply = *popt;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Option negotiation for image compression
|
||||
*/
|
||||
|
||||
LbxBitmapCompMethod
|
||||
LbxBitmapCompMethods [] = {
|
||||
{
|
||||
"XC-FaxG42D", /* compression method name */
|
||||
0, /* inited */
|
||||
2, /* method opcode */
|
||||
NULL, /* init function */
|
||||
LbxImageEncodeFaxG42D, /* encode function */
|
||||
LbxImageDecodeFaxG42D /* decode function */
|
||||
}
|
||||
};
|
||||
|
||||
#define NUM_BITMAP_METHODS \
|
||||
(sizeof (LbxBitmapCompMethods) / sizeof (LbxBitmapCompMethod))
|
||||
|
||||
|
||||
#if 1
|
||||
/*
|
||||
* Currently, we don't support any pixmap compression algorithms
|
||||
* because regular stream compression does much better than PackBits.
|
||||
* If we want to plug in a better pixmap image compression algorithm,
|
||||
* it would go here.
|
||||
*/
|
||||
|
||||
#define NUM_PIXMAP_METHODS 0
|
||||
LbxPixmapCompMethod LbxPixmapCompMethods [1]; /* dummy */
|
||||
|
||||
#else
|
||||
|
||||
LbxPixmapCompMethod
|
||||
LbxPixmapCompMethods [] = {
|
||||
{
|
||||
"XC-PackBits", /* compression method name */
|
||||
1 << ZPixmap, /* formats supported */
|
||||
1, {8}, /* depths supported */
|
||||
0, /* inited */
|
||||
1, /* method opcode */
|
||||
NULL, /* init function */
|
||||
LbxImageEncodePackBits, /* encode function */
|
||||
LbxImageDecodePackBits /* decode function */
|
||||
}
|
||||
};
|
||||
|
||||
#define NUM_PIXMAP_METHODS \
|
||||
(sizeof (LbxPixmapCompMethods) / sizeof (LbxPixmapCompMethod))
|
||||
#endif
|
||||
|
||||
static int MergeDepths ();
|
||||
|
||||
|
||||
static int
|
||||
LbxImageCompOpt (pixmap, pno, popt, optlen, preply)
|
||||
|
||||
Bool pixmap;
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
|
||||
{
|
||||
unsigned char *preplyStart = preply;
|
||||
int numMethods = *popt++;
|
||||
char *myIndices, *hisIndices;
|
||||
unsigned *retFormats;
|
||||
int **retDepths;
|
||||
int replyCount = 0;
|
||||
int status, i, j;
|
||||
|
||||
if (numMethods == 0)
|
||||
{
|
||||
if (pixmap)
|
||||
pno->numPixmapCompMethods = 0;
|
||||
else
|
||||
pno->numBitmapCompMethods = 0;
|
||||
|
||||
*preply++ = 0;
|
||||
return (1);
|
||||
}
|
||||
|
||||
myIndices = (char *) xalloc (numMethods);
|
||||
hisIndices = (char *) xalloc (numMethods);
|
||||
|
||||
if (!myIndices || !hisIndices)
|
||||
{
|
||||
if (myIndices)
|
||||
xfree (myIndices);
|
||||
if (hisIndices)
|
||||
xfree (hisIndices);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
retFormats = (unsigned *) xalloc (numMethods);
|
||||
retDepths = (int **) xalloc (numMethods * sizeof (int *));
|
||||
|
||||
if (!retFormats || !retDepths)
|
||||
{
|
||||
if (retFormats)
|
||||
xfree (retFormats);
|
||||
if (retDepths)
|
||||
xfree (retDepths);
|
||||
xfree (myIndices);
|
||||
xfree (hisIndices);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For each method in the list sent by the proxy, see if the server
|
||||
* supports this method. If YES, update the following lists:
|
||||
*
|
||||
* myIndices[] is a list of indices into the server's
|
||||
* LbxBit[Pix]mapCompMethods table.
|
||||
*
|
||||
* hisIndices[] is a list of indices into the list of
|
||||
* method names sent by the proxy.
|
||||
*
|
||||
* retFormats[] indicates for each pixmap compression method,
|
||||
* the pixmap formats supported.
|
||||
*
|
||||
* retDepths[] indicates for each pixmap compression method,
|
||||
* the pixmap depths supported.
|
||||
*/
|
||||
|
||||
for (i = 0; i < numMethods; i++)
|
||||
{
|
||||
unsigned formatMask, newFormatMask;
|
||||
int depthCount, *depths, len;
|
||||
int freeDepths;
|
||||
char *methodName;
|
||||
|
||||
freeDepths = 0;
|
||||
len = *popt++;
|
||||
methodName = (char *) popt;
|
||||
popt += len;
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
formatMask = *popt++;
|
||||
depthCount = *popt++;
|
||||
depths = (int *) xalloc ((depthCount + 1) * sizeof (int));
|
||||
freeDepths = 1;
|
||||
depths[0] = depthCount;
|
||||
for (j = 1; j <= depthCount; j++)
|
||||
depths[j] = *popt++;
|
||||
}
|
||||
|
||||
for (j = 0;
|
||||
j < (pixmap ? NUM_PIXMAP_METHODS : NUM_BITMAP_METHODS); j++)
|
||||
{
|
||||
|
||||
status = strncmp (methodName,
|
||||
(pixmap ? LbxPixmapCompMethods[j].methodName :
|
||||
LbxBitmapCompMethods[j].methodName),
|
||||
len);
|
||||
|
||||
if (status == 0 && pixmap)
|
||||
{
|
||||
newFormatMask =
|
||||
formatMask & LbxPixmapCompMethods[j].formatMask;
|
||||
|
||||
depthCount = MergeDepths (depths, &LbxPixmapCompMethods[j]);
|
||||
|
||||
if (newFormatMask == 0 || depthCount == 0)
|
||||
status = 1;
|
||||
}
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
myIndices[replyCount] = j;
|
||||
hisIndices[replyCount] = i;
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
retFormats[replyCount] = newFormatMask;
|
||||
retDepths[replyCount] = depths;
|
||||
freeDepths = 0;
|
||||
}
|
||||
|
||||
replyCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (freeDepths)
|
||||
xfree (depths);
|
||||
}
|
||||
|
||||
*preply++ = replyCount;
|
||||
|
||||
/*
|
||||
* Sort the lists by LBX server preference (increasing myIndices[] vals)
|
||||
*/
|
||||
|
||||
for (i = 0; i <= replyCount - 2; i++)
|
||||
for (j = replyCount - 1; j >= i; j--)
|
||||
if (myIndices[j - 1] > myIndices[j])
|
||||
{
|
||||
char temp1 = myIndices[j - 1];
|
||||
char temp2 = hisIndices[j - 1];
|
||||
|
||||
myIndices[j - 1] = myIndices[j];
|
||||
myIndices[j] = temp1;
|
||||
|
||||
hisIndices[j - 1] = hisIndices[j];
|
||||
hisIndices[j] = temp2;
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
unsigned temp3 = retFormats[j - 1];
|
||||
int *temp4 = retDepths[j - 1];
|
||||
|
||||
retFormats[j - 1] = retFormats[j];
|
||||
retFormats[j] = temp3;
|
||||
|
||||
retDepths[j - 1] = retDepths[j];
|
||||
retDepths[j] = temp4;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For each method supported, return to the proxy an index into
|
||||
* the list sent by the proxy, the opcode to be used for the method,
|
||||
* the pixmap formats supported, and the list of depths supported.
|
||||
*/
|
||||
|
||||
for (i = 0; i < replyCount; i++)
|
||||
{
|
||||
*preply++ = hisIndices[i];
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
int left;
|
||||
*preply++ = LbxPixmapCompMethods[myIndices[i]].methodOpCode;
|
||||
*preply++ = retFormats[i];
|
||||
*preply++ = left = retDepths[i][0];
|
||||
j = 1;
|
||||
while (left > 0)
|
||||
{
|
||||
*preply++ = retDepths[i][j];
|
||||
left--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*preply++ = LbxBitmapCompMethods[myIndices[i]].methodOpCode;
|
||||
}
|
||||
}
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
pno->numPixmapCompMethods = replyCount;
|
||||
pno->pixmapCompMethods = myIndices;
|
||||
pno->pixmapCompDepths = retDepths;
|
||||
}
|
||||
else
|
||||
{
|
||||
pno->numBitmapCompMethods = replyCount;
|
||||
pno->bitmapCompMethods = myIndices;
|
||||
}
|
||||
|
||||
if (hisIndices)
|
||||
xfree (hisIndices);
|
||||
|
||||
if (pixmap)
|
||||
{
|
||||
if (retFormats)
|
||||
xfree (retFormats);
|
||||
}
|
||||
|
||||
return (preply - preplyStart);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
LbxBitmapCompOpt (pno, popt, optlen, preply)
|
||||
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
|
||||
{
|
||||
return (LbxImageCompOpt (0 /* bitmap */, pno, popt, optlen, preply));
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
LbxPixmapCompOpt (pno, popt, optlen, preply)
|
||||
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
|
||||
{
|
||||
return (LbxImageCompOpt (1 /* Pixmap */, pno, popt, optlen, preply));
|
||||
}
|
||||
|
||||
|
||||
LbxBitmapCompMethod *
|
||||
LbxSrvrLookupBitmapCompMethod (proxy, methodOpCode)
|
||||
|
||||
LbxProxyPtr proxy;
|
||||
int methodOpCode;
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < proxy->numBitmapCompMethods; i++)
|
||||
{
|
||||
LbxBitmapCompMethod *method;
|
||||
|
||||
method = &LbxBitmapCompMethods[proxy->bitmapCompMethods[i]];
|
||||
|
||||
if (method->methodOpCode == methodOpCode)
|
||||
return (method);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
LbxPixmapCompMethod *
|
||||
LbxSrvrLookupPixmapCompMethod (proxy, methodOpCode)
|
||||
|
||||
LbxProxyPtr proxy;
|
||||
int methodOpCode;
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < proxy->numPixmapCompMethods; i++)
|
||||
{
|
||||
LbxPixmapCompMethod *method;
|
||||
|
||||
method = &LbxPixmapCompMethods[proxy->pixmapCompMethods[i]];
|
||||
|
||||
if (method->methodOpCode == methodOpCode)
|
||||
return (method);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
LbxBitmapCompMethod *
|
||||
LbxSrvrFindPreferredBitmapCompMethod (proxy)
|
||||
|
||||
LbxProxyPtr proxy;
|
||||
|
||||
{
|
||||
if (proxy->numBitmapCompMethods == 0)
|
||||
return NULL;
|
||||
else
|
||||
return (&LbxBitmapCompMethods[proxy->bitmapCompMethods[0]]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LbxPixmapCompMethod *
|
||||
LbxSrvrFindPreferredPixmapCompMethod (proxy, format, depth)
|
||||
|
||||
LbxProxyPtr proxy;
|
||||
int format;
|
||||
int depth;
|
||||
|
||||
{
|
||||
if (proxy->numPixmapCompMethods == 0)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
LbxPixmapCompMethod *method;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < proxy->numPixmapCompMethods; i++)
|
||||
{
|
||||
method = &LbxPixmapCompMethods[proxy->pixmapCompMethods[i]];
|
||||
|
||||
if ((method->formatMask & (1 << format)))
|
||||
{
|
||||
int n = proxy->pixmapCompDepths[i][0];
|
||||
j = 1;
|
||||
while (n > 0)
|
||||
{
|
||||
if (depth == proxy->pixmapCompDepths[i][j])
|
||||
return method;
|
||||
else
|
||||
n--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int MergeDepths (depths, method)
|
||||
|
||||
int *depths;
|
||||
LbxPixmapCompMethod *method;
|
||||
|
||||
{
|
||||
int i, j, count;
|
||||
int temp[LBX_MAX_DEPTHS + 1];
|
||||
|
||||
temp[0] = count = 0;
|
||||
|
||||
for (i = 1; i <= depths[0]; i++)
|
||||
{
|
||||
for (j = 0; j < method->depthCount; j++)
|
||||
if (method->depths[j] == depths[i])
|
||||
{
|
||||
temp[0]++;
|
||||
temp[++count] = depths[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy (depths, temp, (count + 1) * sizeof (int));
|
||||
|
||||
return (count);
|
||||
}
|
||||
|
||||
|
||||
#define LbxCmapAllMethod "XC-CMAP"
|
||||
|
||||
static int
|
||||
LbxCmapAllOpt (pno, popt, optlen, preply)
|
||||
|
||||
LbxNegOptsPtr pno;
|
||||
unsigned char *popt;
|
||||
int optlen;
|
||||
unsigned char *preply;
|
||||
|
||||
{
|
||||
int numMethods = *popt++;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numMethods; i++)
|
||||
{
|
||||
int len;
|
||||
char *methodName;
|
||||
|
||||
len = *popt++;
|
||||
methodName = (char *) popt;
|
||||
popt += len;
|
||||
if (!strncmp(methodName, LbxCmapAllMethod, len))
|
||||
break;
|
||||
}
|
||||
if (i >= numMethods)
|
||||
i = 0; /* assume first one is proxy's favorite */
|
||||
*preply = i;
|
||||
return 1;
|
||||
}
|
||||
552
lbx/lbxprop.c
Normal file
552
lbx/lbxprop.c
Normal file
|
|
@ -0,0 +1,552 @@
|
|||
/* $Xorg: lbxprop.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1986, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
/*
|
||||
* Copyright 1993 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/* various bits of DIX-level mangling */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "servermd.h"
|
||||
#include "propertyst.h"
|
||||
#include "windowstr.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
#include "lbxserve.h"
|
||||
#include "lbxtags.h"
|
||||
#include "Xfuncproto.h"
|
||||
#ifdef XCSECURITY
|
||||
#define _SECURITY_SERVER
|
||||
#include "extensions/security.h"
|
||||
#endif
|
||||
|
||||
extern int (*ProcVector[256]) ();
|
||||
extern void (*ReplySwapVector[256]) ();
|
||||
extern void CopySwap16Write(), CopySwap32Write(), Swap32Write();
|
||||
|
||||
void
|
||||
LbxStallPropRequest(client, pProp)
|
||||
ClientPtr client;
|
||||
PropertyPtr pProp;
|
||||
{
|
||||
xReq *req = (xReq *) client->requestBuffer;
|
||||
register char n;
|
||||
|
||||
LbxQueryTagData(client, pProp->owner_pid,
|
||||
pProp->tag_id, LbxTagTypeProperty);
|
||||
|
||||
/*
|
||||
* Before we reset the request, we must make sure
|
||||
* it is in the client's byte order.
|
||||
*/
|
||||
|
||||
if (client->swapped) {
|
||||
if (req->reqType == X_ChangeProperty) {
|
||||
xChangePropertyReq *stuff = (xChangePropertyReq *) req;
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->property, n);
|
||||
swapl(&stuff->type, n);
|
||||
swapl(&stuff->nUnits, n);
|
||||
switch ( stuff->format ) {
|
||||
case 16:
|
||||
SwapRestS(stuff);
|
||||
break;
|
||||
case 32:
|
||||
SwapRestL(stuff);
|
||||
break;
|
||||
}
|
||||
} else if (req->reqType == X_GetProperty) {
|
||||
xGetPropertyReq *stuff = (xGetPropertyReq *) req;
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->property, n);
|
||||
swapl(&stuff->type, n);
|
||||
swapl(&stuff->longOffset, n);
|
||||
swapl(&stuff->longLength, n);
|
||||
} else if (req->data == X_LbxChangeProperty) {
|
||||
xLbxChangePropertyReq *stuff = (xLbxChangePropertyReq *) req;
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->property, n);
|
||||
swapl(&stuff->type, n);
|
||||
swapl(&stuff->nUnits, n);
|
||||
} else if (req->data == X_LbxGetProperty) {
|
||||
xLbxGetPropertyReq *stuff = (xLbxGetPropertyReq *) req;
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->property, n);
|
||||
swapl(&stuff->type, n);
|
||||
swapl(&stuff->longOffset, n);
|
||||
swapl(&stuff->longLength, n);
|
||||
}
|
||||
}
|
||||
ResetCurrentRequest(client);
|
||||
client->sequence--;
|
||||
IgnoreClient(client);
|
||||
}
|
||||
|
||||
int
|
||||
LbxChangeWindowProperty(client, pWin, property, type, format, mode, len,
|
||||
have_data, value, sendevent, tag)
|
||||
ClientPtr client;
|
||||
WindowPtr pWin;
|
||||
Atom property,
|
||||
type;
|
||||
int format,
|
||||
mode;
|
||||
unsigned long len;
|
||||
Bool have_data;
|
||||
pointer value;
|
||||
Bool sendevent;
|
||||
XID *tag;
|
||||
{
|
||||
PropertyPtr pProp;
|
||||
xEvent event;
|
||||
int sizeInBytes;
|
||||
int totalSize;
|
||||
pointer data;
|
||||
|
||||
sizeInBytes = format >> 3;
|
||||
totalSize = len * sizeInBytes;
|
||||
|
||||
/* first see if property already exists */
|
||||
|
||||
pProp = wUserProps(pWin);
|
||||
while (pProp) {
|
||||
if (pProp->propertyName == property)
|
||||
break;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
if (!pProp) { /* just add to list */
|
||||
if (!pWin->optional && !MakeWindowOptional(pWin))
|
||||
return (BadAlloc);
|
||||
pProp = (PropertyPtr) xalloc(sizeof(PropertyRec));
|
||||
if (!pProp)
|
||||
return (BadAlloc);
|
||||
data = (pointer) xalloc(totalSize);
|
||||
if (!data && len) {
|
||||
xfree(pProp);
|
||||
return (BadAlloc);
|
||||
}
|
||||
pProp->propertyName = property;
|
||||
pProp->type = type;
|
||||
pProp->format = format;
|
||||
pProp->data = data;
|
||||
if (have_data) {
|
||||
if (len)
|
||||
memmove((char *) data, (char *) value, totalSize);
|
||||
pProp->tag_id = 0;
|
||||
pProp->owner_pid = 0;
|
||||
} else {
|
||||
if (!TagSaveTag(LbxTagTypeProperty, totalSize,
|
||||
(pointer)pProp, &pProp->tag_id)) {
|
||||
xfree(pProp);
|
||||
xfree(pProp->data);
|
||||
return BadAlloc;
|
||||
}
|
||||
pProp->owner_pid = LbxProxyID(client);
|
||||
TagMarkProxy(pProp->tag_id, pProp->owner_pid);
|
||||
}
|
||||
pProp->size = len;
|
||||
pProp->next = pWin->optional->userProps;
|
||||
pWin->optional->userProps = pProp;
|
||||
} else {
|
||||
/*
|
||||
* To append or prepend to a property the request format and type must
|
||||
* match those of the already defined property. The existing format
|
||||
* and type are irrelevant when using the mode "PropModeReplace" since
|
||||
* they will be written over.
|
||||
*/
|
||||
|
||||
if ((format != pProp->format) && (mode != PropModeReplace))
|
||||
return (BadMatch);
|
||||
if ((pProp->type != type) && (mode != PropModeReplace))
|
||||
return (BadMatch);
|
||||
|
||||
/*
|
||||
* if its a modify instead of replace, make sure we have the current
|
||||
* value
|
||||
*/
|
||||
if ((mode != PropModeReplace) && pProp->tag_id && pProp->owner_pid) {
|
||||
LbxStallPropRequest(client, pProp);
|
||||
return (client->noClientException);
|
||||
}
|
||||
/* make sure any old tag is flushed first */
|
||||
if (pProp->tag_id)
|
||||
TagDeleteTag(pProp->tag_id);
|
||||
if (mode == PropModeReplace) {
|
||||
if (totalSize != pProp->size * (pProp->format >> 3)) {
|
||||
data = (pointer) xrealloc(pProp->data, totalSize);
|
||||
if (!data && len)
|
||||
return (BadAlloc);
|
||||
pProp->data = data;
|
||||
}
|
||||
if (have_data) {
|
||||
if (len)
|
||||
memmove((char *) pProp->data, (char *) value, totalSize);
|
||||
} else {
|
||||
if (!TagSaveTag(LbxTagTypeProperty, totalSize,
|
||||
(pointer)pProp, &pProp->tag_id)) {
|
||||
xfree(pProp);
|
||||
xfree(pProp->data);
|
||||
return BadAlloc;
|
||||
}
|
||||
pProp->owner_pid = LbxProxyID(client);
|
||||
TagMarkProxy(pProp->tag_id, pProp->owner_pid);
|
||||
}
|
||||
pProp->size = len;
|
||||
pProp->type = type;
|
||||
pProp->format = format;
|
||||
} else if (len == 0) {
|
||||
/* do nothing */
|
||||
} else if (mode == PropModeAppend) {
|
||||
data = (pointer) xrealloc(pProp->data,
|
||||
sizeInBytes * (len + pProp->size));
|
||||
if (!data)
|
||||
return (BadAlloc);
|
||||
pProp->data = data;
|
||||
memmove(&((char *) data)[pProp->size * sizeInBytes],
|
||||
(char *) value,
|
||||
totalSize);
|
||||
pProp->size += len;
|
||||
} else if (mode == PropModePrepend) {
|
||||
data = (pointer) xalloc(sizeInBytes * (len + pProp->size));
|
||||
if (!data)
|
||||
return (BadAlloc);
|
||||
memmove(&((char *) data)[totalSize], (char *) pProp->data,
|
||||
(int) (pProp->size * sizeInBytes));
|
||||
memmove((char *) data, (char *) value, totalSize);
|
||||
xfree(pProp->data);
|
||||
pProp->data = data;
|
||||
pProp->size += len;
|
||||
}
|
||||
}
|
||||
if (sendevent) {
|
||||
event.u.u.type = PropertyNotify;
|
||||
event.u.property.window = pWin->drawable.id;
|
||||
event.u.property.state = PropertyNewValue;
|
||||
event.u.property.atom = pProp->propertyName;
|
||||
event.u.property.time = currentTime.milliseconds;
|
||||
DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
|
||||
}
|
||||
if (pProp->tag_id)
|
||||
*tag = pProp->tag_id;
|
||||
return (Success);
|
||||
}
|
||||
|
||||
int
|
||||
LbxChangeProperty(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
WindowPtr pWin;
|
||||
char format,
|
||||
mode;
|
||||
unsigned long len;
|
||||
int err;
|
||||
int n;
|
||||
XID newtag;
|
||||
xLbxChangePropertyReply rep;
|
||||
REQUEST(xLbxChangePropertyReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xLbxChangePropertyReq);
|
||||
UpdateCurrentTime();
|
||||
format = stuff->format;
|
||||
mode = stuff->mode;
|
||||
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
|
||||
(mode != PropModePrepend)) {
|
||||
client->errorValue = mode;
|
||||
return BadValue;
|
||||
}
|
||||
if ((format != 8) && (format != 16) && (format != 32)) {
|
||||
client->errorValue = format;
|
||||
return BadValue;
|
||||
}
|
||||
len = stuff->nUnits;
|
||||
if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2))
|
||||
return BadLength;
|
||||
|
||||
pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
|
||||
SecurityWriteAccess);
|
||||
if (!pWin)
|
||||
return (BadWindow);
|
||||
if (!ValidAtom(stuff->property)) {
|
||||
client->errorValue = stuff->property;
|
||||
return (BadAtom);
|
||||
}
|
||||
if (!ValidAtom(stuff->type)) {
|
||||
client->errorValue = stuff->type;
|
||||
return (BadAtom);
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = 0;
|
||||
rep.pad = rep.pad0 = rep.pad1 = rep.pad2 = rep.pad3 = rep.pad4 = 0;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
}
|
||||
|
||||
#ifdef XCSECURITY
|
||||
switch (SecurityCheckPropertyAccess(client, pWin, stuff->property,
|
||||
SecurityWriteAccess))
|
||||
{
|
||||
case SecurityErrorOperation:
|
||||
client->errorValue = stuff->property;
|
||||
return BadAtom;
|
||||
case SecurityIgnoreOperation:
|
||||
rep.tag = 0;
|
||||
WriteToClient(client, sizeof(xLbxChangePropertyReply), (char *)&rep);
|
||||
return client->noClientException;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = LbxChangeWindowProperty(client, pWin, stuff->property, stuff->type,
|
||||
(int) format, (int) mode, len, FALSE, (pointer) &stuff[1],
|
||||
TRUE, &newtag);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
rep.tag = newtag;
|
||||
|
||||
if (client->swapped) {
|
||||
swapl(&rep.tag, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xLbxChangePropertyReply), (char *)&rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static void
|
||||
LbxWriteGetpropReply(client, rep)
|
||||
ClientPtr client;
|
||||
xLbxGetPropertyReply *rep;
|
||||
{
|
||||
int n;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep->sequenceNumber, n);
|
||||
swapl(&rep->length, n);
|
||||
swapl(&rep->propertyType, n);
|
||||
swapl(&rep->bytesAfter, n);
|
||||
swapl(&rep->nItems, n);
|
||||
swapl(&rep->tag, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xLbxGetPropertyReply), (char *)rep);
|
||||
}
|
||||
|
||||
int
|
||||
LbxGetProperty(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
PropertyPtr pProp,
|
||||
prevProp;
|
||||
unsigned long n,
|
||||
len,
|
||||
ind;
|
||||
WindowPtr pWin;
|
||||
xLbxGetPropertyReply reply;
|
||||
Bool send_data = FALSE;
|
||||
|
||||
REQUEST(xLbxGetPropertyReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xLbxGetPropertyReq);
|
||||
|
||||
reply.pad1 = 0;
|
||||
reply.pad2 = 0;
|
||||
|
||||
if (stuff->delete)
|
||||
UpdateCurrentTime();
|
||||
pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
|
||||
SecurityReadAccess);
|
||||
if (!pWin)
|
||||
return (BadWindow);
|
||||
|
||||
if (!ValidAtom(stuff->property)) {
|
||||
client->errorValue = stuff->property;
|
||||
return (BadAtom);
|
||||
}
|
||||
if ((stuff->delete != xTrue) && (stuff->delete != xFalse)) {
|
||||
client->errorValue = stuff->delete;
|
||||
return (BadValue);
|
||||
}
|
||||
if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
|
||||
{
|
||||
client->errorValue = stuff->type;
|
||||
return(BadAtom);
|
||||
}
|
||||
pProp = wUserProps(pWin);
|
||||
prevProp = (PropertyPtr) NULL;
|
||||
while (pProp) {
|
||||
if (pProp->propertyName == stuff->property)
|
||||
break;
|
||||
prevProp = pProp;
|
||||
pProp = pProp->next;
|
||||
}
|
||||
reply.type = X_Reply;
|
||||
reply.sequenceNumber = client->sequence;
|
||||
if (!pProp) {
|
||||
reply.nItems = 0;
|
||||
reply.length = 0;
|
||||
reply.bytesAfter = 0;
|
||||
reply.propertyType = None;
|
||||
reply.format = 0;
|
||||
reply.tag = 0;
|
||||
LbxWriteGetpropReply(client, &reply);
|
||||
return client->noClientException;
|
||||
}
|
||||
/*
|
||||
* If the request type and actual type don't match. Return the
|
||||
* property information, but not the data.
|
||||
*/
|
||||
if ((stuff->type != pProp->type) &&
|
||||
(stuff->type != AnyPropertyType)) {
|
||||
reply.bytesAfter = pProp->size;
|
||||
reply.format = pProp->format;
|
||||
reply.length = 0;
|
||||
reply.nItems = 0;
|
||||
reply.propertyType = pProp->type;
|
||||
reply.tag = 0;
|
||||
LbxWriteGetpropReply(client, &reply);
|
||||
return client->noClientException;
|
||||
}
|
||||
/*
|
||||
* Return type, format, value to client
|
||||
*/
|
||||
n = (pProp->format >> 3) * pProp->size; /* size (bytes) of prop */
|
||||
ind = stuff->longOffset << 2;
|
||||
|
||||
/*
|
||||
* If longOffset is invalid such that it causes "len" to be
|
||||
* negative, it's a value error.
|
||||
*/
|
||||
|
||||
if (n < ind) {
|
||||
client->errorValue = stuff->longOffset;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* make sure we have the current value */
|
||||
if (pProp->tag_id && pProp->owner_pid) {
|
||||
LbxStallPropRequest(client, pProp);
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
len = min(n - ind, stuff->longLength << 2);
|
||||
|
||||
reply.bytesAfter = n - (ind + len);
|
||||
reply.format = pProp->format;
|
||||
reply.propertyType = pProp->type;
|
||||
|
||||
if (!pProp->tag_id) {
|
||||
if (n && (!stuff->delete || reply.bytesAfter)) {
|
||||
TagSaveTag(LbxTagTypeProperty, n, (pointer)pProp, &pProp->tag_id);
|
||||
pProp->owner_pid = 0;
|
||||
}
|
||||
send_data = TRUE;
|
||||
} else
|
||||
send_data = !TagProxyMarked(pProp->tag_id, LbxProxyID(client));
|
||||
if (pProp->tag_id && send_data)
|
||||
TagMarkProxy(pProp->tag_id, LbxProxyID(client));
|
||||
reply.tag = pProp->tag_id;
|
||||
|
||||
if (!send_data)
|
||||
len = 0;
|
||||
else if (reply.tag) {
|
||||
len = n;
|
||||
ind = 0;
|
||||
}
|
||||
reply.nItems = len / (pProp->format >> 3);
|
||||
reply.length = (len + 3) >> 2;
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
xEvent event;
|
||||
|
||||
event.u.u.type = PropertyNotify;
|
||||
event.u.property.window = pWin->drawable.id;
|
||||
event.u.property.state = PropertyDelete;
|
||||
event.u.property.atom = pProp->propertyName;
|
||||
event.u.property.time = currentTime.milliseconds;
|
||||
DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
|
||||
}
|
||||
LbxWriteGetpropReply(client, &reply);
|
||||
if (len) {
|
||||
switch (reply.format) {
|
||||
case 32:
|
||||
client->pSwapReplyFunc = CopySwap32Write;
|
||||
break;
|
||||
case 16:
|
||||
client->pSwapReplyFunc = CopySwap16Write;
|
||||
break;
|
||||
default:
|
||||
client->pSwapReplyFunc = (void (*) ()) WriteToClient;
|
||||
break;
|
||||
}
|
||||
WriteSwappedDataToClient(client, len,
|
||||
(char *) pProp->data + ind);
|
||||
}
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
if (pProp->tag_id)
|
||||
TagDeleteTag(pProp->tag_id);
|
||||
if (prevProp == (PropertyPtr) NULL) {
|
||||
if (!(pWin->optional->userProps = pProp->next))
|
||||
CheckWindowOptionalNeed(pWin);
|
||||
} else
|
||||
prevProp->next = pProp->next;
|
||||
xfree(pProp->data);
|
||||
xfree(pProp);
|
||||
}
|
||||
return client->noClientException;
|
||||
}
|
||||
173
lbx/lbxserve.h
Normal file
173
lbx/lbxserve.h
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
/* $Xorg: lbxserve.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1996, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
/*
|
||||
* Copyright 1992 Network Computing Devices
|
||||
*
|
||||
* 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 of NCD. not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. NCD. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LBXSERVE_H_
|
||||
#define _LBXSERVE_H_
|
||||
#include "lbxdeltastr.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
#include "lbxopts.h"
|
||||
|
||||
#define MAX_LBX_CLIENTS MAXCLIENTS
|
||||
#define MAX_NUM_PROXIES (MAXCLIENTS >> 1)
|
||||
|
||||
typedef struct _LbxClient *LbxClientPtr;
|
||||
typedef struct _LbxProxy *LbxProxyPtr;
|
||||
|
||||
typedef struct _LbxClient {
|
||||
CARD32 id;
|
||||
ClientPtr client;
|
||||
LbxProxyPtr proxy;
|
||||
Bool ignored;
|
||||
Bool input_blocked;
|
||||
int reqs_pending;
|
||||
long bytes_in_reply;
|
||||
long bytes_remaining;
|
||||
Drawable drawableCache[GFX_CACHE_SIZE];
|
||||
GContext gcontextCache[GFX_CACHE_SIZE];
|
||||
pointer gfx_buffer; /* tmp buffer for unpacking gfx requests */
|
||||
unsigned long gb_size;
|
||||
} LbxClientRec;
|
||||
|
||||
typedef struct _connectionOutput *OSBufPtr;
|
||||
|
||||
typedef struct _LbxProxy {
|
||||
LbxProxyPtr next;
|
||||
/* this array is indexed by lbx proxy index */
|
||||
LbxClientPtr lbxClients[MAX_LBX_CLIENTS];
|
||||
LbxClientPtr curRecv,
|
||||
curDix;
|
||||
int fd;
|
||||
int pid; /* proxy ID */
|
||||
int uid;
|
||||
int numClients;
|
||||
int maxIndex;
|
||||
Bool aborted;
|
||||
int grabClient;
|
||||
pointer compHandle;
|
||||
Bool dosquishing;
|
||||
Bool useTags;
|
||||
LBXDeltasRec indeltas;
|
||||
LBXDeltasRec outdeltas;
|
||||
char *iDeltaBuf;
|
||||
char *replyBuf;
|
||||
char *oDeltaBuf;
|
||||
OSBufPtr ofirst;
|
||||
OSBufPtr olast;
|
||||
CARD32 cur_send_id;
|
||||
|
||||
LbxStreamOpts streamOpts;
|
||||
|
||||
int numBitmapCompMethods;
|
||||
char *bitmapCompMethods; /* array of indices */
|
||||
int numPixmapCompMethods;
|
||||
char *pixmapCompMethods; /* array of indices */
|
||||
int **pixmapCompDepths; /* depths supported from each method */
|
||||
|
||||
struct _ColormapRec *grabbedCmaps; /* chained via lbx private */
|
||||
int motion_allowed_events;
|
||||
lbxMotionCache motionCache;
|
||||
} LbxProxyRec;
|
||||
|
||||
/* This array is indexed by server client index, not lbx proxy index */
|
||||
|
||||
extern LbxClientPtr lbxClients[MAXCLIENTS];
|
||||
|
||||
#define LbxClient(client) (lbxClients[(client)->index])
|
||||
#define LbxProxy(client) (LbxClient(client)->proxy)
|
||||
#define LbxMaybeProxy(client) (LbxClient(client) ? LbxProxy(client) : 0)
|
||||
#define LbxProxyID(client) (LbxProxy(client)->pid)
|
||||
#define LbxProxyClient(proxy) ((proxy)->lbxClients[0]->client)
|
||||
|
||||
extern int LbxEventCode;
|
||||
|
||||
extern void LbxDixInit(
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern LbxProxyPtr LbxPidToProxy(
|
||||
#if NeedFunctionPrototypes
|
||||
int /* pid */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void LbxReencodeOutput(
|
||||
#if NeedFunctionPrototypes
|
||||
ClientPtr /*client*/,
|
||||
char* /*pbuf*/,
|
||||
int* /*pcount*/,
|
||||
char* /*cbuf*/,
|
||||
int* /*ccount*/
|
||||
#endif
|
||||
);
|
||||
|
||||
extern int UncompressedWriteToClient(
|
||||
#if NeedFunctionPrototypes
|
||||
ClientPtr /*who*/,
|
||||
int /*count*/,
|
||||
char* /*buf*/
|
||||
#endif
|
||||
);
|
||||
|
||||
extern ClientPtr AllocLbxClientConnection(
|
||||
#if NeedFunctionPrototypes
|
||||
ClientPtr /* client */,
|
||||
LbxProxyPtr /* proxy */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void LbxProxyConnection(
|
||||
#if NeedFunctionPrototypes
|
||||
ClientPtr /* client */,
|
||||
LbxProxyPtr /* proxy */
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif /* _LBXSERVE_H_ */
|
||||
152
lbx/lbxsquish.c
Normal file
152
lbx/lbxsquish.c
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/* $Xorg: lbxsquish.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1996, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
/*
|
||||
* Copyright 1994 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "Xos.h"
|
||||
#include "misc.h"
|
||||
#include "lbxserve.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
|
||||
/* handles server-side protocol squishing */
|
||||
|
||||
static char lbxevdelta[] = {
|
||||
0,
|
||||
0,
|
||||
sz_xEvent - lbxsz_KeyButtonEvent,
|
||||
sz_xEvent - lbxsz_KeyButtonEvent,
|
||||
sz_xEvent - lbxsz_KeyButtonEvent,
|
||||
sz_xEvent - lbxsz_KeyButtonEvent,
|
||||
sz_xEvent - lbxsz_KeyButtonEvent,
|
||||
sz_xEvent - lbxsz_EnterLeaveEvent,
|
||||
sz_xEvent - lbxsz_EnterLeaveEvent,
|
||||
sz_xEvent - lbxsz_FocusEvent,
|
||||
sz_xEvent - lbxsz_FocusEvent,
|
||||
sz_xEvent - lbxsz_KeymapEvent,
|
||||
sz_xEvent - lbxsz_ExposeEvent,
|
||||
sz_xEvent - lbxsz_GfxExposeEvent,
|
||||
sz_xEvent - lbxsz_NoExposeEvent,
|
||||
sz_xEvent - lbxsz_VisibilityEvent,
|
||||
sz_xEvent - lbxsz_CreateNotifyEvent,
|
||||
sz_xEvent - lbxsz_DestroyNotifyEvent,
|
||||
sz_xEvent - lbxsz_UnmapNotifyEvent,
|
||||
sz_xEvent - lbxsz_MapNotifyEvent,
|
||||
sz_xEvent - lbxsz_MapRequestEvent,
|
||||
sz_xEvent - lbxsz_ReparentEvent,
|
||||
sz_xEvent - lbxsz_ConfigureNotifyEvent,
|
||||
sz_xEvent - lbxsz_ConfigureRequestEvent,
|
||||
sz_xEvent - lbxsz_GravityEvent,
|
||||
sz_xEvent - lbxsz_ResizeRequestEvent,
|
||||
sz_xEvent - lbxsz_CirculateEvent,
|
||||
sz_xEvent - lbxsz_CirculateEvent,
|
||||
sz_xEvent - lbxsz_PropertyEvent,
|
||||
sz_xEvent - lbxsz_SelectionClearEvent,
|
||||
sz_xEvent - lbxsz_SelectionRequestEvent,
|
||||
sz_xEvent - lbxsz_SelectionNotifyEvent,
|
||||
sz_xEvent - lbxsz_ColormapEvent,
|
||||
sz_xEvent - lbxsz_ClientMessageEvent,
|
||||
sz_xEvent - lbxsz_MappingNotifyEvent
|
||||
};
|
||||
|
||||
static char lbxevpad[] = {
|
||||
0,
|
||||
0,
|
||||
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
|
||||
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
|
||||
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
|
||||
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
|
||||
lbxsz_KeyButtonEvent - lbxupsz_KeyButtonEvent,
|
||||
lbxsz_EnterLeaveEvent - lbxupsz_EnterLeaveEvent,
|
||||
lbxsz_EnterLeaveEvent - lbxupsz_EnterLeaveEvent,
|
||||
lbxsz_FocusEvent - lbxupsz_FocusEvent,
|
||||
lbxsz_FocusEvent - lbxupsz_FocusEvent,
|
||||
lbxsz_KeymapEvent - lbxupsz_KeymapEvent,
|
||||
lbxsz_ExposeEvent - lbxupsz_ExposeEvent,
|
||||
lbxsz_GfxExposeEvent - lbxupsz_GfxExposeEvent,
|
||||
lbxsz_NoExposeEvent - lbxupsz_NoExposeEvent,
|
||||
lbxsz_VisibilityEvent - lbxupsz_VisibilityEvent,
|
||||
lbxsz_CreateNotifyEvent - lbxupsz_CreateNotifyEvent,
|
||||
lbxsz_DestroyNotifyEvent - lbxupsz_DestroyNotifyEvent,
|
||||
lbxsz_UnmapNotifyEvent - lbxupsz_UnmapNotifyEvent,
|
||||
lbxsz_MapNotifyEvent - lbxupsz_MapNotifyEvent,
|
||||
lbxsz_MapRequestEvent - lbxupsz_MapRequestEvent,
|
||||
lbxsz_ReparentEvent - lbxupsz_ReparentEvent,
|
||||
lbxsz_ConfigureNotifyEvent - lbxupsz_ConfigureNotifyEvent,
|
||||
lbxsz_ConfigureRequestEvent - lbxupsz_ConfigureRequestEvent,
|
||||
lbxsz_GravityEvent - lbxupsz_GravityEvent,
|
||||
lbxsz_ResizeRequestEvent - lbxupsz_ResizeRequestEvent,
|
||||
lbxsz_CirculateEvent - lbxupsz_CirculateEvent,
|
||||
lbxsz_CirculateEvent - lbxupsz_CirculateEvent,
|
||||
lbxsz_PropertyEvent - lbxupsz_PropertyEvent,
|
||||
lbxsz_SelectionClearEvent - lbxupsz_SelectionClearEvent,
|
||||
lbxsz_SelectionRequestEvent - lbxupsz_SelectionRequestEvent,
|
||||
lbxsz_SelectionNotifyEvent - lbxupsz_SelectionNotifyEvent,
|
||||
lbxsz_ColormapEvent - lbxupsz_ColormapEvent,
|
||||
lbxsz_ClientMessageEvent - lbxupsz_ClientMessageEvent,
|
||||
lbxsz_MappingNotifyEvent - lbxupsz_MappingNotifyEvent
|
||||
};
|
||||
|
||||
int
|
||||
LbxSquishEvent(buf)
|
||||
char *buf;
|
||||
{
|
||||
int delta = lbxevdelta[((xEvent *)buf)->u.u.type];
|
||||
int pad = lbxevpad[((xEvent *)buf)->u.u.type];
|
||||
|
||||
if (delta)
|
||||
memmove(buf + delta, buf, sz_xEvent - delta);
|
||||
if (pad) {
|
||||
buf += sz_xEvent;
|
||||
while (--pad >= 0)
|
||||
*--buf = 0;
|
||||
}
|
||||
return delta;
|
||||
}
|
||||
78
lbx/lbxsrvopts.h
Normal file
78
lbx/lbxsrvopts.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/* $Xorg: lbxsrvopts.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */
|
||||
/*
|
||||
* Copyright 1994 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LBX_SRVOPTS_H_
|
||||
#define _LBX_SRVOPTS_H_
|
||||
|
||||
#include "lbxopts.h"
|
||||
|
||||
typedef struct _LbxNegOpts {
|
||||
int nopts;
|
||||
short proxyDeltaN;
|
||||
short proxyDeltaMaxLen;
|
||||
short serverDeltaN;
|
||||
short serverDeltaMaxLen;
|
||||
LbxStreamOpts streamOpts;
|
||||
int numBitmapCompMethods;
|
||||
char *bitmapCompMethods; /* array of indices */
|
||||
int numPixmapCompMethods;
|
||||
char *pixmapCompMethods; /* array of indices */
|
||||
int **pixmapCompDepths; /* depths supported from each method */
|
||||
Bool squish;
|
||||
Bool useTags;
|
||||
} LbxNegOptsRec;
|
||||
|
||||
typedef LbxNegOptsRec *LbxNegOptsPtr;
|
||||
|
||||
|
||||
extern LbxBitmapCompMethod *LbxSrvrLookupBitmapCompMethod (
|
||||
#if NeedFunctionPrototypes
|
||||
LbxProxyPtr, /* proxy */
|
||||
int /* methodOpCode */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern LbxPixmapCompMethod *LbxSrvrLookupPixmapCompMethod (
|
||||
#if NeedFunctionPrototypes
|
||||
LbxProxyPtr, /* proxy */
|
||||
int /* methodOpCode */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern LbxBitmapCompMethod *LbxSrvrFindPreferredBitmapCompMethod (
|
||||
#if NeedFunctionPrototypes
|
||||
LbxProxyPtr /* proxy */
|
||||
#endif
|
||||
);
|
||||
|
||||
extern LbxPixmapCompMethod *LbxSrvrFindPreferredPixmapCompMethod (
|
||||
#if NeedFunctionPrototypes
|
||||
LbxProxyPtr, /* proxy */
|
||||
int, /* format */
|
||||
int /* depth */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
#endif /* _LBX_SRVOPTS_H_ */
|
||||
858
lbx/lbxswap.c
Normal file
858
lbx/lbxswap.c
Normal file
|
|
@ -0,0 +1,858 @@
|
|||
/* $Xorg: lbxswap.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1996, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
/*
|
||||
* Copyright 1992 Network Computing Devices
|
||||
*
|
||||
* 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 of NCD. not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. NCD. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
#include "Xos.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "servermd.h"
|
||||
#define _XLBX_SERVER_
|
||||
#include "lbxstr.h"
|
||||
#include "lbxserve.h"
|
||||
#include "Xfuncproto.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static int
|
||||
SProcLbxQueryVersion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcLbxQueryVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxStartProxy(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxStartProxyReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcLbxStartProxy(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxStopProxy(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxStopProxyReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcLbxStopProxy(client);
|
||||
}
|
||||
|
||||
int
|
||||
SProcLbxSwitch(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxSwitchReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->client, n);
|
||||
return ProcLbxSwitch(client);
|
||||
}
|
||||
|
||||
int
|
||||
SProcLbxBeginLargeRequest (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxBeginLargeRequestReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->largeReqLength, n);
|
||||
return ProcLbxBeginLargeRequest(client);
|
||||
}
|
||||
|
||||
int
|
||||
SProcLbxLargeRequestData (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxLargeRequestDataReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcLbxLargeRequestData(client);
|
||||
}
|
||||
|
||||
int
|
||||
SProcLbxEndLargeRequest (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxEndLargeRequestReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcLbxEndLargeRequest(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxNewClient(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxNewClientReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->client, n);
|
||||
return ProcLbxNewClient(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxCloseClient(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxCloseClientReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->client, n);
|
||||
return ProcLbxCloseClient(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxModifySequence(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxModifySequenceReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->adjust, n);
|
||||
return ProcLbxModifySequence(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxAllowMotion(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxAllowMotionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->num, n);
|
||||
return ProcLbxAllowMotion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxIncrementPixel(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxIncrementPixelReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->cmap, n);
|
||||
swapl(&stuff->pixel, n);
|
||||
return ProcLbxIncrementPixel(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxGrabCmap(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxGrabCmapReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->cmap, n);
|
||||
|
||||
return ProcLbxGrabCmap(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxReleaseCmap(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxReleaseCmapReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->cmap, n);
|
||||
|
||||
return ProcLbxReleaseCmap(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxAllocColor(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxAllocColorReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->cmap, n);
|
||||
swapl(&stuff->pixel, n);
|
||||
swaps(&stuff->red, n);
|
||||
swaps(&stuff->green, n);
|
||||
swaps(&stuff->blue, n);
|
||||
|
||||
return ProcLbxAllocColor(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxGetModifierMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxGetModifierMappingReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcLbxGetModifierMapping(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxGetKeyboardMapping(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxGetKeyboardMappingReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
return ProcLbxGetKeyboardMapping(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxQueryFont(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxQueryFontReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->fid, n);
|
||||
return ProcLbxQueryFont(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxChangeProperty(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxChangePropertyReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
REQUEST_AT_LEAST_SIZE(xLbxChangePropertyReq);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->property, n);
|
||||
swapl(&stuff->type, n);
|
||||
swapl(&stuff->nUnits, n);
|
||||
switch (stuff->format) {
|
||||
case 8:
|
||||
break;
|
||||
case 16:
|
||||
SwapRestS(stuff);
|
||||
break;
|
||||
case 32:
|
||||
SwapRestL(stuff);
|
||||
break;
|
||||
}
|
||||
return ProcLbxChangeProperty(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxGetProperty(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxGetPropertyReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->window, n);
|
||||
swapl(&stuff->property, n);
|
||||
swapl(&stuff->type, n);
|
||||
swapl(&stuff->longOffset, n);
|
||||
swapl(&stuff->longLength, n);
|
||||
return ProcLbxGetProperty(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxTagData(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxTagDataReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->tag, n);
|
||||
swapl(&stuff->real_length, n);
|
||||
return ProcLbxTagData(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxInvalidateTag(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxInvalidateTagReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->tag, n);
|
||||
return ProcLbxInvalidateTag(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxPoly(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxPolyPointReq);
|
||||
char *after;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
after = ((char *) stuff) + SIZEOF(xLbxPolyPointReq);
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
swapl (((GContext *) after), n);
|
||||
return ProcLbxDispatch(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxFillPoly(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxFillPolyReq);
|
||||
char *after;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
after = ((char *) stuff) + SIZEOF(xLbxFillPolyReq);
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
swapl (((GContext *) after), n);
|
||||
return ProcLbxFillPoly(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxCopyArea (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxCopyAreaReq);
|
||||
char *after;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
after = ((char *) stuff) + SIZEOF(xLbxCopyAreaReq);
|
||||
if (GFXdCacheEnt (stuff->srcCache) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
swapl (((GContext *) after), n);
|
||||
return ProcLbxCopyArea(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxCopyPlane (client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxCopyPlaneReq);
|
||||
char *after;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->bitPlane, n);
|
||||
after = ((char *) stuff) + SIZEOF(xLbxCopyPlaneReq);
|
||||
if (GFXdCacheEnt (stuff->srcCache) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
swapl (((GContext *) after), n);
|
||||
return ProcLbxCopyPlane(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxPolyText(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxPolyTextReq);
|
||||
char *after;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
after = ((char *) stuff) + SIZEOF(xLbxPolyTextReq);
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
swapl (((GContext *) after), n);
|
||||
return ProcLbxDispatch(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxImageText(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxImageTextReq);
|
||||
char *after;
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
after = ((char *) stuff) + SIZEOF(xLbxImageTextReq);
|
||||
if (GFXdCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
{
|
||||
swapl (((Drawable *) after), n);
|
||||
after += sizeof (Drawable);
|
||||
}
|
||||
if (GFXgCacheEnt (stuff->cacheEnts) == GFXCacheNone)
|
||||
swapl (((GContext *) after), n);
|
||||
return ProcLbxDispatch(client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SProcLbxPutImage(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxPutImageReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
return ProcLbxPutImage(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxGetImage(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xLbxGetImageReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
swapl (&stuff->drawable, n);
|
||||
swaps (&stuff->x, n);
|
||||
swaps (&stuff->y, n);
|
||||
swaps (&stuff->width, n);
|
||||
swaps (&stuff->height, n);
|
||||
swapl (&stuff->planeMask, n);
|
||||
return ProcLbxGetImage(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcLbxInternAtoms(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
register int n;
|
||||
char *ptr;
|
||||
char lenbuf[2];
|
||||
CARD16 len;
|
||||
int i;
|
||||
|
||||
REQUEST(xLbxInternAtomsReq);
|
||||
|
||||
swaps (&stuff->length, n);
|
||||
swaps (&stuff->num, n);
|
||||
|
||||
ptr = (char *) stuff + sz_xLbxInternAtomsReq;
|
||||
for (i = 0; i < stuff->num; i++)
|
||||
{
|
||||
swaps (ptr, n);
|
||||
lenbuf[0] = ptr[0];
|
||||
lenbuf[1] = ptr[1];
|
||||
len = *((CARD16 *) lenbuf);
|
||||
ptr += (len + 2);
|
||||
}
|
||||
|
||||
return ProcLbxInternAtoms(client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SProcLbxGetWinAttrAndGeom(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST(xLbxGetWinAttrAndGeomReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->id, n);
|
||||
|
||||
return ProcLbxGetWinAttrAndGeom(client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
SProcLbxQueryExtension(client)
|
||||
ClientPtr client;
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST(xLbxQueryExtensionReq);
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
swapl(&stuff->nbytes, n);
|
||||
return ProcLbxQueryExtension(client);
|
||||
}
|
||||
|
||||
int
|
||||
SProcLbxDispatch(client)
|
||||
register ClientPtr client;
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
case X_LbxQueryVersion:
|
||||
return SProcLbxQueryVersion(client);
|
||||
case X_LbxStartProxy:
|
||||
return SProcLbxStartProxy(client);
|
||||
case X_LbxStopProxy:
|
||||
return SProcLbxStopProxy(client);
|
||||
case X_LbxNewClient:
|
||||
return SProcLbxNewClient(client);
|
||||
case X_LbxCloseClient:
|
||||
return SProcLbxCloseClient(client);
|
||||
case X_LbxModifySequence:
|
||||
return SProcLbxModifySequence(client);
|
||||
case X_LbxAllowMotion:
|
||||
return SProcLbxAllowMotion(client);
|
||||
case X_LbxIncrementPixel:
|
||||
return SProcLbxIncrementPixel(client);
|
||||
case X_LbxGrabCmap:
|
||||
return SProcLbxGrabCmap(client);
|
||||
case X_LbxReleaseCmap:
|
||||
return SProcLbxReleaseCmap(client);
|
||||
case X_LbxAllocColor:
|
||||
return SProcLbxAllocColor(client);
|
||||
case X_LbxGetModifierMapping:
|
||||
return SProcLbxGetModifierMapping(client);
|
||||
case X_LbxGetKeyboardMapping:
|
||||
return SProcLbxGetKeyboardMapping(client);
|
||||
case X_LbxInvalidateTag:
|
||||
return SProcLbxInvalidateTag(client);
|
||||
case X_LbxPolyPoint:
|
||||
case X_LbxPolyLine:
|
||||
case X_LbxPolySegment:
|
||||
case X_LbxPolyRectangle:
|
||||
case X_LbxPolyArc:
|
||||
case X_LbxPolyFillRectangle:
|
||||
case X_LbxPolyFillArc:
|
||||
return SProcLbxPoly(client);
|
||||
case X_LbxFillPoly:
|
||||
return SProcLbxFillPoly(client);
|
||||
case X_LbxQueryFont:
|
||||
return SProcLbxQueryFont(client);
|
||||
case X_LbxChangeProperty:
|
||||
return SProcLbxChangeProperty(client);
|
||||
case X_LbxGetProperty:
|
||||
return SProcLbxGetProperty(client);
|
||||
case X_LbxTagData:
|
||||
return SProcLbxTagData(client);
|
||||
case X_LbxCopyArea:
|
||||
return SProcLbxCopyArea(client);
|
||||
case X_LbxCopyPlane:
|
||||
return SProcLbxCopyPlane(client);
|
||||
case X_LbxPolyText8:
|
||||
case X_LbxPolyText16:
|
||||
return SProcLbxPolyText(client);
|
||||
case X_LbxImageText8:
|
||||
case X_LbxImageText16:
|
||||
return SProcLbxImageText (client);
|
||||
case X_LbxQueryExtension:
|
||||
return SProcLbxQueryExtension(client);
|
||||
case X_LbxPutImage:
|
||||
return SProcLbxPutImage(client);
|
||||
case X_LbxGetImage:
|
||||
return SProcLbxGetImage(client);
|
||||
case X_LbxInternAtoms:
|
||||
return SProcLbxInternAtoms(client);
|
||||
case X_LbxGetWinAttrAndGeom:
|
||||
return SProcLbxGetWinAttrAndGeom(client);
|
||||
case X_LbxSync:
|
||||
return ProcLbxSync(client); /* nothing to swap */
|
||||
case X_LbxBeginLargeRequest:
|
||||
return SProcLbxBeginLargeRequest(client);
|
||||
case X_LbxLargeRequestData:
|
||||
return SProcLbxLargeRequestData(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
void
|
||||
LbxWriteSConnectionInfo(pClient, size, pInfo)
|
||||
ClientPtr pClient;
|
||||
unsigned long size;
|
||||
char *pInfo;
|
||||
{
|
||||
int i, j, k;
|
||||
ScreenPtr pScreen;
|
||||
DepthPtr pDepth;
|
||||
char *pInfoT, *pInfoTBase;
|
||||
xConnSetup *pConnSetup = (xConnSetup *)pInfo;
|
||||
|
||||
pInfoT = pInfoTBase = (char *) ALLOCATE_LOCAL(size);
|
||||
if (!pInfoTBase)
|
||||
{
|
||||
pClient->noClientException = -1;
|
||||
return;
|
||||
}
|
||||
SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT);
|
||||
pInfo += sizeof(xConnSetup);
|
||||
pInfoT += sizeof(xConnSetup);
|
||||
|
||||
/* Copy the vendor string */
|
||||
i = (pConnSetup->nbytesVendor + 3) & ~3;
|
||||
memmove(pInfoT, pInfo, i);
|
||||
pInfo += i;
|
||||
pInfoT += i;
|
||||
|
||||
/* The Pixmap formats don't need to be swapped, just copied. */
|
||||
i = sizeof(xPixmapFormat) * screenInfo.numPixmapFormats;
|
||||
memmove(pInfoT, pInfo, i);
|
||||
pInfo += i;
|
||||
pInfoT += i;
|
||||
|
||||
for(i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
pScreen = screenInfo.screens[i];
|
||||
SwapWinRoot((xWindowRoot *)pInfo, (xWindowRoot *)pInfoT);
|
||||
pInfo += sizeof(xWindowRoot);
|
||||
pInfoT += sizeof(xWindowRoot);
|
||||
pDepth = pScreen->allowedDepths;
|
||||
for(j = 0; j < pScreen->numDepths; j++, pDepth++)
|
||||
{
|
||||
((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth;
|
||||
cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals);
|
||||
pInfo += sizeof(xDepth);
|
||||
pInfoT += sizeof(xDepth);
|
||||
for(k = 0; k < pDepth->numVids; k++)
|
||||
{
|
||||
SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT);
|
||||
pInfo += sizeof(xVisualType);
|
||||
pInfoT += sizeof(xVisualType);
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)WriteToClient(pClient, (int)size, (char *) pInfoTBase);
|
||||
DEALLOCATE_LOCAL(pInfoTBase);
|
||||
}
|
||||
|
||||
void
|
||||
SwapConnSetup(pConnSetup, pConnSetupT)
|
||||
xConnSetup *pConnSetup, *pConnSetupT;
|
||||
{
|
||||
cpswapl(pConnSetup->release, pConnSetupT->release);
|
||||
cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
|
||||
cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
|
||||
cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
|
||||
cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
|
||||
cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
|
||||
pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
|
||||
pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
|
||||
pConnSetupT->numRoots = pConnSetup->numRoots;
|
||||
pConnSetupT->numFormats = pConnSetup->numFormats;
|
||||
pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
|
||||
pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
|
||||
pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
|
||||
pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
|
||||
}
|
||||
|
||||
void
|
||||
SwapWinRoot(pRoot, pRootT)
|
||||
xWindowRoot *pRoot, *pRootT;
|
||||
{
|
||||
cpswapl(pRoot->windowId, pRootT->windowId);
|
||||
cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
|
||||
cpswapl(pRoot->whitePixel, pRootT->whitePixel);
|
||||
cpswapl(pRoot->blackPixel, pRootT->blackPixel);
|
||||
cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
|
||||
cpswaps(pRoot->pixWidth, pRootT->pixWidth);
|
||||
cpswaps(pRoot->pixHeight, pRootT->pixHeight);
|
||||
cpswaps(pRoot->mmWidth, pRootT->mmWidth);
|
||||
cpswaps(pRoot->mmHeight, pRootT->mmHeight);
|
||||
cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
|
||||
cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
|
||||
cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
|
||||
pRootT->backingStore = pRoot->backingStore;
|
||||
pRootT->saveUnders = pRoot->saveUnders;
|
||||
pRootT->rootDepth = pRoot->rootDepth;
|
||||
pRootT->nDepths = pRoot->nDepths;
|
||||
}
|
||||
|
||||
void
|
||||
SwapVisual(pVis, pVisT)
|
||||
xVisualType *pVis, *pVisT;
|
||||
{
|
||||
cpswapl(pVis->visualID, pVisT->visualID);
|
||||
pVisT->class = pVis->class;
|
||||
pVisT->bitsPerRGB = pVis->bitsPerRGB;
|
||||
cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
|
||||
cpswapl(pVis->redMask, pVisT->redMask);
|
||||
cpswapl(pVis->greenMask, pVisT->greenMask);
|
||||
cpswapl(pVis->blueMask, pVisT->blueMask);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
LbxWriteSConnSetupPrefix(pClient, pcsp)
|
||||
ClientPtr pClient;
|
||||
xLbxConnSetupPrefix *pcsp;
|
||||
{
|
||||
xLbxConnSetupPrefix cspT;
|
||||
|
||||
cspT.success = pcsp->success;
|
||||
cspT.changeType = pcsp->changeType;
|
||||
cspT.length = pcsp->length;
|
||||
cpswaps(pcsp->majorVersion, cspT.majorVersion);
|
||||
cpswaps(pcsp->minorVersion, cspT.minorVersion);
|
||||
cpswapl(pcsp->tag, cspT.tag);
|
||||
|
||||
(void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
|
||||
}
|
||||
|
||||
void
|
||||
LbxSwapFontInfo(pr, compressed)
|
||||
xLbxFontInfo *pr;
|
||||
Bool compressed;
|
||||
{
|
||||
unsigned i;
|
||||
xCharInfo *pxci;
|
||||
unsigned nchars,
|
||||
nprops;
|
||||
char *pby;
|
||||
register char n;
|
||||
|
||||
nchars = pr->nCharInfos;
|
||||
nprops = pr->nFontProps;
|
||||
swaps(&pr->minCharOrByte2, n);
|
||||
swaps(&pr->maxCharOrByte2, n);
|
||||
swaps(&pr->defaultChar, n);
|
||||
swaps(&pr->nFontProps, n);
|
||||
swaps(&pr->fontAscent, n);
|
||||
swaps(&pr->fontDescent, n);
|
||||
SwapCharInfo(&pr->minBounds);
|
||||
SwapCharInfo(&pr->maxBounds);
|
||||
swapl(&pr->nCharInfos, n);
|
||||
|
||||
pby = (char *) &pr[1];
|
||||
/*
|
||||
* Font properties are an atom and either an int32 or a CARD32, so they
|
||||
* are always 2 4 byte values
|
||||
*/
|
||||
for (i = 0; i < nprops; i++) {
|
||||
swapl(pby, n);
|
||||
pby += 4;
|
||||
swapl(pby, n);
|
||||
pby += 4;
|
||||
}
|
||||
if (!compressed) {
|
||||
pxci = (xCharInfo *) pby;
|
||||
for (i = 0; i < nchars; i++, pxci++)
|
||||
SwapCharInfo(pxci);
|
||||
} else {
|
||||
SwapLongs((CARD32 *) pby, nchars);
|
||||
}
|
||||
}
|
||||
33
lbx/lbxtables.c
Normal file
33
lbx/lbxtables.c
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/* $Xorg: lbxtables.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */
|
||||
/*
|
||||
* Copyright 1993 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
extern int ProcInitialConnection();
|
||||
extern int ProcLbxEstablishConnection();
|
||||
|
||||
int (* LbxInitialVector[3]) () =
|
||||
{
|
||||
0,
|
||||
ProcInitialConnection,
|
||||
ProcLbxEstablishConnection
|
||||
};
|
||||
238
lbx/lbxtags.c
Normal file
238
lbx/lbxtags.c
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
/* $Xorg: lbxtags.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1996, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
/*
|
||||
* Copyright 1993 Network Computing Devices, 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 != NULL) ? proxy->lbxClients[0] : NULL;
|
||||
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);
|
||||
}
|
||||
119
lbx/lbxtags.h
Normal file
119
lbx/lbxtags.h
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
/* $Xorg: lbxtags.h,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
|
||||
/*
|
||||
|
||||
Copyright 1996, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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
|
||||
OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
*/
|
||||
/*
|
||||
* Copyright 1993 Network Computing Devices, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LBXTAGS_H_
|
||||
#define _LBXTAGS_H_
|
||||
#include "lbxserve.h"
|
||||
|
||||
#include "os.h"
|
||||
#include "opaque.h"
|
||||
#include "resource.h"
|
||||
#include "X.h"
|
||||
#include "Xproto.h"
|
||||
|
||||
typedef struct _tagdata {
|
||||
XID tid;
|
||||
short data_type;
|
||||
unsigned char sent_to_proxy[(MAX_NUM_PROXIES + 7) / 8];
|
||||
int size;
|
||||
pointer tdata;
|
||||
XID *global;
|
||||
} TagDataRec;
|
||||
|
||||
typedef struct _tagdata *TagData;
|
||||
|
||||
extern TagData TagGetTag(
|
||||
#if NeedFunctionPrototypes
|
||||
XID /*tid*/
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XID TagNewTag(
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void TagClearProxy(
|
||||
#if NeedFunctionPrototypes
|
||||
XID /*tid*/,
|
||||
int /*pid*/
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void TagMarkProxy(
|
||||
#if NeedFunctionPrototypes
|
||||
XID /*tid*/,
|
||||
int /*pid*/
|
||||
#endif
|
||||
);
|
||||
|
||||
extern Bool TagProxyMarked(
|
||||
#if NeedFunctionPrototypes
|
||||
XID /*tid*/,
|
||||
int /*pid*/
|
||||
#endif
|
||||
);
|
||||
|
||||
extern void TagDeleteTag(
|
||||
#if NeedFunctionPrototypes
|
||||
XID /*tid*/
|
||||
#endif
|
||||
);
|
||||
|
||||
extern XID TagSaveTag(
|
||||
#if NeedFunctionPrototypes
|
||||
int /*dtype*/,
|
||||
int /*size*/,
|
||||
pointer /*data*/,
|
||||
XID* /*global*/
|
||||
#endif
|
||||
);
|
||||
|
||||
#endif /* _LBXTAGS_H_ */
|
||||
416
lbx/lbxzerorep.c
Normal file
416
lbx/lbxzerorep.c
Normal file
|
|
@ -0,0 +1,416 @@
|
|||
/* $Xorg: lbxzerorep.c,v 1.4 2001/02/09 02:05:17 xorgcvs Exp $ */
|
||||
|
||||
/*
|
||||
|
||||
Copyright 1996, 1998 The Open Group
|
||||
|
||||
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.
|
||||
|
||||
The above copyright notice and this permission notice 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 OPEN GROUP 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.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall
|
||||
not be used in advertising or otherwise to promote the sale, use or
|
||||
other dealings in this Software without prior written authorization
|
||||
from The Open Group.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* This module handles zeroing out unused pad bytes in core X replies.
|
||||
* This will hopefully improve both stream and delta compression,
|
||||
* since we are removing the random values in pad bytes.
|
||||
*/
|
||||
|
||||
#define NEED_REPLIES
|
||||
#include "X.h"
|
||||
#include <X11/Xproto.h>
|
||||
|
||||
|
||||
ZeroReplyPadBytes (buf, reqType)
|
||||
char *buf;
|
||||
int reqType;
|
||||
{
|
||||
switch (reqType) {
|
||||
case X_GetWindowAttributes:
|
||||
{
|
||||
xGetWindowAttributesReply *reply = (xGetWindowAttributesReply *) buf;
|
||||
reply->pad = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetGeometry:
|
||||
{
|
||||
xGetGeometryReply *reply = (xGetGeometryReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryTree:
|
||||
{
|
||||
xQueryTreeReply *reply = (xQueryTreeReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
break;
|
||||
}
|
||||
case X_InternAtom:
|
||||
{
|
||||
xInternAtomReply *reply = (xInternAtomReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetAtomName:
|
||||
{
|
||||
xGetAtomNameReply *reply = (xGetAtomNameReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetProperty:
|
||||
{
|
||||
xGetPropertyReply *reply = (xGetPropertyReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
break;
|
||||
}
|
||||
case X_ListProperties:
|
||||
{
|
||||
xListPropertiesReply *reply = (xListPropertiesReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetSelectionOwner:
|
||||
{
|
||||
xGetSelectionOwnerReply *reply = (xGetSelectionOwnerReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GrabKeyboard:
|
||||
case X_GrabPointer:
|
||||
{
|
||||
xGrabKeyboardReply *reply = (xGrabKeyboardReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryPointer:
|
||||
{
|
||||
xQueryPointerReply *reply = (xQueryPointerReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetMotionEvents:
|
||||
{
|
||||
xGetMotionEventsReply *reply = (xGetMotionEventsReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
break;
|
||||
}
|
||||
case X_TranslateCoords:
|
||||
{
|
||||
xTranslateCoordsReply *reply = (xTranslateCoordsReply *) buf;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetInputFocus:
|
||||
{
|
||||
xGetInputFocusReply *reply = (xGetInputFocusReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryKeymap:
|
||||
{
|
||||
xQueryKeymapReply *reply = (xQueryKeymapReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryFont:
|
||||
{
|
||||
xQueryFontReply *reply = (xQueryFontReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryTextExtents:
|
||||
{
|
||||
xQueryTextExtentsReply *reply = (xQueryTextExtentsReply *) buf;
|
||||
reply->pad = 0;
|
||||
break;
|
||||
}
|
||||
case X_ListFonts:
|
||||
{
|
||||
xListFontsReply *reply = (xListFontsReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetFontPath:
|
||||
{
|
||||
xGetFontPathReply *reply = (xGetFontPathReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetImage:
|
||||
{
|
||||
xGetImageReply *reply = (xGetImageReply *) buf;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_ListInstalledColormaps:
|
||||
{
|
||||
xListInstalledColormapsReply *reply =
|
||||
(xListInstalledColormapsReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_AllocColor:
|
||||
{
|
||||
xAllocColorReply *reply = (xAllocColorReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
break;
|
||||
}
|
||||
case X_AllocNamedColor:
|
||||
{
|
||||
xAllocNamedColorReply *reply = (xAllocNamedColorReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
break;
|
||||
}
|
||||
case X_AllocColorCells:
|
||||
{
|
||||
xAllocColorCellsReply *reply = (xAllocColorCellsReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_AllocColorPlanes:
|
||||
{
|
||||
xAllocColorPlanesReply *reply = (xAllocColorPlanesReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryColors:
|
||||
{
|
||||
xQueryColorsReply *reply = (xQueryColorsReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_LookupColor:
|
||||
{
|
||||
xLookupColorReply *reply = (xLookupColorReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryBestSize:
|
||||
{
|
||||
xQueryBestSizeReply *reply = (xQueryBestSizeReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_QueryExtension:
|
||||
{
|
||||
xQueryExtensionReply *reply = (xQueryExtensionReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_ListExtensions:
|
||||
{
|
||||
xListExtensionsReply *reply = (xListExtensionsReply *) buf;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_SetPointerMapping:
|
||||
case X_SetModifierMapping:
|
||||
{
|
||||
xSetMappingReply *reply = (xSetMappingReply *) buf;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetPointerMapping:
|
||||
{
|
||||
xGetPointerMappingReply *reply = (xGetPointerMappingReply *) buf;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetKeyboardMapping:
|
||||
{
|
||||
xGetKeyboardMappingReply *reply = (xGetKeyboardMappingReply *) buf;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetModifierMapping:
|
||||
{
|
||||
xGetModifierMappingReply *reply = (xGetModifierMappingReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetKeyboardControl:
|
||||
{
|
||||
xGetKeyboardControlReply *reply = (xGetKeyboardControlReply *) buf;
|
||||
reply->pad = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetPointerControl:
|
||||
{
|
||||
xGetPointerControlReply *reply = (xGetPointerControlReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
break;
|
||||
}
|
||||
case X_GetScreenSaver:
|
||||
{
|
||||
xGetScreenSaverReply *reply = (xGetScreenSaverReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad2 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
break;
|
||||
}
|
||||
case X_ListHosts:
|
||||
{
|
||||
xListHostsReply *reply = (xListHostsReply *) buf;
|
||||
reply->pad1 = 0;
|
||||
reply->pad3 = 0;
|
||||
reply->pad4 = 0;
|
||||
reply->pad5 = 0;
|
||||
reply->pad6 = 0;
|
||||
reply->pad7 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue