summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
Diffstat (limited to 'dix')
-rw-r--r--dix/atom.c7
-rw-r--r--dix/buildatoms7
-rw-r--r--dix/colormap.c41
-rw-r--r--dix/cursor.c70
-rw-r--r--dix/devices.c190
-rw-r--r--dix/dispatch.c496
-rw-r--r--dix/dixfonts.c351
-rw-r--r--dix/dixutils.c69
-rw-r--r--dix/events.c1174
-rw-r--r--dix/extension.c44
-rw-r--r--dix/gc.c54
-rw-r--r--dix/globals.c25
-rw-r--r--dix/grabs.c52
-rw-r--r--dix/initatoms.c5
-rw-r--r--dix/main.c295
-rw-r--r--dix/pixmap.c7
-rw-r--r--dix/privates.c101
-rw-r--r--dix/property.c26
-rw-r--r--dix/resource.c160
-rw-r--r--dix/swaprep.c60
-rw-r--r--dix/swapreq.c10
-rw-r--r--dix/tables.c402
-rw-r--r--dix/window.c339
-rw-r--r--dix/xpstubs.c2
24 files changed, 2914 insertions, 1073 deletions
diff --git a/dix/atom.c b/dix/atom.c
index d5c53d2e2..66c045583 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/atom.c,v 3.4 2002/02/19 11:09:21 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -51,6 +52,7 @@ SOFTWARE.
#include "Xatom.h"
#include "misc.h"
#include "resource.h"
+#include "dix.h"
#define InitialTableSize 100
@@ -66,6 +68,8 @@ static NodePtr atomRoot = (NodePtr)NULL;
static unsigned long tableLength;
static NodePtr *nodeTable;
+void FreeAtom(NodePtr patom);
+
Atom
MakeAtom(string, len, makeit)
char *string;
@@ -170,8 +174,7 @@ AtomError()
}
void
-FreeAtom(patom)
- NodePtr patom;
+FreeAtom(NodePtr patom)
{
if(patom->left)
FreeAtom(patom->left);
diff --git a/dix/buildatoms b/dix/buildatoms
index bedec5886..dfbbca8a9 100644
--- a/dix/buildatoms
+++ b/dix/buildatoms
@@ -1,5 +1,5 @@
#!/bin/sh
-hfile=../../X11/Xatom.h
+hfile=../../../include/Xatom.h
cfile=initatoms.c
rm -f $hfile $cfile
umask 222
@@ -21,8 +21,9 @@ BEGIN {
printf(" */\n\n") > cfile;
printf("#include \"X.h\"\n") > cfile;
printf("#include \"Xatom.h\"\n") > cfile;
- printf("extern Atom MakeAtom();\n") > cfile;
- printf("MakePredeclaredAtoms()\n") > cfile;
+ printf("#include \"misc.h\"\n") > cfile;
+ printf("#include \"dix.h\"\n") > cfile;
+ printf("void MakePredeclaredAtoms()\n") > cfile;
printf("{\n") > cfile;
}
diff --git a/dix/colormap.c b/dix/colormap.c
index 610ea01ca..b3d8d1347 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/colormap.c,v 3.10 2002/04/14 00:45:54 mvojkovi Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -57,8 +58,12 @@ SOFTWARE.
#include "scrnintstr.h"
#include "resource.h"
#include "windowstr.h"
+#ifdef LBX
+#include "lbxserve.h"
+#endif
extern XID clientErrorValue;
+extern int colormapPrivateCount;
static Pixel FindBestPixel(
#if NeedFunctionPrototypes
@@ -280,7 +285,6 @@ CreateColormap (mid, pScreen, pVisual, ppcmap, alloc, client)
register EntryPtr pent;
int i;
register Pixel *ppix, **pptr;
- extern int colormapPrivateCount;
class = pVisual->class;
if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID))
@@ -499,6 +503,7 @@ TellNoMap (pwin, pmid)
Colormap *pmid;
{
xEvent xE;
+
if (wColormap(pwin) == *pmid)
{
/* This should be call to DeliverEvent */
@@ -507,7 +512,10 @@ TellNoMap (pwin, pmid)
xE.u.colormap.colormap = None;
xE.u.colormap.new = TRUE;
xE.u.colormap.state = ColormapUninstalled;
- DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
+#ifdef PANORAMIX
+ if(noPanoramiXExtension || !pwin->drawable.pScreen->myNum)
+#endif
+ DeliverEvents(pwin, &xE, 1, (WindowPtr)NULL);
if (pwin->optional) {
pwin->optional->colormap = None;
CheckWindowOptionalNeed (pwin);
@@ -525,6 +533,11 @@ TellLostMap (pwin, value)
{
Colormap *pmid = (Colormap *)value;
xEvent xE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
+ return WT_STOPWALKING;
+#endif
if (wColormap(pwin) == *pmid)
{
/* This should be call to DeliverEvent */
@@ -547,6 +560,11 @@ TellGainedMap (pwin, value)
{
Colormap *pmid = (Colormap *)value;
xEvent xE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
+ return WT_STOPWALKING;
+#endif
if (wColormap (pwin) == *pmid)
{
/* This should be call to DeliverEvent */
@@ -625,6 +643,7 @@ CopyFree (channel, client, pmapSrc, pmapDst)
switch(channel)
{
+ default: /* so compiler can see that everything gets initialized */
case REDMAP:
ppix = (pmapSrc->clientPixelsRed)[client];
npix = (pmapSrc->numPixelsRed)[client];
@@ -715,6 +734,7 @@ FreeCell (pmap, i, channel)
switch (channel)
{
+ default: /* so compiler can see that everything gets initialized */
case PSEUDOMAP:
case REDMAP:
pent = (EntryPtr) &pmap->red[i];
@@ -1116,8 +1136,8 @@ typedef struct _bignum {
BigNumLower lower;
} BigNumRec, *BigNumPtr;
-#define BigNumGreater(x,y) ((x)->upper > (y)->upper ||\
- (x)->upper == (y)->upper && (x)->lower > (y)->lower)
+#define BigNumGreater(x,y) (((x)->upper > (y)->upper) ||\
+ ((x)->upper == (y)->upper && (x)->lower > (y)->lower))
#define UnsignedToBigNum(u,r) (((r)->upper = UPPERPART(u)), \
((r)->lower = LOWERPART(u)))
@@ -1126,8 +1146,12 @@ typedef struct _bignum {
((r)->lower = BIGNUMLOWER-1))
static void
+#if NeedFunctionPrototypes
+BigNumAdd (BigNumPtr x, BigNumPtr y, BigNumPtr r)
+#else
BigNumAdd (x, y, r)
BigNumPtr x, y, r;
+#endif
{
BigNumLower lower, carry = 0;
@@ -1248,9 +1272,9 @@ FindColor (pmap, pentFirst, size, prgb, pPixel, channel, client, comp)
{
EntryPtr pent;
Bool foundFree;
- Pixel pixel, Free;
- int npix, count, *nump;
- Pixel **pixp, *ppix;
+ Pixel pixel, Free = 0;
+ int npix, count, *nump = NULL;
+ Pixel **pixp = NULL, *ppix;
xColorItem def;
foundFree = FALSE;
@@ -1844,7 +1868,7 @@ AllocDirect (client, pmap, c, r, g, b, contig, pixels, prmask, pgmask, pbmask)
Pixel *ppix, *pDst, *p;
int npix, npixR, npixG, npixB;
Bool okR, okG, okB;
- Pixel *rpix, *gpix, *bpix;
+ Pixel *rpix = 0, *gpix = 0, *bpix = 0;
npixR = c << r;
npixG = c << g;
@@ -2426,6 +2450,7 @@ FreeCo (pmap, client, color, npixIn, ppixIn, mask)
ppixClient = pmap->clientPixelsBlue[client];
npixClient = pmap->numPixelsBlue[client];
break;
+ default: /* so compiler can see that everything gets initialized */
case PSEUDOMAP:
cmask = ~((Pixel)0);
rgbbad = 0;
diff --git a/dix/cursor.c b/dix/cursor.c
index fe0ceabe0..29a429f34 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/cursor.c,v 3.8 2003/01/12 02:44:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -68,13 +69,20 @@ typedef struct _GlyphShare {
static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL;
static void
+#if NeedFunctionPrototypes
+FreeCursorBits(CursorBitsPtr bits)
+#else
FreeCursorBits(bits)
CursorBitsPtr bits;
+#endif
{
if (--bits->refcnt > 0)
return;
xfree(bits->source);
xfree(bits->mask);
+#ifdef ARGB_CURSOR
+ xfree(bits->argb);
+#endif
if (bits->refcnt == 0)
{
register GlyphSharePtr *prev, this;
@@ -120,15 +128,41 @@ FreeCursor(value, cid)
return(Success);
}
+
+/*
+ * We check for empty cursors so that we won't have to display them
+ */
+static void
+CheckForEmptyMask(CursorBitsPtr bits)
+{
+ register unsigned char *msk = bits->mask;
+ int n = BitmapBytePad(bits->width) * bits->height;
+
+ bits->emptyMask = FALSE;
+ while(n--)
+ if(*(msk++) != 0) return;
+#ifdef ARGB_CURSOR
+ if (bits->argb)
+ {
+ CARD32 *argb = bits->argb;
+ int n = bits->width * bits->height;
+ while (n--)
+ if (*argb++ & 0xff000000) return;
+ }
+#endif
+ bits->emptyMask = TRUE;
+}
+
/*
* does nothing about the resource table, just creates the data structure.
* does not copy the src and mask bits
*/
CursorPtr
-AllocCursor(psrcbits, pmaskbits, cm,
+AllocCursorARGB(psrcbits, pmaskbits, argb, cm,
foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue)
unsigned char * psrcbits; /* server-defined padding */
unsigned char * pmaskbits; /* server-defined padding */
+ CARD32 * argb; /* no padding */
CursorMetricPtr cm;
unsigned foreRed, foreGreen, foreBlue;
unsigned backRed, backGreen, backBlue;
@@ -148,11 +182,15 @@ AllocCursor(psrcbits, pmaskbits, cm,
bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
bits->source = psrcbits;
bits->mask = pmaskbits;
+#ifdef ARGB_CURSOR
+ bits->argb = argb;
+#endif
bits->width = cm->width;
bits->height = cm->height;
bits->xhot = cm->xhot;
bits->yhot = cm->yhot;
bits->refcnt = -1;
+ CheckForEmptyMask(bits);
pCurs->bits = bits;
pCurs->refcnt = 1;
@@ -186,6 +224,20 @@ AllocCursor(psrcbits, pmaskbits, cm,
return pCurs;
}
+CursorPtr
+AllocCursor(psrcbits, pmaskbits, cm,
+ foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue)
+ unsigned char * psrcbits; /* server-defined padding */
+ unsigned char * pmaskbits; /* server-defined padding */
+ CursorMetricPtr cm;
+ unsigned foreRed, foreGreen, foreBlue;
+ unsigned backRed, backGreen, backBlue;
+{
+ return AllocCursorARGB (psrcbits, pmaskbits, (CARD32 *) 0, cm,
+ foreRed, foreGreen, foreBlue,
+ backRed, backGreen, backBlue);
+}
+
int
AllocGlyphCursor(source, sourceChar, mask, maskChar,
foreRed, foreGreen, foreBlue, backRed, backGreen, backBlue,
@@ -253,14 +305,14 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
if (!maskfont)
{
register long n;
- register unsigned char *bits;
+ register unsigned char *mskptr;
n = BitmapBytePad(cm.width)*(long)cm.height;
- bits = mskbits = (unsigned char *)xalloc(n);
- if (!bits)
+ mskptr = mskbits = (unsigned char *)xalloc(n);
+ if (!mskptr)
return BadAlloc;
while (--n >= 0)
- *bits++ = ~0;
+ *mskptr++ = ~0;
}
else
{
@@ -269,10 +321,10 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
client->errorValue = maskChar;
return BadValue;
}
- if (res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits))
+ if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0)
return res;
}
- if (res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))
+ if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0)
{
xfree(mskbits);
return res;
@@ -302,6 +354,9 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
}
bits->source = srcbits;
bits->mask = mskbits;
+#ifdef ARGB_CURSOR
+ bits->argb = 0;
+#endif
bits->width = cm.width;
bits->height = cm.height;
bits->xhot = cm.xhot;
@@ -326,6 +381,7 @@ AllocGlyphCursor(source, sourceChar, mask, maskChar,
sharedGlyphs = pShare;
}
}
+ CheckForEmptyMask(bits);
pCurs->bits = bits;
pCurs->refcnt = 1;
diff --git a/dix/devices.c b/dix/devices.c
index 3a9d56522..7028cd279 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/devices.c,v 3.20 2001/12/14 19:59:30 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -66,27 +67,28 @@ SOFTWARE.
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
#endif
-extern void CopySwap32Write(), SwapTimeCoordWrite();
-extern void ActivatePointerGrab(), DeactivatePointerGrab();
-extern void ActivateKeyboardGrab(), DeactivateKeyboardGrab();
-extern Mask EventMaskForClient();
-extern void EnqueueEvent();
+#include "dispatch.h"
+#include "swaprep.h"
+#include "dixevents.h"
-DevicePtr
-AddInputDevice(deviceProc, autoStart)
+DeviceIntPtr
+_AddInputDevice(deviceProc, autoStart)
DeviceProc deviceProc;
Bool autoStart;
{
register DeviceIntPtr dev;
if (inputInfo.numDevices >= MAX_DEVICES)
- return (DevicePtr)NULL;
+ return (DeviceIntPtr)NULL;
dev = (DeviceIntPtr) xalloc(sizeof(DeviceIntRec));
if (!dev)
- return (DevicePtr)NULL;
+ return (DeviceIntPtr)NULL;
dev->name = (char *)NULL;
dev->type = 0;
dev->id = inputInfo.numDevices;
@@ -121,7 +123,7 @@ AddInputDevice(deviceProc, autoStart)
dev->xkb_interest= NULL;
#endif
inputInfo.off_devices = dev;
- return &dev->public;
+ return dev;
}
Bool
@@ -179,20 +181,28 @@ InitAndStartDevices()
dev && (dev != inputInfo.keyboard);
dev = dev->next)
;
- if (!dev || (dev != inputInfo.keyboard))
+ if (!dev || (dev != inputInfo.keyboard)) {
+ ErrorF("No core keyboard\n");
return BadImplementation;
+ }
for (dev = inputInfo.devices;
dev && (dev != inputInfo.pointer);
dev = dev->next)
;
- if (!dev || (dev != inputInfo.pointer))
+ if (!dev || (dev != inputInfo.pointer)) {
+ ErrorF("No core pointer\n");
return BadImplementation;
+ }
return Success;
}
static void
+#if NeedFunctionPrototypes
+CloseDevice(register DeviceIntPtr dev)
+#else
CloseDevice(dev)
register DeviceIntPtr dev;
+#endif
{
KbdFeedbackPtr k, knext;
PtrFeedbackPtr p, pnext;
@@ -290,6 +300,10 @@ CloseDownDevices()
next = dev->next;
CloseDevice(dev);
}
+ inputInfo.devices = NULL;
+ inputInfo.off_devices = NULL;
+ inputInfo.keyboard = NULL;
+ inputInfo.pointer = NULL;
}
void
@@ -308,6 +322,10 @@ RemoveDevice(dev)
else
prev->next = next;
inputInfo.numDevices--;
+ if (inputInfo.keyboard == tmp)
+ inputInfo.keyboard = NULL;
+ else if (inputInfo.pointer == tmp)
+ inputInfo.pointer = NULL;
return;
}
}
@@ -322,6 +340,10 @@ RemoveDevice(dev)
else
prev->next = next;
inputInfo.numDevices--;
+ if (inputInfo.keyboard == tmp)
+ inputInfo.keyboard = NULL;
+ else if (inputInfo.pointer == tmp)
+ inputInfo.pointer = NULL;
return;
}
}
@@ -336,71 +358,69 @@ NumMotionEvents()
}
void
-RegisterPointerDevice(device)
- DevicePtr device;
+_RegisterPointerDevice(device)
+ DeviceIntPtr device;
{
- DeviceIntPtr dev = (DeviceIntPtr)device;
- inputInfo.pointer = dev;
+ inputInfo.pointer = device;
#ifdef XKB
if (noXkbExtension) {
- device->processInputProc = CoreProcessPointerEvent;
- device->realInputProc = CoreProcessPointerEvent;
+ device->public.processInputProc = CoreProcessPointerEvent;
+ device->public.realInputProc = CoreProcessPointerEvent;
} else {
- device->processInputProc = ProcessPointerEvent;
- device->realInputProc = ProcessPointerEvent;
+ device->public.processInputProc = ProcessPointerEvent;
+ device->public.realInputProc = ProcessPointerEvent;
}
#else
- device->processInputProc = ProcessPointerEvent;
- device->realInputProc = ProcessPointerEvent;
+ device->public.processInputProc = ProcessPointerEvent;
+ device->public.realInputProc = ProcessPointerEvent;
#endif
- dev->ActivateGrab = ActivatePointerGrab;
- dev->DeactivateGrab = DeactivatePointerGrab;
- if (!dev->name)
+ device->ActivateGrab = ActivatePointerGrab;
+ device->DeactivateGrab = DeactivatePointerGrab;
+ if (!device->name)
{
char *p = "pointer";
- dev->name = (char *)xalloc(strlen(p) + 1);
- strcpy(dev->name, p);
+ device->name = (char *)xalloc(strlen(p) + 1);
+ strcpy(device->name, p);
}
}
void
-RegisterKeyboardDevice(device)
- DevicePtr device;
+_RegisterKeyboardDevice(device)
+ DeviceIntPtr device;
{
- DeviceIntPtr dev = (DeviceIntPtr)device;
- inputInfo.keyboard = dev;
+ inputInfo.keyboard = device;
#ifdef XKB
if (noXkbExtension) {
- device->processInputProc = CoreProcessKeyboardEvent;
- device->realInputProc = CoreProcessKeyboardEvent;
+ device->public.processInputProc = CoreProcessKeyboardEvent;
+ device->public.realInputProc = CoreProcessKeyboardEvent;
} else {
- device->processInputProc = ProcessKeyboardEvent;
- device->realInputProc = ProcessKeyboardEvent;
+ device->public.processInputProc = ProcessKeyboardEvent;
+ device->public.realInputProc = ProcessKeyboardEvent;
}
#else
- device->processInputProc = ProcessKeyboardEvent;
- device->realInputProc = ProcessKeyboardEvent;
+ device->public.processInputProc = ProcessKeyboardEvent;
+ device->public.realInputProc = ProcessKeyboardEvent;
#endif
- dev->ActivateGrab = ActivateKeyboardGrab;
- dev->DeactivateGrab = DeactivateKeyboardGrab;
- if (!dev->name)
+ device->ActivateGrab = ActivateKeyboardGrab;
+ device->DeactivateGrab = DeactivateKeyboardGrab;
+ if (!device->name)
{
char *k = "keyboard";
- dev->name = (char *)xalloc(strlen(k) + 1);
- strcpy(dev->name, k);
+ device->name = (char *)xalloc(strlen(k) + 1);
+ strcpy(device->name, k);
}
}
DevicePtr
LookupKeyboardDevice()
{
- return &inputInfo.keyboard->public;
+ return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL;
}
DevicePtr
LookupPointerDevice()
{
- return &inputInfo.pointer->public;
+ return inputInfo.pointer ? &inputInfo.pointer->public : NULL;
}
DevicePtr
@@ -481,8 +501,12 @@ SetKeySymsMap(dst, src)
}
static Bool
+#if NeedFunctionPrototypes
+InitModMap(register KeyClassPtr keyc)
+#else
InitModMap(keyc)
register KeyClassPtr keyc;
+#endif
{
int i, j;
CARD8 keysPerModifier[8];
@@ -656,7 +680,7 @@ InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc)
#endif
feedc->ctrl = defaultKeyboardControl;
feedc->ctrl.id = 0;
- if (feedc->next = dev->kbdfeed)
+ if ((feedc->next = dev->kbdfeed) != 0)
feedc->ctrl.id = dev->kbdfeed->ctrl.id + 1;
dev->kbdfeed = feedc;
#ifdef XKB
@@ -1068,7 +1092,6 @@ ProcGetModifierMapping(client)
ClientPtr client;
{
xGetModifierMappingReply rep;
- REQUEST(xReq);
register KeyClassPtr keyc = inputInfo.keyboard->key;
REQUEST_SIZE_MATCH(xReq);
@@ -1201,7 +1224,7 @@ ProcGetKeyboardMapping(client)
/* length is a count of 4 byte quantities and KeySyms are 4 bytes */
rep.length = (curKeySyms->mapWidth * stuff->count);
WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
- client->pSwapReplyFunc = CopySwap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(
client,
curKeySyms->mapWidth * stuff->count * sizeof(KeySym),
@@ -1216,7 +1239,6 @@ ProcGetPointerMapping(client)
ClientPtr client;
{
xGetPointerMappingReply rep;
- REQUEST(xReq);
ButtonClassPtr butc = inputInfo.pointer->button;
REQUEST_SIZE_MATCH(xReq);
@@ -1264,7 +1286,7 @@ ProcChangeKeyboardControl (client)
int t;
int led = DO_ALL;
int key = DO_ALL;
- BITS32 vmask, index;
+ BITS32 vmask, index2;
int mask, i;
REQUEST(xChangeKeyboardControlReq);
@@ -1280,9 +1302,9 @@ ProcChangeKeyboardControl (client)
ctrl = keybd->kbdfeed->ctrl;
while (vmask)
{
- index = (BITS32) lowbit (vmask);
- vmask &= ~index;
- switch (index)
+ index2 = (BITS32) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
{
case KBKeyClickPercent:
t = (INT8)*vlist;
@@ -1369,9 +1391,9 @@ ProcChangeKeyboardControl (client)
if (!noXkbExtension) {
XkbEventCauseRec cause;
XkbSetCauseCoreReq(&cause,X_ChangeKeyboardControl,client);
- keybd->kbdfeed->ctrl.leds = ctrl.leds;
XkbSetIndicators(keybd,((led == DO_ALL) ? ~0L : (1L<<(led-1))),
ctrl.leds, &cause);
+ ctrl.leds = keybd->kbdfeed->ctrl.leds;
}
#endif
break;
@@ -1451,7 +1473,6 @@ ProcGetKeyboardControl (client)
int i;
register KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl;
xGetKeyboardControlReply rep;
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply;
@@ -1559,7 +1580,6 @@ ProcGetPointerControl(client)
ClientPtr client;
{
register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl;
- REQUEST(xReq);
xGetPointerControlReply rep;
REQUEST_SIZE_MATCH(xReq);
@@ -1650,7 +1670,7 @@ ProcGetMotionEvents(client)
WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
if (nEvents)
{
- client->pSwapReplyFunc = SwapTimeCoordWrite;
+ client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
(char *)coords);
}
@@ -1663,7 +1683,6 @@ int
ProcQueryKeymap(client)
ClientPtr client;
{
- REQUEST(xReq);
xQueryKeymapReply rep;
int i;
CARD8 *down = inputInfo.keyboard->key->down;
@@ -1685,3 +1704,58 @@ ProcQueryKeymap(client)
return Success;
}
+/******************************************************************************
+ * The following entrypoints are provided for binary compatibility with
+ * previous versions (they make casts, where the current version changes types
+ * for more stringent prototype checking).
+ ******************************************************************************/
+#ifdef AddInputDevice
+#undef AddInputDevice
+
+#if NeedFunctionPrototypes
+DevicePtr
+AddInputDevice(
+ DeviceProc deviceProc,
+ Bool autoStart)
+#else
+DevicePtr
+AddInputDevice(deviceProc, autoStart)
+ DeviceProc deviceProc;
+ Bool autoStart;
+#endif
+{
+ return (DevicePtr)_AddInputDevice(deviceProc, autoStart);
+}
+#endif /* AddInputDevice */
+
+#ifdef RegisterPointerDevice
+#undef RegisterPointerDevice
+
+#if NeedFunctionPrototypes
+void
+RegisterPointerDevice(DevicePtr device)
+#else
+void
+RegisterPointerDevice(device)
+ DevicePtr device;
+#endif
+{
+ _RegisterPointerDevice((DeviceIntPtr)device);
+}
+#endif /* RegisterPointerDevice */
+
+#ifdef RegisterKeyboardDevice
+#undef RegisterKeyboardDevice
+
+#if NeedFunctionPrototypes
+void
+RegisterKeyboardDevice(DevicePtr device)
+#else
+void
+RegisterKeyboardDevice(device)
+ DevicePtr device;
+#endif
+{
+ _RegisterKeyboardDevice((DeviceIntPtr)device);
+}
+#endif /* RegisterKeyboardDevice */
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 68cd8e549..24b825e41 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -46,6 +46,35 @@ SOFTWARE.
********************************************************/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.29 2003/01/12 02:44:26 dawes Exp $ */
+
+#ifdef PANORAMIX_DEBUG
+#include <stdio.h>
+int ProcInitialConnection();
+#endif
+
#include "windowstr.h"
#include "fontstruct.h"
#include "dixfontstr.h"
@@ -59,40 +88,43 @@ SOFTWARE.
#include "servermd.h"
#include "extnsionst.h"
#include "dixfont.h"
+#include "dispatch.h"
+#include "swaprep.h"
+#include "swapreq.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
#ifdef XAPPGROUP
-#include "extensions/Xagsrv.h"
+#include "Xagsrv.h"
+#endif
+#ifdef XKB
+#define XKB_IN_SERVER
+#include "inputstr.h"
+#include "XKBsrv.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
#endif
#define mskcnt ((MAXCLIENTS + 31) / 32)
-#define BITMASK(i) (1 << ((i) & 31))
+#define BITMASK(i) (1U << ((i) & 31))
#define MASKIDX(i) ((i) >> 5)
#define MASKWORD(buf, i) buf[MASKIDX(i)]
#define BITSET(buf, i) MASKWORD(buf, i) |= BITMASK(i)
#define BITCLEAR(buf, i) MASKWORD(buf, i) &= ~BITMASK(i)
#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
-extern WindowPtr *WindowTable;
extern xConnSetupPrefix connSetupPrefix;
extern char *ConnectionInfo;
-extern void ReleaseActiveGrabs();
-extern void NotImplemented();
-extern void SwapConnClientPrefix(
-#if NeedFunctionPrototypes
- xConnClientPrefix *
-#endif
-);
Selection *CurrentSelections;
int NumCurrentSelections;
-extern CARD32 defaultScreenSaverTime;
-extern CARD32 defaultScreenSaverInterval;
-extern int defaultScreenSaverBlanking;
-extern int defaultScreenSaverAllowExposures;
static ClientPtr grabClient;
#define GrabNone 0
#define GrabActive 1
@@ -103,13 +135,6 @@ CallbackListPtr ServerGrabCallback = NULL;
HWEventQueuePtr checkForInput[2];
extern int connBlockScreenStart;
-#ifdef XKB
-extern Bool noXkbExtension;
-#endif
-
-extern void Swap32Write(), SLHostsExtend(), SQColorsExtend(), WriteSConnectionInfo();
-extern void WriteSConnSetupPrefix();
-
static void KillAllClients(
#if NeedFunctionPrototypes
void
@@ -122,10 +147,6 @@ static void DeleteClientFromAnySelections(
#endif
);
-#ifdef LBX
-extern unsigned long StandardRequestLength();
-#endif
-
static int nextFreeClientID; /* always MIN free client ID */
static int nClients; /* number of authorized clients */
@@ -221,17 +242,123 @@ FlushClientCaches(id)
}
}
}
+#ifdef SMART_SCHEDULE
+
+#undef SMART_DEBUG
+
+#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
+#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
+
+Bool SmartScheduleDisable;
+long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
+long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
+long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
+long SmartScheduleTime;
+ClientPtr SmartLastClient;
+int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
+int SmartScheduleClient(int *clientReady, int nready);
+
+#ifdef SMART_DEBUG
+long SmartLastPrint;
+#endif
+
+void Dispatch(void);
+void InitProcVectors(void);
+
+int
+SmartScheduleClient (int *clientReady, int nready)
+{
+ ClientPtr pClient;
+ int i;
+ int client;
+ int bestPrio, best = 0;
+ int bestRobin, robin;
+ long now = SmartScheduleTime;
+ long idle;
+
+ bestPrio = -0x7fffffff;
+ bestRobin = 0;
+ idle = 2 * SmartScheduleSlice;
+ for (i = 0; i < nready; i++)
+ {
+ client = clientReady[i];
+ pClient = clients[client];
+ /* Praise clients which are idle */
+ if ((now - pClient->smart_check_tick) >= idle)
+ {
+ if (pClient->smart_priority < 0)
+ pClient->smart_priority++;
+ }
+ pClient->smart_check_tick = now;
+
+ /* check priority to select best client */
+ robin = (pClient->index - SmartLastIndex[pClient->smart_priority-SMART_MIN_PRIORITY]) & 0xff;
+ if (pClient->smart_priority > bestPrio ||
+ (pClient->smart_priority == bestPrio && robin > bestRobin))
+ {
+ bestPrio = pClient->smart_priority;
+ bestRobin = robin;
+ best = client;
+ }
+#ifdef SMART_DEBUG
+ if ((now - SmartLastPrint) >= 5000)
+ fprintf (stderr, " %2d: %3d", client, pClient->smart_priority);
+#endif
+ }
+#ifdef SMART_DEBUG
+ if ((now - SmartLastPrint) >= 5000)
+ {
+ fprintf (stderr, " use %2d\n", best);
+ SmartLastPrint = now;
+ }
+#endif
+ pClient = clients[best];
+ SmartLastIndex[bestPrio-SMART_MIN_PRIORITY] = pClient->index;
+ /*
+ * Set current client pointer
+ */
+ if (SmartLastClient != pClient)
+ {
+ pClient->smart_start_tick = now;
+ SmartLastClient = pClient;
+ }
+ /*
+ * Adjust slice
+ */
+ if (nready == 1)
+ {
+ /*
+ * If it's been a long time since another client
+ * has run, bump the slice up to get maximal
+ * performance from a single client
+ */
+ if ((now - pClient->smart_start_tick) > 1000 &&
+ SmartScheduleSlice < SmartScheduleMaxSlice)
+ {
+ SmartScheduleSlice += SmartScheduleInterval;
+ }
+ }
+ else
+ {
+ SmartScheduleSlice = SmartScheduleInterval;
+ }
+ return best;
+}
+#endif
#define MAJOROP ((xReq *)client->requestBuffer)->reqType
void
-Dispatch()
+Dispatch(void)
{
register int *clientReady; /* array of request ready clients */
register int result;
register ClientPtr client;
register int nready;
register HWEventQueuePtr* icheck = checkForInput;
+#ifdef SMART_SCHEDULE
+ int start_tick;
+#endif
nextFreeClientID = 1;
InitSelections();
@@ -251,6 +378,13 @@ Dispatch()
nready = WaitForSomething(clientReady);
+#ifdef SMART_SCHEDULE
+ if (nready && !SmartScheduleDisable)
+ {
+ clientReady[0] = SmartScheduleClient (clientReady, nready);
+ nready = 1;
+ }
+#endif
/*****************
* Handle events in round robin fashion, doing input between
* each round
@@ -273,6 +407,9 @@ Dispatch()
isItTimeToYield = FALSE;
requestingClient = client;
+#ifdef SMART_SCHEDULE
+ start_tick = SmartScheduleTime;
+#endif
while (!isItTimeToYield)
{
if (*icheck[0] != *icheck[1])
@@ -280,7 +417,16 @@ Dispatch()
ProcessInputEvents();
FlushIfCriticalOutputPending();
}
-
+#ifdef SMART_SCHEDULE
+ if (!SmartScheduleDisable &&
+ (SmartScheduleTime - start_tick) >= SmartScheduleSlice)
+ {
+ /* Penalize clients which consume ticks */
+ if (client->smart_priority > SMART_MIN_PRIORITY)
+ client->smart_priority--;
+ break;
+ }
+#endif
/* now, finally, deal with client requests */
result = ReadRequestFromClient(client);
@@ -315,7 +461,11 @@ Dispatch()
}
}
FlushAllOutput();
-
+#ifdef SMART_SCHEDULE
+ client = clients[clientReady[nready]];
+ if (client)
+ client->smart_stop_tick = SmartScheduleTime;
+#endif
requestingClient = NULL;
}
dispatchException &= ~DE_PRIORITYCHANGE;
@@ -699,7 +849,6 @@ int
ProcQueryTree(client)
register ClientPtr client;
{
-
xQueryTreeReply reply;
int numChildren = 0;
register WindowPtr pChild, pWin, pHead;
@@ -718,7 +867,6 @@ ProcQueryTree(client)
reply.parent = pWin->parent->drawable.id;
else
reply.parent = (Window)None;
-
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
numChildren++;
@@ -739,7 +887,7 @@ ProcQueryTree(client)
WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply);
if (numChildren)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs);
DEALLOCATE_LOCAL(childIDs);
}
@@ -999,7 +1147,6 @@ int
ProcGrabServer(client)
register ClientPtr client;
{
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
if (grabState != GrabNone && client != grabClient)
{
@@ -1025,8 +1172,12 @@ ProcGrabServer(client)
}
static void
+#if NeedFunctionPrototypes
+UngrabServer(ClientPtr client)
+#else
UngrabServer(client)
ClientPtr client;
+#endif
{
int i;
@@ -1056,7 +1207,6 @@ int
ProcUngrabServer(client)
register ClientPtr client;
{
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
UngrabServer(client);
return(client->noClientException);
@@ -1429,6 +1579,7 @@ ProcChangeGC(client)
len = client->req_len - (sizeof(xChangeGCReq) >> 2);
if (len != Ones(stuff->mask))
return BadLength;
+
result = dixChangeGC(client, pGC, stuff->mask, (CARD32 *) &stuff[1], 0);
if (client->noClientException != Success)
return(client->noClientException);
@@ -1808,6 +1959,7 @@ ProcPolyFillRectangle(client)
if (things & 4)
return(BadLength);
things >>= 3;
+
if (things)
(*pGC->ops->PolyFillRect) (pDraw, pGC, things,
(xRectangle *) &stuff[1]);
@@ -1834,6 +1986,49 @@ ProcPolyFillArc(client)
return (client->noClientException);
}
+#ifdef MATCH_CLIENT_ENDIAN
+
+int
+ServerOrder (void)
+{
+ int whichbyte = 1;
+
+ if (*((char *) &whichbyte))
+ return LSBFirst;
+ return MSBFirst;
+}
+
+#define ClientOrder(client) ((client)->swapped ? !ServerOrder() : ServerOrder())
+
+void
+ReformatImage (char *base, int nbytes, int bpp, int order)
+{
+ switch (bpp) {
+ case 1: /* yuck */
+ if (BITMAP_BIT_ORDER != order)
+ BitOrderInvert ((unsigned char *) base, nbytes);
+#if IMAGE_BYTE_ORDER != BITMAP_BIT_ORDER && BITMAP_SCANLINE_UNIT != 8
+ ReformatImage (base, nbytes, BITMAP_SCANLINE_UNIT, order);
+#endif
+ break;
+ case 4:
+ break; /* yuck */
+ case 8:
+ break;
+ case 16:
+ if (IMAGE_BYTE_ORDER != order)
+ TwoByteSwap ((unsigned char *) base, nbytes);
+ break;
+ case 32:
+ if (IMAGE_BYTE_ORDER != order)
+ FourByteSwap ((unsigned char *) base, nbytes);
+ break;
+ }
+}
+#else
+#define ReformatImage(b,n,bpp,o)
+#endif
+
/* 64-bit server notes: the protocol restricts padding of images to
* 8-, 16-, or 32-bits. We would like to have 64-bits for the server
* to use internally. Removes need for internal alignment checking.
@@ -1864,9 +2059,6 @@ ProcPutImage(client)
(stuff->leftPad >= (unsigned int)screenInfo.bitmapScanlinePad))
return BadMatch;
length = BitmapBytePad(stuff->width + stuff->leftPad);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
-#endif
}
else if (stuff->format == XYPixmap)
{
@@ -1875,19 +2067,12 @@ ProcPutImage(client)
return BadMatch;
length = BitmapBytePad(stuff->width + stuff->leftPad);
length *= stuff->depth;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = BitmapBytePadProto(stuff->width + stuff->leftPad);
- lengthProto *= stuff->depth;
-#endif
}
else if (stuff->format == ZPixmap)
{
if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0))
return BadMatch;
length = PixmapBytePad(stuff->width, stuff->depth);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->width, stuff->depth);
-#endif
}
else
{
@@ -1895,65 +2080,21 @@ ProcPutImage(client)
return BadValue;
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* handle 64 bit case where protocol may pad to 32 and we want 64 */
- if ( length != lengthProto ) {
- register int i;
- char * stuffptr, /* pointer into protocol data */
- * tmpptr; /* new location to copy to */
-
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
- return (BadAlloc);
-
- bzero(tmpImage,length*stuff->height);
-
- if ( stuff->format == XYPixmap ) {
- int lineBytes = BitmapBytePad(stuff->width + stuff->leftPad);
- int lineBytesProto =
- BitmapBytePadProto(stuff->width + stuff->leftPad);
- int depth = stuff->depth;
-
- stuffptr = (char *)&stuff[1];
- tmpptr = tmpImage;
- for ( i = 0; i < stuff->height*stuff->depth;
- stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
- memmove(tmpptr,stuffptr,lineBytesProto);
- }
- else {
- for ( i = 0,stuffptr = (char *)&stuff[1],tmpptr=tmpImage;
- i < stuff->height;
- stuffptr += lengthProto,tmpptr += length, i++)
- memmove(tmpptr,stuffptr,lengthProto);
- }
- }
-
- /* handle 64-bit case where stuff is not 64-bit aligned */
- else if ((unsigned long)&stuff[1] & (sizeof(long)-1)) {
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->height)))
- return (BadAlloc);
- memmove(tmpImage,(char *)&stuff[1],length*stuff->height);
- }
- else
- tmpImage = (char *)&stuff[1];
-#else
tmpImage = (char *)&stuff[1];
lengthProto = length;
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
if (((((lengthProto * stuff->height) + (unsigned)3) >> 2) +
(sizeof(xPutImageReq) >> 2)) != client->req_len)
return BadLength;
+ ReformatImage (tmpImage, lengthProto * stuff->height,
+ stuff->format == ZPixmap ? BitsPerPixel (stuff->depth) : 1,
+ ClientOrder(client));
+
(*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY,
stuff->width, stuff->height,
stuff->leftPad, stuff->format, tmpImage);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* free up our temporary space if used */
- if (tmpImage != (char *)&stuff[1])
- DEALLOCATE_LOCAL(tmpImage);
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
-
return (client->noClientException);
}
@@ -1971,10 +2112,7 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
int nlines, linesPerBuf;
register int linesDone;
long widthBytesLine, length;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long widthBytesLineProto, lengthProto;
-#endif
- Mask plane;
+ Mask plane = 0;
char *pBuf;
xGetImageReply xgi;
RegionPtr pVisibleRegion = NULL;
@@ -2024,10 +2162,6 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
widthBytesLine = PixmapBytePad(width, pDraw->depth);
length = widthBytesLine * height;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = PixmapBytePadProto(width, pDraw->depth);
- lengthProto = widthBytesLineProto * height;
-#endif
}
else
{
@@ -2037,18 +2171,9 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
length = widthBytesLine * height *
Ones(planemask & (plane | (plane - 1)));
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = BitmapBytePadProto(width);
- lengthProto = widthBytesLineProto * height *
- Ones(planemask & (plane | (plane - 1)));
-#endif
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- xgi.length = lengthProto;
-#else
xgi.length = length;
-#endif
if (im_return) {
pBuf = (char *)xalloc(sz_xGetImageReply + length);
@@ -2078,12 +2203,12 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
{
/* we have to make sure intermediate buffers don't need padding */
while ((linesPerBuf > 1) &&
- (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
+ (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1)))
{
linesPerBuf--;
length -= widthBytesLine;
}
- while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))
+ while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD)-1))
{
linesPerBuf++;
length += widthBytesLine;
@@ -2131,35 +2256,19 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
nlines, format, pBuf);
#endif
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* for 64-bit server, convert image to pad to 32 bits */
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- for (i = 1,
- bufPtr = pBuf + widthBytesLine,
- protoPtr = pBuf + widthBytesLineProto;
- i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr, bufPtr, widthBytesLineProto);
- }
-#endif
/* Note that this is NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
if (!im_return)
+ {
+ ReformatImage (pBuf, (int)(nlines * widthBytesLine),
+ BitsPerPixel (pDraw->depth),
+ ClientOrder(client));
+
/* Don't split me, gcc pukes when you do */
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto),
- pBuf);
-#else
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
-#endif
+ }
linesDone += nlines;
}
}
@@ -2189,41 +2298,21 @@ DoGetImage(client, format, drawable, x, y, width, height, planemask, im_return)
nlines, format, pBuf);
#endif
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* for 64-bit server, convert image to pad to 32 bits */
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- for (i = 1,
- bufPtr = pBuf + widthBytesLine,
- protoPtr = pBuf + widthBytesLineProto;
- i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr, bufPtr, widthBytesLineProto);
- }
-#endif
/* Note: NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
if (im_return) {
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- pBuf += nlines * widthBytesLineProto;
-#else
pBuf += nlines * widthBytesLine;
-#endif
- } else
+ } else {
+ ReformatImage (pBuf,
+ (int)(nlines * widthBytesLine),
+ 1,
+ ClientOrder (client));
+
/* Don't split me, gcc pukes when you do */
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto),
- pBuf);
-#else
(void)WriteToClient(client,
(int)(nlines * widthBytesLine),
pBuf);
-#endif
+ }
linesDone += nlines;
}
}
@@ -2517,7 +2606,7 @@ ProcListInstalledColormaps(client)
preply->nColormaps = nummaps;
preply->length = nummaps;
WriteReplyToClient(client, sizeof (xListInstalledColormapsReply), preply);
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
DEALLOCATE_LOCAL(preply);
return(client->noClientException);
@@ -2561,6 +2650,9 @@ ProcAllocColor(client)
else
return (retval);
}
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pmap->pScreen->myNum)
+#endif
WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
return (client->noClientException);
@@ -2617,6 +2709,9 @@ ProcAllocNamedColor (client)
else
return(retval);
}
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+#endif
WriteReplyToClient(client, sizeof (xAllocNamedColorReply), &ancr);
return (client->noClientException);
}
@@ -2684,14 +2779,19 @@ ProcAllocColorCells (client)
else
return(retval);
}
- accr.type = X_Reply;
- accr.length = length >> 2;
- accr.sequenceNumber = client->sequence;
- accr.nPixels = npixels;
- accr.nMasks = nmasks;
- WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr);
- client->pSwapReplyFunc = Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+#endif
+ {
+ accr.type = X_Reply;
+ accr.length = length >> 2;
+ accr.sequenceNumber = client->sequence;
+ accr.nPixels = npixels;
+ accr.nMasks = nmasks;
+ WriteReplyToClient(client, sizeof (xAllocColorCellsReply), &accr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
DEALLOCATE_LOCAL(ppixels);
return (client->noClientException);
}
@@ -2758,9 +2858,14 @@ ProcAllocColorPlanes(client)
return(retval);
}
acpr.length = length >> 2;
- WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
- client->pSwapReplyFunc = Swap32Write;
- WriteSwappedDataToClient(client, length, ppixels);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !pcmp->pScreen->myNum)
+#endif
+ {
+ WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
+ WriteSwappedDataToClient(client, length, ppixels);
+ }
DEALLOCATE_LOCAL(ppixels);
return (client->noClientException);
}
@@ -2915,7 +3020,7 @@ ProcQueryColors(client)
WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
if (count)
{
- client->pSwapReplyFunc = SQColorsExtend;
+ client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
}
if (prgbs) DEALLOCATE_LOCAL(prgbs);
@@ -3199,7 +3304,6 @@ int
ProcGetScreenSaver(client)
register ClientPtr client;
{
- REQUEST(xReq);
xGetScreenSaverReply rep;
REQUEST_SIZE_MATCH(xReq);
@@ -3243,11 +3347,10 @@ int
ProcListHosts(client)
register ClientPtr client;
{
-extern int GetHosts();
xListHostsReply reply;
int len, nHosts, result;
pointer pdata;
- REQUEST(xListHostsReq);
+ /* REQUEST(xListHostsReq); */
REQUEST_SIZE_MATCH(xListHostsReq);
#ifdef XCSECURITY
@@ -3268,7 +3371,7 @@ extern int GetHosts();
WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
if (nHosts)
{
- client->pSwapReplyFunc = SLHostsExtend;
+ client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
WriteSwappedDataToClient(client, len, pdata);
}
xfree(pdata);
@@ -3372,7 +3475,7 @@ ProcGetFontPath(client)
xGetFontPathReply reply;
int stringLens, numpaths;
unsigned char *bufferStart;
- REQUEST (xReq);
+ /* REQUEST (xReq); */
REQUEST_SIZE_MATCH(xReq);
bufferStart = GetFontPath(&numpaths, &stringLens);
@@ -3429,8 +3532,6 @@ int ProcForceScreenSaver(client)
int ProcNoOperation(client)
register ClientPtr client;
{
- REQUEST(xReq);
-
REQUEST_AT_LEAST_SIZE(xReq);
/* noop -- don't do anything */
@@ -3438,7 +3539,7 @@ int ProcNoOperation(client)
}
void
-InitProcVectors()
+InitProcVectors(void)
{
int i;
for (i = 0; i<256; i++)
@@ -3446,7 +3547,7 @@ InitProcVectors()
if(!ProcVector[i])
{
ProcVector[i] = SwappedProcVector[i] = ProcBadRequest;
- ReplySwapVector[i] = NotImplemented;
+ ReplySwapVector[i] = ReplyNotSwappd;
}
#ifdef K5AUTH
if (!k5_Vector[i])
@@ -3469,7 +3570,7 @@ InitProcVectors()
* then killed again, the client is really destroyed.
*********************/
-Bool terminateAtReset = FALSE;
+char dispatchExceptionAtReset = DE_RESET;
void
CloseDownClient(client)
@@ -3535,12 +3636,8 @@ CloseDownClient(client)
if (really_close_down)
{
if (client->clientState == ClientStateRunning && nClients == 0)
- {
- if (terminateAtReset)
- dispatchException |= DE_TERMINATE;
- else
- dispatchException |= DE_RESET;
- }
+ dispatchException |= dispatchExceptionAtReset;
+
client->clientState = ClientStateGone;
if (ClientStateCallback)
{
@@ -3555,6 +3652,9 @@ CloseDownClient(client)
if (client->index < nextFreeClientID)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
+#ifdef SMART_SCHEDULE
+ SmartLastClient = NullClient;
+#endif
xfree(client);
while (!clients[currentMaxClients-1])
@@ -3651,6 +3751,12 @@ void InitClient(client, i, ospriv)
client->appgroup = NULL;
#endif
client->fontResFunc = NULL;
+#ifdef SMART_SCHEDULE
+ client->smart_priority = 0;
+ client->smart_start_tick = SmartScheduleTime;
+ client->smart_stop_tick = SmartScheduleTime;
+ client->smart_check_tick = SmartScheduleTime;
+#endif
}
extern int clientPrivateLen;
@@ -3795,7 +3901,6 @@ SendConnSetup(client, reason)
if (reason)
{
xConnSetupPrefix csp;
- char pad[3];
csp.success = xFalse;
csp.lengthReason = strlen(reason);
@@ -3828,8 +3933,19 @@ SendConnSetup(client, reason)
#endif
((xConnSetup *)lConnectionInfo)->ridBase = client->clientAsMask;
((xConnSetup *)lConnectionInfo)->ridMask = RESOURCE_ID_MASK;
+#ifdef MATCH_CLIENT_ENDIAN
+ ((xConnSetup *)lConnectionInfo)->imageByteOrder = ClientOrder (client);
+ ((xConnSetup *)lConnectionInfo)->bitmapBitOrder = ClientOrder (client);
+#endif
/* fill in the "currentInputMask" */
root = (xWindowRoot *)(lConnectionInfo + connBlockScreenStart);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension)
+ numScreens = screenInfo.numScreens;
+ else
+ numScreens = ((xConnSetup *)ConnectionInfo)->numRoots;
+#endif
+
for (i=0; i<numScreens; i++)
{
register unsigned int j;
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 83ef68b96..5386c908b 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.27 2003/02/15 03:47:05 dawes Exp $ */
/************************************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -40,47 +41,27 @@ SOFTWARE.
#include <stdio.h>
#endif
-#define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics
-
-static Mask FontFormat =
-#if IMAGE_BYTE_ORDER == LSBFirst
- BitmapFormatByteOrderLSB |
-#else
- BitmapFormatByteOrderMSB |
-#endif
-
-#if BITMAP_BIT_ORDER == LSBFirst
- BitmapFormatBitOrderLSB |
-#else
- BitmapFormatBitOrderMSB |
-#endif
-
- BitmapFormatImageRectMin |
-
-#if GLYPHPADBYTES == 1
- BitmapFormatScanlinePad8 |
-#endif
-
-#if GLYPHPADBYTES == 2
- BitmapFormatScanlinePad16 |
+#ifdef PANORAMIX
+#include "panoramiX.h"
#endif
-#if GLYPHPADBYTES == 4
- BitmapFormatScanlinePad32 |
+#ifdef LBX
+#include "lbxserve.h"
#endif
-#if GLYPHPADBYTES == 8
- BitmapFormatScanlinePad64 |
+#ifdef XF86BIGFONT
+#define _XF86BIGFONT_SERVER_
+#include "xf86bigfont.h"
#endif
- BitmapFormatScanlineUnit8;
+#define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics
extern pointer fosNaturalParams;
extern FontPtr defaultFont;
static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0;
static int num_fpes = 0;
-static FPEFunctions *fpe_functions = (FPEFunctions *) 0;
+FPEFunctions *fpe_functions = (FPEFunctions *) 0;
static int num_fpe_types = 0;
static unsigned char *font_path_string;
@@ -100,8 +81,8 @@ FontToXError(err)
case AllocError:
return BadAlloc;
case BadFontName:
- case BadFontPath:
return BadName;
+ case BadFontPath:
case BadFontFormat: /* is there something better? */
case BadCharRange:
return BadValue;
@@ -212,15 +193,23 @@ FontWakeup(data, count, LastSelectMask)
/* XXX -- these two funcs may want to be broken into macros */
static void
+#if NeedFunctionPrototypes
+UseFPE(FontPathElementPtr fpe)
+#else
UseFPE(fpe)
FontPathElementPtr fpe;
+#endif
{
fpe->refcount++;
}
static void
+#if NeedFunctionPrototypes
+FreeFPE (FontPathElementPtr fpe)
+#else
FreeFPE (fpe)
FontPathElementPtr fpe;
+#endif
{
fpe->refcount--;
if (fpe->refcount == 0) {
@@ -231,12 +220,16 @@ FreeFPE (fpe)
}
static Bool
+#if NeedFunctionPrototypes
+doOpenFont(ClientPtr client, OFclosurePtr c)
+#else
doOpenFont(client, c)
ClientPtr client;
OFclosurePtr c;
+#endif
{
FontPtr pfont = NullFont;
- FontPathElementPtr fpe;
+ FontPathElementPtr fpe = NULL;
ScreenPtr pScr;
int err = Successful;
int i;
@@ -244,6 +237,36 @@ doOpenFont(client, c)
*newname;
int newlen;
int aliascount = 20;
+ /*
+ * Decide at runtime what FontFormat to use.
+ */
+ Mask FontFormat =
+
+ ((screenInfo.imageByteOrder == LSBFirst) ?
+ BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) |
+
+ ((screenInfo.bitmapBitOrder == LSBFirst) ?
+ BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) |
+
+ BitmapFormatImageRectMin |
+
+#if GLYPHPADBYTES == 1
+ BitmapFormatScanlinePad8 |
+#endif
+
+#if GLYPHPADBYTES == 2
+ BitmapFormatScanlinePad16 |
+#endif
+
+#if GLYPHPADBYTES == 4
+ BitmapFormatScanlinePad32 |
+#endif
+
+#if GLYPHPADBYTES == 8
+ BitmapFormatScanlinePad64 |
+#endif
+
+ BitmapFormatScanlineUnit8;
if (client->clientGone)
{
@@ -292,7 +315,7 @@ doOpenFont(client, c)
if (err == Suspended) {
if (!c->slept) {
c->slept = TRUE;
- ClientSleep(client, doOpenFont, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)doOpenFont, (pointer) c);
}
return TRUE;
}
@@ -358,6 +381,14 @@ OpenFont(client, fid, flags, lenfname, pfontname)
int i;
FontPtr cached = (FontPtr)0;
+#ifdef FONTDEBUG
+ char *f;
+ f = (char *)xalloc(lenfname + 1);
+ memmove(f, pfontname, lenfname);
+ f[lenfname] = '\0';
+ ErrorF("OpenFont: fontname is \"%s\"\n", f);
+ xfree(f);
+#endif
if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
return BadName;
if (patternCache)
@@ -461,6 +492,9 @@ CloseFont(value, fid)
#ifdef LBX
LbxFreeFontTag(pfont);
#endif
+#ifdef XF86BIGFONT
+ XF86BigfontFreeFontShm(pfont);
+#endif
fpe = pfont->fpe;
(*fpe_functions[fpe->type].close_font) (fpe, pfont);
FreeFPE(fpe);
@@ -489,7 +523,7 @@ QueryFont(pFont, pReply, nProtoCCIStructs)
xFontProp *prFP;
xCharInfo *prCI;
xCharInfo *charInfos[256];
- char chars[512];
+ unsigned char chars[512];
int ninfos;
unsigned long ncols;
unsigned long count;
@@ -529,8 +563,8 @@ QueryFont(pFont, pReply, nProtoCCIStructs)
chars[i++] = r;
chars[i++] = c;
}
- (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit,
- &count, charInfos);
+ (*pFont->get_metrics) (pFont, ncols, chars,
+ TwoD16Bit, &count, charInfos);
i = 0;
for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) {
*prCI = *charInfos[i];
@@ -542,14 +576,18 @@ QueryFont(pFont, pReply, nProtoCCIStructs)
}
static Bool
+#if NeedFunctionPrototypes
+doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
+#else
doListFontsAndAliases(client, c)
ClientPtr client;
LFclosurePtr c;
+#endif
{
FontPathElementPtr fpe;
int err = Successful;
FontNamesPtr names = NULL;
- char *name, *resolved;
+ char *name, *resolved=NULL;
int namelen, resolvedlen;
int nnames;
int stringLens;
@@ -557,7 +595,7 @@ doListFontsAndAliases(client, c)
xListFontsReply reply;
char *bufptr;
char *bufferStart;
- int aliascount;
+ int aliascount = 0;
if (client->clientGone)
{
@@ -589,7 +627,9 @@ doListFontsAndAliases(client, c)
if (err == Suspended) {
if (!c->slept) {
c->slept = TRUE;
- ClientSleep(client, doListFontsAndAliases, (pointer) c);
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
+ (pointer) c);
}
return TRUE;
}
@@ -614,7 +654,8 @@ doListFontsAndAliases(client, c)
&c->current.private);
if (err == Suspended) {
if (!c->slept) {
- ClientSleep(client, doListFontsAndAliases,
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
(pointer) c);
c->slept = TRUE;
}
@@ -624,18 +665,26 @@ doListFontsAndAliases(client, c)
c->current.list_started = TRUE;
}
if (err == Successful) {
+ char *tmpname;
name = 0;
err = (*fpe_functions[fpe->type].list_next_font_or_alias)
- ((pointer) c->client, fpe, &name, &namelen, &resolved,
+ ((pointer) c->client, fpe, &name, &namelen, &tmpname,
&resolvedlen, c->current.private);
if (err == Suspended) {
if (!c->slept) {
- ClientSleep(client, doListFontsAndAliases,
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsAndAliases,
(pointer) c);
c->slept = TRUE;
}
return TRUE;
}
+ if (err == FontNameAlias) {
+ if (resolved) xfree(resolved);
+ resolved = (char *) xalloc(resolvedlen + 1);
+ if (resolved)
+ memmove(resolved, tmpname, resolvedlen + 1);
+ }
}
if (err == Successful)
@@ -784,6 +833,7 @@ bail:
if (c->savedName) xfree(c->savedName);
FreeFontNames(names);
xfree(c);
+ if (resolved) xfree(resolved);
return TRUE;
}
@@ -856,7 +906,7 @@ doListFontsWithInfo(client, c)
int length;
xFontProp *pFP;
int i;
- int aliascount;
+ int aliascount = 0;
xListFontsWithInfoReply finalReply;
if (client->clientGone)
@@ -885,7 +935,7 @@ doListFontsWithInfo(client, c)
{
if (!c->slept)
{
- ClientSleep(client, doListFontsWithInfo, c);
+ ClientSleep(client, (ClientSleepProcPtr)doListFontsWithInfo, c);
c->slept = TRUE;
}
return TRUE;
@@ -904,7 +954,9 @@ doListFontsWithInfo(client, c)
{
if (!c->slept)
{
- ClientSleep(client, doListFontsWithInfo, c);
+ ClientSleep(client,
+ (ClientSleepProcPtr)doListFontsWithInfo,
+ c);
c->slept = TRUE;
}
return TRUE;
@@ -1122,9 +1174,9 @@ doPolyText(client, c)
register FontPtr pFont = c->pGC->font, oldpFont;
Font fid, oldfid;
int err = Success, lgerr; /* err is in X error, not font error, space */
- enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state;
+ enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
FontPathElementPtr fpe;
- GC *origGC;
+ GC *origGC = NULL;
if (client->clientGone)
{
@@ -1211,9 +1263,9 @@ doPolyText(client, c)
ChangeGC( c->pGC, GCFont, &fid);
ValidateGC(c->pDraw, c->pGC);
if (c->reqType == X_PolyText8)
- c->polyText = c->pGC->ops->PolyText8;
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
else
- c->polyText = c->pGC->ops->PolyText16;
+ c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16;
}
/* Undo the refcnt++ we performed when going to sleep */
@@ -1319,7 +1371,9 @@ doPolyText(client, c)
ValidateGC(c->pDraw, c->pGC);
c->slept = TRUE;
- ClientSleep(client, doPolyText, (pointer) c);
+ ClientSleep(client,
+ (ClientSleepProcPtr)doPolyText,
+ (pointer) c);
/* Set up to perform steps 3 and 4 */
client_state = START_SLEEP;
@@ -1360,7 +1414,10 @@ bail:
if (c->err != Success) err = c->err;
if (err != Success && c->client != serverClient) {
- SendErrorToClient(c->client, c->reqType, 0, 0, err);
+#ifdef PANORAMIX
+ if (noPanoramiXExtension || !c->pGC->pScreen->myNum)
+#endif
+ SendErrorToClient(c->client, c->reqType, 0, 0, err);
}
if (c->slept)
{
@@ -1400,12 +1457,12 @@ PolyText(client, pDraw, pGC, pElt, endReq, xorg, yorg, reqType, did)
local_closure.yorg = yorg;
if ((local_closure.reqType = reqType) == X_PolyText8)
{
- local_closure.polyText = pGC->ops->PolyText8;
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8;
local_closure.itemSize = 1;
}
else
{
- local_closure.polyText = pGC->ops->PolyText16;
+ local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16;
local_closure.itemSize = 2;
}
local_closure.pGC = pGC;
@@ -1508,7 +1565,7 @@ doImageText(client, c)
ValidateGC(c->pDraw, c->pGC);
c->slept = TRUE;
- ClientSleep(client, doImageText, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)doImageText, (pointer) c);
}
return TRUE;
}
@@ -1567,12 +1624,12 @@ ImageText(client, pDraw, pGC, nChars, data, xorg, yorg, reqType, did)
local_closure.yorg = yorg;
if ((local_closure.reqType = reqType) == X_ImageText8)
{
- local_closure.imageText = pGC->ops->ImageText8;
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8;
local_closure.itemSize = 1;
}
else
{
- local_closure.imageText = pGC->ops->ImageText16;
+ local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16;
local_closure.itemSize = 2;
}
local_closure.did = did;
@@ -1585,8 +1642,12 @@ ImageText(client, pDraw, pGC, nChars, data, xorg, yorg, reqType, did)
/* does the necessary magic to figure out the fpe type */
static int
+#if NeedFunctionPrototypes
+DetermineFPEType(char *pathname)
+#else
DetermineFPEType(pathname)
char *pathname;
+#endif
{
int i;
@@ -1599,10 +1660,14 @@ DetermineFPEType(pathname)
static void
+#if NeedFunctionPrototypes
+FreeFontPath(FontPathElementPtr *list, int n, Bool force)
+#else
FreeFontPath(list, n, force)
FontPathElementPtr *list;
Bool force;
int n;
+#endif
{
int i;
@@ -1628,12 +1693,16 @@ FreeFontPath(list, n, force)
xfree((char *) list);
}
-static FontPathElementPtr
+static FontPathElementPtr
+#if NeedFunctionPrototypes
+find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len)
+#else
find_existing_fpe(list, num, name, len)
FontPathElementPtr *list;
int num;
unsigned char *name;
int len;
+#endif
{
FontPathElementPtr fpe;
int i;
@@ -1648,18 +1717,21 @@ find_existing_fpe(list, num, name, len)
static int
-SetFontPathElements(npaths, paths, bad)
+#if NeedFunctionPrototypes
+SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
+#else
+SetFontPathElements(npaths, paths, bad, persist)
int npaths;
unsigned char *paths;
int *bad;
+ Bool persist;
+#endif
{
- int i,
- err;
+ int i, err = 0;
int valid_paths = 0;
unsigned int len;
unsigned char *cp = paths;
- FontPathElementPtr fpe,
- *fplist;
+ FontPathElementPtr fpe = NULL, *fplist;
fplist = (FontPathElementPtr *)
xalloc(sizeof(FontPathElementPtr) * npaths);
@@ -1671,63 +1743,83 @@ SetFontPathElements(npaths, paths, bad)
if (fpe_functions[i].set_path_hook)
(*fpe_functions[i].set_path_hook) ();
}
- for (i = 0; i < npaths; i++) {
+ for (i = 0; i < npaths; i++)
+ {
len = (unsigned int) (*cp++);
- if (len) {
+ if (len == 0)
+ {
+ if (persist)
+ ErrorF ("Removing empty element from the valid list of fontpaths\n");
+ err = BadValue;
+ }
+ else
+ {
/* if it's already in our active list, just reset it */
/*
* note that this can miss FPE's in limbo -- may be worth catching
* them, though it'd muck up refcounting
*/
fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len);
- if (fpe) {
+ if (fpe)
+ {
err = (*fpe_functions[fpe->type].reset_fpe) (fpe);
- if (err == Successful) {
+ if (err == Successful)
+ {
UseFPE(fpe);/* since it'll be decref'd later when freed
* from the old list */
- fplist[valid_paths++] = fpe;
- cp += len;
- continue;
}
- /* if error or can't do it, act like it's a new one */
- }
- fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec));
- if (!fpe) {
- err = BadAlloc;
- goto bail;
- }
- fpe->name = (char *) xalloc(len + 1);
- if (!fpe->name) {
- xfree(fpe);
- err = BadAlloc;
- goto bail;
+ else
+ fpe = 0;
}
- fpe->refcount = 1;
-
- strncpy(fpe->name, (char *) cp, (int) len);
- cp += len;
- fpe->name[len] = '\0';
- fpe->name_length = len;
- fpe->type = DetermineFPEType(fpe->name);
- if (fpe->type == -1) {
- xfree(fpe->name);
- xfree(fpe);
- err = BadValue;
- goto bail;
+ /* if error or can't do it, act like it's a new one */
+ if (!fpe)
+ {
+ fpe = (FontPathElementPtr) xalloc(sizeof(FontPathElementRec));
+ if (!fpe)
+ {
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->name = (char *) xalloc(len + 1);
+ if (!fpe->name)
+ {
+ xfree(fpe);
+ err = BadAlloc;
+ goto bail;
+ }
+ fpe->refcount = 1;
+
+ strncpy(fpe->name, (char *) cp, (int) len);
+ fpe->name[len] = '\0';
+ fpe->name_length = len;
+ fpe->type = DetermineFPEType(fpe->name);
+ if (fpe->type == -1)
+ err = BadValue;
+ else
+ err = (*fpe_functions[fpe->type].init_fpe) (fpe);
+ if (err != Successful)
+ {
+ if (persist)
+ {
+ ErrorF("Could not init font path element %s, removing from list!\n",
+ fpe->name);
+ }
+ xfree (fpe->name);
+ xfree (fpe);
+ }
}
- err = (*fpe_functions[fpe->type].init_fpe) (fpe);
- if (err != Successful) {
- xfree(fpe->name);
- xfree(fpe);
- err = BadValue;
+ }
+ if (err != Successful)
+ {
+ if (!persist)
goto bail;
- }
+ }
+ else
+ {
fplist[valid_paths++] = fpe;
- } else {
- err = BadValue;
- goto bail;
}
+ cp += len;
}
FreeFontPath(font_path_elements, num_fpes, FALSE);
@@ -1739,10 +1831,10 @@ SetFontPathElements(npaths, paths, bad)
return Success;
bail:
*bad = i;
- while (--i >= 0)
- FreeFPE(fplist[i]);
+ while (--valid_paths >= 0)
+ FreeFPE(fplist[valid_paths]);
xfree(fplist);
- return err;
+ return FontToXError(err);
}
/* XXX -- do we need to pass error down to each renderer? */
@@ -1757,9 +1849,9 @@ SetFontPath(client, npaths, paths, error)
if (npaths == 0) {
if (SetDefaultFontPath(defaultFontPath) != Success)
- return BadName;
+ return BadValue;
} else {
- err = SetFontPathElements(npaths, paths, error);
+ err = SetFontPathElements(npaths, paths, error, FALSE);
}
return err;
}
@@ -1799,7 +1891,7 @@ SetDefaultFontPath(path)
}
*nump = (unsigned char) size;
- err = SetFontPathElements(num, newpath, &bad);
+ err = SetFontPathElements(num, newpath, &bad, TRUE);
DEALLOCATE_LOCAL(newpath);
@@ -1873,13 +1965,21 @@ InitFonts ()
{
patternCache = MakeFontPatternCache();
+#ifndef KDRIVESERVER
if (screenInfo.numScreens > screenInfo.numVideoScreens) {
PrinterFontRegisterFpeFunctions();
FontFileCheckRegisterFpeFunctions();
check_fs_register_fpe_functions();
- } else {
+ } else
+#endif
+ {
+#ifdef KDRIVESERVER
+ BuiltinRegisterFpeFunctions();
+#endif
FontFileRegisterFpeFunctions();
+#ifndef NOFONTSERVERACCESS
fs_register_fpe_functions();
+#endif
}
}
@@ -1931,26 +2031,21 @@ GetClientResolutions (num)
*/
int
-RegisterFPEFunctions(name_func, init_func, free_func, reset_func,
- open_func, close_func, list_func, start_lfwi_func, next_lfwi_func,
- wakeup_func, client_died, load_glyphs,
- start_list_alias_func, next_list_alias_func,
- set_path_func)
- Bool (*name_func) ();
- int (*init_func) ();
- int (*free_func) ();
- int (*reset_func) ();
- int (*open_func) ();
- int (*close_func) ();
- int (*list_func) ();
- int (*start_lfwi_func) ();
- int (*next_lfwi_func) ();
- int (*wakeup_func) ();
- int (*client_died) ();
- int (*load_glyphs) ();
- int (*start_list_alias_func) ();
- int (*next_list_alias_func) ();
- void (*set_path_func) ();
+RegisterFPEFunctions(NameCheckFunc name_func,
+ InitFpeFunc init_func,
+ FreeFpeFunc free_func,
+ ResetFpeFunc reset_func,
+ OpenFontFunc open_func,
+ CloseFontFunc close_func,
+ ListFontsFunc list_func,
+ StartLfwiFunc start_lfwi_func,
+ NextLfwiFunc next_lfwi_func,
+ WakeupFpeFunc wakeup_func,
+ ClientDiedFunc client_died,
+ LoadGlyphsFunc load_glyphs,
+ StartLaFunc start_list_alias_func,
+ NextLaFunc next_list_alias_func,
+ SetPathFunc set_path_func)
{
FPEFunctions *new;
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 3b16c6a13..7e9bfa4bf 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/dixutils.c,v 3.13 2003/01/12 02:44:26 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -94,7 +95,7 @@ Author: Adobe Systems Incorporated
#include "keysymdef.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
/*
@@ -326,7 +327,7 @@ AlterSaveSetForClient(client, pWin, mode)
unsigned mode;
{
int numnow;
- pointer *pTmp;
+ pointer *pTmp = NULL;
int j;
numnow = client->numSaved;
@@ -397,11 +398,7 @@ DeleteWindowFromAnySaveSet(pWin)
* procedure to call than to check if there's a procedure
*/
void
-NoopDDA(
-#if NeedVarargsPrototypes
- void* f, ...
-#endif
-)
+NoopDDA(void)
{
}
@@ -556,7 +553,7 @@ WorkQueuePtr workQueue;
static WorkQueuePtr *workQueueLast = &workQueue;
void
-ProcessWorkQueue()
+ProcessWorkQueue(void)
{
WorkQueuePtr q, *p;
@@ -567,7 +564,7 @@ ProcessWorkQueue()
* they will be called again. This must be reentrant with
* QueueWorkProc.
*/
- while (q = *p)
+ while ((q = *p))
{
if ((*q->function) (q->client, q->closure))
{
@@ -584,12 +581,12 @@ ProcessWorkQueue()
}
void
-ProcessWorkQueueZombies()
+ProcessWorkQueueZombies(void)
{
WorkQueuePtr q, *p;
p = &workQueue;
- while (q = *p)
+ while ((q = *p))
{
if (q->client && q->client->clientGone)
{
@@ -607,10 +604,22 @@ ProcessWorkQueueZombies()
}
Bool
+#if NeedFunctionPrototypes
+QueueWorkProc (
+ Bool (*function)(
+#if NeedNestedPrototypes
+ ClientPtr /* pClient */,
+ pointer /* closure */
+#endif
+ ),
+ ClientPtr client,
+ pointer closure)
+#else
QueueWorkProc (function, client, closure)
Bool (*function)();
ClientPtr client;
pointer closure;
+#endif
{
WorkQueuePtr q;
@@ -637,7 +646,7 @@ QueueWorkProc (function, client, closure)
typedef struct _SleepQueue {
struct _SleepQueue *next;
ClientPtr client;
- Bool (*function)();
+ ClientSleepProcPtr function;
pointer closure;
} SleepQueueRec, *SleepQueuePtr;
@@ -646,7 +655,7 @@ static SleepQueuePtr sleepQueue = NULL;
Bool
ClientSleep (client, function, closure)
ClientPtr client;
- Bool (*function)();
+ ClientSleepProcPtr function;
pointer closure;
{
SleepQueuePtr q;
@@ -692,7 +701,11 @@ ClientWakeup (client)
*prev = q->next;
xfree (q);
if (client->clientGone)
- CloseDownClient(client);
+ /* Oops -- new zombie cleanup code ensures this only
+ * happens from inside CloseDownClient; don't want to
+ * recurse here...
+ */
+ /* CloseDownClient(client) */;
else
AttendClient (client);
break;
@@ -723,10 +736,17 @@ static int numCallbackListsToCleanup = 0;
static CallbackListPtr **listsToCleanup = NULL;
static Bool
+#if NeedFunctionPrototypes
+_AddCallback(
+ CallbackListPtr *pcbl,
+ CallbackProcPtr callback,
+ pointer data)
+#else
_AddCallback(pcbl, callback, data)
CallbackListPtr *pcbl;
CallbackProcPtr callback;
pointer data;
+#endif
{
CallbackPtr cbr;
@@ -742,14 +762,20 @@ _AddCallback(pcbl, callback, data)
}
static Bool
+#if NeedFunctionPrototypes
+_DeleteCallback(
+ CallbackListPtr *pcbl,
+ CallbackProcPtr callback,
+ pointer data)
+#else
_DeleteCallback(pcbl, callback, data)
CallbackListPtr *pcbl;
CallbackProcPtr callback;
pointer data;
+#endif
{
CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, pcbr;
- int i;
for (pcbr = NULL, cbr = cbl->list;
cbr != NULL;
@@ -779,9 +805,15 @@ _DeleteCallback(pcbl, callback, data)
}
static void
+#if NeedFunctionPrototypes
+_CallCallbacks(
+ CallbackListPtr *pcbl,
+ pointer call_data)
+#else
_CallCallbacks(pcbl, call_data)
CallbackListPtr *pcbl;
pointer call_data;
+#endif
{
CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, pcbr;
@@ -836,8 +868,13 @@ _CallCallbacks(pcbl, call_data)
}
static void
+#if NeedFunctionPrototypes
+_DeleteCallbackList(
+ CallbackListPtr *pcbl)
+#else
_DeleteCallbackList(pcbl)
CallbackListPtr *pcbl;
+#endif
{
CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, nextcbr;
@@ -851,7 +888,7 @@ _DeleteCallbackList(pcbl)
for (i = 0; i < numCallbackListsToCleanup; i++)
{
- if (listsToCleanup[i] = pcbl)
+ if ((listsToCleanup[i] = pcbl) != 0)
{
listsToCleanup[i] = NULL;
break;
diff --git a/dix/events.c b/dix/events.c
index afadfe6a3..ce8e53f92 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.46 2002/09/17 01:15:09 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -45,6 +46,27 @@ SOFTWARE.
********************************************************/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
/* $Xorg: events.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
@@ -60,19 +82,33 @@ SOFTWARE.
#include "cursorstr.h"
#include "dixstruct.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#include "globals.h"
#ifdef XKB
#include "XKBsrv.h"
+#if NeedFunctionPrototypes
+extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
+#else
+extern Bool XkbFilterEvents();
+#endif
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
-extern WindowPtr *WindowTable;
+#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
-extern void (* EventSwapVector[128]) ();
+#include "dixevents.h"
+#include "dixgrabs.h"
+#include "dispatch.h"
#define EXTENSION_EVENT_BASE 64
@@ -106,6 +142,9 @@ extern void (* EventSwapVector[128]) ();
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
+#define XE_KBPTR (xE->u.keyButtonPointer)
+
+
#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
CallbackListPtr EventCallback;
@@ -148,13 +187,20 @@ static struct {
CursorPtr current;
BoxRec hotLimits; /* logical constraints of hot spot */
Bool confined; /* confined to screen */
-#ifdef SHAPE
+#if defined(SHAPE) || defined(PANORAMIX)
RegionPtr hotShape; /* additional logical shape constraint */
#endif
BoxRec physLimits; /* physical constraints of hot spot */
WindowPtr win; /* window of logical position */
HotSpot hot; /* logical pointer position */
HotSpot hotPhys; /* physical pointer position */
+#ifdef PANORAMIX
+ ScreenPtr screen; /* all others are in Screen 0 coordinates */
+ RegionRec Reg1; /* Region 1 for confining motion */
+ RegionRec Reg2; /* Region 2 for confining virtual motion */
+ WindowPtr windows[MAXSCREENS];
+ WindowPtr confineWin; /* confine window */
+#endif
} sprite; /* info about the cursor sprite */
static void DoEnterLeaveEvents(
@@ -172,27 +218,14 @@ static WindowPtr XYToWindow(
#endif
);
-void DeliverFocusedEvent();
-int DeliverDeviceEvents();
-void DoFocusEvents();
-Mask EventMaskForClient();
-Bool CheckDeviceGrabs();
-void EnqueueEvent();
+extern int lastEvent;
-extern GrabPtr CreateGrab(); /* Defined in grabs.c */
-extern Bool GrabMatchesSecond();
-extern Bool DeletePassiveGrabFromList();
-extern int AddPassiveGrabToList();
+static Mask lastEventMask;
-extern Bool permitOldBugs;
-extern Bool Must_have_memory;
-extern int lastEvent;
#ifdef XINPUT
-extern int DeviceMotionNotify, DeviceButtonPress, DeviceKeyPress;
+extern int DeviceMotionNotify;
#endif
-static Mask lastEventMask;
-
#define CantBeFiltered NoEventMask
static Mask filters[128] =
{
@@ -235,16 +268,331 @@ static Mask filters[128] =
static CARD8 criticalEvents[32] =
{
- 0x3c /* key and button events */
+ 0x7c /* key and button events */
};
-Mask
-GetNextEventMask()
+#ifdef PANORAMIX
+
+static void ConfineToShape(RegionPtr shape, int *px, int *py);
+static void SyntheticMotion(int x, int y);
+static void PostNewCursor(void);
+
+static Bool
+XineramaSetCursorPosition(
+ int x,
+ int y,
+ Bool generateEvent
+){
+ ScreenPtr pScreen;
+ BoxRec box;
+ int i;
+
+ /* x,y are in Screen 0 coordinates. We need to decide what Screen
+ to send the message too and what the coordinates relative to
+ that screen are. */
+
+ pScreen = sprite.screen;
+ x += panoramiXdataPtr[0].x;
+ y += panoramiXdataPtr[0].y;
+
+ if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
+ x, y, &box))
+ {
+ FOR_NSCREENS(i)
+ {
+ if(i == pScreen->myNum)
+ continue;
+ if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box))
+ {
+ pScreen = screenInfo.screens[i];
+ break;
+ }
+ }
+ }
+
+ sprite.screen = pScreen;
+ sprite.hotPhys.x = x - panoramiXdataPtr[0].x;
+ sprite.hotPhys.y = y - panoramiXdataPtr[0].y;
+ x -= panoramiXdataPtr[pScreen->myNum].x;
+ y -= panoramiXdataPtr[pScreen->myNum].y;
+
+ return (*pScreen->SetCursorPosition)(pScreen, x, y, generateEvent);
+}
+
+
+static void
+XineramaConstrainCursor(void)
{
- lastEventMask <<= 1;
- return lastEventMask;
+ ScreenPtr pScreen = sprite.screen;
+ BoxRec newBox = sprite.physLimits;
+
+ /* Translate the constraining box to the screen
+ the sprite is actually on */
+ newBox.x1 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
+ newBox.x2 += panoramiXdataPtr[0].x - panoramiXdataPtr[pScreen->myNum].x;
+ newBox.y1 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
+ newBox.y2 += panoramiXdataPtr[0].y - panoramiXdataPtr[pScreen->myNum].y;
+
+ (* pScreen->ConstrainCursor)(pScreen, &newBox);
}
+static void
+XineramaCheckPhysLimits(
+ CursorPtr cursor,
+ Bool generateEvents
+){
+ HotSpot new;
+
+ if (!cursor)
+ return;
+
+ new = sprite.hotPhys;
+
+ /* I don't care what the DDX has to say about it */
+ sprite.physLimits = sprite.hotLimits;
+
+ /* constrain the pointer to those limits */
+ if (new.x < sprite.physLimits.x1)
+ new.x = sprite.physLimits.x1;
+ else
+ if (new.x >= sprite.physLimits.x2)
+ new.x = sprite.physLimits.x2 - 1;
+ if (new.y < sprite.physLimits.y1)
+ new.y = sprite.physLimits.y1;
+ else
+ if (new.y >= sprite.physLimits.y2)
+ new.y = sprite.physLimits.y2 - 1;
+
+ if (sprite.hotShape) /* more work if the shape is a mess */
+ ConfineToShape(sprite.hotShape, &new.x, &new.y);
+
+ if((new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y))
+ {
+ XineramaSetCursorPosition (new.x, new.y, generateEvents);
+ if (!generateEvents)
+ SyntheticMotion(new.x, new.y);
+ }
+
+ /* Tell DDX what the limits are */
+ XineramaConstrainCursor();
+}
+
+
+static Bool
+XineramaSetWindowPntrs(WindowPtr pWin)
+{
+ if(pWin == WindowTable[0]) {
+ memcpy(sprite.windows, WindowTable,
+ PanoramiXNumScreens*sizeof(WindowPtr));
+ } else {
+ PanoramiXRes *win;
+ int i;
+
+ win = (PanoramiXRes*)LookupIDByType(pWin->drawable.id, XRT_WINDOW);
+
+ if(!win)
+ return FALSE;
+
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ sprite.windows[i] = LookupIDByType(win->info[i].id, RT_WINDOW);
+ if(!sprite.windows[i]) /* window is being unmapped */
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+static void
+XineramaCheckVirtualMotion(
+ QdEventPtr qe,
+ WindowPtr pWin
+){
+
+ if (qe)
+ {
+ sprite.hot.pScreen = qe->pScreen; /* should always be Screen 0 */
+ sprite.hot.x = qe->event->u.keyButtonPointer.rootX;
+ sprite.hot.y = qe->event->u.keyButtonPointer.rootY;
+ pWin = inputInfo.pointer->grab ? inputInfo.pointer->grab->confineTo :
+ NullWindow;
+ }
+ if (pWin)
+ {
+ int x, y, off_x, off_y, i;
+ BoxRec lims;
+
+ if(!XineramaSetWindowPntrs(pWin))
+ return;
+
+ i = PanoramiXNumScreens - 1;
+
+ REGION_COPY(sprite.screen, &sprite.Reg2,
+ &sprite.windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
+
+ if(x || y)
+ REGION_TRANSLATE(sprite.screen, &sprite.Reg2, x, y);
+
+ REGION_UNION(sprite.screen, &sprite.Reg2, &sprite.Reg2,
+ &sprite.windows[i]->borderSize);
+
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
+
+ lims = *REGION_EXTENTS(sprite.screen, &sprite.Reg2);
+
+ if (sprite.hot.x < lims.x1)
+ sprite.hot.x = lims.x1;
+ else if (sprite.hot.x >= lims.x2)
+ sprite.hot.x = lims.x2 - 1;
+ if (sprite.hot.y < lims.y1)
+ sprite.hot.y = lims.y1;
+ else if (sprite.hot.y >= lims.y2)
+ sprite.hot.y = lims.y2 - 1;
+
+ if (REGION_NUM_RECTS(&sprite.Reg2) > 1)
+ ConfineToShape(&sprite.Reg2, &sprite.hot.x, &sprite.hot.y);
+
+ if (qe)
+ {
+ qe->pScreen = sprite.hot.pScreen;
+ qe->event->u.keyButtonPointer.rootX = sprite.hot.x;
+ qe->event->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+ }
+}
+
+
+static Bool
+XineramaCheckMotion(xEvent *xE)
+{
+ WindowPtr prevSpriteWin = sprite.win;
+
+ if (xE && !syncEvents.playingEvents)
+ {
+ /* Motion events entering DIX get translated to Screen 0
+ coordinates. Replayed events have already been
+ translated since they've entered DIX before */
+ XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x -
+ panoramiXdataPtr[0].x;
+ XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
+ panoramiXdataPtr[0].y;
+
+ sprite.hot.x = XE_KBPTR.rootX;
+ sprite.hot.y = XE_KBPTR.rootY;
+ if (sprite.hot.x < sprite.physLimits.x1)
+ sprite.hot.x = sprite.physLimits.x1;
+ else if (sprite.hot.x >= sprite.physLimits.x2)
+ sprite.hot.x = sprite.physLimits.x2 - 1;
+ if (sprite.hot.y < sprite.physLimits.y1)
+ sprite.hot.y = sprite.physLimits.y1;
+ else if (sprite.hot.y >= sprite.physLimits.y2)
+ sprite.hot.y = sprite.physLimits.y2 - 1;
+
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
+
+ sprite.hotPhys = sprite.hot;
+ if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
+ (sprite.hotPhys.y != XE_KBPTR.rootY))
+ {
+ XineramaSetCursorPosition(
+ sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
+ }
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
+ }
+
+ sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
+
+ if (sprite.win != prevSpriteWin)
+ {
+ if (prevSpriteWin != NullWindow) {
+ if (!xE)
+ UpdateCurrentTimeIf();
+ DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal);
+ }
+ PostNewCursor();
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+static void
+XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents)
+{
+
+ if (syncEvents.playingEvents)
+ {
+ XineramaCheckVirtualMotion((QdEventPtr)NULL, pWin);
+ SyntheticMotion(sprite.hot.x, sprite.hot.y);
+ }
+ else
+ {
+ int x, y, off_x, off_y, i;
+
+ if(!XineramaSetWindowPntrs(pWin))
+ return;
+
+ i = PanoramiXNumScreens - 1;
+
+ REGION_COPY(sprite.screen, &sprite.Reg1,
+ &sprite.windows[i]->borderSize);
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+
+ while(i--) {
+ x = off_x - panoramiXdataPtr[i].x;
+ y = off_y - panoramiXdataPtr[i].y;
+
+ if(x || y)
+ REGION_TRANSLATE(sprite.screen, &sprite.Reg1, x, y);
+
+ REGION_UNION(sprite.screen, &sprite.Reg1, &sprite.Reg1,
+ &sprite.windows[i]->borderSize);
+
+ off_x = panoramiXdataPtr[i].x;
+ off_y = panoramiXdataPtr[i].y;
+ }
+
+ sprite.hotLimits = *REGION_EXTENTS(sprite.screen, &sprite.Reg1);
+
+ if(REGION_NUM_RECTS(&sprite.Reg1) > 1)
+ sprite.hotShape = &sprite.Reg1;
+ else
+ sprite.hotShape = NullRegion;
+
+ sprite.confined = FALSE;
+ sprite.confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
+
+ XineramaCheckPhysLimits(sprite.current, generateEvents);
+ }
+}
+
+
+static void
+XineramaChangeToCursor(CursorPtr cursor)
+{
+ if (cursor != sprite.current)
+ {
+ if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
+ (sprite.current->bits->yhot != cursor->bits->yhot))
+ XineramaCheckPhysLimits(cursor, FALSE);
+ (*sprite.screen->DisplayCursor)(sprite.screen, cursor);
+ sprite.current = cursor;
+ }
+}
+
+
+#endif /* PANORAMIX */
+
void
SetMaskForEvent(mask, event)
Mask mask;
@@ -265,11 +613,24 @@ SetCriticalEvent(event)
}
static void
+#if NeedFunctionPrototypes
+SyntheticMotion(int x, int y)
+#else
SyntheticMotion(x, y)
int x, y;
+#endif
{
xEvent xE;
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer */
+ if(!noPanoramiXExtension) {
+ x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x;
+ y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
+ }
+#endif
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
if (syncEvents.playingEvents)
@@ -282,9 +643,13 @@ SyntheticMotion(x, y)
#ifdef SHAPE
static void
+#if NeedFunctionPrototypes
+ConfineToShape(RegionPtr shape, int *px, int *py)
+#else
ConfineToShape(shape, px, py)
RegionPtr shape;
int *px, *py;
+#endif
{
BoxRec box;
int x = *px, y = *py;
@@ -321,11 +686,19 @@ ConfineToShape(shape, px, py)
#endif
static void
+#if NeedFunctionPrototypes
+CheckPhysLimits(
+ CursorPtr cursor,
+ Bool generateEvents,
+ Bool confineToScreen,
+ ScreenPtr pScreen)
+#else
CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
CursorPtr cursor;
Bool generateEvents;
Bool confineToScreen;
ScreenPtr pScreen;
+#endif
{
HotSpot new;
@@ -352,7 +725,7 @@ CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
new.y = sprite.physLimits.y2 - 1;
#ifdef SHAPE
if (sprite.hotShape)
- ConfineToShape(sprite.hotShape, &new.x, &new.y);
+ ConfineToShape(sprite.hotShape, &new.x, &new.y);
#endif
if ((pScreen != sprite.hotPhys.pScreen) ||
(new.x != sprite.hotPhys.x) || (new.y != sprite.hotPhys.y))
@@ -366,11 +739,22 @@ CheckPhysLimits(cursor, generateEvents, confineToScreen, pScreen)
}
static void
+#if NeedFunctionPrototypes
+CheckVirtualMotion(
+ register QdEventPtr qe,
+ register WindowPtr pWin)
+#else
CheckVirtualMotion(qe, pWin)
register QdEventPtr qe;
register WindowPtr pWin;
+#endif
{
-
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaCheckVirtualMotion(qe, pWin);
+ return;
+ }
+#endif
if (qe)
{
sprite.hot.pScreen = qe->pScreen;
@@ -411,14 +795,18 @@ CheckVirtualMotion(qe, pWin)
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
-void
-ConfineCursorToWindow(pWin, generateEvents, confineToScreen)
- WindowPtr pWin;
- Bool generateEvents;
- Bool confineToScreen;
+static void
+ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaConfineCursorToWindow(pWin, generateEvents);
+ return;
+ }
+#endif
+
if (syncEvents.playingEvents)
{
CheckVirtualMotion((QdEventPtr)NULL, pWin);
@@ -443,14 +831,25 @@ PointerConfinedToScreen()
}
static void
+#if NeedFunctionPrototypes
+ChangeToCursor(CursorPtr cursor)
+#else
ChangeToCursor(cursor)
CursorPtr cursor;
+#endif
{
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XineramaChangeToCursor(cursor);
+ return;
+ }
+#endif
+
if (cursor != sprite.current)
{
if ((sprite.current->bits->xhot != cursor->bits->xhot) ||
(sprite.current->bits->yhot != cursor->bits->yhot))
- CheckPhysLimits(cursor, FALSE, PointerConfinedToScreen(),
+ CheckPhysLimits(cursor, FALSE, sprite.confined,
(ScreenPtr)NULL);
(*sprite.hotPhys.pScreen->DisplayCursor) (sprite.hotPhys.pScreen,
cursor);
@@ -469,7 +868,11 @@ IsParent(a, b)
}
static void
+#if NeedFunctionPrototypes
+PostNewCursor(void)
+#else
PostNewCursor()
+#endif
{
register WindowPtr win;
register GrabPtr grab = inputInfo.pointer->grab;
@@ -524,20 +927,36 @@ GetSpritePosition(px, py)
*py = sprite.hotPhys.y;
}
+#ifdef PANORAMIX
+int
+XineramaGetCursorScreen()
+{
+ if(!noPanoramiXExtension) {
+ return sprite.screen->myNum;
+ } else {
+ return 0;
+ }
+}
+#endif /* PANORAMIX */
+
#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
static void
+#if NeedFunctionPrototypes
+MonthChangedOrBadTime(register xEvent *xE)
+#else
MonthChangedOrBadTime(xE)
register xEvent *xE;
+#endif
{
/* If the ddx/OS is careless about not processing timestamped events from
* different sources in sorted order, then it's possible for time to go
* backwards when it should not. Here we ensure a decent time.
*/
- if ((currentTime.milliseconds - xE->u.keyButtonPointer.time) > TIMESLOP)
+ if ((currentTime.milliseconds - XE_KBPTR.time) > TIMESLOP)
currentTime.months++;
else
- xE->u.keyButtonPointer.time = currentTime.milliseconds;
+ XE_KBPTR.time = currentTime.milliseconds;
}
#define NoticeTime(xE) { \
@@ -582,7 +1001,7 @@ EnqueueEvent(xE, device, count)
* updated yet.
*/
if (xE->u.u.type == MotionNotify)
- xE->u.keyButtonPointer.root =
+ XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
@@ -590,8 +1009,16 @@ EnqueueEvent(xE, device, count)
}
if (xE->u.u.type == MotionNotify)
{
- sprite.hotPhys.x = xE->u.keyButtonPointer.rootX;
- sprite.hotPhys.y = xE->u.keyButtonPointer.rootY;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ XE_KBPTR.rootX += panoramiXdataPtr[sprite.screen->myNum].x -
+ panoramiXdataPtr[0].x;
+ XE_KBPTR.rootY += panoramiXdataPtr[sprite.screen->myNum].y -
+ panoramiXdataPtr[0].y;
+ }
+#endif
+ sprite.hotPhys.x = XE_KBPTR.rootX;
+ sprite.hotPhys.y = XE_KBPTR.rootY;
/* do motion compression */
if (tail &&
(tail->event->u.u.type == MotionNotify) &&
@@ -599,7 +1026,7 @@ EnqueueEvent(xE, device, count)
{
tail->event->u.keyButtonPointer.rootX = sprite.hotPhys.x;
tail->event->u.keyButtonPointer.rootY = sprite.hotPhys.y;
- tail->event->u.keyButtonPointer.time = xE->u.keyButtonPointer.time;
+ tail->event->u.keyButtonPointer.time = XE_KBPTR.time;
tail->months = currentTime.months;
return;
}
@@ -621,7 +1048,11 @@ EnqueueEvent(xE, device, count)
}
static void
+#if NeedFunctionPrototypes
+PlayReleasedEvents(void)
+#else
PlayReleasedEvents()
+#endif
{
register QdEventPtr *prev, qe;
register DeviceIntPtr dev;
@@ -638,6 +1069,19 @@ PlayReleasedEvents()
CheckVirtualMotion(qe, NullWindow);
syncEvents.time.months = qe->months;
syncEvents.time.milliseconds = qe->event->u.keyButtonPointer.time;
+#ifdef PANORAMIX
+ /* Translate back to the sprite screen since processInputProc
+ will translate from sprite screen to screen 0 upon reentry
+ to the DIX layer */
+ if(!noPanoramiXExtension) {
+ qe->event->u.keyButtonPointer.rootX +=
+ panoramiXdataPtr[0].x -
+ panoramiXdataPtr[sprite.screen->myNum].x;
+ qe->event->u.keyButtonPointer.rootY +=
+ panoramiXdataPtr[0].y -
+ panoramiXdataPtr[sprite.screen->myNum].y;
+ }
+#endif
(*qe->device->public.processInputProc)(qe->event, qe->device,
qe->evcount);
xfree(qe);
@@ -655,9 +1099,13 @@ PlayReleasedEvents()
}
static void
+#if NeedFunctionPrototypes
+FreezeThaw(register DeviceIntPtr dev, Bool frozen)
+#else
FreezeThaw(dev, frozen)
register DeviceIntPtr dev;
Bool frozen;
+#endif
{
dev->sync.frozen = frozen;
if (frozen)
@@ -687,19 +1135,22 @@ ComputeFreezes()
xE = replayDev->sync.event;
count = replayDev->sync.evcount;
syncEvents.replayDev = (DeviceIntPtr)NULL;
- w = XYToWindow(
- xE->u.keyButtonPointer.rootX, xE->u.keyButtonPointer.rootY);
+
+ w = XYToWindow( XE_KBPTR.rootX, XE_KBPTR.rootY);
for (i = 0; i < spriteTraceGood; i++)
+ {
if (syncEvents.replayWin == spriteTrace[i])
{
- if (!CheckDeviceGrabs(replayDev, xE, i+1, count))
+ if (!CheckDeviceGrabs(replayDev, xE, i+1, count)) {
if (replayDev->focus)
DeliverFocusedEvent(replayDev, xE, w, count);
else
DeliverDeviceEvents(w, xE, NullGrab, NullWindow,
- replayDev, count);
+ replayDev, count);
+ }
goto playmore;
}
+ }
/* must not still be in the same stack */
if (replayDev->focus)
DeliverFocusedEvent(replayDev, xE, w, count);
@@ -729,6 +1180,24 @@ playmore:
PostNewCursor();
}
+#ifdef RANDR
+void
+ScreenRestructured (ScreenPtr pScreen)
+{
+ GrabPtr grab;
+
+ if ((grab = inputInfo.pointer->grab) && grab->confineTo)
+ {
+ if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen)
+ sprite.hotPhys.x = sprite.hotPhys.y = 0;
+ ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
+ }
+ else
+ ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum],
+ TRUE, FALSE);
+}
+#endif
+
void
CheckGrabForSyncs(thisDev, thisMode, otherMode)
register DeviceIntPtr thisDev;
@@ -793,8 +1262,7 @@ ActivatePointerGrab(mouse, grab, time, autoGrab)
mouse->grab = &mouse->activeGrab;
mouse->fromPassiveGrab = autoGrab;
PostNewCursor();
- CheckGrabForSyncs(mouse,
- (Bool)grab->pointerMode, (Bool)grab->keyboardMode);
+ CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
}
void
@@ -849,8 +1317,7 @@ ActivateKeyboardGrab(keybd, grab, time, passive)
keybd->activeGrab = *grab;
keybd->grab = &keybd->activeGrab;
keybd->fromPassiveGrab = passive;
- CheckGrabForSyncs(keybd,
- (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
+ CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
}
void
@@ -1092,6 +1559,7 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
{
#ifdef DEBUG
if (debug_events) ErrorF("\n");
+ fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
#endif
return 1; /* don't send, but pretend we did */
}
@@ -1106,7 +1574,8 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
else
{
if ((type == DeviceMotionNotify) &&
- MaybeSendDeviceMotionNotifyHint (pEvents, mask) != 0)
+ MaybeSendDeviceMotionNotifyHint
+ ((deviceKeyButtonPointer*)pEvents, mask) != 0)
return 1;
}
#endif
@@ -1119,7 +1588,13 @@ TryClientEvents (client, pEvents, count, mask, filter, grab)
}
if (BitIsOn(criticalEvents, type))
+ {
+#ifdef SMART_SCHEDULE
+ if (client->smart_priority < SMART_MAX_PRIORITY)
+ client->smart_priority++;
+#endif
SetCriticalOutputPending();
+ }
WriteEventsToClient(client, count, pEvents);
#ifdef DEBUG
@@ -1149,7 +1624,7 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
int attempt;
register InputClients *other;
ClientPtr client = NullClient;
- Mask deliveryMask; /* If a grab occurs due to a button press, then
+ Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
this mask is the mask of the grab. */
int type = pEvents->u.u.type;
@@ -1224,8 +1699,9 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
{
if (((type == DeviceMotionNotify) || (type == DeviceButtonPress)) &&
deliveries)
- CheckDeviceGrabAndHintWindow (pWin, type, pEvents, grab, client,
- deliveryMask);
+ CheckDeviceGrabAndHintWindow (pWin, type,
+ (deviceKeyButtonPointer*) pEvents,
+ grab, client, deliveryMask);
}
#endif
if (deliveries)
@@ -1238,6 +1714,24 @@ DeliverEventsToWindow(pWin, pEvents, count, filter, grab, mskidx)
Only works for core events.
*/
+#ifdef PANORAMIX
+static int
+XineramaTryClientEventsResult(
+ ClientPtr client,
+ GrabPtr grab,
+ Mask mask,
+ Mask filter
+){
+ if ((client) && (client != serverClient) && (!client->clientGone) &&
+ ((filter == CantBeFiltered) || (mask & filter)))
+ {
+ if (grab && !SameClient(grab, client)) return -1;
+ else return 1;
+ }
+ return 0;
+}
+#endif
+
int
MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
register WindowPtr pWin;
@@ -1248,10 +1742,16 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
{
register OtherClients *other;
+
if (pWin->eventMask & filter)
{
if (wClient(pWin) == dontClient)
return 0;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(
+ wClient(pWin), NullGrab, pWin->eventMask, filter);
+#endif
return TryClientEvents(wClient(pWin), pEvents, count,
pWin->eventMask, filter, NullGrab);
}
@@ -1261,6 +1761,11 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
{
if (SameClient(other, dontClient))
return 0;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return XineramaTryClientEventsResult(
+ rClient(other), NullGrab, other->mask, filter);
+#endif
return TryClientEvents(rClient(other), pEvents, count,
other->mask, filter, NullGrab);
}
@@ -1269,16 +1774,23 @@ MaybeDeliverEventsToClient(pWin, pEvents, count, filter, dontClient)
}
static void
+#if NeedFunctionPrototypes
+FixUpEventFromWindow(
+ xEvent *xE,
+ WindowPtr pWin,
+ Window child,
+ Bool calcChild)
+#else
FixUpEventFromWindow(xE, pWin, child, calcChild)
xEvent *xE;
WindowPtr pWin;
Window child;
Bool calcChild;
+#endif
{
if (calcChild)
{
WindowPtr w=spriteTrace[spriteTraceGood-1];
-
/* If the search ends up past the root should the child field be
set to none or should the value in the argument be passed
through. It probably doesn't matter since everyone calls
@@ -1303,23 +1815,23 @@ FixUpEventFromWindow(xE, pWin, child, calcChild)
w = w->parent;
}
}
- xE->u.keyButtonPointer.root = ROOT->drawable.id;
- xE->u.keyButtonPointer.event = pWin->drawable.id;
+ XE_KBPTR.root = ROOT->drawable.id;
+ XE_KBPTR.event = pWin->drawable.id;
if (sprite.hot.pScreen == pWin->drawable.pScreen)
{
- xE->u.keyButtonPointer.sameScreen = xTrue;
- xE->u.keyButtonPointer.child = child;
- xE->u.keyButtonPointer.eventX =
- xE->u.keyButtonPointer.rootX - pWin->drawable.x;
- xE->u.keyButtonPointer.eventY =
- xE->u.keyButtonPointer.rootY - pWin->drawable.y;
+ XE_KBPTR.sameScreen = xTrue;
+ XE_KBPTR.child = child;
+ XE_KBPTR.eventX =
+ XE_KBPTR.rootX - pWin->drawable.x;
+ XE_KBPTR.eventY =
+ XE_KBPTR.rootY - pWin->drawable.y;
}
else
{
- xE->u.keyButtonPointer.sameScreen = xFalse;
- xE->u.keyButtonPointer.child = None;
- xE->u.keyButtonPointer.eventX = 0;
- xE->u.keyButtonPointer.eventY = 0;
+ XE_KBPTR.sameScreen = xFalse;
+ XE_KBPTR.child = None;
+ XE_KBPTR.eventX = 0;
+ XE_KBPTR.eventY = 0;
}
}
@@ -1400,6 +1912,11 @@ DeliverEvents(pWin, xE, count, otherParent)
Mask filter;
int deliveries;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
+ return count;
+#endif
+
if (!count)
return 0;
filter = filters[xE->u.u.type];
@@ -1426,14 +1943,41 @@ DeliverEvents(pWin, xE, count, otherParent)
return deliveries;
}
+
+static Bool
+PointInBorderSize(WindowPtr pWin, int x, int y)
+{
+ BoxRec box;
+
+ if(POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box))
+ return TRUE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) {
+ int i;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ if(POINT_IN_REGION(sprite.screen,
+ &sprite.windows[i]->borderSize,
+ x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x,
+ y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y,
+ &box))
+ return TRUE;
+ }
+ }
+#endif
+ return FALSE;
+}
+
static WindowPtr
+#if NeedFunctionPrototypes
+XYToWindow(int x, int y)
+#else
XYToWindow(x, y)
int x, y;
+#endif
{
register WindowPtr pWin;
-#ifdef SHAPE
- BoxRec box;
-#endif
spriteTraceGood = 1; /* root window still there */
pWin = ROOT->firstChild;
@@ -1451,9 +1995,7 @@ XYToWindow(x, y)
* is made to see if the point is inside
* borderSize
*/
- && (!wBoundingShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
- &pWin->borderSize, x, y, &box))
+ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
#endif
)
{
@@ -1475,11 +2017,20 @@ XYToWindow(x, y)
}
static Bool
+#if NeedFunctionPrototypes
+CheckMotion(xEvent *xE)
+#else
CheckMotion(xE)
xEvent *xE;
+#endif
{
WindowPtr prevSpriteWin = sprite.win;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ return XineramaCheckMotion(xE);
+#endif
+
if (xE && !syncEvents.playingEvents)
{
if (sprite.hot.pScreen != sprite.hotPhys.pScreen)
@@ -1487,8 +2038,8 @@ CheckMotion(xE)
sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum];
}
- sprite.hot.x = xE->u.keyButtonPointer.rootX;
- sprite.hot.y = xE->u.keyButtonPointer.rootY;
+ sprite.hot.x = XE_KBPTR.rootX;
+ sprite.hot.y = XE_KBPTR.rootY;
if (sprite.hot.x < sprite.physLimits.x1)
sprite.hot.x = sprite.physLimits.x1;
else if (sprite.hot.x >= sprite.physLimits.x2)
@@ -1502,13 +2053,15 @@ CheckMotion(xE)
ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y);
#endif
sprite.hotPhys = sprite.hot;
- if ((sprite.hotPhys.x != xE->u.keyButtonPointer.rootX) ||
- (sprite.hotPhys.y != xE->u.keyButtonPointer.rootY))
+ if ((sprite.hotPhys.x != XE_KBPTR.rootX) ||
+ (sprite.hotPhys.y != XE_KBPTR.rootY))
+ {
(*sprite.hotPhys.pScreen->SetCursorPosition)(
sprite.hotPhys.pScreen,
sprite.hotPhys.x, sprite.hotPhys.y, FALSE);
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ }
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
}
sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y);
@@ -1561,6 +2114,21 @@ DefineInitialRootWindow(win)
(*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits);
(*pScreen->SetCursorPosition) (pScreen, sprite.hot.x, sprite.hot.y, FALSE);
(*pScreen->DisplayCursor) (pScreen, sprite.current);
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ sprite.hotLimits.x1 = -panoramiXdataPtr[0].x;
+ sprite.hotLimits.y1 = -panoramiXdataPtr[0].y;
+ sprite.hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x;
+ sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
+ sprite.physLimits = sprite.hotLimits;
+ sprite.confineWin = NullWindow;
+ sprite.screen = pScreen;
+ /* gotta UNINIT these someplace */
+ REGION_INIT(pScreen, &sprite.Reg1, NullBox, 1);
+ REGION_INIT(pScreen, &sprite.Reg2, NullBox, 1);
+ }
+#endif
}
/*
@@ -1585,10 +2153,144 @@ NewCurrentScreen(newScreen, x, y)
{
sprite.hotPhys.x = x;
sprite.hotPhys.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ sprite.hotPhys.x += panoramiXdataPtr[newScreen->myNum].x -
+ panoramiXdataPtr[0].x;
+ sprite.hotPhys.y += panoramiXdataPtr[newScreen->myNum].y -
+ panoramiXdataPtr[0].y;
+ if (newScreen != sprite.screen) {
+ sprite.screen = newScreen;
+ /* Make sure we tell the DDX to update its copy of the screen */
+ if(sprite.confineWin)
+ XineramaConfineCursorToWindow(sprite.confineWin, TRUE);
+ else
+ XineramaConfineCursorToWindow(WindowTable[0], TRUE);
+ /* if the pointer wasn't confined, the DDX won't get
+ told of the pointer warp so we reposition it here */
+ if(!syncEvents.playingEvents)
+ (*sprite.screen->SetCursorPosition)(sprite.screen,
+ sprite.hotPhys.x + panoramiXdataPtr[0].x -
+ panoramiXdataPtr[sprite.screen->myNum].x,
+ sprite.hotPhys.y + panoramiXdataPtr[0].y -
+ panoramiXdataPtr[sprite.screen->myNum].y, FALSE);
+ }
+ } else
+#endif
if (newScreen != sprite.hotPhys.pScreen)
ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE);
}
+#ifdef PANORAMIX
+
+static Bool
+XineramaPointInWindowIsVisible(
+ WindowPtr pWin,
+ int x,
+ int y
+)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ BoxRec box;
+ int i, xoff, yoff;
+
+ if (!pWin->realized) return FALSE;
+
+ if (POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
+ return TRUE;
+
+ if(!XineramaSetWindowPntrs(pWin)) return FALSE;
+
+ xoff = x + panoramiXdataPtr[0].x;
+ yoff = y + panoramiXdataPtr[0].y;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ pWin = sprite.windows[i];
+ pScreen = pWin->drawable.pScreen;
+ x = xoff - panoramiXdataPtr[i].x;
+ y = yoff - panoramiXdataPtr[i].y;
+
+ if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box))
+ return TRUE;
+
+ }
+
+ return FALSE;
+}
+
+static int
+XineramaWarpPointer(ClientPtr client)
+{
+ WindowPtr dest = NULL;
+ int x, y;
+
+ REQUEST(xWarpPointerReq);
+
+
+ if (stuff->dstWid != None)
+ {
+ dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
+ if (!dest)
+ return BadWindow;
+ }
+ x = sprite.hotPhys.x;
+ y = sprite.hotPhys.y;
+
+ if (stuff->srcWid != None)
+ {
+ int winX, winY;
+ XID winID = stuff->srcWid;
+ WindowPtr source;
+
+ source = SecurityLookupWindow(winID, client, SecurityReadAccess);
+ if (!source) return BadWindow;
+
+ winX = source->drawable.x;
+ winY = source->drawable.y;
+ if(source == WindowTable[0]) {
+ winX -= panoramiXdataPtr[0].x;
+ winY -= panoramiXdataPtr[0].y;
+ }
+ if (x < winX + stuff->srcX ||
+ y < winY + stuff->srcY ||
+ (stuff->srcWidth != 0 &&
+ winX + stuff->srcX + (int)stuff->srcWidth < x) ||
+ (stuff->srcHeight != 0 &&
+ winY + stuff->srcY + (int)stuff->srcHeight < y) ||
+ !XineramaPointInWindowIsVisible(source, x, y))
+ return Success;
+ }
+ if (dest) {
+ x = dest->drawable.x;
+ y = dest->drawable.y;
+ if(dest == WindowTable[0]) {
+ x -= panoramiXdataPtr[0].x;
+ y -= panoramiXdataPtr[0].y;
+ }
+ }
+
+ x += stuff->dstX;
+ y += stuff->dstY;
+
+ if (x < sprite.physLimits.x1)
+ x = sprite.physLimits.x1;
+ else if (x >= sprite.physLimits.x2)
+ x = sprite.physLimits.x2 - 1;
+ if (y < sprite.physLimits.y1)
+ y = sprite.physLimits.y1;
+ else if (y >= sprite.physLimits.y2)
+ y = sprite.physLimits.y2 - 1;
+ if (sprite.hotShape)
+ ConfineToShape(sprite.hotShape, &x, &y);
+
+ XineramaSetCursorPosition(x, y, TRUE);
+
+ return Success;
+}
+
+#endif
+
+
int
ProcWarpPointer(client)
ClientPtr client;
@@ -1600,6 +2302,12 @@ ProcWarpPointer(client)
REQUEST(xWarpPointerReq);
REQUEST_SIZE_MATCH(xWarpPointerReq);
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ return XineramaWarpPointer(client);
+#endif
+
if (stuff->dstWid != None)
{
dest = SecurityLookupWindow(stuff->dstWid, client, SecurityReadAccess);
@@ -1608,13 +2316,16 @@ ProcWarpPointer(client)
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
+
if (stuff->srcWid != None)
{
int winX, winY;
- WindowPtr source = SecurityLookupWindow(stuff->srcWid, client,
- SecurityReadAccess);
- if (!source)
- return BadWindow;
+ XID winID = stuff->srcWid;
+ WindowPtr source;
+
+ source = SecurityLookupWindow(winID, client, SecurityReadAccess);
+ if (!source) return BadWindow;
+
winX = source->drawable.x;
winY = source->drawable.y;
if (source->drawable.pScreen != sprite.hotPhys.pScreen ||
@@ -1627,16 +2338,17 @@ ProcWarpPointer(client)
!PointInWindowIsVisible(source, x, y))
return Success;
}
- if (dest)
+ if (dest)
{
x = dest->drawable.x;
y = dest->drawable.y;
newScreen = dest->drawable.pScreen;
- }
- else
+ } else
newScreen = sprite.hotPhys.pScreen;
+
x += stuff->dstX;
y += stuff->dstY;
+
if (x < 0)
x = 0;
else if (x >= newScreen->width)
@@ -1656,7 +2368,7 @@ ProcWarpPointer(client)
y = sprite.physLimits.y1;
else if (y >= sprite.physLimits.y2)
y = sprite.physLimits.y2 - 1;
-#ifdef SHAPE
+#if defined(SHAPE)
if (sprite.hotShape)
ConfineToShape(sprite.hotShape, &x, &y);
#endif
@@ -1669,15 +2381,42 @@ ProcWarpPointer(client)
return Success;
}
+static Bool
+BorderSizeNotEmpty(WindowPtr pWin)
+{
+ if(REGION_NOTEMPTY(sprite.hotPhys.pScreen, &pWin->borderSize))
+ return TRUE;
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && XineramaSetWindowPntrs(pWin)) {
+ int i;
+
+ for(i = 1; i < PanoramiXNumScreens; i++) {
+ if(REGION_NOTEMPTY(sprite.screen, &sprite.windows[i]->borderSize))
+ return TRUE;
+ }
+ }
+#endif
+ return FALSE;
+}
+
/* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
passive grab set on the window to be activated. */
static Bool
+#if NeedFunctionPrototypes
+CheckPassiveGrabsOnWindow(
+ WindowPtr pWin,
+ register DeviceIntPtr device,
+ register xEvent *xE,
+ int count)
+#else
CheckPassiveGrabsOnWindow(pWin, device, xE, count)
WindowPtr pWin;
register DeviceIntPtr device;
register xEvent *xE;
int count;
+#endif
{
register GrabPtr grab = wPassiveGrabs(pWin);
GrabRec tempGrab;
@@ -1722,9 +2461,8 @@ CheckPassiveGrabsOnWindow(pWin, device, xE, count)
#endif
if (GrabMatchesSecond(&tempGrab, grab) &&
(!grab->confineTo ||
- (grab->confineTo->realized &&
- REGION_NOTEMPTY( grab->confineTo->drawable.pScreen,
- &grab->confineTo->borderSize))))
+ (grab->confineTo->realized &&
+ BorderSizeNotEmpty(grab->confineTo))))
{
#ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(wClient(pWin), device, FALSE))
@@ -1732,8 +2470,8 @@ CheckPassiveGrabsOnWindow(pWin, device, xE, count)
#endif
#ifdef XKB
if (!noXkbExtension) {
- xE->u.keyButtonPointer.state &= 0x1f00;
- xE->u.keyButtonPointer.state |=
+ XE_KBPTR.state &= 0x1f00;
+ XE_KBPTR.state |=
tempGrab.modifiersDetail.exact&(~0x1f00);
}
#endif
@@ -1787,7 +2525,7 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
int count;
{
register int i;
- register WindowPtr pWin;
+ register WindowPtr pWin = NULL;
register FocusClassPtr focus = device->focus;
if ((xE->u.u.type == ButtonPress
@@ -1814,7 +2552,7 @@ CheckDeviceGrabs(device, xE, checkFirst, count)
((i > checkFirst) && (pWin != spriteTrace[i-1])))
return FALSE;
}
-
+
for (; i < spriteTraceGood; i++)
{
pWin = spriteTrace[i];
@@ -1973,10 +2711,9 @@ ProcessKeyboardEvent (xE, keybd, count)
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
}
}
- xE->u.keyButtonPointer.state = (keyc->state |
- inputInfo.pointer->button->state);
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ XE_KBPTR.state = (keyc->state | inputInfo.pointer->button->state);
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
key = xE->u.u.detail;
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
@@ -2053,6 +2790,44 @@ ProcessKeyboardEvent (xE, keybd, count)
(*keybd->DeactivateGrab)(keybd);
}
+#ifdef XKB
+/* This function is used to set the key pressed or key released state -
+ this is only used when the pressing of keys does not cause
+ CoreProcessKeyEvent to be called, as in for example Mouse Keys.
+*/
+void
+FixKeyState (xE, keybd)
+ register xEvent *xE;
+ register DeviceIntPtr keybd;
+{
+ int key, bit;
+ register BYTE *kptr;
+ register KeyClassPtr keyc = keybd->key;
+
+ key = xE->u.u.detail;
+ kptr = &keyc->down[key >> 3];
+ bit = 1 << (key & 7);
+#ifdef DEBUG
+ if ((xkbDebugFlags&0x4)&&
+ ((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
+ ErrorF("FixKeyState: Key %d %s\n",key,
+ (xE->u.u.type==KeyPress?"down":"up"));
+ }
+#endif
+ switch (xE->u.u.type)
+ {
+ case KeyPress:
+ *kptr |= bit;
+ break;
+ case KeyRelease:
+ *kptr &= ~bit;
+ break;
+ default:
+ FatalError("Impossible keyboard event");
+ }
+}
+#endif
+
void
#ifdef XKB
CoreProcessPointerEvent (xE, mouse, count)
@@ -2072,7 +2847,7 @@ ProcessPointerEvent (xE, mouse, count)
if (!syncEvents.playingEvents)
NoticeTime(xE)
- xE->u.keyButtonPointer.state = (butc->state | (
+ XE_KBPTR.state = (butc->state | (
#ifdef XKB
(noXkbExtension ?
inputInfo.keyboard->key->state :
@@ -2088,7 +2863,7 @@ ProcessPointerEvent (xE, mouse, count)
DeviceEventInfoRec eventinfo;
/* see comment in EnqueueEvents regarding the next three lines */
if (xE->u.u.type == MotionNotify)
- xE->u.keyButtonPointer.root =
+ XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
@@ -2101,8 +2876,9 @@ ProcessPointerEvent (xE, mouse, count)
register BYTE *kptr;
int bit;
- xE->u.keyButtonPointer.rootX = sprite.hot.x;
- xE->u.keyButtonPointer.rootY = sprite.hot.y;
+ XE_KBPTR.rootX = sprite.hot.x;
+ XE_KBPTR.rootY = sprite.hot.y;
+
key = xE->u.u.detail;
kptr = &butc->down[key >> 3];
bit = 1 << (key & 7);
@@ -2110,10 +2886,13 @@ ProcessPointerEvent (xE, mouse, count)
{
case ButtonPress:
mouse->valuator->motionHintWindow = NullWindow;
- butc->buttonsDown++;
+ if (!(*kptr & bit))
+ butc->buttonsDown++;
butc->motionMask = ButtonMotionMask;
*kptr |= bit;
+#if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key];
+#endif
if (xE->u.u.detail == 0)
return;
if (xE->u.u.detail <= 5)
@@ -2125,10 +2904,14 @@ ProcessPointerEvent (xE, mouse, count)
break;
case ButtonRelease:
mouse->valuator->motionHintWindow = NullWindow;
- if (!--butc->buttonsDown)
+ if (*kptr & bit)
+ --butc->buttonsDown;
+ if (!butc->buttonsDown)
butc->motionMask = 0;
*kptr &= ~bit;
+#if !defined(XFree86Server) || !defined(XINPUT)
xE->u.u.detail = butc->map[key];
+#endif
if (xE->u.u.detail == 0)
return;
if (xE->u.u.detail <= 5)
@@ -2256,7 +3039,7 @@ EventSelectForWindow(pWin, client, mask)
if (wClient (pWin) == client)
{
check = pWin->eventMask;
-#if SGIMISC
+#ifdef SGIMISC
pWin->eventMask =
(mask & ~SGIMiscSpecialDestroyMask) | (pWin->eventMask & SGIMiscSpecialDestroyMask);
#else
@@ -2270,7 +3053,7 @@ EventSelectForWindow(pWin, client, mask)
if (SameClient(others, client))
{
check = others->mask;
-#if SGIMISC
+#ifdef SGIMISC
mask = (mask & ~SGIMiscSpecialDestroyMask) | (others->mask & SGIMiscSpecialDestroyMask);
#endif
if (mask == 0)
@@ -2367,8 +3150,14 @@ EventSuppressForWindow(pWin, client, mask, checkOptional)
}
static WindowPtr
+#if NeedFunctionPrototypes
+CommonAncestor(
+ register WindowPtr a,
+ register WindowPtr b)
+#else
CommonAncestor(a, b)
register WindowPtr a, b;
+#endif
{
for (b = b->parent; b; b = b->parent)
if (IsParent(b, a)) return b;
@@ -2376,10 +3165,19 @@ CommonAncestor(a, b)
}
static void
+#if NeedFunctionPrototypes
+EnterLeaveEvent(
+ int type,
+ int mode,
+ int detail,
+ register WindowPtr pWin,
+ Window child)
+#else
EnterLeaveEvent(type, mode, detail, pWin, child)
int type, mode, detail;
register WindowPtr pWin;
Window child;
+#endif
{
xEvent event;
register DeviceIntPtr keybd = inputInfo.keyboard;
@@ -2460,9 +3258,13 @@ EnterLeaveEvent(type, mode, detail, pWin, child)
}
static void
+#if NeedFunctionPrototypes
+EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
+#else
EnterNotifies(ancestor, child, mode, detail)
WindowPtr ancestor, child;
int mode, detail;
+#endif
{
WindowPtr parent = child->parent;
@@ -2473,9 +3275,13 @@ EnterNotifies(ancestor, child, mode, detail)
}
static void
+#if NeedFunctionPrototypes
+LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
+#else
LeaveNotifies(child, ancestor, mode, detail)
WindowPtr child, ancestor;
int detail, mode;
+#endif
{
register WindowPtr pWin;
@@ -2489,9 +3295,13 @@ LeaveNotifies(child, ancestor, mode, detail)
}
static void
+#if NeedFunctionPrototypes
+DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
+#else
DoEnterLeaveEvents(fromWin, toWin, mode)
WindowPtr fromWin, toWin;
int mode;
+#endif
{
if (fromWin == toWin)
return;
@@ -2519,10 +3329,14 @@ DoEnterLeaveEvents(fromWin, toWin, mode)
}
static void
+#if NeedFunctionPrototypes
+FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin)
+#else
FocusEvent(dev, type, mode, detail, pWin)
DeviceIntPtr dev;
int type, mode, detail;
register WindowPtr pWin;
+#endif
{
xEvent event;
@@ -2563,11 +3377,19 @@ FocusEvent(dev, type, mode, detail, pWin)
* no-op if child not descended from ancestor
*/
static Bool
+#if NeedFunctionPrototypes
+FocusInEvents(
+ DeviceIntPtr dev,
+ WindowPtr ancestor, WindowPtr child, WindowPtr skipChild,
+ int mode, int detail,
+ Bool doAncestor)
+#else
FocusInEvents(dev, ancestor, child, skipChild, mode, detail, doAncestor)
DeviceIntPtr dev;
WindowPtr ancestor, child, skipChild;
int mode, detail;
Bool doAncestor;
+#endif
{
if (child == NullWindow)
return ancestor == NullWindow;
@@ -2589,12 +3411,20 @@ FocusInEvents(dev, ancestor, child, skipChild, mode, detail, doAncestor)
/* dies horribly if ancestor is not an ancestor of child */
static void
+#if NeedFunctionPrototypes
+FocusOutEvents(
+ DeviceIntPtr dev,
+ WindowPtr child, WindowPtr ancestor,
+ int mode, int detail,
+ Bool doAncestor)
+#else
FocusOutEvents(dev, child, ancestor, mode, detail, doAncestor)
DeviceIntPtr dev;
WindowPtr child, ancestor;
int mode;
int detail;
Bool doAncestor;
+#endif
{
register WindowPtr pWin;
@@ -2628,8 +3458,13 @@ DoFocusEvents(dev, fromWin, toWin, mode)
FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer,
TRUE);
/* Notify all the roots */
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[0]);
+ else
+#endif
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
}
else
{
@@ -2642,8 +3477,13 @@ DoFocusEvents(dev, fromWin, toWin, mode)
NotifyNonlinearVirtual, FALSE);
}
/* Notify all the roots */
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusIn, mode, in, WindowTable[0]);
+ else
+#endif
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusIn, mode, in, WindowTable[i]);
if (toWin == PointerRootWin)
(void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode,
NotifyPointer, TRUE);
@@ -2655,8 +3495,13 @@ DoFocusEvents(dev, fromWin, toWin, mode)
if (fromWin == PointerRootWin)
FocusOutEvents(dev, sprite.win, ROOT, mode, NotifyPointer,
TRUE);
- for (i=0; i<screenInfo.numScreens; i++)
- FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[0]);
+ else
+#endif
+ for (i=0; i<screenInfo.numScreens; i++)
+ FocusEvent(dev, FocusOut, mode, out, WindowTable[i]);
if (toWin->parent != NullWindow)
(void)FocusInEvents(dev, ROOT, toWin, toWin, mode,
NotifyNonlinearVirtual, TRUE);
@@ -2719,6 +3564,15 @@ DoFocusEvents(dev, fromWin, toWin, mode)
}
int
+#if NeedFunctionPrototypes
+SetInputFocus(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ Window focusID,
+ CARD8 revertTo,
+ Time ctime,
+ Bool followOK)
+#else
SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
ClientPtr client;
DeviceIntPtr dev;
@@ -2726,6 +3580,7 @@ SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
CARD8 revertTo;
Time ctime;
Bool followOK;
+#endif
{
register FocusClassPtr focus;
register WindowPtr focusWin;
@@ -2743,7 +3598,7 @@ SetInputFocus(client, dev, focusID, revertTo, ctime, followOK)
}
time = ClientTimeToServerTime(ctime);
if ((focusID == None) || (focusID == PointerRoot))
- focusWin = (WindowPtr)focusID;
+ focusWin = (WindowPtr)(long)focusID;
else if ((focusID == FollowKeyboard) && followOK)
focusWin = inputInfo.keyboard->focus->win;
else if (!(focusWin = SecurityLookupWindow(focusID, client,
@@ -2816,7 +3671,7 @@ ProcGetInputFocus(client)
ClientPtr client;
{
xGetInputFocusReply rep;
- REQUEST(xReq);
+ /* REQUEST(xReq); */
FocusClassPtr focus = inputInfo.keyboard->focus;
REQUEST_SIZE_MATCH(xReq);
@@ -2874,7 +3729,7 @@ ProcGrabPointer(client)
return BadWindow;
if (stuff->confineTo == None)
confineTo = NullWindow;
- else
+ else
{
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
@@ -2902,10 +3757,8 @@ ProcGrabPointer(client)
if ((grab) && !SameClient(grab, client))
rep.status = AlreadyGrabbed;
else if ((!pWin->realized) ||
- (confineTo &&
- !(confineTo->realized &&
- REGION_NOTEMPTY( confineTo->drawable.pScreen,
- &confineTo->borderSize))))
+ (confineTo &&
+ !(confineTo->realized && BorderSizeNotEmpty(confineTo))))
rep.status = GrabNotViewable;
else if (device->sync.frozen &&
device->sync.other && !SameClient(device->sync.other, client))
@@ -3165,6 +4018,18 @@ ProcQueryPointer(client)
rep.winX = 0;
rep.winY = 0;
}
+
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ rep.rootX += panoramiXdataPtr[0].x;
+ rep.rootY += panoramiXdataPtr[0].y;
+ if(stuff->id == rep.root) {
+ rep.winX += panoramiXdataPtr[0].x;
+ rep.winY += panoramiXdataPtr[0].y;
+ }
+ }
+#endif
+
WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep);
return(Success);
@@ -3220,6 +4085,14 @@ InitEvents()
}
}
+void
+CloseDownEvents(void)
+{
+ xfree(spriteTrace);
+ spriteTrace = NULL;
+ spriteTraceSize = 0;
+}
+
int
ProcSendEvent(client)
ClientPtr client;
@@ -3322,6 +4195,7 @@ ProcUngrabKey(client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
+
if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
(stuff->key < keybd->key->curKeySyms.minKeyCode))
&& (stuff->key != AnyKey))
@@ -3335,7 +4209,6 @@ ProcUngrabKey(client)
client->errorValue = stuff->modifiers;
return BadValue;
}
-
tempGrab.resource = client->clientAsMask;
tempGrab.device = keybd;
tempGrab.window = pWin;
@@ -3398,12 +4271,14 @@ ProcGrabKey(client)
grab = CreateGrab(client->index, keybd, pWin,
(Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
(Bool)stuff->keyboardMode, (Bool)stuff->pointerMode,
- keybd, stuff->modifiers, KeyPress, stuff->key, NullWindow, NullCursor);
+ keybd, stuff->modifiers, KeyPress, stuff->key,
+ NullWindow, NullCursor);
if (!grab)
return BadAlloc;
return AddPassiveGrabToList(grab);
}
+
int
ProcGrabButton(client)
ClientPtr client;
@@ -3446,9 +4321,8 @@ ProcGrabButton(client)
if (!pWin)
return BadWindow;
if (stuff->confineTo == None)
- confineTo = NullWindow;
- else
- {
+ confineTo = NullWindow;
+ else {
confineTo = SecurityLookupWindow(stuff->confineTo, client,
SecurityReadAccess);
if (!confineTo)
@@ -3467,8 +4341,9 @@ ProcGrabButton(client)
}
}
+
grab = CreateGrab(client->index, inputInfo.pointer, pWin,
- permitOldBugs ? (Mask)(stuff->eventMask |
+ permitOldBugs ? (Mask)(stuff->eventMask |
ButtonPressMask | ButtonReleaseMask) :
(Mask)stuff->eventMask,
(Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode,
@@ -3497,7 +4372,6 @@ ProcUngrabButton(client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin)
return BadWindow;
-
tempGrab.resource = client->clientAsMask;
tempGrab.device = inputInfo.pointer;
tempGrab.window = pWin;
@@ -3613,10 +4487,13 @@ CheckCursorConfinement(pWin)
GrabPtr grab = inputInfo.pointer->grab;
WindowPtr confineTo;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return;
+#endif
+
if (grab && (confineTo = grab->confineTo))
{
- if (!REGION_NOTEMPTY( confineTo->drawable.pScreen,
- &confineTo->borderSize))
+ if (!BorderSizeNotEmpty(confineTo))
(*inputInfo.pointer->DeactivateGrab)(inputInfo.pointer);
else if ((pWin == confineTo) || IsParent(pWin, confineTo))
ConfineCursorToWindow(confineTo, TRUE, TRUE);
@@ -3647,6 +4524,7 @@ ProcRecolorCursor(client)
CursorPtr pCursor;
int nscr;
ScreenPtr pscr;
+ Bool displayed;
REQUEST(xRecolorCursorReq);
REQUEST_SIZE_MATCH(xRecolorCursorReq);
@@ -3669,9 +4547,14 @@ ProcRecolorCursor(client)
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
{
pscr = screenInfo.screens[nscr];
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension)
+ displayed = (pscr == sprite.screen);
+ else
+#endif
+ displayed = (pscr == sprite.hotPhys.pScreen);
( *pscr->RecolorCursor)(pscr, pCursor,
- (pCursor == sprite.current) &&
- (pscr == sprite.hotPhys.pScreen));
+ (pCursor == sprite.current) && displayed);
}
return (Success);
}
@@ -3682,6 +4565,9 @@ WriteEventsToClient(pClient, count, events)
int count;
xEvent *events;
{
+#ifdef PANORAMIX
+ xEvent eventCopy;
+#endif
xEvent eventTo, *eventFrom;
int i;
@@ -3690,6 +4576,40 @@ WriteEventsToClient(pClient, count, events)
return;
#endif
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension &&
+ (panoramiXdataPtr[0].x || panoramiXdataPtr[0].y))
+ {
+ switch(events->u.u.type) {
+ case MotionNotify:
+ case ButtonPress:
+ case ButtonRelease:
+ case KeyPress:
+ case KeyRelease:
+ case EnterNotify:
+ case LeaveNotify:
+ /*
+ When multiple clients want the same event DeliverEventsToWindow
+ passes the same event structure multiple times so we can't
+ modify the one passed to us
+ */
+ count = 1; /* should always be 1 */
+ memcpy(&eventCopy, events, sizeof(xEvent));
+ eventCopy.u.keyButtonPointer.rootX += panoramiXdataPtr[0].x;
+ eventCopy.u.keyButtonPointer.rootY += panoramiXdataPtr[0].y;
+ if(eventCopy.u.keyButtonPointer.event ==
+ eventCopy.u.keyButtonPointer.root)
+ {
+ eventCopy.u.keyButtonPointer.eventX += panoramiXdataPtr[0].x;
+ eventCopy.u.keyButtonPointer.eventY += panoramiXdataPtr[0].y;
+ }
+ events = &eventCopy;
+ break;
+ default: break;
+ }
+ }
+#endif
+
if (EventCallback)
{
EventInfoRec eventinfo;
diff --git a/dix/extension.c b/dix/extension.c
index 00c6b158d..36f053f02 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/extension.c,v 3.12 2002/02/19 11:09:22 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -47,6 +48,7 @@ SOFTWARE.
/* $Xorg: extension.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
#include "X.h"
+#define NEED_EVENTS
#define NEED_REPLIES
#include "Xproto.h"
#include "misc.h"
@@ -54,9 +56,13 @@ SOFTWARE.
#include "extnsionst.h"
#include "gcstruct.h"
#include "scrnintstr.h"
+#include "dispatch.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
#endif
#define EXTENSION_BASE 128
@@ -72,15 +78,12 @@ int lastEvent = EXTENSION_EVENT_BASE;
static int lastError = FirstExtensionError;
static unsigned int NumExtensions = 0;
-ExtensionEntry *AddExtension(name, NumEvents, NumErrors, MainProc,
- SwappedMainProc, CloseDownProc, MinorOpcodeProc)
- char *name;
- int NumEvents;
- int NumErrors;
- int (* MainProc)();
- int (* SwappedMainProc)();
- void (* CloseDownProc)();
- unsigned short (* MinorOpcodeProc)();
+ExtensionEntry *
+AddExtension(char *name, int NumEvents, int NumErrors,
+ int (*MainProc)(ClientPtr c1),
+ int (*SwappedMainProc)(ClientPtr c2),
+ void (*CloseDownProc)(ExtensionEntry *e),
+ unsigned short (*MinorOpcodeProc)(ClientPtr c3))
{
int i;
register ExtensionEntry *ext, **newexts;
@@ -179,9 +182,7 @@ Bool AddExtensionAlias(alias, ext)
}
static int
-FindExtension(extname, len)
- char *extname;
- int len;
+FindExtension(char *extname, int len)
{
int i, j;
@@ -201,6 +202,22 @@ FindExtension(extname, len)
return ((i == NumExtensions) ? -1 : i);
}
+/*
+ * CheckExtension returns the extensions[] entry for the requested
+ * extension name. Maybe this could just return a Bool instead?
+ */
+ExtensionEntry *
+CheckExtension(const char *extname)
+{
+ int n;
+
+ n = FindExtension((char*)extname, strlen(extname));
+ if (n != -1)
+ return extensions[n];
+ else
+ return NULL;
+}
+
void
DeclareExtensionSecurity(extname, secure)
char *extname;
@@ -337,7 +354,6 @@ ProcListExtensions(client)
char *bufptr, *buffer;
int total_length = 0;
- REQUEST(xReq);
REQUEST_SIZE_MATCH(xReq);
reply.type = X_Reply;
diff --git a/dix/gc.c b/dix/gc.c
index e8ce161e8..6ab685d6c 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/gc.c,v 3.9 2001/12/14 19:59:32 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -62,6 +63,7 @@ SOFTWARE.
#include <assert.h>
extern XID clientErrorValue;
+extern FontPtr defaultFont;
static Bool CreateDefaultTile(
#if NeedFunctionPrototypes
@@ -97,14 +99,16 @@ ValidateGC(pDraw, pGC)
* or pUnion, but not both; one of them must be NULL. If you don't need
* to pass any pointers, you can use either one:
*
- * /* example calling dixChangeGC using pC32 parameter
+ * example calling dixChangeGC using pC32 parameter
+ *
* CARD32 v[2];
* v[0] = foreground;
* v[1] = background;
* dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL);
*
- * /* example calling dixChangeGC using pUnion parameter;
- * /* same effect as above
+ * example calling dixChangeGC using pUnion parameter;
+ * same effect as above
+ *
* ChangeGCVal v[2];
* v[0].val = foreground;
* v[1].val = background;
@@ -113,10 +117,12 @@ ValidateGC(pDraw, pGC)
* However, if you need to pass a pointer to a pixmap or font, you MUST
* use the pUnion parameter.
*
- * /* example calling dixChangeGC passing pointers in the value list
+ * example calling dixChangeGC passing pointers in the value list
+ * v[1].ptr is a pointer to a pixmap
+ *
* ChangeGCVal v[2];
* v[0].val = FillTiled;
- * v[1].ptr = pPixmap; /* pointer to a pixmap
+ * v[1].ptr = pPixmap;
* dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v);
*
* Note: we could have gotten by with just the pUnion parameter, but on
@@ -149,7 +155,7 @@ dixChangeGC(client, pGC, mask, pC32, pUnion)
CARD32 *pC32;
ChangeGCValPtr pUnion;
{
- register BITS32 index;
+ register BITS32 index2;
register int error = 0;
PixmapPtr pPixmap;
BITS32 maskQ;
@@ -160,10 +166,10 @@ dixChangeGC(client, pGC, mask, pC32, pUnion)
maskQ = mask; /* save these for when we walk the GCque */
while (mask && !error)
{
- index = (BITS32) lowbit (mask);
- mask &= ~index;
- pGC->stateChanges |= index;
- switch (index)
+ index2 = (BITS32) lowbit (mask);
+ mask &= ~index2;
+ pGC->stateChanges |= index2;
+ switch (index2)
{
case GCFunction:
{
@@ -402,8 +408,8 @@ dixChangeGC(client, pGC, mask, pC32, pUnion)
break;
case GCClipMask:
{
- Pixmap pid;
- int clipType;
+ Pixmap pid = 0;
+ int clipType = 0;
if (pUnion)
{
@@ -562,9 +568,9 @@ DoChangeGC(pGC, mask, pval, fPointer)
{
if (fPointer)
/* XXX might be a problem on 64 bit big-endian servers */
- dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval);
+ return dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval);
else
- dixChangeGC(NullClient, pGC, mask, pval, NULL);
+ return dixChangeGC(NullClient, pGC, mask, pval, NULL);
}
@@ -579,8 +585,12 @@ BUG:
*/
static GCPtr
+#if NeedFunctionPrototypes
+AllocateGC(ScreenPtr pScreen)
+#else
AllocateGC(pScreen)
ScreenPtr pScreen;
+#endif
{
GCPtr pGC;
register char *ptr;
@@ -618,7 +628,6 @@ CreateGC(pDrawable, mask, pval, pStatus)
int *pStatus;
{
register GCPtr pGC;
- extern FontPtr defaultFont;
pGC = AllocateGC(pDrawable->pScreen);
if (!pGC)
@@ -678,7 +687,7 @@ CreateGC(pDrawable, mask, pval, pStatus)
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
pGC->stipple->refcnt++;
- pGC->stateChanges = (1 << GCLastBit+1) - 1;
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
if (!(*pGC->pScreen->CreateGC)(pGC))
*pStatus = BadAlloc;
else if (mask)
@@ -746,7 +755,7 @@ CopyGC(pgcSrc, pgcDst, mask)
register GC *pgcDst;
register BITS32 mask;
{
- register BITS32 index;
+ register BITS32 index2;
BITS32 maskQ;
int error = 0;
@@ -757,9 +766,9 @@ CopyGC(pgcSrc, pgcDst, mask)
maskQ = mask;
while (mask)
{
- index = (BITS32) lowbit (mask);
- mask &= ~index;
- switch (index)
+ index2 = (BITS32) lowbit (mask);
+ mask &= ~index2;
+ switch (index2)
{
case GCFunction:
pgcDst->alu = pgcSrc->alu;
@@ -963,7 +972,6 @@ CreateScratchGC(pScreen, depth)
unsigned depth;
{
register GCPtr pGC;
- extern FontPtr defaultFont;
pGC = AllocateGC(pScreen);
if (!pGC)
@@ -1003,7 +1011,7 @@ CreateScratchGC(pScreen, depth)
pGC->lastWinOrg.x = 0;
pGC->lastWinOrg.y = 0;
- pGC->stateChanges = (1 << GCLastBit+1) - 1;
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
if (!(*pScreen->CreateGC)(pGC))
{
FreeGC(pGC, (XID)0);
@@ -1296,7 +1304,7 @@ GetScratchGC(depth, pScreen)
pGC->clipOrg.y = 0;
if (pGC->clientClipType != CT_NONE)
(*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
- pGC->stateChanges = (1 << GCLastBit+1) - 1;
+ pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
return pGC;
}
/* if we make it this far, need to roll our own */
diff --git a/dix/globals.c b/dix/globals.c
index fe45f64cd..3051ebbbb 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/globals.c,v 1.10 2002/10/08 23:55:18 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -90,18 +91,22 @@ CARD32 ScreenSaverInterval;
int ScreenSaverBlanking;
int ScreenSaverAllowExposures;
+#ifdef DPMSExtension
#define DEFAULT_STANDBY_TIME DEFAULT_SCREEN_SAVER_TIME * 2
#define DEFAULT_SUSPEND_TIME DEFAULT_SCREEN_SAVER_TIME * 3
#define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4
-#ifdef DPMSExtension
-CARD32 DPMSStandbyTime = DEFAULT_STANDBY_TIME;
-CARD32 DPMSSuspendTime = DEFAULT_SUSPEND_TIME;
-CARD32 DPMSOffTime = DEFAULT_OFF_TIME;
+CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME;
+CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME;
+CARD32 defaultDPMSOffTime = DEFAULT_OFF_TIME;
CARD16 DPMSPowerLevel = 0;
-BOOL DPMSEnabled = FALSE;
-BOOL DPMSEnabledSwitch = FALSE; /* these denote the DPMS command line */
-BOOL DPMSDisabledSwitch = FALSE; /* switch states */
-BOOL DPMSCapableFlag = FALSE;
+Bool defaultDPMSEnabled = FALSE;
+Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command line */
+Bool DPMSDisabledSwitch = FALSE; /* switch states */
+Bool DPMSCapableFlag = FALSE;
+CARD32 DPMSStandbyTime;
+CARD32 DPMSSuspendTime;
+CARD32 DPMSOffTime;
+Bool DPMSEnabled;
#endif
CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
@@ -119,7 +124,9 @@ char *rgbPath = RGB_DB;
char *defaultDisplayClass = COMPILEDDISPLAYCLASS;
FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
every compilation of dix code */
+Bool loadableFonts = FALSE;
CursorPtr rootCursor;
+Bool blackRoot=FALSE;
ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */
TimeStamp currentTime;
@@ -137,3 +144,5 @@ char *display;
CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
int argcGlobal;
char **argvGlobal;
+
+DDXPointRec dixScreenOrigins[MAXSCREENS];
diff --git a/dix/grabs.c b/dix/grabs.c
index 80422f53f..bebbd3bec 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -46,6 +46,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
*/
+/* $XFree86: xc/programs/Xserver/dix/grabs.c,v 3.4 2002/02/19 11:09:22 alanh Exp $ */
#include "X.h"
#include "misc.h"
@@ -54,8 +55,7 @@ SOFTWARE.
#include "windowstr.h"
#include "inputstr.h"
#include "cursorstr.h"
-
-extern InputInfo inputInfo;
+#include "dixgrabs.h"
#define BITMASK(i) (((Mask)1) << ((i) & 31))
#define MASKIDX(i) ((i) >> 5)
@@ -65,6 +65,20 @@ extern InputInfo inputInfo;
#define GETBIT(buf, i) (MASKWORD(buf, i) & BITMASK(i))
GrabPtr
+#if NeedFunctionPrototypes
+CreateGrab(
+ int client,
+ DeviceIntPtr device,
+ WindowPtr window,
+ Mask eventMask,
+ Bool ownerEvents, Bool keyboardMode, Bool pointerMode,
+ DeviceIntPtr modDevice,
+ unsigned short modifiers,
+ int type,
+ KeyCode keybut, /* key or button */
+ WindowPtr confineTo,
+ CursorPtr cursor)
+#else
CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode,
pointerMode, modDevice, modifiers, type, keybut, confineTo, cursor)
int client;
@@ -78,6 +92,7 @@ CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode,
KeyCode keybut; /* key or button */
WindowPtr confineTo;
CursorPtr cursor;
+#endif
{
GrabPtr grab;
@@ -110,8 +125,12 @@ CreateGrab(client, device, window, eventMask, ownerEvents, keyboardMode,
}
static void
+#if NeedFunctionPrototypes
+FreeGrab(GrabPtr pGrab)
+#else
FreeGrab(pGrab)
GrabPtr pGrab;
+#endif
{
if (pGrab->modifiersDetail.pMask != NULL)
xfree(pGrab->modifiersDetail.pMask);
@@ -154,9 +173,13 @@ DeletePassiveGrab(value, id)
}
static Mask *
+#if NeedFunctionPrototypes
+DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail)
+#else
DeleteDetailFromMask(pDetailMask, detail)
Mask *pDetailMask;
unsigned short detail;
+#endif
{
register Mask *mask;
register int i;
@@ -176,9 +199,16 @@ DeleteDetailFromMask(pDetailMask, detail)
}
static Bool
+#if NeedFunctionPrototypes
+IsInGrabMask(
+ DetailRec firstDetail,
+ DetailRec secondDetail,
+ unsigned short exception)
+#else
IsInGrabMask(firstDetail, secondDetail, exception)
DetailRec firstDetail, secondDetail;
unsigned short exception;
+#endif
{
if (firstDetail.exact == exception)
{
@@ -197,8 +227,15 @@ IsInGrabMask(firstDetail, secondDetail, exception)
}
static Bool
+#if NeedFunctionPrototypes
+IdenticalExactDetails(
+ unsigned short firstExact,
+ unsigned short secondExact,
+ unsigned short exception)
+#else
IdenticalExactDetails(firstExact, secondExact, exception)
unsigned short firstExact, secondExact, exception;
+#endif
{
if ((firstExact == exception) || (secondExact == exception))
return FALSE;
@@ -210,9 +247,16 @@ IdenticalExactDetails(firstExact, secondExact, exception)
}
static Bool
+#if NeedFunctionPrototypes
+DetailSupersedesSecond(
+ DetailRec firstDetail,
+ DetailRec secondDetail,
+ unsigned short exception)
+#else
DetailSupersedesSecond(firstDetail, secondDetail, exception)
DetailRec firstDetail, secondDetail;
unsigned short exception;
+#endif
{
if (IsInGrabMask(firstDetail, secondDetail, exception))
return TRUE;
@@ -225,8 +269,12 @@ DetailSupersedesSecond(firstDetail, secondDetail, exception)
}
static Bool
+#if NeedFunctionPrototypes
+GrabSupersedesSecond(GrabPtr pFirstGrab, GrabPtr pSecondGrab)
+#else
GrabSupersedesSecond(pFirstGrab, pSecondGrab)
GrabPtr pFirstGrab, pSecondGrab;
+#endif
{
if (!DetailSupersedesSecond(pFirstGrab->modifiersDetail,
pSecondGrab->modifiersDetail,
diff --git a/dix/initatoms.c b/dix/initatoms.c
index f1734a734..7aadd909a 100644
--- a/dix/initatoms.c
+++ b/dix/initatoms.c
@@ -5,8 +5,9 @@
#include "X.h"
#include "Xatom.h"
-extern Atom MakeAtom();
-MakePredeclaredAtoms()
+#include "misc.h"
+#include "dix.h"
+void MakePredeclaredAtoms()
{
if (MakeAtom("PRIMARY", 7, 1) != XA_PRIMARY) AtomError();
if (MakeAtom("SECONDARY", 9, 1) != XA_SECONDARY) AtomError();
diff --git a/dix/main.c b/dix/main.c
index 5b50ea94f..a31f33d8a 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.40 2003/02/17 16:55:31 dawes Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -46,6 +47,31 @@ SOFTWARE.
******************************************************************/
/* $Xorg: main.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $TOG: main.c /main/86 1998/02/09 14:20:03 kaleb $ */
+
+#define NEED_EVENTS
#include "X.h"
#include "Xos.h" /* for unistd.h */
#include "Xproto.h"
@@ -65,20 +91,20 @@ SOFTWARE.
#include "servermd.h"
#include "site.h"
#include "dixfont.h"
-
-extern CARD32 defaultScreenSaverTime;
-extern CARD32 defaultScreenSaverInterval;
-extern int defaultScreenSaverBlanking;
-extern int defaultScreenSaverAllowExposures;
+#include "extnsionst.h"
+#ifdef PANORAMIX
+#include "panoramiXsrv.h"
+#else
+#include "dixevents.h" /* InitEvents() */
+#include "dispatch.h" /* InitProcVectors() */
+#endif
#ifdef DPMSExtension
+#define DPMS_SERVER
#include "dpms.h"
-extern BOOL DPMSCapableFlag;
-extern BOOL DPMSEnabled;
+#include "dpmsproc.h"
#endif
-void ddxGiveUp();
-
extern int InitClientPrivates(
#if NeedFunctionPrototypes
ClientPtr /*client*/
@@ -91,47 +117,46 @@ extern void Dispatch(
#endif
);
-extern char *display;
char *ConnectionInfo;
xConnSetupPrefix connSetupPrefix;
-extern WindowPtr *WindowTable;
extern FontPtr defaultFont;
extern int screenPrivateCount;
-extern void InitProcVectors();
-extern void InitEvents();
-extern void DefineInitialRootWindow();
-extern Bool CreateGCperDepthArray();
+extern void InitProcVectors(void);
+extern Bool CreateGCperDepthArray(void);
-static Bool CreateConnectionBlock(
-#if NeedFunctionPrototypes
- void
+#ifndef PANORAMIX
+static
#endif
-);
+Bool CreateConnectionBlock(void);
-static void FreeScreen(
-#if NeedFunctionPrototypes
- ScreenPtr /*pScreen*/
-#endif
-);
+static void FreeScreen(ScreenPtr);
PaddingInfo PixmapWidthPaddingInfo[33];
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
-/* add padding info for 32-bit interface. PutImage and GetImage will
- * work on 32-bit padding while the rest of the server will work
- * on 64-bit padding (Alpha).
- */
-PaddingInfo PixmapWidthPaddingInfoProto[33];
-#endif
-
int connBlockScreenStart;
static int restart = 0;
void
-NotImplemented()
+NotImplemented(xEvent *from, xEvent *to)
+{
+ FatalError("Not implemented");
+}
+
+/*
+ * Dummy entry for ReplySwapVector[]
+ */
+/*ARGSUSED*/
+void
+ReplyNotSwappd(
+#if NeedNestedPrototypes
+ ClientPtr pClient ,
+ int size ,
+ void * pbuf
+#endif
+ )
{
FatalError("Not implemented");
}
@@ -171,6 +196,22 @@ static int indexForBitsPerPixel[ 33 ] = {
};
/*
+ * This array gives the bytesperPixel value for cases where the number
+ * of bits per pixel is a multiple of 8 but not a power of 2.
+ */
+static int answerBytesPerPixel[ 33 ] = {
+ ~0, 0, ~0, ~0, /* 1 bit per pixel */
+ 0, ~0, ~0, ~0, /* 4 bits per pixel */
+ 0, ~0, ~0, ~0, /* 8 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0, ~0, ~0, ~0, /* 16 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 3, ~0, ~0, ~0, /* 24 bits per pixel */
+ ~0,~0, ~0, ~0,
+ 0 /* 32 bits per pixel */
+};
+
+/*
* This array gives the answer to the question "what is the second index for
* the answer array above given the number of bits per scanline pad unit?"
* Note that ~0 is an invalid entry (mostly for the benefit of the reader).
@@ -200,37 +241,47 @@ static int indexForScanlinePad[ 65 ] = {
#endif
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[], char *envp[])
{
- int i, j, k;
+ int i, j, k, error;
+ char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
- /* Notice if we're restart. Probably this is because we jumped through
- * uninitialized pointer */
+ display = "0";
+
+ /* Quartz support on Mac OS X requires that the Cocoa event loop be in
+ * the main thread. This allows the X server main to be called again
+ * from another thread. */
+#if defined(__DARWIN__) && defined(DARWIN_WITH_QUARTZ)
+ DarwinHandleGUI(argc, argv, envp);
+#endif
+
+ /* Notice if we're restarted. Probably this is because we jumped through
+ * an uninitialized pointer */
if (restart)
FatalError("server restarted. Jumped through uninitialized pointer?\n");
else
restart = 1;
+ CheckUserParameters(argc, argv, envp);
+
+ CheckUserAuthorization();
+
#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
ExpandCommandLine(&argc, &argv);
#endif
-#ifdef _SC_OPEN_MAX
- /* if sysconf(_SC_OPEN_MAX) is supported, at runtime MaxClients will be
- * reassigned instead of using MAXSOCKS */
- if (MaxClients == 0)
- MaxClients = MIN(MAXCLIENTS, sysconf(_SC_OPEN_MAX));
-#endif
+ InitConnectionLimits();
/* These are needed by some routines which are called from interrupt
* handlers, thus have no direct calling path back to main and thus
* can't be passed argc, argv as parameters */
argcGlobal = argc;
argvGlobal = argv;
- display = "0";
+ /* prep X authority file from environment; this can be overriden by a
+ * command line option */
+ xauthfile = getenv("XAUTHORITY");
+ if (xauthfile) InitAuthorization (xauthfile);
ProcessCommandLine(argc, argv);
alwaysCheckForInput[0] = 0;
@@ -238,10 +289,17 @@ main(argc, argv)
while(1)
{
serverGeneration++;
- ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverTime = defaultScreenSaverTime;
ScreenSaverInterval = defaultScreenSaverInterval;
ScreenSaverBlanking = defaultScreenSaverBlanking;
ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+#ifdef DPMSExtension
+ DPMSStandbyTime = defaultDPMSStandbyTime;
+ DPMSSuspendTime = defaultDPMSSuspendTime;
+ DPMSOffTime = defaultDPMSOffTime;
+ DPMSEnabled = defaultDPMSEnabled;
+ DPMSPowerLevel = 0;
+#endif
InitBlockAndWakeupHandlers();
/* Perform any operating system dependent initializations you'd like */
OsInit();
@@ -284,18 +342,7 @@ main(argc, argv)
PixmapWidthPaddingInfo[1].padPixelsLog2 = answer[j][k];
j = indexForBitsPerPixel[8]; /* bits per byte */
PixmapWidthPaddingInfo[1].padBytesLog2 = answer[j][k];
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* Fake out protocol interface to make them believe we support
- * a different padding than the actual internal padding.
- */
- j = indexForBitsPerPixel[ 1 ];
- k = indexForScanlinePad[ BITMAP_SCANLINE_PAD_PROTO ];
- PixmapWidthPaddingInfoProto[1].padRoundUp = BITMAP_SCANLINE_PAD_PROTO-1;
- PixmapWidthPaddingInfoProto[1].padPixelsLog2 = answer[j][k];
- j = indexForBitsPerPixel[8]; /* bits per byte */
- PixmapWidthPaddingInfoProto[1].padBytesLog2 = answer[j][k];
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+ PixmapWidthPaddingInfo[1].bitsPerPixel = 1;
InitAtoms();
InitEvents();
@@ -310,6 +357,7 @@ main(argc, argv)
ResetColormapPrivates();
ResetFontPrivateIndex();
InitCallbackManager();
+ InitVisualWrap();
InitOutput(&screenInfo, argc, argv);
if (screenInfo.numScreens < 1)
FatalError("no screens found");
@@ -341,8 +389,13 @@ main(argc, argv)
FatalError("failed to initialize core devices");
InitFonts();
- if (SetDefaultFontPath(defaultFontPath) != Success)
- ErrorF("failed to set default font path '%s'", defaultFontPath);
+ if (loadableFonts) {
+ SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error);
+ } else {
+ if (SetDefaultFontPath(defaultFontPath) != Success)
+ ErrorF("failed to set default font path '%s'",
+ defaultFontPath);
+ }
if (!SetDefaultFont(defaultTextFont))
FatalError("could not open default font '%s'", defaultTextFont);
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0)))
@@ -354,12 +407,30 @@ main(argc, argv)
if (!DPMSCapableFlag)
DPMSEnabled = FALSE;
#endif
+
+#ifdef PANORAMIX
+ /*
+ * Consolidate window and colourmap information for each screen
+ */
+ if (!noPanoramiXExtension)
+ PanoramiXConsolidate();
+#endif
+
for (i = 0; i < screenInfo.numScreens; i++)
InitRootWindow(WindowTable[i]);
DefineInitialRootWindow(WindowTable[0]);
+ SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
- if (!CreateConnectionBlock())
- FatalError("could not create connection block info");
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension) {
+ if (!PanoramiXCreateConnectionBlock())
+ FatalError("could not create connection block info");
+ } else
+#endif
+ {
+ if (!CreateConnectionBlock())
+ FatalError("could not create connection block info");
+ }
Dispatch();
@@ -367,7 +438,18 @@ main(argc, argv)
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
CloseDownExtensions();
+
+#ifdef PANORAMIX
+ {
+ Bool remember_it = noPanoramiXExtension;
+ noPanoramiXExtension = TRUE;
+ FreeAllResources();
+ noPanoramiXExtension = remember_it;
+ }
+#else
FreeAllResources();
+#endif
+
CloseDownDevices();
for (i = screenInfo.numScreens - 1; i >= 0; i--)
{
@@ -378,24 +460,34 @@ main(argc, argv)
FreeScreen(screenInfo.screens[i]);
screenInfo.numScreens = i;
}
+ CloseDownEvents();
xfree(WindowTable);
+ WindowTable = NULL;
FreeFonts ();
+
xfree(serverClient->devPrivates);
+ serverClient->devPrivates = NULL;
if (dispatchException & DE_TERMINATE)
{
+ CloseWellKnownConnections();
+ OsCleanup();
ddxGiveUp();
break;
}
xfree(ConnectionInfo);
+ ConnectionInfo = NULL;
}
return(0);
}
static int padlength[4] = {0, 3, 2, 1};
-static Bool
+#ifndef PANORAMIX
+static
+#endif
+Bool
CreateConnectionBlock()
{
xConnSetup setup;
@@ -419,18 +511,8 @@ CreateConnectionBlock()
*/
setup.imageByteOrder = screenInfo.imageByteOrder;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ( screenInfo.bitmapScanlineUnit > 32 )
- setup.bitmapScanlineUnit = 32;
- else
-#endif
- setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ( screenInfo.bitmapScanlinePad > 32 )
- setup.bitmapScanlinePad = 32;
- else
-#endif
- setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad;
+ setup.bitmapScanlineUnit = screenInfo.bitmapScanlineUnit;
+ setup.bitmapScanlinePad = screenInfo.bitmapScanlinePad;
setup.bitmapBitOrder = screenInfo.bitmapBitOrder;
setup.motionBufferSize = NumMotionEvents();
@@ -464,12 +546,7 @@ CreateConnectionBlock()
{
format.depth = screenInfo.formats[i].depth;
format.bitsPerPixel = screenInfo.formats[i].bitsPerPixel;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ( screenInfo.formats[i].scanlinePad > 32 )
- format.scanLinePad = 32;
- else
-#endif
- format.scanLinePad = screenInfo.formats[i].scanlinePad;
+ format.scanLinePad = screenInfo.formats[i].scanlinePad;
memmove(pBuf, (char *)&format, sizeof(xPixmapFormat));
pBuf += sizeof(xPixmapFormat);
sizesofar += sizeof(xPixmapFormat);
@@ -557,10 +634,24 @@ with its screen number, a pointer to its ScreenRec, argc, and argv.
*/
int
+#if NeedFunctionPrototypes
+AddScreen(
+ Bool (* pfnInit)(
+#if NeedNestedPrototypes
+ int /*index*/,
+ ScreenPtr /*pScreen*/,
+ int /*argc*/,
+ char ** /*argv*/
+#endif
+ ),
+ int argc,
+ char **argv)
+#else
AddScreen(pfnInit, argc, argv)
Bool (* pfnInit)();
int argc;
char **argv;
+#endif
{
int i;
@@ -578,8 +669,8 @@ AddScreen(pfnInit, argc, argv)
if (!pScreen)
return -1;
- pScreen->devPrivates = (DevUnion *)xalloc(screenPrivateCount *
- sizeof(DevUnion));
+ pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion),
+ screenPrivateCount);
if (!pScreen->devPrivates && screenPrivateCount)
{
xfree(pScreen);
@@ -588,17 +679,19 @@ AddScreen(pfnInit, argc, argv)
pScreen->myNum = i;
pScreen->WindowPrivateLen = 0;
pScreen->WindowPrivateSizes = (unsigned *)NULL;
- pScreen->totalWindowSize = sizeof(WindowRec);
+ pScreen->totalWindowSize =
+ ((sizeof(WindowRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
pScreen->GCPrivateLen = 0;
pScreen->GCPrivateSizes = (unsigned *)NULL;
- pScreen->totalGCSize = sizeof(GC);
+ pScreen->totalGCSize =
+ ((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
#ifdef PIXPRIV
pScreen->PixmapPrivateLen = 0;
pScreen->PixmapPrivateSizes = (unsigned *)NULL;
- pScreen->totalPixmapSize = sizeof(PixmapRec);
+ pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
#endif
- pScreen->ClipNotify = (void (*)())NULL; /* for R4 ddx compatibility */
- pScreen->CreateScreenResources = (Bool (*)())NULL;
+ pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
+ pScreen->CreateScreenResources = 0;
#ifdef DEBUG
for (jNI = &pScreen->QueryBestSize;
@@ -628,19 +721,17 @@ AddScreen(pfnInit, argc, argv)
(scanlinepad/bitsPerPixel) - 1;
j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
PixmapWidthPaddingInfo[ depth ].padBytesLog2 = answer[j][k];
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* Fake out protocol interface to make them believe we support
- * a different padding than the actual internal padding.
- */
- j = indexForBitsPerPixel[ bitsPerPixel ];
- k = indexForScanlinePad[ BITMAP_SCANLINE_PAD_PROTO ];
- PixmapWidthPaddingInfoProto[ depth ].padPixelsLog2 = answer[j][k];
- PixmapWidthPaddingInfoProto[ depth ].padRoundUp =
- (BITMAP_SCANLINE_PAD_PROTO/bitsPerPixel) - 1;
- j = indexForBitsPerPixel[ 8 ]; /* bits per byte */
- PixmapWidthPaddingInfoProto[ depth ].padBytesLog2 = answer[j][k];
-#endif /* INTERNAL_VS_EXTERNAL_PADDING */
+ PixmapWidthPaddingInfo[ depth ].bitsPerPixel = bitsPerPixel;
+ if (answerBytesPerPixel[bitsPerPixel])
+ {
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 1;
+ PixmapWidthPaddingInfo[ depth ].bytesPerPixel =
+ answerBytesPerPixel[bitsPerPixel];
+ }
+ else
+ {
+ PixmapWidthPaddingInfo[ depth ].notPower2 = 0;
+ }
}
/* This is where screen specific stuff gets initialized. Load the
diff --git a/dix/pixmap.c b/dix/pixmap.c
index b65559f6e..fda07801c 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/dix/pixmap.c,v 3.5 2001/12/14 19:59:32 dawes Exp $ */
#include "X.h"
#include "scrnintstr.h"
@@ -65,10 +66,12 @@ GetScratchPixmapHeader(pScreen, width, height, depth, bitsPerPixel, devKind,
/* width and height of 0 means don't allocate any pixmap data */
pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, depth);
- if (pPixmap)
+ if (pPixmap) {
if ((*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
bitsPerPixel, devKind, pPixData))
return pPixmap;
+ (*pScreen->DestroyPixmap)(pPixmap);
+ }
return NullPixmap;
}
@@ -132,7 +135,7 @@ AllocatePixmap(pScreen, pixDataSize)
ptr = (char *)(ppriv + pScreen->PixmapPrivateLen);
for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++)
{
- if (size = *sizes)
+ if ((size = *sizes) != 0)
{
ppriv->ptr = (pointer)ptr;
ptr += size;
diff --git a/dix/privates.c b/dix/privates.c
index a252dbce9..2d0885846 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/dix/privates.c,v 3.8 2001/12/14 19:59:32 dawes Exp $ */
#include "X.h"
#include "scrnintstr.h"
@@ -61,8 +62,8 @@ ResetClientPrivates()
clientPrivateLen = 0;
xfree(clientPrivateSizes);
clientPrivateSizes = (unsigned *)NULL;
- totalClientSize = sizeof(ClientRec);
-
+ totalClientSize =
+ ((sizeof(ClientRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
}
int
@@ -72,30 +73,33 @@ AllocateClientPrivateIndex()
}
Bool
-AllocateClientPrivate(index, amount)
- int index;
+AllocateClientPrivate(index2, amount)
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= clientPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= clientPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(clientPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (clientPrivateLen <= index)
+ while (clientPrivateLen <= index2)
{
nsizes[clientPrivateLen++] = 0;
totalClientSize += sizeof(DevUnion);
}
clientPrivateSizes = nsizes;
}
- oldamount = clientPrivateSizes[index];
+ oldamount = clientPrivateSizes[index2];
if (amount > oldamount)
{
- clientPrivateSizes[index] = amount;
+ clientPrivateSizes[index2] = amount;
totalClientSize += (amount - oldamount);
}
return TRUE;
@@ -119,12 +123,12 @@ ResetScreenPrivates()
int
AllocateScreenPrivateIndex()
{
- int index;
+ int idx;
int i;
ScreenPtr pScreen;
DevUnion *nprivs;
- index = screenPrivateCount++;
+ idx = screenPrivateCount++;
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
@@ -135,9 +139,11 @@ AllocateScreenPrivateIndex()
screenPrivateCount--;
return -1;
}
+ /* Zero the new private */
+ bzero(&nprivs[idx], sizeof(DevUnion));
pScreen->devPrivates = nprivs;
}
- return index;
+ return idx;
}
@@ -160,31 +166,34 @@ AllocateWindowPrivateIndex()
}
Bool
-AllocateWindowPrivate(pScreen, index, amount)
+AllocateWindowPrivate(pScreen, index2, amount)
register ScreenPtr pScreen;
- int index;
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= pScreen->WindowPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->WindowPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(pScreen->WindowPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (pScreen->WindowPrivateLen <= index)
+ while (pScreen->WindowPrivateLen <= index2)
{
nsizes[pScreen->WindowPrivateLen++] = 0;
pScreen->totalWindowSize += sizeof(DevUnion);
}
pScreen->WindowPrivateSizes = nsizes;
}
- oldamount = pScreen->WindowPrivateSizes[index];
+ oldamount = pScreen->WindowPrivateSizes[index2];
if (amount > oldamount)
{
- pScreen->WindowPrivateSizes[index] = amount;
+ pScreen->WindowPrivateSizes[index2] = amount;
pScreen->totalWindowSize += (amount - oldamount);
}
return TRUE;
@@ -210,31 +219,34 @@ AllocateGCPrivateIndex()
}
Bool
-AllocateGCPrivate(pScreen, index, amount)
+AllocateGCPrivate(pScreen, index2, amount)
register ScreenPtr pScreen;
- int index;
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= pScreen->GCPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->GCPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(pScreen->GCPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (pScreen->GCPrivateLen <= index)
+ while (pScreen->GCPrivateLen <= index2)
{
nsizes[pScreen->GCPrivateLen++] = 0;
pScreen->totalGCSize += sizeof(DevUnion);
}
pScreen->GCPrivateSizes = nsizes;
}
- oldamount = pScreen->GCPrivateSizes[index];
+ oldamount = pScreen->GCPrivateSizes[index2];
if (amount > oldamount)
{
- pScreen->GCPrivateSizes[index] = amount;
+ pScreen->GCPrivateSizes[index2] = amount;
pScreen->totalGCSize += (amount - oldamount);
}
return TRUE;
@@ -260,33 +272,37 @@ AllocatePixmapPrivateIndex()
}
Bool
-AllocatePixmapPrivate(pScreen, index, amount)
+AllocatePixmapPrivate(pScreen, index2, amount)
register ScreenPtr pScreen;
- int index;
+ int index2;
unsigned amount;
{
unsigned oldamount;
- if (index >= pScreen->PixmapPrivateLen)
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= pScreen->PixmapPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(pScreen->PixmapPrivateSizes,
- (index + 1) * sizeof(unsigned));
+ (index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
- while (pScreen->PixmapPrivateLen <= index)
+ while (pScreen->PixmapPrivateLen <= index2)
{
nsizes[pScreen->PixmapPrivateLen++] = 0;
pScreen->totalPixmapSize += sizeof(DevUnion);
}
pScreen->PixmapPrivateSizes = nsizes;
}
- oldamount = pScreen->PixmapPrivateSizes[index];
+ oldamount = pScreen->PixmapPrivateSizes[index2];
if (amount > oldamount)
{
- pScreen->PixmapPrivateSizes[index] = amount;
+ pScreen->PixmapPrivateSizes[index2] = amount;
pScreen->totalPixmapSize += (amount - oldamount);
}
+ pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8);
return TRUE;
}
#endif
@@ -335,15 +351,18 @@ InitCmapPrivFunc initPrivFunc;
pColormap = (ColormapPtr) LookupIDByType (
pScreen->defColormap, RT_COLORMAP);
- privs = (DevUnion *) xrealloc (pColormap->devPrivates,
- colormapPrivateCount * sizeof(DevUnion));
-
- pColormap->devPrivates = privs;
-
- if (!privs || !(*initPrivFunc)(pColormap))
+ if (pColormap)
{
- colormapPrivateCount--;
- return -1;
+ privs = (DevUnion *) xrealloc (pColormap->devPrivates,
+ colormapPrivateCount * sizeof(DevUnion));
+
+ pColormap->devPrivates = privs;
+
+ if (!privs || !(*initPrivFunc)(pColormap))
+ {
+ colormapPrivateCount--;
+ return -1;
+ }
}
}
diff --git a/dix/property.c b/dix/property.c
index 1b92dfa35..ba12faffe 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.12 2002/02/19 11:09:22 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -53,12 +54,23 @@ SOFTWARE.
#include "windowstr.h"
#include "propertyst.h"
#include "dixstruct.h"
+#include "dispatch.h"
+#include "swaprep.h"
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
+#endif
+#ifdef LBX
+#include "lbxserve.h"
+#include "lbxtags.h"
#endif
-extern void CopySwap16Write(), CopySwap32Write(), Swap32Write();
+#if defined(LBX) || defined(LBX_COMPAT)
+int fWriteToClient(ClientPtr client, int len, char *buf)
+{
+ return WriteToClient(client, len, buf);
+}
+#endif
/*****************************************************************
* Property Stuff
@@ -609,9 +621,9 @@ ProcGetProperty(client)
if (len)
{
switch (reply.format) {
- case 32: client->pSwapReplyFunc = CopySwap32Write; break;
- case 16: client->pSwapReplyFunc = CopySwap16Write; break;
- default: client->pSwapReplyFunc = (void (*) ())WriteToClient; break;
+ case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
+ case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
+ default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
}
WriteSwappedDataToClient(client, len,
(char *)pProp->data + ind);
@@ -640,7 +652,7 @@ int
ProcListProperties(client)
ClientPtr client;
{
- Atom *pAtoms, *temppAtoms;
+ Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
int numProps = 0;
WindowPtr pWin;
@@ -677,7 +689,7 @@ ProcListProperties(client)
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
if (numProps)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
DEALLOCATE_LOCAL(pAtoms);
}
diff --git a/dix/resource.c b/dix/resource.c
index 76f9ef191..d17586a77 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -47,6 +47,9 @@ SOFTWARE.
/* $Xorg: resource.c,v 1.5 2001/02/09 02:04:40 xorgcvs Exp $ */
+
+/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
+
/* Routines to manage various kinds of resources:
*
* CreateNewResourceType, CreateNewResourceClass, InitClientResources,
@@ -69,7 +72,9 @@ SOFTWARE.
* 1, and an otherwise arbitrary ID in the low 22 bits, we can create a
* resource "owned" by the client.
*/
+/* $XFree86: xc/programs/Xserver/dix/resource.c,v 3.12 2002/03/06 21:13:38 mvojkovi Exp $ */
+#define NEED_EVENTS
#include "X.h"
#include "misc.h"
#include "os.h"
@@ -77,10 +82,18 @@ SOFTWARE.
#include "dixstruct.h"
#include "opaque.h"
#include "windowstr.h"
+#include "dixfont.h"
+#include "colormap.h"
+#include "inputstr.h"
+#include "dixevents.h"
+#include "dixgrabs.h"
+#include "cursor.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
#include <assert.h>
-extern WindowPtr *WindowTable;
-
static void RebuildTable(
#if NeedFunctionPrototypes
int /*client*/
@@ -111,12 +124,23 @@ typedef struct _ClientResource {
XID expectID;
} ClientResourceRec;
-static RESTYPE lastResourceType;
+RESTYPE lastResourceType;
static RESTYPE lastResourceClass;
-static RESTYPE TypeMask;
+RESTYPE TypeMask;
static DeleteType *DeleteFuncs = (DeleteType *)NULL;
+#ifdef XResExtension
+
+Atom * ResourceNames = NULL;
+
+void RegisterResourceName (RESTYPE type, char *name)
+{
+ ResourceNames[type & TypeMask] = MakeAtom(name, strlen(name), TRUE);
+}
+
+#endif
+
RESTYPE
CreateNewResourceType(deleteFunc)
DeleteType deleteFunc;
@@ -130,6 +154,18 @@ CreateNewResourceType(deleteFunc)
(next + 1) * sizeof(DeleteType));
if (!funcs)
return 0;
+
+#ifdef XResExtension
+ {
+ Atom *newnames;
+ newnames = xrealloc(ResourceNames, (next + 1) * sizeof(Atom));
+ if(!newnames)
+ return 0;
+ ResourceNames = newnames;
+ ResourceNames[next] = 0;
+ }
+#endif
+
lastResourceType = next;
DeleteFuncs = funcs;
DeleteFuncs[next] = deleteFunc;
@@ -164,11 +200,6 @@ InitClientResources(client)
if (client == serverClient)
{
- extern int DeleteWindow(), dixDestroyPixmap(), FreeGC();
- extern int CloseFont(), FreeCursor();
- extern int FreeColormap(), FreeClientPixels();
- extern int OtherClientGone(), DeletePassiveGrab();
-
lastResourceType = RT_LASTPREDEF;
lastResourceClass = RC_LASTPREDEF;
TypeMask = RC_LASTPREDEF - 1;
@@ -188,6 +219,14 @@ InitClientResources(client)
DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels;
DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone;
DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab;
+
+#ifdef XResExtension
+ if(ResourceNames)
+ xfree(ResourceNames);
+ ResourceNames = xalloc((lastResourceType + 1) * sizeof(Atom));
+ if(!ResourceNames)
+ return FALSE;
+#endif
}
clientTable[i = client->index].resources =
(ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr));
@@ -212,10 +251,15 @@ InitClientResources(client)
return TRUE;
}
+
static int
+#if NeedFunctionPrototypes
+Hash(int client, register XID id)
+#else
Hash(client, id)
int client;
register XID id;
+#endif
{
id &= RESOURCE_ID_MASK;
switch (clientTable[client].hashsize)
@@ -237,9 +281,17 @@ Hash(client, id)
}
static XID
+#if NeedFunctionPrototypes
+AvailableID(
+ register int client,
+ register XID id,
+ register XID maxid,
+ register XID goodid)
+#else
AvailableID(client, id, maxid, goodid)
register int client;
register XID id, maxid, goodid;
+#endif
{
register ResourcePtr res;
@@ -507,7 +559,6 @@ FreeResourceByType(id, type, skipFree)
int cid;
register ResourcePtr res;
register ResourcePtr *prev, *head;
-
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
{
head = &clientTable[cid].resources[Hash(cid, id)];
@@ -574,12 +625,12 @@ ChangeResourceValue (id, rtype, value)
*/
void
-FindClientResourcesByType(client, type, func, cdata)
- ClientPtr client;
- RESTYPE type;
- FindResType func;
- pointer cdata;
-{
+FindClientResourcesByType(
+ ClientPtr client,
+ RESTYPE type,
+ FindResType func,
+ pointer cdata
+){
register ResourcePtr *resources;
register ResourcePtr this, next;
int i, elements;
@@ -606,8 +657,64 @@ FindClientResourcesByType(client, type, func, cdata)
}
void
-FreeClientNeverRetainResources(client)
- ClientPtr client;
+FindAllClientResources(
+ ClientPtr client,
+ FindAllRes func,
+ pointer cdata
+){
+ register ResourcePtr *resources;
+ register ResourcePtr this, next;
+ int i, elements;
+ register int *eltptr;
+
+ if (!client)
+ client = serverClient;
+
+ resources = clientTable[client->index].resources;
+ eltptr = &clientTable[client->index].elements;
+ for (i = 0; i < clientTable[client->index].buckets; i++)
+ {
+ for (this = resources[i]; this; this = next)
+ {
+ next = this->next;
+ elements = *eltptr;
+ (*func)(this->value, this->id, this->type, cdata);
+ if (*eltptr != elements)
+ next = resources[i]; /* start over */
+ }
+ }
+}
+
+
+pointer
+LookupClientResourceComplex(
+ ClientPtr client,
+ RESTYPE type,
+ FindComplexResType func,
+ pointer cdata
+){
+ ResourcePtr *resources;
+ ResourcePtr this;
+ int i;
+
+ if (!client)
+ client = serverClient;
+
+ resources = clientTable[client->index].resources;
+ for (i = 0; i < clientTable[client->index].buckets; i++) {
+ for (this = resources[i]; this; this = this->next) {
+ if (!type || this->type == type) {
+ if((*func)(this->value, this->id, cdata))
+ return this->value;
+ }
+ }
+ }
+ return NULL;
+}
+
+
+void
+FreeClientNeverRetainResources(ClientPtr client)
{
ResourcePtr *resources;
ResourcePtr this;
@@ -681,6 +788,7 @@ FreeClientResources(client)
}
}
xfree(clientTable[client->index].resources);
+ clientTable[client->index].resources = NULL;
clientTable[client->index].buckets = 0;
}
@@ -701,7 +809,19 @@ LegalNewID(id, client)
XID id;
register ClientPtr client;
{
- return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) &&
+
+#ifdef PANORAMIX
+ XID minid, maxid;
+
+ if (!noPanoramiXExtension) {
+ minid = client->clientAsMask | (client->index ?
+ SERVER_BIT : SERVER_MINID);
+ maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1;
+ if ((id >= minid) && (id <= maxid))
+ return TRUE;
+ }
+#endif /* PANORAMIX */
+ return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) &&
((clientTable[client->index].expectID <= id) ||
!LookupIDByClass(id, RC_ANY)));
}
@@ -757,7 +877,7 @@ SecurityLookupIDByClass(client, id, classes, mode)
Mask mode;
{
int cid;
- register ResourcePtr res;
+ register ResourcePtr res = NULL;
pointer retval = NULL;
assert(client == NullClient ||
diff --git a/dix/swaprep.c b/dix/swaprep.c
index ffce75ac4..e16f7c53f 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/swaprep.c,v 3.7 2001/12/14 19:59:33 dawes Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -55,8 +56,29 @@ SOFTWARE.
#include "dixstruct.h"
#include "fontstruct.h"
#include "scrnintstr.h"
+#include "swaprep.h"
+#include "globals.h"
-void SwapVisual(), SwapConnSetup(), SwapWinRoot();
+static void SwapFontInfo(
+#if NeedFunctionPrototypes
+ xQueryFontReply * /* pr */
+#endif
+);
+
+#ifndef LBX
+static void SwapCharInfo(
+#if NeedFunctionPrototypes
+ xCharInfo * /* pInfo */
+#endif
+ );
+
+static void SwapFont(
+#if NeedFunctionPrototypes
+ xQueryFontReply * /* pr */,
+ Bool /* hasGlyphs */
+#endif
+ );
+#endif
/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
void
@@ -1294,47 +1316,47 @@ SKeymapNotifyEvent(from, to)
}
void
-SwapConnSetupInfo(pInfo, pInfoTBase)
- char *pInfo;
- char *pInfoTBase;
+SwapConnSetupInfo(
+ char *pInfo,
+ char *pInfoT
+)
{
int i, j, k;
- ScreenPtr pScreen;
- DepthPtr pDepth;
- char *pInfoT;
xConnSetup *pConnSetup = (xConnSetup *)pInfo;
+ xDepth *depth;
+ xWindowRoot *root;
- pInfoT = pInfoTBase;
SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT);
pInfo += sizeof(xConnSetup);
pInfoT += sizeof(xConnSetup);
/* Copy the vendor string */
i = (pConnSetup->nbytesVendor + 3) & ~3;
- memmove(pInfoT, pInfo, i);
+ memcpy(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);
+ i = sizeof(xPixmapFormat) * pConnSetup->numFormats;
+ memcpy(pInfoT, pInfo, i);
pInfo += i;
pInfoT += i;
- for(i = 0; i < screenInfo.numScreens; i++)
+ for(i = 0; i < pConnSetup->numRoots; i++)
{
- pScreen = screenInfo.screens[i];
- SwapWinRoot((xWindowRoot *)pInfo, (xWindowRoot *)pInfoT);
+ root = (xWindowRoot*)pInfo;
+ SwapWinRoot(root, (xWindowRoot *)pInfoT);
pInfo += sizeof(xWindowRoot);
pInfoT += sizeof(xWindowRoot);
- pDepth = pScreen->allowedDepths;
- for(j = 0; j < pScreen->numDepths; j++, pDepth++)
+
+ for(j = 0; j < root->nDepths; j++)
{
- ((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth;
- cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals);
+ depth = (xDepth*)pInfo;
+ ((xDepth *)pInfoT)->depth = depth->depth;
+ cpswaps(depth->nVisuals, ((xDepth *)pInfoT)->nVisuals);
pInfo += sizeof(xDepth);
pInfoT += sizeof(xDepth);
- for(k = 0; k < pDepth->numVids; k++)
+ for(k = 0; k < depth->nVisuals; k++)
{
SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT);
pInfo += sizeof(xVisualType);
diff --git a/dix/swapreq.c b/dix/swapreq.c
index d0b1a2525..358ec8139 100644
--- a/dix/swapreq.c
+++ b/dix/swapreq.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/swapreq.c,v 3.5 2002/02/19 11:09:22 alanh Exp $ */
/************************************************************
Copyright 1987, 1998 The Open Group
@@ -53,9 +54,8 @@ SOFTWARE.
#include "Xprotostr.h"
#include "misc.h"
#include "dixstruct.h"
-
-extern int (* ProcVector[256]) ();
-extern void (* EventSwapVector[128]) (); /* for SendEvent */
+#include "extnsionst.h" /* for SendEvent */
+#include "swapreq.h"
/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
@@ -326,7 +326,7 @@ SProcSendEvent(client)
{
register char n;
xEvent eventT;
- void (*proc)(), NotImplemented();
+ EventSwapPtr proc;
REQUEST(xSendEventReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xSendEventReq);
@@ -335,7 +335,7 @@ SProcSendEvent(client)
/* Swap event */
proc = EventSwapVector[stuff->event.u.u.type & 0177];
- if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) /* no swapping proc; invalid event type? */
+ if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */
return (BadValue);
(*proc)(&stuff->event, &eventT);
stuff->event = eventT;
diff --git a/dix/tables.c b/dix/tables.c
index 7c84bdc96..7f42c005d 100644
--- a/dix/tables.c
+++ b/dix/tables.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/tables.c,v 3.5 2002/02/19 11:09:22 alanh Exp $ */
/***********************************************************
Copyright 1987, 1998 The Open Group
@@ -46,128 +47,39 @@ SOFTWARE.
******************************************************************/
/* $Xorg: tables.c,v 1.4 2001/02/09 02:04:41 xorgcvs Exp $ */
-extern int ProcInitialConnection(), ProcEstablishConnection();
-
-extern int ProcBadRequest(), ProcCreateWindow(),
- ProcChangeWindowAttributes(), ProcGetWindowAttributes(),
- ProcDestroyWindow(), ProcDestroySubwindows(), ProcChangeSaveSet(),
- ProcReparentWindow(), ProcMapWindow(), ProcMapSubwindows(),
- ProcUnmapWindow(), ProcUnmapSubwindows(), ProcConfigureWindow(),
- ProcCirculateWindow(), ProcGetGeometry(), ProcQueryTree(),
- ProcInternAtom(), ProcGetAtomName(), ProcChangeProperty(),
- ProcDeleteProperty(), ProcGetProperty(), ProcListProperties(),
- ProcSetSelectionOwner(), ProcGetSelectionOwner(), ProcConvertSelection(),
- ProcSendEvent(), ProcGrabPointer(), ProcUngrabPointer(),
- ProcGrabButton(), ProcUngrabButton(), ProcChangeActivePointerGrab(),
- ProcGrabKeyboard(), ProcUngrabKeyboard(), ProcGrabKey(),
- ProcUngrabKey(), ProcAllowEvents(), ProcGrabServer(),
- ProcUngrabServer(), ProcQueryPointer(), ProcGetMotionEvents(),
- ProcTranslateCoords(), ProcWarpPointer(), ProcSetInputFocus(),
- ProcGetInputFocus(), ProcQueryKeymap(), ProcOpenFont(),
- ProcCloseFont(), ProcQueryFont(), ProcQueryTextExtents(),
- ProcListFonts(), ProcListFontsWithInfo(), ProcSetFontPath(),
- ProcGetFontPath(), ProcCreatePixmap(), ProcFreePixmap(),
- ProcCreateGC(), ProcChangeGC(), ProcCopyGC(),
- ProcSetDashes(), ProcSetClipRectangles(), ProcFreeGC(),
- ProcClearToBackground(), ProcCopyArea(), ProcCopyPlane(),
- ProcPolyPoint(), ProcPolyLine(), ProcPolySegment(),
- ProcPolyRectangle(), ProcPolyArc(), ProcFillPoly(),
- ProcPolyFillRectangle(), ProcPolyFillArc(), ProcPutImage(),
- ProcGetImage(), ProcPolyText(),
- ProcImageText8(), ProcImageText16(), ProcCreateColormap(),
- ProcFreeColormap(), ProcCopyColormapAndFree(), ProcInstallColormap(),
- ProcUninstallColormap(), ProcListInstalledColormaps(), ProcAllocColor(),
- ProcAllocNamedColor(), ProcAllocColorCells(), ProcAllocColorPlanes(),
- ProcFreeColors(), ProcStoreColors(), ProcStoreNamedColor(),
- ProcQueryColors(), ProcLookupColor(), ProcCreateCursor(),
- ProcCreateGlyphCursor(), ProcFreeCursor(), ProcRecolorCursor(),
- ProcQueryBestSize(), ProcQueryExtension(), ProcListExtensions(),
- ProcChangeKeyboardMapping(), ProcSetPointerMapping(),
- ProcGetKeyboardMapping(), ProcGetPointerMapping(),
- ProcChangeKeyboardControl(),
- ProcGetKeyboardControl(), ProcBell(), ProcChangePointerControl(),
- ProcGetPointerControl(), ProcSetScreenSaver(), ProcGetScreenSaver(),
- ProcChangeHosts(), ProcListHosts(), ProcChangeAccessControl(),
- ProcChangeCloseDownMode(), ProcKillClient(),
- ProcRotateProperties(), ProcForceScreenSaver(),
- ProcSetModifierMapping(), ProcGetModifierMapping(),
- ProcNoOperation();
-
-extern int SProcSProcBadRequest(), SProcCreateWindow(),
- SProcChangeWindowAttributes(),
- SProcReparentWindow(), SProcConfigureWindow(),
- SProcInternAtom(), SProcChangeProperty(),
- SProcDeleteProperty(), SProcGetProperty(),
- SProcSetSelectionOwner(),
- SProcConvertSelection(),
- SProcSendEvent(), SProcGrabPointer(),
- SProcGrabButton(), SProcUngrabButton(), SProcChangeActivePointerGrab(),
- SProcGrabKeyboard(), SProcGrabKey(),
- SProcUngrabKey(), SProcGetMotionEvents(),
- SProcTranslateCoords(), SProcWarpPointer(), SProcSetInputFocus(),
- SProcOpenFont(),
- SProcListFonts(), SProcListFontsWithInfo(), SProcSetFontPath(),
- SProcCreatePixmap(),
- SProcCreateGC(), SProcChangeGC(), SProcCopyGC(),
- SProcSetDashes(), SProcSetClipRectangles(),
- SProcClearToBackground(), SProcCopyArea(), SProcCopyPlane(),
- SProcPoly(), SProcFillPoly(), SProcPutImage(),
- SProcGetImage(), SProcPolyText(),
- SProcImageText(), SProcCreateColormap(),
- SProcCopyColormapAndFree(), SProcAllocColor(),
- SProcAllocNamedColor(), SProcAllocColorCells(), SProcAllocColorPlanes(),
- SProcFreeColors(), SProcStoreColors(), SProcStoreNamedColor(),
- SProcQueryColors(), SProcLookupColor(), SProcCreateCursor(),
- SProcCreateGlyphCursor(), SProcRecolorCursor(),
- SProcQueryBestSize(), SProcQueryExtension(),
- SProcChangeKeyboardMapping(), SProcChangeKeyboardControl(),
- SProcChangePointerControl(),
- SProcSetScreenSaver(),
- SProcChangeHosts(),
- SProcRotateProperties(),
- SProcNoOperation(), SProcResourceReq(), SProcSimpleReq();
-
-extern void
- SErrorEvent(), NotImplemented(), SKeyButtonPtrEvent(), SEnterLeaveEvent(),
- SFocusEvent(), SKeymapNotifyEvent(), SExposeEvent(),
- SGraphicsExposureEvent(), SNoExposureEvent(), SVisibilityEvent(),
- SCreateNotifyEvent(), SDestroyNotifyEvent(), SUnmapNotifyEvent(),
- SMapNotifyEvent(), SMapRequestEvent(), SReparentEvent(),
- SConfigureNotifyEvent(), SConfigureRequestEvent(), SGravityEvent(),
- SResizeRequestEvent(), SCirculateEvent(),
- SPropertyEvent(), SSelectionClearEvent(), SSelectionRequestEvent(),
- SSelectionNotifyEvent(), SColormapEvent(), SClientMessageEvent(), SMappingEvent();
-
-extern void
- SGetWindowAttributesReply(), SGetGeometryReply(), SQueryTreeReply(),
- SInternAtomReply(), SGetAtomNameReply(), SGetPropertyReply(),
- SListPropertiesReply(),
- SGetSelectionOwnerReply(),
- SQueryPointerReply(), SGetMotionEventsReply(), STranslateCoordsReply(),
- SGetInputFocusReply(), SQueryKeymapReply(), SQueryFontReply(),
- SQueryTextExtentsReply(), SListFontsReply(), SListFontsWithInfoReply(),
- SGetFontPathReply(), SGetImageReply(), SListInstalledColormapsReply(),
- SAllocColorReply(), SAllocNamedColorReply(), SAllocColorCellsReply(),
- SAllocColorPlanesReply(), SQueryColorsReply(), SLookupColorReply(),
- SQueryBestSizeReply(), SListExtensionsReply(),
- SGetKeyboardMappingReply(), SGetKeyboardControlReply(),
- SGetPointerControlReply(), SGetScreenSaverReply(),
- SListHostsReply(), SGetPointerMappingReply(),
- SGetModifierMappingReply(), SGenericReply();
+#include "X.h"
+#define NEED_EVENTS
+#define NEED_REPLIES
+#include "Xproto.h"
+#include "windowstr.h"
+#include "extnsionst.h"
+#include "dixstruct.h"
+#include "dixevents.h"
+#include "dispatch.h"
+#include "swaprep.h"
+#include "swapreq.h"
#ifdef K5AUTH
extern int
k5_stage1(), k5_stage2(), k5_stage3(), k5_bad();
#endif
-int (* InitialVector[3]) () =
+int (* InitialVector[3]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
{
0,
ProcInitialConnection,
ProcEstablishConnection
};
-int (* ProcVector[256]) () =
+int (* ProcVector[256]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
{
ProcBadRequest,
ProcCreateWindow,
@@ -299,7 +211,11 @@ int (* ProcVector[256]) () =
ProcNoOperation
};
-int (* SwappedProcVector[256]) () =
+int (* SwappedProcVector[256]) (
+#if NeedNestedPrototypes
+ ClientPtr /* client */
+#endif
+ ) =
{
ProcBadRequest,
SProcCreateWindow,
@@ -431,9 +347,9 @@ int (* SwappedProcVector[256]) () =
SProcNoOperation
};
-void (* EventSwapVector[128]) () =
+EventSwapPtr EventSwapVector[128] =
{
- SErrorEvent,
+ (EventSwapPtr)SErrorEvent,
NotImplemented,
SKeyButtonPtrEvent,
SKeyButtonPtrEvent,
@@ -471,137 +387,137 @@ void (* EventSwapVector[128]) () =
};
-void (* ReplySwapVector[256]) () =
+ReplySwapPtr ReplySwapVector[256] =
{
- NotImplemented,
- NotImplemented,
- NotImplemented,
- SGetWindowAttributesReply,
- NotImplemented,
- NotImplemented, /* 5 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 10 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- SGetGeometryReply,
- SQueryTreeReply, /* 15 */
- SInternAtomReply,
- SGetAtomNameReply,
- NotImplemented,
- NotImplemented,
- SGetPropertyReply, /* 20 */
- SListPropertiesReply,
- NotImplemented,
- SGetSelectionOwnerReply,
- NotImplemented,
- NotImplemented, /* 25 */
- SGenericReply, /* SGrabPointerReply, */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 30 */
- SGenericReply, /* SGrabKeyboardReply, */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 35 */
- NotImplemented,
- NotImplemented,
- SQueryPointerReply,
- SGetMotionEventsReply,
- STranslateCoordsReply, /* 40 */
- NotImplemented,
- NotImplemented,
- SGetInputFocusReply,
- SQueryKeymapReply,
- NotImplemented, /* 45 */
- NotImplemented,
- SQueryFontReply,
- SQueryTextExtentsReply,
- SListFontsReply,
- SListFontsWithInfoReply, /* 50 */
- NotImplemented,
- SGetFontPathReply,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 55 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 60 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 65 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 70 */
- NotImplemented,
- NotImplemented,
- SGetImageReply,
- NotImplemented,
- NotImplemented, /* 75 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 80 */
- NotImplemented,
- NotImplemented,
- SListInstalledColormapsReply,
- SAllocColorReply,
- SAllocNamedColorReply, /* 85 */
- SAllocColorCellsReply,
- SAllocColorPlanesReply,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 90 */
- SQueryColorsReply,
- SLookupColorReply,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 95 */
- NotImplemented,
- SQueryBestSizeReply,
- SGenericReply, /* SQueryExtensionReply, */
- SListExtensionsReply,
- NotImplemented, /* 100 */
- SGetKeyboardMappingReply,
- NotImplemented,
- SGetKeyboardControlReply,
- NotImplemented,
- NotImplemented, /* 105 */
- SGetPointerControlReply,
- NotImplemented,
- SGetScreenSaverReply,
- NotImplemented,
- SListHostsReply, /* 110 */
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented,
- NotImplemented, /* 115 */
- SGenericReply, /* SetPointerMapping */
- SGetPointerMappingReply,
- SGenericReply, /* SetModifierMapping */
- SGetModifierMappingReply, /* 119 */
- NotImplemented, /* 120 */
- NotImplemented, /* 121 */
- NotImplemented, /* 122 */
- NotImplemented, /* 123 */
- NotImplemented, /* 124 */
- NotImplemented, /* 125 */
- NotImplemented, /* 126 */
- NotImplemented, /* NoOperation */
- NotImplemented
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetWindowAttributesReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 5 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 10 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetGeometryReply,
+ (ReplySwapPtr)SQueryTreeReply, /* 15 */
+ (ReplySwapPtr)SInternAtomReply,
+ (ReplySwapPtr)SGetAtomNameReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetPropertyReply, /* 20 */
+ (ReplySwapPtr)SListPropertiesReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetSelectionOwnerReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 25 */
+ (ReplySwapPtr)SGenericReply, /* SGrabPointerReply, */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 30 */
+ (ReplySwapPtr)SGenericReply, /* SGrabKeyboardReply, */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 35 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryPointerReply,
+ (ReplySwapPtr)SGetMotionEventsReply,
+ (ReplySwapPtr)STranslateCoordsReply, /* 40 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetInputFocusReply,
+ (ReplySwapPtr)SQueryKeymapReply,
+ ReplyNotSwappd, /* 45 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryFontReply,
+ (ReplySwapPtr)SQueryTextExtentsReply,
+ (ReplySwapPtr)SListFontsReply,
+ (ReplySwapPtr)SListFontsWithInfoReply, /* 50 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetFontPathReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 55 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 60 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 65 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 70 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetImageReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 75 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 80 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SListInstalledColormapsReply,
+ (ReplySwapPtr)SAllocColorReply,
+ (ReplySwapPtr)SAllocNamedColorReply, /* 85 */
+ (ReplySwapPtr)SAllocColorCellsReply,
+ (ReplySwapPtr)SAllocColorPlanesReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 90 */
+ (ReplySwapPtr)SQueryColorsReply,
+ (ReplySwapPtr)SLookupColorReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 95 */
+ ReplyNotSwappd,
+ (ReplySwapPtr)SQueryBestSizeReply,
+ (ReplySwapPtr)SGenericReply, /* SQueryExtensionReply, */
+ (ReplySwapPtr)SListExtensionsReply,
+ ReplyNotSwappd, /* 100 */
+ (ReplySwapPtr)SGetKeyboardMappingReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetKeyboardControlReply,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 105 */
+ (ReplySwapPtr)SGetPointerControlReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SGetScreenSaverReply,
+ ReplyNotSwappd,
+ (ReplySwapPtr)SListHostsReply, /* 110 */
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd,
+ ReplyNotSwappd, /* 115 */
+ (ReplySwapPtr)SGenericReply, /* SetPointerMapping */
+ (ReplySwapPtr)SGetPointerMappingReply,
+ (ReplySwapPtr)SGenericReply, /* SetModifierMapping */
+ (ReplySwapPtr)SGetModifierMappingReply, /* 119 */
+ ReplyNotSwappd, /* 120 */
+ ReplyNotSwappd, /* 121 */
+ ReplyNotSwappd, /* 122 */
+ ReplyNotSwappd, /* 123 */
+ ReplyNotSwappd, /* 124 */
+ ReplyNotSwappd, /* 125 */
+ ReplyNotSwappd, /* 126 */
+ ReplyNotSwappd, /* NoOperation */
+ ReplyNotSwappd
};
#ifdef K5AUTH
diff --git a/dix/window.c b/dix/window.c
index b24c48376..30c0df032 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -48,6 +48,30 @@ SOFTWARE.
*/
+/* The panoramix components contained the following notice */
+/****************************************************************
+* *
+* Copyright (c) Digital Equipment Corporation, 1991, 1997 *
+* *
+* All Rights Reserved. Unpublished rights reserved under *
+* the copyright laws of the United States. *
+* *
+* The software contained on this media is proprietary to *
+* and embodies the confidential technology of Digital *
+* Equipment Corporation. Possession, use, duplication or *
+* dissemination of the software and media is authorized only *
+* pursuant to a valid written license from Digital Equipment *
+* Corporation. *
+* *
+* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
+* by the U.S. Government is subject to restrictions as set *
+* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
+* or in FAR 52.227-19, as applicable. *
+* *
+*****************************************************************/
+
+/* $XFree86: xc/programs/Xserver/dix/window.c,v 3.32 2003/01/12 02:44:26 dawes Exp $ */
+
#include "misc.h"
#include "scrnintstr.h"
#include "os.h"
@@ -61,15 +85,27 @@ SOFTWARE.
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#include "dixevents.h"
+#include "globals.h"
+
#ifdef XAPPGROUP
-#include "extensions/Xagsrv.h"
+#include "Xagsrv.h"
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
-#include "extensions/security.h"
+#include "security.h"
#endif
-extern Bool permitOldBugs;
+#if defined(NEED_SCREEN_REGIONS)
+#define REGION_PTR(pScreen,pWin) \
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
+#else
+#define REGION_PTR(pScreen,pWin) /* nothing */
+#endif
/******
* Window stuff for server
@@ -88,13 +124,12 @@ int screenIsSaved = SCREEN_SAVER_OFF;
ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
-extern WindowPtr *WindowTable;
-
+#if 0
extern void DeleteWindowFromAnyEvents();
extern Mask EventMaskForClient();
extern void WindowHasNewCursor();
extern void RecalculateDeliverableEvents();
-extern int rand();
+#endif
static Bool TileScreenSaver(
#if NeedFunctionPrototypes
@@ -220,12 +255,17 @@ WalkTree(pScreen, func, data)
int defaultBackingStore = NotUseful;
/* hack to force no backing store */
Bool disableBackingStore = FALSE;
+Bool enableBackingStore = FALSE;
/* hack to force no save unders */
Bool disableSaveUnders = FALSE;
static void
+#if NeedFunctionPrototypes
+SetWindowToDefaults(register WindowPtr pWin)
+#else
SetWindowToDefaults(pWin)
register WindowPtr pWin;
+#endif
{
pWin->prevSib = NullWindow;
pWin->firstChild = NullWindow;
@@ -260,8 +300,12 @@ SetWindowToDefaults(pWin)
}
static void
+#if NeedFunctionPrototypes
+MakeRootTile(WindowPtr pWin)
+#else
MakeRootTile(pWin)
WindowPtr pWin;
+#endif
{
ScreenPtr pScreen = pWin->drawable.pScreen;
GCPtr pGC;
@@ -270,13 +314,13 @@ MakeRootTile(pWin)
register unsigned char *from, *to;
register int i, j;
- pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, len, 4,
+ pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
pScreen->rootDepth);
pWin->backgroundState = BackgroundPixmap;
pGC = GetScratchGC(pScreen->rootDepth, pScreen);
if (!pWin->background.pixmap || !pGC)
- FatalError("cound not create root tile");
+ FatalError("could not create root tile");
{
CARD32 attributes[2];
@@ -296,6 +340,9 @@ MakeRootTile(pWin)
for (j = len; j > 0; j--)
*to++ = *from;
+ if (blackRoot)
+ bzero(back, sizeof(back));
+
(*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1,
0, 0, len, 4, 0, XYBitmap, (char *)back);
@@ -428,6 +475,8 @@ CreateRootWindow(pScreen)
if (disableBackingStore)
pScreen->backingStoreSupport = NotUseful;
+ if (enableBackingStore)
+ pScreen->backingStoreSupport = Always;
#ifdef DO_SAVE_UNDERS
if ((pScreen->backingStoreSupport != NotUseful) &&
@@ -483,7 +532,7 @@ ClippedRegionFromBox(pWin, Rgn, x, y, w, h)
register int x, y;
int w, h;
{
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
BoxRec box;
box = *(REGION_EXTENTS(pScreen, &pWin->winSize));
@@ -571,9 +620,8 @@ CreateWindow(wid, pParent, x, y, w, h, bw, class, vmask, vlist,
}
pScreen = pParent->drawable.pScreen;
-
if ((class == InputOutput) && (depth == 0))
- depth = pParent->drawable.depth;
+ depth = pParent->drawable.depth;
ancwopt = pParent->optional;
if (!ancwopt)
ancwopt = FindWindowWithOptional(pParent)->optional;
@@ -768,17 +816,18 @@ CreateWindow(wid, pParent, x, y, w, h, bw, class, vmask, vlist,
event.u.createNotify.override = pWin->overrideRedirect;
DeliverEvents(pParent, &event, 1, NullWindow);
}
-
return pWin;
}
static void
+#if NeedFunctionPrototypes
+FreeWindowResources(register WindowPtr pWin)
+#else
FreeWindowResources(pWin)
register WindowPtr pWin;
+#endif
{
- register ScreenPtr pScreen;
-
- pScreen = pWin->drawable.pScreen;
+ register ScreenPtr pScreen = pWin->drawable.pScreen;
DeleteWindowFromAnySaveSet(pWin);
DeleteWindowFromAnySelections(pWin);
@@ -805,11 +854,15 @@ FreeWindowResources(pWin)
}
static void
+#if NeedFunctionPrototypes
+CrushTree(WindowPtr pWin)
+#else
CrushTree(pWin)
WindowPtr pWin;
+#endif
{
register WindowPtr pChild, pSib, pParent;
- Bool (* UnrealizeWindow)();
+ UnrealizeWindowProcPtr UnrealizeWindow;
xEvent event;
if (!(pChild = pWin->firstChild))
@@ -937,7 +990,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
XID *vlist;
ClientPtr client;
{
- register Mask index;
+ register Mask index2;
register XID *pVlist;
PixmapPtr pPixmap;
Pixmap pixID;
@@ -966,9 +1019,9 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
tmask = vmask;
while (tmask)
{
- index = (Mask) lowbit (tmask);
- tmask &= ~index;
- switch (index)
+ index2 = (Mask) lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
{
case CWBackPixmap:
pixID = (Pixmap )*pVlist;
@@ -992,7 +1045,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
}
else
{ /* didn't change the background to None, so don't tell ddx */
- index = 0;
+ index2 = 0;
}
#endif
}
@@ -1068,7 +1121,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
pWin->border = pWin->parent->border;
if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE)
{
- index = CWBorderPixel;
+ index2 = CWBorderPixel;
}
else
{
@@ -1146,14 +1199,14 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
pWin->forcedBS = FALSE;
break;
case CWBackingPlanes:
- if (pWin->optional || ((CARD32)*pVlist != ~0L)) {
+ if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {
if (!pWin->optional && !MakeWindowOptional (pWin))
{
error = BadAlloc;
goto PatchUp;
}
pWin->optional->backingBitPlanes = (CARD32) *pVlist;
- if ((CARD32)*pVlist == ~0L)
+ if ((CARD32)*pVlist == (CARD32)~0L)
checkOptional = TRUE;
}
pVlist++;
@@ -1267,7 +1320,8 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
*/
win_owner = clients[CLIENT_ID(pWin->drawable.id)];
- if (win_owner->appgroup && !pWin->parent->parent &&
+ if ( win_owner && win_owner->appgroup &&
+ !pWin->parent->parent &&
(ag_colormap = XagDefaultColormap (win_owner)))
cmap = ag_colormap;
else
@@ -1338,7 +1392,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
if (pChild->optional->colormap == cmap)
CheckWindowOptionalNeed (pChild);
}
-
+
xE.u.u.type = ColormapNotify;
xE.u.colormap.window = pWin->drawable.id;
xE.u.colormap.colormap = cmap;
@@ -1440,7 +1494,7 @@ ChangeWindowAttributes(pWin, vmask, vlist, client)
client->errorValue = vmask;
goto PatchUp;
}
- vmaskCopy |= index;
+ vmaskCopy |= index2;
}
PatchUp:
if (checkOptional)
@@ -1521,6 +1575,8 @@ MoveWindowInStack(pWin, pNextSib)
if (pWin->nextSib != pNextSib)
{
+ WindowPtr pOldNextSib = pWin->nextSib;
+
if (!pNextSib) /* move to bottom */
{
if (pParent->firstChild == pWin)
@@ -1577,6 +1633,8 @@ MoveWindowInStack(pWin, pNextSib)
pFirstChange = pFirstChange->nextSib;
}
}
+ if(pWin->drawable.pScreen->RestackWindow)
+ (*pWin->drawable.pScreen->RestackWindow)(pWin, pOldNextSib);
}
return( pFirstChange );
@@ -1596,7 +1654,7 @@ CreateUnclippedWinSize (pWin)
pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1);
#ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x,
- pWin->drawable.y);
@@ -1620,7 +1678,7 @@ SetWinSize (pWin)
(int)pWin->drawable.height);
#ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x,
- pWin->drawable.y);
@@ -1650,7 +1708,7 @@ SetBorderSize (pWin)
(int)(pWin->drawable.height + (bw<<1)));
#ifdef SHAPE
if (wBoundingShape (pWin)) {
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x,
- pWin->drawable.y);
@@ -1760,6 +1818,7 @@ ResizeChildrenWinSize(pWin, dx, dy, dw, dh)
SetWinSize (pSib);
SetBorderSize (pSib);
(*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
+
if ( (pChild = pSib->firstChild) )
{
while (1)
@@ -1817,8 +1876,14 @@ ResizeChildrenWinSize(pWin, dx, dy, dw, dh)
*/
static int
+#if NeedFunctionPrototypes
+IsSiblingAboveMe(
+ register WindowPtr pMe,
+ register WindowPtr pSib)
+#else
IsSiblingAboveMe(pMe, pSib)
register WindowPtr pMe, pSib;
+#endif
{
register WindowPtr pWin;
@@ -1835,9 +1900,15 @@ IsSiblingAboveMe(pMe, pSib)
}
static BoxPtr
+#if NeedFunctionPrototypes
+WindowExtents(
+ register WindowPtr pWin,
+ register BoxPtr pBox)
+#else
WindowExtents(pWin, pBox)
register WindowPtr pWin;
register BoxPtr pBox;
+#endif
{
pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
@@ -1852,12 +1923,18 @@ WindowExtents(pWin, pBox)
#define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL)
static RegionPtr
+#if NeedFunctionPrototypes
+MakeBoundingRegion (
+ register WindowPtr pWin,
+ BoxPtr pBox)
+#else
MakeBoundingRegion (pWin, pBox)
register WindowPtr pWin;
BoxPtr pBox;
+#endif
{
RegionPtr pRgn;
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ REGION_PTR(pScreen, pWin)
pRgn = REGION_CREATE(pScreen, pBox, 1);
if (wBoundingShape (pWin)) {
@@ -1871,9 +1948,17 @@ MakeBoundingRegion (pWin, pBox)
}
static Bool
+#if NeedFunctionPrototypes
+ShapeOverlap (
+ WindowPtr pWin,
+ BoxPtr pWinBox,
+ WindowPtr pSib,
+ BoxPtr pSibBox)
+#else
ShapeOverlap (pWin, pWinBox, pSib, pSibBox)
WindowPtr pWin, pSib;
BoxPtr pWinBox, pSibBox;
+#endif
{
RegionPtr pWinRgn, pSibRgn;
register ScreenPtr pScreen;
@@ -1893,9 +1978,16 @@ ShapeOverlap (pWin, pWinBox, pSib, pSibBox)
#endif
static Bool
+#if NeedFunctionPrototypes
+AnyWindowOverlapsMe(
+ WindowPtr pWin,
+ WindowPtr pHead,
+ register BoxPtr box)
+#else
AnyWindowOverlapsMe(pWin, pHead, box)
WindowPtr pWin, pHead;
register BoxPtr box;
+#endif
{
register WindowPtr pSib;
BoxRec sboxrec;
@@ -1918,9 +2010,15 @@ AnyWindowOverlapsMe(pWin, pHead, box)
}
static Bool
+#if NeedFunctionPrototypes
+IOverlapAnyWindow(
+ WindowPtr pWin,
+ register BoxPtr box)
+#else
IOverlapAnyWindow(pWin, box)
WindowPtr pWin;
register BoxPtr box;
+#endif
{
register WindowPtr pSib;
BoxRec sboxrec;
@@ -1971,11 +2069,22 @@ IOverlapAnyWindow(pWin, box)
*/
static WindowPtr
+#if NeedFunctionPrototypes
+WhereDoIGoInTheStack(
+ register WindowPtr pWin,
+ register WindowPtr pSib,
+ short x,
+ short y,
+ unsigned short w,
+ unsigned short h,
+ int smode)
+#else
WhereDoIGoInTheStack(pWin, pSib, x, y, w, h, smode)
register WindowPtr pWin, pSib;
short x, y;
unsigned short w, h;
int smode;
+#endif
{
BoxRec box;
register ScreenPtr pScreen;
@@ -2074,9 +2183,16 @@ WhereDoIGoInTheStack(pWin, pSib, x, y, w, h, smode)
}
static void
+#if NeedFunctionPrototypes
+ReflectStackChange(
+ register WindowPtr pWin,
+ register WindowPtr pSib,
+ VTKind kind)
+#else
ReflectStackChange(pWin, pSib, kind)
register WindowPtr pWin, pSib;
VTKind kind;
+#endif
{
/* Note that pSib might be NULL */
@@ -2140,8 +2256,8 @@ ConfigureWindow(pWin, mask, vlist, client)
#define REBORDER_WIN 3
register WindowPtr pSib = NullWindow;
register WindowPtr pParent = pWin->parent;
- Window sibwid;
- Mask index, tmask;
+ Window sibwid = 0;
+ Mask index2, tmask;
register XID *pVlist;
short x, y, beforeX, beforeY;
unsigned short w = pWin->drawable.width,
@@ -2198,9 +2314,9 @@ ConfigureWindow(pWin, mask, vlist, client)
tmask = mask & ~ChangeMask;
while (tmask)
{
- index = (Mask)lowbit (tmask);
- tmask &= ~index;
- switch (index)
+ index2 = (Mask)lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
{
case CWBorderWidth:
GET_CARD16(CWBorderWidth, bw);
@@ -2273,6 +2389,12 @@ ConfigureWindow(pWin, mask, vlist, client)
event.u.u.detail = Above;
event.u.configureRequest.x = x;
event.u.configureRequest.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ event.u.configureRequest.x += panoramiXdataPtr[0].x;
+ event.u.configureRequest.y += panoramiXdataPtr[0].y;
+ }
+#endif
event.u.configureRequest.width = w;
event.u.configureRequest.height = h;
event.u.configureRequest.borderWidth = bw;
@@ -2350,6 +2472,12 @@ ActuallyDoSomething:
event.u.configureNotify.aboveSibling = None;
event.u.configureNotify.x = x;
event.u.configureNotify.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ event.u.configureNotify.x += panoramiXdataPtr[0].x;
+ event.u.configureNotify.y += panoramiXdataPtr[0].y;
+ }
+#endif
event.u.configureNotify.width = w;
event.u.configureNotify.height = h;
event.u.configureNotify.borderWidth = bw;
@@ -2383,7 +2511,6 @@ ActuallyDoSomething:
if (action != RESTACK_WIN)
CheckCursorConfinement(pWin);
-
return(Success);
#undef RESTACK_WIN
#undef MOVE_WIN
@@ -2461,9 +2588,15 @@ CirculateWindow(pParent, direction, client)
}
static int
+#if NeedFunctionPrototypes
+CompareWIDs(
+ WindowPtr pWin,
+ pointer value) /* must conform to VisitWindowProcPtr */
+#else
CompareWIDs(pWin, value)
WindowPtr pWin;
pointer value; /* must conform to VisitWindowProcPtr */
+#endif
{
Window *wid = (Window *)value;
@@ -2503,6 +2636,12 @@ ReparentWindow(pWin, pParent, x, y, client)
event.u.reparent.parent = pParent->drawable.id;
event.u.reparent.x = x;
event.u.reparent.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && !pParent->parent) {
+ event.u.reparent.x += panoramiXdataPtr[0].x;
+ event.u.reparent.y += panoramiXdataPtr[0].y;
+ }
+#endif
event.u.reparent.override = pWin->overrideRedirect;
DeliverEvents(pWin, &event, 1, pParent);
@@ -2566,11 +2705,15 @@ ReparentWindow(pWin, pParent, x, y, client)
}
static void
+#if NeedFunctionPrototypes
+RealizeTree(WindowPtr pWin)
+#else
RealizeTree(pWin)
WindowPtr pWin;
+#endif
{
register WindowPtr pChild;
- Bool (* Realize)();
+ RealizeWindowProcPtr Realize;
Realize = pWin->drawable.pScreen->RealizeWindow;
pChild = pWin;
@@ -2854,9 +2997,15 @@ MapSubwindows(pParent, client)
}
static void
+#if NeedFunctionPrototypes
+UnrealizeTree(
+ WindowPtr pWin,
+ Bool fromConfigure)
+#else
UnrealizeTree(pWin, fromConfigure)
WindowPtr pWin;
Bool fromConfigure;
+#endif
{
register WindowPtr pChild;
UnrealizeWindowProcPtr Unrealize;
@@ -2871,6 +3020,15 @@ UnrealizeTree(pWin, fromConfigure)
{
pChild->realized = FALSE;
pChild->visibility = VisibilityNotViewable;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
+ PanoramiXRes *win;
+ win = (PanoramiXRes*)LookupIDByType(pChild->drawable.id,
+ XRT_WINDOW);
+ if(win)
+ win->u.win.visibility = VisibilityNotViewable;
+ }
+#endif
(* Unrealize)(pChild);
DeleteWindowFromAnyEvents(pChild, FALSE);
if (pChild->viewable)
@@ -2978,7 +3136,7 @@ UnmapSubwindows(pWin)
Bool wasViewable = (Bool)pWin->viewable;
Bool anyMarked = FALSE;
Mask parentNotify;
- WindowPtr pLayerWin;
+ WindowPtr pLayerWin = NULL;
ScreenPtr pScreen = pWin->drawable.pScreen;
if (!pWin->firstChild)
@@ -3139,15 +3297,71 @@ NotClippedByChildren(pWin)
return(pReg);
}
-
void
SendVisibilityNotify(pWin)
WindowPtr pWin;
{
xEvent event;
+ unsigned int visibility = pWin->visibility;
+
+#ifdef PANORAMIX
+ /* This is not quite correct yet, but it's close */
+ if(!noPanoramiXExtension) {
+ PanoramiXRes *win;
+ WindowPtr pWin2;
+ int i, Scrnum;
+
+ Scrnum = pWin->drawable.pScreen->myNum;
+
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, Scrnum);
+
+ if(!win || (win->u.win.visibility == visibility))
+ return;
+
+ switch(visibility) {
+ case VisibilityUnobscured:
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ if(i == Scrnum) continue;
+
+ pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW);
+
+ if (pWin2) {
+ if(pWin2->visibility == VisibilityPartiallyObscured)
+ return;
+
+ if(!i) pWin = pWin2;
+ }
+ }
+ break;
+ case VisibilityPartiallyObscured:
+ if(Scrnum) {
+ pWin2 = (WindowPtr)LookupIDByType(win->info[0].id, RT_WINDOW);
+ if (pWin2) pWin = pWin2;
+ }
+ break;
+ case VisibilityFullyObscured:
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ if(i == Scrnum) continue;
+
+ pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW);
+
+ if (pWin2) {
+ if(pWin2->visibility != VisibilityFullyObscured)
+ return;
+
+ if(!i) pWin = pWin2;
+ }
+ }
+ break;
+ }
+
+ win->u.win.visibility = visibility;
+ }
+#endif
+
event.u.u.type = VisibilityNotify;
event.u.visibility.window = pWin->drawable.id;
- event.u.visibility.state = pWin->visibility;
+ event.u.visibility.state = visibility;
DeliverEvents(pWin, &event, 1, NullWindow);
}
@@ -3155,7 +3369,6 @@ SendVisibilityNotify(pWin)
#define RANDOM_WIDTH 32
#ifndef NOLOGOHACK
-extern int logoScreenSaver;
static void DrawLogo(
#if NeedFunctionPrototypes
WindowPtr /*pWin*/
@@ -3237,6 +3450,15 @@ SaveScreens(on, mode)
#endif
screenIsSaved = SCREEN_SAVER_ON;
}
+ /*
+ * Call the DDX saver in case it wants to do something
+ * at cycle time
+ */
+ else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
+ {
+ (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
+ type);
+ }
break;
case SCREEN_SAVER_ON:
if (ScreenSaverBlanking != DontPreferBlanking)
@@ -3268,9 +3490,13 @@ SaveScreens(on, mode)
}
static Bool
+#if NeedFunctionPrototypes
+TileScreenSaver(int i, int kind)
+#else
TileScreenSaver(i, kind)
int i;
int kind;
+#endif
{
int j;
int result;
@@ -3280,7 +3506,7 @@ TileScreenSaver(i, kind)
CursorMetricRec cm;
unsigned char *srcbits, *mskbits;
CursorPtr cursor;
- XID cursorID;
+ XID cursorID = 0;
int attri;
mask = 0;
@@ -3510,17 +3736,40 @@ DisposeWindowOptional (pWin)
* everything is peachy. Delete the optional record
* and clean up
*/
- if (pWin->cursorIsNone == FALSE)
+ /*
+ * TOG changed this code to:
+ *
+ * if (pWin->cursorIsNone == FALSE)
+ * FreeCursor (pWin->optional->cursor, (Cursor)0);
+ * pWin->cursorIsNone = TRUE;
+ *
+ * This is blatently wrong; windows without optionals can have
+ * two different cursor values, either None or sharing their
+ * parents cursor. This difference is controlled by the
+ * cursorIsNone value; when TRUE, the window has no cursor,
+ * when false, it shares its cursor with its parent; TOG
+ * made it impossible for a window to have a cursor without
+ * an optional record.
+ */
+ if (pWin->optional->cursor)
+ {
FreeCursor (pWin->optional->cursor, (Cursor)0);
- pWin->cursorIsNone = TRUE;
+ pWin->cursorIsNone = FALSE;
+ }
+ else
+ pWin->cursorIsNone = TRUE;
xfree (pWin->optional);
pWin->optional = NULL;
}
#ifndef NOLOGOHACK
static void
+#if NeedFunctionPrototypes
+DrawLogo(WindowPtr pWin)
+#else
DrawLogo(pWin)
WindowPtr pWin;
+#endif
{
DrawablePtr pDraw;
ScreenPtr pScreen;
diff --git a/dix/xpstubs.c b/dix/xpstubs.c
index 2702b453d..a48a81402 100644
--- a/dix/xpstubs.c
+++ b/dix/xpstubs.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/dix/xpstubs.c,v 1.4 2001/12/20 19:41:00 tsi Exp $ */
/*
Copyright 1996, 1998 The Open Group
@@ -43,7 +44,6 @@ XpClientIsPrintClient(client, fpe)
{
return FALSE;
}
-
int
XprintOptions(argc, argv, i)
int argc;