aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2018-02-26 05:12:20 +0100
committerMihai Moldovan <ionic@ionic.de>2018-02-26 05:12:20 +0100
commita9787fc2e79065e8f56fdace41f4e565667c22bb (patch)
tree19559f26bed90d12689ee47145b27fcd7619820a /nx-X11/programs/Xserver
parentb40dec982d17b010cedc183ebdc4c75ca7de785f (diff)
parent6dcfcbabe6b87467a6f811d0dc03efba7bfce8e4 (diff)
downloadnx-libs-a9787fc2e79065e8f56fdace41f4e565667c22bb.tar.gz
nx-libs-a9787fc2e79065e8f56fdace41f4e565667c22bb.tar.bz2
nx-libs-a9787fc2e79065e8f56fdace41f4e565667c22bb.zip
Merge branch 'uli42-pr/update_dix' into 3.6.x
Attributes GH PR #646: https://github.com/ArcticaProject/nx-libs/pull/646
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r--nx-X11/programs/Xserver/dix/atom.c2
-rw-r--r--nx-X11/programs/Xserver/dix/colormap.c10
-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/globals.c13
-rw-r--r--nx-X11/programs/Xserver/dix/main.c3
-rw-r--r--nx-X11/programs/Xserver/dix/pixmap.c9
-rw-r--r--nx-X11/programs/Xserver/dix/privates.c58
-rw-r--r--nx-X11/programs/Xserver/dix/swaprep.c6
-rw-r--r--nx-X11/programs/Xserver/dix/swapreq.c2
-rw-r--r--nx-X11/programs/Xserver/dix/window.c80
-rw-r--r--nx-X11/programs/Xserver/dix/xpstubs.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXevents.c5
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXproperty.c8
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXwindow.c56
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/man/nxagent.15
-rw-r--r--nx-X11/programs/Xserver/include/colormapst.h19
-rw-r--r--nx-X11/programs/Xserver/include/extension.h12
-rw-r--r--nx-X11/programs/Xserver/include/extnsionst.h3
-rw-r--r--nx-X11/programs/Xserver/include/opaque.h2
-rw-r--r--nx-X11/programs/Xserver/include/pixmapstr.h13
-rw-r--r--nx-X11/programs/Xserver/include/window.h7
-rw-r--r--nx-X11/programs/Xserver/os/utils.c2
26 files changed, 328 insertions, 131 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 81b93d2de..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"
@@ -273,6 +276,13 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
pmap = (ColormapPtr) malloc(sizebytes);
if (!pmap)
return (BadAlloc);
+#if defined(_XSERVER64)
+ pmap->pad0 = 0;
+ pmap->pad1 = 0;
+#if (X_BYTE_ORDER == X_LITTLE_ENDIAN)
+ pmap->pad2 = 0;
+#endif
+#endif
pmap->red = (EntryPtr)((char *)pmap + sizeof(ColormapRec));
sizebytes = size * sizeof(Entry);
pmap->clientPixelsRed = (Pixel **)((char *)pmap->red + sizebytes);
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/globals.c b/nx-X11/programs/Xserver/dix/globals.c
index 6f4774a5c..8bfd84606 100644
--- a/nx-X11/programs/Xserver/dix/globals.c
+++ b/nx-X11/programs/Xserver/dix/globals.c
@@ -89,7 +89,7 @@ unsigned long serverGeneration = 0;
/* these next four are initialized in main.c */
CARD32 ScreenSaverTime;
CARD32 ScreenSaverInterval;
-int ScreenSaverBlanking;
+int ScreenSaverBlanking;
int ScreenSaverAllowExposures;
#ifdef DPMSExtension
@@ -103,15 +103,15 @@ int ScreenSaverAllowExposures;
# define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4
# endif
# ifndef DEFAULT_DPMS_ENABLED
-# define DEFAULT_DPMS_ENABLED FALSE
+# define DEFAULT_DPMS_ENABLED TRUE
# endif
CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME;
CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME;
CARD32 defaultDPMSOffTime = DEFAULT_OFF_TIME;
CARD16 DPMSPowerLevel = 0;
Bool defaultDPMSEnabled = DEFAULT_DPMS_ENABLED;
-Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command line */
-Bool DPMSDisabledSwitch = FALSE; /* switch states */
+Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command */
+Bool DPMSDisabledSwitch = FALSE; /* line switch states */
Bool DPMSCapableFlag = FALSE;
CARD32 DPMSStandbyTime;
CARD32 DPMSSuspendTime;
@@ -140,15 +140,12 @@ FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in
Bool loadableFonts = FALSE;
CursorPtr rootCursor;
Bool blackRoot=FALSE;
+Bool whiteRoot=FALSE;
ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */
TimeStamp currentTime;
TimeStamp lastDeviceEventTime;
-Bool permitOldBugs = FALSE; /* turn off some error checking, to permit certain
- * old broken clients (like R2/R3 xterms) to work
- */
-
int defaultColorVisualClass = -1;
int monitorResolution = 0;
diff --git a/nx-X11/programs/Xserver/dix/main.c b/nx-X11/programs/Xserver/dix/main.c
index eb8f359a6..d425872df 100644
--- a/nx-X11/programs/Xserver/dix/main.c
+++ b/nx-X11/programs/Xserver/dix/main.c
@@ -167,7 +167,7 @@ ReplyNotSwappd(
int
main(int argc, char *argv[], char *envp[])
{
- int i, error;
+ int i;
char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
@@ -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/pixmap.c b/nx-X11/programs/Xserver/dix/pixmap.c
index 709f413ed..247fa34ab 100644
--- a/nx-X11/programs/Xserver/dix/pixmap.c
+++ b/nx-X11/programs/Xserver/dix/pixmap.c
@@ -124,6 +124,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
* is a quick workaround intended to fix a problem reported
* by Valgrind due to fbBlt() writing just after the end of
* the pixmap buffer. This may be a RENDER bug.
+ * This is not included in xorg upstream!
*/
pPixmap = (PixmapPtr)calloc(1, pScreen->totalPixmapSize + pixDataSize + 4);
@@ -146,5 +147,13 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
#else
pPixmap = (PixmapPtr)calloc(1, sizeof(PixmapRec) + pixDataSize);
#endif
+
+#ifdef _XSERVER64
+ if (pPixmap) {
+ pPixmap->drawable.pad0 = 0;
+ pPixmap->drawable.pad1 = 0;
+ }
+#endif
+
return pPixmap;
}
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/swaprep.c b/nx-X11/programs/Xserver/dix/swaprep.c
index 74dae817d..315e05016 100644
--- a/nx-X11/programs/Xserver/dix/swaprep.c
+++ b/nx-X11/programs/Xserver/dix/swaprep.c
@@ -354,8 +354,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
WriteToClient(pClient, size, pRep);
}
-static
-void
+static void
SwapCharInfo(xCharInfo *pInfo)
{
swaps(&pInfo->leftSideBearing);
@@ -380,8 +379,7 @@ SwapFontInfo(xQueryFontReply *pr)
swapl(&pr->nCharInfos);
}
-static
-void
+static void
SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
{
unsigned i;
diff --git a/nx-X11/programs/Xserver/dix/swapreq.c b/nx-X11/programs/Xserver/dix/swapreq.c
index 7ea841e12..c88a48b14 100644
--- a/nx-X11/programs/Xserver/dix/swapreq.c
+++ b/nx-X11/programs/Xserver/dix/swapreq.c
@@ -61,7 +61,6 @@ SOFTWARE.
/* Thanks to Jack Palevich for testing and subsequently rewriting all this */
/* Byte swap a list of longs */
-
void
SwapLongs (register CARD32 *list, register unsigned long count)
{
@@ -86,7 +85,6 @@ SwapLongs (register CARD32 *list, register unsigned long count)
}
/* Byte swap a list of shorts */
-
void
SwapShorts (register short *list, register unsigned long count)
{
diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c
index ba9cfc2d2..300c1a7fc 100644
--- a/nx-X11/programs/Xserver/dix/window.c
+++ b/nx-X11/programs/Xserver/dix/window.c
@@ -1,5 +1,27 @@
/*
+Copyright (c) 2006, Red Hat, Inc.
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+RED HAT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Red Hat shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from Red Hat.
+
Copyright 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
@@ -320,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);
@@ -358,6 +377,10 @@ AllocateWindow(ScreenPtr pScreen)
else
ppriv->ptr = (void *)NULL;
}
+#if _XSERVER64
+ pWin->drawable.pad0 = 0;
+ pWin->drawable.pad1 = 0;
+#endif
}
return pWin;
}
@@ -481,6 +504,7 @@ void
InitRootWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
+ int backFlag = CWBorderPixel | CWCursor | CWBackingStore;
if (!(*pScreen->CreateWindow)(pWin))
return; /* XXX */
@@ -489,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);
}
@@ -2059,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)
{
@@ -2074,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)
{
@@ -2089,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)
{
@@ -2709,7 +2744,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
}
pWin->mapped = TRUE;
- if (SubStrSend(pWin, pParent))
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
{
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapNotify;
@@ -2968,7 +3003,7 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
if ((!pWin->mapped) || (!(pParent = pWin->parent)))
return(Success);
- if (SubStrSend(pWin, pParent))
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
{
memset(&event, 0, sizeof(xEvent));
event.u.u.type = UnmapNotify;
@@ -3271,6 +3306,29 @@ SendVisibilityNotify(WindowPtr pWin)
DeliverEvents(pWin, &event, 1, NullWindow);
}
+static WindowPtr windowDisableMapUnmapEvents;
+
+void
+DisableMapUnmapEvents(WindowPtr pWin)
+{
+ assert (windowDisableMapUnmapEvents == NULL);
+
+ windowDisableMapUnmapEvents = pWin;
+}
+
+void
+EnableMapUnmapEvents(WindowPtr pWin)
+{
+ assert (windowDisableMapUnmapEvents != NULL);
+
+ windowDisableMapUnmapEvents = NULL;
+}
+
+Bool
+MapUnmapEventsEnabled(WindowPtr pWin)
+{
+ return pWin != windowDisableMapUnmapEvents;
+}
#define RANDOM_WIDTH 32
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(
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c
index 43cb806e7..727246cc7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c
@@ -547,13 +547,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;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
index 882dbe61b..6292b3508 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
@@ -208,14 +208,11 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
Bool sendevent)
{
PropertyPtr pProp;
- xEvent event;
int sizeInBytes;
int totalSize;
void * data;
int copySize;
- memset(&event, 0, sizeof(xEvent));
-
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
@@ -278,7 +275,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
{
if (totalSize != pProp->size * (pProp->format >> 3))
{
- data = (void *)realloc(pProp->data, totalSize);
+ data = (void *)realloc(pProp->data, totalSize);
if (!data && len)
return(BadAlloc);
pProp->data = data;
@@ -320,6 +317,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
}
if (sendevent)
{
+ xEvent event;
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyNewValue;
@@ -350,7 +349,6 @@ ProcGetProperty(ClientPtr client)
REQUEST(xGetPropertyReq);
REQUEST_SIZE_MATCH(xGetPropertyReq);
-
if (stuff->delete)
UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
index 5df252d34..d108d3ef3 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
@@ -138,9 +138,7 @@ extern void nxagentSetVersionProperty(WindowPtr pWin);
void nxagentClearSplash(WindowPtr pW)
{
- ScreenPtr pScreen;
-
- pScreen = pW->drawable.pScreen;
+ ScreenPtr pScreen = pW->drawable.pScreen;
if (pW->backgroundState == BackgroundPixmap)
{
@@ -189,9 +187,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);
@@ -203,7 +198,8 @@ MakeRootTile(WindowPtr pWin)
void
InitRootWindow(WindowPtr pWin)
{
- ScreenPtr pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ int backFlag = CWBorderPixel | CWCursor | CWBackingStore;
#ifdef TEST
fprintf(stderr, "InitRootWindow: Called for window at [%p][%ld] with parent [%p].\n",
@@ -220,8 +216,6 @@ InitRootWindow(WindowPtr pWin)
nxagentRootlessWindow = pWin;
}
- pScreen = pWin->drawable.pScreen;
-
/*
* A root window is created for each screen by main
* and the pointer is saved in screenInfo.screens as
@@ -254,20 +248,34 @@ InitRootWindow(WindowPtr pWin)
pWin->cursorIsNone = FALSE;
pWin->optional->cursor = rootCursor;
rootCursor->refcnt++;
+
+#ifdef NXAGENT_SPLASH
+ if (blackRoot)
+ pWin->background.pixel = pScreen->blackPixel;
+ else
+ pWin->background.pixel = pScreen->whitePixel;
+ backFlag |= CWBackPixel;
+
+ MakeRootTile(pWin);
+#else
+ if (!blackRoot && !whiteRoot) {
+ MakeRootTile(pWin);
+ backFlag |= CWBackPixmap;
+ }
+ else {
+ if (blackRoot)
+ pWin->background.pixel = pScreen->blackPixel;
+ else
+ pWin->background.pixel = pScreen->whitePixel;
+ backFlag |= CWBackPixel;
+ }
+#endif
+
pWin->backingStore = defaultBackingStore;
pWin->forcedBS = (defaultBackingStore != NotUseful);
- #ifdef NXAGENT_SPLASH
/* We SHOULD check for an error value here XXX */
- pWin -> background.pixel = pScreen -> blackPixel;
- (*pScreen->ChangeWindowAttributes)(pWin,
- CWBackPixel|CWBorderPixel|CWCursor|CWBackingStore);
- #else
- (*pScreen->ChangeWindowAttributes)(pWin,
- CWBackPixmap|CWBorderPixel|CWCursor|CWBackingStore);
- #endif
-
- MakeRootTile(pWin);
+ (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
/*
* Map both the root and the default agent window.
@@ -310,6 +318,7 @@ DeleteWindow(void * value, XID wid)
{
register WindowPtr pParent;
register WindowPtr pWin = (WindowPtr)value;
+ xEvent event;
UnmapWindow(pWin, FALSE);
@@ -318,7 +327,7 @@ DeleteWindow(void * value, XID wid)
pParent = pWin->parent;
if (wid && pParent && SubStrSend(pWin, pParent))
{
- xEvent event = {0};
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = DestroyNotify;
event.u.destroyNotify.window = pWin->drawable.id;
DeliverEvents(pWin, &event, 1, NullWindow);
@@ -874,7 +883,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
}
pWin->mapped = TRUE;
- if (SubStrSend(pWin, pParent))
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
{
memset(&event, 0, sizeof(xEvent));
event.u.u.type = MapNotify;
@@ -945,6 +954,7 @@ int
UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
{
register WindowPtr pParent;
+ xEvent event;
Bool wasRealized = (Bool)pWin->realized;
Bool wasViewable = (Bool)pWin->viewable;
ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -960,9 +970,9 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
if ((!pWin->mapped) || (!(pParent = pWin->parent)))
return(Success);
- if (SubStrSend(pWin, pParent))
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
{
- xEvent event = {0};
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = UnmapNotify;
event.u.unmapNotify.window = pWin->drawable.id;
event.u.unmapNotify.fromConfigure = fromConfigure;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1
index 1c0fe5fa4..d06cb8495 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1
+++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1
@@ -139,11 +139,6 @@ specifies a file which contains a collection of authorization records used
to authenticate access. See also the \fIxdm\fP(1) and
\fIXsecurity\fP(__miscmansuffix__) manual pages.
.TP 8
-.B bc
-disables certain kinds of error checking, for bug compatibility with
-previous releases (e.g., to work around bugs in R2 and R3 xterms and toolkits).
-Deprecated.
-.TP 8
.B \-bs
disables backing store support on all screens.
.TP 8
diff --git a/nx-X11/programs/Xserver/include/colormapst.h b/nx-X11/programs/Xserver/include/colormapst.h
index a8fa055de..d26987581 100644
--- a/nx-X11/programs/Xserver/include/colormapst.h
+++ b/nx-X11/programs/Xserver/include/colormapst.h
@@ -48,6 +48,8 @@ SOFTWARE.
#ifndef CMAPSTRUCT_H
#define CMAPSTRUCT_H 1
+#include <nx-X11/Xarch.h>
+
#include "colormap.h"
#include "screenint.h"
@@ -88,15 +90,26 @@ typedef struct _CMEntry
Bool fShared;
} Entry;
-/* COLORMAPs can be used for either Direct or Pseudo color. PseudoColor
+/*
+ * COLORMAPs can be used for either Direct or Pseudo color. PseudoColor
* only needs one cell table, we arbitrarily pick red. We keep track
- * of that table with freeRed, numPixelsRed, and clientPixelsRed */
+ * of that table with freeRed, numPixelsRed, and clientPixelsRed
+ *
+ * The padN variables are unfortunate ABI BC. See fdo bug #6924.
+ */
typedef struct _ColormapRec
{
VisualPtr pVisual;
short class; /* PseudoColor or DirectColor */
- long mid; /* client's name for colormap */
+#if defined(_XSERVER64)
+ short pad0;
+ XID pad1;
+#endif
+ XID mid; /* client's name for colormap */
+#if defined(_XSERVER64) && (X_BYTE_ORDER == X_LITTLE_ENDIAN)
+ XID pad2;
+#endif
ScreenPtr pScreen; /* screen map is associated with */
short flags; /* 1 = IsDefault
* 2 = AllAllocated */
diff --git a/nx-X11/programs/Xserver/include/extension.h b/nx-X11/programs/Xserver/include/extension.h
index f9e74e82c..74975c50b 100644
--- a/nx-X11/programs/Xserver/include/extension.h
+++ b/nx-X11/programs/Xserver/include/extension.h
@@ -54,6 +54,18 @@ extern unsigned short StandardMinorOpcode(ClientPtr /*client*/);
extern unsigned short MinorOpcodeOfRequest(ClientPtr /*client*/);
+extern Bool EnableDisableExtension(char *name, Bool enable);
+
+extern void EnableDisableExtensionError(char *name, Bool enable);
+
+extern void ResetExtensionPrivates(void);
+
+extern int AllocateExtensionPrivateIndex(void);
+
+extern Bool AllocateExtensionPrivate(
+ int /*index*/,
+ unsigned /*amount*/);
+
extern void InitExtensions(int argc, char **argv);
extern void InitVisualWrap(void);
diff --git a/nx-X11/programs/Xserver/include/extnsionst.h b/nx-X11/programs/Xserver/include/extnsionst.h
index da4cee57c..09cbb6b4c 100644
--- a/nx-X11/programs/Xserver/include/extnsionst.h
+++ b/nx-X11/programs/Xserver/include/extnsionst.h
@@ -48,6 +48,7 @@ SOFTWARE.
#ifndef EXTENSIONSTRUCT_H
#define EXTENSIONSTRUCT_H
+#include "dix.h"
#include "misc.h"
#include "screenint.h"
#include "extension.h"
@@ -71,6 +72,7 @@ typedef struct _ExtensionEntry {
#ifdef XCSECURITY
Bool secure; /* extension visible to untrusted clients? */
#endif
+ DevUnion *devPrivates;
} ExtensionEntry;
/*
@@ -127,6 +129,7 @@ extern Bool AddExtensionAlias(
ExtensionEntry * /*extension*/);
extern ExtensionEntry *CheckExtension(const char *extname);
+extern ExtensionEntry *GetExtensionEntry(int major);
extern ExtensionLookupProc LookupProc(
char* /*name*/,
diff --git a/nx-X11/programs/Xserver/include/opaque.h b/nx-X11/programs/Xserver/include/opaque.h
index 8312b4a21..c68275394 100644
--- a/nx-X11/programs/Xserver/include/opaque.h
+++ b/nx-X11/programs/Xserver/include/opaque.h
@@ -72,10 +72,10 @@ extern int limitStackSpace;
#ifdef RLIMIT_NOFILE
extern int limitNoFile;
#endif
-extern Bool permitOldBugs;
extern Bool defeatAccessControl;
extern long maxBigRequestSize;
extern Bool blackRoot;
+extern Bool whiteRoot;
extern Bool CoreDump;
extern Bool NoListenAll;
diff --git a/nx-X11/programs/Xserver/include/pixmapstr.h b/nx-X11/programs/Xserver/include/pixmapstr.h
index 5d38c1c3b..d7f934a34 100644
--- a/nx-X11/programs/Xserver/include/pixmapstr.h
+++ b/nx-X11/programs/Xserver/include/pixmapstr.h
@@ -47,16 +47,27 @@ SOFTWARE.
#ifndef PIXMAPSTRUCT_H
#define PIXMAPSTRUCT_H
+#include <nx-X11/Xarch.h>
#include "pixmap.h"
#include "screenint.h"
#include "regionstr.h"
+/*
+ * The padN members are unfortunate ABI BC. See fdo bug #6924.
+ */
+
typedef struct _Drawable {
unsigned char type; /* DRAWABLE_<type> */
unsigned char class; /* specific to type */
unsigned char depth;
unsigned char bitsPerPixel;
- unsigned long id; /* resource id */
+#if defined(_XSERVER64)
+ XID pad0;
+#endif
+ XID id; /* resource id */
+#if defined(_XSERVER64)
+ XID pad1;
+#endif
short x; /* window: screen absolute, pixmap: 0 */
short y; /* window: screen absolute, pixmap: 0 */
unsigned short width;
diff --git a/nx-X11/programs/Xserver/include/window.h b/nx-X11/programs/Xserver/include/window.h
index a8c78f569..6e93e8ff8 100644
--- a/nx-X11/programs/Xserver/include/window.h
+++ b/nx-X11/programs/Xserver/include/window.h
@@ -264,4 +264,11 @@ extern RegionPtr CreateBoundingShape(
extern RegionPtr CreateClipShape(
WindowPtr /* pWin */ );
+extern void DisableMapUnmapEvents(
+ WindowPtr /* pWin */ );
+extern void EnableMapUnmapEvents(
+ WindowPtr /* pWin */ );
+extern Bool MapUnmapEventsEnabled(
+ WindowPtr /* pWin */ );
+
#endif /* WINDOW_H */
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index a9c4b2ee4..0ebb64487 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -753,8 +753,6 @@ ProcessCommandLine(int argc, char *argv[])
else
UseMsg();
}
- else if ( strcmp( argv[i], "bc") == 0)
- permitOldBugs = TRUE;
else if ( strcmp( argv[i], "-br") == 0)
blackRoot = TRUE;
else if ( strcmp( argv[i], "+bs") == 0)