aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/dix
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-01-23 00:47:38 +0100
committerMihai Moldovan <ionic@ionic.de>2018-02-26 05:07:49 +0100
commit485d626769c53c7d72ffad2f4e8623d6ce897662 (patch)
treeece8a3df05c586f6782d871fe5a5c9c4617d70f1 /nx-X11/programs/Xserver/dix
parent2853ab292345ef5d1c690289f9d55a0ccdf32450 (diff)
downloadnx-libs-485d626769c53c7d72ffad2f4e8623d6ce897662.tar.gz
nx-libs-485d626769c53c7d72ffad2f4e8623d6ce897662.tar.bz2
nx-libs-485d626769c53c7d72ffad2f4e8623d6ce897662.zip
Lift dix to xorg-xserver-1.3.0.0 state
Diffstat (limited to 'nx-X11/programs/Xserver/dix')
-rw-r--r--nx-X11/programs/Xserver/dix/atom.c2
-rw-r--r--nx-X11/programs/Xserver/dix/colormap.c3
-rw-r--r--nx-X11/programs/Xserver/dix/devices.c41
-rw-r--r--nx-X11/programs/Xserver/dix/dispatch.c21
-rw-r--r--nx-X11/programs/Xserver/dix/events.c27
-rw-r--r--nx-X11/programs/Xserver/dix/extension.c51
-rw-r--r--nx-X11/programs/Xserver/dix/ffs.c2
-rw-r--r--nx-X11/programs/Xserver/dix/main.c1
-rw-r--r--nx-X11/programs/Xserver/dix/privates.c58
-rw-r--r--nx-X11/programs/Xserver/dix/window.c27
-rw-r--r--nx-X11/programs/Xserver/dix/xpstubs.c2
11 files changed, 164 insertions, 71 deletions
diff --git a/nx-X11/programs/Xserver/dix/atom.c b/nx-X11/programs/Xserver/dix/atom.c
index d569c2314..c15a05bb7 100644
--- a/nx-X11/programs/Xserver/dix/atom.c
+++ b/nx-X11/programs/Xserver/dix/atom.c
@@ -52,6 +52,8 @@ SOFTWARE.
#include <nx-X11/X.h>
#include <nx-X11/Xatom.h>
+#include <stdio.h>
+#include <string.h>
#include "misc.h"
#include "resource.h"
#include "dix.h"
diff --git a/nx-X11/programs/Xserver/dix/colormap.c b/nx-X11/programs/Xserver/dix/colormap.c
index 42ba8002a..db2b64714 100644
--- a/nx-X11/programs/Xserver/dix/colormap.c
+++ b/nx-X11/programs/Xserver/dix/colormap.c
@@ -52,6 +52,9 @@ SOFTWARE.
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
#include "misc.h"
#include "dix.h"
#include "colormapst.h"
diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c
index b93a40d97..1c7572d64 100644
--- a/nx-X11/programs/Xserver/dix/devices.c
+++ b/nx-X11/programs/Xserver/dix/devices.c
@@ -74,7 +74,7 @@ SOFTWARE.
#include "dixevents.h"
DeviceIntPtr
-_AddInputDevice(DeviceProc deviceProc, Bool autoStart)
+AddInputDevice(DeviceProc deviceProc, Bool autoStart)
{
register DeviceIntPtr dev;
@@ -348,7 +348,7 @@ NumMotionEvents()
}
void
-_RegisterPointerDevice(DeviceIntPtr device)
+RegisterPointerDevice(DeviceIntPtr device)
{
inputInfo.pointer = device;
#ifdef XKB
@@ -371,7 +371,7 @@ _RegisterPointerDevice(DeviceIntPtr device)
}
void
-_RegisterKeyboardDevice(DeviceIntPtr device)
+RegisterKeyboardDevice(DeviceIntPtr device)
{
inputInfo.keyboard = device;
#ifdef XKB
@@ -1611,38 +1611,3 @@ ProcQueryKeymap(ClientPtr client)
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
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
-
-DevicePtr
-AddInputDevice(DeviceProc deviceProc, Bool autoStart)
-{
- return (DevicePtr)_AddInputDevice(deviceProc, autoStart);
-}
-#endif /* AddInputDevice */
-
-#ifdef RegisterPointerDevice
-#undef RegisterPointerDevice
-
-void
-RegisterPointerDevice(DevicePtr device)
-{
- _RegisterPointerDevice((DeviceIntPtr)device);
-}
-#endif /* RegisterPointerDevice */
-
-#ifdef RegisterKeyboardDevice
-#undef RegisterKeyboardDevice
-
-void
-RegisterKeyboardDevice(DevicePtr device)
-{
- _RegisterKeyboardDevice((DeviceIntPtr)device);
-}
-#endif /* RegisterKeyboardDevice */
diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c
index 6f32f51f3..3c791465e 100644
--- a/nx-X11/programs/Xserver/dix/dispatch.c
+++ b/nx-X11/programs/Xserver/dix/dispatch.c
@@ -2453,7 +2453,7 @@ ProcCreateColormap(register ClientPtr client)
return(result);
}
client->errorValue = stuff->visual;
- return(BadValue);
+ return(BadMatch);
}
int
@@ -3608,6 +3608,10 @@ CloseDownRetainedResources()
}
}
+extern int clientPrivateLen;
+extern unsigned *clientPrivateSizes;
+extern unsigned totalClientSize;
+
void InitClient(ClientPtr client, int i, void * ospriv)
{
client->index = i;
@@ -3648,10 +3652,6 @@ void InitClient(ClientPtr client, int i, void * ospriv)
client->clientIds = NULL;
}
-extern int clientPrivateLen;
-extern unsigned *clientPrivateSizes;
-extern unsigned totalClientSize;
-
#ifndef NXAGENT_SERVER
int
InitClientPrivates(ClientPtr client)
@@ -3685,6 +3685,17 @@ InitClientPrivates(ClientPtr client)
else
ppriv->ptr = (void *)NULL;
}
+
+ /* Allow registrants to initialize the serverClient devPrivates */
+ if (!client->index && ClientStateCallback)
+ {
+ NewClientInfoRec clientinfo;
+
+ clientinfo.client = client;
+ clientinfo.prefix = (xConnSetupPrefix *)NULL;
+ clientinfo.setup = (xConnSetup *) NULL;
+ CallCallbacks((&ClientStateCallback), (void *)&clientinfo);
+ }
return 1;
}
#endif /* NXAGENT_SERVER */
diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c
index 73187f712..e936be77e 100644
--- a/nx-X11/programs/Xserver/dix/events.c
+++ b/nx-X11/programs/Xserver/dix/events.c
@@ -2837,9 +2837,6 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
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)
@@ -2856,9 +2853,6 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
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)
@@ -3033,7 +3027,7 @@ EventSuppressForWindow(register WindowPtr pWin, register ClientPtr client,
{
register int i, free;
- if ((mask & ~PropagateMask) && !permitOldBugs)
+ if (mask & ~PropagateMask)
{
client->errorValue = mask;
return BadValue;
@@ -3587,7 +3581,7 @@ ProcGrabPointer(ClientPtr client)
client->errorValue = stuff->ownerEvents;
return BadValue;
}
- if ((stuff->eventMask & ~PointerGrabMask) && !permitOldBugs)
+ if (stuff->eventMask & ~PointerGrabMask)
{
client->errorValue = stuff->eventMask;
return BadValue;
@@ -3674,7 +3668,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
TimeStamp time;
REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
- if ((stuff->eventMask & ~PointerGrabMask) && !permitOldBugs)
+ if (stuff->eventMask & ~PointerGrabMask)
{
client->errorValue = stuff->eventMask;
return BadValue;
@@ -3975,13 +3969,12 @@ ProcSendEvent(ClientPtr client)
if (stuff->event.u.u.type == ClientMessage &&
stuff->event.u.u.detail != 8 &&
stuff->event.u.u.detail != 16 &&
- stuff->event.u.u.detail != 32 &&
- !permitOldBugs)
+ stuff->event.u.u.detail != 32)
{
client->errorValue = stuff->event.u.u.detail;
return BadValue;
}
- if ((stuff->eventMask & ~AllEventMasks) && !permitOldBugs)
+ if (stuff->eventMask & ~AllEventMasks)
{
client->errorValue = stuff->eventMask;
return BadValue;
@@ -4199,12 +4192,10 @@ ProcGrabButton(ClientPtr client)
grab = CreateGrab(client->index, inputInfo.pointer, pWin,
- permitOldBugs ? (Mask)(stuff->eventMask |
- ButtonPressMask | ButtonReleaseMask) :
- (Mask)stuff->eventMask,
- (Bool)stuff->ownerEvents, (Bool) stuff->keyboardMode,
- (Bool)stuff->pointerMode, inputInfo.keyboard, stuff->modifiers,
- ButtonPress, stuff->button, confineTo, cursor);
+ (Mask)stuff->eventMask, (Bool)stuff->ownerEvents,
+ (Bool) stuff->keyboardMode, (Bool)stuff->pointerMode,
+ inputInfo.keyboard, stuff->modifiers, ButtonPress,
+ stuff->button, confineTo, cursor);
if (!grab)
return BadAlloc;
return AddPassiveGrabToList(grab);
diff --git a/nx-X11/programs/Xserver/dix/extension.c b/nx-X11/programs/Xserver/dix/extension.c
index a1701281d..763f57337 100644
--- a/nx-X11/programs/Xserver/dix/extension.c
+++ b/nx-X11/programs/Xserver/dix/extension.c
@@ -75,6 +75,39 @@ int lastEvent = EXTENSION_EVENT_BASE;
static int lastError = FirstExtensionError;
static unsigned int NumExtensions = 0;
+extern int extensionPrivateLen;
+extern unsigned *extensionPrivateSizes;
+extern unsigned totalExtensionSize;
+
+static void
+InitExtensionPrivates(ExtensionEntry *ext)
+{
+ register char *ptr;
+ DevUnion *ppriv;
+ register unsigned *sizes;
+ register unsigned size;
+ register int i;
+
+ if (totalExtensionSize == sizeof(ExtensionEntry))
+ ppriv = (DevUnion *)NULL;
+ else
+ ppriv = (DevUnion *)(ext + 1);
+
+ ext->devPrivates = ppriv;
+ sizes = extensionPrivateSizes;
+ ptr = (char *)(ppriv + extensionPrivateLen);
+ for (i = extensionPrivateLen; --i >= 0; ppriv++, sizes++)
+ {
+ if ( (size = *sizes) )
+ {
+ ppriv->ptr = (void *)ptr;
+ ptr += size;
+ }
+ else
+ ppriv->ptr = (void *)NULL;
+ }
+}
+
ExtensionEntry *
AddExtension(char *name, int NumEvents, int NumErrors,
int (*MainProc)(ClientPtr c1),
@@ -91,9 +124,11 @@ AddExtension(char *name, int NumEvents, int NumErrors,
(unsigned)(lastError + NumErrors > LAST_ERROR))
return((ExtensionEntry *) NULL);
- ext = (ExtensionEntry *) malloc(sizeof(ExtensionEntry));
+ ext = (ExtensionEntry *) malloc(totalExtensionSize);
if (!ext)
return((ExtensionEntry *) NULL);
+ bzero(ext, totalExtensionSize);
+ InitExtensionPrivates(ext);
ext->name = (char *)malloc(strlen(name) + 1);
ext->num_aliases = 0;
ext->aliases = (char **)NULL;
@@ -206,6 +241,20 @@ CheckExtension(const char *extname)
return NULL;
}
+/*
+ * Added as part of Xace.
+ */
+ExtensionEntry *
+GetExtensionEntry(int major)
+{
+ if (major < EXTENSION_BASE)
+ return NULL;
+ major -= EXTENSION_BASE;
+ if (major >= NumExtensions)
+ return NULL;
+ return extensions[major];
+}
+
void
DeclareExtensionSecurity(char *extname, Bool secure)
{
diff --git a/nx-X11/programs/Xserver/dix/ffs.c b/nx-X11/programs/Xserver/dix/ffs.c
index e25d715dd..80fbcc8a9 100644
--- a/nx-X11/programs/Xserver/dix/ffs.c
+++ b/nx-X11/programs/Xserver/dix/ffs.c
@@ -30,6 +30,8 @@ int
ffs(int i)
{
int j;
+ if (i == 0)
+ return 0;
for (j = 1; (i & 1) == 0; j++)
i >>= 1;
return j;
diff --git a/nx-X11/programs/Xserver/dix/main.c b/nx-X11/programs/Xserver/dix/main.c
index d5503676d..d425872df 100644
--- a/nx-X11/programs/Xserver/dix/main.c
+++ b/nx-X11/programs/Xserver/dix/main.c
@@ -263,6 +263,7 @@ main(int argc, char *argv[], char *envp[])
#else
InitGlyphCaching();
#endif /* of HAS_XFONT2 */
+ ResetExtensionPrivates();
ResetClientPrivates();
ResetScreenPrivates();
ResetWindowPrivates();
diff --git a/nx-X11/programs/Xserver/dix/privates.c b/nx-X11/programs/Xserver/dix/privates.c
index a7009054c..6c793ef97 100644
--- a/nx-X11/programs/Xserver/dix/privates.c
+++ b/nx-X11/programs/Xserver/dix/privates.c
@@ -42,6 +42,7 @@ from The Open Group.
#include "servermd.h"
#include "site.h"
#include "inputstr.h"
+#include "extnsionst.h"
/*
* See the Wrappers and devPrivates section in "Definition of the
@@ -50,6 +51,63 @@ from The Open Group.
*/
/*
+ * extension private machinery
+ */
+
+static int extensionPrivateCount;
+int extensionPrivateLen;
+unsigned *extensionPrivateSizes;
+unsigned totalExtensionSize;
+
+void
+ResetExtensionPrivates()
+{
+ extensionPrivateCount = 0;
+ extensionPrivateLen = 0;
+ free(extensionPrivateSizes);
+ extensionPrivateSizes = (unsigned *)NULL;
+ totalExtensionSize =
+ ((sizeof(ExtensionEntry) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
+}
+
+int
+AllocateExtensionPrivateIndex()
+{
+ return extensionPrivateCount++;
+}
+
+Bool
+AllocateExtensionPrivate(int index2, unsigned amount)
+{
+ unsigned oldamount;
+
+ /* Round up sizes for proper alignment */
+ amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
+
+ if (index2 >= extensionPrivateLen)
+ {
+ unsigned *nsizes;
+ nsizes = (unsigned *)realloc(extensionPrivateSizes,
+ (index2 + 1) * sizeof(unsigned));
+ if (!nsizes)
+ return FALSE;
+ while (extensionPrivateLen <= index2)
+ {
+ nsizes[extensionPrivateLen++] = 0;
+ totalExtensionSize += sizeof(DevUnion);
+ }
+ extensionPrivateSizes = nsizes;
+ }
+ oldamount = extensionPrivateSizes[index2];
+ if (amount > oldamount)
+ {
+ extensionPrivateSizes[index2] = amount;
+ totalExtensionSize += (amount - oldamount);
+ }
+ return TRUE;
+}
+
+/*
* client private machinery
*/
diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c
index 5f9d234b7..300c1a7fc 100644
--- a/nx-X11/programs/Xserver/dix/window.c
+++ b/nx-X11/programs/Xserver/dix/window.c
@@ -342,9 +342,6 @@ MakeRootTile(WindowPtr 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);
@@ -507,6 +504,7 @@ void
InitRootWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
+ int backFlag = CWBorderPixel | CWCursor | CWBackingStore;
if (!(*pScreen->CreateWindow)(pWin))
return; /* XXX */
@@ -515,12 +513,23 @@ InitRootWindow(WindowPtr pWin)
pWin->cursorIsNone = FALSE;
pWin->optional->cursor = rootCursor;
rootCursor->refcnt++;
- MakeRootTile(pWin);
+
+ if (!blackRoot && !whiteRoot) {
+ MakeRootTile(pWin);
+ backFlag |= CWBackPixmap;
+ }
+ else {
+ if (blackRoot)
+ pWin->background.pixel = pScreen->blackPixel;
+ else
+ pWin->background.pixel = pScreen->whitePixel;
+ backFlag |= CWBackPixel;
+ }
+
pWin->backingStore = defaultBackingStore;
pWin->forcedBS = (defaultBackingStore != NotUseful);
/* We SHOULD check for an error value here XXX */
- (*pScreen->ChangeWindowAttributes)(pWin,
- CWBackPixmap|CWBorderPixel|CWCursor|CWBackingStore);
+ (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
MapWindow(pWin, serverClient);
}
@@ -2085,7 +2094,7 @@ WhereDoIGoInTheStack(
else
return NullWindow;
case TopIf:
- if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs)
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
return(pWin->nextSib);
else if (pSib)
{
@@ -2100,7 +2109,7 @@ WhereDoIGoInTheStack(
else
return(pWin->nextSib);
case BottomIf:
- if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs)
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
return(pWin->nextSib);
else if (pSib)
{
@@ -2115,7 +2124,7 @@ WhereDoIGoInTheStack(
else
return(pWin->nextSib);
case Opposite:
- if ((!pWin->mapped || (pSib && !pSib->mapped)) && !permitOldBugs)
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
return(pWin->nextSib);
else if (pSib)
{
diff --git a/nx-X11/programs/Xserver/dix/xpstubs.c b/nx-X11/programs/Xserver/dix/xpstubs.c
index ade0847d3..f8cd207eb 100644
--- a/nx-X11/programs/Xserver/dix/xpstubs.c
+++ b/nx-X11/programs/Xserver/dix/xpstubs.c
@@ -31,6 +31,8 @@ from The Open Group.
#include "misc.h"
#include <X11/fonts/font.h>
+extern Bool XpClientIsBitmapClient(ClientPtr client);
+extern Bool XpClientIsPrintClient(ClientPtr client, FontPathElementPtr fpe);
Bool
XpClientIsBitmapClient(