summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-04-19 22:28:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-19 22:28:22 +1000
commitd5ad14c8ed4d8360e1df8cd0bacf6a7c9c31df91 (patch)
treeff87f5a065f759e6d4ff6b2a869ca0e40299c019
parent54716fd3dbc251db9d251d1d0435942efaa63259 (diff)
parent0e0642ee9466d3268476d0084a83a9d93a4aa555 (diff)
Merge branch 'master' into xi2
-rw-r--r--.gitignore3
-rw-r--r--Makefile.am1
-rw-r--r--Xext/security.c42
-rw-r--r--Xext/xselinux.c72
-rw-r--r--Xi/exevents.c13
-rw-r--r--composite/compext.c87
-rw-r--r--composite/compinit.c8
-rw-r--r--configure.ac26
-rw-r--r--dix/Makefile.am4
-rw-r--r--dix/devices.c4
-rw-r--r--dix/main.c1
-rw-r--r--exa/exa_accel.c70
-rw-r--r--exa/exa_glyphs.c33
-rw-r--r--glx/Makefile.am1
-rw-r--r--glx/glxcmds.c291
-rw-r--r--glx/glxdrawable.h8
-rw-r--r--glx/glxdri.c2
-rw-r--r--glx/glxdri2.c34
-rw-r--r--glx/glxdriswrast.c2
-rw-r--r--glx/glxext.c42
-rw-r--r--glx/glxext.h1
-rw-r--r--glx/glxscreens.c7
-rw-r--r--glx/glxutil.c74
-rw-r--r--glx/glxutil.h9
-rw-r--r--glx/xfont.c15
-rw-r--r--hw/kdrive/src/kdrive.c34
-rw-r--r--hw/kdrive/src/kinput.c4
-rw-r--r--hw/vfb/InitInput.c4
-rw-r--r--hw/xfree86/common/xf86Config.c16
-rw-r--r--hw/xfree86/common/xf86Events.c28
-rw-r--r--hw/xfree86/common/xf86Init.c18
-rw-r--r--hw/xfree86/common/xf86Priv.h2
-rw-r--r--hw/xfree86/common/xf86RandR.c1
-rw-r--r--hw/xfree86/common/xf86Xinput.c1
-rw-r--r--hw/xfree86/common/xf86cmap.c13
-rw-r--r--hw/xfree86/dri2/dri2.c62
-rw-r--r--hw/xfree86/dri2/dri2ext.c24
-rw-r--r--hw/xfree86/modes/xf86RandR12.c61
-rw-r--r--hw/xfree86/os-support/bus/Pci.h2
-rw-r--r--hw/xfree86/os-support/bus/linuxPci.c2
-rw-r--r--hw/xfree86/os-support/hurd/Makefile.am1
-rw-r--r--hw/xfree86/os-support/hurd/hurd_video.c28
-rw-r--r--hw/xfree86/os-support/shared/stdResource.c2
-rw-r--r--hw/xfree86/parser/Flags.c5
-rw-r--r--hw/xnest/Keyboard.c11
-rw-r--r--hw/xquartz/X11Application.m77
-rw-r--r--hw/xquartz/darwinEvents.c44
-rw-r--r--hw/xquartz/darwinEvents.h12
-rw-r--r--hw/xquartz/quartz.c15
-rw-r--r--hw/xquartz/quartzKeyboard.c4
-rw-r--r--hw/xquartz/xpr/xpr.h15
-rw-r--r--hw/xquartz/xpr/xprAppleWM.c29
-rw-r--r--hw/xquartz/xpr/xprFrame.c47
-rw-r--r--hw/xquartz/xpr/xprScreen.c3
-rw-r--r--include/os.h2
-rw-r--r--include/version-config.h.in16
-rw-r--r--include/xkbsrv.h5
-rw-r--r--m4/ac_define_dir.m449
-rw-r--r--m4/dolt.m4 (renamed from acinclude.m4)51
-rw-r--r--m4/shave.m473
-rw-r--r--miext/rootless/rootless.h1
-rw-r--r--miext/rootless/rootlessWindow.c9
-rw-r--r--os/log.c29
-rw-r--r--os/osinit.c103
-rw-r--r--os/xdmcp.c2
-rw-r--r--shave-libtool.in69
-rw-r--r--shave.in76
-rw-r--r--xfixes/cursor.c21
-rw-r--r--xfixes/xfixes.h20
-rw-r--r--xkb/xkbInit.c39
70 files changed, 1285 insertions, 695 deletions
diff --git a/.gitignore b/.gitignore
index 4d277d98e..3fb73f061 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,8 @@ install-sh
libtool
ltmain.sh
missing
+shave
+shave-libtool
TAGS
tags
cscope*
@@ -146,6 +148,7 @@ hw/xwin/winprefsyacc.c
hw/xwin/winprefsyacc.h
include/dix-config.h
include/kdrive-config.h
+include/version-config.h
include/xkb-config.h
include/xorg-config.h
include/xorg-server.h
diff --git a/Makefile.am b/Makefile.am
index f5ab8a5ab..dea6fa47c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
AUTOMAKE_OPTIONS=dist-bzip2 foreign nostdinc
+ACLOCAL_AMFLAGS = -I m4
if COMPOSITE
COMPOSITE_DIR=composite
diff --git a/Xext/security.c b/Xext/security.c
index c9077c87e..7962fdb37 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -61,10 +61,10 @@ typedef struct {
} SecurityStateRec;
/* Extensions that untrusted clients shouldn't have access to */
-static char *SecurityUntrustedExtensions[] = {
- "RandR",
- "SECURITY",
- "XFree86-DGA",
+static char *SecurityTrustedExtensions[] = {
+ "XC-MISC",
+ "BIG-REQUESTS",
+ "XpExtension",
NULL
};
@@ -74,6 +74,7 @@ static char *SecurityUntrustedExtensions[] = {
static const Mask SecurityResourceMask =
DixGetAttrAccess | DixReceiveAccess | DixListPropAccess |
DixGetPropAccess | DixListAccess;
+static const Mask SecurityWindowExtraMask = DixRemoveAccess;
static const Mask SecurityRootWindowExtraMask =
DixReceiveAccess | DixSendAccess | DixAddAccess | DixRemoveAccess;
static const Mask SecurityDeviceMask =
@@ -817,6 +818,10 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
((WindowPtr)rec->res)->forcedBG = TRUE;
+ /* additional permissions for specific resource types */
+ if (rec->rtype == RT_WINDOW)
+ allowed |= SecurityWindowExtraMask;
+
/* special checks for server-owned resources */
if (cid == 0) {
if (rec->rtype & RC_DRAWABLE)
@@ -852,16 +857,18 @@ SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
- if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
- while (SecurityUntrustedExtensions[i])
- if (!strcmp(SecurityUntrustedExtensions[i++], rec->ext->name)) {
- SecurityAudit("Security: denied client %d access to extension "
- "%s on request %s\n",
- rec->client->index, rec->ext->name,
- SecurityLookupRequestName(rec->client));
- rec->status = BadAccess;
- return;
- }
+ if (subj->haveState && subj->trustLevel == XSecurityClientTrusted)
+ return;
+
+ while (SecurityTrustedExtensions[i])
+ if (!strcmp(SecurityTrustedExtensions[i++], rec->ext->name))
+ return;
+
+ SecurityAudit("Security: denied client %d access to extension "
+ "%s on request %s\n",
+ rec->client->index, rec->ext->name,
+ SecurityLookupRequestName(rec->client));
+ rec->status = BadAccess;
}
static void
@@ -946,9 +953,10 @@ SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata)
SecurityAudit("Security: denied client %d from sending event "
"of type %s to window 0x%x of client %d\n",
- rec->client->index, rec->pWin->drawable.id,
- wClient(rec->pWin)->index,
- LookupEventName(rec->events[i].u.u.type));
+ rec->client->index,
+ LookupEventName(rec->events[i].u.u.type),
+ rec->pWin->drawable.id,
+ wClient(rec->pWin)->index);
rec->status = BadAccess;
return;
}
diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 4a1fe004b..2c7262140 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1258,6 +1258,17 @@ typedef struct {
CARD32 id;
} SELinuxListItemRec;
+static security_context_t
+SELinuxCopyContext(char *ptr, unsigned len)
+{
+ security_context_t copy = xalloc(len + 1);
+ if (!copy)
+ return NULL;
+ strncpy(copy, ptr, len);
+ copy[len] = '\0';
+ return copy;
+}
+
static int
ProcSELinuxQueryVersion(ClientPtr client)
{
@@ -1315,29 +1326,34 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
{
PrivateRec **privPtr = &client->devPrivates;
security_id_t *pSid;
- security_context_t ctx;
+ security_context_t ctx = NULL;
char *ptr;
+ int rc;
REQUEST(SELinuxSetCreateContextReq);
REQUEST_FIXED_SIZE(SELinuxSetCreateContextReq, stuff->context_len);
- ctx = (char *)(stuff + 1);
- if (stuff->context_len > 0 && ctx[stuff->context_len - 1])
- return BadLength;
+ if (stuff->context_len > 0) {
+ ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len);
+ if (!ctx)
+ return BadAlloc;
+ }
if (offset == CTX_DEV) {
/* Device create context currently requires manage permission */
- int rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
+ rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
if (rc != Success)
- return rc;
+ goto out;
privPtr = &serverClient->devPrivates;
}
else if (offset == USE_SEL) {
/* Selection use context currently requires no selections owned */
Selection *pSel;
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
- if (pSel->client == client)
- return BadMatch;
+ if (pSel->client == client) {
+ rc = BadMatch;
+ goto out;
+ }
}
ptr = dixLookupPrivate(privPtr, subjectKey);
@@ -1345,13 +1361,15 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
sidput(*pSid);
*pSid = NULL;
+ rc = Success;
if (stuff->context_len > 0) {
- if (security_check_context_raw(ctx) < 0)
- return BadValue;
- if (avc_context_to_sid_raw(ctx, pSid) < 0)
- return BadValue;
+ if (security_check_context_raw(ctx) < 0 ||
+ avc_context_to_sid_raw(ctx, pSid) < 0)
+ rc = BadValue;
}
- return Success;
+out:
+ xfree(ctx);
+ return rc;
}
static int
@@ -1384,18 +1402,21 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
REQUEST(SELinuxSetContextReq);
REQUEST_FIXED_SIZE(SELinuxSetContextReq, stuff->context_len);
- ctx = (char *)(stuff + 1);
- if (stuff->context_len < 1 || ctx[stuff->context_len - 1])
+ if (stuff->context_len < 1)
return BadLength;
+ ctx = SELinuxCopyContext((char *)(stuff + 1), stuff->context_len);
+ if (!ctx)
+ return BadAlloc;
rc = dixLookupDevice(&dev, stuff->id, client, DixManageAccess);
if (rc != Success)
- return rc;
+ goto out;
- if (security_check_context_raw(ctx) < 0)
- return BadValue;
- if (avc_context_to_sid_raw(ctx, &sid) < 0)
- return BadValue;
+ if (security_check_context_raw(ctx) < 0 ||
+ avc_context_to_sid_raw(ctx, &sid) < 0) {
+ rc = BadValue;
+ goto out;
+ }
subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
sidput(subj->sid);
@@ -1404,7 +1425,10 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
sidput(obj->sid);
sidget(obj->sid = sid);
- return Success;
+ rc = Success;
+out:
+ xfree(ctx);
+ return rc;
}
static int
@@ -1543,7 +1567,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec *items,
CARD32 *buf;
buf = xcalloc(size, sizeof(CARD32));
- if (!buf) {
+ if (size && !buf) {
rc = BadAlloc;
goto out;
}
@@ -1615,7 +1639,7 @@ ProcSELinuxListProperties(ClientPtr client)
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
count++;
items = xcalloc(count, sizeof(SELinuxListItemRec));
- if (!items)
+ if (count && !items)
return BadAlloc;
/* Fill in the items and calculate size */
@@ -1649,7 +1673,7 @@ ProcSELinuxListSelections(ClientPtr client)
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
count++;
items = xcalloc(count, sizeof(SELinuxListItemRec));
- if (!items)
+ if (count && !items)
return BadAlloc;
/* Fill in the items and calculate size */
diff --git a/Xi/exevents.c b/Xi/exevents.c
index af144313b..ed6a3edee 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -227,11 +227,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
to->kbdfeed = classes->kbdfeed;
if (!to->kbdfeed)
- {
- XkbRMLVOSet rmlvo;
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
- }
+ InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
}
k = &to->kbdfeed;
@@ -474,11 +470,8 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
UnusedClassesPrivateKey);
to->key = classes->key;
if (!to->key)
- {
- XkbRMLVOSet rmlvo;
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL);
- } else
+ InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
+ else
classes->key = NULL;
}
diff --git a/composite/compext.c b/composite/compext.c
index 4fff20efa..829c90fbf 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -136,21 +136,30 @@ ProcCompositeQueryVersion (ClientPtr client)
return(client->noClientException);
}
+#define VERIFY_WINDOW(pWindow, wid, client, mode) \
+ do { \
+ int err; \
+ err = dixLookupResourceByType((pointer *) &pWindow, wid, \
+ RT_WINDOW, client, mode); \
+ if (err == BadValue) { \
+ client->errorValue = wid; \
+ return BadWindow; \
+ } else if (err != Success) { \
+ client->errorValue = wid; \
+ return err; \
+ } \
+ } while (0)
+
static int
ProcCompositeRedirectWindow (ClientPtr client)
{
WindowPtr pWin;
- int rc;
REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return (rc == BadValue) ? BadWindow : rc;
- }
+ VERIFY_WINDOW(pWin, stuff->window, client,
+ DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+
return compRedirectWindow (client, pWin, stuff->update);
}
@@ -158,17 +167,12 @@ static int
ProcCompositeRedirectSubwindows (ClientPtr client)
{
WindowPtr pWin;
- int rc;
REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
- DixSetAttrAccess|DixManageAccess|DixBlendAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return (rc == BadValue) ? BadWindow : rc;
- }
+ VERIFY_WINDOW(pWin, stuff->window, client,
+ DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+
return compRedirectSubwindows (client, pWin, stuff->update);
}
@@ -179,12 +183,9 @@ ProcCompositeUnredirectWindow (ClientPtr client)
REQUEST(xCompositeUnredirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
- {
- client->errorValue = stuff->window;
- return BadWindow;
- }
+ VERIFY_WINDOW(pWin, stuff->window, client,
+ DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+
return compUnredirectWindow (client, pWin, stuff->update);
}
@@ -195,12 +196,9 @@ ProcCompositeUnredirectSubwindows (ClientPtr client)
REQUEST(xCompositeUnredirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
- {
- client->errorValue = stuff->window;
- return BadWindow;
- }
+ VERIFY_WINDOW(pWin, stuff->window, client,
+ DixSetAttrAccess|DixManageAccess|DixBlendAccess);
+
return compUnredirectSubwindows (client, pWin, stuff->update);
}
@@ -210,18 +208,10 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
WindowPtr pWin;
CompWindowPtr cw;
RegionPtr pBorderClip, pRegion;
- int rc;
REQUEST(xCompositeCreateRegionFromBorderClipReq);
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
- DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return (rc == BadValue) ? BadWindow : rc;
- }
-
+ VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
LEGAL_NEW_RESOURCE (stuff->region, client);
cw = GetCompWindow (pWin);
@@ -250,13 +240,7 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
- DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return (rc == BadValue) ? BadWindow : rc;
- }
+ VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
if (!pWin->viewable)
return BadMatch;
@@ -298,13 +282,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
int rc;
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
- rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
- DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = stuff->window;
- return (rc == BadValue) ? BadWindow : rc;
- }
+ VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
pScreen = pWin->drawable.pScreen;
/*
@@ -360,12 +338,7 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
CompOverlayClientPtr pOc;
REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
- pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
- if (!pWin)
- {
- client->errorValue = stuff->window;
- return BadWindow;
- }
+ VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
pScreen = pWin->drawable.pScreen;
/*
diff --git a/composite/compinit.c b/composite/compinit.c
index 5b2fba1a4..a844017c1 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -296,10 +296,12 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
* for all colormaps.
*/
for (i = 0; i < numInstalledCmaps; i++) {
- int j;
+ int j, rc;
- installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
- if (!installedCmap)
+ rc = dixLookupResourceByType((pointer *)&installedCmap,
+ installedCmaps[i], RT_COLORMAP,
+ serverClient, DixReadAccess);
+ if (rc != Success)
continue;
j = installedCmap->pVisual - pScreen->visuals;
installedCmap->pVisual = &visuals[j];
diff --git a/configure.ac b/configure.ac
index 4725c9fa5..fd6020343 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,11 @@ AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
+AC_CONFIG_FILES([
+ shave
+ shave-libtool
+])
+
# Require xorg-macros version 1.2.0 or newer for XORG_CHANGELOG and
# XORG_CWARNFLAGS
m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
@@ -54,6 +59,9 @@ dnl xwin-config.h covers the XWin DDX.
AC_CONFIG_HEADERS(include/xwin-config.h)
dnl kdrive-config.h covers the kdrive DDX
AC_CONFIG_HEADERS(include/kdrive-config.h)
+dnl version-config.h covers the version numbers so they can be bumped without
+dnl forcing an entire recompile.x
+AC_CONFIG_HEADERS(include/version-config.h)
AC_PROG_CC
AM_PROG_AS
@@ -105,7 +113,7 @@ AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
AC_HEADER_DIRENT
AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
+AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -889,7 +897,7 @@ case "$DRI2,$HAVE_DRI2PROTO" in
DRI2=yes
;;
esac
-AM_CONDITIONAL(DRI2, test "x$DRI2" == xyes)
+AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
if test "x$DRI" = xyes || test "x$DRI2" = xyes; then
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.0])
@@ -916,7 +924,7 @@ if test "x$DRI2" = xyes; then
DRI2_AIGLX=no
fi
fi
-AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" == xyes)
+AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
@@ -1120,10 +1128,11 @@ AC_DEFINE_UNQUOTED(OSNAME, ["$OSNAME"], [Operating System Name])
AC_DEFINE_UNQUOTED(OSVENDOR, ["$OSVENDOR"], [Operating System Vendor])
AC_DEFINE_UNQUOTED(BUILDERSTRING, ["$BUILDERSTRING"], [Builder string])
-AC_SUBST([VENDOR_NAME])
AC_SUBST([VENDOR_NAME_SHORT])
-AC_SUBST([VENDOR_RELEASE])
-AC_SUBST([VENDOR_MAN_VERSION])
+AC_DEFINE_UNQUOTED(VENDOR_NAME, ["$VENDOR_NAME"], [Vendor name])
+AC_DEFINE_UNQUOTED(VENDOR_NAME_SHORT, ["$VENDOR_NAME_SHORT"], [Vendor name])
+AC_DEFINE_UNQUOTED(VENDOR_RELEASE, [$VENDOR_RELEASE], [Vendor release])
+AC_DEFINE_UNQUOTED(VENDOR_MAN_VERSION, ["$VENDOR_MAN_VERSION"], [Vendor man version])
AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
@@ -1446,6 +1455,9 @@ if test "x$XORG" = xyes; then
gnu*)
XORG_OS="gnu"
XORG_OS_SUBDIR="hurd"
+ # Use the same stubs as BSD for old functions, since we now
+ # use libpciaccess for PCI
+ xorg_bus_bsdpci="yes"
;;
*)
XORG_OS="unknown"
@@ -1874,6 +1886,8 @@ AC_SUBST([prefix])
XORG_MANPAGE_SECTIONS
XORG_CHANGELOG
+SHAVE_INIT([.], [enable])
+
AC_OUTPUT([
Makefile
glx/Makefile
diff --git a/dix/Makefile.am b/dix/Makefile.am
index 8c5f3c00e..83b8c62c2 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -1,8 +1,6 @@
noinst_LTLIBRARIES = libdix.la
-AM_CFLAGS = $(DIX_CFLAGS) \
- -DVENDOR_NAME=\""@VENDOR_NAME@"\" \
- -DVENDOR_RELEASE="@VENDOR_RELEASE@"
+AM_CFLAGS = $(DIX_CFLAGS)
libdix_la_SOURCES = \
atom.c \
diff --git a/dix/devices.c b/dix/devices.c
index 1c702dc49..a8d81abaf 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -475,12 +475,10 @@ CoreKeyboardCtl(DeviceIntPtr pDev, KeybdCtrl *ctrl)
static int
CoreKeyboardProc(DeviceIntPtr pDev, int what)
{
- XkbRMLVOSet rmlvo;
switch (what) {
case DEVICE_INIT:
- XkbGetRulesDflts(&rmlvo);
- if (!InitKeyboardDeviceStruct(pDev, &rmlvo, CoreKeyboardBell,
+ if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
CoreKeyboardCtl))
{
ErrorF("Keyboard initialization failed. This could be a missing "
diff --git a/dix/main.c b/dix/main.c
index e10f7e1a4..9d5d83944 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -76,6 +76,7 @@ Equipment Corporation.
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
+#include <version-config.h>
#endif
#include <X11/X.h>
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index b1ab2d1d9..d284ff560 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -466,27 +466,59 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
goto fallback;
}
- if (!exaPixmapIsOffscreen(pSrcPixmap) ||
- !exaPixmapIsOffscreen(pDstPixmap) ||
- !(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, reverse ? -1 : 1,
- upsidedown ? -1 : 1,
- pGC ? pGC->alu : GXcopy,
- pGC ? pGC->planemask : FB_ALLONES)) {
- goto fallback;
- }
+ if (exaPixmapIsOffscreen(pDstPixmap)) {
+ /* Normal blitting. */
+ if (exaPixmapIsOffscreen(pSrcPixmap)) {
+ if (!(*pExaScr->info->PrepareCopy) (pSrcPixmap, pDstPixmap, reverse ? -1 : 1,
+ upsidedown ? -1 : 1,
+ pGC ? pGC->alu : GXcopy,
+ pGC ? pGC->planemask : FB_ALLONES)) {
+ goto fallback;
+ }
- while (nbox--)
- {
- (*pExaScr->info->Copy) (pDstPixmap,
- pbox->x1 + dx + src_off_x,
- pbox->y1 + dy + src_off_y,
- pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- pbox++;
- }
+ while (nbox--)
+ {
+ (*pExaScr->info->Copy) (pDstPixmap,
+ pbox->x1 + dx + src_off_x,
+ pbox->y1 + dy + src_off_y,
+ pbox->x1 + dst_off_x, pbox->y1 + dst_off_y,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ (*pExaScr->info->DoneCopy) (pDstPixmap);
+ exaMarkSync (pDstDrawable->pScreen);
+ /* UTS: mainly for SHM PutImage's secondary path. */
+ } else {
+ int bpp = pSrcDrawable->bitsPerPixel;
+ int src_stride = exaGetPixmapPitch(pSrcPixmap);
+ CARD8 *src = NULL;
- (*pExaScr->info->DoneCopy) (pDstPixmap);
- exaMarkSync (pDstDrawable->pScreen);
+ if (!pExaScr->info->UploadToScreen)
+ goto fallback;
+
+ if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
+ goto fallback;
+
+ if (pSrcDrawable->bitsPerPixel < 8)
+ goto fallback;
+
+ if (pGC && !(pGC->alu == GXcopy && EXA_PM_IS_SOLID(pSrcDrawable, pGC->planemask)))
+ goto fallback;
+
+ while (nbox--)
+ {
+ src = pSrcExaPixmap->sys_ptr + (pbox->y1 + dy + src_off_y) * src_stride + (pbox->x1 + dx + src_off_x) * (bpp / 8);
+ if (!pExaScr->info->UploadToScreen(pDstPixmap, pbox->x1 + dst_off_x,
+ pbox->y1 + dst_off_y, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ (char *) src, src_stride))
+ goto fallback;
+
+ pbox++;
+ }
+ }
+ } else
+ goto fallback;
goto out;
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 596b60c6e..d2a0168b4 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -713,6 +713,7 @@ exaGlyphs (CARD8 op,
if (maskFormat)
{
+ ExaScreenPriv(pScreen);
GCPtr pGC;
xRectangle rect;
@@ -739,10 +740,38 @@ exaGlyphs (CARD8 op,
pMask = CreatePicture (0, &pMaskPixmap->drawable,
maskFormat, CPComponentAlpha, &component_alpha,
serverClient, &error);
- if (!pMask)
+ if (!pMask ||
+ (!component_alpha && pExaScr->info->CheckComposite &&
+ !(*pExaScr->info->CheckComposite) (PictOpAdd, pSrc, NULL, pMask)))
{
+ PictFormatPtr argbFormat;
+
(*pScreen->DestroyPixmap) (pMaskPixmap);
- return;
+
+ if (!pMask)
+ return;
+
+ /* The driver can't seem to composite to a8, let's try argb (but
+ * without component-alpha) */
+ FreePicture ((pointer) pMask, (XID) 0);
+
+ argbFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8);
+
+ if (argbFormat)
+ maskFormat = argbFormat;
+
+ pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
+ maskFormat->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ if (!pMaskPixmap)
+ return;
+
+ pMask = CreatePicture (0, &pMaskPixmap->drawable, maskFormat, 0, 0,
+ serverClient, &error);
+ if (!pMask) {
+ (*pScreen->DestroyPixmap) (pMaskPixmap);
+ return;
+ }
}
pGC = GetScratchGC (pMaskPixmap->drawable.depth, pScreen);
ValidateGC (&pMaskPixmap->drawable, pGC);
diff --git a/glx/Makefile.am b/glx/Makefile.am
index 2537db865..a23ae0a47 100644
--- a/glx/Makefile.am
+++ b/glx/Makefile.am
@@ -80,7 +80,6 @@ libglx_la_SOURCES = \
glxscreens.c \
glxscreens.h \
glxserver.h \
- glxutil.c \
glxutil.h \
render2.c \
render2swap.c \
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 80f3a6936..86e8dd8a5 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -138,21 +138,64 @@ validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
return TRUE;
}
+static int
+validGlxContext(ClientPtr client, XID id, int access_mode,
+ __GLXcontext **context, int *err)
+{
+ *err = dixLookupResourceByType((pointer *) context, id,
+ __glXContextRes, client, access_mode);
+ if (*err != Success) {
+ client->errorValue = id;
+ if (*err == BadValue)
+ *err = __glXError(GLXBadContext);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static int
+validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
+ __GLXdrawable **drawable, int *err)
+{
+ int rc;
+
+ rc = dixLookupResourceByType((pointer *) drawable, id,
+ __glXDrawableRes, client, access_mode);
+ if (rc != Success && rc != BadValue) {
+ *err = rc;
+ client->errorValue = id;
+ return FALSE;
+ }
+
+ if (rc == BadValue ||
+ (type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
+ client->errorValue = id;
+ switch (type) {
+ case GLX_DRAWABLE_WINDOW:
+ *err = __glXError(GLXBadWindow);
+ return FALSE;
+ case GLX_DRAWABLE_PIXMAP:
+ *err = __glXError(GLXBadPixmap);
+ return FALSE;
+ case GLX_DRAWABLE_PBUFFER:
+ *err = __glXError(GLXBadPbuffer);
+ return FALSE;
+ case GLX_DRAWABLE_ANY:
+ *err = __glXError(GLXBadDrawable);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
void
__glXContextDestroy(__GLXcontext *context)
{
- if (!context->isDirect) {
- if (context->drawPriv)
- __glXUnrefDrawable(context->drawPriv);
- if (context->readPriv)
- __glXUnrefDrawable(context->readPriv);
- context->drawPriv = NULL;
- context->readPriv = NULL;
- }
__glXFlushContextCache();
}
-
static void __glXdirectContextDestroy(__GLXcontext *context)
{
__glXContextDestroy(context);
@@ -189,7 +232,8 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
-
+ int err;
+
LEGAL_NEW_RESOURCE(gcId, client);
/*
@@ -204,11 +248,10 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
if (shareList == None) {
shareglxc = 0;
} else {
- shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
- if (!shareglxc) {
- client->errorValue = shareList;
- return __glXError(GLXBadContext);
- }
+ if (!validGlxContext(client, shareList, DixReadAccess,
+ &shareglxc, &err))
+ return err;
+
if (shareglxc->isDirect) {
/*
** NOTE: no support for sharing display lists between direct
@@ -268,6 +311,8 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
glxc->isDirect = isDirect;
glxc->renderMode = GL_RENDER;
+ __glXAddToContextList(glxc);
+
return Success;
}
@@ -321,25 +366,16 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
}
int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc)
{
- ClientPtr client = cl->client;
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
- GLXContextID gcId = req->context;
__GLXcontext *glxc;
-
- glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
- if (glxc) {
- /*
- ** Just free the resource; don't actually destroy the context,
- ** because it might be in use. The
- ** destroy method will be called by the resource destruction routine
- ** if necessary.
- */
- FreeResourceByType(gcId, __glXContextRes, FALSE);
- return Success;
- } else {
- client->errorValue = gcId;
- return __glXError(GLXBadContext);
- }
+ int err;
+
+ if (!validGlxContext(cl->client, req->context, DixDestroyAccess,
+ &glxc, &err))
+ return err;
+
+ FreeResourceByType(req->context, __glXContextRes, FALSE);
+ return Success;
}
/*****************************************************************************/
@@ -434,20 +470,10 @@ static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
}
/**
- * Given a drawable ID, get the associated drawable and / or pixmap.
- *
- * If the specified drawable ID is not a pixmap, \c ppPixmap will be set
- * to \c NULL on return. In either case, \c ppDraw will be set to a drawable.
- * In the case where the drawable ID is a pixmap, \c ppDraw will be set to
- * the drawable associated with that pixmap.
- *
- * \param glxc Associated GLX context.
- * \param drawId ID of the drawable.
- * \param client Pointer to the client state.
- * \return the __GLXdrawable is returned on success. Otherwise NULL.
- *
- * \notes This function will need some modification when support pbuffers
- * is added.
+ * This is a helper function to handle the legacy (pre GLX 1.3) cases
+ * where passing an X window to glXMakeCurrent is valid. Given a
+ * resource ID, look up the GLX drawable if available, otherwise, make
+ * sure it's an X window and create a GLX drawable one the fly.
*/
static __GLXdrawable *
__glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
@@ -457,10 +483,8 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
__GLXdrawable *pGlxDraw;
int rc;
- /* This is the GLX 1.3 case - the client passes in a GLXWindow or
- * GLXPixmap and we just return the __GLXdrawable. */
- pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes);
- if (pGlxDraw != NULL) {
+ if (validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
+ DixWriteAccess, &pGlxDraw, &rc)) {
if (glxc != NULL && pGlxDraw->config != glxc->config) {
client->errorValue = drawId;
*error = BadMatch;
@@ -470,13 +494,10 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
return pGlxDraw;
}
- /* The drawId wasn't a GLX drawable, so presumably it's a regular
- * X window. In that case, we create a shadow GLXWindow for it on
- * demand here for pre GLX 1.3 compatibility and use the X Window
- * XID as its GLXWindow XID. The client can't explicitly create a
- * GLXWindow with the same XID as an X Window, so we wont get any
- * resource ID clashes. Effectively, the X Window is now also a
- * GLXWindow. */
+ /* The drawId wasn't a GLX drawable. Make sure it's a window and
+ * create a GLXWindow for it. Check that the drawable screen
+ * matches the context screen and that the context fbconfig is
+ * compatible with the window visual. */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
if (rc != Success || pDraw->type != DRAWABLE_WINDOW) {
@@ -485,18 +506,13 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
return NULL;
}
- /* If we're not given a context, don't create the __GLXdrawable */
- if (glxc == NULL) {
- *error = __glXError(GLXBadDrawable);
+ if (pDraw->pScreen != glxc->pGlxScreen->pScreen) {
+ client->errorValue = pDraw->pScreen->myNum;
+ *error = BadMatch;
return NULL;
}
- /* We're binding an X Window for the first time and need to create
- * a GLX drawable for it. Check that the drawable screen matches
- * the context screen and that the context fbconfig is compatible
- * with the window visual. */
- if (pDraw->pScreen != glxc->pGlxScreen->pScreen ||
- !validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
+ if (!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
return NULL;
pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
@@ -528,7 +544,7 @@ DoMakeCurrent(__GLXclientState *cl,
__GLXcontext *glxc, *prevglxc;
__GLXdrawable *drawPriv = NULL;
__GLXdrawable *readPriv = NULL;
- GLint error;
+ int error;
GLuint mask;
/*
@@ -569,11 +585,8 @@ DoMakeCurrent(__GLXclientState *cl,
if (contextId != None) {
int status;
- glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes);
- if (!glxc) {
- client->errorValue = contextId;
- return __glXError(GLXBadContext);
- }
+ if (!validGlxContext(client, contextId, DixUseAccess, &glxc, &error))
+ return error;
if ((glxc != prevglxc) && glxc->isCurrent) {
/* Context is current to somebody else */
return BadAccess;
@@ -619,10 +632,6 @@ DoMakeCurrent(__GLXclientState *cl,
}
__glXFlushContextCache();
if (!prevglxc->isDirect) {
- if (prevglxc->drawPriv)
- __glXUnrefDrawable(prevglxc->drawPriv);
- if (prevglxc->readPriv)
- __glXUnrefDrawable(prevglxc->readPriv);
prevglxc->drawPriv = NULL;
prevglxc->readPriv = NULL;
}
@@ -642,8 +651,6 @@ DoMakeCurrent(__GLXclientState *cl,
}
glxc->isCurrent = GL_TRUE;
- __glXRefDrawable(glxc->drawPriv);
- __glXRefDrawable(glxc->readPriv);
}
if (prevglxc) {
@@ -702,15 +709,10 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc)
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
xGLXIsDirectReply reply;
__GLXcontext *glxc;
+ int err;
- /*
- ** Find the GL context.
- */
- glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
- if (!glxc) {
- client->errorValue = req->context;
- return __glXError(GLXBadContext);
- }
+ if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err))
+ return err;
reply.isDirect = glxc->isDirect;
reply.length = 0;
@@ -814,19 +816,10 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc)
__GLXcontext *src, *dst;
int error;
- /*
- ** Check that each context exists.
- */
- src = (__GLXcontext *) LookupIDByType(source, __glXContextRes);
- if (!src) {
- client->errorValue = source;
- return __glXError(GLXBadContext);
- }
- dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes);
- if (!dst) {
- client->errorValue = dest;
- return __glXError(GLXBadContext);
- }
+ if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error))
+ return error;
+ if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error))
+ return error;
/*
** They must be in the same address space, and same screen.
@@ -1084,6 +1077,33 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
return DoGetFBConfigs(cl, req->screen);
}
+GLboolean
+__glXDrawableInit(__GLXdrawable *drawable,
+ __GLXscreen *screen, DrawablePtr pDraw, int type,
+ XID drawId, __GLXconfig *config)
+{
+ drawable->pDraw = pDraw;
+ drawable->type = type;
+ drawable->drawId = drawId;
+ drawable->config = config;
+ drawable->eventMask = 0;
+
+ return GL_TRUE;
+}
+
+void
+__glXDrawableRelease(__GLXdrawable *drawable)
+{
+ ScreenPtr pScreen = drawable->pDraw->pScreen;
+
+ switch (drawable->type) {
+ case GLX_DRAWABLE_PIXMAP:
+ case GLX_DRAWABLE_PBUFFER:
+ (*pScreen->DestroyPixmap)((PixmapPtr) drawable->pDraw);
+ break;
+ }
+}
+
static int
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
DrawablePtr pDraw, XID glxDrawableId, int type)
@@ -1116,7 +1136,11 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
int err;
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
- if (err != Success || pDraw->type != DRAWABLE_PIXMAP) {
+ if (err != Success) {
+ client->errorValue = drawableId;
+ return err;
+ }
+ if (pDraw->type != DRAWABLE_PIXMAP) {
client->errorValue = drawableId;
return BadPixmap;
}
@@ -1131,14 +1155,18 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
}
static void
-determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs)
+determineTextureTarget(ClientPtr client, XID glxDrawableID,
+ CARD32 *attribs, CARD32 numAttribs)
{
GLenum target = 0;
GLenum format = 0;
- int i;
+ int i, err;
__GLXdrawable *pGlxDraw;
- pGlxDraw = LookupIDByType(glxDrawableID, __glXDrawableRes);
+ if (!validGlxDrawable(client, glxDrawableID, GLX_DRAWABLE_PIXMAP,
+ DixWriteAccess, &pGlxDraw, &err))
+ /* We just added it in CreatePixmap, so we should never get here. */
+ return;
for (i = 0; i < numAttribs; i++) {
if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
@@ -1202,7 +1230,7 @@ int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
if (err != Success)
return err;
- determineTextureTarget(req->glxpixmap,
+ determineTextureTarget(cl->client, req->glxpixmap,
(CARD32*) (req + 1), req->numAttribs);
return Success;
@@ -1228,24 +1256,12 @@ int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type)
{
- ClientPtr client = cl->client;
__GLXdrawable *pGlxDraw;
+ int err;
- /*
- ** Check it's the right type of drawable.
- */
- pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes);
- if (pGlxDraw == NULL || pGlxDraw->type != type) {
- client->errorValue = glxdrawable;
- switch (type) {
- case GLX_DRAWABLE_WINDOW:
- return __glXError(GLXBadWindow);
- case GLX_DRAWABLE_PIXMAP:
- return __glXError(GLXBadDrawable);
- case GLX_DRAWABLE_PBUFFER:
- return __glXError(GLXBadPbuffer);
- }
- }
+ if (!validGlxDrawable(cl->client, glxdrawable, type,
+ DixDestroyAccess, &pGlxDraw, &err))
+ return err;
FreeResource(glxdrawable, FALSE);
@@ -1345,9 +1361,12 @@ DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable,
int numAttribs, CARD32 *attribs)
{
__GLXdrawable *pGlxDraw;
- int i;
+ int i, err;
+
+ if (!validGlxDrawable(client, glxdrawable, GLX_DRAWABLE_ANY,
+ DixSetAttrAccess, &pGlxDraw, &err))
+ return err;
- pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes);
for (i = 0; i < numAttribs; i++) {
switch(attribs[i * 2]) {
case GLX_EVENT_MASK:
@@ -1475,12 +1494,10 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
int nProps;
int *sendBuf, *pSendBuf;
int nReplyBytes;
+ int err;
- ctx = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
- if (!ctx) {
- client->errorValue = gcId;
- return __glXError(GLXBadContext);
- }
+ if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
+ return err;
nProps = 3;
reply.length = nProps << 1;
@@ -1548,11 +1565,9 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
if (!context)
return error;
- pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error);
- if (!pGlxDraw || pGlxDraw->type != GLX_DRAWABLE_PIXMAP) {
- client->errorValue = drawId;
- return __glXError(GLXBadPixmap);
- }
+ if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
+ DixReadAccess, &pGlxDraw, &error))
+ return error;
if (!context->textureFromPixmap)
return __glXError(GLXUnsupportedPrivateRequest);
@@ -1581,11 +1596,9 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc)
if (!context)
return error;
- pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error);
- if (!pGlxDraw || pGlxDraw->type != GLX_DRAWABLE_PIXMAP) {
- client->errorValue = drawId;
+ if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_PIXMAP,
+ DixReadAccess, &pGlxDraw, &error))
return error;
- }
if (!context->textureFromPixmap)
return __glXError(GLXUnsupportedPrivateRequest);
@@ -1665,11 +1678,9 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId)
CARD32 attributes[6];
int numAttribs, error;
- pGlxDraw = __glXGetDrawable(NULL, drawId, client, &error);
- if (!pGlxDraw) {
- client->errorValue = drawId;
+ if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY,
+ DixGetAttrAccess, &pGlxDraw, &error))
return error;
- }
numAttribs = 3;
reply.length = numAttribs << 1;
diff --git a/glx/glxdrawable.h b/glx/glxdrawable.h
index 2d787ae78..0215b3b20 100644
--- a/glx/glxdrawable.h
+++ b/glx/glxdrawable.h
@@ -41,7 +41,8 @@
enum {
GLX_DRAWABLE_WINDOW,
GLX_DRAWABLE_PIXMAP,
- GLX_DRAWABLE_PBUFFER
+ GLX_DRAWABLE_PBUFFER,
+ GLX_DRAWABLE_ANY
};
struct __GLXdrawable {
@@ -66,11 +67,6 @@ struct __GLXdrawable {
*/
__GLXconfig *config;
- /*
- ** reference count
- */
- int refCount;
-
GLenum target;
GLenum format;
diff --git a/glx/glxdri.c b/glx/glxdri.c
index cc6d93976..eeac7fcb2 100644
--- a/glx/glxdri.c
+++ b/glx/glxdri.c
@@ -238,6 +238,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
__glXleaveServer(GL_FALSE);
}
+ __glXDrawableRelease(drawable);
+
xfree(private);
}
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 4df406b5a..9e452c4fd 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -82,6 +82,8 @@ struct __GLXDRIcontext {
__DRIcontext *driContext;
};
+#define MAX_DRAWABLE_BUFFERS 5
+
struct __GLXDRIdrawable {
__GLXdrawable base;
__DRIdrawable *driDrawable;
@@ -90,7 +92,7 @@ struct __GLXDRIdrawable {
/* Dimensions as last reported by DRI2GetBuffers. */
int width;
int height;
- __DRIbuffer buffers[5];
+ __DRIbuffer buffers[MAX_DRAWABLE_BUFFERS];
int count;
};
@@ -107,6 +109,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
if (drawable->pDraw != NULL)
DRI2DestroyDrawable(drawable->pDraw);
+ __glXDrawableRelease(drawable);
+
xfree(private);
}
@@ -251,12 +255,15 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
if (texBuffer == NULL)
return Success;
+#if __DRI_TEX_BUFFER_VERSION >= 2
if (texBuffer->base.version >= 2 && texBuffer->setTexBuffer2 != NULL) {
(*texBuffer->setTexBuffer2)(context->driContext,
glxPixmap->target,
glxPixmap->format,
drawable->driDrawable);
- } else {
+ } else
+#endif
+ {
texBuffer->setTexBuffer(context->driContext,
glxPixmap->target,
drawable->driDrawable);
@@ -401,10 +408,11 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
__GLXDRIdrawable *private = loaderPrivate;
DRI2BufferPtr buffers;
int i;
+ int j;
buffers = DRI2GetBuffers(private->base.pDraw,
width, height, attachments, count, out_count);
- if (*out_count > 5) {
+ if (*out_count > MAX_DRAWABLE_BUFFERS) {
*out_count = 0;
return NULL;
}
@@ -414,14 +422,24 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
/* This assumes the DRI2 buffer attachment tokens matches the
* __DRIbuffer tokens. */
+ j = 0;
for (i = 0; i < *out_count; i++) {
- private->buffers[i].attachment = buffers[i].attachment;
- private->buffers[i].name = buffers[i].name;
- private->buffers[i].pitch = buffers[i].pitch;
- private->buffers[i].cpp = buffers[i].cpp;
- private->buffers[i].flags = buffers[i].flags;
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if ((private->base.pDraw->type == DRAWABLE_WINDOW)
+ && (buffers[i].attachment == DRI2BufferFrontLeft)) {
+ continue;
+ }
+
+ private->buffers[j].attachment = buffers[i].attachment;
+ private->buffers[j].name = buffers[i].name;
+ private->buffers[j].pitch = buffers[i].pitch;
+ private->buffers[j].cpp = buffers[i].cpp;
+ private->buffers[j].flags = buffers[i].flags;
+ j++;
}
+ *out_count = j;
return private->buffers;
}
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index de89d381e..328aa7e56 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -102,6 +102,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
FreeScratchGC(private->gc);
FreeScratchGC(private->swapgc);
+ __glXDrawableRelease(drawable);
+
xfree(private);
}
diff --git a/glx/glxext.c b/glx/glxext.c
index 025e6198f..93391e9fd 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -50,6 +50,7 @@
** from the server's perspective.
*/
__GLXcontext *__glXLastContext;
+__GLXcontext *__glXContextList;
/*
** X resources.
@@ -111,31 +112,46 @@ static int ContextGone(__GLXcontext* cx, XID id)
return True;
}
+static __GLXcontext *glxPendingDestroyContexts;
+static __GLXcontext *glxAllContexts;
+static int glxServerLeaveCount;
+static int glxBlockClients;
+
/*
** Destroy routine that gets called when a drawable is freed. A drawable
** contains the ancillary buffers needed for rendering.
*/
static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
{
- ScreenPtr pScreen = glxPriv->pDraw->pScreen;
+ __GLXcontext *c;
- switch (glxPriv->type) {
- case GLX_DRAWABLE_PIXMAP:
- case GLX_DRAWABLE_PBUFFER:
- (*pScreen->DestroyPixmap)((PixmapPtr) glxPriv->pDraw);
- break;
+ for (c = glxAllContexts; c; c = c->next) {
+ if (c->drawPriv == glxPriv)
+ c->drawPriv = NULL;
+ if (c->readPriv == glxPriv)
+ c->readPriv = NULL;
}
- glxPriv->pDraw = NULL;
- glxPriv->drawId = 0;
- __glXUnrefDrawable(glxPriv);
+ glxPriv->destroy(glxPriv);
return True;
}
-static __GLXcontext *glxPendingDestroyContexts;
-static int glxServerLeaveCount;
-static int glxBlockClients;
+void __glXAddToContextList(__GLXcontext *cx)
+{
+ cx->next = glxAllContexts;
+ glxAllContexts = cx;
+}
+
+void __glXRemoveFromContextList(__GLXcontext *cx)
+{
+ __GLXcontext *c, **prev;
+
+ prev = &glxAllContexts;
+ for (c = glxAllContexts; c; c = c->next)
+ if (c == cx)
+ *prev = c->next;
+}
/*
** Free a context.
@@ -150,6 +166,8 @@ GLboolean __glXFreeContext(__GLXcontext *cx)
__glXFlushContextCache();
}
+ __glXRemoveFromContextList(cx);
+
/* We can get here through both regular dispatching from
* __glXDispatch() or as a callback from the resource manager. In
* the latter case we need to lift the DRI lock manually. */
diff --git a/glx/glxext.h b/glx/glxext.h
index 72092f34a..7008c4763 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -38,6 +38,7 @@
extern GLboolean __glXFreeContext(__GLXcontext *glxc);
extern void __glXFlushContextCache(void);
+extern void __glXAddToContextList(__GLXcontext *cx);
extern void __glXErrorCallBack(GLenum code);
extern void __glXClearErrorOccured(void);
extern GLboolean __glXErrorOccured(void);
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 6f68b066a..2b12049fb 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -254,6 +254,7 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d)
VisualPtr visuals;
ColormapPtr installedCmap;
DepthPtr depth;
+ int rc;
depth = NULL;
for (i = 0; i < pScreen->numDepths; i++) {
@@ -294,8 +295,10 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d)
* for all colormaps.
*/
for (i = 0; i < numInstalledCmaps; i++) {
- installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP);
- if (!installedCmap)
+ rc = dixLookupResourceByType((pointer *)&installedCmap,
+ installedCmaps[i], RT_COLORMAP,
+ serverClient, DixReadAccess);
+ if (rc != Success)
continue;
j = installedCmap->pVisual - pScreen->visuals;
installedCmap->pVisual = &visuals[j];
diff --git a/glx/glxutil.c b/glx/glxutil.c
deleted file mode 100644
index 52a10e4e5..000000000
--- a/glx/glxutil.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#define FONT_PCF
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <string.h>
-
-#include "glxserver.h"
-#include "glxutil.h"
-
-/*****************************************************************************/
-/* Drawable private stuff */
-
-void
-__glXRefDrawable(__GLXdrawable *glxPriv)
-{
- glxPriv->refCount++;
-}
-
-void
-__glXUnrefDrawable(__GLXdrawable *glxPriv)
-{
- glxPriv->refCount--;
- if (glxPriv->refCount == 0) {
- /* remove the drawable from the drawable list */
- FreeResourceByType(glxPriv->drawId, __glXDrawableRes, FALSE);
- glxPriv->destroy(glxPriv);
- }
-}
-
-GLboolean
-__glXDrawableInit(__GLXdrawable *drawable,
- __GLXscreen *screen, DrawablePtr pDraw, int type,
- XID drawId, __GLXconfig *config)
-{
- drawable->pDraw = pDraw;
- drawable->type = type;
- drawable->drawId = drawId;
- drawable->refCount = 1;
- drawable->config = config;
- drawable->eventMask = 0;
-
- return GL_TRUE;
-}
diff --git a/glx/glxutil.h b/glx/glxutil.h
index baa490500..d1a715b4b 100644
--- a/glx/glxutil.h
+++ b/glx/glxutil.h
@@ -35,18 +35,11 @@
* Silicon Graphics, Inc.
*/
-/* relate contexts with drawables */
-extern void __glXAssociateContext(__GLXcontext *glxc);
-extern void __glXDeassociateContext(__GLXcontext *glxc);
-
-/* drawable management */
-extern void __glXRefDrawable(__GLXdrawable *glxPriv);
-extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
-
extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
__GLXscreen *screen,
DrawablePtr pDraw, int type, XID drawID,
__GLXconfig *config);
+extern void __glXDrawableRelease(__GLXdrawable *drawable);
/* context helper routines */
extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
diff --git a/glx/xfont.c b/glx/xfont.c
index 1f4ecbd4d..b8b466d87 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -180,12 +180,17 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
** Font can actually be either the ID of a font or the ID of a GC
** containing a font.
*/
- pFont = (FontPtr)LookupIDByType(req->font, RT_FONT);
- if (!pFont) {
- pGC = (GC *)LookupIDByType(req->font, RT_GC);
- if (!pGC) {
+
+ error = dixLookupResourceByType((pointer *)&pFont,
+ req->font, RT_FONT,
+ client, DixReadAccess);
+ if (error != Success) {
+ error = dixLookupResourceByType((pointer *)&pGC,
+ req->font, RT_GC,
+ client, DixReadAccess);
+ if (error != Success) {
client->errorValue = req->font;
- return BadFont;
+ return error == BadGC ? BadFont : error;
}
pFont = pGC->font;
}
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 76355e8a1..ccef2a0c8 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1279,38 +1279,12 @@ KdDepthToFb (ScreenPtr pScreen, int depth)
#endif
-#ifdef HAVE_BACKTRACE
-/* shamelessly ripped from xf86Events.c */
-void
-KdBacktrace (int signum)
-{
- void *array[32]; /* more than 32 and you have bigger problems */
- size_t size, i;
- char **strings;
-
- signal(signum, SIG_IGN);
-
- size = backtrace (array, 32);
- fprintf (stderr, "\nBacktrace (%d deep):\n", size);
- strings = backtrace_symbols (array, size);
- for (i = 0; i < size; i++)
- fprintf (stderr, "%d: %s\n", i, strings[i]);
- free (strings);
-
- kdCaughtSignal = TRUE;
- if (signum == SIGSEGV)
- FatalError("Segmentation fault caught\n");
- else if (signum > 0)
- FatalError("Signal %d caught\n", signum);
-}
-#else
-void
-KdBacktrace (int signum)
+static int
+KdSignalWrapper (int signum)
{
kdCaughtSignal = TRUE;
- FatalError("Segmentation fault caught\n");
+ return 1; /* use generic OS layer cleanup & abort */
}
-#endif
void
KdInitOutput (ScreenInfo *pScreenInfo,
@@ -1357,7 +1331,7 @@ KdInitOutput (ScreenInfo *pScreenInfo,
for (screen = card->screenList; screen; screen = screen->next)
KdAddScreen (pScreenInfo, screen, argc, argv);
- signal(SIGSEGV, KdBacktrace);
+ OsRegisterSigWrapper(KdSignalWrapper);
}
void
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 4b2d709d6..7ed36017f 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1918,8 +1918,8 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
}
else {
if (pi->transformCoordinates) {
- x = matrix[0][0] * rx + matrix[0][1] * ry;
- y = matrix[1][0] * rx + matrix[1][1] * ry;
+ x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2];
+ y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2];
}
else {
x = rx;
diff --git a/hw/vfb/InitInput.c b/hw/vfb/InitInput.c
index aa902522a..4c8c99653 100644
--- a/hw/vfb/InitInput.c
+++ b/hw/vfb/InitInput.c
@@ -66,13 +66,11 @@ static int
vfbKeybdProc(DeviceIntPtr pDevice, int onoff)
{
DevicePtr pDev = (DevicePtr)pDevice;
- XkbRMLVOSet rmlvo;
switch (onoff)
{
case DEVICE_INIT:
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(pDevice, &rmlvo, NULL, NULL);
+ InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL);
break;
case DEVICE_ON:
pDev->on = TRUE;
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 9a25c7bca..7ea6197de 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -597,7 +597,9 @@ configFiles(XF86ConfFilesPtr fileconf)
defaultFontPath = Xprintf("%s%s%s",
fileconf->file_fontpath,
*temp_path ? "," : "", temp_path);
- must_copy = FALSE;
+ if (defaultFontPath != NULL) {
+ must_copy = FALSE;
+ }
}
else
defaultFontPath = fileconf->file_fontpath;
@@ -613,7 +615,14 @@ configFiles(XF86ConfFilesPtr fileconf)
!((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) {
defaultFontPath = Xprintf("%s%sbuilt-ins",
temp_path, *temp_path ? "," : "");
- must_copy = FALSE;
+ if (must_copy == TRUE) {
+ if (defaultFontPath != NULL) {
+ must_copy = FALSE;
+ }
+ } else {
+ /* already made a copy of the font path */
+ xfree(temp_path);
+ }
}
/* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;
@@ -1273,7 +1282,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
*/
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
if (!strcmp((*devs)->driver, "void") || !strcmp((*devs)->driver, "mouse") ||
- !strcmp((*devs)->driver, "vmmouse") || !strcmp((*devs)->driver, "evdev")) {
+ !strcmp((*devs)->driver, "vmmouse") || !strcmp((*devs)->driver, "evdev") ||
+ !strcmp((*devs)->driver, "synaptics")) {
found = 1; break;
}
}
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 19120cede..aa818c358 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -79,11 +79,6 @@
#include "xkbsrv.h"
#include "xkbstr.h"
-#ifdef XF86BIGFONT
-#define _XF86BIGFONT_SERVER_
-#include <X11/extensions/xf86bigfont.h>
-#endif
-
#ifdef DPMSExtension
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
@@ -356,35 +351,24 @@ xf86InterceptSigIll(void (*sigillhandler)(void))
}
/*
- * xf86SigHandler --
+ * xf86SigWrapper --
* Catch unexpected signals and exit or continue cleanly.
*/
-void
-xf86SigHandler(int signo)
+int
+xf86SigWrapper(int signo)
{
if ((signo == SIGILL) && xf86SigIllHandler) {
(*xf86SigIllHandler)();
- /* Re-arm handler just in case we unexpectedly return here */
- (void) signal(signo, xf86SigHandler);
- return;
+ return 0; /* continue */
}
if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
*xf86SignalIntercept = signo;
- /* Re-arm handler just in case */
- (void) signal(signo, xf86SigHandler);
- return;
+ return 0; /* continue */
}
- signal(signo,SIG_IGN);
xf86Info.caughtSignal = TRUE;
-#ifdef XF86BIGFONT
- XF86BigfontCleanup();
-#endif
-
- xorg_backtrace();
-
- FatalError("Caught signal %d. Server aborting\n", signo);
+ return 1; /* abort */
}
/*
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index acb775bbe..cf28ae73e 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -380,23 +380,25 @@ InstallSignalHandlers(void)
*/
xf86Info.caughtSignal=FALSE;
if (!xf86Info.notrapSignals) {
- signal(SIGSEGV,xf86SigHandler);
- signal(SIGILL,xf86SigHandler);
+ OsRegisterSigWrapper(xf86SigWrapper);
+ } else {
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGILL, SIG_DFL);
#ifdef SIGEMT
- signal(SIGEMT,xf86SigHandler);
+ signal(SIGEMT, SIG_DFL);
#endif
- signal(SIGFPE,xf86SigHandler);
+ signal(SIGFPE, SIG_DFL);
#ifdef SIGBUS
- signal(SIGBUS,xf86SigHandler);
+ signal(SIGBUS, SIG_DFL);
#endif
#ifdef SIGSYS
- signal(SIGSYS,xf86SigHandler);
+ signal(SIGSYS, SIG_DFL);
#endif
#ifdef SIGXCPU
- signal(SIGXCPU,xf86SigHandler);
+ signal(SIGXCPU, SIG_DFL);
#endif
#ifdef SIGXFSZ
- signal(SIGXFSZ,xf86SigHandler);
+ signal(SIGXFSZ, SIG_DFL);
#endif
}
}
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index bc984f2f7..f4ed8c085 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -147,7 +147,7 @@ extern _X_EXPORT void DoShowOptions(void);
/* xf86Events.c */
extern _X_EXPORT void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
-extern _X_EXPORT void xf86SigHandler(int signo);
+extern _X_HIDDEN int xf86SigWrapper(int signo);
extern _X_EXPORT void xf86HandlePMEvents(int fd, pointer data);
extern _X_EXPORT int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num);
extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event);
diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index 0e06de661..02dcc34b4 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -30,6 +30,7 @@
#include "mibank.h"
#include "globals.h"
#include "xf86.h"
+#include "xf86str.h"
#include "xf86Priv.h"
#include "xf86DDC.h"
#include "mipointer.h"
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 96aff1538..a035fca7f 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -548,6 +548,7 @@ xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
if (rval != Success)
{
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
+ RemoveDevice(dev);
goto unwind;
}
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index 316470df4..a627b5315 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -85,6 +85,7 @@ typedef struct {
Bool (*EnterVT)(int, int);
Bool (*SwitchMode)(int, DisplayModePtr, int);
int (*SetDGAMode)(int, int, DGADevicePtr);
+ xf86ChangeGammaProc *ChangeGamma;
int maxColors;
int sigRGBbits;
int gammaElements;
@@ -195,6 +196,7 @@ Bool xf86HandleColormaps(
pScreenPriv->EnterVT = pScrn->EnterVT;
pScreenPriv->SwitchMode = pScrn->SwitchMode;
pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+ pScreenPriv->ChangeGamma = pScrn->ChangeGamma;
if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) {
pScrn->EnterVT = CMapEnterVT;
@@ -824,6 +826,7 @@ CMapUnwrapScreen(ScreenPtr pScreen)
pScrn->EnterVT = pScreenPriv->EnterVT;
pScrn->SwitchMode = pScreenPriv->SwitchMode;
pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
xfree(pScreenPriv->gamma);
xfree(pScreenPriv->PreAllocIndices);
@@ -889,6 +892,7 @@ CMapChangeGamma(
int index,
Gamma gamma
){
+ int ret = Success;
ScrnInfoPtr pScrn = xf86Screens[index];
ScreenPtr pScreen = pScrn->pScreen;
CMapColormapPtr pColPriv;
@@ -954,7 +958,12 @@ CMapChangeGamma(
CMapReinstallMap(pMap);
}
- return Success;
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
+ if (pScrn->ChangeGamma)
+ ret = pScrn->ChangeGamma(index, gamma);
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ return ret;
}
@@ -1113,5 +1122,5 @@ xf86ChangeGamma(
if(pScrn->ChangeGamma)
return (*pScrn->ChangeGamma)(pScreen->myNum, gamma);
- return Success; /* Success? */
+ return BadImplementation;
}
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 0f2e24b3f..0b52a0f8c 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -139,6 +139,45 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
DRI2BufferPtr buffers;
+ unsigned int temp_buf[32];
+ unsigned int *temp = temp_buf;
+ int have_fake_front = 0;
+
+
+ /* If the drawable is a window and the front-buffer is requested, silently
+ * add the fake front-buffer to the list of requested attachments. The
+ * counting logic in the loop accounts for the case where the client
+ * requests both the fake and real front-buffer.
+ */
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ int need_fake_front = 0;
+ int i;
+
+ if ((count + 1) > 32) {
+ temp = xalloc((count + 1) * sizeof(temp[0]));
+ }
+
+ for (i = 0; i < count; i++) {
+ if (attachments[i] == DRI2BufferFrontLeft) {
+ need_fake_front++;
+ }
+
+ if (attachments[i] == DRI2BufferFakeFrontLeft) {
+ need_fake_front--;
+ have_fake_front = 1;
+ }
+
+ temp[i] = attachments[i];
+ }
+
+ if (need_fake_front > 0) {
+ temp[i] = DRI2BufferFakeFrontLeft;
+ count++;
+ have_fake_front = 1;
+ attachments = temp;
+ }
+ }
+
if (pPriv->buffers == NULL ||
pDraw->width != pPriv->width || pDraw->height != pPriv->height)
@@ -151,10 +190,33 @@ DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
pPriv->height = pDraw->height;
}
+ if (temp != temp_buf) {
+ xfree(temp);
+ }
+
*width = pPriv->width;
*height = pPriv->height;
*out_count = pPriv->bufferCount;
+
+ /* If the client is getting a fake front-buffer, pre-fill it with the
+ * contents of the real front-buffer. This ensures correct operation of
+ * applications that call glXWaitX before calling glDrawBuffer.
+ */
+ if (have_fake_front) {
+ BoxRec box;
+ RegionRec region;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPriv->width;
+ box.y2 = pPriv->height;
+ REGION_INIT(pDraw->pScreen, &region, &box, 0);
+
+ DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
+ DRI2BufferFrontLeft);
+ }
+
return pPriv->buffers;
}
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index d6e1c9689..503f82716 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -202,6 +202,7 @@ ProcDRI2GetBuffers(ClientPtr client)
int i, status, width, height, count;
unsigned int *attachments;
xDRI2Buffer buffer;
+ int skip;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
@@ -211,15 +212,34 @@ ProcDRI2GetBuffers(ClientPtr client)
buffers = DRI2GetBuffers(pDrawable, &width, &height,
attachments, stuff->count, &count);
+ skip = 0;
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ for (i = 0; i < count; i++) {
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if (buffers[i].attachment == DRI2BufferFrontLeft) {
+ skip++;
+ continue;
+ }
+ }
+ }
+
rep.type = X_Reply;
- rep.length = count * sizeof(xDRI2Buffer) / 4;
+ rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
rep.sequenceNumber = client->sequence;
rep.width = width;
rep.height = height;
- rep.count = count;
+ rep.count = count - skip;
WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
for (i = 0; i < count; i++) {
+ /* Do not send the real front buffer of a window to the client.
+ */
+ if ((pDrawable->type == DRAWABLE_WINDOW)
+ && (buffers[i].attachment == DRI2BufferFrontLeft)) {
+ continue;
+ }
+
buffer.attachment = buffers[i].attachment;
buffer.name = buffers[i].name;
buffer.pitch = buffers[i].pitch;
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index dacb5d27d..f941a3b4a 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -754,8 +754,8 @@ Bool
xf86RandR12CreateScreenResources (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ xf86CrtcConfigPtr config;
+ XF86RandRInfoPtr randrp;
int c;
int width, height;
int mmWidth, mmHeight;
@@ -765,6 +765,8 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
return TRUE;
#endif
+ config = XF86_CRTC_CONFIG_PTR(pScrn);
+ randrp = XF86RANDRINFO(pScreen);
/*
* Compute size of screen
*/
@@ -1687,6 +1689,60 @@ xf86RandR13SetPanning (ScreenPtr pScreen,
}
}
+/*
+ * Compatibility with XF86VidMode's gamma changer. This necessarily clobbers
+ * any per-crtc setup. You asked for it...
+ */
+
+static void
+gamma_to_ramp(float gamma, CARD16 *ramp, int size)
+{
+ int i;
+
+ for (i = 0; i < size; i++) {
+ if (gamma == 1.0)
+ ramp[i] = i << 8;
+ else
+ ramp[i] = (CARD16)(pow((double)i / (double)(size - 1), gamma)
+ * (double)(size - 1) * 256);
+ }
+}
+
+static int
+xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
+{
+ int i, size = 0;
+ CARD16 *points, *red, *green, *blue;
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ rrScrPrivPtr rp = rrGetScrPriv(pScrn->pScreen);
+
+ for (i = 0; i < rp->numCrtcs; i++)
+ size = max(size, rp->crtcs[i]->gammaSize);
+
+ if (!size)
+ return Success;
+
+ points = xcalloc(size, 3 * sizeof(CARD16));
+ if (!points)
+ return BadAlloc;
+
+ red = points;
+ green = points + size;
+ blue = points + 2 * size;
+
+ for (i = 0; i < rp->numCrtcs; i++) {
+ gamma_to_ramp(gamma.red, red, rp->crtcs[i]->gammaSize);
+ gamma_to_ramp(gamma.green, green, rp->crtcs[i]->gammaSize);
+ gamma_to_ramp(gamma.blue, blue, rp->crtcs[i]->gammaSize);
+ RRCrtcGammaSet(rp->crtcs[i], red, green, blue);
+ memset(points, 0, 3 * size * sizeof(CARD16));
+ }
+
+ xfree(points);
+
+ return Success;
+}
+
static Bool
xf86RandR12Init12 (ScreenPtr pScreen)
{
@@ -1708,6 +1764,7 @@ xf86RandR12Init12 (ScreenPtr pScreen)
rp->rrModeDestroy = xf86RandR12ModeDestroy;
rp->rrSetConfig = NULL;
pScrn->PointerMoved = xf86RandR12PointerMoved;
+ pScrn->ChangeGamma = xf86RandR12ChangeGamma;
if (!xf86RandR12CreateObjects12 (pScreen))
return FALSE;
diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h
index 3a3f3d7f8..7623e9738 100644
--- a/hw/xfree86/os-support/bus/Pci.h
+++ b/hw/xfree86/os-support/bus/Pci.h
@@ -169,7 +169,7 @@
#endif /* !defined(DEBUGPCI) */
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
- defined(__DragonFly__) || defined(__sun)
+ defined(__DragonFly__) || defined(__sun) || defined(__GNU__)
#define ARCH_PCI_INIT bsdPciInit
#endif
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index a60df2538..e210fa1ab 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -69,8 +69,6 @@ static pointer DomainMmappedIO[MAX_DOMAINS];
void
linuxPciInit(void)
{
- struct stat st;
-
memset(DomainMmappedIO, 0, sizeof(DomainMmappedIO));
}
diff --git a/hw/xfree86/os-support/hurd/Makefile.am b/hw/xfree86/os-support/hurd/Makefile.am
index b405b1f2a..9bbe2afaf 100644
--- a/hw/xfree86/os-support/hurd/Makefile.am
+++ b/hw/xfree86/os-support/hurd/Makefile.am
@@ -5,6 +5,7 @@ libhurd_la_SOURCES = hurd_bell.c hurd_init.c hurd_mmap.c \
$(srcdir)/../shared/VTsw_noop.c \
$(srcdir)/../shared/posix_tty.c \
$(srcdir)/../shared/stdResource.c \
+ $(srcdir)/../shared/vidmem.c \
$(srcdir)/../shared/sigiostubs.c \
$(srcdir)/../shared/pm_noop.c \
$(srcdir)/../shared/kmod_noop.c \
diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c
index 9f2e2bd01..b8b00c892 100644
--- a/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/hw/xfree86/os-support/hurd/hurd_video.c
@@ -41,8 +41,8 @@
/**************************************************************************
* Video Memory Mapping section
***************************************************************************/
-pointer
-xf86MapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size)
+static pointer
+mapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size)
{
mach_port_t device,iopl_dev;
memory_object_t iopl_mem;
@@ -95,8 +95,8 @@ xf86MapVidMem(int ScreenNum,int Flags, unsigned long Base, unsigned long Size)
return (pointer)addr;
}
-void
-xf86UnMapVidMem(int ScreenNum,pointer Base,unsigned long Size)
+static void
+unmapVidMem(int ScreenNum,pointer Base,unsigned long Size)
{
kern_return_t err = vm_deallocate(mach_task_self(), (int)Base, Size);
if( err )
@@ -107,12 +107,6 @@ xf86UnMapVidMem(int ScreenNum,pointer Base,unsigned long Size)
return;
}
-Bool
-xf86LinearVidMem()
-{
- return(TRUE);
-}
-
/**************************************************************************
* I/O Permissions section
***************************************************************************/
@@ -143,14 +137,10 @@ xf86DisableIO()
}
void
-xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
- unsigned long Size)
+xf86OSInitVidMem(VidMemInfoPtr pVidMem)
{
+ pVidMem->linearSupported = TRUE;
+ pVidMem->mapMem = mapVidMem;
+ pVidMem->unmapMem = unmapVidMem;
+ pVidMem->initialised = TRUE;
}
-
-Bool
-xf86CheckMTRR(int s)
-{
- return FALSE;
-}
-
diff --git a/hw/xfree86/os-support/shared/stdResource.c b/hw/xfree86/os-support/shared/stdResource.c
index 8cb101488..a4c162d97 100644
--- a/hw/xfree86/os-support/shared/stdResource.c
+++ b/hw/xfree86/os-support/shared/stdResource.c
@@ -44,7 +44,7 @@
#include "bus/Pci.h"
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
- defined(__DragonFly__) || defined(__sun)
+ defined(__DragonFly__) || defined(__sun) || defined(__GNU__)
#define xf86StdAccResFromOS xf86AccResFromOS
#endif
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index b4e8d2583..6865d3592 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -235,11 +235,12 @@ XF86OptionPtr
xf86optionListDup (XF86OptionPtr opt)
{
XF86OptionPtr newopt = NULL;
+ char *val;
while (opt)
{
- newopt = xf86addNewOption(newopt, strdup(opt->opt_name),
- strdup(opt->opt_val));
+ val = opt->opt_val ? strdup(opt->opt_val) : NULL;
+ newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val);
newopt->opt_used = opt->opt_used;
if (opt->opt_comment)
newopt->opt_comment = strdup(opt->opt_comment);
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index c9b4a1748..f94e26079 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -120,9 +120,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
KeySymsRec keySyms;
int i;
XKeyboardState values;
- XkbComponentNamesRec names;
XkbDescPtr xkb;
- XkbRMLVOSet rmlvo;
int op, event, error, major, minor;
switch (onoff)
@@ -166,14 +164,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
}
XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb);
- memset(&names, 0, sizeof(XkbComponentNamesRec));
- rmlvo.rules = XKB_DFLT_RULES;
- rmlvo.model = XKB_DFLT_MODEL;
- rmlvo.layout = XKB_DFLT_LAYOUT;
- rmlvo.variant = XKB_DFLT_VARIANT;
- rmlvo.options = XKB_DFLT_OPTIONS;
-
- InitKeyboardDeviceStruct(pDev, &rmlvo,
+ InitKeyboardDeviceStruct(pDev, NULL,
xnestBell, xnestChangeKeyboardControl);
XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
XkbFreeKeyboard(xkb, 0, False);
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 937517c6e..0445b8e29 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -44,6 +44,7 @@
#define _APPLEWM_SERVER_
#include "X11/extensions/applewm.h"
#include "micmap.h"
+#include "exglobals.h"
#include <mach/mach.h>
#include <unistd.h>
@@ -60,12 +61,8 @@ extern BOOL xpbproxy_init (void);
#define XSERVER_VERSION "?"
#endif
-#define ProximityIn 0
-#define ProximityOut 1
-
/* Stuck modifier / button state... force release when we context switch */
static NSEventType keyState[NUM_KEYCODES];
-static int modifierFlagsMask;
int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
@@ -84,6 +81,7 @@ extern int darwinFakeButtons;
* location when we become the foreground application
*/
static NSPoint bgMouseLocation;
+static BOOL bgMouseLocationUpdated = FALSE;
X11Application *X11App;
@@ -193,7 +191,8 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
size_t i;
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
if (state) {
- DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
+ if(bgMouseLocationUpdated)
+ DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
DarwinSendDDXEvent(kXquartzActivate, 0);
if (!_x_active) {
@@ -207,7 +206,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
}
} else {
- if(darwin_modifier_flags)
+ if(darwin_all_modifier_flags)
DarwinUpdateModKeys(0);
for(i=0; i < NUM_KEYCODES; i++) {
if(keyState[i] == NSKeyDown) {
@@ -880,7 +879,6 @@ environment the next time you start X11?", @"Startup xinitrc dialog");
void X11ApplicationMain (int argc, char **argv, char **envp) {
NSAutoreleasePool *pool;
- int *p;
#ifdef DEBUG
while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
@@ -925,10 +923,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n");
}
- for(p=darwin_modifier_mask_list, modifierFlagsMask=0; *p; p++) {
- modifierFlagsMask |= *p;
- }
-
/* Tell the server thread that it can proceed */
QuartzInitServer(argc, argv, envp);
@@ -1005,14 +999,14 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
modifierFlags = ensure_flag(modifierFlags, NX_ALTERNATEMASK, NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK, NX_DEVICELALTKEYMASK);
#endif
- modifierFlags &= modifierFlagsMask;
+ modifierFlags &= darwin_all_modifier_mask;
/* We don't receive modifier key events while out of focus, and 3button
* emulation mucks this up, so we need to check our modifier flag state
* on every event... ugg
*/
- if(darwin_modifier_flags != modifierFlags)
+ if(darwin_all_modifier_flags != modifierFlags)
DarwinUpdateModKeys(modifierFlags);
switch ([e type]) {
@@ -1054,8 +1048,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
* NSTabletProximityEventSubtype will come from NSTabletPoint
* rather than NSMouseMoved.
pressure = [e pressure];
- tilt_x = [e tilt].x;
- tilt_y = [e tilt].y;
+ tilt = [e tilt];
pDev = darwinTabletCurrent;
*/
@@ -1071,35 +1064,34 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
}
if(!quartzServerVisible && noTestExtensions) {
-#if 0
-/* Seems this has somehow triggered 100% CPU usage while X11.app is in the
- * background on some obscure HW configurations.
- * http://xquartz.macosforge.org/trac/ticket/241
- */
-//#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
+ if(ev_button == 0) {
+#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
/* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */
- xp_window_id wid;
- xp_error e;
+ xp_window_id wid = 0;
+ xp_error e;
- /* Sigh. Need to check that we're really over one of
- * our windows. (We need to receive pointer events while
- * not in the foreground, but we don't want to receive them
- * when another window is over us or we might show a tooltip)
- */
+ /* Sigh. Need to check that we're really over one of
+ * our windows. (We need to receive pointer events while
+ * not in the foreground, but we don't want to receive them
+ * when another window is over us or we might show a tooltip)
+ */
- wid = 0;
- e = xp_find_window(location.x, location.y, 0, &wid);
+ e = xp_find_window(location.x, location.y, 0, &wid);
- if (e == XP_Success && wid == 0) {
- bgMouseLocation = location;
- return;
- }
-#else
- bgMouseLocation = location;
- return;
+ if (e == XP_Success && wid == 0)
#endif
+ {
+ bgMouseLocation = location;
+ bgMouseLocationUpdated = TRUE;
+ return;
+ }
+ } else {
+ bgMouseLocationUpdated = FALSE;
+ DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x,
+ location.y, pressure, tilt.x, tilt.y);
+ }
}
-
+
DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, location.y,
pressure, tilt.x, tilt.y);
@@ -1125,6 +1117,15 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
break;
case NSScrollWheel:
+#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
+ /* If we're in the background, we need to send a MotionNotify event
+ * first, since we aren't getting them on background mouse motion
+ */
+ if(!quartzServerVisible && noTestExtensions) {
+ DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
+ location.y, pressure, tilt.x, tilt.y);
+ }
+#endif
DarwinSendScrollEvents([e deltaX], [e deltaY], location.x, location.y,
pressure, tilt.x, tilt.y);
break;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 7f0ff7e88..54d05fb63 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -74,7 +74,9 @@ in this Software without prior written authorization from The Open Group.
/* FIXME: Abstract this better */
void QuartzModeEQInit(void);
-int darwin_modifier_flags = 0; // last known modifier state
+int darwin_all_modifier_flags = 0; // last known modifier state
+int darwin_all_modifier_mask = 0;
+int darwin_x11_modifier_mask = 0;
#define FD_ADD_MAX 128
static int fd_add[FD_ADD_MAX];
@@ -145,7 +147,7 @@ static void DarwinPressModifierKey(int pressed, int key) {
* Send events to update the modifier state.
*/
-int darwin_modifier_mask_list[] = {
+static int darwin_x11_modifier_mask_list[] = {
#ifdef NX_DEVICELCMDKEYMASK
NX_DEVICELCTLKEYMASK, NX_DEVICERCTLKEYMASK,
NX_DEVICELSHIFTKEYMASK, NX_DEVICERSHIFTKEYMASK,
@@ -158,6 +160,8 @@ int darwin_modifier_mask_list[] = {
0
};
+static int darwin_all_modifier_mask_additions[] = { NX_SECONDARYFNMASK, };
+
static void DarwinUpdateModifiers(
int pressed, // KeyPress or KeyRelease
int flags ) // modifier flags that have changed
@@ -173,7 +177,7 @@ static void DarwinUpdateModifiers(
DarwinPressModifierKey(KeyRelease, NX_MODIFIERKEY_ALPHALOCK);
}
- for(f=darwin_modifier_mask_list; *f; f++)
+ for(f=darwin_x11_modifier_mask_list; *f; f++)
if(*f & flags && *f != NX_ALPHASHIFTMASK) {
key = DarwinModifierNXMaskToNXKey(*f);
if(key == -1)
@@ -306,6 +310,16 @@ static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceInt
}
Bool DarwinEQInit(void) {
+ int *p;
+
+ for(p=darwin_x11_modifier_mask_list, darwin_all_modifier_mask=0; *p; p++) {
+ darwin_x11_modifier_mask |= *p;
+ }
+
+ for(p=darwin_all_modifier_mask_additions, darwin_all_modifier_mask= darwin_x11_modifier_mask; *p; p++) {
+ darwin_all_modifier_mask |= *p;
+ }
+
mieqInit();
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
@@ -434,14 +448,14 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
DarwinSendPointerEvents(pDev, ButtonRelease, darwinFakeMouseButtonDown, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
darwinFakeMouseButtonDown=0;
}
- if (darwin_modifier_flags & darwinFakeMouse2Mask) {
+ if (darwin_all_modifier_flags & darwinFakeMouse2Mask) {
ev_button = 2;
darwinFakeMouseButtonDown = 2;
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse2Mask);
- } else if (darwin_modifier_flags & darwinFakeMouse3Mask) {
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse2Mask);
+ } else if (darwin_all_modifier_flags & darwinFakeMouse3Mask) {
ev_button = 3;
darwinFakeMouseButtonDown = 3;
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse3Mask);
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse3Mask);
}
}
@@ -451,9 +465,9 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
}
if(darwinFakeMouseButtonDown == 2) {
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse2Mask);
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse2Mask);
} else if(darwinFakeMouseButtonDown == 3) {
- DarwinUpdateModKeys(darwin_modifier_flags & ~darwinFakeMouse3Mask);
+ DarwinUpdateModKeys(darwin_all_modifier_flags & ~darwinFakeMouse3Mask);
}
darwinFakeMouseButtonDown = 0;
@@ -464,7 +478,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
for(i=0; i<num_events; i++) mieqEnqueue (pDev, darwinEvents[i].event);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -479,7 +493,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
darwinEvents_lock(); {
num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,darwinEvents[i].event);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -507,7 +521,7 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
num_events = GetProximityEvents(darwinEvents, pDev, ev_type,
0, 5, valuators);
for(i=0; i<num_events; i++) mieqEnqueue (pDev,darwinEvents[i].event);
- DarwinPokeEQ();
+ if(num_events > 0) DarwinPokeEQ();
} darwinEvents_unlock();
}
@@ -543,9 +557,9 @@ void DarwinSendScrollEvents(float count_x, float count_y,
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
reflect changing modifier flags (alt, control, meta, etc) */
void DarwinUpdateModKeys(int flags) {
- DarwinUpdateModifiers(KeyRelease, darwin_modifier_flags & ~flags);
- DarwinUpdateModifiers(KeyPress, ~darwin_modifier_flags & flags);
- darwin_modifier_flags = flags;
+ DarwinUpdateModifiers(KeyRelease, darwin_all_modifier_flags & ~flags & darwin_x11_modifier_mask);
+ DarwinUpdateModifiers(KeyPress, ~darwin_all_modifier_flags & flags & darwin_x11_modifier_mask);
+ darwin_all_modifier_flags = flags;
}
/*
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 9ec3bda2f..126851422 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -78,7 +78,15 @@ enum {
/* Send one of the above events to the server thread. */
void DarwinSendDDXEvent(int type, int argc, ...);
-extern int darwin_modifier_mask_list[];
-extern int darwin_modifier_flags;
+/* A mask of the modifiers that are in our X11 keyboard layout:
+ * (Fn for example is just useful for 3button mouse emulation) */
+extern int darwin_all_modifier_mask;
+
+/* A mask of the modifiers that are in our X11 keyboard layout:
+ * (Fn for example is just useful for 3button mouse emulation) */
+extern int darwin_x11_modifier_mask;
+
+/* The current state of the above listed modifiers */
+extern int darwin_all_modifier_flags;
#endif /* _DARWIN_EVENTS_H */
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 0de63b642..344edec54 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -352,13 +352,20 @@ void QuartzSetRootless(Bool state) {
/* When in rootless, the menubar is not part of the screen, so we need to update our screens on toggle */
QuartzUpdateScreens();
- if (!quartzEnableRootless && !quartzHasRoot) {
- RootlessHideAllWindows();
- } else if (quartzEnableRootless && !quartzHasRoot) {
- RootlessShowAllWindows();
+ if(!quartzHasRoot) {
+ if(!quartzEnableRootless) {
+ RootlessHideAllWindows();
+ } else {
+ RootlessShowAllWindows();
+ }
}
+ X11ApplicationShowHideMenubar(!quartzHasRoot);
+
xp_reenable_update();
+
+ if (!quartzEnableRootless && quartzFullscreenDisableHotkeys)
+ xp_disable_hot_keys(quartzHasRoot);
}
/*
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 823c2e67c..2b8cb13f8 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -317,7 +317,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
XkbComponentNamesRec names;
CFIndex value;
BOOL ok;
- XkbRMLVOSet rmlvo;
// Open a shared connection to the HID System.
// Note that the Event Status Driver is really just a wrapper
@@ -328,8 +327,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
bzero(&names, sizeof(names));
- XkbGetRulesDflts(&rmlvo);
- InitKeyboardDeviceStruct(pDev, &rmlvo, QuartzBell,
+ InitKeyboardDeviceStruct(pDev, NULL, QuartzBell,
DarwinChangeKeyboardControl);
/* Get our key repeat settings from GlobalPreferences */
diff --git a/hw/xquartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h
index ab79a42cd..b329ca118 100644
--- a/hw/xquartz/xpr/xpr.h
+++ b/hw/xquartz/xpr/xpr.h
@@ -47,4 +47,19 @@ Bool QuartzInitCursor(ScreenPtr pScreen);
void QuartzSuspendXCursor(ScreenPtr pScreen);
void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
+/* If we are rooted, we need the root window and desktop levels to be below
+ * the menubar (24) but above native windows. Normal window level is 0.
+ * Floating window level is 3. The rest are filled in as appropriate.
+ * See CGWindowLevel.h
+ */
+
+#define _APPLEWM_SERVER_
+#include <X11/extensions/applewm.h>
+static const int normal_window_levels[AppleWMNumWindowLevels+1] = {
+0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29,
+};
+static const int rooted_window_levels[AppleWMNumWindowLevels+1] = {
+20, 21, 22, 23, 19, 18,
+};
+
#endif /* XPR_H */
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index fb506986c..9c44e20a2 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -38,36 +38,37 @@
#include "applewmExt.h"
#include "rootless.h"
+#include "rootlessCommon.h"
#include <Xplugin.h>
#include <X11/X.h>
#include "quartz.h"
#include "x-hash.h"
-/* This lookup table came straight from the Tiger X11 source. I tried to figure
- * it out based on CGWindowLevel.h, but I dunno... -JH
- */
-static const int normal_window_levels[AppleWMNumWindowLevels+1] = {
-0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29,
-};
-static const int rooted_window_levels[AppleWMNumWindowLevels+1] = {
-202, 203, 204, 205, 201, 200
-};
-
static int xprSetWindowLevel(
WindowPtr pWin,
int level)
{
xp_window_id wid;
xp_window_changes wc;
+ RootlessWindowRec *winRec;
+ // AppleWMNumWindowLevels is allowed, but is only set by the server
+ // for the root window.
+ if (level < 0 || level >= AppleWMNumWindowLevels) {
+ return BadValue;
+ }
+
wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, TRUE));
if (wid == 0)
return BadWindow;
RootlessStopDrawing (pWin, FALSE);
-
- //if (WINREC(WindowTable[pWin->drawable.pScreen->myNum]) == NULL)
- if (quartzHasRoot)
+ winRec = WINREC(pWin);
+
+ if(!winRec)
+ return BadWindow;
+
+ if(quartzEnableRootless)
wc.window_level = normal_window_levels[level];
else
wc.window_level = rooted_window_levels[level];
@@ -76,6 +77,8 @@ static int xprSetWindowLevel(
return BadValue;
}
+ winRec->level = level;
+
return Success;
}
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index a7fc3a9e7..6635f08d8 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -42,6 +42,7 @@
#include "dix.h"
#include <X11/Xatom.h>
#include "windowstr.h"
+#include "quartz.h"
#include "threadSafety.h"
@@ -161,6 +162,14 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
mask |= XP_SHAPE;
}
+ pFrame->level = !IsRoot (pWin) ? AppleWMWindowLevelNormal : AppleWMNumWindowLevels;
+
+ if(quartzEnableRootless)
+ wc.window_level = normal_window_levels[pFrame->level];
+ else
+ wc.window_level = rooted_window_levels[pFrame->level];
+ mask |= XP_WINDOW_LEVEL;
+
err = xp_create_window(mask, &wc, (xp_window_id *) &pFrame->wid);
if (err != Success)
@@ -245,38 +254,36 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
/*
* Change frame stacking.
*/
-static void
-xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
-{
+static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
xp_window_changes wc;
+ unsigned int mask = XP_STACKING;
TA_SERVER();
- /* Stack frame below nextWid it if it exists, or raise
+ /* Stack frame below nextWid it if it exists, or raise
frame above everything otherwise. */
- if (nextWid == NULL)
- {
-#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
- WindowPtr pWin = xprGetXWindow((xp_window_id)wid);
- wc.stack_mode = (pWin && pWin->overrideRedirect) ? XP_MAPPED_ABOVE_CURRENT_SPACE : XP_MAPPED_ABOVE;
-#else
+ if(nextWid == NULL) {
wc.stack_mode = XP_MAPPED_ABOVE;
-#endif
wc.sibling = 0;
- }
- else
- {
-#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
- WindowPtr pWin = xprGetXWindow((xp_window_id)wid);
- wc.stack_mode = (pWin && pWin->overrideRedirect) ? XP_MAPPED_BELOW_CURRENT_SPACE : XP_MAPPED_BELOW;
-#else
+ } else {
wc.stack_mode = XP_MAPPED_BELOW;
-#endif
wc.sibling = x_cvt_vptr_to_uint(nextWid);
}
- xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc);
+ if(window_hash) {
+ RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr((xp_window_id)wid), NULL);
+
+ if(winRec) {
+ if(quartzEnableRootless)
+ wc.window_level = normal_window_levels[winRec->level];
+ else
+ wc.window_level = rooted_window_levels[winRec->level];
+ mask |= XP_WINDOW_LEVEL;
+ }
+ }
+
+ xprConfigureWindow(x_cvt_vptr_to_uint(wid), mask, &wc);
}
diff --git a/hw/xquartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c
index da262f654..1fac9ec60 100644
--- a/hw/xquartz/xpr/xprScreen.c
+++ b/hw/xquartz/xpr/xprScreen.c
@@ -256,6 +256,9 @@ xprDisplayInit(void)
AppleDRIExtensionInit();
xprAppleWMInit();
+
+ if (!quartzEnableRootless)
+ RootlessHideAllWindows();
}
/*
diff --git a/include/os.h b/include/os.h
index bda7125a0..2f6b0c06f 100644
--- a/include/os.h
+++ b/include/os.h
@@ -228,8 +228,10 @@ extern _X_EXPORT char *XNFprintf(const char *fmt, ...);
extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
typedef void (*OsSigHandlerPtr)(int /* sig */);
+typedef int (*OsSigWrapperPtr)(int /* sig */);
extern _X_EXPORT OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
+extern _X_EXPORT OsSigWrapperPtr OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
extern _X_EXPORT int auditTrailLevel;
diff --git a/include/version-config.h.in b/include/version-config.h.in
new file mode 100644
index 000000000..8180dff8e
--- /dev/null
+++ b/include/version-config.h.in
@@ -0,0 +1,16 @@
+/* version-config.h.in: not generated */
+
+#ifndef VERSION_CONFIG_H
+#define VERSION_CONFIG_H
+
+/* Vendor man version */
+#undef VENDOR_MAN_VERSION
+
+/* Vendor name */
+#undef VENDOR_NAME
+
+/* Vendor release */
+#undef VENDOR_RELEASE
+
+#endif /* VERSION_CONFIG_H */
+
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index d1c079b92..1ca0e3059 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -857,6 +857,11 @@ extern _X_EXPORT void XkbGetRulesDflts(
XkbRMLVOSet * /* rmlvo */
);
+extern _X_EXPORT void XkbFreeRMLVOSet(
+ XkbRMLVOSet * /* rmlvo */,
+ Bool /* freeRMLVO */
+);
+
extern _X_EXPORT void XkbSetRulesDflts(
XkbRMLVOSet * /* rmlvo */
);
diff --git a/m4/ac_define_dir.m4 b/m4/ac_define_dir.m4
new file mode 100644
index 000000000..db42d3eb0
--- /dev/null
+++ b/m4/ac_define_dir.m4
@@ -0,0 +1,49 @@
+# ===========================================================================
+# http://autoconf-archive.cryp.to/ac_define_dir.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+#
+# DESCRIPTION
+#
+# This macro sets VARNAME to the expansion of the DIR variable, taking
+# care of fixing up ${prefix} and such.
+#
+# VARNAME is then offered as both an output variable and a C preprocessor
+# symbol.
+#
+# Example:
+#
+# AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
+#
+# LAST MODIFICATION
+#
+# 2008-04-12
+#
+# COPYLEFT
+#
+# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
+# Copyright (c) 2008 Andreas Schwab <schwab@suse.de>
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2008 Alexandre Oliva
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved.
+
+AC_DEFUN([AC_DEFINE_DIR], [
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
+dnl refers to ${prefix}. Thus we have to use `eval' twice.
+ eval ac_define_dir="\"[$]$2\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ AC_SUBST($1, "$ac_define_dir")
+ AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+])
diff --git a/acinclude.m4 b/m4/dolt.m4
index c3e36f8b1..1109bdb0c 100644
--- a/acinclude.m4
+++ b/m4/dolt.m4
@@ -155,6 +155,7 @@ modeok=false
tagok=false
for arg in "$[]@"; do
case "$arg" in
+ --silent) ;;
--mode=compile) modeok=true ;;
--tag=CC|--tag=CXX) tagok=true ;;
*) args@<:@${#args[@]}@:>@="$arg" ;;
@@ -175,53 +176,3 @@ AC_SUBST(LTCOMPILE)
AC_SUBST(LTCXXCOMPILE)
# end dolt
])
-
-# ===========================================================================
-# http://autoconf-archive.cryp.to/ac_define_dir.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
-#
-# DESCRIPTION
-#
-# This macro sets VARNAME to the expansion of the DIR variable, taking
-# care of fixing up ${prefix} and such.
-#
-# VARNAME is then offered as both an output variable and a C preprocessor
-# symbol.
-#
-# Example:
-#
-# AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
-#
-# LAST MODIFICATION
-#
-# 2008-04-12
-#
-# COPYLEFT
-#
-# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
-# Copyright (c) 2008 Andreas Schwab <schwab@suse.de>
-# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
-# Copyright (c) 2008 Alexandre Oliva
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved.
-
-AC_DEFUN([AC_DEFINE_DIR], [
- prefix_NONE=
- exec_prefix_NONE=
- test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
- test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
-dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
-dnl refers to ${prefix}. Thus we have to use `eval' twice.
- eval ac_define_dir="\"[$]$2\""
- eval ac_define_dir="\"$ac_define_dir\""
- AC_SUBST($1, "$ac_define_dir")
- AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
- test "$prefix_NONE" && prefix=NONE
- test "$exec_prefix_NONE" && exec_prefix=NONE
-])
diff --git a/m4/shave.m4 b/m4/shave.m4
new file mode 100644
index 000000000..0c2c9f5a0
--- /dev/null
+++ b/m4/shave.m4
@@ -0,0 +1,73 @@
+dnl Make automake/libtool output more friendly to humans
+dnl
+dnl SHAVE_INIT([shavedir],[default_mode])
+dnl
+dnl shavedir: the directory where the shave scripts are, it defaults to
+dnl $(top_builddir)
+dnl default_mode: (enable|disable) default shave mode. This parameter
+dnl controls shave's behaviour when no option has been
+dnl given to configure. It defaults to disable.
+dnl
+dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just
+dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and
+dnl LIBTOOL, you don't want the configure tests to have these variables
+dnl re-defined.
+dnl * This macro requires GNU make's -s option.
+
+AC_DEFUN([_SHAVE_ARG_ENABLE],
+[
+ AC_ARG_ENABLE([shave],
+ AS_HELP_STRING(
+ [--enable-shave],
+ [use shave to make the build pretty [[default=$1]]]),,
+ [enable_shave=$1]
+ )
+])
+
+AC_DEFUN([SHAVE_INIT],
+[
+ dnl you can tweak the default value of enable_shave
+ m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)])
+
+ if test x"$enable_shave" = xyes; then
+ dnl where can we find the shave scripts?
+ m4_if([$1],,
+ [shavedir="$ac_pwd"],
+ [shavedir="$ac_pwd/$1"])
+ AC_SUBST(shavedir)
+
+ dnl make is now quiet
+ AC_SUBST([MAKEFLAGS], [-s])
+ AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`'])
+
+ dnl we need sed
+ AC_CHECK_PROG(SED,sed,sed,false)
+
+ dnl substitute libtool
+ SHAVE_SAVED_LIBTOOL=$LIBTOOL
+ LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'"
+ AC_SUBST(LIBTOOL)
+
+ dnl substitute cc/cxx
+ SHAVE_SAVED_CC=$CC
+ SHAVE_SAVED_CXX=$CXX
+ SHAVE_SAVED_FC=$FC
+ SHAVE_SAVED_F77=$F77
+ CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}"
+ CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}"
+ FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}"
+ F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}"
+ AC_SUBST(CC)
+ AC_SUBST(CXX)
+ AC_SUBST(FC)
+ AC_SUBST(F77)
+
+ V=@
+ else
+ V=1
+ fi
+ Q='$(V:1=)'
+ AC_SUBST(V)
+ AC_SUBST(Q)
+])
+
diff --git a/miext/rootless/rootless.h b/miext/rootless/rootless.h
index 5224dca2b..bde4cff52 100644
--- a/miext/rootless/rootless.h
+++ b/miext/rootless/rootless.h
@@ -57,6 +57,7 @@ typedef struct _RootlessWindowRec {
int x, y;
unsigned int width, height;
unsigned int borderWidth;
+ int level;
RootlessFrameID wid; // implementation specific frame id
WindowPtr win; // underlying X window
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 5ce26bd2f..b173cef70 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -48,8 +48,6 @@ extern int darwinMainScreenX, darwinMainScreenY;
#endif
#include "fb.h"
-#define AppleWMNumWindowLevels 5
-
#include "rootlessCommon.h"
#include "rootlessWindow.h"
@@ -105,12 +103,6 @@ current_time_in_seconds (void)
return t;
} */
-static inline Bool
-rootlessHasRoot (ScreenPtr pScreen)
-{
- return WINREC (WindowTable[pScreen->myNum]) != NULL;
-}
-
void
RootlessNativeWindowStateChanged (WindowPtr pWin, unsigned int state)
{
@@ -486,6 +478,7 @@ RootlessEnsureFrame(WindowPtr pWin)
winRec->is_reorder_pending = FALSE;
winRec->pixmap = NULL;
winRec->wid = NULL;
+ winRec->level = 0;
SETWINREC(pWin, winRec);
diff --git a/os/log.c b/os/log.c
index b01965a17..8108890b6 100644
--- a/os/log.c
+++ b/os/log.c
@@ -98,6 +98,10 @@ OR PERFORMANCE OF THIS SOFTWARE.
#define getpid(x) _getpid(x)
#endif
+#ifdef XF86BIGFONT
+#define _XF86BIGFONT_SERVER_
+#include <X11/extensions/xf86bigfont.h>
+#endif
#ifdef DDXOSVERRORF
void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
@@ -312,7 +316,7 @@ void
LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
{
const char *s = X_UNKNOWN_STRING;
- char *tmpBuf = NULL;
+ char tmpBuf[1024];
/* Ignore verbosity for X_ERROR */
if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) {
@@ -354,21 +358,11 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
break;
}
- /*
- * Prefix the format string with the message type. We do it this way
- * so that LogVWrite() is only called once per message.
- */
- if (s) {
- tmpBuf = malloc(strlen(format) + strlen(s) + 1 + 1);
- /* Silently return if malloc fails here. */
- if (!tmpBuf)
- return;
- sprintf(tmpBuf, "%s ", s);
- strcat(tmpBuf, format);
- LogVWrite(verb, tmpBuf, args);
- free(tmpBuf);
- } else
- LogVWrite(verb, format, args);
+ /* if s is not NULL we need a space before format */
+ snprintf(tmpBuf, sizeof(tmpBuf), "%s%s%s", s ? s : "",
+ s ? " " : "",
+ format);
+ LogVWrite(verb, tmpBuf, args);
}
}
@@ -401,6 +395,9 @@ void AbortServer(void) __attribute__((noreturn));
void
AbortServer(void)
{
+#ifdef XF86BIGFONT
+ XF86BigfontCleanup();
+#endif
CloseWellKnownConnections();
OsCleanup(TRUE);
CloseDownDevices();
diff --git a/os/osinit.c b/os/osinit.c
index f9ee73ec1..b7bd0763b 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -54,6 +54,11 @@ SOFTWARE.
#include "os.h"
#include "osdep.h"
#include <X11/Xos.h>
+#include <signal.h>
+#include <errno.h>
+#ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
+#endif
#include "dixstruct.h"
@@ -88,6 +93,66 @@ int limitStackSpace = -1;
int limitNoFile = -1;
#endif
+static OsSigWrapperPtr OsSigWrapper = NULL;
+
+OsSigWrapperPtr
+OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
+{
+ OsSigWrapperPtr oldSigWrapper = OsSigWrapper;
+
+ OsSigWrapper = newSigWrapper;
+
+ return oldSigWrapper;
+}
+
+/*
+ * OsSigHandler --
+ * Catch unexpected signals and exit or continue cleanly.
+ */
+static void
+#ifdef SA_SIGINFO
+OsSigHandler(int signo, siginfo_t *sip, void *unused)
+#else
+OsSigHandler(int signo)
+#endif
+{
+#ifdef RTLD_DI_SETSIGNAL
+ const char *dlerr = dlerror();
+
+ if (dlerr) {
+ LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr);
+ }
+#endif /* RTLD_DI_SETSIGNAL */
+
+ if (OsSigWrapper != NULL) {
+ if (OsSigWrapper(signo) == 0) {
+ /* ddx handled signal and wants us to continue */
+ return;
+ }
+ }
+
+ /* log, cleanup, and abort */
+ xorg_backtrace();
+
+#ifdef SA_SIGINFO
+ if (sip->si_code == SI_USER) {
+ ErrorF("Recieved signal %d sent by process %ld, uid %ld\n",
+ (long) sip->si_pid, (long) sip->si_uid);
+ } else {
+ switch (signo) {
+ case SIGSEGV:
+ case SIGBUS:
+ case SIGILL:
+ case SIGFPE:
+ ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr);
+ }
+ }
+#endif
+
+ FatalError("Caught signal %d (%s). Server aborting\n",
+ signo, strsignal(signo));
+}
+
void
OsInit(void)
{
@@ -97,6 +162,44 @@ OsInit(void)
char fname[PATH_MAX];
if (!been_here) {
+ struct sigaction act, oact;
+ int i;
+ int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
+#ifdef SIGSYS
+ SIGSYS,
+#endif
+#ifdef SIGXCPU
+ SIGXCPU,
+#endif
+#ifdef SIGXFSZ
+ SIGXFSZ,
+#endif
+#ifdef SIGEMT
+ SIGEMT,
+#endif
+ 0 /* must be last */ };
+ sigemptyset(&act.sa_mask);
+ act.sa_handler = OsSigHandler;
+ act.sa_flags = 0;
+#ifdef SA_SIGINFO
+ act.sa_flags |= SA_SIGINFO;
+#endif
+ for (i = 0; siglist[i] != 0; i++) {
+ if (sigaction(siglist[i], &act, &oact)) {
+ ErrorF("failed to install signal handler for signal %d: %s\n",
+ siglist[i], strerror(errno));
+ }
+ }
+
+#ifdef RTLD_DI_SETSIGNAL
+ /* Tell runtime linker to send a signal we can catch instead of SIGKILL
+ * for failures to load libraries/modules at runtime so we can clean up
+ * after ourselves.
+ */
+ int failure_signal = SIGQUIT;
+ dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
+#endif
+
#if !defined(__SCO__) && !defined(__CYGWIN__) && !defined(__UNIXWARE__)
fclose(stdin);
fclose(stdout);
diff --git a/os/xdmcp.c b/os/xdmcp.c
index cf9558679..c1d650d46 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -490,6 +490,8 @@ XdmcpRegisterConnection (
return;
}
}
+ if (ConnectionAddresses.length + 1 == 256)
+ return;
newAddress = xalloc (addrlen * sizeof (CARD8));
if (!newAddress)
return;
diff --git a/shave-libtool.in b/shave-libtool.in
new file mode 100644
index 000000000..1f3a720c1
--- /dev/null
+++ b/shave-libtool.in
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# we need sed
+SED=@SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+ last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the real libtool to use
+LIBTOOL="$1"
+shift
+
+# if 1, don't print anything, the underlaying wrapper will do it
+pass_though=0
+
+# scan the arguments, keep the right ones for libtool, and discover the mode
+preserved_args=
+while test "$#" -gt 0; do
+ opt="$1"
+ shift
+
+ case $opt in
+ --mode=*)
+ mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+ preserved_args="$preserved_args $opt"
+ ;;
+ -o)
+ lt_output="$1"
+ preserved_args="$preserved_args $opt"
+ ;;
+ *)
+ preserved_args="$preserved_args $opt"
+ ;;
+ esac
+done
+
+case "$mode" in
+compile)
+ # shave will be called and print the actual CC/CXX/LINK line
+ preserved_args="$preserved_args --shave-mode=$mode"
+ pass_though=1
+ ;;
+link)
+ preserved_args="$preserved_args --shave-mode=$mode"
+ Q=" LINK "
+ ;;
+*)
+ # let's u
+ # echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
+ ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+ if test $pass_though -eq 0; then
+ echo "$Q$output"
+ fi
+ $LIBTOOL --silent $preserved_args
+else
+ echo $LIBTOOL $preserved_args
+ $LIBTOOL $preserved_args
+fi
diff --git a/shave.in b/shave.in
new file mode 100644
index 000000000..174641e9b
--- /dev/null
+++ b/shave.in
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+# we need sed
+SED=@SED@
+if test -z "$SED" ; then
+SED=sed
+fi
+
+lt_unmangle ()
+{
+ last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
+}
+
+# the tool to wrap (cc, cxx, ar, ranlib, ..)
+tool="$1"
+shift
+
+# the reel tool (to call)
+REEL_TOOL="$1"
+shift
+
+pass_through=0
+preserved_args=
+while test "$#" -gt 0; do
+ opt="$1"
+ shift
+
+ case $opt in
+ --shave-mode=*)
+ mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
+ ;;
+ -o)
+ lt_output="$1"
+ preserved_args="$preserved_args $opt"
+ ;;
+ *)
+ preserved_args="$preserved_args $opt"
+ ;;
+ esac
+done
+
+# mode=link is handled in the libtool wrapper
+case "$mode,$tool" in
+link,*)
+ pass_through=1
+ ;;
+*,cxx)
+ Q=" CXX "
+ ;;
+*,cc)
+ Q=" CC "
+ ;;
+*,fc)
+ Q=" FC "
+ ;;
+*,f77)
+ Q=" F77 "
+ ;;
+*,*)
+ # should not happen
+ Q=" CC "
+ ;;
+esac
+
+lt_unmangle "$lt_output"
+output=$last_result
+
+if test -z $V; then
+ if test $pass_through -eq 0; then
+ echo "$Q$output"
+ fi
+ $REEL_TOOL $preserved_args
+else
+ echo $REEL_TOOL $preserved_args
+ $REEL_TOOL $preserved_args
+fi
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 99403e5ce..33ab4265c 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -64,14 +64,19 @@ static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKeyIndex;
static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
-#define VERIFY_CURSOR(pCursor, cursor, client, access) { \
- pCursor = (CursorPtr)SecurityLookupIDByType((client), (cursor), \
- RT_CURSOR, (access)); \
- if (!pCursor) { \
- (client)->errorValue = (cursor); \
- return BadCursor; \
- } \
-}
+#define VERIFY_CURSOR(pCursor, cursor, client, access) \
+ do { \
+ int err; \
+ err = dixLookupResourceByType((pointer *) &pCursor, cursor, \
+ RT_CURSOR, client, access); \
+ if (err == BadValue) { \
+ client->errorValue = cursor; \
+ return BadCursor; \
+ } else if (err != Success) { \
+ client->errorValue = cursor; \
+ return err; \
+ } \
+ } while (0)
/*
* There is a global list of windows selecting for cursor events
diff --git a/xfixes/xfixes.h b/xfixes/xfixes.h
index ade2f8236..69d162ffe 100644
--- a/xfixes/xfixes.h
+++ b/xfixes/xfixes.h
@@ -32,13 +32,19 @@
extern _X_EXPORT RESTYPE RegionResType;
extern _X_EXPORT int XFixesErrorBase;
-#define VERIFY_REGION(pRegion, rid, client, mode) { \
- pRegion = SecurityLookupIDByType (client, rid, RegionResType, mode); \
- if (!pRegion) { \
- client->errorValue = rid; \
- return XFixesErrorBase + BadRegion; \
- } \
-}
+#define VERIFY_REGION(pRegion, rid, client, mode) \
+ do { \
+ int err; \
+ err = dixLookupResourceByType((pointer *) &pRegion, rid, \
+ RegionResType, client, mode); \
+ if (err == BadValue) { \
+ client->errorValue = rid; \
+ return XFixesErrorBase + BadRegion; \
+ } else if (err != Success) { \
+ client->errorValue = rid; \
+ return err; \
+ } \
+ } while (0)
#define VERIFY_REGION_OR_NONE(pRegion, rid, client, mode) { \
pRegion = 0; \
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 1f5f8dc49..5ac06feae 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -111,6 +111,10 @@ static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
/***====================================================================***/
+/**
+ * Get the current default XKB rules.
+ * Caller must free the data in rmlvo.
+ */
void
XkbGetRulesDflts(XkbRMLVOSet *rmlvo)
{
@@ -124,6 +128,30 @@ XkbGetRulesDflts(XkbRMLVOSet *rmlvo)
else rmlvo->variant= XKB_DFLT_VARIANT;
if (XkbOptionsDflt) rmlvo->options= XkbOptionsDflt;
else rmlvo->options= XKB_DFLT_OPTIONS;
+
+ rmlvo->rules = strdup(rmlvo->rules);
+ rmlvo->model = strdup(rmlvo->model);
+ rmlvo->layout = strdup(rmlvo->layout);
+ rmlvo->variant = strdup(rmlvo->variant);
+ rmlvo->options = strdup(rmlvo->options);
+}
+
+void
+XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO)
+{
+ if (!rmlvo)
+ return;
+
+ xfree(rmlvo->rules);
+ xfree(rmlvo->model);
+ xfree(rmlvo->layout);
+ xfree(rmlvo->variant);
+ xfree(rmlvo->options);
+
+ if (freeRMLVO)
+ xfree(rmlvo);
+ else
+ memset(rmlvo, 0, sizeof(XkbRMLVOSet));
}
static Bool
@@ -474,10 +502,18 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
XkbSrvLedInfoPtr sli;
XkbChangesRec changes;
XkbEventCauseRec cause;
+ XkbRMLVOSet rmlvo_dflts = { NULL };
- if (dev->key || dev->kbdfeed || !rmlvo)
+ if (dev->key || dev->kbdfeed)
return False;
+ if (!rmlvo)
+ {
+ rmlvo = &rmlvo_dflts;
+ XkbGetRulesDflts(rmlvo);
+ }
+
+
memset(&changes, 0, sizeof(changes));
XkbSetCauseUnknown(&cause);
@@ -577,6 +613,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
XkbSetRulesDflts(rmlvo);
XkbSetRulesUsed(rmlvo);
+ XkbFreeRMLVOSet(&rmlvo_dflts, FALSE);
return TRUE;