diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-27 17:30:21 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-27 17:30:21 +0000 |
commit | 8689f7e348671f65e4b8c425ea4674fa33fc2900 (patch) | |
tree | 55e6d0af861c23466263508d6935b05e305c4d9d | |
parent | 06a58f2d5363e13069315beac8934cca1aab54db (diff) | |
parent | 41aea6194bd29ab34cc166b3fd90eee64299ddf8 (diff) |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into glucose-2
Conflicts:
hw/xfree86/Makefile.am
hw/xfree86/dri/dri.c
hw/xfree86/dri/dristruct.h
hw/xgl/glx/xglx.c
hw/xgl/xglscreen.c
render/picture.c
672 files changed, 18288 insertions, 35492 deletions
diff --git a/.gitignore b/.gitignore index 6abca3b1a..406b74c4e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ Makefile.in *.o *~ .*.swp +*.pbxuser +*.mode1v3 obj* build* aclocal.m4 @@ -25,6 +27,8 @@ install-sh libtool ltmain.sh missing +TAGS +tags ylwrap xorg-server.pc stamp-h? @@ -95,8 +99,6 @@ cfb32/cfbzerarcG.c cfb32/cfbzerarcX.c doc/Xserver.1x doc/Xserver.man -doc/SecurityPolicy.5 -doc/SecurityPolicy.man hw/dmx/Xdmx hw/dmx/Xdmx.1x hw/dmx/config/dmxtodmx diff --git a/GL/apple/Makefile.am b/GL/apple/Makefile.am index d3c05ccc7..33ad15714 100644 --- a/GL/apple/Makefile.am +++ b/GL/apple/Makefile.am @@ -4,8 +4,8 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/GL/glx \ -I$(top_srcdir)/GL/include \ -I$(top_srcdir)/GL/mesa/glapi \ - -I$(top_srcdir)/hw/darwin/quartz \ - -I$(top_srcdir)/hw/darwin/quartz/cr \ + -I$(top_srcdir)/hw/xquartz \ + -I$(top_srcdir)/hw/xquartz/xpr \ -I$(top_srcdir)/miext/damage if HAVE_AGL_FRAMEWORK @@ -17,3 +17,8 @@ libAGLcore_a_SOURCES = aglGlx.c \ $(top_srcdir)/hw/darwin/quartz/xpr/x-hash.h \ $(top_srcdir)/hw/dmx/glxProxy/compsize.c endif + +#noinst_LIBRARIES = libCGLcore.a +#libCGLcore_a_SOURCES = \ +# indirect.c \ +# $(top_srcdir)/hw/dmx/glxProxy/compsize.c diff --git a/GL/glx/.gitignore b/GL/glx/.gitignore index 5cf6f0a44..c49b54d43 100644 --- a/GL/glx/.gitignore +++ b/GL/glx/.gitignore @@ -1,5 +1,13 @@ -indirect_size.h +glapi.c glcontextmodes.c glcontextmodes.h -glapi.c glthread.c +indirect_dispatch.c +indirect_dispatch.h +indirect_dispatch_swap.c +indirect_reqsize.c +indirect_reqsize.h +indirect_size.h +indirect_size_get.c +indirect_size_get.h +indirect_table.c diff --git a/GL/glx/Makefile.am b/GL/glx/Makefile.am index 8eda1531e..377d76019 100644 --- a/GL/glx/Makefile.am +++ b/GL/glx/Makefile.am @@ -14,7 +14,8 @@ AM_CFLAGS = \ -I@MESA_SOURCE@/src/mesa/glapi \ -I@MESA_SOURCE@/src/mesa/main \ -DXFree86Server \ - @GLX_DEFINES@ + @GLX_DEFINES@ \ + @GLX_ARCH_DEFINES@ # none yet #sdk_HEADERS = @@ -24,6 +25,7 @@ INCLUDES = \ -I$(top_srcdir)/hw/xfree86/os-support/bus \ -I$(top_srcdir)/hw/xfree86/common \ -I$(top_srcdir)/hw/xfree86/dri \ + -I$(top_srcdir)/hw/xfree86/dri2 \ -I$(top_srcdir)/mi @@ -31,10 +33,19 @@ nodist_libglx_la_SOURCES = indirect_size.h \ glapi.c \ glcontextmodes.c \ glcontextmode.h \ - glthread.c + glthread.c \ + indirect_dispatch.c \ + indirect_dispatch.h \ + indirect_dispatch_swap.c \ + indirect_reqsize.c \ + indirect_reqsize.h \ + indirect_size_get.c \ + indirect_size_get.h \ + indirect_table.c libglxdri_la_SOURCES = \ glxdri.c \ + glxdri2.c \ extension_string.c \ extension_string.h @@ -53,15 +64,7 @@ libglx_la_SOURCES = \ glxserver.h \ glxutil.c \ glxutil.h \ - indirect_dispatch.c \ - indirect_dispatch.h \ - indirect_dispatch_swap.c \ indirect_program.c \ - indirect_reqsize.c \ - indirect_reqsize.h \ - indirect_size_get.c \ - indirect_size_get.h \ - indirect_table.c \ indirect_table.h \ indirect_texture_compression.c \ indirect_util.c \ diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index c0da07b68..f9b28e427 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -47,6 +47,8 @@ #include <xf86.h> #include <dri.h> +#include "servermd.h" + #define DRI_NEW_INTERFACE_ONLY #include "glxserver.h" #include "glxutil.h" @@ -178,11 +180,54 @@ __glXDRIenterServer(GLboolean rendering) DRIWakeupHandler(NULL, 0, NULL); } + +static void +__glXDRIdoReleaseTexImage(__GLXDRIscreen *screen, __GLXDRIdrawable *drawable) +{ + GLuint lastOverride = screen->lastTexOffsetOverride; + + if (lastOverride) { + __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride; + int i; + + for (i = 0; i < lastOverride; i++) { + if (texOffsetOverride[i] == drawable) { + + texOffsetOverride[i] = NULL; + + if (i + 1 == lastOverride) { + lastOverride = 0; + + while (i--) { + if (texOffsetOverride[i]) { + lastOverride = i + 1; + break; + } + } + + screen->lastTexOffsetOverride = lastOverride; + + break; + } + } + } + } +} + + static void __glXDRIdrawableDestroy(__GLXdrawable *drawable) { __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; + int i; + + for (i = 0; i < screenInfo.numScreens; i++) { + __glXDRIdoReleaseTexImage((__GLXDRIscreen *) + glxGetScreen(screenInfo.screens[i]), + private); + } + (*private->driDrawable.destroyDrawable)(&private->driDrawable); /* If the X window was destroyed, the dri DestroyWindow hook will @@ -308,18 +353,20 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext) } static void -glxFillAlphaChannel (PixmapPtr pixmap, int x, int y, int width, int height) +glxFillAlphaChannel (CARD32 *pixels, CARD32 rowstride, int width, int height) { int i; - CARD32 *p, *end, *pixels = (CARD32 *)pixmap->devPrivate.ptr; - CARD32 rowstride = pixmap->devKind / 4; + CARD32 *p, *end; + + rowstride /= 4; - for (i = y; i < y + height; i++) + for (i = 0; i < height; i++) { - p = &pixels[i * rowstride + x]; + p = pixels; end = p + width; while (p < end) *p++ |= 0xFF000000; + pixels += rowstride; } } @@ -430,22 +477,31 @@ nooverride: type = GL_UNSIGNED_SHORT_5_6_5; } - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, - pixmap->devKind / bpp) ); - if (pRegion == NULL) { - if (!override && pixmap->drawable.depth == 24) - glxFillAlphaChannel(pixmap, - pixmap->drawable.x, - pixmap->drawable.y, - pixmap->drawable.width, - pixmap->drawable.height); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, - pixmap->drawable.x) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, - pixmap->drawable.y) ); + void *data = NULL; + + if (!override) { + unsigned pitch = PixmapBytePad(pixmap->drawable.width, + pixmap->drawable.depth); + + data = xalloc(pitch * pixmap->drawable.height); + + pScreen->GetImage(&pixmap->drawable, 0 /*pixmap->drawable.x*/, + 0 /*pixmap->drawable.y*/, pixmap->drawable.width, + pixmap->drawable.height, ZPixmap, ~0, data); + + if (pixmap->drawable.depth == 24) + glxFillAlphaChannel(data, + pitch, + pixmap->drawable.width, + pixmap->drawable.height); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, + pitch / bpp) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) ); + } CALL_TexImage2D( GET_DISPATCH(), (glxPixmap->target, @@ -456,26 +512,37 @@ nooverride: 0, format, type, - override ? NULL : pixmap->devPrivate.ptr) ); + data) ); + + xfree(data); } else if (!override) { int i, numRects; BoxPtr p; numRects = REGION_NUM_RECTS (pRegion); p = REGION_RECTS (pRegion); + + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, 0) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, 0) ); + for (i = 0; i < numRects; i++) { + unsigned pitch = PixmapBytePad(p[i].x2 - p[i].x1, + pixmap->drawable.depth); + void *data = xalloc(pitch * (p[i].y2 - p[i].y1)); + + pScreen->GetImage(&pixmap->drawable, /*pixmap->drawable.x +*/ p[i].x1, + /*pixmap->drawable.y*/ + p[i].y1, p[i].x2 - p[i].x1, + p[i].y2 - p[i].y1, ZPixmap, ~0, data); + if (pixmap->drawable.depth == 24) - glxFillAlphaChannel(pixmap, - pixmap->drawable.x + p[i].x1, - pixmap->drawable.y + p[i].y1, + glxFillAlphaChannel(data, + pitch, p[i].x2 - p[i].x1, p[i].y2 - p[i].y1); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, - pixmap->drawable.x + p[i].x1) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, - pixmap->drawable.y + p[i].y1) ); + CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, + pitch / bpp) ); CALL_TexSubImage2D( GET_DISPATCH(), (glxPixmap->target, @@ -484,7 +551,9 @@ nooverride: p[i].x2 - p[i].x1, p[i].y2 - p[i].y1, format, type, - pixmap->devPrivate.ptr) ); + data) ); + + xfree(data); } } @@ -499,41 +568,9 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext, int buffer, __GLXdrawable *pixmap) { - ScreenPtr pScreen = pixmap->pDraw->pScreen; - __GLXDRIdrawable *driDraw = - containerOf(pixmap, __GLXDRIdrawable, base); - __GLXDRIscreen * const screen = - (__GLXDRIscreen *) glxGetScreen(pScreen); - GLuint lastOverride = screen->lastTexOffsetOverride; - - if (lastOverride) { - __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride; - int i; - - for (i = 0; i < lastOverride; i++) { - if (texOffsetOverride[i] == driDraw) { - if (screen->texOffsetFinish) - screen->texOffsetFinish((PixmapPtr)pixmap->pDraw); - - texOffsetOverride[i] = NULL; - - if (i + 1 == lastOverride) { - lastOverride = 0; - - while (i--) { - if (texOffsetOverride[i]) { - lastOverride = i + 1; - break; - } - } - - screen->lastTexOffsetOverride = lastOverride; - - break; - } - } - } - } + __glXDRIdoReleaseTexImage((__GLXDRIscreen *) + glxGetScreen(pixmap->pDraw->pScreen), + containerOf(pixmap, __GLXDRIdrawable, base)); return Success; } @@ -577,6 +614,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, else driShare = NULL; + if (baseShareContext && baseShareContext->isDirect) + return NULL; + context = xalloc(sizeof *context); if (context == NULL) return NULL; @@ -612,6 +652,14 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen, hwContext, &context->driContext); + if (context->driContext.private == NULL) { + __glXenterServer(GL_FALSE); + retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID); + __glXleaveServer(GL_FALSE); + xfree(context); + return NULL; + } + return &context->base; } @@ -658,6 +706,14 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen, &private->driDrawable, hwDrawable, 0, NULL); + if (private->driDrawable.private == NULL) { + __glXenterServer(GL_FALSE); + DRIDestroyDrawable(screen->pScreen, serverClient, pDraw); + __glXleaveServer(GL_FALSE); + xfree(private); + return NULL; + } + return &private->base; } @@ -761,10 +817,14 @@ static void __glXReportDamage(__DRIdrawable *driDraw, DrawablePtr pDraw = drawable->base.pDraw; RegionRec region; + __glXenterServer(GL_FALSE); + REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects); REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y); DamageDamageRegion(pDraw, ®ion); REGION_UNINIT(pDraw->pScreen, ®ion); + + __glXleaveServer(GL_FALSE); } /* Table of functions that we export to the driver. */ diff --git a/GL/glx/glxdri2.c b/GL/glx/glxdri2.c new file mode 100644 index 000000000..d1c8d417e --- /dev/null +++ b/GL/glx/glxdri2.c @@ -0,0 +1,633 @@ +/* + * Copyright © 2007 Red Hat, Inc + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Red Hat, + * Inc not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL RED HAT, INC BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdint.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <sys/time.h> +#include <dlfcn.h> + +#include <drm.h> +#include <GL/gl.h> +#include <GL/internal/dri_interface.h> + +#include <windowstr.h> +#include <os.h> + +#define _XF86DRI_SERVER_ +#include <xf86drm.h> +#include <xf86dristr.h> +#include <xf86str.h> +#include <xf86.h> +#include <dri2.h> + +#include "glxserver.h" +#include "glxutil.h" +#include "glcontextmodes.h" + +#include "g_disptab.h" +#include "glapitable.h" +#include "glapi.h" +#include "glthread.h" +#include "dispatch.h" +#include "extension_string.h" + +#define containerOf(ptr, type, member) \ + (type *)( (char *)ptr - offsetof(type,member) ) + +typedef struct __GLXDRIscreen __GLXDRIscreen; +typedef struct __GLXDRIcontext __GLXDRIcontext; +typedef struct __GLXDRIdrawable __GLXDRIdrawable; + +struct __GLXDRIscreen { + __GLXscreen base; + __DRIscreen driScreen; + void *driver; + int fd; + + xf86EnterVTProc *enterVT; + xf86LeaveVTProc *leaveVT; + + __DRIcopySubBufferExtension *copySubBuffer; + __DRIswapControlExtension *swapControl; + __DRItexBufferExtension *texBuffer; + + unsigned char glx_enable_bits[__GLX_EXT_BYTES]; +}; + +struct __GLXDRIcontext { + __GLXcontext base; + __DRIcontext driContext; + drm_context_t hwContext; +}; + +struct __GLXDRIdrawable { + __GLXdrawable base; + __DRIdrawable driDrawable; +}; + +static const char CREATE_NEW_SCREEN_FUNC[] = __DRI2_CREATE_NEW_SCREEN_STRING; + +static void +__glXDRIdrawableDestroy(__GLXdrawable *drawable) +{ + __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; + + (*private->driDrawable.destroyDrawable)(&private->driDrawable); + + /* If the X window was destroyed, the dri DestroyWindow hook will + * aready have taken care of this, so only call if pDraw isn't NULL. */ + if (drawable->pDraw != NULL) + DRI2DestroyDrawable(drawable->pDraw->pScreen, drawable->pDraw); + + xfree(private); +} + +static GLboolean +__glXDRIdrawableResize(__GLXdrawable *glxPriv) +{ + /* Nothing to do here, the DRI driver asks the server for drawable + * geometry when it sess the SAREA timestamps change.*/ + + return GL_TRUE; +} + +static GLboolean +__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate) +{ + __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate; + + (*private->driDrawable.swapBuffers)(&private->driDrawable); + + return TRUE; +} + + +static int +__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval) +{ + __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable; + __GLXDRIscreen *screen = (__GLXDRIscreen *) + glxGetScreen(baseDrawable->pDraw->pScreen); + + if (screen->swapControl) + screen->swapControl->setSwapInterval(&draw->driDrawable, interval); + + return 0; +} + + +static void +__glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate, + int x, int y, int w, int h) +{ + __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate; + __GLXDRIscreen *screen = (__GLXDRIscreen *) + glxGetScreen(basePrivate->pDraw->pScreen); + + if (screen->copySubBuffer) + screen->copySubBuffer->copySubBuffer(&private->driDrawable, + x, y, w, h); +} + +static void +__glXDRIcontextDestroy(__GLXcontext *baseContext) +{ + __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + __GLXDRIscreen *screen = (__GLXDRIscreen *) baseContext->pGlxScreen; + + context->driContext.destroyContext(&context->driContext); + drmDestroyContext(screen->fd, context->hwContext); + __glXContextDestroy(&context->base); + xfree(context); +} + +static int +__glXDRIcontextMakeCurrent(__GLXcontext *baseContext) +{ + __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; + __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; + + return (*context->driContext.bindContext)(&context->driContext, + &draw->driDrawable, + &read->driDrawable); +} + +static int +__glXDRIcontextLoseCurrent(__GLXcontext *baseContext) +{ + __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + + return (*context->driContext.unbindContext)(&context->driContext); +} + +static int +__glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, + unsigned long mask) +{ + __GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst; + __GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc; + + /* FIXME: We will need to add DRIcontext::copyContext for this. */ + + (void) dst; + (void) src; + + return FALSE; +} + +static int +__glXDRIcontextForceCurrent(__GLXcontext *baseContext) +{ + __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + __GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv; + __GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv; + + return (*context->driContext.bindContext)(&context->driContext, + &draw->driDrawable, + &read->driDrawable); +} + +#ifdef __DRI_TEX_BUFFER + +#define isPowerOfTwo(n) (((n) & ((n) - 1 )) == 0) + +static int +__glXDRIbindTexImage(__GLXcontext *baseContext, + int buffer, + __GLXdrawable *glxPixmap) +{ + ScreenPtr pScreen = glxPixmap->pDraw->pScreen; + __GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen); + PixmapPtr pixmap; + __GLXDRIcontext *context = (__GLXDRIcontext *) baseContext; + unsigned int flags; + int w, h, target; + + if (screen->texBuffer == NULL) + return Success; + + pixmap = (PixmapPtr) glxPixmap->pDraw; + w = pixmap->drawable.width; + h = pixmap->drawable.height; + + if (!isPowerOfTwo(w) || !isPowerOfTwo(h)) + target = GL_TEXTURE_RECTANGLE_ARB; + else + target = GL_TEXTURE_2D; + + screen->texBuffer->setTexBuffer(&context->driContext, + target, + DRI2GetPixmapHandle(pixmap, &flags), + pixmap->drawable.depth, + pixmap->devKind, + h); + + return Success; +} + +static int +__glXDRIreleaseTexImage(__GLXcontext *baseContext, + int buffer, + __GLXdrawable *pixmap) +{ + /* FIXME: Just unbind the texture? */ + return Success; +} + +#else + +static int +__glXDRIbindTexImage(__GLXcontext *baseContext, + int buffer, + __GLXdrawable *glxPixmap) +{ + return Success; +} + +static int +__glXDRIreleaseTexImage(__GLXcontext *baseContext, + int buffer, + __GLXdrawable *pixmap) +{ + return Success; +} + +#endif + +static __GLXtextureFromPixmap __glXDRItextureFromPixmap = { + __glXDRIbindTexImage, + __glXDRIreleaseTexImage +}; + +static void +__glXDRIscreenDestroy(__GLXscreen *baseScreen) +{ + __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; + + screen->driScreen.destroyScreen(&screen->driScreen); + + dlclose(screen->driver); + + __glXScreenDestroy(baseScreen); + + xfree(screen); +} + +static __GLXcontext * +__glXDRIscreenCreateContext(__GLXscreen *baseScreen, + __GLcontextModes *modes, + __GLXcontext *baseShareContext) +{ + __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; + __GLXDRIcontext *context, *shareContext; + __DRIcontext *driShare; + + shareContext = (__GLXDRIcontext *) baseShareContext; + if (shareContext) + driShare = &shareContext->driContext; + else + driShare = NULL; + + context = xalloc(sizeof *context); + if (context == NULL) + return NULL; + + memset(context, 0, sizeof *context); + context->base.destroy = __glXDRIcontextDestroy; + context->base.makeCurrent = __glXDRIcontextMakeCurrent; + context->base.loseCurrent = __glXDRIcontextLoseCurrent; + context->base.copy = __glXDRIcontextCopy; + context->base.forceCurrent = __glXDRIcontextForceCurrent; + context->base.textureFromPixmap = &__glXDRItextureFromPixmap; + + if (drmCreateContext(screen->fd, &context->hwContext)) + return GL_FALSE; + + context->driContext.private = + screen->driScreen.createNewContext(&screen->driScreen, + modes, + 0, /* render type */ + driShare, + context->hwContext, + &context->driContext); + + return &context->base; +} + +static __GLXdrawable * +__glXDRIscreenCreateDrawable(__GLXscreen *screen, + DrawablePtr pDraw, + int type, + XID drawId, + __GLcontextModes *modes) +{ + __GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen; + __GLXDRIdrawable *private; + GLboolean retval; + drm_drawable_t hwDrawable; + + private = xalloc(sizeof *private); + if (private == NULL) + return NULL; + + memset(private, 0, sizeof *private); + + if (!__glXDrawableInit(&private->base, screen, + pDraw, type, drawId, modes)) { + xfree(private); + return NULL; + } + + private->base.destroy = __glXDRIdrawableDestroy; + private->base.resize = __glXDRIdrawableResize; + private->base.swapBuffers = __glXDRIdrawableSwapBuffers; + private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer; + + retval = DRI2CreateDrawable(screen->pScreen, pDraw, &hwDrawable); + + private->driDrawable.private = + (driScreen->driScreen.createNewDrawable)(&driScreen->driScreen, + modes, + &private->driDrawable, + hwDrawable, 0, NULL); + + return &private->base; +} + +static int +getUST(int64_t *ust) +{ + struct timeval tv; + + if (ust == NULL) + return -EFAULT; + + if (gettimeofday(&tv, NULL) == 0) { + ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec; + return 0; + } else { + return -errno; + } +} + +static void __glXReportDamage(__DRIdrawable *driDraw, + int x, int y, + drm_clip_rect_t *rects, int num_rects, + GLboolean front_buffer) +{ + __GLXDRIdrawable *drawable = + containerOf(driDraw, __GLXDRIdrawable, driDrawable); + DrawablePtr pDraw = drawable->base.pDraw; + RegionRec region; + + REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects); + REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y); + DamageDamageRegion(pDraw, ®ion); + REGION_UNINIT(pDraw->pScreen, ®ion); +} + +/* Table of functions that we export to the driver. */ +static const __DRIinterfaceMethods interface_methods = { + _gl_context_modes_create, + _gl_context_modes_destroy, + + NULL, + + getUST, + NULL, + + __glXReportDamage, +}; + +static const char dri_driver_path[] = DRI_DRIVER_PATH; + +static Bool +glxDRIEnterVT (int index, int flags) +{ + __GLXDRIscreen *screen = (__GLXDRIscreen *) + glxGetScreen(screenInfo.screens[index]); + + LogMessage(X_INFO, "AIGLX: Resuming AIGLX clients after VT switch\n"); + + if (!(*screen->enterVT) (index, flags)) + return FALSE; + + glxResumeClients(); + + return TRUE; +} + +static void +glxDRILeaveVT (int index, int flags) +{ + __GLXDRIscreen *screen = (__GLXDRIscreen *) + glxGetScreen(screenInfo.screens[index]); + + LogMessage(X_INFO, "AIGLX: Suspending AIGLX clients for VT switch\n"); + + glxSuspendClients(); + + return (*screen->leaveVT) (index, flags); +} + +static void +initializeExtensions(__GLXDRIscreen *screen) +{ + const __DRIextension **extensions; + int i; + + extensions = screen->driScreen.getExtensions(&screen->driScreen); + for (i = 0; extensions[i]; i++) { +#ifdef __DRI_COPY_SUB_BUFFER + if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { + screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; + __glXEnableExtension(screen->glx_enable_bits, + "GLX_MESA_copy_sub_buffer"); + + LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n"); + } +#endif + +#ifdef __DRI_SWAP_CONTROL + if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) { + screen->swapControl = (__DRIswapControlExtension *) extensions[i]; + __glXEnableExtension(screen->glx_enable_bits, + "GLX_SGI_swap_control"); + __glXEnableExtension(screen->glx_enable_bits, + "GLX_MESA_swap_control"); + + LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n"); + } +#endif + +#ifdef __DRI_TEX_BUFFER + if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) { + screen->texBuffer = (__DRItexBufferExtension *) extensions[i]; + /* GLX_EXT_texture_from_pixmap is always enabled. */ + LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n"); + } +#endif + /* Ignore unknown extensions */ + } +} + +static __GLXscreen * +__glXDRIscreenProbe(ScreenPtr pScreen) +{ + __DRI2_CREATE_NEW_SCREEN_FUNC *createNewScreen; + __DRIversion ddx_version; + __DRIversion dri_version; + __DRIversion drm_version; + drmVersionPtr version; + const char *driverName; + __GLXDRIscreen *screen; + char filename[128]; + size_t buffer_size; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + unsigned int sareaHandle; + + screen = xalloc(sizeof *screen); + if (screen == NULL) + return NULL; + memset(screen, 0, sizeof *screen); + + if (!xf86LoaderCheckSymbol("DRI2Connect") || + !DRI2Connect(pScreen, + &screen->fd, + &driverName, + &ddx_version.major, + &ddx_version.minor, + &ddx_version.patch, + &sareaHandle)) { + LogMessage(X_INFO, + "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum); + return NULL; + } + + screen->base.destroy = __glXDRIscreenDestroy; + screen->base.createContext = __glXDRIscreenCreateContext; + screen->base.createDrawable = __glXDRIscreenCreateDrawable; + screen->base.swapInterval = __glXDRIdrawableSwapInterval; + screen->base.pScreen = pScreen; + + __glXInitExtensionEnableBits(screen->glx_enable_bits); + + /* DRI protocol version. */ + dri_version.major = XF86DRI_MAJOR_VERSION; + dri_version.minor = XF86DRI_MINOR_VERSION; + dri_version.patch = XF86DRI_PATCH_VERSION; + + version = drmGetVersion(screen->fd); + if (version) { + drm_version.major = version->version_major; + drm_version.minor = version->version_minor; + drm_version.patch = version->version_patchlevel; + drmFreeVersion(version); + } + else { + drm_version.major = -1; + drm_version.minor = -1; + drm_version.patch = -1; + } + + snprintf(filename, sizeof filename, "%s/%s_dri.so", + dri_driver_path, driverName); + + screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL); + if (screen->driver == NULL) { + LogMessage(X_ERROR, "AIGLX error: dlopen of %s failed (%s)\n", + filename, dlerror()); + goto handle_error; + } + + createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC); + if (createNewScreen == NULL) { + LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n", + CREATE_NEW_SCREEN_FUNC, dlerror()); + goto handle_error; + } + + screen->driScreen.private = + (*createNewScreen)(pScreen->myNum, + &screen->driScreen, + &ddx_version, + &dri_version, + &drm_version, + screen->fd, + sareaHandle, + &interface_methods, + &screen->base.fbconfigs); + + if (screen->driScreen.private == NULL) { + LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed"); + goto handle_error; + } + + initializeExtensions(screen); + + __glXScreenInit(&screen->base, pScreen); + + buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL); + if (buffer_size > 0) { + if (screen->base.GLXextensions != NULL) { + xfree(screen->base.GLXextensions); + } + + screen->base.GLXextensions = xnfalloc(buffer_size); + (void) __glXGetExtensionString(screen->glx_enable_bits, + screen->base.GLXextensions); + } + + screen->enterVT = pScrn->EnterVT; + pScrn->EnterVT = glxDRIEnterVT; + screen->leaveVT = pScrn->LeaveVT; + pScrn->LeaveVT = glxDRILeaveVT; + + LogMessage(X_INFO, + "AIGLX: Loaded and initialized %s\n", filename); + + return &screen->base; + + handle_error: + if (screen->driver) + dlclose(screen->driver); + + xfree(screen); + + LogMessage(X_ERROR, "AIGLX: reverting to software rendering\n"); + + return NULL; +} + +__GLXprovider __glXDRI2Provider = { + __glXDRIscreenProbe, + "DRI2", + NULL +}; diff --git a/GL/glx/glxext.c b/GL/glx/glxext.c index f9b872c41..85d8debd4 100644 --- a/GL/glx/glxext.c +++ b/GL/glx/glxext.c @@ -27,6 +27,7 @@ #include "glxserver.h" #include <windowstr.h> #include <propertyst.h> +#include "privates.h" #include <os.h> #include "g_disptab.h" #include "unpack.h" @@ -53,7 +54,7 @@ RESTYPE __glXSwapBarrierRes; */ xGLXSingleReply __glXReply; -static int glxClientPrivateIndex; +static DevPrivateKey glxClientPrivateKey = &glxClientPrivateKey; /* ** Client that called into GLX dispatch. @@ -204,7 +205,7 @@ int __glXError(int error) __GLXclientState * glxGetClient(ClientPtr pClient) { - return (__GLXclientState *) pClient->devPrivates[glxClientPrivateIndex].ptr; + return dixLookupPrivate(&pClient->devPrivates, glxClientPrivateKey); } static void @@ -274,9 +275,7 @@ void GlxExtensionInit(void) __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); __glXSwapBarrierRes = CreateNewResourceType((DeleteType)SwapBarrierGone); - glxClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (glxClientPrivateIndex, - sizeof (__GLXclientState))) + if (!dixRequestPrivate(glxClientPrivateKey, sizeof (__GLXclientState))) return; if (!AddCallback (&ClientStateCallback, glxClientCallback, 0)) return; diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index d6002532d..6575b271d 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -42,12 +42,13 @@ #include <os.h> #include <colormapst.h> +#include "privates.h" #include "glxserver.h" #include "glxutil.h" #include "glxext.h" #include "glcontextmodes.h" -static int glxScreenPrivateIndex; +static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKey; const char GLServerVersion[] = "1.4"; static const char GLServerExtensions[] = @@ -174,7 +175,7 @@ static char GLXServerExtensions[] = "GLX_EXT_texture_from_pixmap " "GLX_OML_swap_method " "GLX_SGI_make_current_read " -#ifndef __DARWIN__ +#ifndef __APPLE__ "GLX_SGIS_multisample " "GLX_SGIX_hyperpipe " "GLX_SGIX_swap_barrier " @@ -269,7 +270,7 @@ glxCloseScreen (int index, ScreenPtr pScreen) __GLXscreen * glxGetScreen(ScreenPtr pScreen) { - return (__GLXscreen *) pScreen->devPrivates[glxScreenPrivateIndex].ptr; + return dixLookupPrivate(&pScreen->devPrivates, glxScreenPrivateKey); } void GlxSetVisualConfigs(int nconfigs, @@ -279,6 +280,30 @@ void GlxSetVisualConfigs(int nconfigs, * call it. */ } +static void +filterOutNativeConfigs(__GLXscreen *pGlxScreen) +{ + __GLcontextModes *m, *next, *native_modes, **last; + ScreenPtr pScreen = pGlxScreen->pScreen; + int i, depth; + + last = &pGlxScreen->fbconfigs; + for (m = pGlxScreen->fbconfigs; m != NULL; m = next) { + next = m->next; + depth = m->redBits + m->blueBits + m->greenBits; + + for (i = 0; i < pScreen->numVisuals; i++) { + if (pScreen->visuals[i].nplanes == depth) { + *last = m; + last = &m->next; + break; + } + } + } + + *last = NULL; +} + static XID findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m) { @@ -497,19 +522,9 @@ void GlxSetVisualConfig(int config) void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) { - static int glxGeneration; __GLcontextModes *m; int i; - if (glxGeneration != serverGeneration) - { - glxScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (glxScreenPrivateIndex == -1) - return; - - glxGeneration = serverGeneration; - } - pGlxScreen->pScreen = pScreen; pGlxScreen->GLextensions = xstrdup(GLServerExtensions); pGlxScreen->GLXvendor = xstrdup(GLXServerVendorName); @@ -522,6 +537,8 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) pGlxScreen->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = glxCloseScreen; + filterOutNativeConfigs(pGlxScreen); + i = 0; for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) { m->fbconfigID = FakeClientID(0); @@ -548,9 +565,9 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) break; } - pScreen->devPrivates[glxScreenPrivateIndex].ptr = (pointer) pGlxScreen; + dixSetPrivate(&pScreen->devPrivates, glxScreenPrivateKey, pGlxScreen); } - + void __glXScreenDestroy(__GLXscreen *screen) { xfree(screen->GLXvendor); diff --git a/GL/glx/indirect_dispatch.c b/GL/glx/indirect_dispatch.c deleted file mode 100644 index 2afd3eb22..000000000 --- a/GL/glx/indirect_dispatch.c +++ /dev/null @@ -1,5889 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2005 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - -#include <X11/Xmd.h> -#include <GL/gl.h> -#include <GL/glxproto.h> -#include <inttypes.h> -#include "indirect_size.h" -#include "indirect_size_get.h" -#include "indirect_dispatch.h" -#include "glxserver.h" -#include "glxbyteorder.h" -#include "indirect_util.h" -#include "singlesize.h" -#include "glapitable.h" -#include "glapi.h" -#include "glthread.h" -#include "dispatch.h" - -#define __GLX_PAD(x) (((x) + 3) & ~3) - -typedef struct { - __GLX_PIXEL_3D_HDR; -} __GLXpixel3DHeader; - -extern GLboolean __glXErrorOccured( void ); -extern void __glXClearErrorOccured( void ); - -static const unsigned dummy_answer[2] = {0, 0}; - -int __glXDisp_NewList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_NewList( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_EndList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_EndList( GET_DISPATCH(), () ); - error = Success; - } - - return error; -} - -void __glXDisp_CallList(GLbyte * pc) -{ - CALL_CallList( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_CallLists(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - const GLenum type = *(GLenum *)(pc + 4); - const GLvoid * lists = (const GLvoid *)(pc + 8); - - lists = (const GLvoid *) (pc + 8); - - CALL_CallLists( GET_DISPATCH(), ( - n, - type, - lists - ) ); -} - -int __glXDisp_DeleteLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_DeleteLists( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - *(GLsizei *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_GenLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLuint retval; - retval = CALL_GenLists( GET_DISPATCH(), ( - *(GLsizei *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_ListBase(GLbyte * pc) -{ - CALL_ListBase( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Begin(GLbyte * pc) -{ - CALL_Begin( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Bitmap(GLbyte * pc) -{ - const GLubyte * const bitmap = (const GLubyte *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_Bitmap( GET_DISPATCH(), ( - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLfloat *)(pc + 28), - *(GLfloat *)(pc + 32), - *(GLfloat *)(pc + 36), - *(GLfloat *)(pc + 40), - bitmap - ) ); -} - -void __glXDisp_Color3bv(GLbyte * pc) -{ - CALL_Color3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Color3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Color3fv(GLbyte * pc) -{ - CALL_Color3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Color3iv(GLbyte * pc) -{ - CALL_Color3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Color3sv(GLbyte * pc) -{ - CALL_Color3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Color3ubv(GLbyte * pc) -{ - CALL_Color3ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color3uiv(GLbyte * pc) -{ - CALL_Color3uiv( GET_DISPATCH(), ( - (const GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Color3usv(GLbyte * pc) -{ - CALL_Color3usv( GET_DISPATCH(), ( - (const GLushort *)(pc + 0) - ) ); -} - -void __glXDisp_Color4bv(GLbyte * pc) -{ - CALL_Color4bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Color4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Color4fv(GLbyte * pc) -{ - CALL_Color4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Color4iv(GLbyte * pc) -{ - CALL_Color4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Color4sv(GLbyte * pc) -{ - CALL_Color4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Color4ubv(GLbyte * pc) -{ - CALL_Color4ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_Color4uiv(GLbyte * pc) -{ - CALL_Color4uiv( GET_DISPATCH(), ( - (const GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Color4usv(GLbyte * pc) -{ - CALL_Color4usv( GET_DISPATCH(), ( - (const GLushort *)(pc + 0) - ) ); -} - -void __glXDisp_EdgeFlagv(GLbyte * pc) -{ - CALL_EdgeFlagv( GET_DISPATCH(), ( - (const GLboolean *)(pc + 0) - ) ); -} - -void __glXDisp_End(GLbyte * pc) -{ - CALL_End( GET_DISPATCH(), () ); -} - -void __glXDisp_Indexdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_Indexdv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Indexfv(GLbyte * pc) -{ - CALL_Indexfv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Indexiv(GLbyte * pc) -{ - CALL_Indexiv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Indexsv(GLbyte * pc) -{ - CALL_Indexsv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3bv(GLbyte * pc) -{ - CALL_Normal3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Normal3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3fv(GLbyte * pc) -{ - CALL_Normal3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3iv(GLbyte * pc) -{ - CALL_Normal3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Normal3sv(GLbyte * pc) -{ - CALL_Normal3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_RasterPos2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2fv(GLbyte * pc) -{ - CALL_RasterPos2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2iv(GLbyte * pc) -{ - CALL_RasterPos2iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos2sv(GLbyte * pc) -{ - CALL_RasterPos2sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_RasterPos3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3fv(GLbyte * pc) -{ - CALL_RasterPos3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3iv(GLbyte * pc) -{ - CALL_RasterPos3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos3sv(GLbyte * pc) -{ - CALL_RasterPos3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_RasterPos4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4fv(GLbyte * pc) -{ - CALL_RasterPos4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4iv(GLbyte * pc) -{ - CALL_RasterPos4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_RasterPos4sv(GLbyte * pc) -{ - CALL_RasterPos4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Rectdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rectdv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0), - (const GLdouble *)(pc + 16) - ) ); -} - -void __glXDisp_Rectfv(GLbyte * pc) -{ - CALL_Rectfv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Rectiv(GLbyte * pc) -{ - CALL_Rectiv( GET_DISPATCH(), ( - (const GLint *)(pc + 0), - (const GLint *)(pc + 8) - ) ); -} - -void __glXDisp_Rectsv(GLbyte * pc) -{ - CALL_Rectsv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_TexCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_TexCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord1fv(GLbyte * pc) -{ - CALL_TexCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord1iv(GLbyte * pc) -{ - CALL_TexCoord1iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord1sv(GLbyte * pc) -{ - CALL_TexCoord1sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2fv(GLbyte * pc) -{ - CALL_TexCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2iv(GLbyte * pc) -{ - CALL_TexCoord2iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord2sv(GLbyte * pc) -{ - CALL_TexCoord2sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_TexCoord3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3fv(GLbyte * pc) -{ - CALL_TexCoord3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3iv(GLbyte * pc) -{ - CALL_TexCoord3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord3sv(GLbyte * pc) -{ - CALL_TexCoord3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_TexCoord4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4fv(GLbyte * pc) -{ - CALL_TexCoord4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4iv(GLbyte * pc) -{ - CALL_TexCoord4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_TexCoord4sv(GLbyte * pc) -{ - CALL_TexCoord4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_Vertex2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2fv(GLbyte * pc) -{ - CALL_Vertex2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2iv(GLbyte * pc) -{ - CALL_Vertex2iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex2sv(GLbyte * pc) -{ - CALL_Vertex2sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Vertex3dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3fv(GLbyte * pc) -{ - CALL_Vertex3fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3iv(GLbyte * pc) -{ - CALL_Vertex3iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex3sv(GLbyte * pc) -{ - CALL_Vertex3sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Vertex4dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4fv(GLbyte * pc) -{ - CALL_Vertex4fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4iv(GLbyte * pc) -{ - CALL_Vertex4iv( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_Vertex4sv(GLbyte * pc) -{ - CALL_Vertex4sv( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_ClipPlane(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_ClipPlane( GET_DISPATCH(), ( - *(GLenum *)(pc + 32), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_ColorMaterial(GLbyte * pc) -{ - CALL_ColorMaterial( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_CullFace(GLbyte * pc) -{ - CALL_CullFace( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Fogf(GLbyte * pc) -{ - CALL_Fogf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_Fogfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLfloat * params; - - params = (const GLfloat *) (pc + 4); - - CALL_Fogfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_Fogi(GLbyte * pc) -{ - CALL_Fogi( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_Fogiv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLint * params; - - params = (const GLint *) (pc + 4); - - CALL_Fogiv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_FrontFace(GLbyte * pc) -{ - CALL_FrontFace( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Hint(GLbyte * pc) -{ - CALL_Hint( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_Lightf(GLbyte * pc) -{ - CALL_Lightf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Lightfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_Lightfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_Lighti(GLbyte * pc) -{ - CALL_Lighti( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_Lightiv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_Lightiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_LightModelf(GLbyte * pc) -{ - CALL_LightModelf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_LightModelfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLfloat * params; - - params = (const GLfloat *) (pc + 4); - - CALL_LightModelfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_LightModeli(GLbyte * pc) -{ - CALL_LightModeli( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_LightModeliv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLint * params; - - params = (const GLint *) (pc + 4); - - CALL_LightModeliv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_LineStipple(GLbyte * pc) -{ - CALL_LineStipple( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLushort *)(pc + 4) - ) ); -} - -void __glXDisp_LineWidth(GLbyte * pc) -{ - CALL_LineWidth( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_Materialf(GLbyte * pc) -{ - CALL_Materialf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Materialfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_Materialfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_Materiali(GLbyte * pc) -{ - CALL_Materiali( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_Materialiv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_Materialiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_PointSize(GLbyte * pc) -{ - CALL_PointSize( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_PolygonMode(GLbyte * pc) -{ - CALL_PolygonMode( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_PolygonStipple(GLbyte * pc) -{ - const GLubyte * const mask = (const GLubyte *) (pc + 20); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_PolygonStipple( GET_DISPATCH(), ( - mask - ) ); -} - -void __glXDisp_Scissor(GLbyte * pc) -{ - CALL_Scissor( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12) - ) ); -} - -void __glXDisp_ShadeModel(GLbyte * pc) -{ - CALL_ShadeModel( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_TexParameterf(GLbyte * pc) -{ - CALL_TexParameterf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_TexParameterfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_TexParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexParameteri(GLbyte * pc) -{ - CALL_TexParameteri( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_TexParameteriv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_TexParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexImage1D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLsizei *)(pc + 32), - *(GLint *)(pc + 40), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_TexImage2D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLsizei *)(pc + 32), - *(GLsizei *)(pc + 36), - *(GLint *)(pc + 40), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_TexEnvf(GLbyte * pc) -{ - CALL_TexEnvf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_TexEnvfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_TexEnvfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexEnvi(GLbyte * pc) -{ - CALL_TexEnvi( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_TexEnviv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_TexEnviv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexGend(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexGend( GET_DISPATCH(), ( - *(GLenum *)(pc + 8), - *(GLenum *)(pc + 12), - *(GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_TexGendv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLdouble * params; - -#ifdef __GLX_ALIGN64 - const GLuint compsize = __glTexGendv_size(pname); - const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - params = (const GLdouble *) (pc + 8); - - CALL_TexGendv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexGenf(GLbyte * pc) -{ - CALL_TexGenf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_TexGenfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_TexGenfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_TexGeni(GLbyte * pc) -{ - CALL_TexGeni( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_TexGeniv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_TexGeniv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_InitNames(GLbyte * pc) -{ - CALL_InitNames( GET_DISPATCH(), () ); -} - -void __glXDisp_LoadName(GLbyte * pc) -{ - CALL_LoadName( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_PassThrough(GLbyte * pc) -{ - CALL_PassThrough( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_PopName(GLbyte * pc) -{ - CALL_PopName( GET_DISPATCH(), () ); -} - -void __glXDisp_PushName(GLbyte * pc) -{ - CALL_PushName( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_DrawBuffer(GLbyte * pc) -{ - CALL_DrawBuffer( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Clear(GLbyte * pc) -{ - CALL_Clear( GET_DISPATCH(), ( - *(GLbitfield *)(pc + 0) - ) ); -} - -void __glXDisp_ClearAccum(GLbyte * pc) -{ - CALL_ClearAccum( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8), - *(GLfloat *)(pc + 12) - ) ); -} - -void __glXDisp_ClearIndex(GLbyte * pc) -{ - CALL_ClearIndex( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_ClearColor(GLbyte * pc) -{ - CALL_ClearColor( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLclampf *)(pc + 4), - *(GLclampf *)(pc + 8), - *(GLclampf *)(pc + 12) - ) ); -} - -void __glXDisp_ClearStencil(GLbyte * pc) -{ - CALL_ClearStencil( GET_DISPATCH(), ( - *(GLint *)(pc + 0) - ) ); -} - -void __glXDisp_ClearDepth(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_ClearDepth( GET_DISPATCH(), ( - *(GLclampd *)(pc + 0) - ) ); -} - -void __glXDisp_StencilMask(GLbyte * pc) -{ - CALL_StencilMask( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_ColorMask(GLbyte * pc) -{ - CALL_ColorMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0), - *(GLboolean *)(pc + 1), - *(GLboolean *)(pc + 2), - *(GLboolean *)(pc + 3) - ) ); -} - -void __glXDisp_DepthMask(GLbyte * pc) -{ - CALL_DepthMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0) - ) ); -} - -void __glXDisp_IndexMask(GLbyte * pc) -{ - CALL_IndexMask( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_Accum(GLbyte * pc) -{ - CALL_Accum( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_Disable(GLbyte * pc) -{ - CALL_Disable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_Enable(GLbyte * pc) -{ - CALL_Enable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_PopAttrib(GLbyte * pc) -{ - CALL_PopAttrib( GET_DISPATCH(), () ); -} - -void __glXDisp_PushAttrib(GLbyte * pc) -{ - CALL_PushAttrib( GET_DISPATCH(), ( - *(GLbitfield *)(pc + 0) - ) ); -} - -void __glXDisp_MapGrid1d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MapGrid1d( GET_DISPATCH(), ( - *(GLint *)(pc + 16), - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_MapGrid1f(GLbyte * pc) -{ - CALL_MapGrid1f( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_MapGrid2d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_MapGrid2d( GET_DISPATCH(), ( - *(GLint *)(pc + 32), - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLint *)(pc + 36), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24) - ) ); -} - -void __glXDisp_MapGrid2f(GLbyte * pc) -{ - CALL_MapGrid2f( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8), - *(GLint *)(pc + 12), - *(GLfloat *)(pc + 16), - *(GLfloat *)(pc + 20) - ) ); -} - -void __glXDisp_EvalCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_EvalCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_EvalCoord1fv(GLbyte * pc) -{ - CALL_EvalCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_EvalCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_EvalCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_EvalCoord2fv(GLbyte * pc) -{ - CALL_EvalCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_EvalMesh1(GLbyte * pc) -{ - CALL_EvalMesh1( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_EvalPoint1(GLbyte * pc) -{ - CALL_EvalPoint1( GET_DISPATCH(), ( - *(GLint *)(pc + 0) - ) ); -} - -void __glXDisp_EvalMesh2(GLbyte * pc) -{ - CALL_EvalMesh2( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16) - ) ); -} - -void __glXDisp_EvalPoint2(GLbyte * pc) -{ - CALL_EvalPoint2( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_AlphaFunc(GLbyte * pc) -{ - CALL_AlphaFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLclampf *)(pc + 4) - ) ); -} - -void __glXDisp_BlendFunc(GLbyte * pc) -{ - CALL_BlendFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_LogicOp(GLbyte * pc) -{ - CALL_LogicOp( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_StencilFunc(GLbyte * pc) -{ - CALL_StencilFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLuint *)(pc + 8) - ) ); -} - -void __glXDisp_StencilOp(GLbyte * pc) -{ - CALL_StencilOp( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8) - ) ); -} - -void __glXDisp_DepthFunc(GLbyte * pc) -{ - CALL_DepthFunc( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_PixelZoom(GLbyte * pc) -{ - CALL_PixelZoom( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_PixelTransferf(GLbyte * pc) -{ - CALL_PixelTransferf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_PixelTransferi(GLbyte * pc) -{ - CALL_PixelTransferi( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -int __glXDisp_PixelStoref(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStoref( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_PixelStorei(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStorei( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -void __glXDisp_PixelMapfv(GLbyte * pc) -{ - const GLsizei mapsize = *(GLsizei *)(pc + 4); - - CALL_PixelMapfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - mapsize, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_PixelMapuiv(GLbyte * pc) -{ - const GLsizei mapsize = *(GLsizei *)(pc + 4); - - CALL_PixelMapuiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - mapsize, - (const GLuint *)(pc + 8) - ) ); -} - -void __glXDisp_PixelMapusv(GLbyte * pc) -{ - const GLsizei mapsize = *(GLsizei *)(pc + 4); - - CALL_PixelMapusv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - mapsize, - (const GLushort *)(pc + 8) - ) ); -} - -void __glXDisp_ReadBuffer(GLbyte * pc) -{ - CALL_ReadBuffer( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_CopyPixels(GLbyte * pc) -{ - CALL_CopyPixels( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLenum *)(pc + 16) - ) ); -} - -void __glXDisp_DrawPixels(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 36); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_DrawPixels( GET_DISPATCH(), ( - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLenum *)(pc + 28), - *(GLenum *)(pc + 32), - pixels - ) ); -} - -int __glXDisp_GetBooleanv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetBooleanv_size(pname); - GLboolean answerBuffer[200]; - GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetBooleanv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 1, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetClipPlane(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLdouble equation[4]; - CALL_GetClipPlane( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - equation - ) ); - __glXSendReply(cl->client, equation, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetDoublev(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetDoublev_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetDoublev( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetError(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_GetError( GET_DISPATCH(), () ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_GetFloatv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetFloatv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetFloatv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetIntegerv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetIntegerv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetIntegerv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetLightfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetLightfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetLightiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetLightiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMapdv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = *(GLenum *)(pc + 0); - const GLenum query = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMapdv_size(target,query); - GLdouble answerBuffer[200]; - GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapdv( GET_DISPATCH(), ( - target, - query, - v - ) ); - __glXSendReply(cl->client, v, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = *(GLenum *)(pc + 0); - const GLenum query = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMapfv_size(target,query); - GLfloat answerBuffer[200]; - GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapfv( GET_DISPATCH(), ( - target, - query, - v - ) ); - __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMapiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = *(GLenum *)(pc + 0); - const GLenum query = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMapiv_size(target,query); - GLint answerBuffer[200]; - GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapiv( GET_DISPATCH(), ( - target, - query, - v - ) ); - __glXSendReply(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMaterialfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMaterialiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialiv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetPixelMapfv_size(map); - GLfloat answerBuffer[200]; - GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapfv( GET_DISPATCH(), ( - map, - values - ) ); - __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetPixelMapuiv_size(map); - GLuint answerBuffer[200]; - GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapuiv( GET_DISPATCH(), ( - map, - values - ) ); - __glXSendReply(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = *(GLenum *)(pc + 0); - - const GLuint compsize = __glGetPixelMapusv_size(map); - GLushort answerBuffer[200]; - GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapusv( GET_DISPATCH(), ( - map, - values - ) ); - __glXSendReply(cl->client, values, compsize, 2, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexEnvfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnvfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexEnviv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnviv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexGendv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexGendv_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGendv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexGenfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGenfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexGeniv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGeniv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetTexParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 8); - - const GLuint compsize = __glGetTexLevelParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 8); - - const GLuint compsize = __glGetTexLevelParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsEnabled(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsEnabled( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_IsList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsList( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_DepthRange(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_DepthRange( GET_DISPATCH(), ( - *(GLclampd *)(pc + 0), - *(GLclampd *)(pc + 8) - ) ); -} - -void __glXDisp_Frustum(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Frustum( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24), - *(GLdouble *)(pc + 32), - *(GLdouble *)(pc + 40) - ) ); -} - -void __glXDisp_LoadIdentity(GLbyte * pc) -{ - CALL_LoadIdentity( GET_DISPATCH(), () ); -} - -void __glXDisp_LoadMatrixf(GLbyte * pc) -{ - CALL_LoadMatrixf( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_LoadMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_LoadMatrixd( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MatrixMode(GLbyte * pc) -{ - CALL_MatrixMode( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_MultMatrixf(GLbyte * pc) -{ - CALL_MultMatrixf( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_MultMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_MultMatrixd( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_Ortho(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Ortho( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24), - *(GLdouble *)(pc + 32), - *(GLdouble *)(pc + 40) - ) ); -} - -void __glXDisp_PopMatrix(GLbyte * pc) -{ - CALL_PopMatrix( GET_DISPATCH(), () ); -} - -void __glXDisp_PushMatrix(GLbyte * pc) -{ - CALL_PushMatrix( GET_DISPATCH(), () ); -} - -void __glXDisp_Rotated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rotated( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16), - *(GLdouble *)(pc + 24) - ) ); -} - -void __glXDisp_Rotatef(GLbyte * pc) -{ - CALL_Rotatef( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8), - *(GLfloat *)(pc + 12) - ) ); -} - -void __glXDisp_Scaled(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Scaled( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16) - ) ); -} - -void __glXDisp_Scalef(GLbyte * pc) -{ - CALL_Scalef( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Translated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Translated( GET_DISPATCH(), ( - *(GLdouble *)(pc + 0), - *(GLdouble *)(pc + 8), - *(GLdouble *)(pc + 16) - ) ); -} - -void __glXDisp_Translatef(GLbyte * pc) -{ - CALL_Translatef( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_Viewport(GLbyte * pc) -{ - CALL_Viewport( GET_DISPATCH(), ( - *(GLint *)(pc + 0), - *(GLint *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12) - ) ); -} - -void __glXDisp_BindTexture(GLbyte * pc) -{ - CALL_BindTexture( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_Indexubv(GLbyte * pc) -{ - CALL_Indexubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_PolygonOffset(GLbyte * pc) -{ - CALL_PolygonOffset( GET_DISPATCH(), ( - *(GLfloat *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - residences - ) ); - __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - residences - ) ); - __glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_CopyTexImage1D(GLbyte * pc) -{ - CALL_CopyTexImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLint *)(pc + 24) - ) ); -} - -void __glXDisp_CopyTexImage2D(GLbyte * pc) -{ - CALL_CopyTexImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLint *)(pc + 28) - ) ); -} - -void __glXDisp_CopyTexSubImage1D(GLbyte * pc) -{ - CALL_CopyTexSubImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20) - ) ); -} - -void __glXDisp_CopyTexSubImage2D(GLbyte * pc) -{ - CALL_CopyTexSubImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLint *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLsizei *)(pc + 28) - ) ); -} - -int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - __glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_PrioritizeTextures(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_PrioritizeTextures( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - (const GLclampf *)(pc + 4) - ) ); -} - -void __glXDisp_TexSubImage1D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexSubImage1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLsizei *)(pc + 36), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_TexSubImage2D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexSubImage2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLint *)(pc + 24), - *(GLint *)(pc + 28), - *(GLint *)(pc + 32), - *(GLsizei *)(pc + 36), - *(GLsizei *)(pc + 40), - *(GLenum *)(pc + 44), - *(GLenum *)(pc + 48), - pixels - ) ); -} - -void __glXDisp_BlendColor(GLbyte * pc) -{ - CALL_BlendColor( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLclampf *)(pc + 4), - *(GLclampf *)(pc + 8), - *(GLclampf *)(pc + 12) - ) ); -} - -void __glXDisp_BlendEquation(GLbyte * pc) -{ - CALL_BlendEquation( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_ColorTable(GLbyte * pc) -{ - const GLvoid * const table = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ColorTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLenum *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 32), - *(GLenum *)(pc + 36), - table - ) ); -} - -void __glXDisp_ColorTableParameterfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_ColorTableParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_ColorTableParameteriv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_ColorTableParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_CopyColorTable(GLbyte * pc) -{ - CALL_CopyColorTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16) - ) ); -} - -int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_ColorSubTable(GLbyte * pc) -{ - const GLvoid * const data = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ColorSubTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 32), - *(GLenum *)(pc + 36), - data - ) ); -} - -void __glXDisp_CopyColorSubTable(GLbyte * pc) -{ - CALL_CopyColorSubTable( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLsizei *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16) - ) ); -} - -void __glXDisp_ConvolutionFilter1D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ConvolutionFilter1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLenum *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 36), - *(GLenum *)(pc + 40), - image - ) ); -} - -void __glXDisp_ConvolutionFilter2D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_ConvolutionFilter2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 20), - *(GLenum *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLsizei *)(pc + 32), - *(GLenum *)(pc + 36), - *(GLenum *)(pc + 40), - image - ) ); -} - -void __glXDisp_ConvolutionParameterf(GLbyte * pc) -{ - CALL_ConvolutionParameterf( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_ConvolutionParameterfv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLfloat * params; - - params = (const GLfloat *) (pc + 8); - - CALL_ConvolutionParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_ConvolutionParameteri(GLbyte * pc) -{ - CALL_ConvolutionParameteri( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8) - ) ); -} - -void __glXDisp_ConvolutionParameteriv(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 4); - const GLint * params; - - params = (const GLint *) (pc + 8); - - CALL_ConvolutionParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); -} - -void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter1D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16) - ) ); -} - -void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter2D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLsizei *)(pc + 20) - ) ); -} - -int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_Histogram(GLbyte * pc) -{ - CALL_Histogram( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLsizei *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLboolean *)(pc + 12) - ) ); -} - -void __glXDisp_Minmax(GLbyte * pc) -{ - CALL_Minmax( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLboolean *)(pc + 8) - ) ); -} - -void __glXDisp_ResetHistogram(GLbyte * pc) -{ - CALL_ResetHistogram( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_ResetMinmax(GLbyte * pc) -{ - CALL_ResetMinmax( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_TexImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexImage3D( GET_DISPATCH(), ( - *(GLenum *)(pc + 36), - *(GLint *)(pc + 40), - *(GLint *)(pc + 44), - *(GLsizei *)(pc + 48), - *(GLsizei *)(pc + 52), - *(GLsizei *)(pc + 56), - *(GLint *)(pc + 64), - *(GLenum *)(pc + 68), - *(GLenum *)(pc + 72), - pixels - ) ); -} - -void __glXDisp_TexSubImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 84); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 88); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) hdr->rowLength) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) hdr->imageHeight) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) hdr->skipRows) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) hdr->skipImages) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) hdr->skipPixels) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) hdr->alignment) ); - - CALL_TexSubImage3D( GET_DISPATCH(), ( - *(GLenum *)(pc + 36), - *(GLint *)(pc + 40), - *(GLint *)(pc + 44), - *(GLint *)(pc + 48), - *(GLint *)(pc + 52), - *(GLsizei *)(pc + 60), - *(GLsizei *)(pc + 64), - *(GLsizei *)(pc + 68), - *(GLenum *)(pc + 76), - *(GLenum *)(pc + 80), - pixels - ) ); -} - -void __glXDisp_CopyTexSubImage3D(GLbyte * pc) -{ - CALL_CopyTexSubImage3D( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLint *)(pc + 20), - *(GLint *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLsizei *)(pc + 32) - ) ); -} - -void __glXDisp_ActiveTextureARB(GLbyte * pc) -{ - CALL_ActiveTextureARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_MultiTexCoord1dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 8), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord1fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord1ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord1svARB(GLbyte * pc) -{ - CALL_MultiTexCoord1svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MultiTexCoord2dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 16), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord2fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord2ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord2svARB(GLbyte * pc) -{ - CALL_MultiTexCoord2svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_MultiTexCoord3dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 24), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord3fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord3ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord3svARB(GLbyte * pc) -{ - CALL_MultiTexCoord3svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_MultiTexCoord4dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 32), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord4fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord4ivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_MultiTexCoord4svARB(GLbyte * pc) -{ - CALL_MultiTexCoord4svARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_SampleCoverageARB(GLbyte * pc) -{ - CALL_SampleCoverageARB( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDisp_CompressedTexImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 20); - - CALL_CompressedTexImage1DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLint *)(pc + 16), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDisp_CompressedTexImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 24); - - CALL_CompressedTexImage2DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLint *)(pc + 20), - imageSize, - (const GLvoid *)(pc + 28) - ) ); -} - -void __glXDisp_CompressedTexImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 28); - - CALL_CompressedTexImage3DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLint *)(pc + 24), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 20); - - CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLsizei *)(pc + 12), - *(GLenum *)(pc + 16), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 28); - - CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLsizei *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLenum *)(pc + 24), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = *(GLsizei *)(pc + 36); - - CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4), - *(GLint *)(pc + 8), - *(GLint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLsizei *)(pc + 20), - *(GLsizei *)(pc + 24), - *(GLsizei *)(pc + 28), - *(GLenum *)(pc + 32), - imageSize, - (const GLvoid *)(pc + 40) - ) ); -} - -int __glXDisp_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetProgramivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribdvARB_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribfvARB_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_ProgramStringARB(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 8); - - CALL_ProgramStringARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - len, - (const GLvoid *)(pc + 12) - ) ); -} - -void __glXDisp_VertexAttrib1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1fvARB(GLbyte * pc) -{ - CALL_VertexAttrib1fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1svARB(GLbyte * pc) -{ - CALL_VertexAttrib1svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2fvARB(GLbyte * pc) -{ - CALL_VertexAttrib2fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2svARB(GLbyte * pc) -{ - CALL_VertexAttrib2svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3fvARB(GLbyte * pc) -{ - CALL_VertexAttrib3fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3svARB(GLbyte * pc) -{ - CALL_VertexAttrib3svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NbvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NsvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NubvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NuivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NusvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLushort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4bvARB(GLbyte * pc) -{ - CALL_VertexAttrib4bvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4fvARB(GLbyte * pc) -{ - CALL_VertexAttrib4fvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4ivARB(GLbyte * pc) -{ - CALL_VertexAttrib4ivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4svARB(GLbyte * pc) -{ - CALL_VertexAttrib4svARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4ubvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4uivARB(GLbyte * pc) -{ - CALL_VertexAttrib4uivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4usvARB(GLbyte * pc) -{ - CALL_VertexAttrib4usvARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLushort *)(pc + 4) - ) ); -} - -void __glXDisp_BeginQueryARB(GLbyte * pc) -{ - CALL_BeginQueryARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -int __glXDisp_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteQueriesARB( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -void __glXDisp_EndQueryARB(GLbyte * pc) -{ - CALL_EndQueryARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -int __glXDisp_GenQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenQueriesARB( GET_DISPATCH(), ( - n, - ids - ) ); - __glXSendReply(cl->client, ids, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetQueryObjectivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetQueryObjectuivARB_size(pname); - GLuint answerBuffer[200]; - GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectuivARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetQueryivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetQueryivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryivARB( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsQueryARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsQueryARB( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_DrawBuffersARB(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DrawBuffersARB( GET_DISPATCH(), ( - n, - (const GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_SampleMaskSGIS(GLbyte * pc) -{ - CALL_SampleMaskSGIS( GET_DISPATCH(), ( - *(GLclampf *)(pc + 0), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDisp_SamplePatternSGIS(GLbyte * pc) -{ - CALL_SamplePatternSGIS( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -void __glXDisp_PointParameterfEXT(GLbyte * pc) -{ - CALL_PointParameterfEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_PointParameterfvEXT(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLfloat * params; - - params = (const GLfloat *) (pc + 4); - - CALL_PointParameterfvEXT( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3bvEXT( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_SecondaryColor3dvEXT( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3fvEXT( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ivEXT( GET_DISPATCH(), ( - (const GLint *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3svEXT(GLbyte * pc) -{ - CALL_SecondaryColor3svEXT( GET_DISPATCH(), ( - (const GLshort *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3uivEXT( GET_DISPATCH(), ( - (const GLuint *)(pc + 0) - ) ); -} - -void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3usvEXT( GET_DISPATCH(), ( - (const GLushort *)(pc + 0) - ) ); -} - -void __glXDisp_FogCoorddvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_FogCoorddvEXT( GET_DISPATCH(), ( - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_FogCoordfvEXT(GLbyte * pc) -{ - CALL_FogCoordfvEXT( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc) -{ - CALL_BlendFuncSeparateEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLenum *)(pc + 12) - ) ); -} - -void __glXDisp_WindowPos3fvMESA(GLbyte * pc) -{ - CALL_WindowPos3fvMESA( GET_DISPATCH(), ( - (const GLfloat *)(pc + 0) - ) ); -} - -int __glXDisp_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4), - residences - ) ); - __glXSendReply(cl->client, residences, n, 1, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_BindProgramNV(GLbyte * pc) -{ - CALL_BindProgramNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -int __glXDisp_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); - error = Success; - } - - return error; -} - -void __glXDisp_ExecuteProgramNV(GLbyte * pc) -{ - CALL_ExecuteProgramNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - (const GLfloat *)(pc + 8) - ) ); -} - -int __glXDisp_GenProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenProgramsNV( GET_DISPATCH(), ( - n, - programs - ) ); - __glXSendReply(cl->client, programs, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramParameterdvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramParameterfvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetProgramivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetTrackMatrixivNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribdvNV_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribfvNV_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = *(GLenum *)(pc + 4); - - const GLuint compsize = __glGetVertexAttribivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - pname, - params - ) ); - __glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsProgramNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsProgramNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_LoadProgramNV(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 8); - - CALL_LoadProgramNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - len, - (const GLubyte *)(pc + 12) - ) ); -} - -void __glXDisp_ProgramParameters4dvNV(GLbyte * pc) -{ - const GLuint num = *(GLuint *)(pc + 8); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramParameters4dvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - num, - (const GLdouble *)(pc + 12) - ) ); -} - -void __glXDisp_ProgramParameters4fvNV(GLbyte * pc) -{ - const GLuint num = *(GLuint *)(pc + 8); - - CALL_ProgramParameters4fvNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - num, - (const GLfloat *)(pc + 12) - ) ); -} - -void __glXDisp_RequestResidentProgramsNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_RequestResidentProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_TrackMatrixNV(GLbyte * pc) -{ - CALL_TrackMatrixNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLenum *)(pc + 12) - ) ); -} - -void __glXDisp_VertexAttrib1dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1fvNV(GLbyte * pc) -{ - CALL_VertexAttrib1fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib1svNV(GLbyte * pc) -{ - CALL_VertexAttrib1svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2fvNV(GLbyte * pc) -{ - CALL_VertexAttrib2fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib2svNV(GLbyte * pc) -{ - CALL_VertexAttrib2svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3fvNV(GLbyte * pc) -{ - CALL_VertexAttrib3fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib3svNV(GLbyte * pc) -{ - CALL_VertexAttrib3svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLdouble *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4fvNV(GLbyte * pc) -{ - CALL_VertexAttrib4fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLfloat *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4svNV(GLbyte * pc) -{ - CALL_VertexAttrib4svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLshort *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc) -{ - CALL_VertexAttrib4ubvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDisp_VertexAttribs1dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs1dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs1fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs1fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs1svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs1svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs2dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs2dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs2fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs2fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs2svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs2svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs3dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs3dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs3fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs3fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs3svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs3svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4dvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs4dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLdouble *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4fvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs4fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4svNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs4svNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLshort *)(pc + 8) - ) ); -} - -void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 4); - - CALL_VertexAttribs4ubvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - n, - (const GLubyte *)(pc + 8) - ) ); -} - -void __glXDisp_PointParameteriNV(GLbyte * pc) -{ - CALL_PointParameteriNV( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLint *)(pc + 4) - ) ); -} - -void __glXDisp_PointParameterivNV(GLbyte * pc) -{ - const GLenum pname = *(GLenum *)(pc + 0); - const GLint * params; - - params = (const GLint *) (pc + 4); - - CALL_PointParameterivNV( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc) -{ - CALL_ActiveStencilFaceEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -int __glXDisp_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = *(GLsizei *)(pc + 4); - - GLdouble params[4]; - CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - len, - (const GLubyte *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = *(GLsizei *)(pc + 4); - - GLfloat params[4]; - CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - len, - (const GLubyte *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 4, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 36); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 44 + __GLX_PAD(len) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 32), - len, - (const GLubyte *)(pc + 40), - (const GLdouble *)(pc + 0) - ) ); -} - -void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc) -{ - const GLsizei len = *(GLsizei *)(pc + 4); - - CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), ( - *(GLuint *)(pc + 0), - len, - (const GLubyte *)(pc + 24), - (const GLfloat *)(pc + 8) - ) ); -} - -void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc) -{ - CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4) - ) ); -} - -void __glXDisp_BindFramebufferEXT(GLbyte * pc) -{ - CALL_BindFramebufferEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_BindRenderbufferEXT(GLbyte * pc) -{ - CALL_BindRenderbufferEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLuint *)(pc + 4) - ) ); -} - -int __glXDisp_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteFramebuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc) -{ - const GLsizei n = *(GLsizei *)(pc + 0); - - CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)(pc + 4) - ) ); -} - -void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc) -{ - CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12) - ) ); -} - -void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture1DEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12), - *(GLint *)(pc + 16) - ) ); -} - -void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture2DEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12), - *(GLint *)(pc + 16) - ) ); -} - -void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture3DEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - *(GLuint *)(pc + 12), - *(GLint *)(pc + 16), - *(GLint *)(pc + 20) - ) ); -} - -int __glXDisp_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenFramebuffersEXT( GET_DISPATCH(), ( - n, - framebuffers - ) ); - __glXSendReply(cl->client, framebuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = *(GLsizei *)(pc + 0); - - GLuint answerBuffer[200]; - GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenRenderbuffersEXT( GET_DISPATCH(), ( - n, - renderbuffers - ) ); - __glXSendReply(cl->client, renderbuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDisp_GenerateMipmapEXT(GLbyte * pc) -{ - CALL_GenerateMipmapEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0) - ) ); -} - -int __glXDisp_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLenum *)(pc + 8), - params - ) ); - __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - params - ) ); - __glXSendReply(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDisp_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsFramebufferEXT( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDisp_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), ( - *(GLuint *)(pc + 0) - ) ); - __glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDisp_RenderbufferStorageEXT(GLbyte * pc) -{ - CALL_RenderbufferStorageEXT( GET_DISPATCH(), ( - *(GLenum *)(pc + 0), - *(GLenum *)(pc + 4), - *(GLsizei *)(pc + 8), - *(GLsizei *)(pc + 12) - ) ); -} - diff --git a/GL/glx/indirect_dispatch.h b/GL/glx/indirect_dispatch.h deleted file mode 100644 index e81c382f0..000000000 --- a/GL/glx/indirect_dispatch.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2005 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - -#if !defined( _INDIRECT_DISPATCH_H_ ) -# define _INDIRECT_DISPATCH_H_ - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define HIDDEN __attribute__((visibility("hidden"))) -# else -# define HIDDEN -# endif -struct __GLXclientStateRec; - -extern HIDDEN void __glXDisp_MapGrid1d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid1d(GLbyte * pc); -extern HIDDEN void __glXDisp_MapGrid1f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid1f(GLbyte * pc); -extern HIDDEN int __glXDisp_NewList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_NewList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LoadIdentity(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadIdentity(GLbyte * pc); -extern HIDDEN void __glXDisp_SampleCoverageARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SampleCoverageARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDisp_BeginQueryARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BeginQueryARB(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_PointParameteriNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameteriNV(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1iv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4sv(GLbyte * pc); -extern HIDDEN void __glXDisp_ActiveTextureARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Histogram(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Histogram(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_PolygonStipple(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PolygonStipple(GLbyte * pc); -extern HIDDEN void __glXDisp_BlendEquationSeparateEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPixelMapfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color3uiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3uiv(GLbyte * pc); -extern HIDDEN int __glXDisp_IsEnabled(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsEnabled(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalCoord2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord2fv(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMapiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMapiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_SwapBuffers(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Indexubv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexubv(GLbyte * pc); -extern HIDDEN int __glXDisp_Render(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_Render(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetQueryivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexImage3D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexImage3D(GLbyte * pc); -extern HIDDEN int __glXDisp_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_MakeContextCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFBConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color3ubv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3ubv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetQueryObjectivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Vertex3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexSubImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModeliv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModeliv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs1dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3bv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3bv(GLbyte * pc); -extern HIDDEN int __glXDisp_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_VendorPrivate(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib1fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3iv(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc); -extern HIDDEN void __glXDisp_BlendColor(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendColor(GLbyte * pc); -extern HIDDEN void __glXDisp_Scalef(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Scalef(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3iv(GLbyte * pc); -extern HIDDEN void __glXDisp_PassThrough(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PassThrough(GLbyte * pc); -extern HIDDEN void __glXDisp_Viewport(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Viewport(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NusvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_DepthRange(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DepthRange(GLbyte * pc); -extern HIDDEN void __glXDisp_ResetHistogram(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ResetHistogram(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramNamedParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PointParameterfEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameterfEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexImage3DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord1fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3iv(GLbyte * pc); -extern HIDDEN int __glXDisp_CopyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CopyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_PointSize(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointSize(GLbyte * pc); -extern HIDDEN void __glXDisp_PopName(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PopName(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NbvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4sv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexEnvfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LineStipple(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LineStipple(GLbyte * pc); -extern HIDDEN void __glXDisp_TexEnvi(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnvi(GLbyte * pc); -extern HIDDEN int __glXDisp_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetClipPlane(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttribs3dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModeli(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModeli(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Scaled(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Scaled(GLbyte * pc); -extern HIDDEN void __glXDisp_CallLists(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CallLists(GLbyte * pc); -extern HIDDEN void __glXDisp_AlphaFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_AlphaFunc(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2iv(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Rotated(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rotated(GLbyte * pc); -extern HIDDEN int __glXDisp_ReadPixels(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ReadPixels(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EdgeFlagv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EdgeFlagv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexParameterf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameterf(GLbyte * pc); -extern HIDDEN void __glXDisp_TexParameteri(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameteri(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_DrawPixels(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawPixels(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs3fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_GenerateMipmapEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GenLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MapGrid2d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid2d(GLbyte * pc); -extern HIDDEN void __glXDisp_MapGrid2f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MapGrid2f(GLbyte * pc); -extern HIDDEN void __glXDisp_Scissor(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Scissor(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogf(GLbyte * pc); -extern HIDDEN void __glXDisp_TexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4usv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4usv(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogi(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogi(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3iv(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelMapfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelMapfv(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3usv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc); -extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3bv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3bv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3bvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramLocalParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RenderbufferStorageEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorTable(GLbyte * pc); -extern HIDDEN void __glXDisp_Accum(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Accum(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexImage(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexImage(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ConvolutionFilter2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc); -extern HIDDEN int __glXDisp_Finish(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_Finish(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ClearStencil(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearStencil(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs4ubvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameteriv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2fv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramEnvParameter4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4fv(GLbyte * pc); -extern HIDDEN void __glXDisp_ClearIndex(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearIndex(GLbyte * pc); -extern HIDDEN void __glXDisp_LoadMatrixd(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadMatrixd(GLbyte * pc); -extern HIDDEN void __glXDisp_PushMatrix(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PushMatrix(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameterfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexGendv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LoadProgramNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadProgramNV(GLbyte * pc); -extern HIDDEN int __glXDisp_EndList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_EndList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord1fv(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalMesh2(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalMesh2(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4fv(GLbyte * pc); -extern HIDDEN int __glXDisp_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CheckFramebufferStatusEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFBConfigsSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Normal3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramEnvParameter4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_End(GLbyte * pc); -extern HIDDEN void __glXDispSwap_End(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs2dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord3fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramParameterfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_BindTexture(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindTexture(GLbyte * pc); -extern HIDDEN void __glXDisp_TexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexSubImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_DeleteRenderbuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGenfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGenfv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4bvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateContextWithConfigSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_FramebufferTexture3DEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CopySubBufferMESA(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_BlendEquation(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendEquation(GLbyte * pc); -extern HIDDEN int __glXDisp_GetError(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetError(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexCoord3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Indexdv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexdv(GLbyte * pc); -extern HIDDEN void __glXDisp_PushName(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PushName(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramNamedParameter4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord1svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_EndQueryARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EndQueryARB(GLbyte * pc); -extern HIDDEN void __glXDisp_DepthMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DepthMask(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMaterialiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_StencilOp(GLbyte * pc); -extern HIDDEN void __glXDispSwap_StencilOp(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord3svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexEnvfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnvfv(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryServerString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryServerString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LoadMatrixf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadMatrixf(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4bv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4bv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3usvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramLocalParameter4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DeleteLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteLists(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LogicOp(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LogicOp(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4fv(GLbyte * pc); -extern HIDDEN int __glXDisp_WaitX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_WaitX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SecondaryColor3uivEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_FramebufferRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4ubv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4ubv(GLbyte * pc); -extern HIDDEN void __glXDisp_DrawBuffer(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawBuffer(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2fv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1sv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGeniv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGeniv(GLbyte * pc); -extern HIDDEN void __glXDisp_DepthFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DepthFunc(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelMapusv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelMapusv(GLbyte * pc); -extern HIDDEN void __glXDisp_PointParameterivNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PointParameterivNV(GLbyte * pc); -extern HIDDEN void __glXDisp_BlendFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendFunc(GLbyte * pc); -extern HIDDEN int __glXDisp_WaitGL(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_WaitGL(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord3dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramNamedParameter4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_Flush(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_Flush(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color4uiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4uiv(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3sv(GLbyte * pc); -extern HIDDEN void __glXDisp_BindFramebufferEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindFramebufferEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_PushAttrib(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PushAttrib(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyPbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexParameteriv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameteriv(GLbyte * pc); -extern HIDDEN void __glXDisp_WindowPos3fvMESA(GLbyte * pc); -extern HIDDEN void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryExtensionsString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexSubImage3D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc); -extern HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Indexiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc); -extern HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Frustum(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Frustum(GLbyte * pc); -extern HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetString(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexEnvf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnvf(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramStringARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord3ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib1dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ClearAccum(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearAccum(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryVersion(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryVersion(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SecondaryColor3ivEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SampleMaskSGIS(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SampleMaskSGIS(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorTableParameteriv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorTableParameteriv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4ubvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_Lightfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lightfv(GLbyte * pc); -extern HIDDEN void __glXDisp_ClearDepth(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearDepth(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4fv(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord4ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreatePixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Lightiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lightiv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetQueryObjectuivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenRenderbuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib2dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs2svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Rectdv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectdv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Materialiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materialiv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3fvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_PolygonMode(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PolygonMode(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexSubImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsQueryARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsQueryARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexGeni(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGeni(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGenf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGenf(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGend(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGend(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPolygonStipple(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribfvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib2svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs1fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NuivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Color4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4sv(GLbyte * pc); -extern HIDDEN int __glXDisp_IsProgramNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsProgramNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PixelZoom(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelZoom(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorTableParameterfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorTableParameterfv(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelMapuiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelMapuiv(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc); -extern HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMapdv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyGLXPixmap(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SamplePatternSGIS(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SamplePatternSGIS(GLbyte * pc); -extern HIDDEN int __glXDisp_PixelStoref(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_PixelStoref(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PrioritizeTextures(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PrioritizeTextures(GLbyte * pc); -extern HIDDEN int __glXDisp_PixelStorei(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_PixelStorei(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4usvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DestroyGLXPbufferSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EvalCoord2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord2dv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ColorMaterial(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorMaterial(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexSubImage3DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc); -extern HIDDEN int __glXDisp_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsFramebufferEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc); -extern HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_RasterPos2iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2iv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_FrontFace(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FrontFace(GLbyte * pc); -extern HIDDEN int __glXDisp_RenderLarge(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_RenderLarge(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc); -extern HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Lightf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lightf(GLbyte * pc); -extern HIDDEN void __glXDisp_MatrixMode(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MatrixMode(GLbyte * pc); -extern HIDDEN void __glXDisp_FramebufferTexture2DEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPixelMapusv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Lighti(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Lighti(GLbyte * pc); -extern HIDDEN int __glXDisp_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ChangeDrawableAttributesSGIX(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultiTexCoord4dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreatePbuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetDoublev(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetDoublev(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_MultMatrixd(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultMatrixd(GLbyte * pc); -extern HIDDEN void __glXDisp_MultMatrixf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultMatrixf(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TrackMatrixNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TrackMatrixNV(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos4sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4sv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NsvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ClearColor(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClearColor(GLbyte * pc); -extern HIDDEN int __glXDisp_IsDirect(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsDirect(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_DeleteFramebuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_TexEnviv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexEnviv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexSubImage3D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexSubImage3D(GLbyte * pc); -extern HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Bitmap(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenFramebuffersEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramParameterdvNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Vertex2sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2sv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetIntegerv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramEnvParameterfvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTrackMatrixivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib3svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexEnviv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_VendorPrivateWithReply(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SeparableFilter2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SeparableFilter2D(GLbyte * pc); -extern HIDDEN void __glXDisp_Map1d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map1d(GLbyte * pc); -extern HIDDEN void __glXDisp_Map1f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map1f(GLbyte * pc); -extern HIDDEN void __glXDisp_CompressedTexImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexImage2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexImage2D(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramParameters4fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramivNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos2dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogiv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDisp_PixelTransferi(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PixelTransferi(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3ubvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Clear(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Clear(GLbyte * pc); -extern HIDDEN void __glXDisp_ReadBuffer(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ReadBuffer(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameteri(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameteri(GLbyte * pc); -extern HIDDEN void __glXDisp_Ortho(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Ortho(GLbyte * pc); -extern HIDDEN void __glXDisp_ListBase(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ListBase(GLbyte * pc); -extern HIDDEN void __glXDisp_ConvolutionParameterf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc); -extern HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_CallList(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CallList(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs2fvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Rectiv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectiv(GLbyte * pc); -extern HIDDEN void __glXDisp_SecondaryColor3dvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex2fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2fv(GLbyte * pc); -extern HIDDEN void __glXDisp_BindRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc); -extern HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_DeleteProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EvalMesh1(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalMesh1(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord1dvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex2iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex2iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramStringNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_LineWidth(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LineWidth(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_TexGendv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc); -extern HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc); -extern HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_UseXFont(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_UseXFont(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ShadeModel(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ShadeModel(GLbyte * pc); -extern HIDDEN void __glXDisp_Materialfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materialfv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3fv(GLbyte * pc); -extern HIDDEN void __glXDisp_FogCoordfvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FogCoordfvEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord1ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2ivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_DrawArrays(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawArrays(GLbyte * pc); -extern HIDDEN void __glXDisp_Color3iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color3iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Rotatef(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rotatef(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramParameters4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalPoint2(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalPoint2(GLbyte * pc); -extern HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc); -extern HIDDEN void __glXDisp_PopMatrix(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc); -extern HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_MakeCurrent(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Map2d(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map2d(GLbyte * pc); -extern HIDDEN void __glXDisp_Map2f(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Map2f(GLbyte * pc); -extern HIDDEN void __glXDisp_ProgramStringARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ProgramStringARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetCompressedTexImageARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_Materialf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materialf(GLbyte * pc); -extern HIDDEN void __glXDisp_Materiali(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Materiali(GLbyte * pc); -extern HIDDEN void __glXDisp_Indexsv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexsv(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord4svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModelfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModelfv(GLbyte * pc); -extern HIDDEN void __glXDisp_TexCoord2dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord2dv(GLbyte * pc); -extern HIDDEN int __glXDisp_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenQueriesARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_EvalCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_EvalCoord1dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Translated(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Translated(GLbyte * pc); -extern HIDDEN void __glXDisp_Translatef(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Translatef(GLbyte * pc); -extern HIDDEN void __glXDisp_StencilMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_StencilMask(GLbyte * pc); -extern HIDDEN int __glXDisp_CreateWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_CreateWindow(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetLightiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetLightiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_IsList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_IsList(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_RenderMode(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_RenderMode(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_DrawBuffersARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_DrawBuffersARB(GLbyte * pc); -extern HIDDEN void __glXDisp_LoadName(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LoadName(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyTexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc); -extern HIDDEN void __glXDisp_CullFace(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CullFace(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryContextInfoEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttribs3svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_StencilFunc(GLbyte * pc); -extern HIDDEN void __glXDispSwap_StencilFunc(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyPixels(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyPixels(GLbyte * pc); -extern HIDDEN void __glXDisp_Rectsv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectsv(GLbyte * pc); -extern HIDDEN void __glXDisp_CopyConvolutionFilter2D(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc); -extern HIDDEN void __glXDisp_TexParameterfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexParameterfv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4uivARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc); -extern HIDDEN void __glXDisp_ClipPlane(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc); -extern HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Indexfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Indexfv(GLbyte * pc); -extern HIDDEN int __glXDisp_QueryContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_QueryContext(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_SecondaryColor3svEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc); -extern HIDDEN void __glXDisp_IndexMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_IndexMask(GLbyte * pc); -extern HIDDEN void __glXDisp_BindProgramNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_BindProgramNV(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetFloatv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetFloatv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexCoord3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord3sv(GLbyte * pc); -extern HIDDEN void __glXDisp_PopAttrib(GLbyte * pc); -extern HIDDEN void __glXDispSwap_PopAttrib(GLbyte * pc); -extern HIDDEN void __glXDisp_Fogfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Fogfv(GLbyte * pc); -extern HIDDEN void __glXDisp_InitNames(GLbyte * pc); -extern HIDDEN void __glXDispSwap_InitNames(GLbyte * pc); -extern HIDDEN void __glXDisp_Normal3sv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Normal3sv(GLbyte * pc); -extern HIDDEN void __glXDisp_Minmax(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Minmax(GLbyte * pc); -extern HIDDEN void __glXDisp_FogCoorddvEXT(GLbyte * pc); -extern HIDDEN void __glXDispSwap_FogCoorddvEXT(GLbyte * pc); -extern HIDDEN int __glXDisp_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetBooleanv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Hint(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Hint(GLbyte * pc); -extern HIDDEN void __glXDisp_Color4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Color4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib2svARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc); -extern HIDDEN int __glXDisp_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_AreProgramsResidentNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_CopyColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_CopyColorSubTable(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib4NubvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttrib3dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex4iv(GLbyte * pc); -extern HIDDEN int __glXDisp_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetProgramEnvParameterdvARB(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_TexCoord4dv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_TexCoord4dv(GLbyte * pc); -extern HIDDEN void __glXDisp_Begin(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Begin(GLbyte * pc); -extern HIDDEN int __glXDisp_ClientInfo(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_ClientInfo(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Rectfv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Rectfv(GLbyte * pc); -extern HIDDEN void __glXDisp_LightModelf(GLbyte * pc); -extern HIDDEN void __glXDispSwap_LightModelf(GLbyte * pc); -extern HIDDEN int __glXDisp_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetTexParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetLightfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetLightfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_Disable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Disable(GLbyte * pc); -extern HIDDEN void __glXDisp_MultiTexCoord2fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc); -extern HIDDEN int __glXDisp_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetRenderbufferParameterivEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_SelectBuffer(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_ColorMask(GLbyte * pc); -extern HIDDEN void __glXDispSwap_ColorMask(GLbyte * pc); -extern HIDDEN void __glXDisp_RasterPos4iv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_RasterPos4iv(GLbyte * pc); -extern HIDDEN void __glXDisp_Enable(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Enable(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc); -extern HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc); -extern HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc); -extern HIDDEN void __glXDisp_Vertex3fv(GLbyte * pc); -extern HIDDEN void __glXDispSwap_Vertex3fv(GLbyte * pc); -extern HIDDEN int __glXDisp_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN int __glXDispSwap_GenProgramsNV(struct __GLXclientStateRec *, GLbyte *); -extern HIDDEN void __glXDisp_VertexAttrib4dvNV(GLbyte * pc); -extern HIDDEN void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc); - -# undef HIDDEN - -#endif /* !defined( _INDIRECT_DISPATCH_H_ ) */ diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c deleted file mode 100644 index f137cbe98..000000000 --- a/GL/glx/indirect_dispatch_swap.c +++ /dev/null @@ -1,6051 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_recv.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2005 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - -#include <X11/Xmd.h> -#include <GL/gl.h> -#include <GL/glxproto.h> -#include <inttypes.h> -#include "indirect_size.h" -#include "indirect_size_get.h" -#include "indirect_dispatch.h" -#include "glxserver.h" -#include "glxbyteorder.h" -#include "indirect_util.h" -#include "singlesize.h" -#include "glapitable.h" -#include "glapi.h" -#include "glthread.h" -#include "dispatch.h" - -#define __GLX_PAD(x) (((x) + 3) & ~3) - -typedef struct { - __GLX_PIXEL_3D_HDR; -} __GLXpixel3DHeader; - -extern GLboolean __glXErrorOccured( void ); -extern void __glXClearErrorOccured( void ); - -static const unsigned dummy_answer[2] = {0, 0}; - -static GLsizei -bswap_CARD32( const void * src ) -{ - union { uint32_t dst; GLsizei ret; } x; - x.dst = bswap_32( *(uint32_t *) src ); - return x.ret; -} - -static GLshort -bswap_CARD16( const void * src ) -{ - union { uint16_t dst; GLshort ret; } x; - x.dst = bswap_16( *(uint16_t *) src ); - return x.ret; -} - -static GLenum -bswap_ENUM( const void * src ) -{ - union { uint32_t dst; GLenum ret; } x; - x.dst = bswap_32( *(uint32_t *) src ); - return x.ret; -} - -static GLdouble -bswap_FLOAT64( const void * src ) -{ - union { uint64_t dst; GLdouble ret; } x; - x.dst = bswap_64( *(uint64_t *) src ); - return x.ret; -} - -static GLfloat -bswap_FLOAT32( const void * src ) -{ - union { uint32_t dst; GLfloat ret; } x; - x.dst = bswap_32( *(uint32_t *) src ); - return x.ret; -} - -static void * -bswap_16_array( uint16_t * src, unsigned count ) -{ - unsigned i; - - for ( i = 0 ; i < count ; i++ ) { - uint16_t temp = bswap_16( src[i] ); - src[i] = temp; - } - - return src; -} - -static void * -bswap_32_array( uint32_t * src, unsigned count ) -{ - unsigned i; - - for ( i = 0 ; i < count ; i++ ) { - uint32_t temp = bswap_32( src[i] ); - src[i] = temp; - } - - return src; -} - -static void * -bswap_64_array( uint64_t * src, unsigned count ) -{ - unsigned i; - - for ( i = 0 ; i < count ; i++ ) { - uint64_t temp = bswap_64( src[i] ); - src[i] = temp; - } - - return src; -} - -int __glXDispSwap_NewList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_NewList( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_EndList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_EndList( GET_DISPATCH(), () ); - error = Success; - } - - return error; -} - -void __glXDispSwap_CallList(GLbyte * pc) -{ - CALL_CallList( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_CallLists(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - const GLenum type = (GLenum )bswap_ENUM ( pc + 4 ); - const GLvoid * lists; - - switch(type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - case GL_2_BYTES: - case GL_3_BYTES: - case GL_4_BYTES: - lists = (const GLvoid *) (pc + 8); break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - lists = (const GLvoid *) bswap_16_array( (uint16_t *) (pc + 8), n ); break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - lists = (const GLvoid *) bswap_32_array( (uint32_t *) (pc + 8), n ); break; - default: - return; - } - - CALL_CallLists( GET_DISPATCH(), ( - n, - type, - lists - ) ); -} - -int __glXDispSwap_DeleteLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_DeleteLists( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (GLsizei )bswap_CARD32 ( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenLists(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLuint retval; - retval = CALL_GenLists( GET_DISPATCH(), ( - (GLsizei )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_ListBase(GLbyte * pc) -{ - CALL_ListBase( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Begin(GLbyte * pc) -{ - CALL_Begin( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Bitmap(GLbyte * pc) -{ - const GLubyte * const bitmap = (const GLubyte *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_Bitmap( GET_DISPATCH(), ( - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLfloat )bswap_FLOAT32( pc + 28 ), - (GLfloat )bswap_FLOAT32( pc + 32 ), - (GLfloat )bswap_FLOAT32( pc + 36 ), - (GLfloat )bswap_FLOAT32( pc + 40 ), - bitmap - ) ); -} - -void __glXDispSwap_Color3bv(GLbyte * pc) -{ - CALL_Color3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Color3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3fv(GLbyte * pc) -{ - CALL_Color3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3iv(GLbyte * pc) -{ - CALL_Color3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3sv(GLbyte * pc) -{ - CALL_Color3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3ubv(GLbyte * pc) -{ - CALL_Color3ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color3uiv(GLbyte * pc) -{ - CALL_Color3uiv( GET_DISPATCH(), ( - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color3usv(GLbyte * pc) -{ - CALL_Color3usv( GET_DISPATCH(), ( - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Color4bv(GLbyte * pc) -{ - CALL_Color4bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Color4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4fv(GLbyte * pc) -{ - CALL_Color4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4iv(GLbyte * pc) -{ - CALL_Color4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4sv(GLbyte * pc) -{ - CALL_Color4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4ubv(GLbyte * pc) -{ - CALL_Color4ubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Color4uiv(GLbyte * pc) -{ - CALL_Color4uiv( GET_DISPATCH(), ( - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Color4usv(GLbyte * pc) -{ - CALL_Color4usv( GET_DISPATCH(), ( - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_EdgeFlagv(GLbyte * pc) -{ - CALL_EdgeFlagv( GET_DISPATCH(), ( - (const GLboolean *)(pc + 0) - ) ); -} - -void __glXDispSwap_End(GLbyte * pc) -{ - CALL_End( GET_DISPATCH(), () ); -} - -void __glXDispSwap_Indexdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_Indexdv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Indexfv(GLbyte * pc) -{ - CALL_Indexfv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Indexiv(GLbyte * pc) -{ - CALL_Indexiv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Indexsv(GLbyte * pc) -{ - CALL_Indexsv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_Normal3bv(GLbyte * pc) -{ - CALL_Normal3bv( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_Normal3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Normal3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Normal3fv(GLbyte * pc) -{ - CALL_Normal3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Normal3iv(GLbyte * pc) -{ - CALL_Normal3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Normal3sv(GLbyte * pc) -{ - CALL_Normal3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_RasterPos2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos2fv(GLbyte * pc) -{ - CALL_RasterPos2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos2iv(GLbyte * pc) -{ - CALL_RasterPos2iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos2sv(GLbyte * pc) -{ - CALL_RasterPos2sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_RasterPos3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_RasterPos3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos3fv(GLbyte * pc) -{ - CALL_RasterPos3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos3iv(GLbyte * pc) -{ - CALL_RasterPos3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos3sv(GLbyte * pc) -{ - CALL_RasterPos3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_RasterPos4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_RasterPos4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_RasterPos4fv(GLbyte * pc) -{ - CALL_RasterPos4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_RasterPos4iv(GLbyte * pc) -{ - CALL_RasterPos4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_RasterPos4sv(GLbyte * pc) -{ - CALL_RasterPos4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Rectdv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rectdv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 16), 2 ) - ) ); -} - -void __glXDispSwap_Rectfv(GLbyte * pc) -{ - CALL_Rectfv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 2 ) - ) ); -} - -void __glXDispSwap_Rectiv(GLbyte * pc) -{ - CALL_Rectiv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 8), 2 ) - ) ); -} - -void __glXDispSwap_Rectsv(GLbyte * pc) -{ - CALL_Rectsv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_TexCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord1fv(GLbyte * pc) -{ - CALL_TexCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord1iv(GLbyte * pc) -{ - CALL_TexCoord1iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord1sv(GLbyte * pc) -{ - CALL_TexCoord1sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_TexCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord2fv(GLbyte * pc) -{ - CALL_TexCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord2iv(GLbyte * pc) -{ - CALL_TexCoord2iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord2sv(GLbyte * pc) -{ - CALL_TexCoord2sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_TexCoord3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_TexCoord3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord3fv(GLbyte * pc) -{ - CALL_TexCoord3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord3iv(GLbyte * pc) -{ - CALL_TexCoord3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord3sv(GLbyte * pc) -{ - CALL_TexCoord3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_TexCoord4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_TexCoord4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_TexCoord4fv(GLbyte * pc) -{ - CALL_TexCoord4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_TexCoord4iv(GLbyte * pc) -{ - CALL_TexCoord4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_TexCoord4sv(GLbyte * pc) -{ - CALL_TexCoord4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_Vertex2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex2fv(GLbyte * pc) -{ - CALL_Vertex2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex2iv(GLbyte * pc) -{ - CALL_Vertex2iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex2sv(GLbyte * pc) -{ - CALL_Vertex2sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_Vertex3dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Vertex3dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex3fv(GLbyte * pc) -{ - CALL_Vertex3fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex3iv(GLbyte * pc) -{ - CALL_Vertex3iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex3sv(GLbyte * pc) -{ - CALL_Vertex3sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_Vertex4dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Vertex4dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex4fv(GLbyte * pc) -{ - CALL_Vertex4fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex4iv(GLbyte * pc) -{ - CALL_Vertex4iv( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_Vertex4sv(GLbyte * pc) -{ - CALL_Vertex4sv( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_ClipPlane(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_ClipPlane( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 32 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_ColorMaterial(GLbyte * pc) -{ - CALL_ColorMaterial( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_CullFace(GLbyte * pc) -{ - CALL_CullFace( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Fogf(GLbyte * pc) -{ - CALL_Fogf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_Fogfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glFogfv_size(pname) ); - - CALL_Fogfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_Fogi(GLbyte * pc) -{ - CALL_Fogi( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_Fogiv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glFogiv_size(pname) ); - - CALL_Fogiv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_FrontFace(GLbyte * pc) -{ - CALL_FrontFace( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Hint(GLbyte * pc) -{ - CALL_Hint( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_Lightf(GLbyte * pc) -{ - CALL_Lightf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Lightfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glLightfv_size(pname) ); - - CALL_Lightfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_Lighti(GLbyte * pc) -{ - CALL_Lighti( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_Lightiv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glLightiv_size(pname) ); - - CALL_Lightiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_LightModelf(GLbyte * pc) -{ - CALL_LightModelf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_LightModelfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModelfv_size(pname) ); - - CALL_LightModelfv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_LightModeli(GLbyte * pc) -{ - CALL_LightModeli( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_LightModeliv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glLightModeliv_size(pname) ); - - CALL_LightModeliv( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_LineStipple(GLbyte * pc) -{ - CALL_LineStipple( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLushort)bswap_CARD16 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_LineWidth(GLbyte * pc) -{ - CALL_LineWidth( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_Materialf(GLbyte * pc) -{ - CALL_Materialf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Materialfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialfv_size(pname) ); - - CALL_Materialfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_Materiali(GLbyte * pc) -{ - CALL_Materiali( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_Materialiv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glMaterialiv_size(pname) ); - - CALL_Materialiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_PointSize(GLbyte * pc) -{ - CALL_PointSize( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_PolygonMode(GLbyte * pc) -{ - CALL_PolygonMode( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_PolygonStipple(GLbyte * pc) -{ - const GLubyte * const mask = (const GLubyte *) (pc + 20); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_PolygonStipple( GET_DISPATCH(), ( - mask - ) ); -} - -void __glXDispSwap_Scissor(GLbyte * pc) -{ - CALL_Scissor( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ) - ) ); -} - -void __glXDispSwap_ShadeModel(GLbyte * pc) -{ - CALL_ShadeModel( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_TexParameterf(GLbyte * pc) -{ - CALL_TexParameterf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexParameterfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameterfv_size(pname) ); - - CALL_TexParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexParameteri(GLbyte * pc) -{ - CALL_TexParameteri( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexParameteriv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexParameteriv_size(pname) ); - - CALL_TexParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexImage1D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_TexImage2D(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 52); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ), - (GLsizei )bswap_CARD32 ( pc + 36 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_TexEnvf(GLbyte * pc) -{ - CALL_TexEnvf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexEnvfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnvfv_size(pname) ); - - CALL_TexEnvfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexEnvi(GLbyte * pc) -{ - CALL_TexEnvi( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexEnviv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexEnviv_size(pname) ); - - CALL_TexEnviv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexGend(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_TexGend( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 8 ), - (GLenum )bswap_ENUM ( pc + 12 ), - (GLdouble)bswap_FLOAT64( pc + 0 ) - ) ); -} - -void __glXDispSwap_TexGendv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLdouble * params; - -#ifdef __GLX_ALIGN64 - const GLuint compsize = __glTexGendv_size(pname); - const GLuint cmdlen = 12 + __GLX_PAD((compsize * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - params = (const GLdouble *) bswap_64_array( (uint64_t *) (pc + 8), __glTexGendv_size(pname) ); - - CALL_TexGendv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexGenf(GLbyte * pc) -{ - CALL_TexGenf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexGenfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGenfv_size(pname) ); - - CALL_TexGenfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_TexGeni(GLbyte * pc) -{ - CALL_TexGeni( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_TexGeniv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glTexGeniv_size(pname) ); - - CALL_TexGeniv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_InitNames(GLbyte * pc) -{ - CALL_InitNames( GET_DISPATCH(), () ); -} - -void __glXDispSwap_LoadName(GLbyte * pc) -{ - CALL_LoadName( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PassThrough(GLbyte * pc) -{ - CALL_PassThrough( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_PopName(GLbyte * pc) -{ - CALL_PopName( GET_DISPATCH(), () ); -} - -void __glXDispSwap_PushName(GLbyte * pc) -{ - CALL_PushName( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_DrawBuffer(GLbyte * pc) -{ - CALL_DrawBuffer( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Clear(GLbyte * pc) -{ - CALL_Clear( GET_DISPATCH(), ( - (GLbitfield)bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ClearAccum(GLbyte * pc) -{ - CALL_ClearAccum( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ), - (GLfloat )bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_ClearIndex(GLbyte * pc) -{ - CALL_ClearIndex( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ) - ) ); -} - -void __glXDispSwap_ClearColor(GLbyte * pc) -{ - CALL_ClearColor( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - (GLclampf)bswap_FLOAT32( pc + 4 ), - (GLclampf)bswap_FLOAT32( pc + 8 ), - (GLclampf)bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_ClearStencil(GLbyte * pc) -{ - CALL_ClearStencil( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ClearDepth(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_ClearDepth( GET_DISPATCH(), ( - (GLclampd)bswap_FLOAT64( pc + 0 ) - ) ); -} - -void __glXDispSwap_StencilMask(GLbyte * pc) -{ - CALL_StencilMask( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ColorMask(GLbyte * pc) -{ - CALL_ColorMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0), - *(GLboolean *)(pc + 1), - *(GLboolean *)(pc + 2), - *(GLboolean *)(pc + 3) - ) ); -} - -void __glXDispSwap_DepthMask(GLbyte * pc) -{ - CALL_DepthMask( GET_DISPATCH(), ( - *(GLboolean *)(pc + 0) - ) ); -} - -void __glXDispSwap_IndexMask(GLbyte * pc) -{ - CALL_IndexMask( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Accum(GLbyte * pc) -{ - CALL_Accum( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_Disable(GLbyte * pc) -{ - CALL_Disable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_Enable(GLbyte * pc) -{ - CALL_Enable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PopAttrib(GLbyte * pc) -{ - CALL_PopAttrib( GET_DISPATCH(), () ); -} - -void __glXDispSwap_PushAttrib(GLbyte * pc) -{ - CALL_PushAttrib( GET_DISPATCH(), ( - (GLbitfield)bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_MapGrid1d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MapGrid1d( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ) - ) ); -} - -void __glXDispSwap_MapGrid1f(GLbyte * pc) -{ - CALL_MapGrid1f( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_MapGrid2d(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_MapGrid2d( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 32 ), - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 36 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ) - ) ); -} - -void __glXDispSwap_MapGrid2f(GLbyte * pc) -{ - CALL_MapGrid2f( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLfloat )bswap_FLOAT32( pc + 16 ), - (GLfloat )bswap_FLOAT32( pc + 20 ) - ) ); -} - -void __glXDispSwap_EvalCoord1dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_EvalCoord1dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_EvalCoord1fv(GLbyte * pc) -{ - CALL_EvalCoord1fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_EvalCoord2dv(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_EvalCoord2dv( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_EvalCoord2fv(GLbyte * pc) -{ - CALL_EvalCoord2fv( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_EvalMesh1(GLbyte * pc) -{ - CALL_EvalMesh1( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_EvalPoint1(GLbyte * pc) -{ - CALL_EvalPoint1( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ) - ) ); -} - -void __glXDispSwap_EvalMesh2(GLbyte * pc) -{ - CALL_EvalMesh2( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_EvalPoint2(GLbyte * pc) -{ - CALL_EvalPoint2( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_AlphaFunc(GLbyte * pc) -{ - CALL_AlphaFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLclampf)bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_BlendFunc(GLbyte * pc) -{ - CALL_BlendFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_LogicOp(GLbyte * pc) -{ - CALL_LogicOp( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_StencilFunc(GLbyte * pc) -{ - CALL_StencilFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLuint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_StencilOp(GLbyte * pc) -{ - CALL_StencilOp( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ) - ) ); -} - -void __glXDispSwap_DepthFunc(GLbyte * pc) -{ - CALL_DepthFunc( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PixelZoom(GLbyte * pc) -{ - CALL_PixelZoom( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_PixelTransferf(GLbyte * pc) -{ - CALL_PixelTransferf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_PixelTransferi(GLbyte * pc) -{ - CALL_PixelTransferi( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_PixelStoref(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStoref( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_PixelStorei(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - CALL_PixelStorei( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); - error = Success; - } - - return error; -} - -void __glXDispSwap_PixelMapfv(GLbyte * pc) -{ - const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_PixelMapfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - mapsize, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_PixelMapuiv(GLbyte * pc) -{ - const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_PixelMapuiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - mapsize, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_PixelMapusv(GLbyte * pc) -{ - const GLsizei mapsize = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_PixelMapusv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - mapsize, - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_ReadBuffer(GLbyte * pc) -{ - CALL_ReadBuffer( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_CopyPixels(GLbyte * pc) -{ - CALL_CopyPixels( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLenum )bswap_ENUM ( pc + 16 ) - ) ); -} - -void __glXDispSwap_DrawPixels(GLbyte * pc) -{ - const GLvoid * const pixels = (const GLvoid *) (pc + 36); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_DrawPixels( GET_DISPATCH(), ( - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLenum )bswap_ENUM ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - pixels - ) ); -} - -int __glXDispSwap_GetBooleanv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetBooleanv_size(pname); - GLboolean answerBuffer[200]; - GLboolean * params = __glXGetAnswerBuffer(cl, compsize, answerBuffer, sizeof(answerBuffer), 1); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetBooleanv( GET_DISPATCH(), ( - pname, - params - ) ); - __glXSendReplySwap(cl->client, params, compsize, 1, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetClipPlane(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLdouble equation[4]; - CALL_GetClipPlane( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - equation - ) ); - (void) bswap_64_array( (uint64_t *) equation, 4 ); - __glXSendReplySwap(cl->client, equation, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetDoublev(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetDoublev_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetDoublev( GET_DISPATCH(), ( - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetError(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_GetError( GET_DISPATCH(), () ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetFloatv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetFloatv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetFloatv( GET_DISPATCH(), ( - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetIntegerv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetIntegerv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetIntegerv( GET_DISPATCH(), ( - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetLightfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetLightfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetLightiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetLightiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetLightiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMapdv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); - const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMapdv_size(target,query); - GLdouble answerBuffer[200]; - GLdouble * v = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapdv( GET_DISPATCH(), ( - target, - query, - v - ) ); - (void) bswap_64_array( (uint64_t *) v, compsize ); - __glXSendReplySwap(cl->client, v, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); - const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMapfv_size(target,query); - GLfloat answerBuffer[200]; - GLfloat * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapfv( GET_DISPATCH(), ( - target, - query, - v - ) ); - (void) bswap_32_array( (uint32_t *) v, compsize ); - __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMapiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum target = (GLenum )bswap_ENUM ( pc + 0 ); - const GLenum query = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMapiv_size(target,query); - GLint answerBuffer[200]; - GLint * v = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (v == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMapiv( GET_DISPATCH(), ( - target, - query, - v - ) ); - (void) bswap_32_array( (uint32_t *) v, compsize ); - __glXSendReplySwap(cl->client, v, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMaterialfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMaterialfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMaterialiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMaterialiv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMaterialiv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetPixelMapfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetPixelMapfv_size(map); - GLfloat answerBuffer[200]; - GLfloat * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapfv( GET_DISPATCH(), ( - map, - values - ) ); - (void) bswap_32_array( (uint32_t *) values, compsize ); - __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetPixelMapuiv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetPixelMapuiv_size(map); - GLuint answerBuffer[200]; - GLuint * values = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapuiv( GET_DISPATCH(), ( - map, - values - ) ); - (void) bswap_32_array( (uint32_t *) values, compsize ); - __glXSendReplySwap(cl->client, values, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetPixelMapusv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum map = (GLenum )bswap_ENUM ( pc + 0 ); - - const GLuint compsize = __glGetPixelMapusv_size(map); - GLushort answerBuffer[200]; - GLushort * values = __glXGetAnswerBuffer(cl, compsize * 2, answerBuffer, sizeof(answerBuffer), 2); - - if (values == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetPixelMapusv( GET_DISPATCH(), ( - map, - values - ) ); - (void) bswap_16_array( (uint16_t *) values, compsize ); - __glXSendReplySwap(cl->client, values, compsize, 2, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexEnvfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexEnvfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnvfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexEnviv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexEnviv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexEnviv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexGendv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexGendv_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGendv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexGenfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexGenfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGenfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexGeniv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexGeniv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexGeniv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetTexParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 ); - - const GLuint compsize = __glGetTexLevelParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 8 ); - - const GLuint compsize = __glGetTexLevelParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetTexLevelParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsEnabled(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsEnabled( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsList(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsList( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_DepthRange(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 16); - pc -= 4; - } -#endif - - CALL_DepthRange( GET_DISPATCH(), ( - (GLclampd)bswap_FLOAT64( pc + 0 ), - (GLclampd)bswap_FLOAT64( pc + 8 ) - ) ); -} - -void __glXDispSwap_Frustum(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Frustum( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ), - (GLdouble)bswap_FLOAT64( pc + 32 ), - (GLdouble)bswap_FLOAT64( pc + 40 ) - ) ); -} - -void __glXDispSwap_LoadIdentity(GLbyte * pc) -{ - CALL_LoadIdentity( GET_DISPATCH(), () ); -} - -void __glXDispSwap_LoadMatrixf(GLbyte * pc) -{ - CALL_LoadMatrixf( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_LoadMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_LoadMatrixd( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_MatrixMode(GLbyte * pc) -{ - CALL_MatrixMode( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_MultMatrixf(GLbyte * pc) -{ - CALL_MultMatrixf( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_MultMatrixd(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 128); - pc -= 4; - } -#endif - - CALL_MultMatrixd( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 16 ) - ) ); -} - -void __glXDispSwap_Ortho(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 48); - pc -= 4; - } -#endif - - CALL_Ortho( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ), - (GLdouble)bswap_FLOAT64( pc + 32 ), - (GLdouble)bswap_FLOAT64( pc + 40 ) - ) ); -} - -void __glXDispSwap_PopMatrix(GLbyte * pc) -{ - CALL_PopMatrix( GET_DISPATCH(), () ); -} - -void __glXDispSwap_PushMatrix(GLbyte * pc) -{ - CALL_PushMatrix( GET_DISPATCH(), () ); -} - -void __glXDispSwap_Rotated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 32); - pc -= 4; - } -#endif - - CALL_Rotated( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ), - (GLdouble)bswap_FLOAT64( pc + 24 ) - ) ); -} - -void __glXDispSwap_Rotatef(GLbyte * pc) -{ - CALL_Rotatef( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ), - (GLfloat )bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_Scaled(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Scaled( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ) - ) ); -} - -void __glXDispSwap_Scalef(GLbyte * pc) -{ - CALL_Scalef( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Translated(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_Translated( GET_DISPATCH(), ( - (GLdouble)bswap_FLOAT64( pc + 0 ), - (GLdouble)bswap_FLOAT64( pc + 8 ), - (GLdouble)bswap_FLOAT64( pc + 16 ) - ) ); -} - -void __glXDispSwap_Translatef(GLbyte * pc) -{ - CALL_Translatef( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_Viewport(GLbyte * pc) -{ - CALL_Viewport( GET_DISPATCH(), ( - (GLint )bswap_CARD32 ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ) - ) ); -} - -void __glXDispSwap_BindTexture(GLbyte * pc) -{ - CALL_BindTexture( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_Indexubv(GLbyte * pc) -{ - CALL_Indexubv( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_PolygonOffset(GLbyte * pc) -{ - CALL_PolygonOffset( GET_DISPATCH(), ( - (GLfloat )bswap_FLOAT32( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - residences - ) ); - __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreTexturesResident( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - residences - ) ); - __glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_CopyTexImage1D(GLbyte * pc) -{ - CALL_CopyTexImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ) - ) ); -} - -void __glXDispSwap_CopyTexImage2D(GLbyte * pc) -{ - CALL_CopyTexImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ) - ) ); -} - -void __glXDispSwap_CopyTexSubImage1D(GLbyte * pc) -{ - CALL_CopyTexSubImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ) - ) ); -} - -void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc) -{ - CALL_CopyTexSubImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ) - ) ); -} - -int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteTextures( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - (void) bswap_32_array( (uint32_t *) textures, n ); - __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenTextures( GET_DISPATCH(), ( - n, - textures - ) ); - (void) bswap_32_array( (uint32_t *) textures, n ); - __glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsTexture( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_PrioritizeTextures(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_PrioritizeTextures( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - (const GLclampf *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_TexSubImage1D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexSubImage1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 36 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_TexSubImage2D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 52); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 56); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexSubImage2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLint )bswap_CARD32 ( pc + 28 ), - (GLint )bswap_CARD32 ( pc + 32 ), - (GLsizei )bswap_CARD32 ( pc + 36 ), - (GLsizei )bswap_CARD32 ( pc + 40 ), - (GLenum )bswap_ENUM ( pc + 44 ), - (GLenum )bswap_ENUM ( pc + 48 ), - pixels - ) ); -} - -void __glXDispSwap_BlendColor(GLbyte * pc) -{ - CALL_BlendColor( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - (GLclampf)bswap_FLOAT32( pc + 4 ), - (GLclampf)bswap_FLOAT32( pc + 8 ), - (GLclampf)bswap_FLOAT32( pc + 12 ) - ) ); -} - -void __glXDispSwap_BlendEquation(GLbyte * pc) -{ - CALL_BlendEquation( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ColorTable(GLbyte * pc) -{ - const GLvoid * const table = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ColorTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - (GLenum )bswap_ENUM ( pc + 36 ), - table - ) ); -} - -void __glXDispSwap_ColorTableParameterfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameterfv_size(pname) ); - - CALL_ColorTableParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_ColorTableParameteriv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glColorTableParameteriv_size(pname) ); - - CALL_ColorTableParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_CopyColorTable(GLbyte * pc) -{ - CALL_CopyColorTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ) - ) ); -} - -int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetColorTableParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetColorTableParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_ColorSubTable(GLbyte * pc) -{ - const GLvoid * const data = (const GLvoid *) (pc + 40); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ColorSubTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - (GLenum )bswap_ENUM ( pc + 36 ), - data - ) ); -} - -void __glXDispSwap_CopyColorSubTable(GLbyte * pc) -{ - CALL_CopyColorSubTable( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLsizei )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_ConvolutionFilter1D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ConvolutionFilter1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 36 ), - (GLenum )bswap_ENUM ( pc + 40 ), - image - ) ); -} - -void __glXDispSwap_ConvolutionFilter2D(GLbyte * pc) -{ - const GLvoid * const image = (const GLvoid *) (pc + 44); - __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_ConvolutionFilter2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ), - (GLenum )bswap_ENUM ( pc + 36 ), - (GLenum )bswap_ENUM ( pc + 40 ), - image - ) ); -} - -void __glXDispSwap_ConvolutionParameterf(GLbyte * pc) -{ - CALL_ConvolutionParameterf( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLfloat )bswap_FLOAT32( pc + 8 ) - ) ); -} - -void __glXDispSwap_ConvolutionParameterfv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameterfv_size(pname) ); - - CALL_ConvolutionParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_ConvolutionParameteri(GLbyte * pc) -{ - CALL_ConvolutionParameteri( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ) - ) ); -} - -void __glXDispSwap_ConvolutionParameteriv(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 8), __glConvolutionParameteriv_size(pname) ); - - CALL_ConvolutionParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); -} - -void __glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter1D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc) -{ - CALL_CopyConvolutionFilter2D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ) - ) ); -} - -int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetConvolutionParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetConvolutionParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetHistogramParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetHistogramParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameterfv_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameterfv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetMinmaxParameteriv_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetMinmaxParameteriv( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_Histogram(GLbyte * pc) -{ - CALL_Histogram( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLsizei )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - *(GLboolean *)(pc + 12) - ) ); -} - -void __glXDispSwap_Minmax(GLbyte * pc) -{ - CALL_Minmax( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - *(GLboolean *)(pc + 8) - ) ); -} - -void __glXDispSwap_ResetHistogram(GLbyte * pc) -{ - CALL_ResetHistogram( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_ResetMinmax(GLbyte * pc) -{ - CALL_ResetMinmax( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_TexImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 76); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 80); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexImage3D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 36 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLint )bswap_CARD32 ( pc + 44 ), - (GLsizei )bswap_CARD32 ( pc + 48 ), - (GLsizei )bswap_CARD32 ( pc + 52 ), - (GLsizei )bswap_CARD32 ( pc + 56 ), - (GLint )bswap_CARD32 ( pc + 64 ), - (GLenum )bswap_ENUM ( pc + 68 ), - (GLenum )bswap_ENUM ( pc + 72 ), - pixels - ) ); -} - -void __glXDispSwap_TexSubImage3D(GLbyte * pc) -{ - const CARD32 ptr_is_null = *(CARD32 *)(pc + 84); - const GLvoid * const pixels = (const GLvoid *) (ptr_is_null != 0) ? NULL : (pc + 88); - __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc); - - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) bswap_CARD32( & hdr->rowLength )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) bswap_CARD32( & hdr->imageHeight )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) bswap_CARD32( & hdr->skipRows )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) bswap_CARD32( & hdr->skipImages )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) bswap_CARD32( & hdr->skipPixels )) ); - CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) bswap_CARD32( & hdr->alignment )) ); - - CALL_TexSubImage3D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 36 ), - (GLint )bswap_CARD32 ( pc + 40 ), - (GLint )bswap_CARD32 ( pc + 44 ), - (GLint )bswap_CARD32 ( pc + 48 ), - (GLint )bswap_CARD32 ( pc + 52 ), - (GLsizei )bswap_CARD32 ( pc + 60 ), - (GLsizei )bswap_CARD32 ( pc + 64 ), - (GLsizei )bswap_CARD32 ( pc + 68 ), - (GLenum )bswap_ENUM ( pc + 76 ), - (GLenum )bswap_ENUM ( pc + 80 ), - pixels - ) ); -} - -void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc) -{ - CALL_CopyTexSubImage3D( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLsizei )bswap_CARD32 ( pc + 32 ) - ) ); -} - -void __glXDispSwap_ActiveTextureARB(GLbyte * pc) -{ - CALL_ActiveTextureARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_MultiTexCoord1dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 8 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord1fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord1ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord1svARB(GLbyte * pc) -{ - CALL_MultiTexCoord1svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_MultiTexCoord2dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 16 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord2fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord2ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord2svARB(GLbyte * pc) -{ - CALL_MultiTexCoord2svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_MultiTexCoord3dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 24 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord3fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord3ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord3svARB(GLbyte * pc) -{ - CALL_MultiTexCoord3svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_MultiTexCoord4dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 32 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc) -{ - CALL_MultiTexCoord4fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc) -{ - CALL_MultiTexCoord4ivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_MultiTexCoord4svARB(GLbyte * pc) -{ - CALL_MultiTexCoord4svARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_SampleCoverageARB(GLbyte * pc) -{ - CALL_SampleCoverageARB( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDispSwap_CompressedTexImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 ); - - CALL_CompressedTexImage1DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDispSwap_CompressedTexImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 24 ); - - CALL_CompressedTexImage2DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ), - imageSize, - (const GLvoid *)(pc + 28) - ) ); -} - -void __glXDispSwap_CompressedTexImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 ); - - CALL_CompressedTexImage3DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLint )bswap_CARD32 ( pc + 24 ), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDispSwap_CompressedTexSubImage1DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 20 ); - - CALL_CompressedTexSubImage1DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ), - (GLenum )bswap_ENUM ( pc + 16 ), - imageSize, - (const GLvoid *)(pc + 24) - ) ); -} - -void __glXDispSwap_CompressedTexSubImage2DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 28 ); - - CALL_CompressedTexSubImage2DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLsizei )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLenum )bswap_ENUM ( pc + 24 ), - imageSize, - (const GLvoid *)(pc + 32) - ) ); -} - -void __glXDispSwap_CompressedTexSubImage3DARB(GLbyte * pc) -{ - const GLsizei imageSize = (GLsizei )bswap_CARD32 ( pc + 36 ); - - CALL_CompressedTexSubImage3DARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ), - (GLint )bswap_CARD32 ( pc + 8 ), - (GLint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLsizei )bswap_CARD32 ( pc + 20 ), - (GLsizei )bswap_CARD32 ( pc + 24 ), - (GLsizei )bswap_CARD32 ( pc + 28 ), - (GLenum )bswap_ENUM ( pc + 32 ), - imageSize, - (const GLvoid *)(pc + 40) - ) ); -} - -int __glXDispSwap_GetProgramEnvParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramEnvParameterdvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramEnvParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramEnvParameterfvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramLocalParameterdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramLocalParameterdvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramLocalParameterfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramLocalParameterfvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetProgramivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribdvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribdvARB_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribfvARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribfvARB_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_ProgramEnvParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramEnvParameter4dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramEnvParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramEnvParameter4fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramLocalParameter4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 40); - pc -= 4; - } -#endif - - CALL_ProgramLocalParameter4dvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramLocalParameter4fvARB(GLbyte * pc) -{ - CALL_ProgramLocalParameter4fvARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_ProgramStringARB(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 ); - - CALL_ProgramStringARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - len, - (const GLvoid *)(pc + 12) - ) ); -} - -void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc) -{ - CALL_VertexAttrib1fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1svARB(GLbyte * pc) -{ - CALL_VertexAttrib1svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2fvARB(GLbyte * pc) -{ - CALL_VertexAttrib2fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2svARB(GLbyte * pc) -{ - CALL_VertexAttrib2svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3fvARB(GLbyte * pc) -{ - CALL_VertexAttrib3fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3svARB(GLbyte * pc) -{ - CALL_VertexAttrib3svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NbvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NbvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4NivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NsvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NsvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NubvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4NuivARB(GLbyte * pc) -{ - CALL_VertexAttrib4NuivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4NusvARB(GLbyte * pc) -{ - CALL_VertexAttrib4NusvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4bvARB(GLbyte * pc) -{ - CALL_VertexAttrib4bvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLbyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4dvARB(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4fvARB(GLbyte * pc) -{ - CALL_VertexAttrib4fvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4ivARB(GLbyte * pc) -{ - CALL_VertexAttrib4ivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4svARB(GLbyte * pc) -{ - CALL_VertexAttrib4svARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4ubvARB(GLbyte * pc) -{ - CALL_VertexAttrib4ubvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc) -{ - CALL_VertexAttrib4uivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4usvARB(GLbyte * pc) -{ - CALL_VertexAttrib4usvARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_BeginQueryARB(GLbyte * pc) -{ - CALL_BeginQueryARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_DeleteQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteQueriesARB( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -void __glXDispSwap_EndQueryARB(GLbyte * pc) -{ - CALL_EndQueryARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -int __glXDispSwap_GenQueriesARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * ids = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenQueriesARB( GET_DISPATCH(), ( - n, - ids - ) ); - (void) bswap_32_array( (uint32_t *) ids, n ); - __glXSendReplySwap(cl->client, ids, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetQueryObjectivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetQueryObjectivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetQueryObjectuivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetQueryObjectuivARB_size(pname); - GLuint answerBuffer[200]; - GLuint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryObjectuivARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetQueryivARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetQueryivARB_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetQueryivARB( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsQueryARB(__GLXclientState *cl, GLbyte *pc) -{ - xGLXSingleReq * const req = (xGLXSingleReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_SINGLE_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsQueryARB( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_DrawBuffersARB(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DrawBuffersARB( GET_DISPATCH(), ( - n, - (const GLenum *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_SampleMaskSGIS(GLbyte * pc) -{ - CALL_SampleMaskSGIS( GET_DISPATCH(), ( - (GLclampf)bswap_FLOAT32( pc + 0 ), - *(GLboolean *)(pc + 4) - ) ); -} - -void __glXDispSwap_SamplePatternSGIS(GLbyte * pc) -{ - CALL_SamplePatternSGIS( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -void __glXDispSwap_PointParameterfEXT(GLbyte * pc) -{ - CALL_PointParameterfEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLfloat )bswap_FLOAT32( pc + 4 ) - ) ); -} - -void __glXDispSwap_PointParameterfvEXT(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLfloat * params; - - params = (const GLfloat *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterfvEXT_size(pname) ); - - CALL_PointParameterfvEXT( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_SecondaryColor3bvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3bvEXT( GET_DISPATCH(), ( - (const GLbyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_SecondaryColor3dvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 24); - pc -= 4; - } -#endif - - CALL_SecondaryColor3dvEXT( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3fvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3fvEXT( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3ivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ivEXT( GET_DISPATCH(), ( - (const GLint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3svEXT(GLbyte * pc) -{ - CALL_SecondaryColor3svEXT( GET_DISPATCH(), ( - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3ubvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3ubvEXT( GET_DISPATCH(), ( - (const GLubyte *)(pc + 0) - ) ); -} - -void __glXDispSwap_SecondaryColor3uivEXT(GLbyte * pc) -{ - CALL_SecondaryColor3uivEXT( GET_DISPATCH(), ( - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_SecondaryColor3usvEXT(GLbyte * pc) -{ - CALL_SecondaryColor3usvEXT( GET_DISPATCH(), ( - (const GLushort *)bswap_16_array( (uint16_t *) (pc + 0), 3 ) - ) ); -} - -void __glXDispSwap_FogCoorddvEXT(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 8); - pc -= 4; - } -#endif - - CALL_FogCoorddvEXT( GET_DISPATCH(), ( - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_FogCoordfvEXT(GLbyte * pc) -{ - CALL_FogCoordfvEXT( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 1 ) - ) ); -} - -void __glXDispSwap_BlendFuncSeparateEXT(GLbyte * pc) -{ - CALL_BlendFuncSeparateEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLenum )bswap_ENUM ( pc + 12 ) - ) ); -} - -void __glXDispSwap_WindowPos3fvMESA(GLbyte * pc) -{ - CALL_WindowPos3fvMESA( GET_DISPATCH(), ( - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 0), 3 ) - ) ); -} - -int __glXDispSwap_AreProgramsResidentNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLboolean retval; - GLboolean answerBuffer[200]; - GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1); - retval = CALL_AreProgramsResidentNV( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ), - residences - ) ); - __glXSendReplySwap(cl->client, residences, n, 1, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_BindProgramNV(GLbyte * pc) -{ - CALL_BindProgramNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_DeleteProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); - error = Success; - } - - return error; -} - -void __glXDispSwap_ExecuteProgramNV(GLbyte * pc) -{ - CALL_ExecuteProgramNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -int __glXDispSwap_GenProgramsNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * programs = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenProgramsNV( GET_DISPATCH(), ( - n, - programs - ) ); - (void) bswap_32_array( (uint32_t *) programs, n ); - __glXSendReplySwap(cl->client, programs, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLdouble params[4]; - CALL_GetProgramParameterdvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLfloat params[4]; - CALL_GetProgramParameterfvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetProgramivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetProgramivNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetTrackMatrixivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetTrackMatrixivNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 1 ); - __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribdvNV_size(pname); - GLdouble answerBuffer[200]; - GLdouble * params = __glXGetAnswerBuffer(cl, compsize * 8, answerBuffer, sizeof(answerBuffer), 8); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribdvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_64_array( (uint64_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 8, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribfvNV_size(pname); - GLfloat answerBuffer[200]; - GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribfvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetVertexAttribivNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 ); - - const GLuint compsize = __glGetVertexAttribivNV_size(pname); - GLint answerBuffer[200]; - GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4); - - if (params == NULL) return BadAlloc; - __glXClearErrorOccured(); - - CALL_GetVertexAttribivNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - pname, - params - ) ); - (void) bswap_32_array( (uint32_t *) params, compsize ); - __glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsProgramNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsProgramNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_LoadProgramNV(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 8 ); - - CALL_LoadProgramNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - len, - (const GLubyte *)(pc + 12) - ) ); -} - -void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc) -{ - const GLuint num = (GLuint )bswap_CARD32 ( pc + 8 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 16 + __GLX_PAD((num * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramParameters4dvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - num, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 12), 0 ) - ) ); -} - -void __glXDispSwap_ProgramParameters4fvNV(GLbyte * pc) -{ - const GLuint num = (GLuint )bswap_CARD32 ( pc + 8 ); - - CALL_ProgramParameters4fvNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - num, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 12), 0 ) - ) ); -} - -void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_RequestResidentProgramsNV( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_TrackMatrixNV(GLbyte * pc) -{ - CALL_TrackMatrixNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLenum )bswap_ENUM ( pc + 12 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 12); - pc -= 4; - } -#endif - - CALL_VertexAttrib1dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1fvNV(GLbyte * pc) -{ - CALL_VertexAttrib1fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib1svNV(GLbyte * pc) -{ - CALL_VertexAttrib1svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 1 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 20); - pc -= 4; - } -#endif - - CALL_VertexAttrib2dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2fvNV(GLbyte * pc) -{ - CALL_VertexAttrib2fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib2svNV(GLbyte * pc) -{ - CALL_VertexAttrib2svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 2 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 28); - pc -= 4; - } -#endif - - CALL_VertexAttrib3dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3fvNV(GLbyte * pc) -{ - CALL_VertexAttrib3fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib3svNV(GLbyte * pc) -{ - CALL_VertexAttrib3svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 3 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4dvNV(GLbyte * pc) -{ -#ifdef __GLX_ALIGN64 - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, 36); - pc -= 4; - } -#endif - - CALL_VertexAttrib4dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4fvNV(GLbyte * pc) -{ - CALL_VertexAttrib4fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4svNV(GLbyte * pc) -{ - CALL_VertexAttrib4svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 4), 4 ) - ) ); -} - -void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc) -{ - CALL_VertexAttrib4ubvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - (const GLubyte *)(pc + 4) - ) ); -} - -void __glXDispSwap_VertexAttribs1dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 8)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs1dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs1fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs1fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs1svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs1svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs2dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 16)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs2dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs2fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs2fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs2svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs2svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs3dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 24)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs3dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs3fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs3fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs3svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs3svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 12 + __GLX_PAD((n * 32)) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_VertexAttribs4dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4fvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs4fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs4svNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLshort *)bswap_16_array( (uint16_t *) (pc + 8), 0 ) - ) ); -} - -void __glXDispSwap_VertexAttribs4ubvNV(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_VertexAttribs4ubvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - n, - (const GLubyte *)(pc + 8) - ) ); -} - -void __glXDispSwap_PointParameteriNV(GLbyte * pc) -{ - CALL_PointParameteriNV( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_PointParameterivNV(GLbyte * pc) -{ - const GLenum pname = (GLenum )bswap_ENUM ( pc + 0 ); - const GLint * params; - - params = (const GLint *) bswap_32_array( (uint32_t *) (pc + 4), __glPointParameterivNV_size(pname) ); - - CALL_PointParameterivNV( GET_DISPATCH(), ( - pname, - params - ) ); -} - -void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc) -{ - CALL_ActiveStencilFaceEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -int __glXDispSwap_GetProgramNamedParameterdvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); - - GLdouble params[4]; - CALL_GetProgramNamedParameterdvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - len, - (const GLubyte *)(pc + 8), - params - ) ); - (void) bswap_64_array( (uint64_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 8, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetProgramNamedParameterfvNV(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); - - GLfloat params[4]; - CALL_GetProgramNamedParameterfvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - len, - (const GLubyte *)(pc + 8), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 4 ); - __glXSendReplySwap(cl->client, params, 4, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_ProgramNamedParameter4dvNV(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 36 ); - -#ifdef __GLX_ALIGN64 - const GLuint cmdlen = 44 + __GLX_PAD(len) - 4; - if ((unsigned long)(pc) & 7) { - (void) memmove(pc-4, pc, cmdlen); - pc -= 4; - } -#endif - - CALL_ProgramNamedParameter4dvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 32 ), - len, - (const GLubyte *)(pc + 40), - (const GLdouble *)bswap_64_array( (uint64_t *) (pc + 0), 4 ) - ) ); -} - -void __glXDispSwap_ProgramNamedParameter4fvNV(GLbyte * pc) -{ - const GLsizei len = (GLsizei )bswap_CARD32 ( pc + 4 ); - - CALL_ProgramNamedParameter4fvNV( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ), - len, - (const GLubyte *)(pc + 24), - (const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 ) - ) ); -} - -void __glXDispSwap_BlendEquationSeparateEXT(GLbyte * pc) -{ - CALL_BlendEquationSeparateEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ) - ) ); -} - -void __glXDispSwap_BindFramebufferEXT(GLbyte * pc) -{ - CALL_BindFramebufferEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc) -{ - CALL_BindRenderbufferEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLuint )bswap_CARD32 ( pc + 4 ) - ) ); -} - -int __glXDispSwap_CheckFramebufferStatusEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLenum retval; - retval = CALL_CheckFramebufferStatusEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_DeleteFramebuffersEXT(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteFramebuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_DeleteRenderbuffersEXT(GLbyte * pc) -{ - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - CALL_DeleteRenderbuffersEXT( GET_DISPATCH(), ( - n, - (const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ) - ) ); -} - -void __glXDispSwap_FramebufferRenderbufferEXT(GLbyte * pc) -{ - CALL_FramebufferRenderbufferEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ) - ) ); -} - -void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture1DEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_FramebufferTexture2DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture2DEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ) - ) ); -} - -void __glXDispSwap_FramebufferTexture3DEXT(GLbyte * pc) -{ - CALL_FramebufferTexture3DEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - (GLuint )bswap_CARD32 ( pc + 12 ), - (GLint )bswap_CARD32 ( pc + 16 ), - (GLint )bswap_CARD32 ( pc + 20 ) - ) ); -} - -int __glXDispSwap_GenFramebuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * framebuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenFramebuffersEXT( GET_DISPATCH(), ( - n, - framebuffers - ) ); - (void) bswap_32_array( (uint32_t *) framebuffers, n ); - __glXSendReplySwap(cl->client, framebuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GenRenderbuffersEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); - - GLuint answerBuffer[200]; - GLuint * renderbuffers = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4); - CALL_GenRenderbuffersEXT( GET_DISPATCH(), ( - n, - renderbuffers - ) ); - (void) bswap_32_array( (uint32_t *) renderbuffers, n ); - __glXSendReplySwap(cl->client, renderbuffers, n, 4, GL_TRUE, 0); - error = Success; - } - - return error; -} - -void __glXDispSwap_GenerateMipmapEXT(GLbyte * pc) -{ - CALL_GenerateMipmapEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ) - ) ); -} - -int __glXDispSwap_GetFramebufferAttachmentParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetFramebufferAttachmentParameterivEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLenum )bswap_ENUM ( pc + 8 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 1 ); - __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_GetRenderbufferParameterivEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLint params[1]; - CALL_GetRenderbufferParameterivEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - params - ) ); - (void) bswap_32_array( (uint32_t *) params, 1 ); - __glXSendReplySwap(cl->client, params, 1, 4, GL_FALSE, 0); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsFramebufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsFramebufferEXT( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -int __glXDispSwap_IsRenderbufferEXT(__GLXclientState *cl, GLbyte *pc) -{ - xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; - int error; - __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error); - - pc += __GLX_VENDPRIV_HDR_SIZE; - if ( cx != NULL ) { - GLboolean retval; - retval = CALL_IsRenderbufferEXT( GET_DISPATCH(), ( - (GLuint )bswap_CARD32 ( pc + 0 ) - ) ); - __glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval); - error = Success; - } - - return error; -} - -void __glXDispSwap_RenderbufferStorageEXT(GLbyte * pc) -{ - CALL_RenderbufferStorageEXT( GET_DISPATCH(), ( - (GLenum )bswap_ENUM ( pc + 0 ), - (GLenum )bswap_ENUM ( pc + 4 ), - (GLsizei )bswap_CARD32 ( pc + 8 ), - (GLsizei )bswap_CARD32 ( pc + 12 ) - ) ); -} - diff --git a/GL/glx/indirect_reqsize.c b/GL/glx/indirect_reqsize.c deleted file mode 100644 index 954eecd97..000000000 --- a/GL/glx/indirect_reqsize.c +++ /dev/null @@ -1,832 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2005 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - - -#include <GL/gl.h> -#include "glxserver.h" -#include "glxbyteorder.h" -#include "indirect_size.h" -#include "indirect_reqsize.h" - -#define __GLX_PAD(x) (((x) + 3) & ~3) - -#if defined(__CYGWIN__) || defined(__MINGW32__) -# undef HAVE_ALIAS -#endif -#ifdef HAVE_ALIAS -# define ALIAS2(from,to) \ - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ - __attribute__ ((alias( # to ))); -# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize ) -#else -# define ALIAS(from,to) \ - GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \ - { return __glX ## to ## ReqSize( pc, swap ); } -#endif - - -int -__glXCallListsReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 0); - GLenum type = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - n = bswap_32(n); - type = bswap_32(type); - } - - compsize = __glCallLists_size(type); - return __GLX_PAD((compsize * n)); -} - -int -__glXBitmapReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLsizei width = *(GLsizei *) (pc + 20); - GLsizei height = *(GLsizei *) (pc + 24); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - width = bswap_32(width); - height = bswap_32(height); - } - - return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXFogfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glFogfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXLightfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glLightfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXLightModelfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glLightModelfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXMaterialfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glMaterialfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - } - - return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexParameterfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXTexImage1DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 32); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexImage2DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 32); - GLsizei height = *(GLsizei *) (pc + 36); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexEnvfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXTexGendvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexGendv_size(pname); - return __GLX_PAD((compsize * 8)); -} - -int -__glXTexGenfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glTexGenfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei mapsize = *(GLsizei *) (pc + 4); - - if (swap) { - mapsize = bswap_32(mapsize); - } - - return __GLX_PAD((mapsize * 4)); -} - -int -__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei mapsize = *(GLsizei *) (pc + 4); - - if (swap) { - mapsize = bswap_32(mapsize); - } - - return __GLX_PAD((mapsize * 2)); -} - -int -__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLsizei width = *(GLsizei *) (pc + 20); - GLsizei height = *(GLsizei *) (pc + 24); - GLenum format = *(GLenum *) (pc + 28); - GLenum type = *(GLenum *) (pc + 32); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, 0, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 0); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 4) + (n * 4)); -} - -int -__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 36); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 36); - GLsizei height = *(GLsizei *) (pc + 40); - GLenum format = *(GLenum *) (pc + 44); - GLenum type = *(GLenum *) (pc + 48); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXColorTableReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 28); - GLenum format = *(GLenum *) (pc + 32); - GLenum type = *(GLenum *) (pc + 36); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glColorTableParameterfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXColorSubTableReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei count = *(GLsizei *) (pc + 28); - GLenum format = *(GLenum *) (pc + 32); - GLenum type = *(GLenum *) (pc + 36); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - count = bswap_32(count); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, count, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 28); - GLenum format = *(GLenum *) (pc + 36); - GLenum type = *(GLenum *) (pc + 40); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, 1, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = *(GLint *) (pc + 8); - GLint alignment = *(GLint *) (pc + 16); - GLenum target = *(GLenum *) (pc + 20); - GLsizei width = *(GLsizei *) (pc + 28); - GLsizei height = *(GLsizei *) (pc + 32); - GLenum format = *(GLenum *) (pc + 36); - GLenum type = *(GLenum *) (pc + 40); - - if (swap) { - row_length = bswap_32(row_length); - skip_rows = bswap_32(skip_rows); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, 1, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 4); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glConvolutionParameterfv_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXTexImage3DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = *(GLint *) (pc + 8); - GLint skip_rows = *(GLint *) (pc + 16); - GLint skip_images = *(GLint *) (pc + 20); - GLint alignment = *(GLint *) (pc + 32); - GLenum target = *(GLenum *) (pc + 36); - GLsizei width = *(GLsizei *) (pc + 48); - GLsizei height = *(GLsizei *) (pc + 52); - GLsizei depth = *(GLsizei *) (pc + 56); - GLenum format = *(GLenum *) (pc + 68); - GLenum type = *(GLenum *) (pc + 72); - - if (swap) { - row_length = bswap_32(row_length); - image_height = bswap_32(image_height); - skip_rows = bswap_32(skip_rows); - skip_images = bswap_32(skip_images); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - depth = bswap_32(depth); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, depth, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap) -{ - GLint row_length = *(GLint *) (pc + 4); - GLint image_height = *(GLint *) (pc + 8); - GLint skip_rows = *(GLint *) (pc + 16); - GLint skip_images = *(GLint *) (pc + 20); - GLint alignment = *(GLint *) (pc + 32); - GLenum target = *(GLenum *) (pc + 36); - GLsizei width = *(GLsizei *) (pc + 60); - GLsizei height = *(GLsizei *) (pc + 64); - GLsizei depth = *(GLsizei *) (pc + 68); - GLenum format = *(GLenum *) (pc + 76); - GLenum type = *(GLenum *) (pc + 80); - - if (swap) { - row_length = bswap_32(row_length); - image_height = bswap_32(image_height); - skip_rows = bswap_32(skip_rows); - skip_images = bswap_32(skip_images); - alignment = bswap_32(alignment); - target = bswap_32(target); - width = bswap_32(width); - height = bswap_32(height); - depth = bswap_32(depth); - format = bswap_32(format); - type = bswap_32(type); - } - - return __glXImageSize(format, type, target, width, height, depth, - image_height, row_length, skip_images, - skip_rows, alignment); -} - -int -__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 20); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 24); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 28); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei imageSize = *(GLsizei *) (pc + 36); - - if (swap) { - imageSize = bswap_32(imageSize); - } - - return __GLX_PAD(imageSize); -} - -int -__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei len = *(GLsizei *) (pc + 8); - - if (swap) { - len = bswap_32(len); - } - - return __GLX_PAD(len); -} - -int -__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 0); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 4)); -} - -int -__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) -{ - GLenum pname = *(GLenum *) (pc + 0); - GLsizei compsize; - - if (swap) { - pname = bswap_32(pname); - } - - compsize = __glPointParameterfvEXT_size(pname); - return __GLX_PAD((compsize * 4)); -} - -int -__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLuint num = *(GLuint *) (pc + 8); - - if (swap) { - num = bswap_32(num); - } - - return __GLX_PAD((num * 32)); -} - -int -__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLuint num = *(GLuint *) (pc + 8); - - if (swap) { - num = bswap_32(num); - } - - return __GLX_PAD((num * 16)); -} - -int -__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 8)); -} - -int -__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 16)); -} - -int -__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 24)); -} - -int -__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 12)); -} - -int -__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 6)); -} - -int -__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei n = *(GLsizei *) (pc + 4); - - if (swap) { - n = bswap_32(n); - } - - return __GLX_PAD((n * 32)); -} - -int -__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap) -{ - GLsizei len = *(GLsizei *) (pc + 4); - - if (swap) { - len = bswap_32(len); - } - - return __GLX_PAD(len); -} - -ALIAS(Fogiv, Fogfv) - ALIAS(Lightiv, Lightfv) - ALIAS(LightModeliv, LightModelfv) - ALIAS(Materialiv, Materialfv) - ALIAS(TexParameteriv, TexParameterfv) - ALIAS(TexEnviv, TexEnvfv) - ALIAS(TexGeniv, TexGenfv) - ALIAS(PixelMapuiv, PixelMapfv) - ALIAS(ColorTableParameteriv, ColorTableParameterfv) - ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) - ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB) - ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB) - ALIAS(LoadProgramNV, ProgramStringARB) - ALIAS(RequestResidentProgramsNV, DrawBuffersARB) - ALIAS(VertexAttribs1fvNV, PixelMapfv) - ALIAS(VertexAttribs1svNV, PixelMapusv) - ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV) - ALIAS(VertexAttribs2svNV, PixelMapfv) - ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV) - ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV) - ALIAS(VertexAttribs4ubvNV, PixelMapfv) - ALIAS(PointParameterivNV, PointParameterfvEXT) - ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB) - ALIAS(DeleteFramebuffersEXT, DrawBuffersARB) - ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB) diff --git a/GL/glx/indirect_reqsize.h b/GL/glx/indirect_reqsize.h deleted file mode 100644 index 26211ee5c..000000000 --- a/GL/glx/indirect_reqsize.h +++ /dev/null @@ -1,121 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2005 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - -#if !defined( _INDIRECT_REQSIZE_H_ ) -# define _INDIRECT_REQSIZE_H_ - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define HIDDEN __attribute__((visibility("hidden"))) -# else -# define HIDDEN -# endif - -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define PURE __attribute__((pure)) -# else -# define PURE -# endif - -extern PURE HIDDEN int __glXCallListsReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXBitmapReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXFogfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXFogivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightModelfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLightModelivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMaterialfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMaterialivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexParameterivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexImage1DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexImage2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexEnvivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexGendvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexGenfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexGenivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap1dReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap1fReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap2dReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXMap2fReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPixelMapuivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawArraysReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorTableReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorTableParameterivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXColorSubTableReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXRequestResidentProgramsNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs1fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs1svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs2fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs2svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); - -# undef HIDDEN -# undef PURE - -#endif /* !defined( _INDIRECT_REQSIZE_H_ ) */ diff --git a/GL/glx/indirect_size_get.c b/GL/glx/indirect_size_get.c deleted file mode 100644 index f64fb7ece..000000000 --- a/GL/glx/indirect_size_get.c +++ /dev/null @@ -1,1200 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2004 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - - -#include <GL/gl.h> -#include "indirect_size_get.h" -#include "glxserver.h" -#include "indirect_util.h" -#include "indirect_size.h" - -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define PURE __attribute__((pure)) -# else -# define PURE -# endif - -# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) -# define FASTCALL __attribute__((fastcall)) -# else -# define FASTCALL -# endif - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define INTERNAL __attribute__((visibility("internal"))) -# else -# define INTERNAL -# endif - - -#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) -# undef HAVE_ALIAS -#endif -#ifdef HAVE_ALIAS -# define ALIAS2(from,to) \ - INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ - __attribute__ ((alias( # to ))); -# define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size ) -#else -# define ALIAS(from,to) \ - INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \ - { return __gl ## to ## _size( e ); } -#endif - - -INTERNAL PURE FASTCALL GLint -__glCallLists_size(GLenum e) -{ - switch (e) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - return 1; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - case GL_2_BYTES: - return 2; - case GL_3_BYTES: - return 3; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - case GL_4_BYTES: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glFogfv_size(GLenum e) -{ - switch (e) { - case GL_FOG_INDEX: - case GL_FOG_DENSITY: - case GL_FOG_START: - case GL_FOG_END: - case GL_FOG_MODE: - case GL_FOG_OFFSET_VALUE_SGIX: - case GL_FOG_DISTANCE_MODE_NV: - return 1; - case GL_FOG_COLOR: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glLightfv_size(GLenum e) -{ - switch (e) { - case GL_SPOT_EXPONENT: - case GL_SPOT_CUTOFF: - case GL_CONSTANT_ATTENUATION: - case GL_LINEAR_ATTENUATION: - case GL_QUADRATIC_ATTENUATION: - return 1; - case GL_SPOT_DIRECTION: - return 3; - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_POSITION: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glLightModelfv_size(GLenum e) -{ - switch (e) { - case GL_LIGHT_MODEL_LOCAL_VIEWER: - case GL_LIGHT_MODEL_TWO_SIDE: - case GL_LIGHT_MODEL_COLOR_CONTROL: -/* case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/ - return 1; - case GL_LIGHT_MODEL_AMBIENT: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glMaterialfv_size(GLenum e) -{ - switch (e) { - case GL_SHININESS: - return 1; - case GL_COLOR_INDEXES: - return 3; - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_EMISSION: - case GL_AMBIENT_AND_DIFFUSE: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glTexParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_MAG_FILTER: - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_PRIORITY: - case GL_TEXTURE_WRAP_R: - case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: -/* case GL_SHADOW_AMBIENT_SGIX:*/ - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_CLIPMAP_FRAME_SGIX: - case GL_TEXTURE_LOD_BIAS_S_SGIX: - case GL_TEXTURE_LOD_BIAS_T_SGIX: - case GL_TEXTURE_LOD_BIAS_R_SGIX: - case GL_GENERATE_MIPMAP: -/* case GL_GENERATE_MIPMAP_SGIS:*/ - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - case GL_TEXTURE_MAX_CLAMP_S_SGIX: - case GL_TEXTURE_MAX_CLAMP_T_SGIX: - case GL_TEXTURE_MAX_CLAMP_R_SGIX: - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - case GL_TEXTURE_LOD_BIAS: -/* case GL_TEXTURE_LOD_BIAS_EXT:*/ - case GL_DEPTH_TEXTURE_MODE: -/* case GL_DEPTH_TEXTURE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_MODE: -/* case GL_TEXTURE_COMPARE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_FUNC: -/* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ - case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: - return 1; - case GL_TEXTURE_CLIPMAP_CENTER_SGIX: - case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: - return 2; - case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: - return 3; - case GL_TEXTURE_BORDER_COLOR: - case GL_POST_TEXTURE_FILTER_BIAS_SGIX: - case GL_POST_TEXTURE_FILTER_SCALE_SGIX: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glTexEnvfv_size(GLenum e) -{ - switch (e) { - case GL_ALPHA_SCALE: - case GL_TEXTURE_ENV_MODE: - case GL_TEXTURE_LOD_BIAS: - case GL_COMBINE_RGB: - case GL_COMBINE_ALPHA: - case GL_RGB_SCALE: - case GL_SOURCE0_RGB: - case GL_SOURCE1_RGB: - case GL_SOURCE2_RGB: - case GL_SOURCE3_RGB_NV: - case GL_SOURCE0_ALPHA: - case GL_SOURCE1_ALPHA: - case GL_SOURCE2_ALPHA: - case GL_SOURCE3_ALPHA_NV: - case GL_OPERAND0_RGB: - case GL_OPERAND1_RGB: - case GL_OPERAND2_RGB: - case GL_OPERAND3_RGB_NV: - case GL_OPERAND0_ALPHA: - case GL_OPERAND1_ALPHA: - case GL_OPERAND2_ALPHA: - case GL_OPERAND3_ALPHA_NV: - case GL_COORD_REPLACE_ARB: -/* case GL_COORD_REPLACE_NV:*/ - return 1; - case GL_TEXTURE_ENV_COLOR: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glTexGendv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_GEN_MODE: - return 1; - case GL_OBJECT_PLANE: - case GL_EYE_PLANE: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glMap1d_size(GLenum e) -{ - switch (e) { - case GL_MAP1_INDEX: - case GL_MAP1_TEXTURE_COORD_1: - return 1; - case GL_MAP1_TEXTURE_COORD_2: - return 2; - case GL_MAP1_NORMAL: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_VERTEX_3: - return 3; - case GL_MAP1_COLOR_4: - case GL_MAP1_TEXTURE_COORD_4: - case GL_MAP1_VERTEX_4: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glMap2d_size(GLenum e) -{ - switch (e) { - case GL_MAP2_INDEX: - case GL_MAP2_TEXTURE_COORD_1: - return 1; - case GL_MAP2_TEXTURE_COORD_2: - return 2; - case GL_MAP2_NORMAL: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_VERTEX_3: - return 3; - case GL_MAP2_COLOR_4: - case GL_MAP2_TEXTURE_COORD_4: - case GL_MAP2_VERTEX_4: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetBooleanv_size(GLenum e) -{ - switch (e) { - case GL_CURRENT_INDEX: - case GL_CURRENT_RASTER_INDEX: - case GL_CURRENT_RASTER_POSITION_VALID: - case GL_CURRENT_RASTER_DISTANCE: - case GL_POINT_SMOOTH: - case GL_POINT_SIZE: - case GL_SMOOTH_POINT_SIZE_GRANULARITY: - case GL_LINE_SMOOTH: - case GL_LINE_WIDTH: - case GL_LINE_WIDTH_GRANULARITY: - case GL_LINE_STIPPLE: - case GL_LINE_STIPPLE_PATTERN: - case GL_LINE_STIPPLE_REPEAT: - case GL_LIST_MODE: - case GL_MAX_LIST_NESTING: - case GL_LIST_BASE: - case GL_LIST_INDEX: - case GL_POLYGON_SMOOTH: - case GL_POLYGON_STIPPLE: - case GL_EDGE_FLAG: - case GL_CULL_FACE: - case GL_CULL_FACE_MODE: - case GL_FRONT_FACE: - case GL_LIGHTING: - case GL_LIGHT_MODEL_LOCAL_VIEWER: - case GL_LIGHT_MODEL_TWO_SIDE: - case GL_SHADE_MODEL: - case GL_COLOR_MATERIAL_FACE: - case GL_COLOR_MATERIAL_PARAMETER: - case GL_COLOR_MATERIAL: - case GL_FOG: - case GL_FOG_INDEX: - case GL_FOG_DENSITY: - case GL_FOG_START: - case GL_FOG_END: - case GL_FOG_MODE: - case GL_DEPTH_TEST: - case GL_DEPTH_WRITEMASK: - case GL_DEPTH_CLEAR_VALUE: - case GL_DEPTH_FUNC: - case GL_STENCIL_TEST: - case GL_STENCIL_CLEAR_VALUE: - case GL_STENCIL_FUNC: - case GL_STENCIL_VALUE_MASK: - case GL_STENCIL_FAIL: - case GL_STENCIL_PASS_DEPTH_FAIL: - case GL_STENCIL_PASS_DEPTH_PASS: - case GL_STENCIL_REF: - case GL_STENCIL_WRITEMASK: - case GL_MATRIX_MODE: - case GL_NORMALIZE: - case GL_MODELVIEW_STACK_DEPTH: - case GL_PROJECTION_STACK_DEPTH: - case GL_TEXTURE_STACK_DEPTH: - case GL_ATTRIB_STACK_DEPTH: - case GL_CLIENT_ATTRIB_STACK_DEPTH: - case GL_ALPHA_TEST: - case GL_ALPHA_TEST_FUNC: - case GL_ALPHA_TEST_REF: - case GL_DITHER: - case GL_BLEND_DST: - case GL_BLEND_SRC: - case GL_BLEND: - case GL_LOGIC_OP_MODE: - case GL_LOGIC_OP: - case GL_AUX_BUFFERS: - case GL_DRAW_BUFFER: - case GL_READ_BUFFER: - case GL_SCISSOR_TEST: - case GL_INDEX_CLEAR_VALUE: - case GL_INDEX_WRITEMASK: - case GL_INDEX_MODE: - case GL_RGBA_MODE: - case GL_DOUBLEBUFFER: - case GL_STEREO: - case GL_RENDER_MODE: - case GL_PERSPECTIVE_CORRECTION_HINT: - case GL_POINT_SMOOTH_HINT: - case GL_LINE_SMOOTH_HINT: - case GL_POLYGON_SMOOTH_HINT: - case GL_FOG_HINT: - case GL_TEXTURE_GEN_S: - case GL_TEXTURE_GEN_T: - case GL_TEXTURE_GEN_R: - case GL_TEXTURE_GEN_Q: - case GL_PIXEL_MAP_I_TO_I: - case GL_PIXEL_MAP_I_TO_I_SIZE: - case GL_PIXEL_MAP_S_TO_S_SIZE: - case GL_PIXEL_MAP_I_TO_R_SIZE: - case GL_PIXEL_MAP_I_TO_G_SIZE: - case GL_PIXEL_MAP_I_TO_B_SIZE: - case GL_PIXEL_MAP_I_TO_A_SIZE: - case GL_PIXEL_MAP_R_TO_R_SIZE: - case GL_PIXEL_MAP_G_TO_G_SIZE: - case GL_PIXEL_MAP_B_TO_B_SIZE: - case GL_PIXEL_MAP_A_TO_A_SIZE: - case GL_UNPACK_SWAP_BYTES: - case GL_UNPACK_LSB_FIRST: - case GL_UNPACK_ROW_LENGTH: - case GL_UNPACK_SKIP_ROWS: - case GL_UNPACK_SKIP_PIXELS: - case GL_UNPACK_ALIGNMENT: - case GL_PACK_SWAP_BYTES: - case GL_PACK_LSB_FIRST: - case GL_PACK_ROW_LENGTH: - case GL_PACK_SKIP_ROWS: - case GL_PACK_SKIP_PIXELS: - case GL_PACK_ALIGNMENT: - case GL_MAP_COLOR: - case GL_MAP_STENCIL: - case GL_INDEX_SHIFT: - case GL_INDEX_OFFSET: - case GL_RED_SCALE: - case GL_RED_BIAS: - case GL_ZOOM_X: - case GL_ZOOM_Y: - case GL_GREEN_SCALE: - case GL_GREEN_BIAS: - case GL_BLUE_SCALE: - case GL_BLUE_BIAS: - case GL_ALPHA_SCALE: - case GL_ALPHA_BIAS: - case GL_DEPTH_SCALE: - case GL_DEPTH_BIAS: - case GL_MAX_EVAL_ORDER: - case GL_MAX_LIGHTS: - case GL_MAX_CLIP_PLANES: - case GL_MAX_TEXTURE_SIZE: - case GL_MAX_PIXEL_MAP_TABLE: - case GL_MAX_ATTRIB_STACK_DEPTH: - case GL_MAX_MODELVIEW_STACK_DEPTH: - case GL_MAX_NAME_STACK_DEPTH: - case GL_MAX_PROJECTION_STACK_DEPTH: - case GL_MAX_TEXTURE_STACK_DEPTH: - case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - case GL_SUBPIXEL_BITS: - case GL_INDEX_BITS: - case GL_RED_BITS: - case GL_GREEN_BITS: - case GL_BLUE_BITS: - case GL_ALPHA_BITS: - case GL_DEPTH_BITS: - case GL_STENCIL_BITS: - case GL_ACCUM_RED_BITS: - case GL_ACCUM_GREEN_BITS: - case GL_ACCUM_BLUE_BITS: - case GL_ACCUM_ALPHA_BITS: - case GL_NAME_STACK_DEPTH: - case GL_AUTO_NORMAL: - case GL_MAP1_COLOR_4: - case GL_MAP1_INDEX: - case GL_MAP1_NORMAL: - case GL_MAP1_TEXTURE_COORD_1: - case GL_MAP1_TEXTURE_COORD_2: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_TEXTURE_COORD_4: - case GL_MAP1_VERTEX_3: - case GL_MAP1_VERTEX_4: - case GL_MAP2_COLOR_4: - case GL_MAP2_INDEX: - case GL_MAP2_NORMAL: - case GL_MAP2_TEXTURE_COORD_1: - case GL_MAP2_TEXTURE_COORD_2: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_TEXTURE_COORD_4: - case GL_MAP2_VERTEX_3: - case GL_MAP2_VERTEX_4: - case GL_MAP1_GRID_SEGMENTS: - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_POLYGON_OFFSET_UNITS: - case GL_CLIP_PLANE0: - case GL_CLIP_PLANE1: - case GL_CLIP_PLANE2: - case GL_CLIP_PLANE3: - case GL_CLIP_PLANE4: - case GL_CLIP_PLANE5: - case GL_LIGHT0: - case GL_LIGHT1: - case GL_LIGHT2: - case GL_LIGHT3: - case GL_LIGHT4: - case GL_LIGHT5: - case GL_LIGHT6: - case GL_LIGHT7: - case GL_BLEND_EQUATION: -/* case GL_BLEND_EQUATION_EXT:*/ - case GL_CONVOLUTION_1D: - case GL_CONVOLUTION_2D: - case GL_SEPARABLE_2D: - case GL_MAX_CONVOLUTION_WIDTH: -/* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ - case GL_MAX_CONVOLUTION_HEIGHT: -/* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ - case GL_POST_CONVOLUTION_RED_SCALE: -/* case GL_POST_CONVOLUTION_RED_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_GREEN_SCALE: -/* case GL_POST_CONVOLUTION_GREEN_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_BLUE_SCALE: -/* case GL_POST_CONVOLUTION_BLUE_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_ALPHA_SCALE: -/* case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT:*/ - case GL_POST_CONVOLUTION_RED_BIAS: -/* case GL_POST_CONVOLUTION_RED_BIAS_EXT:*/ - case GL_POST_CONVOLUTION_GREEN_BIAS: -/* case GL_POST_CONVOLUTION_GREEN_BIAS_EXT:*/ - case GL_POST_CONVOLUTION_BLUE_BIAS: -/* case GL_POST_CONVOLUTION_BLUE_BIAS_EXT:*/ - case GL_POST_CONVOLUTION_ALPHA_BIAS: -/* case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT:*/ - case GL_HISTOGRAM: - case GL_MINMAX: - case GL_POLYGON_OFFSET_FACTOR: - case GL_RESCALE_NORMAL: -/* case GL_RESCALE_NORMAL_EXT:*/ - case GL_TEXTURE_BINDING_1D: - case GL_TEXTURE_BINDING_2D: - case GL_TEXTURE_BINDING_3D: - case GL_PACK_SKIP_IMAGES: - case GL_PACK_IMAGE_HEIGHT: - case GL_UNPACK_SKIP_IMAGES: - case GL_UNPACK_IMAGE_HEIGHT: - case GL_TEXTURE_3D: - case GL_VERTEX_ARRAY: - case GL_NORMAL_ARRAY: - case GL_COLOR_ARRAY: - case GL_INDEX_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - case GL_EDGE_FLAG_ARRAY: - case GL_VERTEX_ARRAY_SIZE: - case GL_VERTEX_ARRAY_TYPE: - case GL_VERTEX_ARRAY_STRIDE: - case GL_NORMAL_ARRAY_TYPE: - case GL_NORMAL_ARRAY_STRIDE: - case GL_COLOR_ARRAY_SIZE: - case GL_COLOR_ARRAY_TYPE: - case GL_COLOR_ARRAY_STRIDE: - case GL_INDEX_ARRAY_TYPE: - case GL_INDEX_ARRAY_STRIDE: - case GL_TEXTURE_COORD_ARRAY_SIZE: - case GL_TEXTURE_COORD_ARRAY_TYPE: - case GL_TEXTURE_COORD_ARRAY_STRIDE: - case GL_EDGE_FLAG_ARRAY_STRIDE: - case GL_MULTISAMPLE: -/* case GL_MULTISAMPLE_ARB:*/ - case GL_SAMPLE_ALPHA_TO_COVERAGE: -/* case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:*/ - case GL_SAMPLE_ALPHA_TO_ONE: -/* case GL_SAMPLE_ALPHA_TO_ONE_ARB:*/ - case GL_SAMPLE_COVERAGE: -/* case GL_SAMPLE_COVERAGE_ARB:*/ - case GL_SAMPLE_BUFFERS: -/* case GL_SAMPLE_BUFFERS_ARB:*/ - case GL_SAMPLES: -/* case GL_SAMPLES_ARB:*/ - case GL_SAMPLE_COVERAGE_VALUE: -/* case GL_SAMPLE_COVERAGE_VALUE_ARB:*/ - case GL_SAMPLE_COVERAGE_INVERT: -/* case GL_SAMPLE_COVERAGE_INVERT_ARB:*/ - case GL_COLOR_MATRIX_STACK_DEPTH: - case GL_MAX_COLOR_MATRIX_STACK_DEPTH: - case GL_POST_COLOR_MATRIX_RED_SCALE: - case GL_POST_COLOR_MATRIX_GREEN_SCALE: - case GL_POST_COLOR_MATRIX_BLUE_SCALE: - case GL_POST_COLOR_MATRIX_ALPHA_SCALE: - case GL_POST_COLOR_MATRIX_RED_BIAS: - case GL_POST_COLOR_MATRIX_GREEN_BIAS: - case GL_POST_COLOR_MATRIX_BLUE_BIAS: - case GL_POST_COLOR_MATRIX_ALPHA_BIAS: - case GL_BLEND_DST_RGB: - case GL_BLEND_SRC_RGB: - case GL_BLEND_DST_ALPHA: - case GL_BLEND_SRC_ALPHA: - case GL_COLOR_TABLE: - case GL_POST_CONVOLUTION_COLOR_TABLE: - case GL_POST_COLOR_MATRIX_COLOR_TABLE: - case GL_MAX_ELEMENTS_VERTICES: - case GL_MAX_ELEMENTS_INDICES: - case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: - case GL_OCCLUSION_TEST_HP: - case GL_OCCLUSION_TEST_RESULT_HP: - case GL_LIGHT_MODEL_COLOR_CONTROL: - case GL_CURRENT_FOG_COORD: - case GL_FOG_COORDINATE_ARRAY_TYPE: - case GL_FOG_COORDINATE_ARRAY_STRIDE: - case GL_FOG_COORD_ARRAY: - case GL_COLOR_SUM_ARB: - case GL_SECONDARY_COLOR_ARRAY_SIZE: - case GL_SECONDARY_COLOR_ARRAY_TYPE: - case GL_SECONDARY_COLOR_ARRAY_STRIDE: - case GL_SECONDARY_COLOR_ARRAY: - case GL_ACTIVE_TEXTURE: -/* case GL_ACTIVE_TEXTURE_ARB:*/ - case GL_CLIENT_ACTIVE_TEXTURE: -/* case GL_CLIENT_ACTIVE_TEXTURE_ARB:*/ - case GL_MAX_TEXTURE_UNITS: -/* case GL_MAX_TEXTURE_UNITS_ARB:*/ - case GL_TEXTURE_COMPRESSION_HINT: -/* case GL_TEXTURE_COMPRESSION_HINT_ARB:*/ - case GL_TEXTURE_RECTANGLE_ARB: -/* case GL_TEXTURE_RECTANGLE_NV:*/ - case GL_TEXTURE_BINDING_RECTANGLE_ARB: -/* case GL_TEXTURE_BINDING_RECTANGLE_NV:*/ - case GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB: -/* case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV:*/ - case GL_MAX_TEXTURE_LOD_BIAS: - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - case GL_MAX_SHININESS_NV: - case GL_MAX_SPOT_EXPONENT_NV: - case GL_TEXTURE_CUBE_MAP: -/* case GL_TEXTURE_CUBE_MAP_ARB:*/ - case GL_TEXTURE_BINDING_CUBE_MAP: -/* case GL_TEXTURE_BINDING_CUBE_MAP_ARB:*/ - case GL_MAX_CUBE_MAP_TEXTURE_SIZE: -/* case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:*/ - case GL_MULTISAMPLE_FILTER_HINT_NV: - case GL_FOG_DISTANCE_MODE_NV: - case GL_VERTEX_PROGRAM_ARB: - case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: - case GL_MAX_PROGRAM_MATRICES_ARB: - case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: - case GL_VERTEX_PROGRAM_POINT_SIZE_ARB: - case GL_VERTEX_PROGRAM_TWO_SIDE_ARB: - case GL_PROGRAM_ERROR_POSITION_ARB: - case GL_DEPTH_CLAMP_NV: - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: -/* case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:*/ - case GL_MAX_VERTEX_UNITS_ARB: - case GL_ACTIVE_VERTEX_UNITS_ARB: - case GL_WEIGHT_SUM_UNITY_ARB: - case GL_VERTEX_BLEND_ARB: - case GL_CURRENT_WEIGHT_ARB: - case GL_WEIGHT_ARRAY_TYPE_ARB: - case GL_WEIGHT_ARRAY_STRIDE_ARB: - case GL_WEIGHT_ARRAY_SIZE_ARB: - case GL_WEIGHT_ARRAY_ARB: - case GL_PACK_INVERT_MESA: - case GL_STENCIL_BACK_FUNC_ATI: - case GL_STENCIL_BACK_FAIL_ATI: - case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: - case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: - case GL_FRAGMENT_PROGRAM_ARB: - case GL_MAX_DRAW_BUFFERS_ARB: -/* case GL_MAX_DRAW_BUFFERS_ATI:*/ - case GL_DRAW_BUFFER0_ARB: -/* case GL_DRAW_BUFFER0_ATI:*/ - case GL_DRAW_BUFFER1_ARB: -/* case GL_DRAW_BUFFER1_ATI:*/ - case GL_DRAW_BUFFER2_ARB: -/* case GL_DRAW_BUFFER2_ATI:*/ - case GL_DRAW_BUFFER3_ARB: -/* case GL_DRAW_BUFFER3_ATI:*/ - case GL_DRAW_BUFFER4_ARB: -/* case GL_DRAW_BUFFER4_ATI:*/ - case GL_DRAW_BUFFER5_ARB: -/* case GL_DRAW_BUFFER5_ATI:*/ - case GL_DRAW_BUFFER6_ARB: -/* case GL_DRAW_BUFFER6_ATI:*/ - case GL_DRAW_BUFFER7_ARB: -/* case GL_DRAW_BUFFER7_ATI:*/ - case GL_DRAW_BUFFER8_ARB: -/* case GL_DRAW_BUFFER8_ATI:*/ - case GL_DRAW_BUFFER9_ARB: -/* case GL_DRAW_BUFFER9_ATI:*/ - case GL_DRAW_BUFFER10_ARB: -/* case GL_DRAW_BUFFER10_ATI:*/ - case GL_DRAW_BUFFER11_ARB: -/* case GL_DRAW_BUFFER11_ATI:*/ - case GL_DRAW_BUFFER12_ARB: -/* case GL_DRAW_BUFFER12_ATI:*/ - case GL_DRAW_BUFFER13_ARB: -/* case GL_DRAW_BUFFER13_ATI:*/ - case GL_DRAW_BUFFER14_ARB: -/* case GL_DRAW_BUFFER14_ATI:*/ - case GL_DRAW_BUFFER15_ARB: -/* case GL_DRAW_BUFFER15_ATI:*/ - case GL_BLEND_EQUATION_ALPHA_EXT: - case GL_MATRIX_PALETTE_ARB: - case GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB: - case GL_MAX_PALETTE_MATRICES_ARB: - case GL_CURRENT_PALETTE_MATRIX_ARB: - case GL_MATRIX_INDEX_ARRAY_ARB: - case GL_CURRENT_MATRIX_INDEX_ARB: - case GL_MATRIX_INDEX_ARRAY_SIZE_ARB: - case GL_MATRIX_INDEX_ARRAY_TYPE_ARB: - case GL_MATRIX_INDEX_ARRAY_STRIDE_ARB: - case GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT: - case GL_POINT_SPRITE_ARB: -/* case GL_POINT_SPRITE_NV:*/ - case GL_POINT_SPRITE_R_MODE_NV: - case GL_MAX_VERTEX_ATTRIBS_ARB: - case GL_MAX_TEXTURE_COORDS_ARB: - case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: - case GL_DEPTH_BOUNDS_TEST_EXT: - case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: - case GL_STENCIL_TEST_TWO_SIDE_EXT: - case GL_ACTIVE_STENCIL_FACE_EXT: - case GL_TEXTURE_BINDING_1D_ARRAY_EXT: - case GL_TEXTURE_BINDING_2D_ARRAY_EXT: - case GL_RASTER_POSITION_UNCLIPPED_IBM: - return 1; - case GL_SMOOTH_POINT_SIZE_RANGE: - case GL_LINE_WIDTH_RANGE: - case GL_POLYGON_MODE: - case GL_DEPTH_RANGE: - case GL_MAX_VIEWPORT_DIMS: - case GL_MAP1_GRID_DOMAIN: - case GL_MAP2_GRID_SEGMENTS: - case GL_ALIASED_POINT_SIZE_RANGE: - case GL_ALIASED_LINE_WIDTH_RANGE: - case GL_DEPTH_BOUNDS_EXT: - return 2; - case GL_CURRENT_NORMAL: - return 3; - case GL_CURRENT_COLOR: - case GL_CURRENT_TEXTURE_COORDS: - case GL_CURRENT_RASTER_COLOR: - case GL_CURRENT_RASTER_TEXTURE_COORDS: - case GL_CURRENT_RASTER_POSITION: - case GL_LIGHT_MODEL_AMBIENT: - case GL_FOG_COLOR: - case GL_ACCUM_CLEAR_VALUE: - case GL_VIEWPORT: - case GL_SCISSOR_BOX: - case GL_COLOR_CLEAR_VALUE: - case GL_COLOR_WRITEMASK: - case GL_MAP2_GRID_DOMAIN: - case GL_BLEND_COLOR: -/* case GL_BLEND_COLOR_EXT:*/ - case GL_CURRENT_SECONDARY_COLOR: - return 4; - case GL_MODELVIEW_MATRIX: - case GL_PROJECTION_MATRIX: - case GL_TEXTURE_MATRIX: - case GL_MODELVIEW0_ARB: - case GL_COLOR_MATRIX: - case GL_MODELVIEW1_ARB: - case GL_CURRENT_MATRIX_ARB: - case GL_MODELVIEW2_ARB: - case GL_MODELVIEW3_ARB: - case GL_MODELVIEW4_ARB: - case GL_MODELVIEW5_ARB: - case GL_MODELVIEW6_ARB: - case GL_MODELVIEW7_ARB: - case GL_MODELVIEW8_ARB: - case GL_MODELVIEW9_ARB: - case GL_MODELVIEW10_ARB: - case GL_MODELVIEW11_ARB: - case GL_MODELVIEW12_ARB: - case GL_MODELVIEW13_ARB: - case GL_MODELVIEW14_ARB: - case GL_MODELVIEW15_ARB: - case GL_MODELVIEW16_ARB: - case GL_MODELVIEW17_ARB: - case GL_MODELVIEW18_ARB: - case GL_MODELVIEW19_ARB: - case GL_MODELVIEW20_ARB: - case GL_MODELVIEW21_ARB: - case GL_MODELVIEW22_ARB: - case GL_MODELVIEW23_ARB: - case GL_MODELVIEW24_ARB: - case GL_MODELVIEW25_ARB: - case GL_MODELVIEW26_ARB: - case GL_MODELVIEW27_ARB: - case GL_MODELVIEW28_ARB: - case GL_MODELVIEW29_ARB: - case GL_MODELVIEW30_ARB: - case GL_MODELVIEW31_ARB: - case GL_TRANSPOSE_CURRENT_MATRIX_ARB: - return 16; - case GL_FOG_COORDINATE_SOURCE: - case GL_COMPRESSED_TEXTURE_FORMATS: - return __glGetBooleanv_variable_size(e); - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetTexParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_MAG_FILTER: - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_PRIORITY: - case GL_TEXTURE_RESIDENT: - case GL_TEXTURE_WRAP_R: - case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: -/* case GL_SHADOW_AMBIENT_SGIX:*/ - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_CLIPMAP_FRAME_SGIX: - case GL_TEXTURE_LOD_BIAS_S_SGIX: - case GL_TEXTURE_LOD_BIAS_T_SGIX: - case GL_TEXTURE_LOD_BIAS_R_SGIX: - case GL_GENERATE_MIPMAP: -/* case GL_GENERATE_MIPMAP_SGIS:*/ - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - case GL_TEXTURE_MAX_CLAMP_S_SGIX: - case GL_TEXTURE_MAX_CLAMP_T_SGIX: - case GL_TEXTURE_MAX_CLAMP_R_SGIX: - case GL_TEXTURE_MAX_ANISOTROPY_EXT: - case GL_TEXTURE_LOD_BIAS: -/* case GL_TEXTURE_LOD_BIAS_EXT:*/ - case GL_DEPTH_TEXTURE_MODE: -/* case GL_DEPTH_TEXTURE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_MODE: -/* case GL_TEXTURE_COMPARE_MODE_ARB:*/ - case GL_TEXTURE_COMPARE_FUNC: -/* case GL_TEXTURE_COMPARE_FUNC_ARB:*/ - case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: - return 1; - case GL_TEXTURE_CLIPMAP_CENTER_SGIX: - case GL_TEXTURE_CLIPMAP_OFFSET_SGIX: - return 2; - case GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX: - return 3; - case GL_TEXTURE_BORDER_COLOR: - case GL_POST_TEXTURE_FILTER_BIAS_SGIX: - case GL_POST_TEXTURE_FILTER_SCALE_SGIX: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetTexLevelParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_WIDTH: - case GL_TEXTURE_HEIGHT: - case GL_TEXTURE_COMPONENTS: - case GL_TEXTURE_BORDER: - case GL_TEXTURE_RED_SIZE: -/* case GL_TEXTURE_RED_SIZE_EXT:*/ - case GL_TEXTURE_GREEN_SIZE: -/* case GL_TEXTURE_GREEN_SIZE_EXT:*/ - case GL_TEXTURE_BLUE_SIZE: -/* case GL_TEXTURE_BLUE_SIZE_EXT:*/ - case GL_TEXTURE_ALPHA_SIZE: -/* case GL_TEXTURE_ALPHA_SIZE_EXT:*/ - case GL_TEXTURE_LUMINANCE_SIZE: -/* case GL_TEXTURE_LUMINANCE_SIZE_EXT:*/ - case GL_TEXTURE_INTENSITY_SIZE: -/* case GL_TEXTURE_INTENSITY_SIZE_EXT:*/ - case GL_TEXTURE_DEPTH: - case GL_TEXTURE_INDEX_SIZE_EXT: - case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: -/* case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB:*/ - case GL_TEXTURE_COMPRESSED: -/* case GL_TEXTURE_COMPRESSED_ARB:*/ - case GL_TEXTURE_DEPTH_SIZE: -/* case GL_TEXTURE_DEPTH_SIZE_ARB:*/ - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glColorTableParameterfv_size(GLenum e) -{ - switch (e) { - case GL_COLOR_TABLE_SCALE: - case GL_COLOR_TABLE_BIAS: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetColorTableParameterfv_size(GLenum e) -{ - switch (e) { - case GL_COLOR_TABLE_FORMAT: -/* case GL_COLOR_TABLE_FORMAT_EXT:*/ - case GL_COLOR_TABLE_WIDTH: -/* case GL_COLOR_TABLE_WIDTH_EXT:*/ - case GL_COLOR_TABLE_RED_SIZE: -/* case GL_COLOR_TABLE_RED_SIZE_EXT:*/ - case GL_COLOR_TABLE_GREEN_SIZE: -/* case GL_COLOR_TABLE_GREEN_SIZE_EXT:*/ - case GL_COLOR_TABLE_BLUE_SIZE: -/* case GL_COLOR_TABLE_BLUE_SIZE_EXT:*/ - case GL_COLOR_TABLE_ALPHA_SIZE: -/* case GL_COLOR_TABLE_ALPHA_SIZE_EXT:*/ - case GL_COLOR_TABLE_LUMINANCE_SIZE: -/* case GL_COLOR_TABLE_LUMINANCE_SIZE_EXT:*/ - case GL_COLOR_TABLE_INTENSITY_SIZE: -/* case GL_COLOR_TABLE_INTENSITY_SIZE_EXT:*/ - return 1; - case GL_COLOR_TABLE_SCALE: - case GL_COLOR_TABLE_BIAS: - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glConvolutionParameterfv_size(GLenum e) -{ - switch (e) { - case GL_CONVOLUTION_BORDER_MODE: -/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ - return 1; - case GL_CONVOLUTION_FILTER_SCALE: -/* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ - case GL_CONVOLUTION_FILTER_BIAS: -/* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ - case GL_CONVOLUTION_BORDER_COLOR: -/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetConvolutionParameterfv_size(GLenum e) -{ - switch (e) { - case GL_CONVOLUTION_BORDER_MODE: -/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ - case GL_CONVOLUTION_FORMAT: -/* case GL_CONVOLUTION_FORMAT_EXT:*/ - case GL_CONVOLUTION_WIDTH: -/* case GL_CONVOLUTION_WIDTH_EXT:*/ - case GL_CONVOLUTION_HEIGHT: -/* case GL_CONVOLUTION_HEIGHT_EXT:*/ - case GL_MAX_CONVOLUTION_WIDTH: -/* case GL_MAX_CONVOLUTION_WIDTH_EXT:*/ - case GL_MAX_CONVOLUTION_HEIGHT: -/* case GL_MAX_CONVOLUTION_HEIGHT_EXT:*/ - return 1; - case GL_CONVOLUTION_FILTER_SCALE: -/* case GL_CONVOLUTION_FILTER_SCALE_EXT:*/ - case GL_CONVOLUTION_FILTER_BIAS: -/* case GL_CONVOLUTION_FILTER_BIAS_EXT:*/ - case GL_CONVOLUTION_BORDER_COLOR: -/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ - return 4; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetHistogramParameterfv_size(GLenum e) -{ - switch (e) { - case GL_HISTOGRAM_WIDTH: - case GL_HISTOGRAM_FORMAT: - case GL_HISTOGRAM_RED_SIZE: - case GL_HISTOGRAM_GREEN_SIZE: - case GL_HISTOGRAM_BLUE_SIZE: - case GL_HISTOGRAM_ALPHA_SIZE: - case GL_HISTOGRAM_LUMINANCE_SIZE: - case GL_HISTOGRAM_SINK: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetMinmaxParameterfv_size(GLenum e) -{ - switch (e) { - case GL_MINMAX_FORMAT: - case GL_MINMAX_SINK: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetProgramivARB_size(GLenum e) -{ - switch (e) { - case GL_PROGRAM_LENGTH_ARB: - case GL_PROGRAM_BINDING_ARB: - case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: - case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: - case GL_PROGRAM_TEX_INDIRECTIONS_ARB: - case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: - case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: - case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: - case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: - case GL_PROGRAM_FORMAT_ARB: - case GL_PROGRAM_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: - case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: - case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: - case GL_PROGRAM_TEMPORARIES_ARB: - case GL_MAX_PROGRAM_TEMPORARIES_ARB: - case GL_PROGRAM_NATIVE_TEMPORARIES_ARB: - case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: - case GL_PROGRAM_PARAMETERS_ARB: - case GL_MAX_PROGRAM_PARAMETERS_ARB: - case GL_PROGRAM_NATIVE_PARAMETERS_ARB: - case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: - case GL_PROGRAM_ATTRIBS_ARB: - case GL_MAX_PROGRAM_ATTRIBS_ARB: - case GL_PROGRAM_NATIVE_ATTRIBS_ARB: - case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: - case GL_PROGRAM_ADDRESS_REGISTERS_ARB: - case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB: - case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: - case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: - case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB: - case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB: - case GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB: - case GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV: - case GL_MAX_PROGRAM_CALL_DEPTH_NV: - case GL_MAX_PROGRAM_IF_DEPTH_NV: - case GL_MAX_PROGRAM_LOOP_DEPTH_NV: - case GL_MAX_PROGRAM_LOOP_COUNT_NV: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetVertexAttribdvARB_size(GLenum e) -{ - switch (e) { - case GL_VERTEX_PROGRAM_ARB: - case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: - case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: - case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB: - case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: - case GL_CURRENT_VERTEX_ATTRIB_ARB: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetQueryObjectivARB_size(GLenum e) -{ - switch (e) { - case GL_QUERY_RESULT_ARB: - case GL_QUERY_RESULT_AVAILABLE_ARB: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetQueryivARB_size(GLenum e) -{ - switch (e) { - case GL_QUERY_COUNTER_BITS_ARB: - case GL_CURRENT_QUERY_ARB: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glPointParameterfvEXT_size(GLenum e) -{ - switch (e) { - case GL_POINT_SIZE_MIN: -/* case GL_POINT_SIZE_MIN_ARB:*/ -/* case GL_POINT_SIZE_MIN_SGIS:*/ - case GL_POINT_SIZE_MAX: -/* case GL_POINT_SIZE_MAX_ARB:*/ -/* case GL_POINT_SIZE_MAX_SGIS:*/ - case GL_POINT_FADE_THRESHOLD_SIZE: -/* case GL_POINT_FADE_THRESHOLD_SIZE_ARB:*/ -/* case GL_POINT_FADE_THRESHOLD_SIZE_SGIS:*/ - case GL_POINT_SPRITE_R_MODE_NV: - case GL_POINT_SPRITE_COORD_ORIGIN: - return 1; - case GL_POINT_DISTANCE_ATTENUATION: -/* case GL_POINT_DISTANCE_ATTENUATION_ARB:*/ -/* case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/ - return 3; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetProgramivNV_size(GLenum e) -{ - switch (e) { - case GL_PROGRAM_LENGTH_NV: - case GL_PROGRAM_TARGET_NV: - case GL_PROGRAM_RESIDENT_NV: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetVertexAttribdvNV_size(GLenum e) -{ - switch (e) { - case GL_ATTRIB_ARRAY_SIZE_NV: - case GL_ATTRIB_ARRAY_STRIDE_NV: - case GL_ATTRIB_ARRAY_TYPE_NV: - case GL_CURRENT_ATTRIB_NV: - return 1; - default: - return 0; - } -} - -INTERNAL PURE FASTCALL GLint -__glGetFramebufferAttachmentParameterivEXT_size(GLenum e) -{ - switch (e) { - case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: - return 1; - default: - return 0; - } -} - -ALIAS(Fogiv, Fogfv) - ALIAS(Lightiv, Lightfv) - ALIAS(LightModeliv, LightModelfv) - ALIAS(Materialiv, Materialfv) - ALIAS(TexParameteriv, TexParameterfv) - ALIAS(TexEnviv, TexEnvfv) - ALIAS(TexGenfv, TexGendv) - ALIAS(TexGeniv, TexGendv) - ALIAS(Map1f, Map1d) - ALIAS(Map2f, Map2d) - ALIAS(GetDoublev, GetBooleanv) - ALIAS(GetFloatv, GetBooleanv) - ALIAS(GetIntegerv, GetBooleanv) - ALIAS(GetLightfv, Lightfv) - ALIAS(GetLightiv, Lightfv) - ALIAS(GetMaterialfv, Materialfv) - ALIAS(GetMaterialiv, Materialfv) - ALIAS(GetTexEnvfv, TexEnvfv) - ALIAS(GetTexEnviv, TexEnvfv) - ALIAS(GetTexGendv, TexGendv) - ALIAS(GetTexGenfv, TexGendv) - ALIAS(GetTexGeniv, TexGendv) - ALIAS(GetTexParameteriv, GetTexParameterfv) - ALIAS(GetTexLevelParameteriv, GetTexLevelParameterfv) - ALIAS(ColorTableParameteriv, ColorTableParameterfv) - ALIAS(GetColorTableParameteriv, GetColorTableParameterfv) - ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) - ALIAS(GetConvolutionParameteriv, GetConvolutionParameterfv) - ALIAS(GetHistogramParameteriv, GetHistogramParameterfv) - ALIAS(GetMinmaxParameteriv, GetMinmaxParameterfv) - ALIAS(GetVertexAttribfvARB, GetVertexAttribdvARB) - ALIAS(GetVertexAttribivARB, GetVertexAttribdvARB) - ALIAS(GetQueryObjectuivARB, GetQueryObjectivARB) - ALIAS(GetVertexAttribfvNV, GetVertexAttribdvNV) - ALIAS(GetVertexAttribivNV, GetVertexAttribdvNV) - ALIAS(PointParameterivNV, PointParameterfvEXT) -# undef PURE -# undef FASTCALL -# undef INTERNAL diff --git a/GL/glx/indirect_size_get.h b/GL/glx/indirect_size_get.h deleted file mode 100644 index 4fcb55b4e..000000000 --- a/GL/glx/indirect_size_get.h +++ /dev/null @@ -1,102 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_proto_size.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2004 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - -#if !defined( _INDIRECT_SIZE_GET_H_ ) -# define _INDIRECT_SIZE_GET_H_ - -/** - * \file - * Prototypes for functions used to determine the number of data elements in - * various GLX protocol messages. - * - * \author Ian Romanick <idr@us.ibm.com> - */ - -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define PURE __attribute__((pure)) -# else -# define PURE -# endif - -# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__) -# define FASTCALL __attribute__((fastcall)) -# else -# define FASTCALL -# endif - -# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) -# define INTERNAL __attribute__((visibility("internal"))) -# else -# define INTERNAL -# endif - -extern INTERNAL PURE FASTCALL GLint __glGetBooleanv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetDoublev_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetFloatv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetIntegerv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetLightfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetLightiv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMaterialfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMaterialiv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexEnvfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexEnviv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexGendv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexGenfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexGeniv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint -__glGetConvolutionParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint -__glGetConvolutionParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameteriv_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetProgramivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum); -extern INTERNAL PURE FASTCALL GLint -__glGetFramebufferAttachmentParameterivEXT_size(GLenum); - -# undef PURE -# undef FASTCALL -# undef INTERNAL - -#endif /* !defined( _INDIRECT_SIZE_GET_H_ ) */ diff --git a/GL/glx/indirect_table.c b/GL/glx/indirect_table.c deleted file mode 100644 index cb3202605..000000000 --- a/GL/glx/indirect_table.c +++ /dev/null @@ -1,1596 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by glX_server_table.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2005, 2006 - * 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, sub license, - * 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 and this permission notice (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * IBM, - * AND/OR THEIR SUPPLIERS 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. - */ - -#include <inttypes.h> -#include "glxserver.h" -#include "glxext.h" -#include "indirect_dispatch.h" -#include "indirect_reqsize.h" -#include "g_disptab.h" -#include "indirect_table.h" - -/*****************************************************************/ -/* tree depth = 3 */ -static const int_fast16_t Single_dispatch_tree[24] = { - /* [0] -> opcode range [0, 256], node depth 1 */ - 2, - 5, - 13, - 16, - EMPTY_LEAF, - - /* [5] -> opcode range [0, 64], node depth 2 */ - 2, - LEAF(0), - LEAF(16), - 10, - EMPTY_LEAF, - - /* [10] -> opcode range [32, 48], node depth 3 */ - 1, - LEAF(32), - EMPTY_LEAF, - - /* [13] -> opcode range [64, 128], node depth 2 */ - 1, - EMPTY_LEAF, - LEAF(40), - - /* [16] -> opcode range [128, 192], node depth 2 */ - 2, - LEAF(72), - LEAF(88), - 21, - EMPTY_LEAF, - - /* [21] -> opcode range [160, 176], node depth 3 */ - 1, - LEAF(104), - EMPTY_LEAF, - -}; - -static const void *Single_function_table[112][2] = { - /* [ 0] = 0 */ {NULL, NULL}, - /* [ 1] = 1 */ {__glXDisp_Render, __glXDispSwap_Render}, - /* [ 2] = 2 */ {__glXDisp_RenderLarge, __glXDispSwap_RenderLarge}, - /* [ 3] = 3 */ {__glXDisp_CreateContext, __glXDispSwap_CreateContext}, - /* [ 4] = 4 */ {__glXDisp_DestroyContext, __glXDispSwap_DestroyContext}, - /* [ 5] = 5 */ {__glXDisp_MakeCurrent, __glXDispSwap_MakeCurrent}, - /* [ 6] = 6 */ {__glXDisp_IsDirect, __glXDispSwap_IsDirect}, - /* [ 7] = 7 */ {__glXDisp_QueryVersion, __glXDispSwap_QueryVersion}, - /* [ 8] = 8 */ {__glXDisp_WaitGL, __glXDispSwap_WaitGL}, - /* [ 9] = 9 */ {__glXDisp_WaitX, __glXDispSwap_WaitX}, - /* [ 10] = 10 */ {__glXDisp_CopyContext, __glXDispSwap_CopyContext}, - /* [ 11] = 11 */ {__glXDisp_SwapBuffers, __glXDispSwap_SwapBuffers}, - /* [ 12] = 12 */ {__glXDisp_UseXFont, __glXDispSwap_UseXFont}, - /* [ 13] = 13 */ {__glXDisp_CreateGLXPixmap, __glXDispSwap_CreateGLXPixmap}, - /* [ 14] = 14 */ {__glXDisp_GetVisualConfigs, __glXDispSwap_GetVisualConfigs}, - /* [ 15] = 15 */ {__glXDisp_DestroyGLXPixmap, __glXDispSwap_DestroyGLXPixmap}, - /* [ 16] = 16 */ {__glXDisp_VendorPrivate, __glXDispSwap_VendorPrivate}, - /* [ 17] = 17 */ {__glXDisp_VendorPrivateWithReply, __glXDispSwap_VendorPrivateWithReply}, - /* [ 18] = 18 */ {__glXDisp_QueryExtensionsString, __glXDispSwap_QueryExtensionsString}, - /* [ 19] = 19 */ {__glXDisp_QueryServerString, __glXDispSwap_QueryServerString}, - /* [ 20] = 20 */ {__glXDisp_ClientInfo, __glXDispSwap_ClientInfo}, - /* [ 21] = 21 */ {__glXDisp_GetFBConfigs, __glXDispSwap_GetFBConfigs}, - /* [ 22] = 22 */ {__glXDisp_CreatePixmap, __glXDispSwap_CreatePixmap}, - /* [ 23] = 23 */ {__glXDisp_DestroyPixmap, __glXDispSwap_DestroyPixmap}, - /* [ 24] = 24 */ {__glXDisp_CreateNewContext, __glXDispSwap_CreateNewContext}, - /* [ 25] = 25 */ {__glXDisp_QueryContext, __glXDispSwap_QueryContext}, - /* [ 26] = 26 */ {__glXDisp_MakeContextCurrent, __glXDispSwap_MakeContextCurrent}, - /* [ 27] = 27 */ {__glXDisp_CreatePbuffer, __glXDispSwap_CreatePbuffer}, - /* [ 28] = 28 */ {__glXDisp_DestroyPbuffer, __glXDispSwap_DestroyPbuffer}, - /* [ 29] = 29 */ {__glXDisp_GetDrawableAttributes, __glXDispSwap_GetDrawableAttributes}, - /* [ 30] = 30 */ {__glXDisp_ChangeDrawableAttributes, __glXDispSwap_ChangeDrawableAttributes}, - /* [ 31] = 31 */ {__glXDisp_CreateWindow, __glXDispSwap_CreateWindow}, - /* [ 32] = 32 */ {__glXDisp_DestroyWindow, __glXDispSwap_DestroyWindow}, - /* [ 33] = 33 */ {NULL, NULL}, - /* [ 34] = 34 */ {NULL, NULL}, - /* [ 35] = 35 */ {NULL, NULL}, - /* [ 36] = 36 */ {NULL, NULL}, - /* [ 37] = 37 */ {NULL, NULL}, - /* [ 38] = 38 */ {NULL, NULL}, - /* [ 39] = 39 */ {NULL, NULL}, - /* [ 40] = 96 */ {NULL, NULL}, - /* [ 41] = 97 */ {NULL, NULL}, - /* [ 42] = 98 */ {NULL, NULL}, - /* [ 43] = 99 */ {NULL, NULL}, - /* [ 44] = 100 */ {NULL, NULL}, - /* [ 45] = 101 */ {__glXDisp_NewList, __glXDispSwap_NewList}, - /* [ 46] = 102 */ {__glXDisp_EndList, __glXDispSwap_EndList}, - /* [ 47] = 103 */ {__glXDisp_DeleteLists, __glXDispSwap_DeleteLists}, - /* [ 48] = 104 */ {__glXDisp_GenLists, __glXDispSwap_GenLists}, - /* [ 49] = 105 */ {__glXDisp_FeedbackBuffer, __glXDispSwap_FeedbackBuffer}, - /* [ 50] = 106 */ {__glXDisp_SelectBuffer, __glXDispSwap_SelectBuffer}, - /* [ 51] = 107 */ {__glXDisp_RenderMode, __glXDispSwap_RenderMode}, - /* [ 52] = 108 */ {__glXDisp_Finish, __glXDispSwap_Finish}, - /* [ 53] = 109 */ {__glXDisp_PixelStoref, __glXDispSwap_PixelStoref}, - /* [ 54] = 110 */ {__glXDisp_PixelStorei, __glXDispSwap_PixelStorei}, - /* [ 55] = 111 */ {__glXDisp_ReadPixels, __glXDispSwap_ReadPixels}, - /* [ 56] = 112 */ {__glXDisp_GetBooleanv, __glXDispSwap_GetBooleanv}, - /* [ 57] = 113 */ {__glXDisp_GetClipPlane, __glXDispSwap_GetClipPlane}, - /* [ 58] = 114 */ {__glXDisp_GetDoublev, __glXDispSwap_GetDoublev}, - /* [ 59] = 115 */ {__glXDisp_GetError, __glXDispSwap_GetError}, - /* [ 60] = 116 */ {__glXDisp_GetFloatv, __glXDispSwap_GetFloatv}, - /* [ 61] = 117 */ {__glXDisp_GetIntegerv, __glXDispSwap_GetIntegerv}, - /* [ 62] = 118 */ {__glXDisp_GetLightfv, __glXDispSwap_GetLightfv}, - /* [ 63] = 119 */ {__glXDisp_GetLightiv, __glXDispSwap_GetLightiv}, - /* [ 64] = 120 */ {__glXDisp_GetMapdv, __glXDispSwap_GetMapdv}, - /* [ 65] = 121 */ {__glXDisp_GetMapfv, __glXDispSwap_GetMapfv}, - /* [ 66] = 122 */ {__glXDisp_GetMapiv, __glXDispSwap_GetMapiv}, - /* [ 67] = 123 */ {__glXDisp_GetMaterialfv, __glXDispSwap_GetMaterialfv}, - /* [ 68] = 124 */ {__glXDisp_GetMaterialiv, __glXDispSwap_GetMaterialiv}, - /* [ 69] = 125 */ {__glXDisp_GetPixelMapfv, __glXDispSwap_GetPixelMapfv}, - /* [ 70] = 126 */ {__glXDisp_GetPixelMapuiv, __glXDispSwap_GetPixelMapuiv}, - /* [ 71] = 127 */ {__glXDisp_GetPixelMapusv, __glXDispSwap_GetPixelMapusv}, - /* [ 72] = 128 */ {__glXDisp_GetPolygonStipple, __glXDispSwap_GetPolygonStipple}, - /* [ 73] = 129 */ {__glXDisp_GetString, __glXDispSwap_GetString}, - /* [ 74] = 130 */ {__glXDisp_GetTexEnvfv, __glXDispSwap_GetTexEnvfv}, - /* [ 75] = 131 */ {__glXDisp_GetTexEnviv, __glXDispSwap_GetTexEnviv}, - /* [ 76] = 132 */ {__glXDisp_GetTexGendv, __glXDispSwap_GetTexGendv}, - /* [ 77] = 133 */ {__glXDisp_GetTexGenfv, __glXDispSwap_GetTexGenfv}, - /* [ 78] = 134 */ {__glXDisp_GetTexGeniv, __glXDispSwap_GetTexGeniv}, - /* [ 79] = 135 */ {__glXDisp_GetTexImage, __glXDispSwap_GetTexImage}, - /* [ 80] = 136 */ {__glXDisp_GetTexParameterfv, __glXDispSwap_GetTexParameterfv}, - /* [ 81] = 137 */ {__glXDisp_GetTexParameteriv, __glXDispSwap_GetTexParameteriv}, - /* [ 82] = 138 */ {__glXDisp_GetTexLevelParameterfv, __glXDispSwap_GetTexLevelParameterfv}, - /* [ 83] = 139 */ {__glXDisp_GetTexLevelParameteriv, __glXDispSwap_GetTexLevelParameteriv}, - /* [ 84] = 140 */ {__glXDisp_IsEnabled, __glXDispSwap_IsEnabled}, - /* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList}, - /* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush}, - /* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident}, - /* [ 88] = 144 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures}, - /* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures}, - /* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture}, - /* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable}, - /* [ 92] = 148 */ {__glXDisp_GetColorTableParameterfv, __glXDispSwap_GetColorTableParameterfv}, - /* [ 93] = 149 */ {__glXDisp_GetColorTableParameteriv, __glXDispSwap_GetColorTableParameteriv}, - /* [ 94] = 150 */ {__glXDisp_GetConvolutionFilter, __glXDispSwap_GetConvolutionFilter}, - /* [ 95] = 151 */ {__glXDisp_GetConvolutionParameterfv, __glXDispSwap_GetConvolutionParameterfv}, - /* [ 96] = 152 */ {__glXDisp_GetConvolutionParameteriv, __glXDispSwap_GetConvolutionParameteriv}, - /* [ 97] = 153 */ {__glXDisp_GetSeparableFilter, __glXDispSwap_GetSeparableFilter}, - /* [ 98] = 154 */ {__glXDisp_GetHistogram, __glXDispSwap_GetHistogram}, - /* [ 99] = 155 */ {__glXDisp_GetHistogramParameterfv, __glXDispSwap_GetHistogramParameterfv}, - /* [ 100] = 156 */ {__glXDisp_GetHistogramParameteriv, __glXDispSwap_GetHistogramParameteriv}, - /* [ 101] = 157 */ {__glXDisp_GetMinmax, __glXDispSwap_GetMinmax}, - /* [ 102] = 158 */ {__glXDisp_GetMinmaxParameterfv, __glXDispSwap_GetMinmaxParameterfv}, - /* [ 103] = 159 */ {__glXDisp_GetMinmaxParameteriv, __glXDispSwap_GetMinmaxParameteriv}, - /* [ 104] = 160 */ {__glXDisp_GetCompressedTexImageARB, __glXDispSwap_GetCompressedTexImageARB}, - /* [ 105] = 161 */ {__glXDisp_DeleteQueriesARB, __glXDispSwap_DeleteQueriesARB}, - /* [ 106] = 162 */ {__glXDisp_GenQueriesARB, __glXDispSwap_GenQueriesARB}, - /* [ 107] = 163 */ {__glXDisp_IsQueryARB, __glXDispSwap_IsQueryARB}, - /* [ 108] = 164 */ {__glXDisp_GetQueryivARB, __glXDispSwap_GetQueryivARB}, - /* [ 109] = 165 */ {__glXDisp_GetQueryObjectivARB, __glXDispSwap_GetQueryObjectivARB}, - /* [ 110] = 166 */ {__glXDisp_GetQueryObjectuivARB, __glXDispSwap_GetQueryObjectuivARB}, - /* [ 111] = 167 */ {NULL, NULL}, -}; - -const struct __glXDispatchInfo Single_dispatch_info = { - 8, - Single_dispatch_tree, - Single_function_table, - NULL, - NULL -}; - -/*****************************************************************/ -/* tree depth = 8 */ -static const int_fast16_t Render_dispatch_tree[95] = { - /* [0] -> opcode range [0, 8192], node depth 1 */ - 2, - 5, - 31, - 54, - EMPTY_LEAF, - - /* [5] -> opcode range [0, 2048], node depth 2 */ - 1, - 8, - EMPTY_LEAF, - - /* [8] -> opcode range [0, 1024], node depth 3 */ - 1, - 11, - EMPTY_LEAF, - - /* [11] -> opcode range [0, 512], node depth 4 */ - 1, - 14, - EMPTY_LEAF, - - /* [14] -> opcode range [0, 256], node depth 5 */ - 4, - LEAF(0), - LEAF(16), - LEAF(32), - LEAF(48), - LEAF(64), - LEAF(80), - LEAF(96), - LEAF(112), - LEAF(128), - LEAF(144), - LEAF(160), - LEAF(176), - LEAF(192), - LEAF(208), - LEAF(224), - EMPTY_LEAF, - - /* [31] -> opcode range [2048, 4096], node depth 2 */ - 1, - 34, - EMPTY_LEAF, - - /* [34] -> opcode range [2048, 3072], node depth 3 */ - 1, - 37, - EMPTY_LEAF, - - /* [37] -> opcode range [2048, 2560], node depth 4 */ - 1, - 40, - EMPTY_LEAF, - - /* [40] -> opcode range [2048, 2304], node depth 5 */ - 1, - 43, - EMPTY_LEAF, - - /* [43] -> opcode range [2048, 2176], node depth 6 */ - 1, - 46, - EMPTY_LEAF, - - /* [46] -> opcode range [2048, 2112], node depth 7 */ - 1, - 49, - EMPTY_LEAF, - - /* [49] -> opcode range [2048, 2080], node depth 8 */ - 2, - LEAF(240), - LEAF(248), - LEAF(256), - EMPTY_LEAF, - - /* [54] -> opcode range [4096, 6144], node depth 2 */ - 1, - 57, - EMPTY_LEAF, - - /* [57] -> opcode range [4096, 5120], node depth 3 */ - 1, - 60, - EMPTY_LEAF, - - /* [60] -> opcode range [4096, 4608], node depth 4 */ - 1, - 63, - EMPTY_LEAF, - - /* [63] -> opcode range [4096, 4352], node depth 5 */ - 4, - LEAF(264), - LEAF(280), - 80, - EMPTY_LEAF, - EMPTY_LEAF, - LEAF(296), - LEAF(312), - LEAF(328), - LEAF(344), - EMPTY_LEAF, - 83, - 86, - EMPTY_LEAF, - 89, - 92, - EMPTY_LEAF, - - /* [80] -> opcode range [4128, 4144], node depth 6 */ - 1, - LEAF(360), - EMPTY_LEAF, - - /* [83] -> opcode range [4256, 4272], node depth 6 */ - 1, - EMPTY_LEAF, - LEAF(368), - - /* [86] -> opcode range [4272, 4288], node depth 6 */ - 1, - LEAF(376), - EMPTY_LEAF, - - /* [89] -> opcode range [4304, 4320], node depth 6 */ - 1, - EMPTY_LEAF, - LEAF(384), - - /* [92] -> opcode range [4320, 4336], node depth 6 */ - 1, - LEAF(392), - EMPTY_LEAF, - -}; - -static const void *Render_function_table[400][2] = { - /* [ 0] = 0 */ {NULL, NULL}, - /* [ 1] = 1 */ {__glXDisp_CallList, __glXDispSwap_CallList}, - /* [ 2] = 2 */ {__glXDisp_CallLists, __glXDispSwap_CallLists}, - /* [ 3] = 3 */ {__glXDisp_ListBase, __glXDispSwap_ListBase}, - /* [ 4] = 4 */ {__glXDisp_Begin, __glXDispSwap_Begin}, - /* [ 5] = 5 */ {__glXDisp_Bitmap, __glXDispSwap_Bitmap}, - /* [ 6] = 6 */ {__glXDisp_Color3bv, __glXDispSwap_Color3bv}, - /* [ 7] = 7 */ {__glXDisp_Color3dv, __glXDispSwap_Color3dv}, - /* [ 8] = 8 */ {__glXDisp_Color3fv, __glXDispSwap_Color3fv}, - /* [ 9] = 9 */ {__glXDisp_Color3iv, __glXDispSwap_Color3iv}, - /* [ 10] = 10 */ {__glXDisp_Color3sv, __glXDispSwap_Color3sv}, - /* [ 11] = 11 */ {__glXDisp_Color3ubv, __glXDispSwap_Color3ubv}, - /* [ 12] = 12 */ {__glXDisp_Color3uiv, __glXDispSwap_Color3uiv}, - /* [ 13] = 13 */ {__glXDisp_Color3usv, __glXDispSwap_Color3usv}, - /* [ 14] = 14 */ {__glXDisp_Color4bv, __glXDispSwap_Color4bv}, - /* [ 15] = 15 */ {__glXDisp_Color4dv, __glXDispSwap_Color4dv}, - /* [ 16] = 16 */ {__glXDisp_Color4fv, __glXDispSwap_Color4fv}, - /* [ 17] = 17 */ {__glXDisp_Color4iv, __glXDispSwap_Color4iv}, - /* [ 18] = 18 */ {__glXDisp_Color4sv, __glXDispSwap_Color4sv}, - /* [ 19] = 19 */ {__glXDisp_Color4ubv, __glXDispSwap_Color4ubv}, - /* [ 20] = 20 */ {__glXDisp_Color4uiv, __glXDispSwap_Color4uiv}, - /* [ 21] = 21 */ {__glXDisp_Color4usv, __glXDispSwap_Color4usv}, - /* [ 22] = 22 */ {__glXDisp_EdgeFlagv, __glXDispSwap_EdgeFlagv}, - /* [ 23] = 23 */ {__glXDisp_End, __glXDispSwap_End}, - /* [ 24] = 24 */ {__glXDisp_Indexdv, __glXDispSwap_Indexdv}, - /* [ 25] = 25 */ {__glXDisp_Indexfv, __glXDispSwap_Indexfv}, - /* [ 26] = 26 */ {__glXDisp_Indexiv, __glXDispSwap_Indexiv}, - /* [ 27] = 27 */ {__glXDisp_Indexsv, __glXDispSwap_Indexsv}, - /* [ 28] = 28 */ {__glXDisp_Normal3bv, __glXDispSwap_Normal3bv}, - /* [ 29] = 29 */ {__glXDisp_Normal3dv, __glXDispSwap_Normal3dv}, - /* [ 30] = 30 */ {__glXDisp_Normal3fv, __glXDispSwap_Normal3fv}, - /* [ 31] = 31 */ {__glXDisp_Normal3iv, __glXDispSwap_Normal3iv}, - /* [ 32] = 32 */ {__glXDisp_Normal3sv, __glXDispSwap_Normal3sv}, - /* [ 33] = 33 */ {__glXDisp_RasterPos2dv, __glXDispSwap_RasterPos2dv}, - /* [ 34] = 34 */ {__glXDisp_RasterPos2fv, __glXDispSwap_RasterPos2fv}, - /* [ 35] = 35 */ {__glXDisp_RasterPos2iv, __glXDispSwap_RasterPos2iv}, - /* [ 36] = 36 */ {__glXDisp_RasterPos2sv, __glXDispSwap_RasterPos2sv}, - /* [ 37] = 37 */ {__glXDisp_RasterPos3dv, __glXDispSwap_RasterPos3dv}, - /* [ 38] = 38 */ {__glXDisp_RasterPos3fv, __glXDispSwap_RasterPos3fv}, - /* [ 39] = 39 */ {__glXDisp_RasterPos3iv, __glXDispSwap_RasterPos3iv}, - /* [ 40] = 40 */ {__glXDisp_RasterPos3sv, __glXDispSwap_RasterPos3sv}, - /* [ 41] = 41 */ {__glXDisp_RasterPos4dv, __glXDispSwap_RasterPos4dv}, - /* [ 42] = 42 */ {__glXDisp_RasterPos4fv, __glXDispSwap_RasterPos4fv}, - /* [ 43] = 43 */ {__glXDisp_RasterPos4iv, __glXDispSwap_RasterPos4iv}, - /* [ 44] = 44 */ {__glXDisp_RasterPos4sv, __glXDispSwap_RasterPos4sv}, - /* [ 45] = 45 */ {__glXDisp_Rectdv, __glXDispSwap_Rectdv}, - /* [ 46] = 46 */ {__glXDisp_Rectfv, __glXDispSwap_Rectfv}, - /* [ 47] = 47 */ {__glXDisp_Rectiv, __glXDispSwap_Rectiv}, - /* [ 48] = 48 */ {__glXDisp_Rectsv, __glXDispSwap_Rectsv}, - /* [ 49] = 49 */ {__glXDisp_TexCoord1dv, __glXDispSwap_TexCoord1dv}, - /* [ 50] = 50 */ {__glXDisp_TexCoord1fv, __glXDispSwap_TexCoord1fv}, - /* [ 51] = 51 */ {__glXDisp_TexCoord1iv, __glXDispSwap_TexCoord1iv}, - /* [ 52] = 52 */ {__glXDisp_TexCoord1sv, __glXDispSwap_TexCoord1sv}, - /* [ 53] = 53 */ {__glXDisp_TexCoord2dv, __glXDispSwap_TexCoord2dv}, - /* [ 54] = 54 */ {__glXDisp_TexCoord2fv, __glXDispSwap_TexCoord2fv}, - /* [ 55] = 55 */ {__glXDisp_TexCoord2iv, __glXDispSwap_TexCoord2iv}, - /* [ 56] = 56 */ {__glXDisp_TexCoord2sv, __glXDispSwap_TexCoord2sv}, - /* [ 57] = 57 */ {__glXDisp_TexCoord3dv, __glXDispSwap_TexCoord3dv}, - /* [ 58] = 58 */ {__glXDisp_TexCoord3fv, __glXDispSwap_TexCoord3fv}, - /* [ 59] = 59 */ {__glXDisp_TexCoord3iv, __glXDispSwap_TexCoord3iv}, - /* [ 60] = 60 */ {__glXDisp_TexCoord3sv, __glXDispSwap_TexCoord3sv}, - /* [ 61] = 61 */ {__glXDisp_TexCoord4dv, __glXDispSwap_TexCoord4dv}, - /* [ 62] = 62 */ {__glXDisp_TexCoord4fv, __glXDispSwap_TexCoord4fv}, - /* [ 63] = 63 */ {__glXDisp_TexCoord4iv, __glXDispSwap_TexCoord4iv}, - /* [ 64] = 64 */ {__glXDisp_TexCoord4sv, __glXDispSwap_TexCoord4sv}, - /* [ 65] = 65 */ {__glXDisp_Vertex2dv, __glXDispSwap_Vertex2dv}, - /* [ 66] = 66 */ {__glXDisp_Vertex2fv, __glXDispSwap_Vertex2fv}, - /* [ 67] = 67 */ {__glXDisp_Vertex2iv, __glXDispSwap_Vertex2iv}, - /* [ 68] = 68 */ {__glXDisp_Vertex2sv, __glXDispSwap_Vertex2sv}, - /* [ 69] = 69 */ {__glXDisp_Vertex3dv, __glXDispSwap_Vertex3dv}, - /* [ 70] = 70 */ {__glXDisp_Vertex3fv, __glXDispSwap_Vertex3fv}, - /* [ 71] = 71 */ {__glXDisp_Vertex3iv, __glXDispSwap_Vertex3iv}, - /* [ 72] = 72 */ {__glXDisp_Vertex3sv, __glXDispSwap_Vertex3sv}, - /* [ 73] = 73 */ {__glXDisp_Vertex4dv, __glXDispSwap_Vertex4dv}, - /* [ 74] = 74 */ {__glXDisp_Vertex4fv, __glXDispSwap_Vertex4fv}, - /* [ 75] = 75 */ {__glXDisp_Vertex4iv, __glXDispSwap_Vertex4iv}, - /* [ 76] = 76 */ {__glXDisp_Vertex4sv, __glXDispSwap_Vertex4sv}, - /* [ 77] = 77 */ {__glXDisp_ClipPlane, __glXDispSwap_ClipPlane}, - /* [ 78] = 78 */ {__glXDisp_ColorMaterial, __glXDispSwap_ColorMaterial}, - /* [ 79] = 79 */ {__glXDisp_CullFace, __glXDispSwap_CullFace}, - /* [ 80] = 80 */ {__glXDisp_Fogf, __glXDispSwap_Fogf}, - /* [ 81] = 81 */ {__glXDisp_Fogfv, __glXDispSwap_Fogfv}, - /* [ 82] = 82 */ {__glXDisp_Fogi, __glXDispSwap_Fogi}, - /* [ 83] = 83 */ {__glXDisp_Fogiv, __glXDispSwap_Fogiv}, - /* [ 84] = 84 */ {__glXDisp_FrontFace, __glXDispSwap_FrontFace}, - /* [ 85] = 85 */ {__glXDisp_Hint, __glXDispSwap_Hint}, - /* [ 86] = 86 */ {__glXDisp_Lightf, __glXDispSwap_Lightf}, - /* [ 87] = 87 */ {__glXDisp_Lightfv, __glXDispSwap_Lightfv}, - /* [ 88] = 88 */ {__glXDisp_Lighti, __glXDispSwap_Lighti}, - /* [ 89] = 89 */ {__glXDisp_Lightiv, __glXDispSwap_Lightiv}, - /* [ 90] = 90 */ {__glXDisp_LightModelf, __glXDispSwap_LightModelf}, - /* [ 91] = 91 */ {__glXDisp_LightModelfv, __glXDispSwap_LightModelfv}, - /* [ 92] = 92 */ {__glXDisp_LightModeli, __glXDispSwap_LightModeli}, - /* [ 93] = 93 */ {__glXDisp_LightModeliv, __glXDispSwap_LightModeliv}, - /* [ 94] = 94 */ {__glXDisp_LineStipple, __glXDispSwap_LineStipple}, - /* [ 95] = 95 */ {__glXDisp_LineWidth, __glXDispSwap_LineWidth}, - /* [ 96] = 96 */ {__glXDisp_Materialf, __glXDispSwap_Materialf}, - /* [ 97] = 97 */ {__glXDisp_Materialfv, __glXDispSwap_Materialfv}, - /* [ 98] = 98 */ {__glXDisp_Materiali, __glXDispSwap_Materiali}, - /* [ 99] = 99 */ {__glXDisp_Materialiv, __glXDispSwap_Materialiv}, - /* [ 100] = 100 */ {__glXDisp_PointSize, __glXDispSwap_PointSize}, - /* [ 101] = 101 */ {__glXDisp_PolygonMode, __glXDispSwap_PolygonMode}, - /* [ 102] = 102 */ {__glXDisp_PolygonStipple, __glXDispSwap_PolygonStipple}, - /* [ 103] = 103 */ {__glXDisp_Scissor, __glXDispSwap_Scissor}, - /* [ 104] = 104 */ {__glXDisp_ShadeModel, __glXDispSwap_ShadeModel}, - /* [ 105] = 105 */ {__glXDisp_TexParameterf, __glXDispSwap_TexParameterf}, - /* [ 106] = 106 */ {__glXDisp_TexParameterfv, __glXDispSwap_TexParameterfv}, - /* [ 107] = 107 */ {__glXDisp_TexParameteri, __glXDispSwap_TexParameteri}, - /* [ 108] = 108 */ {__glXDisp_TexParameteriv, __glXDispSwap_TexParameteriv}, - /* [ 109] = 109 */ {__glXDisp_TexImage1D, __glXDispSwap_TexImage1D}, - /* [ 110] = 110 */ {__glXDisp_TexImage2D, __glXDispSwap_TexImage2D}, - /* [ 111] = 111 */ {__glXDisp_TexEnvf, __glXDispSwap_TexEnvf}, - /* [ 112] = 112 */ {__glXDisp_TexEnvfv, __glXDispSwap_TexEnvfv}, - /* [ 113] = 113 */ {__glXDisp_TexEnvi, __glXDispSwap_TexEnvi}, - /* [ 114] = 114 */ {__glXDisp_TexEnviv, __glXDispSwap_TexEnviv}, - /* [ 115] = 115 */ {__glXDisp_TexGend, __glXDispSwap_TexGend}, - /* [ 116] = 116 */ {__glXDisp_TexGendv, __glXDispSwap_TexGendv}, - /* [ 117] = 117 */ {__glXDisp_TexGenf, __glXDispSwap_TexGenf}, - /* [ 118] = 118 */ {__glXDisp_TexGenfv, __glXDispSwap_TexGenfv}, - /* [ 119] = 119 */ {__glXDisp_TexGeni, __glXDispSwap_TexGeni}, - /* [ 120] = 120 */ {__glXDisp_TexGeniv, __glXDispSwap_TexGeniv}, - /* [ 121] = 121 */ {__glXDisp_InitNames, __glXDispSwap_InitNames}, - /* [ 122] = 122 */ {__glXDisp_LoadName, __glXDispSwap_LoadName}, - /* [ 123] = 123 */ {__glXDisp_PassThrough, __glXDispSwap_PassThrough}, - /* [ 124] = 124 */ {__glXDisp_PopName, __glXDispSwap_PopName}, - /* [ 125] = 125 */ {__glXDisp_PushName, __glXDispSwap_PushName}, - /* [ 126] = 126 */ {__glXDisp_DrawBuffer, __glXDispSwap_DrawBuffer}, - /* [ 127] = 127 */ {__glXDisp_Clear, __glXDispSwap_Clear}, - /* [ 128] = 128 */ {__glXDisp_ClearAccum, __glXDispSwap_ClearAccum}, - /* [ 129] = 129 */ {__glXDisp_ClearIndex, __glXDispSwap_ClearIndex}, - /* [ 130] = 130 */ {__glXDisp_ClearColor, __glXDispSwap_ClearColor}, - /* [ 131] = 131 */ {__glXDisp_ClearStencil, __glXDispSwap_ClearStencil}, - /* [ 132] = 132 */ {__glXDisp_ClearDepth, __glXDispSwap_ClearDepth}, - /* [ 133] = 133 */ {__glXDisp_StencilMask, __glXDispSwap_StencilMask}, - /* [ 134] = 134 */ {__glXDisp_ColorMask, __glXDispSwap_ColorMask}, - /* [ 135] = 135 */ {__glXDisp_DepthMask, __glXDispSwap_DepthMask}, - /* [ 136] = 136 */ {__glXDisp_IndexMask, __glXDispSwap_IndexMask}, - /* [ 137] = 137 */ {__glXDisp_Accum, __glXDispSwap_Accum}, - /* [ 138] = 138 */ {__glXDisp_Disable, __glXDispSwap_Disable}, - /* [ 139] = 139 */ {__glXDisp_Enable, __glXDispSwap_Enable}, - /* [ 140] = 140 */ {NULL, NULL}, - /* [ 141] = 141 */ {__glXDisp_PopAttrib, __glXDispSwap_PopAttrib}, - /* [ 142] = 142 */ {__glXDisp_PushAttrib, __glXDispSwap_PushAttrib}, - /* [ 143] = 143 */ {__glXDisp_Map1d, __glXDispSwap_Map1d}, - /* [ 144] = 144 */ {__glXDisp_Map1f, __glXDispSwap_Map1f}, - /* [ 145] = 145 */ {__glXDisp_Map2d, __glXDispSwap_Map2d}, - /* [ 146] = 146 */ {__glXDisp_Map2f, __glXDispSwap_Map2f}, - /* [ 147] = 147 */ {__glXDisp_MapGrid1d, __glXDispSwap_MapGrid1d}, - /* [ 148] = 148 */ {__glXDisp_MapGrid1f, __glXDispSwap_MapGrid1f}, - /* [ 149] = 149 */ {__glXDisp_MapGrid2d, __glXDispSwap_MapGrid2d}, - /* [ 150] = 150 */ {__glXDisp_MapGrid2f, __glXDispSwap_MapGrid2f}, - /* [ 151] = 151 */ {__glXDisp_EvalCoord1dv, __glXDispSwap_EvalCoord1dv}, - /* [ 152] = 152 */ {__glXDisp_EvalCoord1fv, __glXDispSwap_EvalCoord1fv}, - /* [ 153] = 153 */ {__glXDisp_EvalCoord2dv, __glXDispSwap_EvalCoord2dv}, - /* [ 154] = 154 */ {__glXDisp_EvalCoord2fv, __glXDispSwap_EvalCoord2fv}, - /* [ 155] = 155 */ {__glXDisp_EvalMesh1, __glXDispSwap_EvalMesh1}, - /* [ 156] = 156 */ {__glXDisp_EvalPoint1, __glXDispSwap_EvalPoint1}, - /* [ 157] = 157 */ {__glXDisp_EvalMesh2, __glXDispSwap_EvalMesh2}, - /* [ 158] = 158 */ {__glXDisp_EvalPoint2, __glXDispSwap_EvalPoint2}, - /* [ 159] = 159 */ {__glXDisp_AlphaFunc, __glXDispSwap_AlphaFunc}, - /* [ 160] = 160 */ {__glXDisp_BlendFunc, __glXDispSwap_BlendFunc}, - /* [ 161] = 161 */ {__glXDisp_LogicOp, __glXDispSwap_LogicOp}, - /* [ 162] = 162 */ {__glXDisp_StencilFunc, __glXDispSwap_StencilFunc}, - /* [ 163] = 163 */ {__glXDisp_StencilOp, __glXDispSwap_StencilOp}, - /* [ 164] = 164 */ {__glXDisp_DepthFunc, __glXDispSwap_DepthFunc}, - /* [ 165] = 165 */ {__glXDisp_PixelZoom, __glXDispSwap_PixelZoom}, - /* [ 166] = 166 */ {__glXDisp_PixelTransferf, __glXDispSwap_PixelTransferf}, - /* [ 167] = 167 */ {__glXDisp_PixelTransferi, __glXDispSwap_PixelTransferi}, - /* [ 168] = 168 */ {__glXDisp_PixelMapfv, __glXDispSwap_PixelMapfv}, - /* [ 169] = 169 */ {__glXDisp_PixelMapuiv, __glXDispSwap_PixelMapuiv}, - /* [ 170] = 170 */ {__glXDisp_PixelMapusv, __glXDispSwap_PixelMapusv}, - /* [ 171] = 171 */ {__glXDisp_ReadBuffer, __glXDispSwap_ReadBuffer}, - /* [ 172] = 172 */ {__glXDisp_CopyPixels, __glXDispSwap_CopyPixels}, - /* [ 173] = 173 */ {__glXDisp_DrawPixels, __glXDispSwap_DrawPixels}, - /* [ 174] = 174 */ {__glXDisp_DepthRange, __glXDispSwap_DepthRange}, - /* [ 175] = 175 */ {__glXDisp_Frustum, __glXDispSwap_Frustum}, - /* [ 176] = 176 */ {__glXDisp_LoadIdentity, __glXDispSwap_LoadIdentity}, - /* [ 177] = 177 */ {__glXDisp_LoadMatrixf, __glXDispSwap_LoadMatrixf}, - /* [ 178] = 178 */ {__glXDisp_LoadMatrixd, __glXDispSwap_LoadMatrixd}, - /* [ 179] = 179 */ {__glXDisp_MatrixMode, __glXDispSwap_MatrixMode}, - /* [ 180] = 180 */ {__glXDisp_MultMatrixf, __glXDispSwap_MultMatrixf}, - /* [ 181] = 181 */ {__glXDisp_MultMatrixd, __glXDispSwap_MultMatrixd}, - /* [ 182] = 182 */ {__glXDisp_Ortho, __glXDispSwap_Ortho}, - /* [ 183] = 183 */ {__glXDisp_PopMatrix, __glXDispSwap_PopMatrix}, - /* [ 184] = 184 */ {__glXDisp_PushMatrix, __glXDispSwap_PushMatrix}, - /* [ 185] = 185 */ {__glXDisp_Rotated, __glXDispSwap_Rotated}, - /* [ 186] = 186 */ {__glXDisp_Rotatef, __glXDispSwap_Rotatef}, - /* [ 187] = 187 */ {__glXDisp_Scaled, __glXDispSwap_Scaled}, - /* [ 188] = 188 */ {__glXDisp_Scalef, __glXDispSwap_Scalef}, - /* [ 189] = 189 */ {__glXDisp_Translated, __glXDispSwap_Translated}, - /* [ 190] = 190 */ {__glXDisp_Translatef, __glXDispSwap_Translatef}, - /* [ 191] = 191 */ {__glXDisp_Viewport, __glXDispSwap_Viewport}, - /* [ 192] = 192 */ {__glXDisp_PolygonOffset, __glXDispSwap_PolygonOffset}, - /* [ 193] = 193 */ {__glXDisp_DrawArrays, __glXDispSwap_DrawArrays}, - /* [ 194] = 194 */ {__glXDisp_Indexubv, __glXDispSwap_Indexubv}, - /* [ 195] = 195 */ {__glXDisp_ColorSubTable, __glXDispSwap_ColorSubTable}, - /* [ 196] = 196 */ {__glXDisp_CopyColorSubTable, __glXDispSwap_CopyColorSubTable}, - /* [ 197] = 197 */ {__glXDisp_ActiveTextureARB, __glXDispSwap_ActiveTextureARB}, - /* [ 198] = 198 */ {__glXDisp_MultiTexCoord1dvARB, __glXDispSwap_MultiTexCoord1dvARB}, - /* [ 199] = 199 */ {__glXDisp_MultiTexCoord1fvARB, __glXDispSwap_MultiTexCoord1fvARB}, - /* [ 200] = 200 */ {__glXDisp_MultiTexCoord1ivARB, __glXDispSwap_MultiTexCoord1ivARB}, - /* [ 201] = 201 */ {__glXDisp_MultiTexCoord1svARB, __glXDispSwap_MultiTexCoord1svARB}, - /* [ 202] = 202 */ {__glXDisp_MultiTexCoord2dvARB, __glXDispSwap_MultiTexCoord2dvARB}, - /* [ 203] = 203 */ {__glXDisp_MultiTexCoord2fvARB, __glXDispSwap_MultiTexCoord2fvARB}, - /* [ 204] = 204 */ {__glXDisp_MultiTexCoord2ivARB, __glXDispSwap_MultiTexCoord2ivARB}, - /* [ 205] = 205 */ {__glXDisp_MultiTexCoord2svARB, __glXDispSwap_MultiTexCoord2svARB}, - /* [ 206] = 206 */ {__glXDisp_MultiTexCoord3dvARB, __glXDispSwap_MultiTexCoord3dvARB}, - /* [ 207] = 207 */ {__glXDisp_MultiTexCoord3fvARB, __glXDispSwap_MultiTexCoord3fvARB}, - /* [ 208] = 208 */ {__glXDisp_MultiTexCoord3ivARB, __glXDispSwap_MultiTexCoord3ivARB}, - /* [ 209] = 209 */ {__glXDisp_MultiTexCoord3svARB, __glXDispSwap_MultiTexCoord3svARB}, - /* [ 210] = 210 */ {__glXDisp_MultiTexCoord4dvARB, __glXDispSwap_MultiTexCoord4dvARB}, - /* [ 211] = 211 */ {__glXDisp_MultiTexCoord4fvARB, __glXDispSwap_MultiTexCoord4fvARB}, - /* [ 212] = 212 */ {__glXDisp_MultiTexCoord4ivARB, __glXDispSwap_MultiTexCoord4ivARB}, - /* [ 213] = 213 */ {__glXDisp_MultiTexCoord4svARB, __glXDispSwap_MultiTexCoord4svARB}, - /* [ 214] = 214 */ {__glXDisp_CompressedTexImage1DARB, __glXDispSwap_CompressedTexImage1DARB}, - /* [ 215] = 215 */ {__glXDisp_CompressedTexImage2DARB, __glXDispSwap_CompressedTexImage2DARB}, - /* [ 216] = 216 */ {__glXDisp_CompressedTexImage3DARB, __glXDispSwap_CompressedTexImage3DARB}, - /* [ 217] = 217 */ {__glXDisp_CompressedTexSubImage1DARB, __glXDispSwap_CompressedTexSubImage1DARB}, - /* [ 218] = 218 */ {__glXDisp_CompressedTexSubImage2DARB, __glXDispSwap_CompressedTexSubImage2DARB}, - /* [ 219] = 219 */ {__glXDisp_CompressedTexSubImage3DARB, __glXDispSwap_CompressedTexSubImage3DARB}, - /* [ 220] = 220 */ {NULL, NULL}, - /* [ 221] = 221 */ {NULL, NULL}, - /* [ 222] = 222 */ {NULL, NULL}, - /* [ 223] = 223 */ {NULL, NULL}, - /* [ 224] = 224 */ {NULL, NULL}, - /* [ 225] = 225 */ {NULL, NULL}, - /* [ 226] = 226 */ {NULL, NULL}, - /* [ 227] = 227 */ {NULL, NULL}, - /* [ 228] = 228 */ {NULL, NULL}, - /* [ 229] = 229 */ {__glXDisp_SampleCoverageARB, __glXDispSwap_SampleCoverageARB}, - /* [ 230] = 230 */ {__glXDisp_WindowPos3fvMESA, __glXDispSwap_WindowPos3fvMESA}, - /* [ 231] = 231 */ {__glXDisp_BeginQueryARB, __glXDispSwap_BeginQueryARB}, - /* [ 232] = 232 */ {__glXDisp_EndQueryARB, __glXDispSwap_EndQueryARB}, - /* [ 233] = 233 */ {__glXDisp_DrawBuffersARB, __glXDispSwap_DrawBuffersARB}, - /* [ 234] = 234 */ {NULL, NULL}, - /* [ 235] = 235 */ {NULL, NULL}, - /* [ 236] = 236 */ {NULL, NULL}, - /* [ 237] = 237 */ {NULL, NULL}, - /* [ 238] = 238 */ {NULL, NULL}, - /* [ 239] = 239 */ {NULL, NULL}, - /* [ 240] = 2048 */ {__glXDisp_SampleMaskSGIS, __glXDispSwap_SampleMaskSGIS}, - /* [ 241] = 2049 */ {__glXDisp_SamplePatternSGIS, __glXDispSwap_SamplePatternSGIS}, - /* [ 242] = 2050 */ {NULL, NULL}, - /* [ 243] = 2051 */ {NULL, NULL}, - /* [ 244] = 2052 */ {NULL, NULL}, - /* [ 245] = 2053 */ {__glXDisp_ColorTable, __glXDispSwap_ColorTable}, - /* [ 246] = 2054 */ {__glXDisp_ColorTableParameterfv, __glXDispSwap_ColorTableParameterfv}, - /* [ 247] = 2055 */ {__glXDisp_ColorTableParameteriv, __glXDispSwap_ColorTableParameteriv}, - /* [ 248] = 2056 */ {__glXDisp_CopyColorTable, __glXDispSwap_CopyColorTable}, - /* [ 249] = 2057 */ {NULL, NULL}, - /* [ 250] = 2058 */ {NULL, NULL}, - /* [ 251] = 2059 */ {NULL, NULL}, - /* [ 252] = 2060 */ {NULL, NULL}, - /* [ 253] = 2061 */ {NULL, NULL}, - /* [ 254] = 2062 */ {NULL, NULL}, - /* [ 255] = 2063 */ {NULL, NULL}, - /* [ 256] = 2064 */ {NULL, NULL}, - /* [ 257] = 2065 */ {__glXDisp_PointParameterfEXT, __glXDispSwap_PointParameterfEXT}, - /* [ 258] = 2066 */ {__glXDisp_PointParameterfvEXT, __glXDispSwap_PointParameterfvEXT}, - /* [ 259] = 2067 */ {NULL, NULL}, - /* [ 260] = 2068 */ {NULL, NULL}, - /* [ 261] = 2069 */ {NULL, NULL}, - /* [ 262] = 2070 */ {NULL, NULL}, - /* [ 263] = 2071 */ {NULL, NULL}, - /* [ 264] = 4096 */ {__glXDisp_BlendColor, __glXDispSwap_BlendColor}, - /* [ 265] = 4097 */ {__glXDisp_BlendEquation, __glXDispSwap_BlendEquation}, - /* [ 266] = 4098 */ {NULL, NULL}, - /* [ 267] = 4099 */ {__glXDisp_TexSubImage1D, __glXDispSwap_TexSubImage1D}, - /* [ 268] = 4100 */ {__glXDisp_TexSubImage2D, __glXDispSwap_TexSubImage2D}, - /* [ 269] = 4101 */ {__glXDisp_ConvolutionFilter1D, __glXDispSwap_ConvolutionFilter1D}, - /* [ 270] = 4102 */ {__glXDisp_ConvolutionFilter2D, __glXDispSwap_ConvolutionFilter2D}, - /* [ 271] = 4103 */ {__glXDisp_ConvolutionParameterf, __glXDispSwap_ConvolutionParameterf}, - /* [ 272] = 4104 */ {__glXDisp_ConvolutionParameterfv, __glXDispSwap_ConvolutionParameterfv}, - /* [ 273] = 4105 */ {__glXDisp_ConvolutionParameteri, __glXDispSwap_ConvolutionParameteri}, - /* [ 274] = 4106 */ {__glXDisp_ConvolutionParameteriv, __glXDispSwap_ConvolutionParameteriv}, - /* [ 275] = 4107 */ {__glXDisp_CopyConvolutionFilter1D, __glXDispSwap_CopyConvolutionFilter1D}, - /* [ 276] = 4108 */ {__glXDisp_CopyConvolutionFilter2D, __glXDispSwap_CopyConvolutionFilter2D}, - /* [ 277] = 4109 */ {__glXDisp_SeparableFilter2D, __glXDispSwap_SeparableFilter2D}, - /* [ 278] = 4110 */ {__glXDisp_Histogram, __glXDispSwap_Histogram}, - /* [ 279] = 4111 */ {__glXDisp_Minmax, __glXDispSwap_Minmax}, - /* [ 280] = 4112 */ {__glXDisp_ResetHistogram, __glXDispSwap_ResetHistogram}, - /* [ 281] = 4113 */ {__glXDisp_ResetMinmax, __glXDispSwap_ResetMinmax}, - /* [ 282] = 4114 */ {__glXDisp_TexImage3D, __glXDispSwap_TexImage3D}, - /* [ 283] = 4115 */ {__glXDisp_TexSubImage3D, __glXDispSwap_TexSubImage3D}, - /* [ 284] = 4116 */ {NULL, NULL}, - /* [ 285] = 4117 */ {__glXDisp_BindTexture, __glXDispSwap_BindTexture}, - /* [ 286] = 4118 */ {__glXDisp_PrioritizeTextures, __glXDispSwap_PrioritizeTextures}, - /* [ 287] = 4119 */ {__glXDisp_CopyTexImage1D, __glXDispSwap_CopyTexImage1D}, - /* [ 288] = 4120 */ {__glXDisp_CopyTexImage2D, __glXDispSwap_CopyTexImage2D}, - /* [ 289] = 4121 */ {__glXDisp_CopyTexSubImage1D, __glXDispSwap_CopyTexSubImage1D}, - /* [ 290] = 4122 */ {__glXDisp_CopyTexSubImage2D, __glXDispSwap_CopyTexSubImage2D}, - /* [ 291] = 4123 */ {__glXDisp_CopyTexSubImage3D, __glXDispSwap_CopyTexSubImage3D}, - /* [ 292] = 4124 */ {__glXDisp_FogCoordfvEXT, __glXDispSwap_FogCoordfvEXT}, - /* [ 293] = 4125 */ {__glXDisp_FogCoorddvEXT, __glXDispSwap_FogCoorddvEXT}, - /* [ 294] = 4126 */ {__glXDisp_SecondaryColor3bvEXT, __glXDispSwap_SecondaryColor3bvEXT}, - /* [ 295] = 4127 */ {__glXDisp_SecondaryColor3svEXT, __glXDispSwap_SecondaryColor3svEXT}, - /* [ 296] = 4176 */ {NULL, NULL}, - /* [ 297] = 4177 */ {NULL, NULL}, - /* [ 298] = 4178 */ {NULL, NULL}, - /* [ 299] = 4179 */ {NULL, NULL}, - /* [ 300] = 4180 */ {__glXDisp_BindProgramNV, __glXDispSwap_BindProgramNV}, - /* [ 301] = 4181 */ {__glXDisp_ExecuteProgramNV, __glXDispSwap_ExecuteProgramNV}, - /* [ 302] = 4182 */ {__glXDisp_RequestResidentProgramsNV, __glXDispSwap_RequestResidentProgramsNV}, - /* [ 303] = 4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV}, - /* [ 304] = 4184 */ {__glXDisp_ProgramEnvParameter4fvARB, __glXDispSwap_ProgramEnvParameter4fvARB}, - /* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB}, - /* [ 306] = 4186 */ {__glXDisp_ProgramParameters4fvNV, __glXDispSwap_ProgramParameters4fvNV}, - /* [ 307] = 4187 */ {__glXDisp_ProgramParameters4dvNV, __glXDispSwap_ProgramParameters4dvNV}, - /* [ 308] = 4188 */ {__glXDisp_TrackMatrixNV, __glXDispSwap_TrackMatrixNV}, - /* [ 309] = 4189 */ {__glXDisp_VertexAttrib1svARB, __glXDispSwap_VertexAttrib1svARB}, - /* [ 310] = 4190 */ {__glXDisp_VertexAttrib2svARB, __glXDispSwap_VertexAttrib2svARB}, - /* [ 311] = 4191 */ {__glXDisp_VertexAttrib3svARB, __glXDispSwap_VertexAttrib3svARB}, - /* [ 312] = 4192 */ {__glXDisp_VertexAttrib4svARB, __glXDispSwap_VertexAttrib4svARB}, - /* [ 313] = 4193 */ {__glXDisp_VertexAttrib1fvARB, __glXDispSwap_VertexAttrib1fvARB}, - /* [ 314] = 4194 */ {__glXDisp_VertexAttrib2fvARB, __glXDispSwap_VertexAttrib2fvARB}, - /* [ 315] = 4195 */ {__glXDisp_VertexAttrib3fvARB, __glXDispSwap_VertexAttrib3fvARB}, - /* [ 316] = 4196 */ {__glXDisp_VertexAttrib4fvARB, __glXDispSwap_VertexAttrib4fvARB}, - /* [ 317] = 4197 */ {__glXDisp_VertexAttrib1dvARB, __glXDispSwap_VertexAttrib1dvARB}, - /* [ 318] = 4198 */ {__glXDisp_VertexAttrib2dvARB, __glXDispSwap_VertexAttrib2dvARB}, - /* [ 319] = 4199 */ {__glXDisp_VertexAttrib3dvARB, __glXDispSwap_VertexAttrib3dvARB}, - /* [ 320] = 4200 */ {__glXDisp_VertexAttrib4dvARB, __glXDispSwap_VertexAttrib4dvARB}, - /* [ 321] = 4201 */ {__glXDisp_VertexAttrib4NubvARB, __glXDispSwap_VertexAttrib4NubvARB}, - /* [ 322] = 4202 */ {__glXDisp_VertexAttribs1svNV, __glXDispSwap_VertexAttribs1svNV}, - /* [ 323] = 4203 */ {__glXDisp_VertexAttribs2svNV, __glXDispSwap_VertexAttribs2svNV}, - /* [ 324] = 4204 */ {__glXDisp_VertexAttribs3svNV, __glXDispSwap_VertexAttribs3svNV}, - /* [ 325] = 4205 */ {__glXDisp_VertexAttribs4svNV, __glXDispSwap_VertexAttribs4svNV}, - /* [ 326] = 4206 */ {__glXDisp_VertexAttribs1fvNV, __glXDispSwap_VertexAttribs1fvNV}, - /* [ 327] = 4207 */ {__glXDisp_VertexAttribs2fvNV, __glXDispSwap_VertexAttribs2fvNV}, - /* [ 328] = 4208 */ {__glXDisp_VertexAttribs3fvNV, __glXDispSwap_VertexAttribs3fvNV}, - /* [ 329] = 4209 */ {__glXDisp_VertexAttribs4fvNV, __glXDispSwap_VertexAttribs4fvNV}, - /* [ 330] = 4210 */ {__glXDisp_VertexAttribs1dvNV, __glXDispSwap_VertexAttribs1dvNV}, - /* [ 331] = 4211 */ {__glXDisp_VertexAttribs2dvNV, __glXDispSwap_VertexAttribs2dvNV}, - /* [ 332] = 4212 */ {__glXDisp_VertexAttribs3dvNV, __glXDispSwap_VertexAttribs3dvNV}, - /* [ 333] = 4213 */ {__glXDisp_VertexAttribs4dvNV, __glXDispSwap_VertexAttribs4dvNV}, - /* [ 334] = 4214 */ {__glXDisp_VertexAttribs4ubvNV, __glXDispSwap_VertexAttribs4ubvNV}, - /* [ 335] = 4215 */ {__glXDisp_ProgramLocalParameter4fvARB, __glXDispSwap_ProgramLocalParameter4fvARB}, - /* [ 336] = 4216 */ {__glXDisp_ProgramLocalParameter4dvARB, __glXDispSwap_ProgramLocalParameter4dvARB}, - /* [ 337] = 4217 */ {__glXDisp_ProgramStringARB, __glXDispSwap_ProgramStringARB}, - /* [ 338] = 4218 */ {__glXDisp_ProgramNamedParameter4fvNV, __glXDispSwap_ProgramNamedParameter4fvNV}, - /* [ 339] = 4219 */ {__glXDisp_ProgramNamedParameter4dvNV, __glXDispSwap_ProgramNamedParameter4dvNV}, - /* [ 340] = 4220 */ {__glXDisp_ActiveStencilFaceEXT, __glXDispSwap_ActiveStencilFaceEXT}, - /* [ 341] = 4221 */ {__glXDisp_PointParameteriNV, __glXDispSwap_PointParameteriNV}, - /* [ 342] = 4222 */ {__glXDisp_PointParameterivNV, __glXDispSwap_PointParameterivNV}, - /* [ 343] = 4223 */ {NULL, NULL}, - /* [ 344] = 4224 */ {NULL, NULL}, - /* [ 345] = 4225 */ {NULL, NULL}, - /* [ 346] = 4226 */ {NULL, NULL}, - /* [ 347] = 4227 */ {NULL, NULL}, - /* [ 348] = 4228 */ {__glXDisp_BlendEquationSeparateEXT, __glXDispSwap_BlendEquationSeparateEXT}, - /* [ 349] = 4229 */ {NULL, NULL}, - /* [ 350] = 4230 */ {__glXDisp_VertexAttrib4bvARB, __glXDispSwap_VertexAttrib4bvARB}, - /* [ 351] = 4231 */ {__glXDisp_VertexAttrib4ivARB, __glXDispSwap_VertexAttrib4ivARB}, - /* [ 352] = 4232 */ {__glXDisp_VertexAttrib4ubvARB, __glXDispSwap_VertexAttrib4ubvARB}, - /* [ 353] = 4233 */ {__glXDisp_VertexAttrib4usvARB, __glXDispSwap_VertexAttrib4usvARB}, - /* [ 354] = 4234 */ {__glXDisp_VertexAttrib4uivARB, __glXDispSwap_VertexAttrib4uivARB}, - /* [ 355] = 4235 */ {__glXDisp_VertexAttrib4NbvARB, __glXDispSwap_VertexAttrib4NbvARB}, - /* [ 356] = 4236 */ {__glXDisp_VertexAttrib4NsvARB, __glXDispSwap_VertexAttrib4NsvARB}, - /* [ 357] = 4237 */ {__glXDisp_VertexAttrib4NivARB, __glXDispSwap_VertexAttrib4NivARB}, - /* [ 358] = 4238 */ {__glXDisp_VertexAttrib4NusvARB, __glXDispSwap_VertexAttrib4NusvARB}, - /* [ 359] = 4239 */ {__glXDisp_VertexAttrib4NuivARB, __glXDispSwap_VertexAttrib4NuivARB}, - /* [ 360] = 4128 */ {__glXDisp_SecondaryColor3ivEXT, __glXDispSwap_SecondaryColor3ivEXT}, - /* [ 361] = 4129 */ {__glXDisp_SecondaryColor3fvEXT, __glXDispSwap_SecondaryColor3fvEXT}, - /* [ 362] = 4130 */ {__glXDisp_SecondaryColor3dvEXT, __glXDispSwap_SecondaryColor3dvEXT}, - /* [ 363] = 4131 */ {__glXDisp_SecondaryColor3ubvEXT, __glXDispSwap_SecondaryColor3ubvEXT}, - /* [ 364] = 4132 */ {__glXDisp_SecondaryColor3usvEXT, __glXDispSwap_SecondaryColor3usvEXT}, - /* [ 365] = 4133 */ {__glXDisp_SecondaryColor3uivEXT, __glXDispSwap_SecondaryColor3uivEXT}, - /* [ 366] = 4134 */ {__glXDisp_BlendFuncSeparateEXT, __glXDispSwap_BlendFuncSeparateEXT}, - /* [ 367] = 4135 */ {NULL, NULL}, - /* [ 368] = 4264 */ {NULL, NULL}, - /* [ 369] = 4265 */ {__glXDisp_VertexAttrib1svNV, __glXDispSwap_VertexAttrib1svNV}, - /* [ 370] = 4266 */ {__glXDisp_VertexAttrib2svNV, __glXDispSwap_VertexAttrib2svNV}, - /* [ 371] = 4267 */ {__glXDisp_VertexAttrib3svNV, __glXDispSwap_VertexAttrib3svNV}, - /* [ 372] = 4268 */ {__glXDisp_VertexAttrib4svNV, __glXDispSwap_VertexAttrib4svNV}, - /* [ 373] = 4269 */ {__glXDisp_VertexAttrib1fvNV, __glXDispSwap_VertexAttrib1fvNV}, - /* [ 374] = 4270 */ {__glXDisp_VertexAttrib2fvNV, __glXDispSwap_VertexAttrib2fvNV}, - /* [ 375] = 4271 */ {__glXDisp_VertexAttrib3fvNV, __glXDispSwap_VertexAttrib3fvNV}, - /* [ 376] = 4272 */ {__glXDisp_VertexAttrib4fvNV, __glXDispSwap_VertexAttrib4fvNV}, - /* [ 377] = 4273 */ {__glXDisp_VertexAttrib1dvNV, __glXDispSwap_VertexAttrib1dvNV}, - /* [ 378] = 4274 */ {__glXDisp_VertexAttrib2dvNV, __glXDispSwap_VertexAttrib2dvNV}, - /* [ 379] = 4275 */ {__glXDisp_VertexAttrib3dvNV, __glXDispSwap_VertexAttrib3dvNV}, - /* [ 380] = 4276 */ {__glXDisp_VertexAttrib4dvNV, __glXDispSwap_VertexAttrib4dvNV}, - /* [ 381] = 4277 */ {__glXDisp_VertexAttrib4ubvNV, __glXDispSwap_VertexAttrib4ubvNV}, - /* [ 382] = 4278 */ {NULL, NULL}, - /* [ 383] = 4279 */ {NULL, NULL}, - /* [ 384] = 4312 */ {NULL, NULL}, - /* [ 385] = 4313 */ {NULL, NULL}, - /* [ 386] = 4314 */ {NULL, NULL}, - /* [ 387] = 4315 */ {NULL, NULL}, - /* [ 388] = 4316 */ {__glXDisp_BindRenderbufferEXT, __glXDispSwap_BindRenderbufferEXT}, - /* [ 389] = 4317 */ {__glXDisp_DeleteRenderbuffersEXT, __glXDispSwap_DeleteRenderbuffersEXT}, - /* [ 390] = 4318 */ {__glXDisp_RenderbufferStorageEXT, __glXDispSwap_RenderbufferStorageEXT}, - /* [ 391] = 4319 */ {__glXDisp_BindFramebufferEXT, __glXDispSwap_BindFramebufferEXT}, - /* [ 392] = 4320 */ {__glXDisp_DeleteFramebuffersEXT, __glXDispSwap_DeleteFramebuffersEXT}, - /* [ 393] = 4321 */ {__glXDisp_FramebufferTexture1DEXT, __glXDispSwap_FramebufferTexture1DEXT}, - /* [ 394] = 4322 */ {__glXDisp_FramebufferTexture2DEXT, __glXDispSwap_FramebufferTexture2DEXT}, - /* [ 395] = 4323 */ {__glXDisp_FramebufferTexture3DEXT, __glXDispSwap_FramebufferTexture3DEXT}, - /* [ 396] = 4324 */ {__glXDisp_FramebufferRenderbufferEXT, __glXDispSwap_FramebufferRenderbufferEXT}, - /* [ 397] = 4325 */ {__glXDisp_GenerateMipmapEXT, __glXDispSwap_GenerateMipmapEXT}, - /* [ 398] = 4326 */ {NULL, NULL}, - /* [ 399] = 4327 */ {NULL, NULL}, -}; - -static const int_fast16_t Render_size_table[400][2] = { - /* [ 0] = 0 */ { 0, ~0}, - /* [ 1] = 1 */ { 8, ~0}, - /* [ 2] = 2 */ { 12, 0}, - /* [ 3] = 3 */ { 8, ~0}, - /* [ 4] = 4 */ { 8, ~0}, - /* [ 5] = 5 */ { 48, 1}, - /* [ 6] = 6 */ { 8, ~0}, - /* [ 7] = 7 */ { 28, ~0}, - /* [ 8] = 8 */ { 16, ~0}, - /* [ 9] = 9 */ { 16, ~0}, - /* [ 10] = 10 */ { 12, ~0}, - /* [ 11] = 11 */ { 8, ~0}, - /* [ 12] = 12 */ { 16, ~0}, - /* [ 13] = 13 */ { 12, ~0}, - /* [ 14] = 14 */ { 8, ~0}, - /* [ 15] = 15 */ { 36, ~0}, - /* [ 16] = 16 */ { 20, ~0}, - /* [ 17] = 17 */ { 20, ~0}, - /* [ 18] = 18 */ { 12, ~0}, - /* [ 19] = 19 */ { 8, ~0}, - /* [ 20] = 20 */ { 20, ~0}, - /* [ 21] = 21 */ { 12, ~0}, - /* [ 22] = 22 */ { 8, ~0}, - /* [ 23] = 23 */ { 4, ~0}, - /* [ 24] = 24 */ { 12, ~0}, - /* [ 25] = 25 */ { 8, ~0}, - /* [ 26] = 26 */ { 8, ~0}, - /* [ 27] = 27 */ { 8, ~0}, - /* [ 28] = 28 */ { 8, ~0}, - /* [ 29] = 29 */ { 28, ~0}, - /* [ 30] = 30 */ { 16, ~0}, - /* [ 31] = 31 */ { 16, ~0}, - /* [ 32] = 32 */ { 12, ~0}, - /* [ 33] = 33 */ { 20, ~0}, - /* [ 34] = 34 */ { 12, ~0}, - /* [ 35] = 35 */ { 12, ~0}, - /* [ 36] = 36 */ { 8, ~0}, - /* [ 37] = 37 */ { 28, ~0}, - /* [ 38] = 38 */ { 16, ~0}, - /* [ 39] = 39 */ { 16, ~0}, - /* [ 40] = 40 */ { 12, ~0}, - /* [ 41] = 41 */ { 36, ~0}, - /* [ 42] = 42 */ { 20, ~0}, - /* [ 43] = 43 */ { 20, ~0}, - /* [ 44] = 44 */ { 12, ~0}, - /* [ 45] = 45 */ { 36, ~0}, - /* [ 46] = 46 */ { 20, ~0}, - /* [ 47] = 47 */ { 20, ~0}, - /* [ 48] = 48 */ { 12, ~0}, - /* [ 49] = 49 */ { 12, ~0}, - /* [ 50] = 50 */ { 8, ~0}, - /* [ 51] = 51 */ { 8, ~0}, - /* [ 52] = 52 */ { 8, ~0}, - /* [ 53] = 53 */ { 20, ~0}, - /* [ 54] = 54 */ { 12, ~0}, - /* [ 55] = 55 */ { 12, ~0}, - /* [ 56] = 56 */ { 8, ~0}, - /* [ 57] = 57 */ { 28, ~0}, - /* [ 58] = 58 */ { 16, ~0}, - /* [ 59] = 59 */ { 16, ~0}, - /* [ 60] = 60 */ { 12, ~0}, - /* [ 61] = 61 */ { 36, ~0}, - /* [ 62] = 62 */ { 20, ~0}, - /* [ 63] = 63 */ { 20, ~0}, - /* [ 64] = 64 */ { 12, ~0}, - /* [ 65] = 65 */ { 20, ~0}, - /* [ 66] = 66 */ { 12, ~0}, - /* [ 67] = 67 */ { 12, ~0}, - /* [ 68] = 68 */ { 8, ~0}, - /* [ 69] = 69 */ { 28, ~0}, - /* [ 70] = 70 */ { 16, ~0}, - /* [ 71] = 71 */ { 16, ~0}, - /* [ 72] = 72 */ { 12, ~0}, - /* [ 73] = 73 */ { 36, ~0}, - /* [ 74] = 74 */ { 20, ~0}, - /* [ 75] = 75 */ { 20, ~0}, - /* [ 76] = 76 */ { 12, ~0}, - /* [ 77] = 77 */ { 40, ~0}, - /* [ 78] = 78 */ { 12, ~0}, - /* [ 79] = 79 */ { 8, ~0}, - /* [ 80] = 80 */ { 12, ~0}, - /* [ 81] = 81 */ { 8, 2}, - /* [ 82] = 82 */ { 12, ~0}, - /* [ 83] = 83 */ { 8, 3}, - /* [ 84] = 84 */ { 8, ~0}, - /* [ 85] = 85 */ { 12, ~0}, - /* [ 86] = 86 */ { 16, ~0}, - /* [ 87] = 87 */ { 12, 4}, - /* [ 88] = 88 */ { 16, ~0}, - /* [ 89] = 89 */ { 12, 5}, - /* [ 90] = 90 */ { 12, ~0}, - /* [ 91] = 91 */ { 8, 6}, - /* [ 92] = 92 */ { 12, ~0}, - /* [ 93] = 93 */ { 8, 7}, - /* [ 94] = 94 */ { 12, ~0}, - /* [ 95] = 95 */ { 8, ~0}, - /* [ 96] = 96 */ { 16, ~0}, - /* [ 97] = 97 */ { 12, 8}, - /* [ 98] = 98 */ { 16, ~0}, - /* [ 99] = 99 */ { 12, 9}, - /* [100] = 100 */ { 8, ~0}, - /* [101] = 101 */ { 12, ~0}, - /* [102] = 102 */ { 24, 10}, - /* [103] = 103 */ { 20, ~0}, - /* [104] = 104 */ { 8, ~0}, - /* [105] = 105 */ { 16, ~0}, - /* [106] = 106 */ { 12, 11}, - /* [107] = 107 */ { 16, ~0}, - /* [108] = 108 */ { 12, 12}, - /* [109] = 109 */ { 56, 13}, - /* [110] = 110 */ { 56, 14}, - /* [111] = 111 */ { 16, ~0}, - /* [112] = 112 */ { 12, 15}, - /* [113] = 113 */ { 16, ~0}, - /* [114] = 114 */ { 12, 16}, - /* [115] = 115 */ { 20, ~0}, - /* [116] = 116 */ { 12, 17}, - /* [117] = 117 */ { 16, ~0}, - /* [118] = 118 */ { 12, 18}, - /* [119] = 119 */ { 16, ~0}, - /* [120] = 120 */ { 12, 19}, - /* [121] = 121 */ { 4, ~0}, - /* [122] = 122 */ { 8, ~0}, - /* [123] = 123 */ { 8, ~0}, - /* [124] = 124 */ { 4, ~0}, - /* [125] = 125 */ { 8, ~0}, - /* [126] = 126 */ { 8, ~0}, - /* [127] = 127 */ { 8, ~0}, - /* [128] = 128 */ { 20, ~0}, - /* [129] = 129 */ { 8, ~0}, - /* [130] = 130 */ { 20, ~0}, - /* [131] = 131 */ { 8, ~0}, - /* [132] = 132 */ { 12, ~0}, - /* [133] = 133 */ { 8, ~0}, - /* [134] = 134 */ { 8, ~0}, - /* [135] = 135 */ { 8, ~0}, - /* [136] = 136 */ { 8, ~0}, - /* [137] = 137 */ { 12, ~0}, - /* [138] = 138 */ { 8, ~0}, - /* [139] = 139 */ { 8, ~0}, - /* [140] = 140 */ { 0, ~0}, - /* [141] = 141 */ { 4, ~0}, - /* [142] = 142 */ { 8, ~0}, - /* [143] = 143 */ { 28, 20}, - /* [144] = 144 */ { 20, 21}, - /* [145] = 145 */ { 48, 22}, - /* [146] = 146 */ { 32, 23}, - /* [147] = 147 */ { 24, ~0}, - /* [148] = 148 */ { 16, ~0}, - /* [149] = 149 */ { 44, ~0}, - /* [150] = 150 */ { 28, ~0}, - /* [151] = 151 */ { 12, ~0}, - /* [152] = 152 */ { 8, ~0}, - /* [153] = 153 */ { 20, ~0}, - /* [154] = 154 */ { 12, ~0}, - /* [155] = 155 */ { 16, ~0}, - /* [156] = 156 */ { 8, ~0}, - /* [157] = 157 */ { 24, ~0}, - /* [158] = 158 */ { 12, ~0}, - /* [159] = 159 */ { 12, ~0}, - /* [160] = 160 */ { 12, ~0}, - /* [161] = 161 */ { 8, ~0}, - /* [162] = 162 */ { 16, ~0}, - /* [163] = 163 */ { 16, ~0}, - /* [164] = 164 */ { 8, ~0}, - /* [165] = 165 */ { 12, ~0}, - /* [166] = 166 */ { 12, ~0}, - /* [167] = 167 */ { 12, ~0}, - /* [168] = 168 */ { 12, 24}, - /* [169] = 169 */ { 12, 25}, - /* [170] = 170 */ { 12, 26}, - /* [171] = 171 */ { 8, ~0}, - /* [172] = 172 */ { 24, ~0}, - /* [173] = 173 */ { 40, 27}, - /* [174] = 174 */ { 20, ~0}, - /* [175] = 175 */ { 52, ~0}, - /* [176] = 176 */ { 4, ~0}, - /* [177] = 177 */ { 68, ~0}, - /* [178] = 178 */ {132, ~0}, - /* [179] = 179 */ { 8, ~0}, - /* [180] = 180 */ { 68, ~0}, - /* [181] = 181 */ {132, ~0}, - /* [182] = 182 */ { 52, ~0}, - /* [183] = 183 */ { 4, ~0}, - /* [184] = 184 */ { 4, ~0}, - /* [185] = 185 */ { 36, ~0}, - /* [186] = 186 */ { 20, ~0}, - /* [187] = 187 */ { 28, ~0}, - /* [188] = 188 */ { 16, ~0}, - /* [189] = 189 */ { 28, ~0}, - /* [190] = 190 */ { 16, ~0}, - /* [191] = 191 */ { 20, ~0}, - /* [192] = 192 */ { 12, ~0}, - /* [193] = 193 */ { 16, 28}, - /* [194] = 194 */ { 8, ~0}, - /* [195] = 195 */ { 44, 29}, - /* [196] = 196 */ { 24, ~0}, - /* [197] = 197 */ { 8, ~0}, - /* [198] = 198 */ { 16, ~0}, - /* [199] = 199 */ { 12, ~0}, - /* [200] = 200 */ { 12, ~0}, - /* [201] = 201 */ { 12, ~0}, - /* [202] = 202 */ { 24, ~0}, - /* [203] = 203 */ { 16, ~0}, - /* [204] = 204 */ { 16, ~0}, - /* [205] = 205 */ { 12, ~0}, - /* [206] = 206 */ { 32, ~0}, - /* [207] = 207 */ { 20, ~0}, - /* [208] = 208 */ { 20, ~0}, - /* [209] = 209 */ { 16, ~0}, - /* [210] = 210 */ { 40, ~0}, - /* [211] = 211 */ { 24, ~0}, - /* [212] = 212 */ { 24, ~0}, - /* [213] = 213 */ { 16, ~0}, - /* [214] = 214 */ { 28, 30}, - /* [215] = 215 */ { 32, 31}, - /* [216] = 216 */ { 36, 32}, - /* [217] = 217 */ { 28, 33}, - /* [218] = 218 */ { 36, 34}, - /* [219] = 219 */ { 44, 35}, - /* [220] = 220 */ { 0, ~0}, - /* [221] = 221 */ { 0, ~0}, - /* [222] = 222 */ { 0, ~0}, - /* [223] = 223 */ { 0, ~0}, - /* [224] = 224 */ { 0, ~0}, - /* [225] = 225 */ { 0, ~0}, - /* [226] = 226 */ { 0, ~0}, - /* [227] = 227 */ { 0, ~0}, - /* [228] = 228 */ { 0, ~0}, - /* [229] = 229 */ { 12, ~0}, - /* [230] = 230 */ { 16, ~0}, - /* [231] = 231 */ { 12, ~0}, - /* [232] = 232 */ { 8, ~0}, - /* [233] = 233 */ { 8, 36}, - /* [234] = 234 */ { 0, ~0}, - /* [235] = 235 */ { 0, ~0}, - /* [236] = 236 */ { 0, ~0}, - /* [237] = 237 */ { 0, ~0}, - /* [238] = 238 */ { 0, ~0}, - /* [239] = 239 */ { 0, ~0}, - /* [240] = 2048 */ { 12, ~0}, - /* [241] = 2049 */ { 8, ~0}, - /* [242] = 2050 */ { 0, ~0}, - /* [243] = 2051 */ { 0, ~0}, - /* [244] = 2052 */ { 0, ~0}, - /* [245] = 2053 */ { 44, 37}, - /* [246] = 2054 */ { 12, 38}, - /* [247] = 2055 */ { 12, 39}, - /* [248] = 2056 */ { 24, ~0}, - /* [249] = 2057 */ { 0, ~0}, - /* [250] = 2058 */ { 0, ~0}, - /* [251] = 2059 */ { 0, ~0}, - /* [252] = 2060 */ { 0, ~0}, - /* [253] = 2061 */ { 0, ~0}, - /* [254] = 2062 */ { 0, ~0}, - /* [255] = 2063 */ { 0, ~0}, - /* [256] = 2064 */ { 0, ~0}, - /* [257] = 2065 */ { 12, ~0}, - /* [258] = 2066 */ { 8, 40}, - /* [259] = 2067 */ { 0, ~0}, - /* [260] = 2068 */ { 0, ~0}, - /* [261] = 2069 */ { 0, ~0}, - /* [262] = 2070 */ { 0, ~0}, - /* [263] = 2071 */ { 0, ~0}, - /* [264] = 4096 */ { 20, ~0}, - /* [265] = 4097 */ { 8, ~0}, - /* [266] = 4098 */ { 0, ~0}, - /* [267] = 4099 */ { 60, 41}, - /* [268] = 4100 */ { 60, 42}, - /* [269] = 4101 */ { 48, 43}, - /* [270] = 4102 */ { 48, 44}, - /* [271] = 4103 */ { 16, ~0}, - /* [272] = 4104 */ { 12, 45}, - /* [273] = 4105 */ { 16, ~0}, - /* [274] = 4106 */ { 12, 46}, - /* [275] = 4107 */ { 24, ~0}, - /* [276] = 4108 */ { 28, ~0}, - /* [277] = 4109 */ { 32, 47}, - /* [278] = 4110 */ { 20, ~0}, - /* [279] = 4111 */ { 16, ~0}, - /* [280] = 4112 */ { 8, ~0}, - /* [281] = 4113 */ { 8, ~0}, - /* [282] = 4114 */ { 84, 48}, - /* [283] = 4115 */ { 92, 49}, - /* [284] = 4116 */ { 0, ~0}, - /* [285] = 4117 */ { 12, ~0}, - /* [286] = 4118 */ { 8, 50}, - /* [287] = 4119 */ { 32, ~0}, - /* [288] = 4120 */ { 36, ~0}, - /* [289] = 4121 */ { 28, ~0}, - /* [290] = 4122 */ { 36, ~0}, - /* [291] = 4123 */ { 40, ~0}, - /* [292] = 4124 */ { 8, ~0}, - /* [293] = 4125 */ { 12, ~0}, - /* [294] = 4126 */ { 8, ~0}, - /* [295] = 4127 */ { 12, ~0}, - /* [296] = 4176 */ { 0, ~0}, - /* [297] = 4177 */ { 0, ~0}, - /* [298] = 4178 */ { 0, ~0}, - /* [299] = 4179 */ { 0, ~0}, - /* [300] = 4180 */ { 12, ~0}, - /* [301] = 4181 */ { 28, ~0}, - /* [302] = 4182 */ { 8, 51}, - /* [303] = 4183 */ { 16, 52}, - /* [304] = 4184 */ { 28, ~0}, - /* [305] = 4185 */ { 44, ~0}, - /* [306] = 4186 */ { 16, 53}, - /* [307] = 4187 */ { 16, 54}, - /* [308] = 4188 */ { 20, ~0}, - /* [309] = 4189 */ { 12, ~0}, - /* [310] = 4190 */ { 12, ~0}, - /* [311] = 4191 */ { 16, ~0}, - /* [312] = 4192 */ { 16, ~0}, - /* [313] = 4193 */ { 12, ~0}, - /* [314] = 4194 */ { 16, ~0}, - /* [315] = 4195 */ { 20, ~0}, - /* [316] = 4196 */ { 24, ~0}, - /* [317] = 4197 */ { 16, ~0}, - /* [318] = 4198 */ { 24, ~0}, - /* [319] = 4199 */ { 32, ~0}, - /* [320] = 4200 */ { 40, ~0}, - /* [321] = 4201 */ { 12, ~0}, - /* [322] = 4202 */ { 12, 55}, - /* [323] = 4203 */ { 12, 56}, - /* [324] = 4204 */ { 12, 57}, - /* [325] = 4205 */ { 12, 58}, - /* [326] = 4206 */ { 12, 59}, - /* [327] = 4207 */ { 12, 60}, - /* [328] = 4208 */ { 12, 61}, - /* [329] = 4209 */ { 12, 62}, - /* [330] = 4210 */ { 12, 63}, - /* [331] = 4211 */ { 12, 64}, - /* [332] = 4212 */ { 12, 65}, - /* [333] = 4213 */ { 12, 66}, - /* [334] = 4214 */ { 12, 67}, - /* [335] = 4215 */ { 28, ~0}, - /* [336] = 4216 */ { 44, ~0}, - /* [337] = 4217 */ { 16, 68}, - /* [338] = 4218 */ { 28, 69}, - /* [339] = 4219 */ { 44, 70}, - /* [340] = 4220 */ { 8, ~0}, - /* [341] = 4221 */ { 12, ~0}, - /* [342] = 4222 */ { 8, 71}, - /* [343] = 4223 */ { 0, ~0}, - /* [344] = 4224 */ { 0, ~0}, - /* [345] = 4225 */ { 0, ~0}, - /* [346] = 4226 */ { 0, ~0}, - /* [347] = 4227 */ { 0, ~0}, - /* [348] = 4228 */ { 12, ~0}, - /* [349] = 4229 */ { 0, ~0}, - /* [350] = 4230 */ { 12, ~0}, - /* [351] = 4231 */ { 24, ~0}, - /* [352] = 4232 */ { 12, ~0}, - /* [353] = 4233 */ { 16, ~0}, - /* [354] = 4234 */ { 24, ~0}, - /* [355] = 4235 */ { 12, ~0}, - /* [356] = 4236 */ { 16, ~0}, - /* [357] = 4237 */ { 24, ~0}, - /* [358] = 4238 */ { 16, ~0}, - /* [359] = 4239 */ { 24, ~0}, - /* [360] = 4128 */ { 16, ~0}, - /* [361] = 4129 */ { 16, ~0}, - /* [362] = 4130 */ { 28, ~0}, - /* [363] = 4131 */ { 8, ~0}, - /* [364] = 4132 */ { 12, ~0}, - /* [365] = 4133 */ { 16, ~0}, - /* [366] = 4134 */ { 20, ~0}, - /* [367] = 4135 */ { 0, ~0}, - /* [368] = 4264 */ { 0, ~0}, - /* [369] = 4265 */ { 12, ~0}, - /* [370] = 4266 */ { 12, ~0}, - /* [371] = 4267 */ { 16, ~0}, - /* [372] = 4268 */ { 16, ~0}, - /* [373] = 4269 */ { 12, ~0}, - /* [374] = 4270 */ { 16, ~0}, - /* [375] = 4271 */ { 20, ~0}, - /* [376] = 4272 */ { 24, ~0}, - /* [377] = 4273 */ { 16, ~0}, - /* [378] = 4274 */ { 24, ~0}, - /* [379] = 4275 */ { 32, ~0}, - /* [380] = 4276 */ { 40, ~0}, - /* [381] = 4277 */ { 12, ~0}, - /* [382] = 4278 */ { 0, ~0}, - /* [383] = 4279 */ { 0, ~0}, - /* [384] = 4312 */ { 0, ~0}, - /* [385] = 4313 */ { 0, ~0}, - /* [386] = 4314 */ { 0, ~0}, - /* [387] = 4315 */ { 0, ~0}, - /* [388] = 4316 */ { 12, ~0}, - /* [389] = 4317 */ { 8, 72}, - /* [390] = 4318 */ { 20, ~0}, - /* [391] = 4319 */ { 12, ~0}, - /* [392] = 4320 */ { 8, 73}, - /* [393] = 4321 */ { 24, ~0}, - /* [394] = 4322 */ { 24, ~0}, - /* [395] = 4323 */ { 28, ~0}, - /* [396] = 4324 */ { 20, ~0}, - /* [397] = 4325 */ { 8, ~0}, - /* [398] = 4326 */ { 0, ~0}, - /* [399] = 4327 */ { 0, ~0}, -}; - -static const gl_proto_size_func Render_size_func_table[74] = { - __glXCallListsReqSize, - __glXBitmapReqSize, - __glXFogfvReqSize, - __glXFogivReqSize, - __glXLightfvReqSize, - __glXLightivReqSize, - __glXLightModelfvReqSize, - __glXLightModelivReqSize, - __glXMaterialfvReqSize, - __glXMaterialivReqSize, - __glXPolygonStippleReqSize, - __glXTexParameterfvReqSize, - __glXTexParameterivReqSize, - __glXTexImage1DReqSize, - __glXTexImage2DReqSize, - __glXTexEnvfvReqSize, - __glXTexEnvivReqSize, - __glXTexGendvReqSize, - __glXTexGenfvReqSize, - __glXTexGenivReqSize, - __glXMap1dReqSize, - __glXMap1fReqSize, - __glXMap2dReqSize, - __glXMap2fReqSize, - __glXPixelMapfvReqSize, - __glXPixelMapuivReqSize, - __glXPixelMapusvReqSize, - __glXDrawPixelsReqSize, - __glXDrawArraysReqSize, - __glXColorSubTableReqSize, - __glXCompressedTexImage1DARBReqSize, - __glXCompressedTexImage2DARBReqSize, - __glXCompressedTexImage3DARBReqSize, - __glXCompressedTexSubImage1DARBReqSize, - __glXCompressedTexSubImage2DARBReqSize, - __glXCompressedTexSubImage3DARBReqSize, - __glXDrawBuffersARBReqSize, - __glXColorTableReqSize, - __glXColorTableParameterfvReqSize, - __glXColorTableParameterivReqSize, - __glXPointParameterfvEXTReqSize, - __glXTexSubImage1DReqSize, - __glXTexSubImage2DReqSize, - __glXConvolutionFilter1DReqSize, - __glXConvolutionFilter2DReqSize, - __glXConvolutionParameterfvReqSize, - __glXConvolutionParameterivReqSize, - __glXSeparableFilter2DReqSize, - __glXTexImage3DReqSize, - __glXTexSubImage3DReqSize, - __glXPrioritizeTexturesReqSize, - __glXRequestResidentProgramsNVReqSize, - __glXLoadProgramNVReqSize, - __glXProgramParameters4fvNVReqSize, - __glXProgramParameters4dvNVReqSize, - __glXVertexAttribs1svNVReqSize, - __glXVertexAttribs2svNVReqSize, - __glXVertexAttribs3svNVReqSize, - __glXVertexAttribs4svNVReqSize, - __glXVertexAttribs1fvNVReqSize, - __glXVertexAttribs2fvNVReqSize, - __glXVertexAttribs3fvNVReqSize, - __glXVertexAttribs4fvNVReqSize, - __glXVertexAttribs1dvNVReqSize, - __glXVertexAttribs2dvNVReqSize, - __glXVertexAttribs3dvNVReqSize, - __glXVertexAttribs4dvNVReqSize, - __glXVertexAttribs4ubvNVReqSize, - __glXProgramStringARBReqSize, - __glXProgramNamedParameter4fvNVReqSize, - __glXProgramNamedParameter4dvNVReqSize, - __glXPointParameterivNVReqSize, - __glXDeleteRenderbuffersEXTReqSize, - __glXDeleteFramebuffersEXTReqSize, -}; - -const struct __glXDispatchInfo Render_dispatch_info = { - 13, - Render_dispatch_tree, - Render_function_table, - Render_size_table, - Render_size_func_table -}; - -/*****************************************************************/ -/* tree depth = 12 */ -static const int_fast16_t VendorPriv_dispatch_tree[152] = { - /* [0] -> opcode range [0, 131072], node depth 1 */ - 2, - 5, - EMPTY_LEAF, - 119, - EMPTY_LEAF, - - /* [5] -> opcode range [0, 32768], node depth 2 */ - 1, - 8, - EMPTY_LEAF, - - /* [8] -> opcode range [0, 16384], node depth 3 */ - 1, - 11, - EMPTY_LEAF, - - /* [11] -> opcode range [0, 8192], node depth 4 */ - 2, - 16, - EMPTY_LEAF, - 78, - EMPTY_LEAF, - - /* [16] -> opcode range [0, 2048], node depth 5 */ - 2, - 21, - EMPTY_LEAF, - 36, - EMPTY_LEAF, - - /* [21] -> opcode range [0, 512], node depth 6 */ - 1, - 24, - EMPTY_LEAF, - - /* [24] -> opcode range [0, 256], node depth 7 */ - 1, - 27, - EMPTY_LEAF, - - /* [27] -> opcode range [0, 128], node depth 8 */ - 1, - 30, - EMPTY_LEAF, - - /* [30] -> opcode range [0, 64], node depth 9 */ - 1, - 33, - EMPTY_LEAF, - - /* [33] -> opcode range [0, 32], node depth 10 */ - 1, - LEAF(0), - EMPTY_LEAF, - - /* [36] -> opcode range [1024, 1536], node depth 6 */ - 2, - 41, - EMPTY_LEAF, - 53, - 67, - - /* [41] -> opcode range [1024, 1152], node depth 7 */ - 1, - 44, - EMPTY_LEAF, - - /* [44] -> opcode range [1024, 1088], node depth 8 */ - 1, - 47, - EMPTY_LEAF, - - /* [47] -> opcode range [1024, 1056], node depth 9 */ - 1, - 50, - EMPTY_LEAF, - - /* [50] -> opcode range [1024, 1040], node depth 10 */ - 1, - LEAF(16), - EMPTY_LEAF, - - /* [53] -> opcode range [1280, 1408], node depth 7 */ - 1, - 56, - EMPTY_LEAF, - - /* [56] -> opcode range [1280, 1344], node depth 8 */ - 2, - 61, - LEAF(24), - EMPTY_LEAF, - 64, - - /* [61] -> opcode range [1280, 1296], node depth 9 */ - 1, - EMPTY_LEAF, - LEAF(40), - - /* [64] -> opcode range [1328, 1344], node depth 9 */ - 1, - LEAF(48), - EMPTY_LEAF, - - /* [67] -> opcode range [1408, 1536], node depth 7 */ - 1, - 70, - EMPTY_LEAF, - - /* [70] -> opcode range [1408, 1472], node depth 8 */ - 1, - 73, - EMPTY_LEAF, - - /* [73] -> opcode range [1408, 1440], node depth 9 */ - 2, - EMPTY_LEAF, - LEAF(56), - LEAF(64), - EMPTY_LEAF, - - /* [78] -> opcode range [4096, 6144], node depth 5 */ - 2, - 83, - EMPTY_LEAF, - 101, - EMPTY_LEAF, - - /* [83] -> opcode range [4096, 4608], node depth 6 */ - 1, - 86, - EMPTY_LEAF, - - /* [86] -> opcode range [4096, 4352], node depth 7 */ - 1, - 89, - EMPTY_LEAF, - - /* [89] -> opcode range [4096, 4224], node depth 8 */ - 1, - 92, - EMPTY_LEAF, - - /* [92] -> opcode range [4096, 4160], node depth 9 */ - 1, - 95, - EMPTY_LEAF, - - /* [95] -> opcode range [4096, 4128], node depth 10 */ - 1, - 98, - EMPTY_LEAF, - - /* [98] -> opcode range [4096, 4112], node depth 11 */ - 1, - LEAF(72), - EMPTY_LEAF, - - /* [101] -> opcode range [5120, 5632], node depth 6 */ - 1, - 104, - EMPTY_LEAF, - - /* [104] -> opcode range [5120, 5376], node depth 7 */ - 1, - 107, - EMPTY_LEAF, - - /* [107] -> opcode range [5120, 5248], node depth 8 */ - 1, - 110, - EMPTY_LEAF, - - /* [110] -> opcode range [5120, 5184], node depth 9 */ - 1, - EMPTY_LEAF, - 113, - - /* [113] -> opcode range [5152, 5184], node depth 10 */ - 1, - 116, - EMPTY_LEAF, - - /* [116] -> opcode range [5152, 5168], node depth 11 */ - 1, - LEAF(80), - EMPTY_LEAF, - - /* [119] -> opcode range [65536, 98304], node depth 2 */ - 1, - 122, - EMPTY_LEAF, - - /* [122] -> opcode range [65536, 81920], node depth 3 */ - 1, - 125, - EMPTY_LEAF, - - /* [125] -> opcode range [65536, 73728], node depth 4 */ - 1, - 128, - EMPTY_LEAF, - - /* [128] -> opcode range [65536, 69632], node depth 5 */ - 1, - 131, - EMPTY_LEAF, - - /* [131] -> opcode range [65536, 67584], node depth 6 */ - 1, - 134, - EMPTY_LEAF, - - /* [134] -> opcode range [65536, 66560], node depth 7 */ - 1, - 137, - EMPTY_LEAF, - - /* [137] -> opcode range [65536, 66048], node depth 8 */ - 1, - 140, - EMPTY_LEAF, - - /* [140] -> opcode range [65536, 65792], node depth 9 */ - 1, - 143, - EMPTY_LEAF, - - /* [143] -> opcode range [65536, 65664], node depth 10 */ - 1, - 146, - EMPTY_LEAF, - - /* [146] -> opcode range [65536, 65600], node depth 11 */ - 1, - 149, - EMPTY_LEAF, - - /* [149] -> opcode range [65536, 65568], node depth 12 */ - 1, - LEAF(88), - EMPTY_LEAF, - -}; - -static const void *VendorPriv_function_table[104][2] = { - /* [ 0] = 0 */ {NULL, NULL}, - /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT}, - /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT}, - /* [ 3] = 3 */ {__glXDisp_GetConvolutionParameterivEXT, __glXDispSwap_GetConvolutionParameterivEXT}, - /* [ 4] = 4 */ {__glXDisp_GetSeparableFilterEXT, __glXDispSwap_GetSeparableFilterEXT}, - /* [ 5] = 5 */ {__glXDisp_GetHistogramEXT, __glXDispSwap_GetHistogramEXT}, - /* [ 6] = 6 */ {__glXDisp_GetHistogramParameterfvEXT, __glXDispSwap_GetHistogramParameterfvEXT}, - /* [ 7] = 7 */ {__glXDisp_GetHistogramParameterivEXT, __glXDispSwap_GetHistogramParameterivEXT}, - /* [ 8] = 8 */ {__glXDisp_GetMinmaxEXT, __glXDispSwap_GetMinmaxEXT}, - /* [ 9] = 9 */ {__glXDisp_GetMinmaxParameterfvEXT, __glXDispSwap_GetMinmaxParameterfvEXT}, - /* [ 10] = 10 */ {__glXDisp_GetMinmaxParameterivEXT, __glXDispSwap_GetMinmaxParameterivEXT}, - /* [ 11] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT}, - /* [ 12] = 12 */ {__glXDisp_DeleteTexturesEXT, __glXDispSwap_DeleteTexturesEXT}, - /* [ 13] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT}, - /* [ 14] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT}, - /* [ 15] = 15 */ {NULL, NULL}, - /* [ 16] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT}, - /* [ 17] = 1025 */ {NULL, NULL}, - /* [ 18] = 1026 */ {NULL, NULL}, - /* [ 19] = 1027 */ {NULL, NULL}, - /* [ 20] = 1028 */ {NULL, NULL}, - /* [ 21] = 1029 */ {NULL, NULL}, - /* [ 22] = 1030 */ {NULL, NULL}, - /* [ 23] = 1031 */ {NULL, NULL}, - /* [ 24] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB}, - /* [ 25] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB}, - /* [ 26] = 1298 */ {__glXDisp_GetProgramivNV, __glXDispSwap_GetProgramivNV}, - /* [ 27] = 1299 */ {__glXDisp_GetProgramStringNV, __glXDispSwap_GetProgramStringNV}, - /* [ 28] = 1300 */ {__glXDisp_GetTrackMatrixivNV, __glXDispSwap_GetTrackMatrixivNV}, - /* [ 29] = 1301 */ {__glXDisp_GetVertexAttribdvARB, __glXDispSwap_GetVertexAttribdvARB}, - /* [ 30] = 1302 */ {__glXDisp_GetVertexAttribfvNV, __glXDispSwap_GetVertexAttribfvNV}, - /* [ 31] = 1303 */ {__glXDisp_GetVertexAttribivNV, __glXDispSwap_GetVertexAttribivNV}, - /* [ 32] = 1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV}, - /* [ 33] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB}, - /* [ 34] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB}, - /* [ 35] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB}, - /* [ 36] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB}, - /* [ 37] = 1309 */ {NULL, NULL}, - /* [ 38] = 1310 */ {__glXDisp_GetProgramNamedParameterfvNV, __glXDispSwap_GetProgramNamedParameterfvNV}, - /* [ 39] = 1311 */ {__glXDisp_GetProgramNamedParameterdvNV, __glXDispSwap_GetProgramNamedParameterdvNV}, - /* [ 40] = 1288 */ {NULL, NULL}, - /* [ 41] = 1289 */ {NULL, NULL}, - /* [ 42] = 1290 */ {NULL, NULL}, - /* [ 43] = 1291 */ {NULL, NULL}, - /* [ 44] = 1292 */ {NULL, NULL}, - /* [ 45] = 1293 */ {__glXDisp_AreProgramsResidentNV, __glXDispSwap_AreProgramsResidentNV}, - /* [ 46] = 1294 */ {__glXDisp_DeleteProgramsNV, __glXDispSwap_DeleteProgramsNV}, - /* [ 47] = 1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV}, - /* [ 48] = 1328 */ {NULL, NULL}, - /* [ 49] = 1329 */ {NULL, NULL}, - /* [ 50] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT}, - /* [ 51] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT}, - /* [ 52] = 1332 */ {NULL, NULL}, - /* [ 53] = 1333 */ {NULL, NULL}, - /* [ 54] = 1334 */ {NULL, NULL}, - /* [ 55] = 1335 */ {NULL, NULL}, - /* [ 56] = 1416 */ {NULL, NULL}, - /* [ 57] = 1417 */ {NULL, NULL}, - /* [ 58] = 1418 */ {NULL, NULL}, - /* [ 59] = 1419 */ {NULL, NULL}, - /* [ 60] = 1420 */ {NULL, NULL}, - /* [ 61] = 1421 */ {NULL, NULL}, - /* [ 62] = 1422 */ {__glXDisp_IsRenderbufferEXT, __glXDispSwap_IsRenderbufferEXT}, - /* [ 63] = 1423 */ {__glXDisp_GenRenderbuffersEXT, __glXDispSwap_GenRenderbuffersEXT}, - /* [ 64] = 1424 */ {__glXDisp_GetRenderbufferParameterivEXT, __glXDispSwap_GetRenderbufferParameterivEXT}, - /* [ 65] = 1425 */ {__glXDisp_IsFramebufferEXT, __glXDispSwap_IsFramebufferEXT}, - /* [ 66] = 1426 */ {__glXDisp_GenFramebuffersEXT, __glXDispSwap_GenFramebuffersEXT}, - /* [ 67] = 1427 */ {__glXDisp_CheckFramebufferStatusEXT, __glXDispSwap_CheckFramebufferStatusEXT}, - /* [ 68] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT, __glXDispSwap_GetFramebufferAttachmentParameterivEXT}, - /* [ 69] = 1429 */ {NULL, NULL}, - /* [ 70] = 1430 */ {NULL, NULL}, - /* [ 71] = 1431 */ {NULL, NULL}, - /* [ 72] = 4096 */ {NULL, NULL}, - /* [ 73] = 4097 */ {NULL, NULL}, - /* [ 74] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI}, - /* [ 75] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI}, - /* [ 76] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI}, - /* [ 77] = 4101 */ {NULL, NULL}, - /* [ 78] = 4102 */ {NULL, NULL}, - /* [ 79] = 4103 */ {NULL, NULL}, - /* [ 80] = 5152 */ {NULL, NULL}, - /* [ 81] = 5153 */ {NULL, NULL}, - /* [ 82] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA}, - /* [ 83] = 5155 */ {NULL, NULL}, - /* [ 84] = 5156 */ {NULL, NULL}, - /* [ 85] = 5157 */ {NULL, NULL}, - /* [ 86] = 5158 */ {NULL, NULL}, - /* [ 87] = 5159 */ {NULL, NULL}, - /* [ 88] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI}, - /* [ 89] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI}, - /* [ 90] = 65538 */ {NULL, NULL}, - /* [ 91] = 65539 */ {NULL, NULL}, - /* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX}, - /* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX}, - /* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX}, - /* [ 95] = 65543 */ {__glXDisp_CreateGLXPbufferSGIX, __glXDispSwap_CreateGLXPbufferSGIX}, - /* [ 96] = 65544 */ {__glXDisp_DestroyGLXPbufferSGIX, __glXDispSwap_DestroyGLXPbufferSGIX}, - /* [ 97] = 65545 */ {__glXDisp_ChangeDrawableAttributesSGIX, __glXDispSwap_ChangeDrawableAttributesSGIX}, - /* [ 98] = 65546 */ {__glXDisp_GetDrawableAttributesSGIX, __glXDispSwap_GetDrawableAttributesSGIX}, - /* [ 99] = 65547 */ {NULL, NULL}, - /* [ 100] = 65548 */ {NULL, NULL}, - /* [ 101] = 65549 */ {NULL, NULL}, - /* [ 102] = 65550 */ {NULL, NULL}, - /* [ 103] = 65551 */ {NULL, NULL}, -}; - -const struct __glXDispatchInfo VendorPriv_dispatch_info = { - 17, - VendorPriv_dispatch_tree, - VendorPriv_function_table, - NULL, - NULL -}; - diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh index 0cfe1c9b6..af9adbd94 100755 --- a/GL/symlink-mesa.sh +++ b/GL/symlink-mesa.sh @@ -229,6 +229,14 @@ symlink_glx() { action indirect_size.h action glcontextmodes.c action glcontextmodes.h + action indirect_dispatch.c + action indirect_dispatch.h + action indirect_dispatch_swap.c + action indirect_reqsize.c + action indirect_reqsize.h + action indirect_size_get.c + action indirect_size_get.h + action indirect_table.c src_dir src/mesa/glapi diff --git a/XTrap/xtrapddmi.c b/XTrap/xtrapddmi.c index 73a20c1f6..3f1a72ab8 100644 --- a/XTrap/xtrapddmi.c +++ b/XTrap/xtrapddmi.c @@ -52,7 +52,7 @@ SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include <X11/X.h> /* From library include environment */ -#include "input.h" /* From server include env. (must be before Xlib.h!) */ +#include "inputstr.h" /* From server include env. (must be before Xlib.h!) */ #ifdef PC # include "scrintst.h" /* Screen struct */ # include "extnsist.h" @@ -96,8 +96,8 @@ int XETrapSimulateXEvent(register xXTrapInputReq *request, xEvent xev; register int x = request->input.x; register int y = request->input.y; - DevicePtr keydev = LookupKeyboardDevice(); - DevicePtr ptrdev = LookupPointerDevice(); + DevicePtr keydev = (DevicePtr)inputInfo.keyboard; + DevicePtr ptrdev = (DevicePtr)inputInfo.pointer; if (request->input.screen < screenInfo.numScreens) { diff --git a/XTrap/xtrapdi.c b/XTrap/xtrapdi.c index 80124fa73..7dd9584a0 100644 --- a/XTrap/xtrapdi.c +++ b/XTrap/xtrapdi.c @@ -58,7 +58,7 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/Xos.h> #include <X11/X.h> #include <X11/Xproto.h> -#include "input.h" /* Server DevicePtr definitions */ +#include "inputstr.h" /* Server DevicePtr definitions */ #include "misc.h" /* Server swapping macros */ #include "dixstruct.h" /* Server ClientRec definitions */ #include "resource.h" /* Used with the MakeAtom call */ @@ -277,7 +277,7 @@ Bool XETrapRedirectDevices() /* Do we need to redirect the keyboard device? */ if (XETrapKbdDev == NULL) { - if ((XETrapKbdDev = LookupKeyboardDevice()) == NULL) + if ((XETrapKbdDev = (DevicePtr)inputInfo.keyboard) == NULL) { retval = False; } @@ -302,7 +302,7 @@ Bool XETrapRedirectDevices() #ifndef VECTORED_EVENTS if (XETrapPtrDev == NULL) { - if ((XETrapPtrDev = LookupPointerDevice()) == 0L) + if ((XETrapPtrDev = (DevicePtr)inputInfo.pointer) == 0L) { retval = False; } diff --git a/Xext/EVI.c b/Xext/EVI.c index 4bd050ca7..a637bae5d 100644 --- a/Xext/EVI.c +++ b/Xext/EVI.c @@ -34,6 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XEVIstr.h> #include "EVIstruct.h" #include "modinit.h" +#include "scrnintstr.h" static EviPrivPtr eviPriv; @@ -84,10 +85,22 @@ ProcEVIGetVisualInfo(ClientPtr client) { REQUEST(xEVIGetVisualInfoReq); xEVIGetVisualInfoReply rep; - int n, n_conflict, n_info, sz_info, sz_conflict; + int i, n, n_conflict, n_info, sz_info, sz_conflict; VisualID32 *conflict; + unsigned int total_visuals = 0; xExtendedVisualInfo *eviInfo; int status; + + /* + * do this first, otherwise REQUEST_FIXED_SIZE can overflow. we assume + * here that you don't have more than 2^32 visuals over all your screens; + * this seems like a safe assumption. + */ + for (i = 0; i < screenInfo.numScreens; i++) + total_visuals += screenInfo.screens[i]->numVisuals; + if (stuff->n_visual > total_visuals) + return BadValue; + REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32); status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual, &eviInfo, &n_info, &conflict, &n_conflict); diff --git a/Xext/Makefile.am b/Xext/Makefile.am index 946c118b1..648736d95 100644 --- a/Xext/Makefile.am +++ b/Xext/Makefile.am @@ -33,9 +33,6 @@ MODULE_SRCS = \ sync.c \ xcmisc.c -# Extra configuration files ship with some extensions -SERVERCONFIG_DATA = - # Optional sources included if extension enabled by configure.ac rules # MIT Shared Memory extension @@ -75,13 +72,17 @@ if XACE BUILTIN_SRCS += $(XACE_SRCS) endif +# SELinux extension: provides SELinux policy support for X objects +# requires X-ACE extension +XSELINUX_SRCS = xselinux.c xselinux.h +if XSELINUX +MODULE_SRCS += $(XSELINUX_SRCS) +endif + # Security extension: multi-level security to protect clients from each other XCSECURITY_SRCS = security.c securitysrv.h if XCSECURITY BUILTIN_SRCS += $(XCSECURITY_SRCS) - -SERVERCONFIG_DATA += SecurityPolicy -AM_CFLAGS += -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGdir)/SecurityPolicy\" endif XCALIBRATE_SRCS = xcalibrate.c @@ -159,7 +160,6 @@ libXextmodule_la_SOURCES = $(MODULE_SRCS) endif EXTRA_DIST = \ - $(SERVERCONFIG_DATA) \ $(MITSHM_SRCS) \ $(XV_SRCS) \ $(RES_SRCS) \ diff --git a/Xext/SecurityPolicy b/Xext/SecurityPolicy deleted file mode 100644 index cc521c263..000000000 --- a/Xext/SecurityPolicy +++ /dev/null @@ -1,88 +0,0 @@ -version-1 - -# $Xorg: SecurityPolicy,v 1.3 2000/08/17 19:47:56 cpqbld Exp $ - -# The site policy fields are interpreted by the XC-QUERY-SECURITY-1 -# authorization protocol. The values are arbitrary and site-specific. -# Refer to the Security Extension Specification for the usage of the policies. -#sitepolicy A -#sitepolicy B -#sitepolicy C - -# Property access rules: -# property <property> <window> <permissions> -# <window> ::= any | root | <propertyselector> -# <propertyselector> ::= <property> | <property>=<value> -# <permissions> :== [ <operation> | <action> | <space> ]* -# <operation> :== r | w | d -# r read -# w write -# d delete -# <action> :== a | i | e -# a allow -# i ignore -# e error - -# Allow reading of application resources, but not writing. -property RESOURCE_MANAGER root ar iw -property SCREEN_RESOURCES root ar iw - -# Ignore attempts to use cut buffers. Giving errors causes apps to crash, -# and allowing access may give away too much information. -property CUT_BUFFER0 root irw -property CUT_BUFFER1 root irw -property CUT_BUFFER2 root irw -property CUT_BUFFER3 root irw -property CUT_BUFFER4 root irw -property CUT_BUFFER5 root irw -property CUT_BUFFER6 root irw -property CUT_BUFFER7 root irw - -# If you are using Motif, you probably want these. -property _MOTIF_DEFAULT_BINDINGS root ar iw -property _MOTIF_DRAG_WINDOW root ar iw -property _MOTIF_DRAG_TARGETS any ar iw -property _MOTIF_DRAG_ATOMS any ar iw -property _MOTIF_DRAG_ATOM_PAIRS any ar iw - -# If you are running CDE you also need these -property _MOTIF_WM_INFO root arw -property TT_SESSION root irw -property WM_ICON_SIZE root irw -property "SDT Pixel Set" any irw - -# The next two rules let xwininfo -tree work when untrusted. -property WM_NAME any ar - -# Allow read of WM_CLASS, but only for windows with WM_NAME. -# This might be more restrictive than necessary, but demonstrates -# the <required property> facility, and is also an attempt to -# say "top level windows only." -property WM_CLASS WM_NAME ar - -# These next three let xlsclients work untrusted. Think carefully -# before including these; giving away the client machine name and command -# may be exposing too much. -property WM_STATE WM_NAME ar -property WM_CLIENT_MACHINE WM_NAME ar -property WM_COMMAND WM_NAME ar - -# To let untrusted clients use the standard colormaps created by -# xstdcmap, include these lines. -property RGB_DEFAULT_MAP root ar -property RGB_BEST_MAP root ar -property RGB_RED_MAP root ar -property RGB_GREEN_MAP root ar -property RGB_BLUE_MAP root ar -property RGB_GRAY_MAP root ar - -# To let untrusted clients use the color management database created -# by xcmsdb, include these lines. -property XDCCC_LINEAR_RGB_CORRECTION root ar -property XDCCC_LINEAR_RGB_MATRICES root ar -property XDCCC_GRAY_SCREENWHITEPOINT root ar -property XDCCC_GRAY_CORRECTION root ar - -# To let untrusted clients use the overlay visuals that many vendors -# support, include this line. -property SERVER_OVERLAY_VISUALS root ar diff --git a/Xext/appgroup.c b/Xext/appgroup.c index 7bd205587..c40782df5 100644 --- a/Xext/appgroup.c +++ b/Xext/appgroup.c @@ -345,7 +345,7 @@ int AttrValidate( ColormapPtr pColormap; rc = dixLookupWindow(&pWin, pAppGrp->default_root, client, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; @@ -367,8 +367,10 @@ int AttrValidate( } if (pAppGrp->default_colormap) { - pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP); - /* XXX check that pColormap is not NULL */ + rc = dixLookupResource((pointer *)&pColormap, pAppGrp->default_colormap, + RT_COLORMAP, client, DixUseAccess); + if (rc != Success) + return rc; if (pColormap->pScreen != pScreen) return BadColor; if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual)) @@ -470,7 +472,7 @@ int ProcXagQuery( int n, rc; REQUEST_SIZE_MATCH (xXagQueryReq); - rc = dixLookupClient(&pClient, stuff->resource, client, DixUnknownAccess); + rc = dixLookupClient(&pClient, stuff->resource, client, DixGetAttrAccess); if (rc != Success) return rc; diff --git a/Xext/bigreq.c b/Xext/bigreq.c index e7d410250..4f0724bc1 100644 --- a/Xext/bigreq.c +++ b/Xext/bigreq.c @@ -50,11 +50,9 @@ static DISPATCH_PROC(ProcBigReqDispatch); void BigReqExtensionInit(INITARGS) { - (void) AddExtension(XBigReqExtensionName, 0, 0, - ProcBigReqDispatch, ProcBigReqDispatch, - BigReqResetProc, StandardMinorOpcode); - - DeclareExtensionSecurity(XBigReqExtensionName, TRUE); + AddExtension(XBigReqExtensionName, 0, 0, + ProcBigReqDispatch, ProcBigReqDispatch, + BigReqResetProc, StandardMinorOpcode); } /*ARGSUSED*/ diff --git a/Xext/cup.c b/Xext/cup.c index 0a83855e5..fd1409e33 100644 --- a/Xext/cup.c +++ b/Xext/cup.c @@ -176,6 +176,9 @@ int ProcGetReservedColormapEntries( REQUEST_SIZE_MATCH (xXcupGetReservedColormapEntriesReq); + if (stuff->screen >= screenInfo.numScreens) + return BadValue; + #ifndef HAVE_SPECIAL_DESKTOP_COLORS citems[CUP_BLACK_PIXEL].pixel = screenInfo.screens[stuff->screen]->blackPixel; @@ -204,12 +207,13 @@ int ProcStoreColors( { REQUEST (xXcupStoreColorsReq); ColormapPtr pcmp; + int rc; REQUEST_AT_LEAST_SIZE (xXcupStoreColorsReq); - pcmp = (ColormapPtr) SecurityLookupIDByType (client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, + client, DixAddAccess); - if (pcmp) { + if (rc == Success) { int ncolors, n; xXcupStoreColorsReply rep; xColorItem* cptr; @@ -253,7 +257,7 @@ int ProcStoreColors( return client->noClientException; } else { client->errorValue = stuff->cmap; - return BadColor; + return (rc == BadValue) ? BadColor : rc; } } diff --git a/Xext/dpms.c b/Xext/dpms.c index b062b53aa..6f01fa348 100644 --- a/Xext/dpms.c +++ b/Xext/dpms.c @@ -73,9 +73,9 @@ static void DPMSResetProc(ExtensionEntry* extEntry); void DPMSExtensionInit(INITARGS) { - (void) AddExtension(DPMSExtensionName, 0, 0, - ProcDPMSDispatch, SProcDPMSDispatch, - DPMSResetProc, StandardMinorOpcode); + AddExtension(DPMSExtensionName, 0, 0, + ProcDPMSDispatch, SProcDPMSDispatch, + DPMSResetProc, StandardMinorOpcode); } /*ARGSUSED*/ @@ -206,7 +206,7 @@ ProcDPMSDisable(client) REQUEST_SIZE_MATCH(xDPMSDisableReq); - DPMSSet(DPMSModeOn); + DPMSSet(client, DPMSModeOn); DPMSEnabled = FALSE; @@ -241,7 +241,7 @@ ProcDPMSForceLevel(client) return BadValue; } - DPMSSet(stuff->level); + DPMSSet(client, stuff->level); return(client->noClientException); } diff --git a/Xext/dpmsproc.h b/Xext/dpmsproc.h index f5485ea79..d57f57318 100644 --- a/Xext/dpmsproc.h +++ b/Xext/dpmsproc.h @@ -8,7 +8,9 @@ #ifndef _DPMSPROC_H_ #define _DPMSPROC_H_ -void DPMSSet(int level); +#include "dixstruct.h" + +int DPMSSet(ClientPtr client, int level); int DPMSGet(int *plevel); Bool DPMSSupported(void); diff --git a/Xext/dpmsstubs.c b/Xext/dpmsstubs.c index 9f99a2d22..0f59d5160 100644 --- a/Xext/dpmsstubs.c +++ b/Xext/dpmsstubs.c @@ -26,8 +26,6 @@ Equipment Corporation. ******************************************************************/ -typedef int Bool; - #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -46,7 +44,7 @@ int DPMSGet(int *plevel) return -1; } -void DPMSSet(int level) +int DPMSSet(ClientPtr client, int level) { - + return Success; } diff --git a/Xext/mbuf.c b/Xext/mbuf.c index e646a7daa..0b5b91ea9 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -61,8 +61,8 @@ in this Software without prior written authorization from The Open Group. static int MultibufferEventBase; static int MultibufferErrorBase; -int MultibufferScreenIndex = -1; -int MultibufferWindowIndex = -1; +static DevPrivateKey MultibufferScreenPrivKey = &MultibufferScreenPrivKey; +static DevPrivateKey MultibufferWindowPrivKey = &MultibufferWindowPrivKey; static void PerformDisplayRequest ( MultibuffersPtr * /* ppMultibuffers */, @@ -200,27 +200,16 @@ MultibufferExtensionInit() ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; - /* - * allocate private pointers in windows and screens. Allocating - * window privates may seem like an unnecessary expense, but every - * PositionWindow call must check to see if the window is - * multi-buffered; a resource lookup is too expensive. - */ - MultibufferScreenIndex = AllocateScreenPrivateIndex (); - if (MultibufferScreenIndex < 0) - return; - MultibufferWindowIndex = AllocateWindowPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; - if (!AllocateWindowPrivate (pScreen, MultibufferWindowIndex, 0) || - !(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) + if (!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) { for (j = 0; j < i; j++) - xfree (screenInfo.screens[j]->devPrivates[MultibufferScreenIndex].ptr); + xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey)); return; } - pScreen->devPrivates[MultibufferScreenIndex].ptr = (pointer) pMultibufferScreen; + dixSetPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey, pMultibufferScreen); /* * wrap PositionWindow to resize the pixmap when the window * changes size @@ -232,7 +221,7 @@ MultibufferExtensionInit() * create the resource types */ MultibufferDrawableResType = - CreateNewResourceType(MultibufferDrawableDelete)|RC_CACHED|RC_DRAWABLE; + CreateNewResourceType(MultibufferDrawableDelete)|RC_DRAWABLE; MultibufferResType = CreateNewResourceType(MultibufferDelete); MultibuffersResType = CreateNewResourceType(MultibuffersDelete); OtherClientResType = CreateNewResourceType(OtherClientDelete); @@ -260,14 +249,11 @@ ExtensionEntry *extEntry; ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; - if (MultibufferScreenIndex < 0) - return; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; - if (pScreen->devPrivates[MultibufferScreenIndex].ptr) + if ((pMultibufferScreen = (MultibufferScreenPtr)dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey))) { - pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr; pScreen->PositionWindow = pMultibufferScreen->PositionWindow; xfree (pMultibufferScreen); } @@ -427,7 +413,7 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint) pMultibuffers->lastUpdate.milliseconds = 0; pMultibuffers->width = width; pMultibuffers->height = height; - pWin->devPrivates[MultibufferWindowIndex].ptr = (pointer) pMultibuffers; + dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, pMultibuffers); if (pClearGC) FreeScratchGC(pClearGC); return Success; } @@ -487,7 +473,7 @@ ProcCreateImageBuffers (client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.numberBuffer = ((MultibuffersPtr) (pWin->devPrivates[MultibufferWindowIndex].ptr))->numMultibuffer; + rep.numberBuffer = ((MultibuffersPtr) (dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey)))->numMultibuffer; if (client->swapped) { swaps(&rep.sequenceNumber, n); @@ -1236,7 +1222,7 @@ GetBufferPointer (pWin, i) { MultibuffersPtr pMultibuffers; - if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr)) + if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey))) return NULL; return (DrawablePtr) pMultibuffers->buffers[i].pPixmap; } @@ -1475,7 +1461,7 @@ DestroyImageBuffers (pWin) { FreeResourceByType (pWin->drawable.id, MultibuffersResType, FALSE); /* Zero out the window's pointer to the buffers so they won't be reused */ - pWin->devPrivates[MultibufferWindowIndex].ptr = NULL; + dixSetPrivate(&pWin->devPrivates, MultibufferWindowPrivKey, NULL); } /* @@ -1503,11 +1489,11 @@ MultibufferPositionWindow (pWin, x, y) Bool clear; pScreen = pWin->drawable.pScreen; - pMultibufferScreen = (MultibufferScreenPtr) pScreen->devPrivates[MultibufferScreenIndex].ptr; + pMultibufferScreen = (MultibufferScreenPtr) dixLookupPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey); (*pMultibufferScreen->PositionWindow) (pWin, x, y); /* if this window is not multibuffered, we're done */ - if (!(pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr)) + if (!(pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey))) return TRUE; /* if new size is same as old, we're done */ @@ -1620,7 +1606,7 @@ MultibufferDrawableDelete (value, id) if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr) pDrawable; - pMultibuffers = (MultibuffersPtr) pWin->devPrivates[MultibufferWindowIndex].ptr; + pMultibuffers = (MultibuffersPtr) dixLookupPrivate(&pWin->devPrivates, MultibufferWindowPrivKey); pPixmap = pMultibuffers->buffers[pMultibuffers->displayedMultibuffer].pPixmap; } else diff --git a/Xext/mitmisc.c b/Xext/mitmisc.c index f89ee0c2b..e793d4dc1 100644 --- a/Xext/mitmisc.c +++ b/Xext/mitmisc.c @@ -56,9 +56,9 @@ static DISPATCH_PROC(SProcMITSetBugMode); void MITMiscExtensionInit(INITARGS) { - (void) AddExtension(MITMISCNAME, 0, 0, - ProcMITDispatch, SProcMITDispatch, - MITResetProc, StandardMinorOpcode); + AddExtension(MITMISCNAME, 0, 0, + ProcMITDispatch, SProcMITDispatch, + MITResetProc, StandardMinorOpcode); } /*ARGSUSED*/ diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index d054cf8f1..d8ec588aa 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -81,9 +81,6 @@ static DepthPtr PanoramiXDepths; static int PanoramiXNumVisuals; static VisualPtr PanoramiXVisuals; -/* We support at most 256 visuals */ -_X_EXPORT XID *PanoramiXVisualTable = NULL; - _X_EXPORT unsigned long XRC_DRAWABLE; _X_EXPORT unsigned long XRT_WINDOW; _X_EXPORT unsigned long XRT_PIXMAP; @@ -107,8 +104,8 @@ static void PanoramiXResetProc(ExtensionEntry*); int (* SavedProcVector[256]) (ClientPtr client) = { NULL, }; -static int PanoramiXGCIndex = -1; -static int PanoramiXScreenIndex = -1; +static DevPrivateKey PanoramiXGCKey = &PanoramiXGCKey; +static DevPrivateKey PanoramiXScreenKey = &PanoramiXScreenKey; typedef struct { DDXPointRec clipOrg; @@ -137,8 +134,8 @@ static GCFuncs XineramaGCFuncs = { }; #define Xinerama_GC_FUNC_PROLOGUE(pGC)\ - PanoramiXGCPtr pGCPriv = \ - (PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\ + PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr) \ + dixLookupPrivate(&(pGC)->devPrivates, PanoramiXGCKey); \ (pGC)->funcs = pGCPriv->wrapFuncs; #define Xinerama_GC_FUNC_EPILOGUE(pGC)\ @@ -149,8 +146,8 @@ static GCFuncs XineramaGCFuncs = { static Bool XineramaCloseScreen (int i, ScreenPtr pScreen) { - PanoramiXScreenPtr pScreenPriv = - (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr; + PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr) + dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateGC = pScreenPriv->CreateGC; @@ -168,14 +165,14 @@ static Bool XineramaCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; - PanoramiXScreenPtr pScreenPriv = - (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr; + PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr) + dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey); Bool ret; pScreen->CreateGC = pScreenPriv->CreateGC; if((ret = (*pScreen->CreateGC)(pGC))) { - PanoramiXGCPtr pGCPriv = - (PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr; + PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr) + dixLookupPrivate(&pGC->devPrivates, PanoramiXGCKey); pGCPriv->wrapFuncs = pGC->funcs; pGC->funcs = &XineramaGCFuncs; @@ -281,8 +278,8 @@ XineramaCopyGC ( unsigned long mask, GCPtr pGCDst ){ - PanoramiXGCPtr pSrcPriv = - (PanoramiXGCPtr) pGCSrc->devPrivates[PanoramiXGCIndex].ptr; + PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr) + dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey); Xinerama_GC_FUNC_PROLOGUE (pGCDst); if(mask & GCTileStipXOrigin) @@ -463,10 +460,8 @@ void PanoramiXExtensionInit(int argc, char *argv[]) ProcPanoramiXDispatch, SProcPanoramiXDispatch, PanoramiXResetProc, StandardMinorOpcode); - if (!extEntry) { - ErrorF("PanoramiXExtensionInit(): failed to AddExtension\n"); + if (!extEntry) break; - } /* * First make sure all the basic allocations succeed. If not, @@ -477,20 +472,17 @@ void PanoramiXExtensionInit(int argc, char *argv[]) xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData)); BREAK_IF(!panoramiXdataPtr); - BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0); - BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0); + + if (!dixRequestPrivate(PanoramiXGCKey, sizeof(PanoramiXGCRec))) { + noPanoramiXExtension = TRUE; + return; + } for (i = 0; i < PanoramiXNumScreens; i++) { pScreen = screenInfo.screens[i]; - if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex, - sizeof(PanoramiXGCRec))) { - noPanoramiXExtension = TRUE; - return; - } - pScreenPriv = xalloc(sizeof(PanoramiXScreenRec)); - pScreen->devPrivates[PanoramiXScreenIndex].ptr = - (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, + pScreenPriv); if(!pScreenPriv) { noPanoramiXExtension = TRUE; return; @@ -517,7 +509,7 @@ void PanoramiXExtensionInit(int argc, char *argv[]) if (!success) { noPanoramiXExtension = TRUE; - ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME); + ErrorF(PANORAMIX_PROTOCOL_NAME " extension failed to initialize\n"); return; } @@ -607,14 +599,14 @@ Bool PanoramiXCreateConnectionBlock(void) */ if(!PanoramiXNumDepths) { - ErrorF("PanoramiX error: Incompatible screens. No common visuals\n"); + ErrorF("Xinerama error: No common visuals\n"); return FALSE; } for(i = 1; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) { - ErrorF("PanoramiX error: Incompatible screens. Root window depths differ\n"); + ErrorF("Xinerama error: Root window depths differ\n"); return FALSE; } if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport) @@ -707,143 +699,133 @@ Bool PanoramiXCreateConnectionBlock(void) return TRUE; } -extern -void PanoramiXConsolidate(void) +/* + * This isn't just memcmp(), bitsPerRGBValue is skipped. markv made that + * change way back before xf86 4.0, but the comment for _why_ is a bit + * opaque, so I'm not going to question it for now. + * + * This is probably better done as a screen hook so DBE/EVI/GLX can add + * their own tests, and adding privates to VisualRec so they don't have to + * do their own back-mapping. + */ +static Bool +VisualsEqual(VisualPtr a, VisualPtr b) { - int i, j, k; - VisualPtr pVisual, pVisual2; - ScreenPtr pScreen, pScreen2; - DepthPtr pDepth, pDepth2; - PanoramiXRes *root, *defmap, *saver; - Bool foundDepth, missingDepth; - - if(!PanoramiXVisualTable) - PanoramiXVisualTable = xcalloc(256 * MAXSCREENS, sizeof(XID)); - - pScreen = screenInfo.screens[0]; - pVisual = pScreen->visuals; - pDepth = pScreen->allowedDepths; + return ((a->class == b->class) && + (a->ColormapEntries == b->ColormapEntries) && + (a->nplanes == b->nplanes) && + (a->redMask == b->redMask) && + (a->greenMask == b->greenMask) && + (a->blueMask == b->blueMask) && + (a->offsetRed == b->offsetRed) && + (a->offsetGreen == b->offsetGreen) && + (a->offsetBlue == b->offsetBlue)); +} - PanoramiXNumDepths = 0; - PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec)); - PanoramiXNumVisuals = 0; - PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec)); - - for (i = 0; i < pScreen->numDepths; i++, pDepth++) { - missingDepth = FALSE; - for (j = 1; j < PanoramiXNumScreens; j++) { - pScreen2 = screenInfo.screens[j]; - pDepth2 = pScreen2->allowedDepths; - - foundDepth = FALSE; - for (k = 0; k < pScreen2->numDepths; k++, pDepth2++) { - if(pDepth2->depth == pDepth->depth) { - foundDepth = TRUE; - break; - } - } - - if(!foundDepth) { - missingDepth = TRUE; - break; - } - } - - if(!missingDepth) { - PanoramiXDepths[PanoramiXNumDepths].depth = pDepth->depth; - PanoramiXDepths[PanoramiXNumDepths].numVids = 0; - if(pDepth->numVids) - PanoramiXDepths[PanoramiXNumDepths].vids = - xalloc(sizeof(VisualID) * pDepth->numVids); - else - PanoramiXDepths[PanoramiXNumDepths].vids = NULL; - PanoramiXNumDepths++; - } +static void +PanoramiXMaybeAddDepth(DepthPtr pDepth) +{ + ScreenPtr pScreen; + int j, k; + Bool found = FALSE; + + for (j = 1; j < PanoramiXNumScreens; j++) { + pScreen = screenInfo.screens[j]; + for (k = 0; k < pScreen->numDepths; k++) { + if (pScreen->allowedDepths[k].depth == pDepth->depth) { + found = TRUE; + break; + } + } } - for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { - PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = pVisual->vid; + if (!found) + return; - /* check if the visual exists on all screens */ - for (j = 1; j < PanoramiXNumScreens; j++) { - pScreen2 = screenInfo.screens[j]; + j = PanoramiXNumDepths; + PanoramiXNumDepths++; + PanoramiXDepths = xrealloc(PanoramiXDepths, + PanoramiXNumDepths * sizeof(DepthRec)); + PanoramiXDepths[j].depth = pDepth->depth; + PanoramiXDepths[j].numVids = 0; + /* XXX suboptimal, should grow these dynamically */ + if(pDepth->numVids) + PanoramiXDepths[j].vids = xalloc(sizeof(VisualID) * pDepth->numVids); + else + PanoramiXDepths[j].vids = NULL; +} +static void +PanoramiXMaybeAddVisual(VisualPtr pVisual) +{ + ScreenPtr pScreen; + VisualPtr candidate = NULL; + int j, k; + Bool found = FALSE; + + for (j = 1; j < PanoramiXNumScreens; j++) { + pScreen = screenInfo.screens[j]; + found = FALSE; + + candidate = pScreen->visuals; + for (k = 0; k < pScreen->numVisuals; k++) { + candidate++; + if (VisualsEqual(pVisual, candidate) #ifdef GLXPROXY - pVisual2 = glxMatchVisual(pScreen, pVisual, pScreen2); - if (pVisual2) { - PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = - pVisual2->vid; - continue; - } else if (glxMatchVisual(pScreen, pVisual, pScreen)) { - PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = 0; - break; - } + && glxMatchVisual(screenInfo.screens[0], pVisual, pScreen) #endif - pVisual2 = pScreen2->visuals; - - for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) { - if ((pVisual->class == pVisual2->class) && - (pVisual->ColormapEntries == pVisual2->ColormapEntries) && - (pVisual->nplanes == pVisual2->nplanes) && - (pVisual->redMask == pVisual2->redMask) && - (pVisual->greenMask == pVisual2->greenMask) && - (pVisual->blueMask == pVisual2->blueMask) && - (pVisual->offsetRed == pVisual2->offsetRed) && - (pVisual->offsetGreen == pVisual2->offsetGreen) && - (pVisual->offsetBlue == pVisual2->offsetBlue)) - { - /* We merely assign the first visual that matches. OpenGL - will need to get involved at some point if you want - match GLX visuals */ - PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = - pVisual2->vid; - break; - } - } - } - - /* if it doesn't exist on all screens we can't use it */ - for (j = 0; j < PanoramiXNumScreens; j++) { - if (!PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j]) { - PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = 0; + ) { + found = TRUE; break; } } - /* if it does, make sure it's in the list of supported depths and visuals */ - if(PanoramiXVisualTable[pVisual->vid * MAXSCREENS]) { - PanoramiXVisuals[PanoramiXNumVisuals].vid = pVisual->vid; - PanoramiXVisuals[PanoramiXNumVisuals].class = pVisual->class; - PanoramiXVisuals[PanoramiXNumVisuals].bitsPerRGBValue = pVisual->bitsPerRGBValue; - PanoramiXVisuals[PanoramiXNumVisuals].ColormapEntries = pVisual->ColormapEntries; - PanoramiXVisuals[PanoramiXNumVisuals].nplanes = pVisual->nplanes; - PanoramiXVisuals[PanoramiXNumVisuals].redMask = pVisual->redMask; - PanoramiXVisuals[PanoramiXNumVisuals].greenMask = pVisual->greenMask; - PanoramiXVisuals[PanoramiXNumVisuals].blueMask = pVisual->blueMask; - PanoramiXVisuals[PanoramiXNumVisuals].offsetRed = pVisual->offsetRed; - PanoramiXVisuals[PanoramiXNumVisuals].offsetGreen = pVisual->offsetGreen; - PanoramiXVisuals[PanoramiXNumVisuals].offsetBlue = pVisual->offsetBlue; - PanoramiXNumVisuals++; - - for (j = 0; j < PanoramiXNumDepths; j++) { - if (PanoramiXDepths[j].depth == pVisual->nplanes) { - PanoramiXDepths[j].vids[PanoramiXDepths[j].numVids] = pVisual->vid; - PanoramiXDepths[j].numVids++; - break; - } - } - } - } + if (!found) + return; + } + + /* found a matching visual on all screens, add it to the subset list */ + j = PanoramiXNumVisuals; + PanoramiXNumVisuals++; + PanoramiXVisuals = xrealloc(PanoramiXVisuals, + PanoramiXNumVisuals * sizeof(VisualRec)); + + memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec)); + for (k = 0; k < PanoramiXNumDepths; k++) { + if (PanoramiXDepths[k].depth == pVisual->nplanes) { + PanoramiXDepths[k].vids[PanoramiXDepths[k].numVids] = pVisual->vid; + PanoramiXDepths[k].numVids++; + break; + } + } +} + +extern void +PanoramiXConsolidate(void) +{ + int i; + PanoramiXRes *root, *defmap, *saver; + ScreenPtr pScreen = screenInfo.screens[0]; + DepthPtr pDepth = pScreen->allowedDepths; + VisualPtr pVisual = pScreen->visuals; - root = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)); + PanoramiXNumDepths = 0; + PanoramiXNumVisuals = 0; + + for (i = 0; i < pScreen->numDepths; i++) + PanoramiXMaybeAddDepth(pDepth++); + + for (i = 0; i < pScreen->numVisuals; i++) + PanoramiXMaybeAddVisual(pVisual++); + + root = xalloc(sizeof(PanoramiXRes)); root->type = XRT_WINDOW; - defmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)); + defmap = xalloc(sizeof(PanoramiXRes)); defmap->type = XRT_COLORMAP; - saver = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)); + saver = xalloc(sizeof(PanoramiXRes)); saver->type = XRT_WINDOW; - for (i = 0; i < PanoramiXNumScreens; i++) { root->info[i].id = WindowTable[i]->drawable.id; root->u.win.class = InputOutput; @@ -859,6 +841,31 @@ void PanoramiXConsolidate(void) AddResource(defmap->info[0].id, XRT_COLORMAP, defmap); } +_X_EXPORT VisualID +PanoramiXTranslateVisualID(int screen, VisualID orig) +{ + VisualPtr pVisual = NULL; + int i, j; + + for (i = 0; i < PanoramiXNumVisuals; i++) { + if (orig == PanoramiXVisuals[i].vid) { + pVisual = &PanoramiXVisuals[i]; + break; + } + } + + if (!pVisual) + return 0; + + /* found the original, now translate it relative to the backend screen */ + for (i = 0; i < PanoramiXNumScreens; i++) + for (j = 0; j < screenInfo.screens[i]->numVisuals; j++) + if (VisualsEqual(pVisual, &screenInfo.screens[i]->visuals[j])) + return screenInfo.screens[i]->visuals[j].vid; + + return 0; +} + /* * PanoramiXResetProc() diff --git a/Xext/panoramiXSwap.c b/Xext/panoramiXSwap.c index cc9f61442..b13c286dd 100644 --- a/Xext/panoramiXSwap.c +++ b/Xext/panoramiXSwap.c @@ -66,6 +66,7 @@ SProcPanoramiXGetState(ClientPtr client) swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); + swapl (&stuff->window, n); return ProcPanoramiXGetState(client); } @@ -77,6 +78,7 @@ SProcPanoramiXGetScreenCount(ClientPtr client) swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); + swapl (&stuff->window, n); return ProcPanoramiXGetScreenCount(client); } @@ -88,6 +90,8 @@ SProcPanoramiXGetScreenSize(ClientPtr client) swaps (&stuff->length, n); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); + swapl (&stuff->window, n); + swapl (&stuff->screen, n); return ProcPanoramiXGetScreenSize(client); } diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 4bd525727..d19b3039a 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -150,7 +150,7 @@ int PanoramiXCreateWindow(ClientPtr client) if (cmap) *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id; if ( orig_visual != CopyFromParent ) - stuff->visual = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + j]; + stuff->visual = PanoramiXTranslateVisualID(j, orig_visual); result = (*SavedProcVector[X_CreateWindow])(client); if(result != Success) break; } @@ -1039,8 +1039,7 @@ int PanoramiXCopyArea(ClientPtr client) FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; - VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, pGC, client); - + VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, DixWriteAccess); if(drawables[0]->depth != pDst->depth) { client->errorValue = stuff->dstDrawable; xfree(data); @@ -1076,7 +1075,8 @@ int PanoramiXCopyArea(ClientPtr client) stuff->dstY = dsty - panoramiXdataPtr[j].y; } - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess); + if (stuff->dstDrawable != stuff->srcDrawable) { rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0, DixReadAccess); @@ -1185,7 +1185,7 @@ int PanoramiXCopyPlane(ClientPtr client) stuff->dstY = dsty - panoramiXdataPtr[j].y; } - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess); if (stuff->dstDrawable != stuff->srcDrawable) { rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0, DixReadAccess); @@ -2077,9 +2077,6 @@ int PanoramiXCreateColormap(ClientPtr client) client, stuff->window, XRT_WINDOW, DixReadAccess))) return BadWindow; - if(!stuff->visual || (stuff->visual > 255)) - return BadValue; - if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2092,7 +2089,7 @@ int PanoramiXCreateColormap(ClientPtr client) FOR_NSCREENS_BACKWARD(j){ stuff->mid = newCmap->info[j].id; stuff->window = win->info[j].id; - stuff->visual = PanoramiXVisualTable[(orig_visual * MAXSCREENS) + j]; + stuff->visual = PanoramiXTranslateVisualID(j, orig_visual); result = (* SavedProcVector[X_CreateColormap])(client); if(result != Success) break; } diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h index ae9024418..6d556e963 100644 --- a/Xext/panoramiXsrv.h +++ b/Xext/panoramiXsrv.h @@ -12,8 +12,8 @@ extern int PanoramiXNumScreens; extern PanoramiXData *panoramiXdataPtr; extern int PanoramiXPixWidth; extern int PanoramiXPixHeight; -extern XID *PanoramiXVisualTable; +extern VisualID PanoramiXTranslateVisualID(int screen, VisualID orig); extern void PanoramiXConsolidate(void); extern Bool PanoramiXCreateConnectionBlock(void); extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int); diff --git a/Xext/sampleEVI.c b/Xext/sampleEVI.c index 7508aa773..b871bfd74 100644 --- a/Xext/sampleEVI.c +++ b/Xext/sampleEVI.c @@ -34,6 +34,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XEVIstr.h> #include "EVIstruct.h" #include "scrnintstr.h" + +#if HAVE_STDINT_H +#include <stdint.h> +#elif !defined(UINT32_MAX) +#define UINT32_MAX 0xffffffffU +#endif + static int sampleGetVisualInfo( VisualID32 *visual, int n_visual, @@ -42,24 +49,36 @@ static int sampleGetVisualInfo( VisualID32 **conflict_rn, int *n_conflict_rn) { - int max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens; + unsigned int max_sz_evi; VisualID32 *temp_conflict; xExtendedVisualInfo *evi; - int max_visuals = 0, max_sz_conflict, sz_conflict = 0; + unsigned int max_visuals = 0, max_sz_conflict, sz_conflict = 0; register int visualI, scrI, sz_evi = 0, conflictI, n_conflict; - *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi); - if (!*evi_rn) - return BadAlloc; + + if (n_visual > UINT32_MAX/(sz_xExtendedVisualInfo * screenInfo.numScreens)) + return BadAlloc; + max_sz_evi = n_visual * sz_xExtendedVisualInfo * screenInfo.numScreens; + for (scrI = 0; scrI < screenInfo.numScreens; scrI++) { if (screenInfo.screens[scrI]->numVisuals > max_visuals) max_visuals = screenInfo.screens[scrI]->numVisuals; } + + if (n_visual > UINT32_MAX/(sz_VisualID32 * screenInfo.numScreens + * max_visuals)) + return BadAlloc; max_sz_conflict = n_visual * sz_VisualID32 * screenInfo.numScreens * max_visuals; + + *evi_rn = evi = (xExtendedVisualInfo *)xalloc(max_sz_evi); + if (!*evi_rn) + return BadAlloc; + temp_conflict = (VisualID32 *)xalloc(max_sz_conflict); if (!temp_conflict) { xfree(*evi_rn); return BadAlloc; } + for (scrI = 0; scrI < screenInfo.numScreens; scrI++) { for (visualI = 0; visualI < n_visual; visualI++) { evi[sz_evi].core_visual_id = visual[visualI]; diff --git a/Xext/saver.c b/Xext/saver.c index 44689fc53..feab972e2 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -48,6 +48,7 @@ in this Software without prior written authorization from the X Consortium. #include "gcstruct.h" #include "cursorstr.h" #include "colormapst.h" +#include "xace.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" @@ -231,10 +232,12 @@ MakeScreenPrivate ( ScreenPtr /* pScreen */ ); -static int ScreenPrivateIndex; +static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey; -#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr) -#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v); +#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \ + dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey)) +#define SetScreenPrivate(s,v) \ + dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v); #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL) #define New(t) ((t *) xalloc (sizeof (t))) @@ -257,14 +260,13 @@ ScreenSaverExtensionInit(INITARGS) AttrType = CreateNewResourceType(ScreenSaverFreeAttr); EventType = CreateNewResourceType(ScreenSaverFreeEvents); SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend); - ScreenPrivateIndex = AllocateScreenPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; SetScreenPrivate (pScreen, NULL); } - if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 && + if (AttrType && EventType && SuspendType && (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, ProcScreenSaverDispatch, SProcScreenSaverDispatch, ScreenSaverResetProc, StandardMinorOpcode))) @@ -448,8 +450,8 @@ ScreenSaverFreeAttr (value, id) pPriv->attr = NULL; if (pPriv->hasWindow) { - SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverReset); - SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverActive); + dixSaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); + dixSaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive); } CheckScreenPrivate (pScreen); return TRUE; @@ -782,7 +784,11 @@ ProcScreenSaverQueryInfo (client) REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); + if (rc != Success) + return rc; + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen, + DixGetAttrAccess); if (rc != Success) return rc; @@ -851,9 +857,15 @@ ProcScreenSaverSelectInput (client) REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq); rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); + if (rc != Success) + return rc; + + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen, + DixSetAttrAccess); if (rc != Success) return rc; + if (!setEventMask (pDraw->pScreen, client, stuff->eventMask)) return BadAlloc; return Success; @@ -887,12 +899,16 @@ ScreenSaverSetAttributes (ClientPtr client) REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (ret != Success) return ret; pScreen = pDraw->pScreen; pParent = WindowTable[pScreen->myNum]; + ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess); + if (ret != Success) + return ret; + len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; @@ -1048,8 +1064,9 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); - if (pPixmap != (PixmapPtr) NULL) + ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (ret == Success) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) @@ -1063,7 +1080,7 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - ret = BadPixmap; + ret = (ret == BadValue) ? BadPixmap : ret; client->errorValue = pixID; goto PatchUp; } @@ -1085,8 +1102,9 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); - if (pPixmap) + ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (ret == Success) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) @@ -1100,7 +1118,7 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - ret = BadPixmap; + ret = (ret == BadValue) ? BadPixmap : ret; client->errorValue = pixID; goto PatchUp; } @@ -1178,10 +1196,11 @@ ScreenSaverSetAttributes (ClientPtr client) break; case CWColormap: cmap = (Colormap) *pVlist; - pCmap = (ColormapPtr)LookupIDByType(cmap, RT_COLORMAP); - if (!pCmap) + ret = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP, + client, DixUseAccess); + if (ret != Success) { - ret = BadColor; + ret = (ret == BadValue) ? BadColor : ret; client->errorValue = cmap; goto PatchUp; } @@ -1201,10 +1220,11 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - pCursor = (CursorPtr)LookupIDByType(cursorID, RT_CURSOR); - if (!pCursor) + ret = dixLookupResource((pointer *)&pCursor, cursorID, + RT_CURSOR, client, DixUseAccess); + if (ret != Success) { - ret = BadCursor; + ret = (ret == BadValue) ? BadCursor : ret; client->errorValue = cursorID; goto PatchUp; } @@ -1246,7 +1266,7 @@ ScreenSaverUnsetAttributes (ClientPtr client) REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; pPriv = GetScreenPrivate (pDraw->pScreen); @@ -1326,8 +1346,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[i].id; if (orig_visual != CopyFromParent) - stuff->visualID = - PanoramiXVisualTable[(orig_visual*MAXSCREENS) + i]; + stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual); status = ScreenSaverSetAttributes(client); } diff --git a/Xext/security.c b/Xext/security.c index ba057defd..cd67120d9 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -28,63 +28,62 @@ in this Software without prior written authorization from The Open Group. #include <dix-config.h> #endif -#include "dixstruct.h" -#include "extnsionst.h" -#include "windowstr.h" -#include "inputstr.h" #include "scrnintstr.h" -#include "gcstruct.h" -#include "colormapst.h" +#include "inputstr.h" +#include "windowstr.h" #include "propertyst.h" +#include "colormapst.h" +#include "privates.h" +#include "registry.h" #include "xacestr.h" #include "securitysrv.h" #include <X11/extensions/securstr.h> -#include <assert.h> -#include <stdarg.h> #ifdef XAPPGROUP #include "appgroup.h" #endif -#include <stdio.h> /* for file reading operations */ -#include <X11/Xatom.h> /* for XA_STRING */ - -#ifndef DEFAULTPOLICYFILE -# define DEFAULTPOLICYFILE NULL -#endif -#if defined(WIN32) || defined(__CYGWIN__) -#include <X11/Xos.h> -#undef index -#endif - #include "modinit.h" +/* Extension stuff */ static int SecurityErrorBase; /* first Security error number */ static int SecurityEventBase; /* first Security event number */ -static int securityClientPrivateIndex; -static int securityExtnsnPrivateIndex; -/* this is what we store as client security state */ -typedef struct { - unsigned int trustLevel; - XID authId; -} SecurityClientStateRec; - -#define STATEVAL(extnsn) \ - ((extnsn)->devPrivates[securityExtnsnPrivateIndex].val) -#define STATEPTR(client) \ - ((client)->devPrivates[securityClientPrivateIndex].ptr) -#define TRUSTLEVEL(client) \ - (((SecurityClientStateRec*)STATEPTR(client))->trustLevel) -#define AUTHID(client) \ - (((SecurityClientStateRec*)STATEPTR(client))->authId) +RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */ +static RESTYPE RTEventClient; static CallbackListPtr SecurityValidateGroupCallback = NULL; -RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */ +/* Private state record */ +static DevPrivateKey stateKey = &stateKey; -static RESTYPE RTEventClient; +/* This is what we store as client security state */ +typedef struct { + int haveState; + unsigned int trustLevel; + XID authId; +} SecurityStateRec; + +/* Extensions that untrusted clients shouldn't have access to */ +static char *SecurityUntrustedExtensions[] = { + "RandR", + "SECURITY", + "XFree86-DGA", + NULL +}; + +/* + * Access modes that untrusted clients are allowed on trusted objects. + */ +static const Mask SecurityResourceMask = + DixGetAttrAccess | DixReceiveAccess | DixListPropAccess | + DixGetPropAccess | DixListAccess; +static const Mask SecurityRootWindowExtraMask = + DixReceiveAccess | DixSendAccess | DixAddAccess | DixRemoveAccess; +static const Mask SecurityDeviceMask = + DixGetAttrAccess | DixReceiveAccess | DixGetFocusAccess | + DixGrabAccess | DixSetAttrAccess | DixUseAccess; +static const Mask SecurityServerMask = DixGetAttrAccess | DixGrabAccess; +static const Mask SecurityClientMask = DixGetAttrAccess; -#define CALLBACK(name) static void \ -name(CallbackListPtr *pcbl, pointer nulldata, pointer calldata) /* SecurityAudit * @@ -110,6 +109,51 @@ SecurityAudit(char *format, ...) va_end(args); } /* SecurityAudit */ +/* + * Performs a Security permission check. + */ +static int +SecurityDoCheck(SecurityStateRec *subj, SecurityStateRec *obj, + Mask requested, Mask allowed) +{ + if (!subj->haveState || !obj->haveState) + return Success; + if (subj->trustLevel == XSecurityClientTrusted) + return Success; + if (obj->trustLevel != XSecurityClientTrusted) + return Success; + if ((requested | allowed) == allowed) + return Success; + + return BadAccess; +} + +/* + * Labels initial server objects. + */ +static void +SecurityLabelInitial(void) +{ + SecurityStateRec *state; + + /* Do the serverClient */ + state = dixLookupPrivate(&serverClient->devPrivates, stateKey); + state->trustLevel = XSecurityClientTrusted; + state->haveState = TRUE; +} + +/* + * Looks up a request name + */ +static _X_INLINE const char * +SecurityLookupRequestName(ClientPtr client) +{ + int major = ((xReq *)client->requestBuffer)->reqType; + int minor = MinorOpcodeOfRequest(client); + return LookupRequestName(major, minor); +} + + #define rClient(obj) (clients[CLIENT_ID((obj)->resource)]) /* SecurityDeleteAuthorization @@ -170,10 +214,12 @@ SecurityDeleteAuthorization( /* kill all clients using this auth */ for (i = 1; i<currentMaxClients; i++) - { - if (clients[i] && (AUTHID(clients[i]) == pAuth->id)) - CloseDownClient(clients[i]); - } + if (clients[i]) { + SecurityStateRec *state; + state = dixLookupPrivate(&clients[i]->devPrivates, stateKey); + if (state->haveState && state->authId == pAuth->id) + CloseDownClient(clients[i]); + } SecurityAudit("revoked authorization ID %d\n", pAuth->id); xfree(pAuth); @@ -322,12 +368,6 @@ ProcSecurityQueryVersion( /* REQUEST(xSecurityQueryVersionReq); */ xSecurityQueryVersionReply rep; - /* paranoia: this "can't happen" because this extension is hidden - * from untrusted clients, but just in case... - */ - if (TRUSTLEVEL(client) != XSecurityClientTrusted) - return BadRequest; - REQUEST_SIZE_MATCH(xSecurityQueryVersionReq); rep.type = X_Reply; rep.sequenceNumber = client->sequence; @@ -408,12 +448,6 @@ ProcSecurityGenerateAuthorization( char *pAuthdata; /* generated auth data */ Mask eventMask; /* what events on this auth does client want */ - /* paranoia: this "can't happen" because this extension is hidden - * from untrusted clients, but just in case... - */ - if (TRUSTLEVEL(client) != XSecurityClientTrusted) - return BadRequest; - /* check request length */ REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq); @@ -591,12 +625,6 @@ ProcSecurityRevokeAuthorization( REQUEST(xSecurityRevokeAuthorizationReq); SecurityAuthorizationPtr pAuth; - /* paranoia: this "can't happen" because this extension is hidden - * from untrusted clients, but just in case... - */ - if (TRUSTLEVEL(client) != XSecurityClientTrusted) - return BadRequest; - REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client, @@ -710,59 +738,6 @@ SwapSecurityAuthorizationRevokedEvent( cpswapl(from->authId, to->authId); } -/* SecurityDetermineEventPropogationLimits - * - * This is a helper function for SecurityCheckDeviceAccess. - * - * Arguments: - * dev is the device for which the starting and stopping windows for - * event propogation should be determined. - * The values pointed to by ppWin and ppStopWin are not used. - * - * Returns: - * ppWin is filled in with a pointer to the window at which event - * propogation for the given device should start given the current - * state of the server (pointer position, window layout, etc.) - * ppStopWin is filled in with the window at which event propogation - * should stop; events should not go to ppStopWin. - * - * Side Effects: none. - */ - -static void -SecurityDetermineEventPropogationLimits( - DeviceIntPtr dev, - WindowPtr *ppWin, - WindowPtr *ppStopWin) -{ - WindowPtr pFocusWin = dev->focus ? dev->focus->win : NoneWin; - - if (pFocusWin == NoneWin) - { /* no focus -- events don't go anywhere */ - *ppWin = *ppStopWin = NULL; - return; - } - - if (pFocusWin == PointerRootWin) - { /* focus follows the pointer */ - *ppWin = GetSpriteWindow(); - *ppStopWin = NULL; /* propogate all the way to the root */ - } - else - { /* a real window is set for the focus */ - WindowPtr pSpriteWin = GetSpriteWindow(); - *ppStopWin = pFocusWin->parent; /* don't go past the focus window */ - - /* if the pointer is in a subwindow of the focus window, start - * at that subwindow, else start at the focus window itself - */ - if (IsParent(pFocusWin, pSpriteWin)) - *ppWin = pSpriteWin; - else *ppWin = pFocusWin; - } -} /* SecurityDetermineEventPropogationLimits */ - - /* SecurityCheckDeviceAccess * * Arguments: @@ -779,162 +754,30 @@ SecurityDetermineEventPropogationLimits( * An audit message is generated if access is denied. */ -CALLBACK(SecurityCheckDeviceAccess) -{ - XaceDeviceAccessRec *rec = (XaceDeviceAccessRec*)calldata; - ClientPtr client = rec->client; - DeviceIntPtr dev = rec->dev; - Bool fromRequest = rec->fromRequest; - WindowPtr pWin, pStopWin; - Bool untrusted_got_event; - Bool found_event_window; - Mask eventmask; - int reqtype = 0; - - /* trusted clients always allowed to do anything */ - if (TRUSTLEVEL(client) == XSecurityClientTrusted) - return; - - /* device security other than keyboard is not implemented yet */ - if (dev != inputInfo.keyboard) - return; - - /* some untrusted client wants access */ - - if (fromRequest) - { - reqtype = ((xReq *)client->requestBuffer)->reqType; - switch (reqtype) - { - /* never allow these */ - case X_ChangeKeyboardMapping: - case X_ChangeKeyboardControl: - case X_SetModifierMapping: - SecurityAudit("client %d attempted request %d\n", - client->index, reqtype); - rec->rval = FALSE; - return; - default: - break; - } - } - - untrusted_got_event = FALSE; - found_event_window = FALSE; - - if (dev->grab) - { - untrusted_got_event = - (TRUSTLEVEL(rClient(dev->grab)) != XSecurityClientTrusted); - } - else - { - SecurityDetermineEventPropogationLimits(dev, &pWin, &pStopWin); - - eventmask = KeyPressMask | KeyReleaseMask; - while ( (pWin != pStopWin) && !found_event_window) - { - OtherClients *other; - - if (pWin->eventMask & eventmask) - { - found_event_window = TRUE; - client = wClient(pWin); - if (TRUSTLEVEL(client) != XSecurityClientTrusted) - { - untrusted_got_event = TRUE; - } - } - if (wOtherEventMasks(pWin) & eventmask) - { - found_event_window = TRUE; - for (other = wOtherClients(pWin); other; other = other->next) - { - if (other->mask & eventmask) - { - client = rClient(other); - if (TRUSTLEVEL(client) != XSecurityClientTrusted) - { - untrusted_got_event = TRUE; - break; - } - } - } - } - if (wDontPropagateMask(pWin) & eventmask) - break; - pWin = pWin->parent; - } /* while propogating the event */ - } - - /* allow access by untrusted clients only if an event would have gone - * to an untrusted client - */ - - if (!untrusted_got_event) - { - char *devname = dev->name; - if (!devname) devname = "unnamed"; - if (fromRequest) - SecurityAudit("client %d attempted request %d device %d (%s)\n", - client->index, reqtype, dev->id, devname); - else - SecurityAudit("client %d attempted to access device %d (%s)\n", - client->index, dev->id, devname); - rec->rval = FALSE; - } - return; -} /* SecurityCheckDeviceAccess */ - - - -/* SecurityAuditResourceIDAccess - * - * Arguments: - * client is the client doing the resource access. - * id is the resource id. - * - * Returns: NULL - * - * Side Effects: - * An audit message is generated with details of the denied - * resource access. - */ - -static pointer -SecurityAuditResourceIDAccess( - ClientPtr client, - XID id) +static void +SecurityDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - int cid = CLIENT_ID(id); - int reqtype = ((xReq *)client->requestBuffer)->reqType; - switch (reqtype) - { - case X_ChangeProperty: - case X_DeleteProperty: - case X_GetProperty: - { - xChangePropertyReq *req = - (xChangePropertyReq *)client->requestBuffer; - int propertyatom = req->property; - char *propertyname = NameForAtom(propertyatom); - - SecurityAudit("client %d attempted request %d with window 0x%x property %s of client %d\n", - client->index, reqtype, id, propertyname, cid); - break; - } - default: - { - SecurityAudit("client %d attempted request %d with resource 0x%x of client %d\n", - client->index, reqtype, id, cid); - break; - } + XaceDeviceAccessRec *rec = calldata; + SecurityStateRec *subj, *obj; + Mask requested = rec->access_mode; + Mask allowed = SecurityDeviceMask; + + subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); + obj = dixLookupPrivate(&serverClient->devPrivates, stateKey); + + if (rec->dev != inputInfo.keyboard) + /* this extension only supports the core keyboard */ + allowed = requested; + + if (SecurityDoCheck(subj, obj, requested, allowed) != Success) { + SecurityAudit("Security denied client %d keyboard access on request " + "%s\n", rec->client->index, + SecurityLookupRequestName(rec->client)); + rec->status = BadAccess; } - return NULL; -} /* SecurityAuditResourceIDAccess */ - +} -/* SecurityCheckResourceIDAccess +/* SecurityResource * * This function gets plugged into client->CheckAccess and is called from * SecurityLookupIDByType/Class to determine if the client can access the @@ -955,867 +798,256 @@ SecurityAuditResourceIDAccess( * Disallowed resource accesses are audited. */ -CALLBACK(SecurityCheckResourceIDAccess) +static void +SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - XaceResourceAccessRec *rec = (XaceResourceAccessRec*)calldata; - ClientPtr client = rec->client; - XID id = rec->id; - RESTYPE rtype = rec->rtype; - Mask access_mode = rec->access_mode; - pointer rval = rec->res; - int cid, reqtype; - - if (TRUSTLEVEL(client) == XSecurityClientTrusted || - DixUnknownAccess == access_mode) - return; /* for compatibility, we have to allow access */ - - cid = CLIENT_ID(id); - reqtype = ((xReq *)client->requestBuffer)->reqType; - switch (reqtype) - { /* these are always allowed */ - case X_QueryTree: - case X_TranslateCoords: - case X_GetGeometry: - /* property access is controlled in SecurityCheckPropertyAccess */ - case X_GetProperty: - case X_ChangeProperty: - case X_DeleteProperty: - case X_RotateProperties: - case X_ListProperties: - return; - default: - break; - } + XaceResourceAccessRec *rec = calldata; + SecurityStateRec *subj, *obj; + int cid = CLIENT_ID(rec->id); + Mask requested = rec->access_mode; + Mask allowed = SecurityResourceMask; + + subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); + obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey); + + /* disable background None for untrusted windows */ + if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW)) + if (subj->haveState && subj->trustLevel != XSecurityClientTrusted) + ((WindowPtr)rec->res)->forcedBG = TRUE; + + /* special checks for server-owned resources */ + if (cid == 0) { + if (rec->rtype & RC_DRAWABLE) + /* additional operations allowed on root windows */ + allowed |= SecurityRootWindowExtraMask; + + else if (rec->rtype == RT_COLORMAP) + /* allow access to default colormaps */ + allowed = requested; - if (cid != 0) - { /* not a server-owned resource */ - /* - * The following 'if' restricts clients to only access resources at - * the same trustLevel. Since there are currently only two trust levels, - * and trusted clients never call this function, this degenerates into - * saying that untrusted clients can only access resources of other - * untrusted clients. One way to add the notion of groups would be to - * allow values other than Trusted (0) and Untrusted (1) for this field. - * Clients at the same trust level would be able to use each other's - * resources, but not those of clients at other trust levels. I haven't - * tried it, but this probably mostly works already. The obvious - * competing alternative for grouping clients for security purposes is to - * use app groups. dpw - */ - if (TRUSTLEVEL(client) == TRUSTLEVEL(clients[cid]) -#ifdef XAPPGROUP - || (RT_COLORMAP == rtype && - XagDefaultColormap (client) == (Colormap) id) -#endif - ) - return; else - goto deny; + /* allow read access to other server-owned resources */ + allowed |= DixReadAccess; } - else /* server-owned resource - probably a default colormap or root window */ - { - if (RT_WINDOW == rtype || RC_DRAWABLE == rtype) - { - switch (reqtype) - { /* the following operations are allowed on root windows */ - case X_CreatePixmap: - case X_CreateGC: - case X_CreateWindow: - case X_CreateColormap: - case X_ListProperties: - case X_GrabPointer: - case X_UngrabButton: - case X_QueryBestSize: - case X_GetWindowAttributes: - break; - case X_SendEvent: - { /* see if it is an event specified by the ICCCM */ - xSendEventReq *req = (xSendEventReq *) - (client->requestBuffer); - if (req->propagate == xTrue - || - (req->eventMask != ColormapChangeMask && - req->eventMask != StructureNotifyMask && - req->eventMask != - (SubstructureRedirectMask|SubstructureNotifyMask) - ) - || - (req->event.u.u.type != UnmapNotify && - req->event.u.u.type != ConfigureRequest && - req->event.u.u.type != ClientMessage - ) - ) - { /* not an ICCCM event */ - goto deny; - } - break; - } /* case X_SendEvent on root */ - - case X_ChangeWindowAttributes: - { /* Allow selection of PropertyNotify and StructureNotify - * events on the root. - */ - xChangeWindowAttributesReq *req = - (xChangeWindowAttributesReq *)(client->requestBuffer); - if (req->valueMask == CWEventMask) - { - CARD32 value = *((CARD32 *)(req + 1)); - if ( (value & - ~(PropertyChangeMask|StructureNotifyMask)) == 0) - break; - } - goto deny; - } /* case X_ChangeWindowAttributes on root */ - - default: - { - /* others not allowed */ - goto deny; - } - } - } /* end server-owned window or drawable */ - else if (SecurityAuthorizationResType == rtype) - { - SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval; - if (pAuth->trustLevel != TRUSTLEVEL(client)) - goto deny; - } - else if (RT_COLORMAP != rtype) - { /* don't allow anything else besides colormaps */ - goto deny; - } - } - return; - deny: - SecurityAuditResourceIDAccess(client, id); - rec->rval = FALSE; /* deny access */ -} /* SecurityCheckResourceIDAccess */ - - -/* SecurityClientStateCallback - * - * Arguments: - * pcbl is &ClientStateCallback. - * nullata is NULL. - * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h) - * which contains information about client state changes. - * - * Returns: nothing. - * - * Side Effects: - * - * If a new client is connecting, its authorization ID is copied to - * client->authID. If this is a generated authorization, its reference - * count is bumped, its timer is cancelled if it was running, and its - * trustlevel is copied to TRUSTLEVEL(client). - * - * If a client is disconnecting and the client was using a generated - * authorization, the authorization's reference count is decremented, and - * if it is now zero, the timer for this authorization is started. - */ -CALLBACK(SecurityClientStateCallback) -{ - NewClientInfoRec *pci = (NewClientInfoRec *)calldata; - ClientPtr client = pci->client; - - switch (client->clientState) - { - case ClientStateInitial: - TRUSTLEVEL(client) = XSecurityClientTrusted; - AUTHID(client) = None; - break; - - case ClientStateRunning: - { - XID authId = AuthorizationIDOfClient(client); - SecurityAuthorizationPtr pAuth; - - TRUSTLEVEL(client) = XSecurityClientTrusted; - AUTHID(client) = authId; - pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, - SecurityAuthorizationResType); - if (pAuth) - { /* it is a generated authorization */ - pAuth->refcnt++; - if (pAuth->refcnt == 1) - { - if (pAuth->timer) TimerCancel(pAuth->timer); - } - TRUSTLEVEL(client) = pAuth->trustLevel; - } - break; - } - case ClientStateGone: - case ClientStateRetained: /* client disconnected */ - { - SecurityAuthorizationPtr pAuth; - - /* client may not have any state (bad authorization) */ - if (!STATEPTR(client)) - break; - - pAuth = (SecurityAuthorizationPtr)LookupIDByType(AUTHID(client), - SecurityAuthorizationResType); - if (pAuth) - { /* it is a generated authorization */ - pAuth->refcnt--; - if (pAuth->refcnt == 0) - { - SecurityStartAuthorizationTimer(pAuth); - } - } - break; - } - default: break; - } -} /* SecurityClientStateCallback */ + if (SecurityDoCheck(subj, obj, requested, allowed) == Success) + return; -CALLBACK(SecurityCheckDrawableAccess) -{ - XaceDrawableAccessRec *rec = (XaceDrawableAccessRec*)calldata; +#ifdef XAPPGROUP + if (rec->id == XagDefaultColormap(rec->client)) + return; +#endif - if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted) - rec->rval = FALSE; + SecurityAudit("Security: denied client %d access %x to resource 0x%x " + "of client %d on request %s\n", rec->client->index, + requested, rec->id, cid, + SecurityLookupRequestName(rec->client)); + rec->status = BadAccess; /* deny access */ } -CALLBACK(SecurityCheckMapAccess) -{ - XaceMapAccessRec *rec = (XaceMapAccessRec*)calldata; - WindowPtr pWin = rec->pWin; - - if (STATEPTR(rec->client) && - (TRUSTLEVEL(rec->client) != XSecurityClientTrusted) && - (pWin->drawable.class == InputOnly) && - pWin->parent && pWin->parent->parent && - (TRUSTLEVEL(wClient(pWin->parent)) == XSecurityClientTrusted)) - rec->rval = FALSE; -} - -CALLBACK(SecurityCheckBackgrndAccess) +static void +SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - XaceMapAccessRec *rec = (XaceMapAccessRec*)calldata; - - if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted) - rec->rval = FALSE; + XaceExtAccessRec *rec = calldata; + SecurityStateRec *subj; + int i = 0; + + 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; + } } -CALLBACK(SecurityCheckExtAccess) +static void +SecurityServer(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - XaceExtAccessRec *rec = (XaceExtAccessRec*)calldata; - - if ((TRUSTLEVEL(rec->client) != XSecurityClientTrusted) && - !STATEVAL(rec->ext)) - - rec->rval = FALSE; -} + XaceServerAccessRec *rec = calldata; + SecurityStateRec *subj, *obj; + Mask requested = rec->access_mode; + Mask allowed = SecurityServerMask; -CALLBACK(SecurityCheckHostlistAccess) -{ - XaceHostlistAccessRec *rec = (XaceHostlistAccessRec*)calldata; + subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); + obj = dixLookupPrivate(&serverClient->devPrivates, stateKey); - if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted) - { - rec->rval = FALSE; - if (rec->access_mode == DixWriteAccess) - SecurityAudit("client %d attempted to change host access\n", - rec->client->index); - else - SecurityAudit("client %d attempted to list hosts\n", - rec->client->index); + if (SecurityDoCheck(subj, obj, requested, allowed) != Success) { + SecurityAudit("Security: denied client %d access to server " + "configuration request %s\n", rec->client->index, + SecurityLookupRequestName(rec->client)); + rec->status = BadAccess; } } -CALLBACK(SecurityDeclareExtSecure) -{ - XaceDeclareExtSecureRec *rec = (XaceDeclareExtSecureRec*)calldata; - - /* security state for extensions is simply a boolean trust value */ - STATEVAL(rec->ext) = rec->secure; -} - -/**********************************************************************/ - -typedef struct _PropertyAccessRec { - ATOM name; - ATOM mustHaveProperty; - char *mustHaveValue; - char windowRestriction; -#define SecurityAnyWindow 0 -#define SecurityRootWindow 1 -#define SecurityWindowWithProperty 2 - char readAction; - char writeAction; - char destroyAction; - struct _PropertyAccessRec *next; -} PropertyAccessRec, *PropertyAccessPtr; - -static PropertyAccessPtr PropertyAccessList = NULL; -static char SecurityDefaultAction = XaceErrorOperation; -static char *SecurityPolicyFile = DEFAULTPOLICYFILE; -static ATOM SecurityMaxPropertyName = 0; - -static char *SecurityKeywords[] = { -#define SecurityKeywordComment 0 - "#", -#define SecurityKeywordProperty 1 - "property", -#define SecurityKeywordSitePolicy 2 - "sitepolicy", -#define SecurityKeywordRoot 3 - "root", -#define SecurityKeywordAny 4 - "any" -}; - -#define NUMKEYWORDS (sizeof(SecurityKeywords) / sizeof(char *)) - -#undef PROPDEBUG -/*#define PROPDEBUG 1*/ - static void -SecurityFreePropertyAccessList(void) -{ - while (PropertyAccessList) - { - PropertyAccessPtr freeit = PropertyAccessList; - PropertyAccessList = PropertyAccessList->next; - xfree(freeit); - } -} /* SecurityFreePropertyAccessList */ - -#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') ) - -static char * -SecuritySkipWhitespace( - char *p) -{ - while (SecurityIsWhitespace(*p)) - p++; - return p; -} /* SecuritySkipWhitespace */ - - -static char * -SecurityParseString( - char **rest) -{ - char *startOfString; - char *s = *rest; - char endChar = 0; - - s = SecuritySkipWhitespace(s); - - if (*s == '"' || *s == '\'') - { - endChar = *s++; - startOfString = s; - while (*s && (*s != endChar)) - s++; - } - else - { - startOfString = s; - while (*s && !SecurityIsWhitespace(*s)) - s++; - } - if (*s) - { - *s = '\0'; - *rest = s + 1; - return startOfString; - } - else - { - *rest = s; - return (endChar) ? NULL : startOfString; - } -} /* SecurityParseString */ - - -static int -SecurityParseKeyword( - char **p) +SecurityClient(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - int i; - char *s = *p; - s = SecuritySkipWhitespace(s); - for (i = 0; i < NUMKEYWORDS; i++) - { - int len = strlen(SecurityKeywords[i]); - if (strncmp(s, SecurityKeywords[i], len) == 0) - { - *p = s + len; - return (i); - } - } - *p = s; - return -1; -} /* SecurityParseKeyword */ - - -static Bool -SecurityParsePropertyAccessRule( - char *p) -{ - char *propname; - char c; - char action = SecurityDefaultAction; - char readAction, writeAction, destroyAction; - PropertyAccessPtr pacl, prev, cur; - char *mustHaveProperty = NULL; - char *mustHaveValue = NULL; - Bool invalid; - char windowRestriction; - int size; - int keyword; - - /* get property name */ - propname = SecurityParseString(&p); - if (!propname || (strlen(propname) == 0)) - return FALSE; - - /* get window on which property must reside for rule to apply */ - - keyword = SecurityParseKeyword(&p); - if (keyword == SecurityKeywordRoot) - windowRestriction = SecurityRootWindow; - else if (keyword == SecurityKeywordAny) - windowRestriction = SecurityAnyWindow; - else /* not root or any, must be a property name */ - { - mustHaveProperty = SecurityParseString(&p); - if (!mustHaveProperty || (strlen(mustHaveProperty) == 0)) - return FALSE; - windowRestriction = SecurityWindowWithProperty; - p = SecuritySkipWhitespace(p); - if (*p == '=') - { /* property value is specified too */ - p++; /* skip over '=' */ - mustHaveValue = SecurityParseString(&p); - if (!mustHaveValue) - return FALSE; - } - } - - /* get operations and actions */ - - invalid = FALSE; - readAction = writeAction = destroyAction = SecurityDefaultAction; - while ( (c = *p++) && !invalid) - { - switch (c) - { - case 'i': action = XaceIgnoreOperation; break; - case 'a': action = XaceAllowOperation; break; - case 'e': action = XaceErrorOperation; break; - - case 'r': readAction = action; break; - case 'w': writeAction = action; break; - case 'd': destroyAction = action; break; - - default : - if (!SecurityIsWhitespace(c)) - invalid = TRUE; - break; - } - } - if (invalid) - return FALSE; - - /* We've successfully collected all the information needed for this - * property access rule. Now record it in a PropertyAccessRec. - */ - size = sizeof(PropertyAccessRec); - - /* If there is a property value string, allocate space for it - * right after the PropertyAccessRec. - */ - if (mustHaveValue) - size += strlen(mustHaveValue) + 1; - pacl = (PropertyAccessPtr)Xalloc(size); - if (!pacl) - return FALSE; - - pacl->name = MakeAtom(propname, strlen(propname), TRUE); - if (pacl->name == BAD_RESOURCE) - { - Xfree(pacl); - return FALSE; - } - if (mustHaveProperty) - { - pacl->mustHaveProperty = MakeAtom(mustHaveProperty, - strlen(mustHaveProperty), TRUE); - if (pacl->mustHaveProperty == BAD_RESOURCE) - { - Xfree(pacl); - return FALSE; - } - } - else - pacl->mustHaveProperty = 0; - - if (mustHaveValue) - { - pacl->mustHaveValue = (char *)(pacl + 1); - strcpy(pacl->mustHaveValue, mustHaveValue); + XaceClientAccessRec *rec = calldata; + SecurityStateRec *subj, *obj; + Mask requested = rec->access_mode; + Mask allowed = SecurityClientMask; + + subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); + obj = dixLookupPrivate(&rec->target->devPrivates, stateKey); + + if (SecurityDoCheck(subj, obj, requested, allowed) != Success) { + SecurityAudit("Security: denied client %d access to client %d on " + "request %s\n", rec->client->index, rec->target->index, + SecurityLookupRequestName(rec->client)); + rec->status = BadAccess; } - else - pacl->mustHaveValue = NULL; - - SecurityMaxPropertyName = max(SecurityMaxPropertyName, pacl->name); - - pacl->windowRestriction = windowRestriction; - pacl->readAction = readAction; - pacl->writeAction = writeAction; - pacl->destroyAction = destroyAction; - - /* link the new rule into the list of rules in order of increasing - * property name (atom) value to make searching easier - */ +} - for (prev = NULL, cur = PropertyAccessList; - cur && cur->name <= pacl->name; - prev = cur, cur = cur->next) - ; - if (!prev) - { - pacl->next = cur; - PropertyAccessList = pacl; - } - else - { - prev->next = pacl; - pacl->next = cur; +static void +SecurityProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XacePropertyAccessRec *rec = calldata; + SecurityStateRec *subj, *obj; + ATOM name = rec->pProp->propertyName; + Mask requested = rec->access_mode; + Mask allowed = SecurityResourceMask | DixReadAccess; + + subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); + obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey); + + if (SecurityDoCheck(subj, obj, requested, allowed) != Success) { + SecurityAudit("Security: denied client %d access to property %s " + "(atom 0x%x) window 0x%x of client %d on request %s\n", + rec->client->index, NameForAtom(name), name, + rec->pWin->drawable.id, wClient(rec->pWin)->index, + SecurityLookupRequestName(rec->client)); + rec->status = BadAccess; } - return TRUE; -} /* SecurityParsePropertyAccessRule */ - -static char **SecurityPolicyStrings = NULL; -static int nSecurityPolicyStrings = 0; +} -static Bool -SecurityParseSitePolicy( - char *p) +static void +SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - char *policyStr = SecurityParseString(&p); - char *copyPolicyStr; - char **newStrings; - - if (!policyStr) - return FALSE; - - copyPolicyStr = (char *)Xalloc(strlen(policyStr) + 1); - if (!copyPolicyStr) - return TRUE; - strcpy(copyPolicyStr, policyStr); - newStrings = (char **)Xrealloc(SecurityPolicyStrings, - sizeof (char *) * (nSecurityPolicyStrings + 1)); - if (!newStrings) - { - Xfree(copyPolicyStr); - return TRUE; - } - - SecurityPolicyStrings = newStrings; - SecurityPolicyStrings[nSecurityPolicyStrings++] = copyPolicyStr; + XaceSendAccessRec *rec = calldata; + SecurityStateRec *subj, *obj; - return TRUE; + if (rec->client) { + int i; -} /* SecurityParseSitePolicy */ + subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); + obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey); + if (SecurityDoCheck(subj, obj, DixSendAccess, 0) == Success) + return; -char ** -SecurityGetSitePolicyStrings(n) - int *n; -{ - *n = nSecurityPolicyStrings; - return SecurityPolicyStrings; -} /* SecurityGetSitePolicyStrings */ - -static void -SecurityFreeSitePolicyStrings(void) -{ - if (SecurityPolicyStrings) - { - assert(nSecurityPolicyStrings); - while (nSecurityPolicyStrings--) - { - Xfree(SecurityPolicyStrings[nSecurityPolicyStrings]); - } - Xfree(SecurityPolicyStrings); - SecurityPolicyStrings = NULL; - nSecurityPolicyStrings = 0; + for (i = 0; i < rec->count; i++) + if (rec->events[i].u.u.type != UnmapNotify && + rec->events[i].u.u.type != ConfigureRequest && + rec->events[i].u.u.type != ClientMessage) { + + 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->status = BadAccess; + return; + } } -} /* SecurityFreeSitePolicyStrings */ - +} static void -SecurityLoadPropertyAccessList(void) +SecurityReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - FILE *f; - int lineNumber = 0; + XaceReceiveAccessRec *rec = calldata; + SecurityStateRec *subj, *obj; - SecurityMaxPropertyName = 0; + subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); + obj = dixLookupPrivate(&wClient(rec->pWin)->devPrivates, stateKey); - if (!SecurityPolicyFile) + if (SecurityDoCheck(subj, obj, DixReceiveAccess, 0) == Success) return; - f = fopen(SecurityPolicyFile, "r"); - if (!f) - { - ErrorF("error opening security policy file %s\n", - SecurityPolicyFile); - return; - } - - while (!feof(f)) - { - char buf[200]; - Bool validLine; - char *p; - - if (!(p = fgets(buf, sizeof(buf), f))) - break; - lineNumber++; - - /* if first line, check version number */ - if (lineNumber == 1) - { - char *v = SecurityParseString(&p); - if (strcmp(v, SECURITY_POLICY_FILE_VERSION) != 0) - { - ErrorF("%s: invalid security policy file version, ignoring file\n", - SecurityPolicyFile); - break; - } - validLine = TRUE; - } - else - { - switch (SecurityParseKeyword(&p)) - { - case SecurityKeywordComment: - validLine = TRUE; - break; - - case SecurityKeywordProperty: - validLine = SecurityParsePropertyAccessRule(p); - break; - - case SecurityKeywordSitePolicy: - validLine = SecurityParseSitePolicy(p); - break; - - default: - validLine = (*p == '\0'); /* blank lines OK, others not */ - break; - } - } - - if (!validLine) - ErrorF("Line %d of %s invalid, ignoring\n", - lineNumber, SecurityPolicyFile); - } /* end while more input */ - -#ifdef PROPDEBUG - { - PropertyAccessPtr pacl; - char *op = "aie"; - for (pacl = PropertyAccessList; pacl; pacl = pacl->next) - { - ErrorF("property %s ", NameForAtom(pacl->name)); - switch (pacl->windowRestriction) - { - case SecurityAnyWindow: ErrorF("any "); break; - case SecurityRootWindow: ErrorF("root "); break; - case SecurityWindowWithProperty: - { - ErrorF("%s ", NameForAtom(pacl->mustHaveProperty)); - if (pacl->mustHaveValue) - ErrorF(" = \"%s\" ", pacl->mustHaveValue); - - } - break; - } - ErrorF("%cr %cw %cd\n", op[pacl->readAction], - op[pacl->writeAction], op[pacl->destroyAction]); - } - } -#endif /* PROPDEBUG */ - - fclose(f); -} /* SecurityLoadPropertyAccessList */ + SecurityAudit("Security: denied client %d from receiving an event " + "sent to window 0x%x of client %d\n", + rec->client->index, rec->pWin->drawable.id, + wClient(rec->pWin)->index); + rec->status = BadAccess; +} +/* SecurityClientStateCallback + * + * Arguments: + * pcbl is &ClientStateCallback. + * nullata is NULL. + * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h) + * which contains information about client state changes. + * + * Returns: nothing. + * + * Side Effects: + * + * If a new client is connecting, its authorization ID is copied to + * client->authID. If this is a generated authorization, its reference + * count is bumped, its timer is cancelled if it was running, and its + * trustlevel is copied to TRUSTLEVEL(client). + * + * If a client is disconnecting and the client was using a generated + * authorization, the authorization's reference count is decremented, and + * if it is now zero, the timer for this authorization is started. + */ -static Bool -SecurityMatchString( - char *ws, - char *cs) +static void +SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) { - while (*ws && *cs) - { - if (*ws == '*') - { - Bool match = FALSE; - ws++; - while (!(match = SecurityMatchString(ws, cs)) && *cs) - { - cs++; - } - return match; - } - else if (*ws == *cs) - { - ws++; - cs++; - } - else break; - } - return ( ( (*ws == '\0') || ((*ws == '*') && *(ws+1) == '\0') ) - && (*cs == '\0') ); -} /* SecurityMatchString */ - -#ifdef PROPDEBUG -#include <sys/types.h> -#include <sys/stat.h> -#endif + NewClientInfoRec *pci = calldata; + SecurityStateRec *state; + SecurityAuthorizationPtr pAuth; + int rc; + state = dixLookupPrivate(&pci->client->devPrivates, stateKey); -CALLBACK(SecurityCheckPropertyAccess) -{ - XacePropertyAccessRec *rec = (XacePropertyAccessRec*)calldata; - ClientPtr client = rec->client; - WindowPtr pWin = rec->pWin; - ATOM propertyName = rec->propertyName; - Mask access_mode = rec->access_mode; - PropertyAccessPtr pacl; - char action = SecurityDefaultAction; - - /* if client trusted or window untrusted, allow operation */ - - if ( (TRUSTLEVEL(client) == XSecurityClientTrusted) || - (TRUSTLEVEL(wClient(pWin)) != XSecurityClientTrusted) ) - return; + switch (pci->client->clientState) { + case ClientStateInitial: + state->trustLevel = XSecurityClientTrusted; + state->authId = None; + state->haveState = TRUE; + break; -#ifdef PROPDEBUG - /* For testing, it's more convenient if the property rules file gets - * reloaded whenever it changes, so we can rapidly try things without - * having to reset the server. - */ - { - struct stat buf; - static time_t lastmod = 0; - int ret = stat(SecurityPolicyFile , &buf); - if ( (ret == 0) && (buf.st_mtime > lastmod) ) - { - ErrorF("reloading property rules\n"); - SecurityFreePropertyAccessList(); - SecurityLoadPropertyAccessList(); - lastmod = buf.st_mtime; + case ClientStateRunning: + state->authId = AuthorizationIDOfClient(pci->client); + rc = dixLookupResource((pointer *)&pAuth, state->authId, + SecurityAuthorizationResType, serverClient, + DixGetAttrAccess); + if (rc == Success) { + /* it is a generated authorization */ + pAuth->refcnt++; + if (pAuth->refcnt == 1 && pAuth->timer) + TimerCancel(pAuth->timer); + + state->trustLevel = pAuth->trustLevel; } - } -#endif - - /* If the property atom is bigger than any atoms on the list, - * we know we won't find it, so don't even bother looking. - */ - if (propertyName <= SecurityMaxPropertyName) - { - /* untrusted client operating on trusted window; see if it's allowed */ - - for (pacl = PropertyAccessList; pacl; pacl = pacl->next) - { - if (pacl->name < propertyName) - continue; - if (pacl->name > propertyName) - break; + break; - /* pacl->name == propertyName, so see if it applies to this window */ + case ClientStateGone: + case ClientStateRetained: + rc = dixLookupResource((pointer *)&pAuth, state->authId, + SecurityAuthorizationResType, serverClient, + DixGetAttrAccess); + if (rc == Success) { + /* it is a generated authorization */ + pAuth->refcnt--; + if (pAuth->refcnt == 0) + SecurityStartAuthorizationTimer(pAuth); + } + break; - switch (pacl->windowRestriction) - { - case SecurityAnyWindow: /* always applies */ - break; - - case SecurityRootWindow: - { - /* if not a root window, this rule doesn't apply */ - if (pWin->parent) - continue; - } - break; - - case SecurityWindowWithProperty: - { - PropertyPtr pProp = wUserProps (pWin); - Bool match = FALSE; - char *p; - char *pEndData; - - while (pProp) - { - if (pProp->propertyName == pacl->mustHaveProperty) - break; - pProp = pProp->next; - } - if (!pProp) - continue; - if (!pacl->mustHaveValue) - break; - if (pProp->type != XA_STRING || pProp->format != 8) - continue; - - p = pProp->data; - pEndData = ((char *)pProp->data) + pProp->size; - while (!match && p < pEndData) - { - if (SecurityMatchString(pacl->mustHaveValue, p)) - match = TRUE; - else - { /* skip to the next string */ - while (*p++ && p < pEndData) - ; - } - } - if (!match) - continue; - } - break; /* end case SecurityWindowWithProperty */ - } /* end switch on windowRestriction */ - - /* If we get here, the property access rule pacl applies. - * If pacl doesn't apply, something above should have - * executed a continue, which will skip the follwing code. - */ - action = XaceAllowOperation; - if (access_mode & DixReadAccess) - action = max(action, pacl->readAction); - if (access_mode & DixWriteAccess) - action = max(action, pacl->writeAction); - if (access_mode & DixDestroyAccess) - action = max(action, pacl->destroyAction); - break; - } /* end for each pacl */ - } /* end if propertyName <= SecurityMaxPropertyName */ - - if (XaceAllowOperation != action) - { /* audit the access violation */ - int cid = CLIENT_ID(pWin->drawable.id); - int reqtype = ((xReq *)client->requestBuffer)->reqType; - char *actionstr = (XaceIgnoreOperation == action) ? - "ignored" : "error"; - SecurityAudit("client %d attempted request %d with window 0x%x property %s (atom 0x%x) of client %d, %s\n", - client->index, reqtype, pWin->drawable.id, - NameForAtom(propertyName), propertyName, cid, actionstr); + default: + break; } - /* return codes increase with strictness */ - if (action > rec->rval) - rec->rval = action; -} /* SecurityCheckPropertyAccess */ - +} /* SecurityResetProc * @@ -1832,66 +1064,19 @@ static void SecurityResetProc( ExtensionEntry *extEntry) { - SecurityFreePropertyAccessList(); - SecurityFreeSitePolicyStrings(); -} /* SecurityResetProc */ - - -int -XSecurityOptions(argc, argv, i) - int argc; - char **argv; - int i; -{ - if (strcmp(argv[i], "-sp") == 0) - { - if (i < argc) - SecurityPolicyFile = argv[++i]; - return (i + 1); - } - return (i); -} /* XSecurityOptions */ - - -/* SecurityExtensionSetup - * - * Arguments: none. - * - * Returns: nothing. - * - * Side Effects: - * Sets up the Security extension if possible. - * This function contains things that need to be done - * before any other extension init functions get called. - */ - -void -SecurityExtensionSetup(INITARGS) -{ - /* Allocate the client private index */ - securityClientPrivateIndex = AllocateClientPrivateIndex(); - if (!AllocateClientPrivate(securityClientPrivateIndex, - sizeof (SecurityClientStateRec))) - FatalError("SecurityExtensionSetup: Can't allocate client private.\n"); - - /* Allocate the extension private index */ - securityExtnsnPrivateIndex = AllocateExtensionPrivateIndex(); - if (!AllocateExtensionPrivate(securityExtnsnPrivateIndex, 0)) - FatalError("SecurityExtensionSetup: Can't allocate extnsn private.\n"); - - /* register callbacks */ -#define XaceRC XaceRegisterCallback - XaceRC(XACE_RESOURCE_ACCESS, SecurityCheckResourceIDAccess, NULL); - XaceRC(XACE_DEVICE_ACCESS, SecurityCheckDeviceAccess, NULL); - XaceRC(XACE_PROPERTY_ACCESS, SecurityCheckPropertyAccess, NULL); - XaceRC(XACE_DRAWABLE_ACCESS, SecurityCheckDrawableAccess, NULL); - XaceRC(XACE_MAP_ACCESS, SecurityCheckMapAccess, NULL); - XaceRC(XACE_BACKGRND_ACCESS, SecurityCheckBackgrndAccess, NULL); - XaceRC(XACE_EXT_DISPATCH, SecurityCheckExtAccess, NULL); - XaceRC(XACE_EXT_ACCESS, SecurityCheckExtAccess, NULL); - XaceRC(XACE_HOSTLIST_ACCESS, SecurityCheckHostlistAccess, NULL); - XaceRC(XACE_DECLARE_EXT_SECURE, SecurityDeclareExtSecure, NULL); -} /* SecurityExtensionSetup */ + /* Unregister callbacks */ + DeleteCallback(&ClientStateCallback, SecurityClientState, NULL); + + XaceDeleteCallback(XACE_EXT_DISPATCH, SecurityExtension, NULL); + XaceDeleteCallback(XACE_RESOURCE_ACCESS, SecurityResource, NULL); + XaceDeleteCallback(XACE_DEVICE_ACCESS, SecurityDevice, NULL); + XaceDeleteCallback(XACE_PROPERTY_ACCESS, SecurityProperty, NULL); + XaceDeleteCallback(XACE_SEND_ACCESS, SecuritySend, NULL); + XaceDeleteCallback(XACE_RECEIVE_ACCESS, SecurityReceive, NULL); + XaceDeleteCallback(XACE_CLIENT_ACCESS, SecurityClient, NULL); + XaceDeleteCallback(XACE_EXT_ACCESS, SecurityExtension, NULL); + XaceDeleteCallback(XACE_SERVER_ACCESS, SecurityServer, NULL); +} /* SecurityExtensionInit @@ -1908,6 +1093,7 @@ void SecurityExtensionInit(INITARGS) { ExtensionEntry *extEntry; + int ret = TRUE; SecurityAuthorizationResType = CreateNewResourceType(SecurityDeleteAuthorization); @@ -1919,10 +1105,30 @@ SecurityExtensionInit(INITARGS) return; RTEventClient |= RC_NEVERRETAIN; + RegisterResourceName(SecurityAuthorizationResType, "SecurityAuthorization"); + RegisterResourceName(RTEventClient, "SecurityEventClient"); - if (!AddCallback(&ClientStateCallback, SecurityClientStateCallback, NULL)) - return; + /* Allocate the private storage */ + if (!dixRequestPrivate(stateKey, sizeof(SecurityStateRec))) + FatalError("SecurityExtensionSetup: Can't allocate client private.\n"); + + /* Register callbacks */ + ret &= AddCallback(&ClientStateCallback, SecurityClientState, NULL); + + ret &= XaceRegisterCallback(XACE_EXT_DISPATCH, SecurityExtension, NULL); + ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, SecurityResource, NULL); + ret &= XaceRegisterCallback(XACE_DEVICE_ACCESS, SecurityDevice, NULL); + ret &= XaceRegisterCallback(XACE_PROPERTY_ACCESS, SecurityProperty, NULL); + ret &= XaceRegisterCallback(XACE_SEND_ACCESS, SecuritySend, NULL); + ret &= XaceRegisterCallback(XACE_RECEIVE_ACCESS, SecurityReceive, NULL); + ret &= XaceRegisterCallback(XACE_CLIENT_ACCESS, SecurityClient, NULL); + ret &= XaceRegisterCallback(XACE_EXT_ACCESS, SecurityExtension, NULL); + ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, SecurityServer, NULL); + if (!ret) + FatalError("SecurityExtensionSetup: Failed to register callbacks\n"); + + /* Add extension to server */ extEntry = AddExtension(SECURITY_EXTENSION_NAME, XSecurityNumberEvents, XSecurityNumberErrors, ProcSecurityDispatch, SProcSecurityDispatch, @@ -1934,6 +1140,6 @@ SecurityExtensionInit(INITARGS) EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent; - SecurityLoadPropertyAccessList(); - -} /* SecurityExtensionInit */ + /* Label objects that were created before we could register ourself */ + SecurityLabelInitial(); +} diff --git a/Xext/securitysrv.h b/Xext/securitysrv.h index 67d864e2e..f4f3e32ae 100644 --- a/Xext/securitysrv.h +++ b/Xext/securitysrv.h @@ -77,13 +77,7 @@ typedef struct { Bool valid; /* did anyone recognize it? if so, set to TRUE */ } SecurityValidateGroupInfoRec; -extern int XSecurityOptions(int argc, char **argv, int i); - /* Give this value or higher to the -audit option to get security messages */ #define SECURITY_AUDIT_LEVEL 4 -#define SECURITY_POLICY_FILE_VERSION "version-1" - -extern char **SecurityGetSitePolicyStrings(int *n); - #endif /* _SECURITY_SRV_H */ diff --git a/Xext/shape.c b/Xext/shape.c index 9c765f22e..2f1baf917 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -317,7 +317,7 @@ ProcShapeRectangles (client) REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); UpdateCurrentTime(); - rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess); if (rc != Success) return rc; switch (stuff->destKind) { @@ -417,7 +417,7 @@ ProcShapeMask (client) REQUEST_SIZE_MATCH (xShapeMaskReq); UpdateCurrentTime(); - rc = dixLookupWindow(&pWin, stuff->dest, client, DixWriteAccess); + rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess); if (rc != Success) return rc; switch (stuff->destKind) { @@ -438,10 +438,10 @@ ProcShapeMask (client) if (stuff->src == None) srcRgn = 0; else { - pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src, - RT_PIXMAP, DixReadAccess); - if (!pPixmap) - return BadPixmap; + rc = dixLookupResource((pointer *)&pPixmap, stuff->src, RT_PIXMAP, + client, DixReadAccess); + if (rc != Success) + return (rc == BadValue) ? BadPixmap : rc; if (pPixmap->drawable.pScreen != pScreen || pPixmap->drawable.depth != 1) return BadMatch; @@ -525,7 +525,7 @@ ProcShapeCombine (client) REQUEST_SIZE_MATCH (xShapeCombineReq); UpdateCurrentTime(); - rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixUnknownAccess); + rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess); if (rc != Success) return rc; if (!pDestWin->optional) @@ -546,7 +546,7 @@ ProcShapeCombine (client) } pScreen = pDestWin->drawable.pScreen; - rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixUnknownAccess); + rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixGetAttrAccess); if (rc != Success) return rc; switch (stuff->srcKind) { @@ -645,7 +645,7 @@ ProcShapeOffset (client) REQUEST_SIZE_MATCH (xShapeOffsetReq); UpdateCurrentTime(); - rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess); if (rc != Success) return rc; switch (stuff->destKind) { @@ -710,7 +710,7 @@ ProcShapeQueryExtents (client) RegionPtr region; REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; rep.type = X_Reply; @@ -820,7 +820,7 @@ ProcShapeSelectInput (client) int rc; REQUEST_SIZE_MATCH (xShapeSelectInputReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); if (rc != Success) return rc; pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, @@ -993,7 +993,7 @@ ProcShapeInputSelected (client) register int n; REQUEST_SIZE_MATCH (xShapeInputSelectedReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pHead = (ShapeEventPtr *) SecurityLookupIDByType(client, @@ -1035,7 +1035,7 @@ ProcShapeGetRectangles (client) register int n; REQUEST_SIZE_MATCH(xShapeGetRectanglesReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; switch (stuff->kind) { diff --git a/Xext/shm.c b/Xext/shm.c index 5937a0358..a7a1ecf75 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -58,6 +58,7 @@ in this Software without prior written authorization from The Open Group. #include "extnsionst.h" #include "servermd.h" #include "shmint.h" +#include "xace.h" #define _XSHM_SERVER_ #include <X11/extensions/shmstr.h> #include <X11/Xfuncproto.h> @@ -146,7 +147,7 @@ static int pixmapFormat; static int shmPixFormat[MAXSCREENS]; static ShmFuncsPtr shmFuncs[MAXSCREENS]; static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS]; -static int shmPixmapPrivate; +static DevPrivateKey shmPixmapPrivate = &shmPixmapPrivate; static ShmFuncs miFuncs = {NULL, miShmPutImage}; static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage}; @@ -256,20 +257,11 @@ ShmExtensionInit(INITARGS) if (!pixmapFormat) pixmapFormat = ZPixmap; if (sharedPixmaps) - { for (i = 0; i < screenInfo.numScreens; i++) { destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap; screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; } - shmPixmapPrivate = AllocatePixmapPrivateIndex(); - for (i = 0; i < screenInfo.numScreens; i++) - { - if (!AllocatePixmapPrivate(screenInfo.screens[i], - shmPixmapPrivate, 0)) - return; - } - } } ShmSegType = CreateNewResourceType(ShmDetachSegment); if (ShmSegType && @@ -322,7 +314,8 @@ ShmDestroyPixmap (PixmapPtr pPixmap) if (pPixmap->refcnt == 1) { ShmDescPtr shmdesc; - shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr; + shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates, + shmPixmapPrivate); if (shmdesc) ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id); } @@ -764,6 +757,8 @@ ProcPanoramiXShmCreatePixmap( int i, j, result, rc; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); + unsigned int width, height, depth; + unsigned long size; PanoramiXRes *newPix; REQUEST_SIZE_MATCH(xShmCreatePixmapReq); @@ -777,11 +772,18 @@ ProcPanoramiXShmCreatePixmap( return rc; VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); - if (!stuff->width || !stuff->height) + + width = stuff->width; + height = stuff->height; + depth = stuff->depth; + if (!width || !height || !depth) { client->errorValue = 0; return BadValue; } + if (width > 32767 || height > 32767) + return BadAlloc; + if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; @@ -791,10 +793,18 @@ ProcPanoramiXShmCreatePixmap( client->errorValue = stuff->depth; return BadValue; } + CreatePmap: - VERIFY_SHMSIZE(shmdesc, stuff->offset, - PixmapBytePad(stuff->width, stuff->depth) * stuff->height, - client); + size = PixmapBytePad(width, depth) * height; + if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) { + if (size < width * height) + return BadAlloc; + } + /* thankfully, offset is unsigned */ + if (stuff->offset + size < size) + return BadAlloc; + + VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -815,7 +825,7 @@ CreatePmap: shmdesc->addr + stuff->offset); if (pMap) { - pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc; + dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc); shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = newPix->info[j].id; @@ -855,7 +865,7 @@ ProcShmPutImage(client) REQUEST(xShmPutImageReq); REQUEST_SIZE_MATCH(xShmPutImageReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) return BadValue; @@ -968,7 +978,7 @@ ProcShmGetImage(client) return(BadValue); } rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixReadAccess); if (rc != Success) return rc; VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); @@ -1093,6 +1103,8 @@ ProcShmCreatePixmap(client) register int i, rc; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); + unsigned int width, height, depth; + unsigned long size; REQUEST_SIZE_MATCH(xShmCreatePixmapReq); client->errorValue = stuff->pid; @@ -1100,16 +1112,23 @@ ProcShmCreatePixmap(client) return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); - if (!stuff->width || !stuff->height) + + width = stuff->width; + height = stuff->height; + depth = stuff->depth; + if (!width || !height || !depth) { client->errorValue = 0; return BadValue; } + if (width > 32767 || height > 32767) + return BadAlloc; + if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; @@ -1119,17 +1138,31 @@ ProcShmCreatePixmap(client) client->errorValue = stuff->depth; return BadValue; } + CreatePmap: - VERIFY_SHMSIZE(shmdesc, stuff->offset, - PixmapBytePad(stuff->width, stuff->depth) * stuff->height, - client); + size = PixmapBytePad(width, depth) * height; + if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) { + if (size < width * height) + return BadAlloc; + } + /* thankfully, offset is unsigned */ + if (stuff->offset + size < size) + return BadAlloc; + + VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); pMap = (*shmFuncs[pDraw->pScreen->myNum]->CreatePixmap)( pDraw->pScreen, stuff->width, stuff->height, stuff->depth, shmdesc->addr + stuff->offset); if (pMap) { - pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc; + rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP, + pMap, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + pDraw->pScreen->DestroyPixmap(pMap); + return rc; + } + dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc); shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; @@ -1137,6 +1170,7 @@ CreatePmap: { return(client->noClientException); } + pDraw->pScreen->DestroyPixmap(pMap); } return (BadAlloc); } diff --git a/Xext/sync.c b/Xext/sync.c index e87e0bd24..10d448106 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -433,18 +433,18 @@ SyncInitTrigger(client, pTrigger, counter, changes) Mask changes; { SyncCounter *pCounter = pTrigger->pCounter; - int status; + int rc; Bool newcounter = FALSE; if (changes & XSyncCACounter) { if (counter == None) pCounter = NULL; - else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType( - client, counter, RTCounter, DixReadAccess))) + else if (Success != (rc = dixLookupResource((pointer *)&pCounter, + counter, RTCounter, client, DixReadAccess))) { client->errorValue = counter; - return SyncErrorBase + XSyncBadCounter; + return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; } if (pCounter != pTrigger->pCounter) { /* new counter for trigger */ @@ -526,8 +526,8 @@ SyncInitTrigger(client, pTrigger, counter, changes) */ if (newcounter) { - if ((status = SyncAddTriggerToCounter(pTrigger)) != Success) - return status; + if ((rc = SyncAddTriggerToCounter(pTrigger)) != Success) + return rc; } else if (IsSystemCounter(pCounter)) { @@ -1465,7 +1465,7 @@ ProcSyncSetPriority(client) priorityclient = client; else { rc = dixLookupClient(&priorityclient, stuff->id, client, - DixUnknownAccess); + DixSetAttrAccess); if (rc != Success) return rc; } @@ -1502,7 +1502,7 @@ ProcSyncGetPriority(client) priorityclient = client; else { rc = dixLookupClient(&priorityclient, stuff->id, client, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; } diff --git a/Xext/xace.c b/Xext/xace.c index b4e0eee5f..e88debc5f 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -22,35 +22,52 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include <stdarg.h> -#include "windowstr.h" #include "scrnintstr.h" +#include "extnsionst.h" +#include "pixmapstr.h" +#include "regionstr.h" #include "gcstruct.h" #include "xacestr.h" -#include "modinit.h" CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0}; -/* Proc vectors for untrusted clients, swapped and unswapped versions. - * These are the same as the normal proc vectors except that extensions - * that haven't declared themselves secure will have ProcBadRequest plugged - * in for their major opcode dispatcher. This prevents untrusted clients - * from guessing extension major opcodes and using the extension even though - * the extension can't be listed or queried. - */ -static int (*UntrustedProcVector[256])( - ClientPtr /*client*/ -); -static int (*SwappedUntrustedProcVector[256])( - ClientPtr /*client*/ -); - /* Special-cased hook functions. Called by Xserver. */ -void XaceHookAuditBegin(ClientPtr ptr) +int XaceHookDispatch(ClientPtr client, int major) { - XaceAuditRec rec = { ptr, 0 }; - /* call callbacks, there is no return value. */ + /* Call the audit begin callback, there is no return value. */ + XaceAuditRec rec = { client, 0 }; CallCallbacks(&XaceHooks[XACE_AUDIT_BEGIN], &rec); + + if (major < 128) { + /* Call the core dispatch hook */ + XaceCoreDispatchRec rec = { client, Success /* default allow */ }; + CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec); + return rec.status; + } else { + /* Call the extension dispatch hook */ + ExtensionEntry *ext = GetExtensionEntry(major); + XaceExtAccessRec rec = { client, ext, DixUseAccess, Success }; + if (ext) + CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec); + /* On error, pretend extension doesn't exist */ + return (rec.status == Success) ? Success : BadRequest; + } +} + +int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin, + PropertyPtr pProp, Mask access_mode) +{ + XacePropertyAccessRec rec = { client, pWin, pProp, access_mode, Success }; + CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec); + return rec.status; +} + +int XaceHookSelectionAccess(ClientPtr client, Atom name, Mask access_mode) +{ + XaceSelectionAccessRec rec = { client, name, access_mode, Success }; + CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec); + return rec.status; } void XaceHookAuditEnd(ClientPtr ptr, int result) @@ -81,95 +98,94 @@ int XaceHook(int hook, ...) va_arg(ap, ClientPtr), va_arg(ap, XID), va_arg(ap, RESTYPE), - va_arg(ap, Mask), va_arg(ap, pointer), - TRUE /* default allow */ + va_arg(ap, RESTYPE), + va_arg(ap, pointer), + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } case XACE_DEVICE_ACCESS: { XaceDeviceAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, DeviceIntPtr), - va_arg(ap, Bool), - TRUE /* default allow */ + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_PROPERTY_ACCESS: { - XacePropertyAccessRec rec = { + case XACE_SEND_ACCESS: { + XaceSendAccessRec rec = { va_arg(ap, ClientPtr), + va_arg(ap, DeviceIntPtr), va_arg(ap, WindowPtr), - va_arg(ap, Atom), - va_arg(ap, Mask), - XaceAllowOperation /* default allow */ + va_arg(ap, xEventPtr), + va_arg(ap, int), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_DRAWABLE_ACCESS: { - XaceDrawableAccessRec rec = { + case XACE_RECEIVE_ACCESS: { + XaceReceiveAccessRec rec = { va_arg(ap, ClientPtr), - va_arg(ap, DrawablePtr), - TRUE /* default allow */ + va_arg(ap, WindowPtr), + va_arg(ap, xEventPtr), + va_arg(ap, int), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_MAP_ACCESS: - case XACE_BACKGRND_ACCESS: { - XaceMapAccessRec rec = { + case XACE_CLIENT_ACCESS: { + XaceClientAccessRec rec = { va_arg(ap, ClientPtr), - va_arg(ap, WindowPtr), - TRUE /* default allow */ + va_arg(ap, ClientPtr), + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_EXT_DISPATCH: case XACE_EXT_ACCESS: { XaceExtAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, ExtensionEntry*), - TRUE /* default allow */ + DixGetAttrAccess, + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_HOSTLIST_ACCESS: { - XaceHostlistAccessRec rec = { + case XACE_SERVER_ACCESS: { + XaceServerAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, Mask), - TRUE /* default allow */ + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_SITE_POLICY: { - XaceSitePolicyRec rec = { - va_arg(ap, char*), - va_arg(ap, int), - FALSE /* default unrecognized */ - }; - calldata = &rec; - prv = &rec.rval; - break; - } - case XACE_DECLARE_EXT_SECURE: { - XaceDeclareExtSecureRec rec = { - va_arg(ap, ExtensionEntry*), - va_arg(ap, Bool) + case XACE_SCREEN_ACCESS: + case XACE_SCREENSAVER_ACCESS: { + XaceScreenAccessRec rec = { + va_arg(ap, ClientPtr), + va_arg(ap, ScreenPtr), + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; + prv = &rec.status; break; } case XACE_AUTH_AVAIL: { @@ -189,14 +205,6 @@ int XaceHook(int hook, ...) calldata = &rec; break; } - case XACE_WINDOW_INIT: { - XaceWindowRec rec = { - va_arg(ap, ClientPtr), - va_arg(ap, WindowPtr) - }; - calldata = &rec; - break; - } default: { va_end(ap); return 0; /* unimplemented hook number */ @@ -206,168 +214,7 @@ int XaceHook(int hook, ...) /* call callbacks and return result, if any. */ CallCallbacks(&XaceHooks[hook], calldata); - return prv ? *prv : 0; -} - -static int -ProcXaceDispatch(ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) - { - default: - return BadRequest; - } -} /* ProcXaceDispatch */ - -static int -SProcXaceDispatch(ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) - { - default: - return BadRequest; - } -} /* SProcXaceDispatch */ - - -/* XaceResetProc - * - * Arguments: - * extEntry is the extension information for the XACE extension. - * - * Returns: nothing. - * - * Side Effects: - * Performs any cleanup needed by XACE at server shutdown time. - */ -static void -XaceResetProc(ExtensionEntry *extEntry) -{ - int i; - - for (i=0; i<XACE_NUM_HOOKS; i++) - { - DeleteCallbackList(&XaceHooks[i]); - XaceHooks[i] = NULL; - } -} /* XaceResetProc */ - - -static int -XaceCatchDispatchProc(ClientPtr client) -{ - REQUEST(xReq); - int major = stuff->reqType; - XaceCoreDispatchRec rec = { client, TRUE /* default allow */ }; - - if (!ProcVector[major]) - return (BadRequest); - - /* call callbacks and return result, if any. */ - CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec); - - if (!rec.rval) - return (BadAccess); - - return client->swapped ? - (* SwappedProcVector[major])(client) : - (* ProcVector[major])(client); -} - -static int -XaceCatchExtProc(ClientPtr client) -{ - REQUEST(xReq); - int major = stuff->reqType; - ExtensionEntry *ext = GetExtensionEntry(major); - - if (!ext || !ProcVector[major]) - return (BadRequest); - - if (!XaceHook(XACE_EXT_DISPATCH, client, ext)) - return (BadRequest); /* pretend extension doesn't exist */ - - return client->swapped ? - (* SwappedProcVector[major])(client) : - (* ProcVector[major])(client); -} - - -/* SecurityClientStateCallback - * - * Arguments: - * pcbl is &ClientStateCallback. - * nullata is NULL. - * calldata is a pointer to a NewClientInfoRec (include/dixstruct.h) - * which contains information about client state changes. - * - * Returns: nothing. - * - * Side Effects: - * - * If a new client is connecting, its authorization ID is copied to - * client->authID. If this is a generated authorization, its reference - * count is bumped, its timer is cancelled if it was running, and its - * trustlevel is copied to TRUSTLEVEL(client). - * - * If a client is disconnecting and the client was using a generated - * authorization, the authorization's reference count is decremented, and - * if it is now zero, the timer for this authorization is started. - */ - -static void -XaceClientStateCallback( - CallbackListPtr *pcbl, - pointer nulldata, - pointer calldata) -{ - NewClientInfoRec *pci = (NewClientInfoRec *)calldata; - ClientPtr client = pci->client; - - switch (client->clientState) - { - case ClientStateRunning: - { - client->requestVector = client->swapped ? - SwappedUntrustedProcVector : UntrustedProcVector; - break; - } - default: break; - } -} /* XaceClientStateCallback */ - -/* XaceExtensionInit - * - * Initialize the XACE Extension - */ -void XaceExtensionInit(INITARGS) -{ - ExtensionEntry *extEntry; - int i; - - if (!AddCallback(&ClientStateCallback, XaceClientStateCallback, NULL)) - return; - - extEntry = AddExtension(XACE_EXTENSION_NAME, - XaceNumberEvents, XaceNumberErrors, - ProcXaceDispatch, SProcXaceDispatch, - XaceResetProc, StandardMinorOpcode); - - /* initialize dispatching intercept functions */ - for (i = 0; i < 128; i++) - { - UntrustedProcVector[i] = XaceCatchDispatchProc; - SwappedUntrustedProcVector[i] = XaceCatchDispatchProc; - } - for (i = 128; i < 256; i++) - { - UntrustedProcVector[i] = XaceCatchExtProc; - SwappedUntrustedProcVector[i] = XaceCatchExtProc; - } + return prv ? *prv : Success; } /* XaceCensorImage @@ -432,7 +279,7 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, /* convert region to list-of-rectangles for PolyFillRect */ - pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle *)); + pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle)); if (!pRects) { failed = TRUE; diff --git a/Xext/xace.h b/Xext/xace.h index 273635c73..1f07d9fd2 100644 --- a/Xext/xace.h +++ b/Xext/xace.h @@ -20,22 +20,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _XACE_H #define _XACE_H -/* Hook return codes */ -#define XaceErrorOperation 0 -#define XaceAllowOperation 1 -#define XaceIgnoreOperation 2 - #ifdef XACE -#define XACE_EXTENSION_NAME "XAccessControlExtension" -#define XACE_MAJOR_VERSION 1 +#define XACE_MAJOR_VERSION 2 #define XACE_MINOR_VERSION 0 -#include "pixmap.h" /* for DrawablePtr */ -#include "regionstr.h" /* for RegionPtr */ +#include "pixmap.h" +#include "region.h" +#include "window.h" +#include "property.h" -#define XaceNumberEvents 0 -#define XaceNumberErrors 0 +/* Default window background */ +#define XaceBackgroundNoneState(w) ((w)->forcedBG ? BackgroundPixel : None) /* security hooks */ /* Constants used to identify the available security hooks @@ -45,16 +41,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define XACE_RESOURCE_ACCESS 2 #define XACE_DEVICE_ACCESS 3 #define XACE_PROPERTY_ACCESS 4 -#define XACE_DRAWABLE_ACCESS 5 -#define XACE_MAP_ACCESS 6 -#define XACE_BACKGRND_ACCESS 7 +#define XACE_SEND_ACCESS 5 +#define XACE_RECEIVE_ACCESS 6 +#define XACE_CLIENT_ACCESS 7 #define XACE_EXT_ACCESS 8 -#define XACE_HOSTLIST_ACCESS 9 -#define XACE_SITE_POLICY 10 -#define XACE_DECLARE_EXT_SECURE 11 -#define XACE_AUTH_AVAIL 12 -#define XACE_KEY_AVAIL 13 -#define XACE_WINDOW_INIT 14 +#define XACE_SERVER_ACCESS 9 +#define XACE_SELECTION_ACCESS 10 +#define XACE_SCREEN_ACCESS 11 +#define XACE_SCREENSAVER_ACCESS 12 +#define XACE_AUTH_AVAIL 13 +#define XACE_KEY_AVAIL 14 #define XACE_AUDIT_BEGIN 15 #define XACE_AUDIT_END 16 #define XACE_NUM_HOOKS 17 @@ -70,8 +66,12 @@ extern int XaceHook( /* Special-cased hook functions */ +extern int XaceHookDispatch(ClientPtr ptr, int major); +extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin, + PropertyPtr pProp, Mask access_mode); +extern int XaceHookSelectionAccess(ClientPtr ptr, Atom name, + Mask access_mode); extern void XaceHookAuditEnd(ClientPtr ptr, int result); -extern void XaceHookAuditBegin(ClientPtr ptr); /* Register a callback for a given hook. */ @@ -99,17 +99,24 @@ extern void XaceCensorImage( #else /* XACE */ +/* Default window background */ +#define XaceBackgroundNoneState(w) None + /* Define calls away when XACE is not being built. */ #ifdef __GNUC__ -#define XaceHook(args...) XaceAllowOperation +#define XaceHook(args...) Success +#define XaceHookDispatch(args...) Success +#define XaceHookPropertyAccess(args...) Success +#define XaceHookSelectionAccess(args...) Success #define XaceHookAuditEnd(args...) { ; } -#define XaceHookAuditBegin(args...) { ; } #define XaceCensorImage(args...) { ; } #else -#define XaceHook(...) XaceAllowOperation +#define XaceHook(...) Success +#define XaceHookDispatch(...) Success +#define XaceHookPropertyAccess(...) Success +#define XaceHookSelectionAccess(...) Success #define XaceHookAuditEnd(...) { ; } -#define XaceHookAuditBegin(...) { ; } #define XaceCensorImage(...) { ; } #endif diff --git a/Xext/xacestr.h b/Xext/xacestr.h index 7114d066b..e31d4246a 100644 --- a/Xext/xacestr.h +++ b/Xext/xacestr.h @@ -20,91 +20,109 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _XACESTR_H #define _XACESTR_H -#include <X11/Xdefs.h> -#include "dixstruct.h" +#include "dix.h" #include "resource.h" #include "extnsionst.h" -#include "gcstruct.h" -#include "windowstr.h" -#include "inputstr.h" +#include "window.h" +#include "input.h" +#include "property.h" +#include "selection.h" #include "xace.h" /* XACE_CORE_DISPATCH */ typedef struct { ClientPtr client; - int rval; + int status; } XaceCoreDispatchRec; /* XACE_RESOURCE_ACCESS */ -/* XACE_RESOURCE_CREATE */ typedef struct { ClientPtr client; XID id; RESTYPE rtype; - Mask access_mode; pointer res; - int rval; + RESTYPE ptype; + pointer parent; + Mask access_mode; + int status; } XaceResourceAccessRec; /* XACE_DEVICE_ACCESS */ typedef struct { ClientPtr client; DeviceIntPtr dev; - Bool fromRequest; - int rval; + Mask access_mode; + int status; } XaceDeviceAccessRec; /* XACE_PROPERTY_ACCESS */ typedef struct { ClientPtr client; WindowPtr pWin; - Atom propertyName; + PropertyPtr pProp; Mask access_mode; - int rval; + int status; } XacePropertyAccessRec; -/* XACE_DRAWABLE_ACCESS */ +/* XACE_SEND_ACCESS */ typedef struct { ClientPtr client; - DrawablePtr pDraw; - int rval; -} XaceDrawableAccessRec; + DeviceIntPtr dev; + WindowPtr pWin; + xEventPtr events; + int count; + int status; +} XaceSendAccessRec; -/* XACE_MAP_ACCESS */ -/* XACE_BACKGRND_ACCESS */ +/* XACE_RECEIVE_ACCESS */ typedef struct { ClientPtr client; WindowPtr pWin; - int rval; -} XaceMapAccessRec; + xEventPtr events; + int count; + int status; +} XaceReceiveAccessRec; + +/* XACE_CLIENT_ACCESS */ +typedef struct { + ClientPtr client; + ClientPtr target; + Mask access_mode; + int status; +} XaceClientAccessRec; -/* XACE_EXT_DISPATCH_ACCESS */ +/* XACE_EXT_DISPATCH */ /* XACE_EXT_ACCESS */ typedef struct { ClientPtr client; ExtensionEntry *ext; - int rval; + Mask access_mode; + int status; } XaceExtAccessRec; -/* XACE_HOSTLIST_ACCESS */ +/* XACE_SERVER_ACCESS */ typedef struct { ClientPtr client; Mask access_mode; - int rval; -} XaceHostlistAccessRec; + int status; +} XaceServerAccessRec; -/* XACE_SITE_POLICY */ +/* XACE_SELECTION_ACCESS */ typedef struct { - char *policyString; - int len; - int rval; -} XaceSitePolicyRec; + ClientPtr client; + Atom name; + Mask access_mode; + int status; +} XaceSelectionAccessRec; -/* XACE_DECLARE_EXT_SECURE */ +/* XACE_SCREEN_ACCESS */ +/* XACE_SCREENSAVER_ACCESS */ typedef struct { - ExtensionEntry *ext; - Bool secure; -} XaceDeclareExtSecureRec; + ClientPtr client; + ScreenPtr screen; + Mask access_mode; + int status; +} XaceScreenAccessRec; /* XACE_AUTH_AVAIL */ typedef struct { @@ -119,12 +137,6 @@ typedef struct { int count; } XaceKeyAvailRec; -/* XACE_WINDOW_INIT */ -typedef struct { - ClientPtr client; - WindowPtr pWin; -} XaceWindowRec; - /* XACE_AUDIT_BEGIN */ /* XACE_AUDIT_END */ typedef struct { diff --git a/Xext/xcalibrate.c b/Xext/xcalibrate.c index 97ef3dc38..3fe2bdc5c 100644 --- a/Xext/xcalibrate.c +++ b/Xext/xcalibrate.c @@ -164,7 +164,6 @@ ProcXCalibrateSetRawMode (ClientPtr client) return (client->noClientException); } - static int SProcXCalibrateSetRawMode (ClientPtr client) { @@ -178,6 +177,47 @@ SProcXCalibrateSetRawMode (ClientPtr client) return ProcXCalibrateSetRawMode(client); } +static int +ProcXCalibrateScreenToCoord (ClientPtr client) +{ + REQUEST(xXCalibrateScreenToCoordReq); + xXCalibrateScreenToCoordReply rep; + + REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq); + + memset (&rep, 0, sizeof (rep)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.x = stuff->x; + rep.y = stuff->y; + + KdScreenToPointerCoords(&rep.x, &rep.y); + + if (client->swapped) + { + int n; + + swaps (&rep.x, n); + swaps (&rep.y, n); + } + WriteToClient(client, sizeof (rep), (char *) &rep); + return (client->noClientException); +} + +static int +SProcXCalibrateScreenToCoord (ClientPtr client) +{ + REQUEST(xXCalibrateScreenToCoordReq); + int n; + + REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq); + + swaps(&stuff->x, n); + swaps(&stuff->y, n); + + return ProcXCalibrateScreenToCoord(client); +} + static void XCalibrateResetProc (ExtensionEntry *extEntry) { @@ -192,6 +232,9 @@ ProcXCalibrateDispatch (ClientPtr client) return ProcXCalibrateQueryVersion(client); case X_XCalibrateRawMode: return ProcXCalibrateSetRawMode(client); + case X_XCalibrateScreenToCoord: + return ProcXCalibrateScreenToCoord(client); + default: break; } @@ -211,6 +254,8 @@ SProcXCalibrateDispatch (ClientPtr client) return SProcXCalibrateQueryVersion(client); case X_XCalibrateRawMode: return SProcXCalibrateSetRawMode(client); + case X_XCalibrateScreenToCoord: + return SProcXCalibrateScreenToCoord(client); default: break; } diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c index a3d40e3ce..a42d2e210 100644 --- a/Xext/xcmisc.c +++ b/Xext/xcmisc.c @@ -64,11 +64,9 @@ static DISPATCH_PROC(SProcXCMiscGetXIDRange); void XCMiscExtensionInit(INITARGS) { - (void) AddExtension(XCMiscExtensionName, 0, 0, - ProcXCMiscDispatch, SProcXCMiscDispatch, - XCMiscResetProc, StandardMinorOpcode); - - DeclareExtensionSecurity(XCMiscExtensionName, TRUE); + AddExtension(XCMiscExtensionName, 0, 0, + ProcXCMiscDispatch, SProcXCMiscDispatch, + XCMiscResetProc, StandardMinorOpcode); } /*ARGSUSED*/ diff --git a/Xext/xevie.c b/Xext/xevie.c index 7922913ba..ea409f104 100644 --- a/Xext/xevie.c +++ b/Xext/xevie.c @@ -76,11 +76,11 @@ DeviceIntPtr xeviemouse = NULL; Mask xevieMask = 0; int xevieEventSent = 0; int xevieKBEventSent = 0; -static unsigned int xevieServerGeneration; -static int xevieDevicePrivateIndex; +static DevPrivateKey xevieDevicePrivateKey = &xevieDevicePrivateKey; static Bool xevieModifiersOn = FALSE; -#define XEVIEINFO(dev) ((xevieDeviceInfoPtr)dev->devPrivates[xevieDevicePrivateIndex].ptr) +#define XEVIEINFO(dev) ((xevieDeviceInfoPtr) \ + dixLookupPrivate(&(dev)->devPrivates, xevieDevicePrivateKey)) Mask xevieFilters[128] = { @@ -134,12 +134,6 @@ XevieExtensionInit (void) { ExtensionEntry* extEntry; - if (serverGeneration != xevieServerGeneration) { - if ((xevieDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1) - return; - xevieServerGeneration = serverGeneration; - } - if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL)) return; @@ -374,7 +368,7 @@ int SProcSelectInput (ClientPtr client) REQUEST (xXevieSelectInputReq); swaps (&stuff->length, n); - REQUEST_AT_LEAST_SIZE (xXevieSendReq); + REQUEST_AT_LEAST_SIZE (xXevieSelectInputReq); swapl(&stuff->event_mask, n); return ProcSelectInput (client); } @@ -618,14 +612,11 @@ XevieAdd(DeviceIntPtr device, void* data) { xevieDeviceInfoPtr xeviep; - if (!AllocateDevicePrivate(device, xevieDevicePrivateIndex)) - return FALSE; - xeviep = xalloc (sizeof (xevieDeviceInfoRec)); if (!xeviep) return FALSE; - device->devPrivates[xevieDevicePrivateIndex].ptr = xeviep; + dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, xeviep); XevieUnwrapAdd(device, data); return TRUE; @@ -642,7 +633,7 @@ XevieRemove(DeviceIntPtr device,pointer data) UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc); xfree(xeviep); - device->devPrivates[xevieDevicePrivateIndex].ptr = NULL; + dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, NULL); return TRUE; } diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index f26605eb9..d5c5704de 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -236,15 +236,15 @@ shmalloc( size = (size + pagesize-1) & -pagesize; shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); if (shmid == -1) { - ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, errno = %d\n", - size, errno); + ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n", + size, strerror(errno)); xfree(pDesc); return (ShmDescPtr) NULL; } if ((addr = shmat(shmid, 0, 0)) == (char *)-1) { - ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, errno = %d\n", - size, errno); + ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n", + size, strerror(errno)); shmctl(shmid, IPC_RMID, (void *) 0); xfree(pDesc); return (ShmDescPtr) NULL; @@ -428,10 +428,10 @@ ProcXF86BigfontQueryFont( #endif client->errorValue = stuff->id; /* EITHER font or gc */ pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - DixReadAccess); + DixGetAttrAccess); if (!pFont) { GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, - DixReadAccess); + DixGetAttrAccess); if (!pGC) { client->errorValue = stuff->id; return BadFont; /* procotol spec says only error is BadFont */ diff --git a/Xext/xprint.c b/Xext/xprint.c index 42c6e6a2a..dba7989cc 100644 --- a/Xext/xprint.c +++ b/Xext/xprint.c @@ -153,8 +153,6 @@ static int XpFreePage(pointer, XID); static Bool XpCloseScreen(int, ScreenPtr); static CARD32 GetAllEventMasks(XpContextPtr); static struct _XpClient *CreateXpClient(ClientPtr); -static void InitContextPrivates(XpContextPtr); -static void ResetContextPrivates(void); static struct _XpClient *FindClient(XpContextPtr, ClientPtr); static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr); @@ -233,21 +231,12 @@ static XpScreenPtr XpScreens[MAXSCREENS]; static unsigned char XpReqCode; static int XpEventBase; static int XpErrorBase; -static unsigned long XpGeneration = 0; -static int XpClientPrivateIndex; - -/* Variables for the context private machinery. - * These must be initialized at compile time because - * main() calls InitOutput before InitExtensions, and the - * output drivers are likely to call AllocateContextPrivate. - * These variables are reset at CloseScreen time. CloseScreen - * is used because it occurs after FreeAllResources, and before - * the next InitOutput cycle. - */ -static int contextPrivateCount = 0; -static int contextPrivateLen = 0; -static unsigned *contextPrivateSizes = (unsigned *)NULL; -static unsigned totalContextSize = sizeof(XpContextRec); +static DevPrivateKey XpClientPrivateKey = &XpClientPrivateKey; + +#define XP_GETPRIV(pClient) ((XpContextPtr) \ + dixLookupPrivate(&(pClient)->devPrivates, XpClientPrivateKey)) +#define XP_SETPRIV(pClient, p) \ + dixSetPrivate(&(pClient)->devPrivates, XpClientPrivateKey, p) /* * There are three types of resources involved. One is the resource associated @@ -305,20 +294,6 @@ XpExtensionInit(INITARGS) EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent; } - if(XpGeneration != serverGeneration) - { - XpClientPrivateIndex = AllocateClientPrivateIndex(); - /* - * We allocate 0 length & simply stuff a pointer to the - * ContextRec in the DevUnion. - */ - if(AllocateClientPrivate(XpClientPrivateIndex, 0) != TRUE) - { - /* we can't alloc a client private, should we bail??? XXX */ - } - XpGeneration = serverGeneration; - } - for(i = 0; i < MAXSCREENS; i++) { /* @@ -335,7 +310,6 @@ XpExtensionInit(INITARGS) screenInfo.screens[i]->CloseScreen = XpCloseScreen; } } - DeclareExtensionSecurity(XP_PRINTNAME, TRUE); } static void @@ -378,14 +352,6 @@ XpCloseScreen(int index, ScreenPtr pScreen) } XpScreens[index] = (XpScreenPtr)NULL; - /* - * It's wasteful to call ResetContextPrivates() at every CloseScreen, - * but it's the best we know how to do for now. We do this because we - * have to wait until after all resources have been freed (so we know - * how to free the ContextRecs), and before the next InitOutput cycle. - * See dix/main.c for the order of initialization and reset. - */ - ResetContextPrivates(); return (*CloseScreen)(index, pScreen); } @@ -938,12 +904,10 @@ ProcXpCreateContext(ClientPtr client) /* * Allocate and add the context resource. */ - if((pContext = (XpContextPtr) xalloc(totalContextSize)) == + if((pContext = (XpContextPtr) xalloc(sizeof(XpContextRec))) == (XpContextPtr) NULL) return BadAlloc; - InitContextPrivates(pContext); - if(AddResource(stuff->contextID, RTcontext, (pointer) pContext) != TRUE) { @@ -957,6 +921,7 @@ ProcXpCreateContext(ClientPtr client) pContext->state = 0; pContext->clientSlept = (ClientPtr)NULL; pContext->imageRes = 0; + pContext->devPrivates = NULL; pContext->funcs.DestroyContext = 0; pContext->funcs.StartJob = 0; @@ -1023,8 +988,7 @@ ProcXpSetContext(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPrintSetContextReq); - if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) != - (pointer)NULL) + if((pContext = XP_GETPRIV(client)) != (pointer)NULL) { /* * Erase this client's knowledge of its old context, if any. @@ -1037,7 +1001,7 @@ ProcXpSetContext(ClientPtr client) FreeXpClient(pPrintClient, TRUE); } - client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL; + XP_SETPRIV(client, NULL); } if(stuff->printContext == None) return Success; @@ -1059,7 +1023,7 @@ ProcXpSetContext(ClientPtr client) if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL) return BadAlloc; - client->devPrivates[XpClientPrivateIndex].ptr = pContext; + XP_SETPRIV(client, pContext); XpSetFontResFunc(client); @@ -1072,7 +1036,7 @@ ProcXpSetContext(ClientPtr client) XpContextPtr XpGetPrintContext(ClientPtr client) { - return (client->devPrivates[XpClientPrivateIndex].ptr); + return XP_GETPRIV(client); } static int @@ -1087,8 +1051,7 @@ ProcXpGetContext(ClientPtr client) REQUEST_SIZE_MATCH(xPrintGetContextReq); - if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) == - (pointer)NULL) + if((pContext = XP_GETPRIV(client)) == (pointer)NULL) rep.printContext = None; else rep.printContext = pContext->contextID; @@ -1231,6 +1194,7 @@ XpFreeContext(pointer data, XID id) } xfree(pContext->printerName); + dixFreePrivates(pContext->devPrivates); xfree(pContext); return Success; /* ??? */ } @@ -1266,11 +1230,9 @@ FreeXpClient(XpClientPtr pXpClient, Bool freeResource) * If we're freeing the clientRec associated with the context tied * to the client's devPrivates, then we need to clear the devPrivates. */ - if(pXpClient->client->devPrivates[XpClientPrivateIndex].ptr == - pXpClient->context) + if(XP_GETPRIV(pXpClient->client) == pXpClient->context) { - pXpClient->client->devPrivates[XpClientPrivateIndex].ptr = - (pointer)NULL; + XP_SETPRIV(pXpClient->client, NULL); } for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead; @@ -1354,87 +1316,6 @@ XpFreePage(pointer data, XID id) return result; } -/* - * ContextPrivate machinery. - * Context privates are intended for use by the drivers, allowing the - * drivers to maintain context-specific data. The driver should free - * the associated data at DestroyContext time. - */ - -static void -InitContextPrivates(XpContextPtr context) -{ - register char *ptr; - DevUnion *ppriv; - register unsigned *sizes; - register unsigned size; - register int i; - - if (totalContextSize == sizeof(XpContextRec)) - ppriv = (DevUnion *)NULL; - else - ppriv = (DevUnion *)(context + 1); - - context->devPrivates = ppriv; - sizes = contextPrivateSizes; - ptr = (char *)(ppriv + contextPrivateLen); - for (i = contextPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } -} - -static void -ResetContextPrivates(void) -{ - contextPrivateCount = 0; - contextPrivateLen = 0; - xfree(contextPrivateSizes); - contextPrivateSizes = (unsigned *)NULL; - totalContextSize = sizeof(XpContextRec); - -} - -int -XpAllocateContextPrivateIndex(void) -{ - return contextPrivateCount++; -} - -Bool -XpAllocateContextPrivate(int index, unsigned amount) -{ - unsigned oldamount; - - if (index >= contextPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(contextPrivateSizes, - (index + 1) * sizeof(unsigned)); - if (!nsizes) - return FALSE; - while (contextPrivateLen <= index) - { - nsizes[contextPrivateLen++] = 0; - totalContextSize += sizeof(DevUnion); - } - contextPrivateSizes = nsizes; - } - oldamount = contextPrivateSizes[index]; - if (amount > oldamount) - { - contextPrivateSizes[index] = amount; - totalContextSize += (amount - oldamount); - } - return TRUE; -} - static XpClientPtr AcquireClient(XpContextPtr pContext, ClientPtr client) { @@ -1483,8 +1364,7 @@ ProcXpStartJob(ClientPtr client) REQUEST_SIZE_MATCH(xPrintStartJobReq); /* Check to see that a context has been established by this client. */ - if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) - == (XpContextPtr)NULL) + if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) return XpErrorBase+XPBadContext; if(pContext->state != 0) @@ -1524,8 +1404,7 @@ ProcXpEndJob(ClientPtr client) REQUEST_SIZE_MATCH(xPrintEndJobReq); - if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) - == (XpContextPtr)NULL) + if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & JOB_STARTED)) @@ -1630,8 +1509,7 @@ ProcXpStartDoc(ClientPtr client) REQUEST_SIZE_MATCH(xPrintStartDocReq); - if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) - == (XpContextPtr)NULL) + if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & JOB_STARTED) || @@ -1666,8 +1544,7 @@ ProcXpEndDoc(ClientPtr client) REQUEST_SIZE_MATCH(xPrintEndDocReq); - if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) - == (XpContextPtr)NULL) + if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & DOC_RAW_STARTED) && @@ -1819,8 +1696,7 @@ ProcXpStartPage(ClientPtr client) REQUEST_SIZE_MATCH(xPrintStartPageReq); - if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) - == (XpContextPtr)NULL) + if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & JOB_STARTED)) @@ -1864,8 +1740,7 @@ ProcXpEndPage(ClientPtr client) REQUEST_SIZE_MATCH(xPrintEndPageReq); - if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) - == (XpContextPtr)NULL) + if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & PAGE_STARTED)) @@ -1914,8 +1789,7 @@ ProcXpPutDocumentData(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq); - if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr) - == (XpContextPtr)NULL) + if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL) return XpErrorBase+XPBadSequence; if(!(pContext->state & DOC_RAW_STARTED) && @@ -2425,7 +2299,7 @@ GetAllEventMasks(XpContextPtr pContext) XpContextPtr XpContextOfClient(ClientPtr client) { - return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr; + return XP_GETPRIV(client); } diff --git a/Xext/xres.c b/Xext/xres.c index 32cc9030d..9bd70c672 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -17,6 +17,7 @@ #include "dixstruct.h" #include "extnsionst.h" #include "swaprep.h" +#include "registry.h" #include <X11/extensions/XResproto.h> #include "pixmapstr.h" #include "windowstr.h" @@ -66,7 +67,7 @@ ProcXResQueryClients (ClientPtr client) current_clients = xalloc((currentMaxClients - 1) * sizeof(int)); num_clients = 0; - for(i = 1; i < currentMaxClients; i++) { + for(i = 0; i < currentMaxClients; i++) { if(clients[i]) { current_clients[num_clients] = i; num_clients++; @@ -127,9 +128,7 @@ ProcXResQueryClientResources (ClientPtr client) clientID = CLIENT_ID(stuff->xid); - /* we could remove the (clientID == 0) check if we wanted to allow - probing the X-server's resource usage */ - if(!clientID || (clientID >= currentMaxClients) || !clients[clientID]) { + if((clientID >= currentMaxClients) || !clients[clientID]) { client->errorValue = stuff->xid; return BadValue; } @@ -161,17 +160,20 @@ ProcXResQueryClientResources (ClientPtr client) if(num_types) { xXResType scratch; + char *name; for(i = 0; i < lastResourceType; i++) { if(!counts[i]) continue; - if(!ResourceNames[i + 1]) { + name = (char *)LookupResourceName(i + 1); + if (strcmp(name, XREGISTRY_UNKNOWN)) + scratch.resource_type = MakeAtom(name, strlen(name), TRUE); + else { char buf[40]; snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1); - RegisterResourceName(i + 1, buf); + scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE); } - scratch.resource_type = ResourceNames[i + 1]; scratch.count = counts[i]; if(client->swapped) { @@ -250,9 +252,7 @@ ProcXResQueryClientPixmapBytes (ClientPtr client) clientID = CLIENT_ID(stuff->xid); - /* we could remove the (clientID == 0) check if we wanted to allow - probing the X-server's resource usage */ - if(!clientID || (clientID >= currentMaxClients) || !clients[clientID]) { + if((clientID >= currentMaxClients) || !clients[clientID]) { client->errorValue = stuff->xid; return BadValue; } @@ -387,15 +387,4 @@ ResExtensionInit(INITARGS) (void) AddExtension(XRES_NAME, 0, 0, ProcResDispatch, SProcResDispatch, ResResetProc, StandardMinorOpcode); - - RegisterResourceName(RT_NONE, "NONE"); - RegisterResourceName(RT_WINDOW, "WINDOW"); - RegisterResourceName(RT_PIXMAP, "PIXMAP"); - RegisterResourceName(RT_GC, "GC"); - RegisterResourceName(RT_FONT, "FONT"); - RegisterResourceName(RT_CURSOR, "CURSOR"); - RegisterResourceName(RT_COLORMAP, "COLORMAP"); - RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); - RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); - RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB"); } diff --git a/Xext/xselinux.c b/Xext/xselinux.c new file mode 100644 index 000000000..d3fe86b3a --- /dev/null +++ b/Xext/xselinux.c @@ -0,0 +1,1654 @@ +/************************************************************ + +Author: Eamon Walsh <ewalsh@epoch.ncsc.mil> + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +this permission notice appear in supporting documentation. This permission +notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR 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. + +********************************************************/ + +/* + * Portions of this code copyright (c) 2005 by Trusted Computer Solutions, Inc. + * All rights reserved. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <sys/socket.h> +#include <stdio.h> +#include <stdarg.h> + +#include <selinux/selinux.h> +#include <selinux/label.h> +#include <selinux/avc.h> + +#include <libaudit.h> + +#include <X11/Xatom.h> +#include "resource.h" +#include "privates.h" +#include "registry.h" +#include "dixstruct.h" +#include "inputstr.h" +#include "windowstr.h" +#include "propertyst.h" +#include "extnsionst.h" +#include "scrnintstr.h" +#include "selection.h" +#include "xacestr.h" +#include "xselinux.h" +#define XSERV_t +#define TRANS_SERVER +#include <X11/Xtrans/Xtrans.h> +#include "../os/osdep.h" +#include "modinit.h" + + +/* + * Globals + */ + +/* private state record */ +static DevPrivateKey subjectKey = &subjectKey; +static DevPrivateKey objectKey = &objectKey; + +/* This is what we store for security state */ +typedef struct { + security_id_t sid; + struct avc_entry_ref aeref; + char *command; + int privileged; +} SELinuxSubjectRec; + +typedef struct { + security_id_t sid; + int poly; +} SELinuxObjectRec; + +/* selection manager */ +typedef struct { + Atom selection; + security_id_t sid; +} SELinuxSelectionRec; + +static ClientPtr securityManager; +static Window securityWindow; + +/* audit file descriptor */ +static int audit_fd; + +/* structure passed to auditing callback */ +typedef struct { + ClientPtr client; /* client */ + DeviceIntPtr dev; /* device */ + char *command; /* client's executable path */ + unsigned id; /* resource id, if any */ + int restype; /* resource type, if any */ + int event; /* event type, if any */ + Atom property; /* property name, if any */ + Atom selection; /* selection name, if any */ + char *extension; /* extension name, if any */ +} SELinuxAuditRec; + +/* labeling handle */ +static struct selabel_handle *label_hnd; + +/* whether AVC is active */ +static int avc_active; + +/* atoms for window label properties */ +static Atom atom_ctx; +static Atom atom_client_ctx; + +/* The unlabeled SID */ +static security_id_t unlabeled_sid; + +/* Array of object classes indexed by resource type */ +static security_class_t *knownTypes; +static unsigned numKnownTypes; + +/* Array of event SIDs indexed by event type */ +static security_id_t *knownEvents; +static unsigned numKnownEvents; + +/* Array of selection SID structures */ +static SELinuxSelectionRec *knownSelections; +static unsigned numKnownSelections; + +/* dynamically allocated security classes and permissions */ +static struct security_class_mapping map[] = { + { "x_drawable", { "read", "write", "destroy", "create", "getattr", "setattr", "list_property", "get_property", "set_property", "", "", "list_child", "add_child", "remove_child", "hide", "show", "blend", "override", "", "", "", "", "send", "receive", "", "manage", NULL }}, + { "x_screen", { "", "", "", "", "getattr", "setattr", "saver_getattr", "saver_setattr", "", "", "", "", "", "", "hide_cursor", "show_cursor", "saver_hide", "saver_show", NULL }}, + { "x_gc", { "", "", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, + { "x_font", { "", "", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_glyph", "remove_glyph", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, + { "x_colormap", { "read", "write", "destroy", "create", "getattr", "", "", "", "", "", "", "", "add_color", "remove_color", "", "", "", "", "", "", "install", "uninstall", "", "", "use", NULL }}, + { "x_property", { "read", "write", "destroy", "create", "getattr", "setattr", NULL }}, + { "x_selection", { "read", "", "", "", "getattr", "setattr", NULL }}, + { "x_cursor", { "read", "write", "destroy", "create", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, + { "x_client", { "", "", "destroy", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "manage", NULL }}, + { "x_device", { "read", "write", "", "", "getattr", "setattr", "", "", "", "getfocus", "setfocus", "", "", "", "", "", "", "grab", "freeze", "force_cursor", "", "", "", "", "use", "manage", "", "bell", NULL }}, + { "x_server", { "record", "", "", "", "getattr", "setattr", "", "", "", "", "", "", "", "", "", "", "", "grab", "", "", "", "", "", "", "", "manage", "debug", NULL }}, + { "x_extension", { "", "", "", "", "query", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "use", NULL }}, + { "x_event", { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "send", "receive", NULL }}, + { "x_synthetic_event", { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "send", "receive", NULL }}, + { "x_resource", { "read", "write", "write", "write", "read", "write", "read", "read", "write", "read", "write", "read", "write", "write", "write", "read", "read", "write", "write", "write", "write", "write", "write", "read", "read", "write", "read", "write", NULL }}, + { NULL } +}; + +/* forward declarations */ +static void SELinuxScreen(CallbackListPtr *, pointer, pointer); + +/* "true" pointer value for use as callback data */ +static pointer truep = (pointer)1; + + +/* + * Support Routines + */ + +/* + * Looks up the SID corresponding to the given selection atom + */ +static int +SELinuxSelectionToSID(Atom selection, SELinuxObjectRec *sid_return) +{ + const char *name; + unsigned i, size; + + for (i = 0; i < numKnownSelections; i++) + if (knownSelections[i].selection == selection) { + sid_return->sid = knownSelections[i].sid; + return Success; + } + + /* Need to increase size of array */ + i = numKnownSelections; + size = (i + 1) * sizeof(SELinuxSelectionRec); + knownSelections = xrealloc(knownSelections, size); + if (!knownSelections) + return BadAlloc; + knownSelections[i].selection = selection; + + /* Look in the mappings of selection names to contexts */ + name = NameForAtom(selection); + if (name) { + security_context_t con; + security_id_t sid; + + if (selabel_lookup(label_hnd, &con, name, SELABEL_X_SELN) < 0) { + ErrorF("SELinux: a selection label lookup failed!\n"); + return BadValue; + } + /* Get a SID for context */ + if (avc_context_to_sid(con, &sid) < 0) { + ErrorF("SELinux: a context_to_SID call failed!\n"); + return BadAlloc; + } + freecon(con); + knownSelections[i].sid = sid_return->sid = sid; + } else + knownSelections[i].sid = sid_return->sid = unlabeled_sid; + + return Success; +} + +/* + * Looks up the SID corresponding to the given event type + */ +static int +SELinuxEventToSID(unsigned type, security_id_t sid_of_window, + SELinuxObjectRec *sid_return) +{ + const char *name = LookupEventName(type); + security_context_t con; + type &= 127; + + if (type >= numKnownEvents) { + /* Need to increase size of classes array */ + unsigned size = sizeof(security_id_t); + knownEvents = xrealloc(knownEvents, (type + 1) * size); + if (!knownEvents) + return BadAlloc; + memset(knownEvents + numKnownEvents, 0, + (type - numKnownEvents + 1) * size); + numKnownEvents = type + 1; + } + + if (!knownEvents[type]) { + /* Look in the mappings of event names to contexts */ + if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EVENT) < 0) { + ErrorF("SELinux: an event label lookup failed!\n"); + return BadValue; + } + /* Get a SID for context */ + if (avc_context_to_sid(con, knownEvents + type) < 0) { + ErrorF("SELinux: a context_to_SID call failed!\n"); + return BadAlloc; + } + freecon(con); + } + + /* Perform a transition to obtain the final SID */ + if (avc_compute_create(sid_of_window, knownEvents[type], SECCLASS_X_EVENT, + &sid_return->sid) < 0) { + ErrorF("SELinux: a compute_create call failed!\n"); + return BadValue; + } + + return Success; +} + +/* + * Returns the object class corresponding to the given resource type. + */ +static security_class_t +SELinuxTypeToClass(RESTYPE type) +{ + RESTYPE fulltype = type; + type &= TypeMask; + + if (type >= numKnownTypes) { + /* Need to increase size of classes array */ + unsigned size = sizeof(security_class_t); + knownTypes = xrealloc(knownTypes, (type + 1) * size); + if (!knownTypes) + return 0; + memset(knownTypes + numKnownTypes, 0, + (type - numKnownTypes + 1) * size); + numKnownTypes = type + 1; + } + + if (!knownTypes[type]) { + const char *str; + knownTypes[type] = SECCLASS_X_RESOURCE; + + if (fulltype & RC_DRAWABLE) + knownTypes[type] = SECCLASS_X_DRAWABLE; + if (fulltype == RT_GC) + knownTypes[type] = SECCLASS_X_GC; + if (fulltype == RT_FONT) + knownTypes[type] = SECCLASS_X_FONT; + if (fulltype == RT_CURSOR) + knownTypes[type] = SECCLASS_X_CURSOR; + if (fulltype == RT_COLORMAP) + knownTypes[type] = SECCLASS_X_COLORMAP; + + /* Need to do a string lookup */ + str = LookupResourceName(fulltype); + if (!strcmp(str, "PICTURE")) + knownTypes[type] = SECCLASS_X_DRAWABLE; + if (!strcmp(str, "GLYPHSET")) + knownTypes[type] = SECCLASS_X_FONT; + } + + return knownTypes[type]; +} + +/* + * Performs an SELinux permission check. + */ +static int +SELinuxDoCheck(SELinuxSubjectRec *subj, SELinuxObjectRec *obj, + security_class_t class, Mask mode, SELinuxAuditRec *auditdata) +{ + /* serverClient requests OK */ + if (subj->privileged) + return Success; + + auditdata->command = subj->command; + errno = 0; + + if (avc_has_perm(subj->sid, obj->sid, class, mode, &subj->aeref, + auditdata) < 0) { + if (errno == EACCES) + return BadAccess; + ErrorF("ServerPerm: unexpected error %d\n", errno); + return BadValue; + } + + return Success; +} + +/* + * Labels a newly connected client. + */ +static void +SELinuxLabelClient(ClientPtr client) +{ + XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + security_context_t ctx; + + subj = dixLookupPrivate(&client->devPrivates, subjectKey); + sidput(subj->sid); + obj = dixLookupPrivate(&client->devPrivates, objectKey); + sidput(obj->sid); + + if (_XSERVTransIsLocal(ci)) { + int fd = _XSERVTransGetConnectionNumber(ci); + struct ucred creds; + socklen_t len = sizeof(creds); + char path[PATH_MAX + 1]; + size_t bytes; + + /* For local clients, can get context from the socket */ + if (getpeercon(fd, &ctx) < 0) + FatalError("Client %d: couldn't get context from socket\n", + client->index); + + /* Try and determine the client's executable name */ + memset(&creds, 0, sizeof(creds)); + if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &creds, &len) < 0) + goto finish; + + snprintf(path, PATH_MAX + 1, "/proc/%d/cmdline", creds.pid); + fd = open(path, O_RDONLY); + if (fd < 0) + goto finish; + + bytes = read(fd, path, PATH_MAX + 1); + close(fd); + if (bytes <= 0) + goto finish; + + subj->command = xalloc(bytes); + if (!subj->command) + goto finish; + + memcpy(subj->command, path, bytes); + subj->command[bytes - 1] = 0; + } else + /* For remote clients, need to use a default context */ + if (selabel_lookup(label_hnd, &ctx, NULL, SELABEL_X_CLIENT) < 0) + FatalError("Client %d: couldn't get default remote context\n", + client->index); + +finish: + /* Get a SID from the context */ + if (avc_context_to_sid(ctx, &subj->sid) < 0) + FatalError("Client %d: context_to_sid(%s) failed\n", + client->index, ctx); + + sidget(subj->sid); + obj->sid = subj->sid; + freecon(ctx); +} + +/* + * Labels initial server objects. + */ +static void +SELinuxLabelInitial(void) +{ + int i; + XaceScreenAccessRec srec; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + security_context_t ctx; + pointer unused; + + /* Do the serverClient */ + subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey); + obj = dixLookupPrivate(&serverClient->devPrivates, objectKey); + subj->privileged = 1; + sidput(subj->sid); + + /* Use the context of the X server process for the serverClient */ + if (getcon(&ctx) < 0) + FatalError("Couldn't get context of X server process\n"); + + /* Get a SID from the context */ + if (avc_context_to_sid(ctx, &subj->sid) < 0) + FatalError("serverClient: context_to_sid(%s) failed\n", ctx); + + sidget(subj->sid); + obj->sid = subj->sid; + freecon(ctx); + + srec.client = serverClient; + srec.access_mode = DixCreateAccess; + srec.status = Success; + + for (i = 0; i < screenInfo.numScreens; i++) { + /* Do the screen object */ + srec.screen = screenInfo.screens[i]; + SELinuxScreen(NULL, NULL, &srec); + + /* Do the default colormap */ + dixLookupResource(&unused, screenInfo.screens[i]->defColormap, + RT_COLORMAP, serverClient, DixCreateAccess); + } +} + + +/* + * Libselinux Callbacks + */ + +static int +SELinuxAudit(void *auditdata, + security_class_t class, + char *msgbuf, + size_t msgbufsize) +{ + SELinuxAuditRec *audit = auditdata; + ClientPtr client = audit->client; + char idNum[16], *propertyName, *selectionName; + int major = -1, minor = -1; + + if (client) { + REQUEST(xReq); + if (stuff) { + major = stuff->reqType; + minor = MinorOpcodeOfRequest(client); + } + } + if (audit->id) + snprintf(idNum, 16, "%x", audit->id); + + propertyName = audit->property ? NameForAtom(audit->property) : NULL; + selectionName = audit->selection ? NameForAtom(audit->selection) : NULL; + + return snprintf(msgbuf, msgbufsize, + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + (major >= 0) ? "request=" : "", + (major >= 0) ? LookupRequestName(major, minor) : "", + audit->command ? " comm=" : "", + audit->command ? audit->command : "", + audit->dev ? " xdevice=\"" : "", + audit->dev ? audit->dev->name : "", + audit->dev ? "\"" : "", + audit->id ? " resid=" : "", + audit->id ? idNum : "", + audit->restype ? " restype=" : "", + audit->restype ? LookupResourceName(audit->restype) : "", + audit->event ? " event=" : "", + audit->event ? LookupEventName(audit->event & 127) : "", + audit->property ? " property=" : "", + audit->property ? propertyName : "", + audit->selection ? " selection=" : "", + audit->selection ? selectionName : "", + audit->extension ? " extension=" : "", + audit->extension ? audit->extension : ""); +} + +static int +SELinuxLog(int type, const char *fmt, ...) +{ + va_list ap; + char buf[MAX_AUDIT_MESSAGE_LENGTH]; + int rc, aut = AUDIT_USER_AVC; + + va_start(ap, fmt); + vsnprintf(buf, MAX_AUDIT_MESSAGE_LENGTH, fmt, ap); + rc = audit_log_user_avc_message(audit_fd, aut, buf, NULL, NULL, NULL, 0); + va_end(ap); + return 0; +} + +/* + * XACE Callbacks + */ + +static void +SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceDeviceAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + SELinuxAuditRec auditdata = { .client = rec->client, .dev = rec->dev }; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&rec->dev->devPrivates, objectKey); + + /* If this is a new object that needs labeling, do it now */ + if (rec->access_mode & DixCreateAccess) { + SELinuxSubjectRec *dsubj; + dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey); + + sidput(dsubj->sid); + sidput(obj->sid); + + /* Label the device directly with the process SID */ + sidget(subj->sid); + obj->sid = subj->sid; + sidget(subj->sid); + dsubj->sid = subj->sid; + } + + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DEVICE, rec->access_mode, + &auditdata); + if (rc != Success) + rec->status = rc; +} + +static void +SELinuxSend(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceSendAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj, ev_sid; + SELinuxAuditRec auditdata = { .client = rec->client, .dev = rec->dev }; + security_class_t class; + int rc, i, type; + + if (rec->dev) + subj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey); + else + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + + obj = dixLookupPrivate(&rec->pWin->devPrivates, objectKey); + + /* Check send permission on window */ + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixSendAccess, + &auditdata); + if (rc != Success) + goto err; + + /* Check send permission on specific event types */ + for (i = 0; i < rec->count; i++) { + type = rec->events[i].u.u.type; + class = (type & 128) ? SECCLASS_X_FAKEEVENT : SECCLASS_X_EVENT; + + rc = SELinuxEventToSID(type, obj->sid, &ev_sid); + if (rc != Success) + goto err; + + auditdata.event = type; + rc = SELinuxDoCheck(subj, &ev_sid, class, DixSendAccess, &auditdata); + if (rc != Success) + goto err; + } + return; +err: + rec->status = rc; +} + +static void +SELinuxReceive(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceReceiveAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj, ev_sid; + SELinuxAuditRec auditdata = { .client = NULL }; + security_class_t class; + int rc, i, type; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&rec->pWin->devPrivates, objectKey); + + /* Check receive permission on window */ + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_DRAWABLE, DixReceiveAccess, + &auditdata); + if (rc != Success) + goto err; + + /* Check receive permission on specific event types */ + for (i = 0; i < rec->count; i++) { + type = rec->events[i].u.u.type; + class = (type & 128) ? SECCLASS_X_FAKEEVENT : SECCLASS_X_EVENT; + + rc = SELinuxEventToSID(type, obj->sid, &ev_sid); + if (rc != Success) + goto err; + + auditdata.event = type; + rc = SELinuxDoCheck(subj, &ev_sid, class, DixReceiveAccess, &auditdata); + if (rc != Success) + goto err; + } + return; +err: + rec->status = rc; +} + +static void +SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceExtAccessRec *rec = calldata; + SELinuxSubjectRec *subj, *serv; + SELinuxObjectRec *obj; + SELinuxAuditRec auditdata = { .client = rec->client }; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&rec->ext->devPrivates, objectKey); + + /* If this is a new object that needs labeling, do it now */ + /* XXX there should be a separate callback for this */ + if (obj->sid == unlabeled_sid) { + const char *name = rec->ext->name; + security_context_t con; + security_id_t sid; + + serv = dixLookupPrivate(&serverClient->devPrivates, subjectKey); + + /* Look in the mappings of extension names to contexts */ + if (selabel_lookup(label_hnd, &con, name, SELABEL_X_EXT) < 0) { + ErrorF("SELinux: a property label lookup failed!\n"); + rec->status = BadValue; + return; + } + /* Get a SID for context */ + if (avc_context_to_sid(con, &sid) < 0) { + ErrorF("SELinux: a context_to_SID call failed!\n"); + rec->status = BadAlloc; + return; + } + + sidput(obj->sid); + + /* Perform a transition to obtain the final SID */ + if (avc_compute_create(serv->sid, sid, SECCLASS_X_EXTENSION, + &obj->sid) < 0) { + ErrorF("SELinux: a SID transition call failed!\n"); + freecon(con); + rec->status = BadValue; + return; + } + freecon(con); + } + + /* Perform the security check */ + auditdata.extension = rec->ext->name; + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode, + &auditdata); + if (rc != Success) + rec->status = rc; +} + +static void +SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XacePropertyAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + SELinuxAuditRec auditdata = { .client = rec->client }; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&rec->pProp->devPrivates, objectKey); + + /* If this is a new object that needs labeling, do it now */ + if (rec->access_mode & DixCreateAccess) { + const char *name = NameForAtom(rec->pProp->propertyName); + security_context_t con; + security_id_t sid; + + /* Look in the mappings of property names to contexts */ + if (selabel_lookup(label_hnd, &con, name, SELABEL_X_PROP) < 0) { + ErrorF("SELinux: a property label lookup failed!\n"); + rec->status = BadValue; + return; + } + /* Get a SID for context */ + if (avc_context_to_sid(con, &sid) < 0) { + ErrorF("SELinux: a context_to_SID call failed!\n"); + rec->status = BadAlloc; + return; + } + + sidput(obj->sid); + + /* Perform a transition to obtain the final SID */ + if (avc_compute_create(subj->sid, sid, SECCLASS_X_PROPERTY, + &obj->sid) < 0) { + ErrorF("SELinux: a SID transition call failed!\n"); + freecon(con); + rec->status = BadValue; + return; + } + freecon(con); + } + + /* Perform the security check */ + auditdata.property = rec->pProp->propertyName; + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_PROPERTY, rec->access_mode, + &auditdata); + if (rc != Success) + rec->status = rc; +} + +static void +SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceResourceAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj, *sobj, *pobj; + SELinuxAuditRec auditdata = { .client = rec->client }; + PrivateRec **privatePtr; + security_class_t class; + int rc, offset; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + sobj = dixLookupPrivate(&rec->client->devPrivates, objectKey); + + /* Determine if the resource object has a devPrivates field */ + offset = dixLookupPrivateOffset(rec->rtype); + if (offset < 0) { + /* No: use the SID of the owning client */ + class = SECCLASS_X_RESOURCE; + privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates; + obj = dixLookupPrivate(privatePtr, objectKey); + } else { + /* Yes: use the SID from the resource object itself */ + class = SELinuxTypeToClass(rec->rtype); + privatePtr = DEVPRIV_AT(rec->res, offset); + obj = dixLookupPrivate(privatePtr, objectKey); + } + + /* If this is a new object that needs labeling, do it now */ + if (rec->access_mode & DixCreateAccess && offset >= 0) { + if (rec->parent) + offset = dixLookupPrivateOffset(rec->ptype); + if (rec->parent && offset >= 0) + /* Use the SID of the parent object in the labeling operation */ + pobj = dixLookupPrivate(DEVPRIV_AT(rec->parent, offset), objectKey); + else + /* Use the SID of the subject */ + pobj = sobj; + + sidput(obj->sid); + + /* Perform a transition to obtain the final SID */ + if (avc_compute_create(subj->sid, pobj->sid, class, &obj->sid) < 0) { + ErrorF("SELinux: a compute_create call failed!\n"); + rec->status = BadValue; + return; + } + } + + /* Perform the security check */ + auditdata.restype = rec->rtype; + auditdata.id = rec->id; + rc = SELinuxDoCheck(subj, obj, class, rec->access_mode, &auditdata); + if (rc != Success) + rec->status = rc; +} + +static void +SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata) +{ + XaceScreenAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + SELinuxAuditRec auditdata = { .client = rec->client }; + Mask access_mode = rec->access_mode; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&rec->screen->devPrivates, objectKey); + + /* If this is a new object that needs labeling, do it now */ + if (access_mode & DixCreateAccess) { + sidput(obj->sid); + + /* Perform a transition to obtain the final SID */ + if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SCREEN, + &obj->sid) < 0) { + ErrorF("SELinux: a compute_create call failed!\n"); + rec->status = BadValue; + return; + } + } + + if (is_saver) + access_mode <<= 2; + + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SCREEN, access_mode, &auditdata); + if (rc != Success) + rec->status = rc; +} + +static void +SELinuxClient(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceClientAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + SELinuxAuditRec auditdata = { .client = rec->client }; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&rec->target->devPrivates, objectKey); + + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_CLIENT, rec->access_mode, + &auditdata); + if (rc != Success) + rec->status = rc; +} + +static void +SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceServerAccessRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + SELinuxAuditRec auditdata = { .client = rec->client }; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + obj = dixLookupPrivate(&serverClient->devPrivates, objectKey); + + rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SERVER, rec->access_mode, + &auditdata); + if (rc != Success) + rec->status = rc; +} + +static void +SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + XaceSelectionAccessRec *rec = (XaceSelectionAccessRec *)calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec sel_sid; + SELinuxAuditRec auditdata = { .client = rec->client }; + int rc; + + subj = dixLookupPrivate(&rec->client->devPrivates, subjectKey); + + rc = SELinuxSelectionToSID(rec->name, &sel_sid); + if (rc != Success) { + rec->status = rc; + return; + } + + auditdata.selection = rec->name; + rc = SELinuxDoCheck(subj, &sel_sid, SECCLASS_X_SELECTION, rec->access_mode, + &auditdata); + if (rc != Success) + rec->status = rc; +} + + +/* + * DIX Callbacks + */ + +static void +SELinuxClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + NewClientInfoRec *pci = calldata; + + switch (pci->client->clientState) { + case ClientStateInitial: + SELinuxLabelClient(pci->client); + break; + + case ClientStateRetained: + case ClientStateGone: + if (pci->client == securityManager) { + securityManager = NULL; + securityWindow = 0; + } + break; + + default: + break; + } +} + +static void +SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + ResourceStateInfoRec *rec = calldata; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + WindowPtr pWin; + + if (rec->type != RT_WINDOW) + return; + + pWin = (WindowPtr)rec->value; + subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey); + + if (subj->sid) { + security_context_t ctx; + int rc = avc_sid_to_context(subj->sid, &ctx); + if (rc < 0) + FatalError("SELinux: Failed to get security context!\n"); + rc = dixChangeWindowProperty(serverClient, + pWin, atom_client_ctx, XA_STRING, 8, + PropModeReplace, strlen(ctx), ctx, FALSE); + if (rc != Success) + FatalError("SELinux: Failed to set label property on window!\n"); + freecon(ctx); + } else + FatalError("SELinux: Unexpected unlabeled client found\n"); + + obj = dixLookupPrivate(&pWin->devPrivates, objectKey); + + if (obj->sid) { + security_context_t ctx; + int rc = avc_sid_to_context(obj->sid, &ctx); + if (rc < 0) + FatalError("SELinux: Failed to get security context!\n"); + rc = dixChangeWindowProperty(serverClient, + pWin, atom_ctx, XA_STRING, 8, + PropModeReplace, strlen(ctx), ctx, FALSE); + if (rc != Success) + FatalError("SELinux: Failed to set label property on window!\n"); + freecon(ctx); + } else + FatalError("SELinux: Unexpected unlabeled window found\n"); +} + +static void +SELinuxSelectionState(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + SelectionInfoRec *rec = calldata; + + switch (rec->kind) { + case SelectionSetOwner: + case SelectionGetOwner: + case SelectionConvertSelection: + default: + break; + } +} + + +/* + * DevPrivates Callbacks + */ + +static void +SELinuxSubjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + PrivateCallbackRec *rec = calldata; + SELinuxSubjectRec *subj = *rec->value; + + sidget(unlabeled_sid); + subj->sid = unlabeled_sid; + + avc_entry_ref_init(&subj->aeref); +} + +static void +SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + PrivateCallbackRec *rec = calldata; + SELinuxSubjectRec *subj = *rec->value; + + xfree(subj->command); + + if (avc_active) + sidput(subj->sid); +} + +static void +SELinuxObjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + PrivateCallbackRec *rec = calldata; + SELinuxObjectRec *obj = *rec->value; + + sidget(unlabeled_sid); + obj->sid = unlabeled_sid; +} + +static void +SELinuxObjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata) +{ + PrivateCallbackRec *rec = calldata; + SELinuxObjectRec *obj = *rec->value; + + if (avc_active) + sidput(obj->sid); +} + + +/* + * Extension Dispatch + */ + +static int +ProcSELinuxQueryVersion(ClientPtr client) +{ + SELinuxQueryVersionReply rep; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.server_major = SELINUX_MAJOR_VERSION; + rep.server_minor = SELINUX_MINOR_VERSION; + if (client->swapped) { + int n; + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swaps(&rep.server_major, n); + swaps(&rep.server_minor, n); + } + WriteToClient(client, sizeof(rep), (char *)&rep); + return (client->noClientException); +} + +static int +ProcSELinuxSetSecurityManager(ClientPtr client) +{ + WindowPtr pWin; + int rc; + + REQUEST(SELinuxSetSecurityManagerReq); + REQUEST_SIZE_MATCH(SELinuxSetSecurityManagerReq); + + if (stuff->window == None) { + securityManager = NULL; + securityWindow = None; + } else { + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (rc != Success) + return rc; + + securityManager = client; + securityWindow = stuff->window; + } + + return Success; +} + +static int +ProcSELinuxGetSecurityManager(ClientPtr client) +{ + SELinuxGetSecurityManagerReply rep; + + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.window = securityWindow; + if (client->swapped) { + int n; + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.window, n); + } + WriteToClient(client, sizeof(rep), (char *)&rep); + return (client->noClientException); +} + +static int +ProcSELinuxSetDeviceCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxGetDeviceCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxSetDeviceContext(ClientPtr client) +{ + char *ctx; + security_id_t sid; + DeviceIntPtr dev; + SELinuxSubjectRec *subj; + SELinuxObjectRec *obj; + int rc; + + REQUEST(SELinuxSetContextReq); + REQUEST_FIXED_SIZE(SELinuxSetContextReq, stuff->context_len); + + ctx = (char *)(stuff + 1); + if (ctx[stuff->context_len - 1]) + return BadLength; + + rc = dixLookupDevice(&dev, stuff->id, client, DixManageAccess); + if (rc != Success) + return rc; + + rc = avc_context_to_sid(ctx, &sid); + if (rc != Success) + return BadValue; + + subj = dixLookupPrivate(&dev->devPrivates, subjectKey); + sidput(subj->sid); + subj->sid = sid; + obj = dixLookupPrivate(&dev->devPrivates, objectKey); + sidput(obj->sid); + obj->sid = sid; + + return Success; +} + +static int +ProcSELinuxGetDeviceContext(ClientPtr client) +{ + char *ctx; + DeviceIntPtr dev; + SELinuxSubjectRec *subj; + SELinuxGetContextReply rep; + int rc; + + REQUEST(SELinuxGetContextReq); + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + + rc = dixLookupDevice(&dev, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; + + subj = dixLookupPrivate(&dev->devPrivates, subjectKey); + rc = avc_sid_to_context(subj->sid, &ctx); + if (rc != Success) + return BadValue; + + rep.type = X_Reply; + rep.length = (strlen(ctx) + 4) >> 2; + rep.sequenceNumber = client->sequence; + rep.context_len = strlen(ctx) + 1; + + if (client->swapped) { + int n; + swapl(&rep.length, n); + swaps(&rep.sequenceNumber, n); + swaps(&rep.context_len, n); + } + + WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); + WriteToClient(client, rep.context_len, ctx); + free(ctx); + return client->noClientException; +} + +static int +ProcSELinuxSetPropertyCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxGetPropertyCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxGetPropertyContext(ClientPtr client) +{ + char *ctx; + WindowPtr pWin; + PropertyPtr pProp; + SELinuxObjectRec *obj; + SELinuxGetContextReply rep; + int rc; + + REQUEST(SELinuxGetPropertyContextReq); + REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq); + + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetPropAccess); + if (rc != Success) + return rc; + + pProp = wUserProps(pWin); + while (pProp) { + if (pProp->propertyName == stuff->property) + break; + pProp = pProp->next; + } + if (!pProp) + return BadValue; + + rc = XaceHookPropertyAccess(client, pWin, pProp, DixGetAttrAccess); + if (rc != Success) + return rc; + + obj = dixLookupPrivate(&pProp->devPrivates, objectKey); + rc = avc_sid_to_context(obj->sid, &ctx); + if (rc != Success) + return BadValue; + + rep.type = X_Reply; + rep.length = (strlen(ctx) + 4) >> 2; + rep.sequenceNumber = client->sequence; + rep.context_len = strlen(ctx) + 1; + + if (client->swapped) { + int n; + swapl(&rep.length, n); + swaps(&rep.sequenceNumber, n); + swaps(&rep.context_len, n); + } + + WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); + WriteToClient(client, rep.context_len, ctx); + free(ctx); + return client->noClientException; +} + +static int +ProcSELinuxSetWindowCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxGetWindowCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxGetWindowContext(ClientPtr client) +{ + char *ctx; + WindowPtr pWin; + SELinuxObjectRec *obj; + SELinuxGetContextReply rep; + int rc; + + REQUEST(SELinuxGetContextReq); + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + if (rc != Success) + return rc; + + obj = dixLookupPrivate(&pWin->devPrivates, objectKey); + rc = avc_sid_to_context(obj->sid, &ctx); + if (rc != Success) + return BadValue; + + rep.type = X_Reply; + rep.length = (strlen(ctx) + 4) >> 2; + rep.sequenceNumber = client->sequence; + rep.context_len = strlen(ctx) + 1; + + if (client->swapped) { + int n; + swapl(&rep.length, n); + swaps(&rep.sequenceNumber, n); + swaps(&rep.context_len, n); + } + + WriteToClient(client, sizeof(SELinuxGetContextReply), (char *)&rep); + WriteToClient(client, rep.context_len, ctx); + free(ctx); + return client->noClientException; +} + +static int +ProcSELinuxSetSelectionCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxGetSelectionCreateContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxGetSelectionContext(ClientPtr client) +{ + return Success; +} + +static int +ProcSELinuxDispatch(ClientPtr client) +{ + REQUEST(xReq); + switch (stuff->data) { + case X_SELinuxQueryVersion: + return ProcSELinuxQueryVersion(client); + case X_SELinuxSetSecurityManager: + return ProcSELinuxSetSecurityManager(client); + case X_SELinuxGetSecurityManager: + return ProcSELinuxGetSecurityManager(client); + case X_SELinuxSetDeviceCreateContext: + return ProcSELinuxSetDeviceCreateContext(client); + case X_SELinuxGetDeviceCreateContext: + return ProcSELinuxGetDeviceCreateContext(client); + case X_SELinuxSetDeviceContext: + return ProcSELinuxSetDeviceContext(client); + case X_SELinuxGetDeviceContext: + return ProcSELinuxGetDeviceContext(client); + case X_SELinuxSetPropertyCreateContext: + return ProcSELinuxSetPropertyCreateContext(client); + case X_SELinuxGetPropertyCreateContext: + return ProcSELinuxGetPropertyCreateContext(client); + case X_SELinuxGetPropertyContext: + return ProcSELinuxGetPropertyContext(client); + case X_SELinuxSetWindowCreateContext: + return ProcSELinuxSetWindowCreateContext(client); + case X_SELinuxGetWindowCreateContext: + return ProcSELinuxGetWindowCreateContext(client); + case X_SELinuxGetWindowContext: + return ProcSELinuxGetWindowContext(client); + case X_SELinuxSetSelectionCreateContext: + return ProcSELinuxSetSelectionCreateContext(client); + case X_SELinuxGetSelectionCreateContext: + return ProcSELinuxGetSelectionCreateContext(client); + case X_SELinuxGetSelectionContext: + return ProcSELinuxGetSelectionContext(client); + default: + return BadRequest; + } +} + +static int +SProcSELinuxQueryVersion(ClientPtr client) +{ + REQUEST(SELinuxQueryVersionReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxQueryVersionReq); + swaps(&stuff->client_major, n); + swaps(&stuff->client_minor, n); + return ProcSELinuxQueryVersion(client); +} + +static int +SProcSELinuxSetSecurityManager(ClientPtr client) +{ + REQUEST(SELinuxSetSecurityManagerReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxSetSecurityManagerReq); + swapl(&stuff->window, n); + return ProcSELinuxSetSecurityManager(client); +} + +static int +SProcSELinuxSetDeviceCreateContext(ClientPtr client) +{ + REQUEST(SELinuxSetCreateContextReq); + int n; + + REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); + swaps(&stuff->context_len, n); + return ProcSELinuxSetDeviceCreateContext(client); +} + +static int +SProcSELinuxSetDeviceContext(ClientPtr client) +{ + REQUEST(SELinuxSetContextReq); + int n; + + REQUEST_AT_LEAST_SIZE(SELinuxSetContextReq); + swapl(&stuff->id, n); + swaps(&stuff->context_len, n); + return ProcSELinuxSetDeviceContext(client); +} + +static int +SProcSELinuxGetDeviceContext(ClientPtr client) +{ + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id, n); + return ProcSELinuxGetDeviceContext(client); +} + +static int +SProcSELinuxSetPropertyCreateContext(ClientPtr client) +{ + REQUEST(SELinuxSetCreateContextReq); + int n; + + REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); + swaps(&stuff->context_len, n); + return ProcSELinuxSetPropertyCreateContext(client); +} + +static int +SProcSELinuxGetPropertyContext(ClientPtr client) +{ + REQUEST(SELinuxGetPropertyContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq); + swapl(&stuff->window, n); + swapl(&stuff->property, n); + return ProcSELinuxGetPropertyContext(client); +} + +static int +SProcSELinuxSetWindowCreateContext(ClientPtr client) +{ + REQUEST(SELinuxSetCreateContextReq); + int n; + + REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); + swaps(&stuff->context_len, n); + return ProcSELinuxSetWindowCreateContext(client); +} + +static int +SProcSELinuxGetWindowContext(ClientPtr client) +{ + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id, n); + return ProcSELinuxGetWindowContext(client); +} + +static int +SProcSELinuxSetSelectionCreateContext(ClientPtr client) +{ + REQUEST(SELinuxSetCreateContextReq); + int n; + + REQUEST_AT_LEAST_SIZE(SELinuxSetCreateContextReq); + swaps(&stuff->context_len, n); + return ProcSELinuxSetSelectionCreateContext(client); +} + +static int +SProcSELinuxGetSelectionContext(ClientPtr client) +{ + REQUEST(SELinuxGetContextReq); + int n; + + REQUEST_SIZE_MATCH(SELinuxGetContextReq); + swapl(&stuff->id, n); + return ProcSELinuxGetSelectionContext(client); +} + +static int +SProcSELinuxDispatch(ClientPtr client) +{ + REQUEST(xReq); + int n; + + swaps(&stuff->length, n); + + switch (stuff->data) { + case X_SELinuxQueryVersion: + return SProcSELinuxQueryVersion(client); + case X_SELinuxSetSecurityManager: + return SProcSELinuxSetSecurityManager(client); + case X_SELinuxGetSecurityManager: + return ProcSELinuxGetSecurityManager(client); + case X_SELinuxSetDeviceCreateContext: + return SProcSELinuxSetDeviceCreateContext(client); + case X_SELinuxGetDeviceCreateContext: + return ProcSELinuxGetDeviceCreateContext(client); + case X_SELinuxSetDeviceContext: + return SProcSELinuxSetDeviceContext(client); + case X_SELinuxGetDeviceContext: + return SProcSELinuxGetDeviceContext(client); + case X_SELinuxSetPropertyCreateContext: + return SProcSELinuxSetPropertyCreateContext(client); + case X_SELinuxGetPropertyCreateContext: + return ProcSELinuxGetPropertyCreateContext(client); + case X_SELinuxGetPropertyContext: + return SProcSELinuxGetPropertyContext(client); + case X_SELinuxSetWindowCreateContext: + return SProcSELinuxSetWindowCreateContext(client); + case X_SELinuxGetWindowCreateContext: + return ProcSELinuxGetWindowCreateContext(client); + case X_SELinuxGetWindowContext: + return SProcSELinuxGetWindowContext(client); + case X_SELinuxSetSelectionCreateContext: + return SProcSELinuxSetSelectionCreateContext(client); + case X_SELinuxGetSelectionCreateContext: + return ProcSELinuxGetSelectionCreateContext(client); + case X_SELinuxGetSelectionContext: + return SProcSELinuxGetSelectionContext(client); + default: + return BadRequest; + } +} + + +/* + * Extension Setup / Teardown + */ + +static void +SELinuxResetProc(ExtensionEntry *extEntry) +{ + /* Unregister callbacks */ + DeleteCallback(&ClientStateCallback, SELinuxClientState, NULL); + DeleteCallback(&ResourceStateCallback, SELinuxResourceState, NULL); + DeleteCallback(&SelectionCallback, SELinuxSelectionState, NULL); + + XaceDeleteCallback(XACE_EXT_DISPATCH, SELinuxExtension, NULL); + XaceDeleteCallback(XACE_RESOURCE_ACCESS, SELinuxResource, NULL); + XaceDeleteCallback(XACE_DEVICE_ACCESS, SELinuxDevice, NULL); + XaceDeleteCallback(XACE_PROPERTY_ACCESS, SELinuxProperty, NULL); + XaceDeleteCallback(XACE_SEND_ACCESS, SELinuxSend, NULL); + XaceDeleteCallback(XACE_RECEIVE_ACCESS, SELinuxReceive, NULL); + XaceDeleteCallback(XACE_CLIENT_ACCESS, SELinuxClient, NULL); + XaceDeleteCallback(XACE_EXT_ACCESS, SELinuxExtension, NULL); + XaceDeleteCallback(XACE_SERVER_ACCESS, SELinuxServer, NULL); + XaceDeleteCallback(XACE_SELECTION_ACCESS, SELinuxSelection, NULL); + XaceDeleteCallback(XACE_SCREEN_ACCESS, SELinuxScreen, NULL); + XaceDeleteCallback(XACE_SCREENSAVER_ACCESS, SELinuxScreen, truep); + + /* Tear down SELinux stuff */ + selabel_close(label_hnd); + label_hnd = NULL; + + audit_close(audit_fd); + + avc_destroy(); + avc_active = 0; + + /* Free local state */ + xfree(knownSelections); + knownSelections = NULL; + numKnownSelections = 0; + + xfree(knownEvents); + knownEvents = NULL; + numKnownEvents = 0; + + xfree(knownTypes); + knownTypes = NULL; + numKnownTypes = 0; +} + +void +SELinuxExtensionInit(INITARGS) +{ + ExtensionEntry *extEntry; + struct selinux_opt options[] = { { SELABEL_OPT_VALIDATE, (char *)1 } }; + security_context_t con; + int ret = TRUE; + + /* Setup SELinux stuff */ + if (!is_selinux_enabled()) { + ErrorF("SELinux: SELinux not enabled, disabling SELinux support.\n"); + return; + } + + selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback)SELinuxLog); + selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback)SELinuxAudit); + + if (selinux_set_mapping(map) < 0) { + if (errno == EINVAL) { + ErrorF("SELinux: Invalid object class mapping, disabling SELinux support.\n"); + return; + } + FatalError("SELinux: Failed to set up security class mapping\n"); + } + + if (avc_open(NULL, 0) < 0) + FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n"); + avc_active = 1; + + label_hnd = selabel_open(SELABEL_CTX_X, options, 1); + if (!label_hnd) + FatalError("SELinux: Failed to open x_contexts mapping in policy\n"); + + if (security_get_initial_context("unlabeled", &con) < 0) + FatalError("SELinux: Failed to look up unlabeled context\n"); + if (avc_context_to_sid(con, &unlabeled_sid) < 0) + FatalError("SELinux: a context_to_SID call failed!\n"); + freecon(con); + + /* Prepare for auditing */ + audit_fd = audit_open(); + if (audit_fd < 0) + FatalError("SELinux: Failed to open the system audit log\n"); + + /* Allocate private storage */ + if (!dixRequestPrivate(subjectKey, sizeof(SELinuxSubjectRec)) || + !dixRequestPrivate(objectKey, sizeof(SELinuxObjectRec))) + FatalError("SELinux: Failed to allocate private storage.\n"); + + /* Create atoms for doing window labeling */ + atom_ctx = MakeAtom("_SELINUX_CONTEXT", 16, TRUE); + if (atom_ctx == BAD_RESOURCE) + FatalError("SELinux: Failed to create atom\n"); + atom_client_ctx = MakeAtom("_SELINUX_CLIENT_CONTEXT", 23, TRUE); + if (atom_client_ctx == BAD_RESOURCE) + FatalError("SELinux: Failed to create atom\n"); + + /* Register callbacks */ + ret &= dixRegisterPrivateInitFunc(subjectKey, SELinuxSubjectInit, NULL); + ret &= dixRegisterPrivateDeleteFunc(subjectKey, SELinuxSubjectFree, NULL); + ret &= dixRegisterPrivateInitFunc(objectKey, SELinuxObjectInit, NULL); + ret &= dixRegisterPrivateDeleteFunc(objectKey, SELinuxObjectFree, NULL); + + ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL); + ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL); + ret &= AddCallback(&SelectionCallback, SELinuxSelectionState, NULL); + + ret &= XaceRegisterCallback(XACE_EXT_DISPATCH, SELinuxExtension, NULL); + ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, SELinuxResource, NULL); + ret &= XaceRegisterCallback(XACE_DEVICE_ACCESS, SELinuxDevice, NULL); + ret &= XaceRegisterCallback(XACE_PROPERTY_ACCESS, SELinuxProperty, NULL); + ret &= XaceRegisterCallback(XACE_SEND_ACCESS, SELinuxSend, NULL); + ret &= XaceRegisterCallback(XACE_RECEIVE_ACCESS, SELinuxReceive, NULL); + ret &= XaceRegisterCallback(XACE_CLIENT_ACCESS, SELinuxClient, NULL); + ret &= XaceRegisterCallback(XACE_EXT_ACCESS, SELinuxExtension, NULL); + ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, SELinuxServer, NULL); + ret &= XaceRegisterCallback(XACE_SELECTION_ACCESS, SELinuxSelection, NULL); + ret &= XaceRegisterCallback(XACE_SCREEN_ACCESS, SELinuxScreen, NULL); + ret &= XaceRegisterCallback(XACE_SCREENSAVER_ACCESS, SELinuxScreen, truep); + if (!ret) + FatalError("SELinux: Failed to register one or more callbacks\n"); + + /* Add extension to server */ + extEntry = AddExtension(SELINUX_EXTENSION_NAME, + SELinuxNumberEvents, SELinuxNumberErrors, + ProcSELinuxDispatch, SProcSELinuxDispatch, + SELinuxResetProc, StandardMinorOpcode); + + /* Label objects that were created before we could register ourself */ + SELinuxLabelInitial(); +} diff --git a/Xext/xselinux.h b/Xext/xselinux.h new file mode 100644 index 000000000..480276154 --- /dev/null +++ b/Xext/xselinux.h @@ -0,0 +1,184 @@ +/************************************************************ + +Author: Eamon Walsh <ewalsh@epoch.ncsc.mil> + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +this permission notice appear in supporting documentation. This permission +notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR 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. + +********************************************************/ + +#ifndef _XSELINUX_H +#define _XSELINUX_H + +#include "dixaccess.h" + +/* Extension info */ +#define SELINUX_EXTENSION_NAME "SELinux" +#define SELINUX_MAJOR_VERSION 1 +#define SELINUX_MINOR_VERSION 0 +#define SELinuxNumberEvents 0 +#define SELinuxNumberErrors 0 + +/* Extension protocol */ +#define X_SELinuxQueryVersion 0 +#define X_SELinuxSetSecurityManager 1 +#define X_SELinuxGetSecurityManager 2 +#define X_SELinuxSetDeviceCreateContext 3 +#define X_SELinuxGetDeviceCreateContext 4 +#define X_SELinuxSetDeviceContext 5 +#define X_SELinuxGetDeviceContext 6 +#define X_SELinuxSetPropertyCreateContext 7 +#define X_SELinuxGetPropertyCreateContext 8 +#define X_SELinuxGetPropertyContext 9 +#define X_SELinuxSetWindowCreateContext 10 +#define X_SELinuxGetWindowCreateContext 11 +#define X_SELinuxGetWindowContext 12 +#define X_SELinuxSetSelectionCreateContext 13 +#define X_SELinuxGetSelectionCreateContext 14 +#define X_SELinuxGetSelectionContext 15 + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD8 client_major; + CARD8 client_minor; + CARD16 unused; +} SELinuxQueryVersionReq; + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 server_major; + CARD16 server_minor; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} SELinuxQueryVersionReply; + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 window; +} SELinuxSetSecurityManagerReq; + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; +} SELinuxGetSecurityManagerReq; + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD32 window; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} SELinuxGetSecurityManagerReply; + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD8 permanent; + CARD8 unused; + CARD16 context_len; +} SELinuxSetCreateContextReq; + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; +} SELinuxGetCreateContextReq; + +typedef struct { + CARD8 type; + CARD8 permanent; + CARD16 sequenceNumber; + CARD32 length; + CARD16 context_len; + CARD16 pad1; + CARD32 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; +} SELinuxGetCreateContextReply; + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 id; + CARD16 unused; + CARD16 context_len; +} SELinuxSetContextReq; + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 id; +} SELinuxGetContextReq; + +typedef struct { + CARD8 reqType; + CARD8 SELinuxReqType; + CARD16 length; + CARD32 window; + CARD32 property; +} SELinuxGetPropertyContextReq; + +typedef struct { + CARD8 type; + CARD8 pad1; + CARD16 sequenceNumber; + CARD32 length; + CARD16 context_len; + CARD16 pad2; + CARD32 pad3; + CARD32 pad4; + CARD32 pad5; + CARD32 pad6; + CARD32 pad7; +} SELinuxGetContextReply; + + +/* Private Flask definitions */ +#define SECCLASS_X_DRAWABLE 1 +#define SECCLASS_X_SCREEN 2 +#define SECCLASS_X_GC 3 +#define SECCLASS_X_FONT 4 +#define SECCLASS_X_COLORMAP 5 +#define SECCLASS_X_PROPERTY 6 +#define SECCLASS_X_SELECTION 7 +#define SECCLASS_X_CURSOR 8 +#define SECCLASS_X_CLIENT 9 +#define SECCLASS_X_DEVICE 10 +#define SECCLASS_X_SERVER 11 +#define SECCLASS_X_EXTENSION 12 +#define SECCLASS_X_EVENT 13 +#define SECCLASS_X_FAKEEVENT 14 +#define SECCLASS_X_RESOURCE 15 + +#endif /* _XSELINUX_H */ diff --git a/Xext/xtest.c b/Xext/xtest.c index 96ae18225..db6d54543 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -49,7 +49,6 @@ from The Open Group. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #define EXTENSION_EVENT_BASE 64 -#include "extinit.h" /* LookupDeviceIntRec */ #endif /* XINPUT */ #include "modinit.h" @@ -85,9 +84,9 @@ static DISPATCH_PROC(SProcXTestGrabControl); void XTestExtensionInit(INITARGS) { - (void) AddExtension(XTestExtensionName, 0, 0, - ProcXTestDispatch, SProcXTestDispatch, - XTestResetProc, StandardMinorOpcode); + AddExtension(XTestExtensionName, 0, 0, + ProcXTestDispatch, SProcXTestDispatch, + XTestResetProc, StandardMinorOpcode); } /*ARGSUSED*/ @@ -129,7 +128,7 @@ ProcXTestCompareCursor(client) register int n, rc; REQUEST_SIZE_MATCH(xXTestCompareCursorReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (stuff->cursor == None) @@ -137,11 +136,12 @@ ProcXTestCompareCursor(client) else if (stuff->cursor == XTestCurrentCursor) pCursor = GetSpriteCursor(); else { - pCursor = (CursorPtr)LookupIDByType(stuff->cursor, RT_CURSOR); - if (!pCursor) + rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR, + client, DixReadAccess); + if (rc != Success) { client->errorValue = stuff->cursor; - return (BadCursor); + return (rc == BadValue) ? BadCursor : rc; } } rep.type = X_Reply; @@ -273,11 +273,12 @@ ProcXTestFakeInput(client) #ifdef XINPUT if (extension) { - dev = LookupDeviceIntRec(stuff->deviceid & 0177); - if (!dev) + rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client, + DixWriteAccess); + if (rc != Success) { client->errorValue = stuff->deviceid & 0177; - return BadValue; + return rc; } if (nev > 1) { @@ -303,7 +304,7 @@ ProcXTestFakeInput(client) #ifdef XINPUT if (!extension) #endif /* XINPUT */ - dev = (DeviceIntPtr)LookupKeyboardDevice(); + dev = inputInfo.keyboard; if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode || ev->u.u.detail > dev->key->curKeySyms.maxKeyCode) { @@ -347,13 +348,13 @@ ProcXTestFakeInput(client) break; } #endif /* XINPUT */ - dev = (DeviceIntPtr)LookupPointerDevice(); + dev = inputInfo.pointer; if (ev->u.keyButtonPointer.root == None) root = GetCurrentRootWindow(); else { rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root, client, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; if (root->parent) @@ -436,7 +437,7 @@ ProcXTestFakeInput(client) #ifdef XINPUT if (!extension) #endif /* XINPUT */ - dev = (DeviceIntPtr)LookupPointerDevice(); + dev = inputInfo.pointer; if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) { client->errorValue = ev->u.u.detail; @@ -445,7 +446,7 @@ ProcXTestFakeInput(client) break; } if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); ev->u.keyButtonPointer.time = currentTime.milliseconds; (*dev->public.processInputProc)(ev, dev, nev); return client->noClientException; diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index ee2e051d4..de0128e14 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -67,7 +67,7 @@ SWriteQueryExtensionReply( swaps(&rep->version, n); swaps(&rep->revision, n); - (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryExtensionReply, (char *)rep); return Success; } @@ -83,7 +83,7 @@ SWriteQueryAdaptorsReply( swapl(&rep->length, n); swaps(&rep->num_adaptors, n); - (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryAdaptorsReply, (char *)rep); return Success; } @@ -99,7 +99,7 @@ SWriteQueryEncodingsReply( swapl(&rep->length, n); swaps(&rep->num_encodings, n); - (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryEncodingsReply, (char *)rep); return Success; } @@ -204,7 +204,7 @@ SWriteGrabPortReply( swaps(&rep->sequenceNumber, n); swapl(&rep->length, n); - (void)WriteToClient(client, sz_xvGrabPortReply, (char *)&rep); + (void)WriteToClient(client, sz_xvGrabPortReply, (char *)rep); return Success; } @@ -220,7 +220,7 @@ SWriteGetPortAttributeReply( swapl(&rep->length, n); swapl(&rep->value, n); - (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)&rep); + (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)rep); return Success; } @@ -237,7 +237,7 @@ SWriteQueryBestSizeReply( swaps(&rep->actual_width, n); swaps(&rep->actual_height, n); - (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryBestSizeReply, (char *)rep); return Success; } @@ -254,7 +254,7 @@ SWriteQueryPortAttributesReply( swapl(&rep->num_attributes, n); swapl(&rep->text_size, n); - (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)rep); return Success; } @@ -273,7 +273,7 @@ SWriteQueryImageAttributesReply( swaps(&rep->width, n); swaps(&rep->height, n); - (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)&rep); + (void)WriteToClient(client, sz_xvQueryImageAttributesReply, (char *)rep); return Success; } @@ -289,7 +289,7 @@ SWriteListImageFormatsReply( swapl(&rep->length, n); swapl(&rep->num_formats, n); - (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)&rep); + (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)rep); return Success; } @@ -378,6 +378,7 @@ ProcXvQueryAdaptors(ClientPtr client) xvAdaptorInfo ainfo; xvQueryAdaptorsReply rep; int totalSize, na, nf, rc; + int nameSize; XvAdaptorPtr pa; XvFormatPtr pf; WindowPtr pWin; @@ -387,13 +388,13 @@ ProcXvQueryAdaptors(ClientPtr client) REQUEST(xvQueryAdaptorsReq); REQUEST_SIZE_MATCH(xvQueryAdaptorsReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; - pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; - + pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + XvGetScreenKey()); if (!pxvs) { rep.type = X_Reply; @@ -439,12 +440,12 @@ ProcXvQueryAdaptors(ClientPtr client) ainfo.base_id = pa->base_id; ainfo.num_ports = pa->nPorts; ainfo.type = pa->type; - ainfo.name_size = strlen(pa->name); + ainfo.name_size = nameSize = strlen(pa->name); ainfo.num_formats = pa->nFormats; _WriteAdaptorInfo(client, &ainfo); - WriteToClient(client, ainfo.name_size, pa->name); + WriteToClient(client, nameSize, pa->name); nf = pa->nFormats; pf = pa->pFormats; @@ -469,6 +470,7 @@ ProcXvQueryEncodings(ClientPtr client) xvEncodingInfo einfo; xvQueryEncodingsReply rep; int totalSize; + int nameSize; XvPortPtr pPort; int ne; XvEncodingPtr pe; @@ -513,13 +515,13 @@ ProcXvQueryEncodings(ClientPtr client) while (ne--) { einfo.encoding = pe->id; - einfo.name_size = strlen(pe->name); + einfo.name_size = nameSize = strlen(pe->name); einfo.width = pe->width; einfo.height = pe->height; einfo.rate.numerator = pe->rate.numerator; einfo.rate.denominator = pe->rate.denominator; _WriteEncodingInfo(client, &einfo); - WriteToClient(client, einfo.name_size, pe->name); + WriteToClient(client, nameSize, pe->name); pe++; } @@ -537,7 +539,7 @@ ProcXvPutVideo(ClientPtr client) REQUEST(xvPutVideoReq); REQUEST_SIZE_MATCH(xvPutVideoReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { @@ -582,7 +584,7 @@ ProcXvPutStill(ClientPtr client) REQUEST(xvPutStillReq); REQUEST_SIZE_MATCH(xvPutStillReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { @@ -627,7 +629,7 @@ ProcXvGetVideo(ClientPtr client) REQUEST(xvGetVideoReq); REQUEST_SIZE_MATCH(xvGetVideoReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { @@ -672,7 +674,7 @@ ProcXvGetStill(ClientPtr client) REQUEST(xvGetStillReq); REQUEST_SIZE_MATCH(xvGetStillReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { @@ -714,7 +716,7 @@ ProcXvSelectVideoNotify(ClientPtr client) REQUEST(xvSelectVideoNotifyReq); REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq); - rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReceiveAccess); if (rc != Success) return rc; @@ -826,7 +828,7 @@ ProcXvStopVideo(ClientPtr client) return (status); } - rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess); if (rc != Success) return rc; @@ -984,18 +986,19 @@ ProcXvQueryPortAttributes(ClientPtr client) rep.text_size = 0; for(i = 0, pAtt = pPort->pAdaptor->pAttributes; - i < rep.num_attributes; i++, pAtt++) + i < pPort->pAdaptor->nAttributes; i++, pAtt++) { rep.text_size += (strlen(pAtt->name) + 1 + 3) & ~3L; } - rep.length = (rep.num_attributes * sz_xvAttributeInfo) + rep.text_size; + rep.length = (pPort->pAdaptor->nAttributes * sz_xvAttributeInfo) + + rep.text_size; rep.length >>= 2; _WriteQueryPortAttributesReply(client, &rep); for(i = 0, pAtt = pPort->pAdaptor->pAttributes; - i < rep.num_attributes; i++, pAtt++) + i < pPort->pAdaptor->nAttributes; i++, pAtt++) { size = strlen(pAtt->name) + 1; /* pass the NULL */ Info.flags = pAtt->flags; @@ -1024,7 +1027,7 @@ ProcXvPutImage(ClientPtr client) REQUEST(xvPutImageReq); REQUEST_AT_LEAST_SIZE(xvPutImageReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { @@ -1112,7 +1115,7 @@ ProcXvShmPutImage(ClientPtr client) REQUEST(xvShmPutImageReq); REQUEST_SIZE_MATCH(xvShmPutImageReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); if(!(pPort = LOOKUP_PORT(stuff->port, client) )) { @@ -1211,6 +1214,7 @@ ProcXvQueryImageAttributes(ClientPtr client) XvPortPtr pPort; int *offsets; int *pitches; + int planeLength; REQUEST(xvQueryImageAttributesReq); REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); @@ -1250,7 +1254,7 @@ ProcXvQueryImageAttributes(ClientPtr client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.length = num_planes << 1; + rep.length = planeLength = num_planes << 1; rep.num_planes = num_planes; rep.width = width; rep.height = height; @@ -1258,8 +1262,8 @@ ProcXvQueryImageAttributes(ClientPtr client) _WriteQueryImageAttributesReply(client, &rep); if(client->swapped) - SwapLongs((CARD32*)offsets, rep.length); - WriteToClient(client, rep.length << 2, (char*)offsets); + SwapLongs((CARD32*)offsets, planeLength); + WriteToClient(client, planeLength << 2, (char*)offsets); xfree(offsets); @@ -1287,13 +1291,13 @@ ProcXvListImageFormats(ClientPtr client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.num_formats = pPort->pAdaptor->nImages; - rep.length = rep.num_formats * sz_xvImageFormatInfo >> 2; + rep.length = pPort->pAdaptor->nImages * sz_xvImageFormatInfo >> 2; _WriteListImageFormatsReply(client, &rep); pImage = pPort->pAdaptor->pImages; - for(i = 0; i < rep.num_formats; i++, pImage++) { + for(i = 0; i < pPort->pAdaptor->nImages; i++, pImage++) { info.id = pImage->id; info.type = pImage->type; info.byte_order = pImage->byte_order; @@ -1528,6 +1532,7 @@ SProcXvShmPutImage(ClientPtr client) swapl(&stuff->gc, n); swapl(&stuff->shmseg, n); swapl(&stuff->id, n); + swapl(&stuff->offset, n); swaps(&stuff->src_x, n); swaps(&stuff->src_y, n); swaps(&stuff->src_w, n); @@ -1536,7 +1541,6 @@ SProcXvShmPutImage(ClientPtr client) swaps(&stuff->drw_y, n); swaps(&stuff->drw_w, n); swaps(&stuff->drw_h, n); - swaps(&stuff->offset, n); swaps(&stuff->width, n); swaps(&stuff->height, n); return XvProcVector[xv_ShmPutImage](client); @@ -1584,6 +1588,7 @@ SProcXvSetPortAttribute(ClientPtr client) swaps(&stuff->length, n); swapl(&stuff->port, n); swapl(&stuff->attribute, n); + swapl(&stuff->value, n); return XvProcVector[xv_SetPortAttribute](client); } @@ -1628,9 +1633,10 @@ SProcXvQueryImageAttributes(ClientPtr client) char n; REQUEST(xvQueryImageAttributesReq); swaps(&stuff->length, n); + swapl(&stuff->port, n); swapl(&stuff->id, n); swaps(&stuff->width, n); - swaps(&stuff->width, n); + swaps(&stuff->height, n); return XvProcVector[xv_QueryImageAttributes](client); } @@ -1921,7 +1927,8 @@ XineramaXvPutStill(ClientPtr client) void XineramifyXv(void) { ScreenPtr pScreen, screen0 = screenInfo.screens[0]; - XvScreenPtr xvsp0 = (XvScreenPtr)screen0->devPrivates[XvScreenIndex].ptr; + XvScreenPtr xvsp0 = (XvScreenPtr)dixLookupPrivate(&screen0->devPrivates, + XvGetScreenKey()); XvAdaptorPtr refAdapt, pAdapt; XvAttributePtr pAttr; XvScreenPtr xvsp; @@ -1954,8 +1961,8 @@ void XineramifyXv(void) for(j = 1; j < PanoramiXNumScreens; j++) { pScreen = screenInfo.screens[j]; - xvsp = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; - + xvsp = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + XvGetScreenKey()); /* Do not try to go on if xv is not supported on this screen */ if (xvsp==NULL) continue ; diff --git a/Xext/xvdix.h b/Xext/xvdix.h index 9e94e05d5..a516cf113 100644 --- a/Xext/xvdix.h +++ b/Xext/xvdix.h @@ -55,7 +55,6 @@ SOFTWARE. #include "scrnintstr.h" #include <X11/extensions/Xvproto.h> -extern int XvScreenIndex; extern unsigned long XvExtensionGeneration; extern unsigned long XvScreenGeneration; extern unsigned long XvResourceGeneration; @@ -224,10 +223,8 @@ typedef struct { DevUnion devPriv; } XvScreenRec, *XvScreenPtr; -#define SCREEN_PROLOGUE(pScreen, field)\ - ((pScreen)->field = \ - ((XvScreenPtr) \ - (pScreen)->devPrivates[XvScreenIndex].ptr)->field) +#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) @@ -242,7 +239,7 @@ extern int SProcXvDispatch(ClientPtr); extern void XvExtensionInit(void); extern int XvScreenInit(ScreenPtr); -extern int XvGetScreenIndex(void); +extern DevPrivateKey XvGetScreenKey(void); extern unsigned long XvGetRTPort(void); extern int XvdiSendPortNotify(XvPortPtr, Atom, INT32); extern int XvdiVideoStopped(XvPortPtr, int); diff --git a/Xext/xvmain.c b/Xext/xvmain.c index 1b80bc8da..9834fcfa0 100644 --- a/Xext/xvmain.c +++ b/Xext/xvmain.c @@ -105,7 +105,7 @@ SOFTWARE. #endif #include "xvdisp.h" -int XvScreenIndex = -1; +static DevPrivateKey XvScreenKey = &XvScreenKey; unsigned long XvExtensionGeneration = 0; unsigned long XvScreenGeneration = 0; unsigned long XvResourceGeneration = 0; @@ -166,12 +166,6 @@ XvExtensionInit(void) ErrorF("XvExtensionInit: Unable to allocate resource types\n"); return; } - XvScreenIndex = AllocateScreenPrivateIndex (); - if (XvScreenIndex < 0) - { - ErrorF("XvExtensionInit: Unable to allocate screen private index\n"); - return; - } #ifdef PANORAMIX XineramaRegisterConnectionBlockCallback(XineramifyXv); #endif @@ -265,19 +259,13 @@ XvScreenInit(ScreenPtr pScreen) ErrorF("XvScreenInit: Unable to allocate resource types\n"); return BadAlloc; } - XvScreenIndex = AllocateScreenPrivateIndex (); - if (XvScreenIndex < 0) - { - ErrorF("XvScreenInit: Unable to allocate screen private index\n"); - return BadAlloc; - } #ifdef PANORAMIX XineramaRegisterConnectionBlockCallback(XineramifyXv); #endif XvScreenGeneration = serverGeneration; } - if (pScreen->devPrivates[XvScreenIndex].ptr) + if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey)) { ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n"); } @@ -291,7 +279,7 @@ XvScreenInit(ScreenPtr pScreen) return BadAlloc; } - pScreen->devPrivates[XvScreenIndex].ptr = (pointer)pxvs; + dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs); pxvs->DestroyPixmap = pScreen->DestroyPixmap; @@ -313,7 +301,7 @@ XvCloseScreen( XvScreenPtr pxvs; - pxvs = (XvScreenPtr) pScreen->devPrivates[XvScreenIndex].ptr; + pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey); pScreen->DestroyPixmap = pxvs->DestroyPixmap; pScreen->DestroyWindow = pxvs->DestroyWindow; @@ -323,7 +311,7 @@ XvCloseScreen( xfree(pxvs); - pScreen->devPrivates[XvScreenIndex].ptr = (pointer)NULL; + dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL); return (*pScreen->CloseScreen)(ii, pScreen); } @@ -334,10 +322,10 @@ XvResetProc(ExtensionEntry* extEntry) XvResetProcVector(); } -_X_EXPORT int -XvGetScreenIndex(void) +_X_EXPORT DevPrivateKey +XvGetScreenKey(void) { - return XvScreenIndex; + return XvScreenKey; } _X_EXPORT unsigned long @@ -361,7 +349,7 @@ XvDestroyPixmap(PixmapPtr pPix) SCREEN_PROLOGUE(pScreen, DestroyPixmap); - pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; + pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey); /* CHECK TO SEE IF THIS PORT IS IN USE */ @@ -413,7 +401,7 @@ XvDestroyWindow(WindowPtr pWin) SCREEN_PROLOGUE(pScreen, DestroyWindow); - pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; + pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey); /* CHECK TO SEE IF THIS PORT IS IN USE */ diff --git a/Xext/xvmc.c b/Xext/xvmc.c index ae358936e..7ae8cc0da 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -39,7 +39,7 @@ #define DR_CLIENT_DRIVER_NAME_SIZE 48 #define DR_BUSID_SIZE 48 -int XvMCScreenIndex = -1; +static DevPrivateKey XvMCScreenKey = NULL; unsigned long XvMCGeneration = 0; @@ -63,7 +63,7 @@ typedef struct { } XvMCScreenRec, *XvMCScreenPtr; #define XVMC_GET_PRIVATE(pScreen) \ - (XvMCScreenPtr)((pScreen)->devPrivates[XvMCScreenIndex].ptr) + (XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey)) static int @@ -153,7 +153,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client) return _XvBadPort; } - if(XvMCScreenIndex >= 0) { /* any adaptors at all */ + if(XvMCScreenKey) { /* any adaptors at all */ ScreenPtr pScreen = pPort->pAdaptor->pScreen; if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */ for(i = 0; i < pScreenPriv->num_adaptors; i++) { @@ -211,7 +211,7 @@ ProcXvMCCreateContext(ClientPtr client) pScreen = pPort->pAdaptor->pScreen; - if(XvMCScreenIndex < 0) /* no XvMC adaptors */ + if(XvMCScreenKey == NULL) /* no XvMC adaptors */ return BadMatch; if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */ @@ -494,7 +494,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client) pScreen = pPort->pAdaptor->pScreen; - if(XvMCScreenIndex < 0) /* No XvMC adaptors */ + if(XvMCScreenKey == NULL) /* No XvMC adaptors */ return BadMatch; if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) @@ -679,7 +679,7 @@ XvMCExtensionInit(void) { ExtensionEntry *extEntry; - if(XvMCScreenIndex < 0) /* nobody supports it */ + if(XvMCScreenKey == NULL) /* nobody supports it */ return; if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes))) @@ -720,17 +720,12 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt) { XvMCScreenPtr pScreenPriv; - if(XvMCGeneration != serverGeneration) { - if((XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0) - return BadAlloc; - - XvMCGeneration = serverGeneration; - } + XvMCScreenKey = &XvMCScreenKey; if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec)))) return BadAlloc; - pScreen->devPrivates[XvMCScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = XvMCCloseScreen; @@ -754,7 +749,7 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id) XvMCAdaptorPtr adaptor = NULL; int i; - if(XvMCScreenIndex < 0) return NULL; + if(XvMCScreenKey == NULL) return NULL; if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) return NULL; diff --git a/Xi/allowev.c b/Xi/allowev.c index cf075e112..0043cb138 100644 --- a/Xi/allowev.c +++ b/Xi/allowev.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "allowev.h" @@ -95,13 +94,14 @@ ProcXAllowDeviceEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr thisdev; + int rc; REQUEST(xAllowDeviceEventsReq); REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); - thisdev = LookupDeviceIntRec(stuff->deviceid); - if (thisdev == NULL) - return BadDevice; + rc = dixLookupDevice(&thisdev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; time = ClientTimeToServerTime(stuff->time); switch (stuff->mode) { diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 055f459d0..30174f496 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -61,7 +61,6 @@ SOFTWARE. #include <X11/extensions/XIproto.h> /* control constants */ #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "exevents.h" @@ -112,11 +111,9 @@ ProcXChangeDeviceControl(ClientPtr client) REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq); len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - ret = BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess); + if (ret != Success) goto out; - } rep.repType = X_Reply; rep.RepType = X_ChangeDeviceControl; diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c index 46bb8e78f..3155e87c2 100644 --- a/Xi/chgfctl.c +++ b/Xi/chgfctl.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> /* control constants */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "chgfctl.h" @@ -303,18 +302,13 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev, xStringFeedbackCtl * f) { char n; - long *p; int i, j; KeySym *syms, *sup_syms; syms = (KeySym *) (f + 1); if (client->swapped) { swaps(&f->length, n); /* swapped num_keysyms in calling proc */ - p = (long *)(syms); - for (i = 0; i < f->num_keysyms; i++) { - swapl(p, n); - p++; - } + SwapLongs((CARD32 *) syms, f->num_keysyms); } if (f->num_keysyms > s->ctrl.max_symbols) @@ -444,14 +438,15 @@ ProcXChangeFeedbackControl(ClientPtr client) StringFeedbackPtr s; BellFeedbackPtr b; LedFeedbackPtr l; + int rc; REQUEST(xChangeFeedbackControlReq); REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess); + if (rc != Success) + return rc; switch (stuff->feedbackid) { case KbdFeedbackClass: diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c index bfdc1cedc..3f51648e1 100644 --- a/Xi/chgkmap.c +++ b/Xi/chgkmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -76,18 +75,14 @@ int SProcXChangeDeviceKeyMapping(ClientPtr client) { char n; - long *p; - int i, count; + unsigned int count; REQUEST(xChangeDeviceKeyMappingReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq); - p = (long *)&stuff[1]; count = stuff->keyCodes * stuff->keySymsPerKeyCode; - for (i = 0; i < count; i++) { - swapl(p, n); - p++; - } + REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32)); + SwapLongs((CARD32 *) (&stuff[1]), count); return (ProcXChangeDeviceKeyMapping(client)); } @@ -103,13 +98,17 @@ ProcXChangeDeviceKeyMapping(ClientPtr client) int ret; unsigned len; DeviceIntPtr dev; + unsigned int count; REQUEST(xChangeDeviceKeyMappingReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + count = stuff->keyCodes * stuff->keySymsPerKeyCode; + REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32)); + + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess); + if (ret != Success) + return ret; len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2); ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify, diff --git a/Xi/chgprop.c b/Xi/chgprop.c index 13463dd1c..3fb33e129 100644 --- a/Xi/chgprop.c +++ b/Xi/chgprop.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -78,19 +77,15 @@ int SProcXChangeDeviceDontPropagateList(ClientPtr client) { char n; - long *p; - int i; REQUEST(xChangeDeviceDontPropagateListReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq); swapl(&stuff->window, n); swaps(&stuff->count, n); - p = (long *)&stuff[1]; - for (i = 0; i < stuff->count; i++) { - swapl(p, n); - p++; - } + REQUEST_FIXED_SIZE(xChangeDeviceDontPropagateListReq, + stuff->count * sizeof(CARD32)); + SwapLongs((CARD32 *) (&stuff[1]), stuff->count); return (ProcXChangeDeviceDontPropagateList(client)); } @@ -115,7 +110,7 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client) stuff->count) return BadLength; - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/chgptr.c b/Xi/chgptr.c index 2ce81d1d6..28950918f 100644 --- a/Xi/chgptr.c +++ b/Xi/chgptr.c @@ -63,8 +63,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include "scrnintstr.h" /* screen structure */ -#include "extinit.h" /* LookupDeviceIntRec */ - #include "dixevents.h" #include "exevents.h" #include "exglobals.h" diff --git a/Xi/closedev.c b/Xi/closedev.c index 1ec3fa163..94b7391fb 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -62,7 +62,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "closedev.h" @@ -140,16 +139,16 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) int ProcXCloseDevice(ClientPtr client) { - int i; + int rc, i; WindowPtr pWin, p1; DeviceIntPtr d; REQUEST(xCloseDeviceReq); REQUEST_SIZE_MATCH(xCloseDeviceReq); - d = LookupDeviceIntRec(stuff->deviceid); - if (d == NULL) - return BadDevice; + rc = dixLookupDevice(&d, stuff->deviceid, client, DixUseAccess); + if (rc != Success) + return rc; if (d->grab && SameClient(d->grab, client)) (*d->DeactivateGrab) (d); /* release active grab */ diff --git a/Xi/devbell.c b/Xi/devbell.c index 83e844d93..264f64800 100644 --- a/Xi/devbell.c +++ b/Xi/devbell.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "devbell.h" @@ -93,7 +92,7 @@ ProcXDeviceBell(ClientPtr client) DeviceIntPtr dev; KbdFeedbackPtr k; BellFeedbackPtr b; - int base; + int rc, base; int newpercent; CARD8 class; pointer ctrl; @@ -102,10 +101,10 @@ ProcXDeviceBell(ClientPtr client) REQUEST(xDeviceBellReq); REQUEST_SIZE_MATCH(xDeviceBellReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixBellAccess); + if (rc != Success) { client->errorValue = stuff->deviceid; - return BadDevice; + return rc; } if (stuff->percent < -100 || stuff->percent > 100) { diff --git a/Xi/exevents.c b/Xi/exevents.c index 377311ec9..ac6b92383 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -67,11 +67,11 @@ SOFTWARE. #include "region.h" #include "exevents.h" #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixevents.h" /* DeliverFocusedEvent */ #include "dixgrabs.h" /* CreateGrab() */ #include "scrnintstr.h" +#include "xace.h" #ifdef XKB #include "xkbsrv.h" @@ -244,7 +244,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count) other->valuator->motionHintWindow = NullWindow; b->buttonsDown++; b->motionMask = DeviceButtonMotionMask; - xE->u.u.detail = b->map[key]; + xE->u.u.detail = key; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) @@ -266,7 +266,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr other, int count) other->valuator->motionHintWindow = NullWindow; if (b->buttonsDown >= 1 && !--b->buttonsDown) b->motionMask = 0; - xE->u.u.detail = b->map[key]; + xE->u.u.detail = key; if (xE->u.u.detail == 0) return; if (xE->u.u.detail <= 5) @@ -511,6 +511,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin, confineTo; CursorPtr cursor; GrabPtr grab; + Mask access_mode = DixGrabAccess; int rc; if ((this_device_mode != GrabModeSync) && @@ -531,25 +532,33 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (rconfineTo == None) confineTo = NullWindow; else { - rc = dixLookupWindow(&confineTo, rconfineTo, client, DixUnknownAccess); + rc = dixLookupWindow(&confineTo, rconfineTo, client, DixSetAttrAccess); if (rc != Success) return rc; } if (rcursor == None) cursor = NullCursor; else { - cursor = (CursorPtr) LookupIDByType(rcursor, RT_CURSOR); - if (!cursor) { + rc = dixLookupResource((pointer *)&cursor, rcursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) + { client->errorValue = rcursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } + access_mode |= DixForceAccess; } + if (this_device_mode == GrabModeSync || other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; grab = CreateGrab(client->index, dev, pWin, eventMask, (Bool) ownerEvents, (Bool) this_device_mode, @@ -557,7 +566,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, DeviceButtonPress, button, confineTo, cursor); if (!grab) return BadAlloc; - return AddPassiveGrabToList(grab); + return AddPassiveGrabToList(client, grab); } int @@ -569,6 +578,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin; GrabPtr grab; KeyClassPtr k = dev->key; + Mask access_mode = DixGrabAccess; int rc; if (k == NULL) @@ -596,7 +606,12 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (this_device_mode == GrabModeSync || other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); if (rc != Success) return rc; @@ -606,7 +621,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, NullWindow, NullCursor); if (!grab) return BadAlloc; - return AddPassiveGrabToList(grab); + return AddPassiveGrabToList(client, grab); } int @@ -837,7 +852,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, if (!mask) break; } - } else + } else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count)) (void)(DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id)); return Success; } @@ -1101,7 +1116,8 @@ MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) { DeviceIntPtr dev; - dev = LookupDeviceIntRec(pEvents->deviceid & DEVICE_BITS); + dixLookupDevice(&dev, pEvents->deviceid & DEVICE_BITS, serverClient, + DixReadAccess); if (!dev) return 0; @@ -1125,7 +1141,8 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, { DeviceIntPtr dev; - dev = LookupDeviceIntRec(xE->deviceid & DEVICE_BITS); + dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient, + DixReadAccess); if (!dev) return; diff --git a/Xi/extinit.c b/Xi/extinit.c index 73bae5e85..2ffdafbc1 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -69,6 +69,7 @@ SOFTWARE. #include "extinit.h" #include "exglobals.h" #include "swaprep.h" +#include "registry.h" /* modules local to Xi */ #include "allowev.h" @@ -856,29 +857,6 @@ MakeDeviceTypeAtoms(void) MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1); } -/************************************************************************** - * Return a DeviceIntPtr corresponding to a specified device id. - * - */ - -DeviceIntPtr -LookupDeviceIntRec(CARD8 id) -{ - DeviceIntPtr dev; - - for (dev = inputInfo.devices; dev; dev = dev->next) { - if (dev->id == id) - return dev; - } - - for (dev = inputInfo.off_devices; dev; dev = dev->next) { - if (dev->id == id) - return dev; - } - - return NULL; -} - /***************************************************************************** * * SEventIDispatch @@ -959,6 +937,7 @@ XInputExtensionInit(void) AllExtensionVersions[IReqCode - 128] = thisversion; MakeDeviceTypeAtoms(); RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); + RegisterResourceName(RT_INPUTCLIENT, "INPUTCLIENT"); FixExtensionEvents(extEntry); ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; EventSwapVector[DeviceValuator] = SEventIDispatch; diff --git a/Xi/getbmap.c b/Xi/getbmap.c index ebb0613af..9f93b06ef 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getbmap.h" @@ -92,6 +91,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client) DeviceIntPtr dev; xGetDeviceButtonMappingReply rep; ButtonClassPtr b; + int rc; REQUEST(xGetDeviceButtonMappingReq); REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq); @@ -102,9 +102,9 @@ ProcXGetDeviceButtonMapping(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; b = dev->button; if (b == NULL) diff --git a/Xi/getdctl.c b/Xi/getdctl.c index 7175dc253..c979959e2 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getdctl.h" @@ -238,7 +237,7 @@ SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) int ProcXGetDeviceControl(ClientPtr client) { - int total_length = 0; + int rc, total_length = 0; char *buf, *savbuf; DeviceIntPtr dev; xGetDeviceControlReply rep; @@ -246,9 +245,9 @@ ProcXGetDeviceControl(ClientPtr client) REQUEST(xGetDeviceControlReq); REQUEST_SIZE_MATCH(xGetDeviceControlReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; rep.repType = X_Reply; rep.RepType = X_GetDeviceControl; @@ -266,19 +265,19 @@ ProcXGetDeviceControl(ClientPtr client) if (!dev->absolute) return BadMatch; - total_length = sizeof(xDeviceAbsCalibCtl); + total_length = sizeof(xDeviceAbsCalibState); break; case DEVICE_ABS_AREA: if (!dev->absolute) return BadMatch; - total_length = sizeof(xDeviceAbsAreaCtl); + total_length = sizeof(xDeviceAbsAreaState); break; case DEVICE_CORE: - total_length = sizeof(xDeviceCoreCtl); + total_length = sizeof(xDeviceCoreState); break; case DEVICE_ENABLE: - total_length = sizeof(xDeviceEnableCtl); + total_length = sizeof(xDeviceEnableState); break; default: return BadValue; diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 7dff32f4f..1b1e594a2 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getfctl.h" @@ -290,7 +289,7 @@ SRepXGetFeedbackControl(ClientPtr client, int size, int ProcXGetFeedbackControl(ClientPtr client) { - int total_length = 0; + int rc, total_length = 0; char *buf, *savbuf; DeviceIntPtr dev; KbdFeedbackPtr k; @@ -304,9 +303,9 @@ ProcXGetFeedbackControl(ClientPtr client) REQUEST(xGetFeedbackControlReq); REQUEST_SIZE_MATCH(xGetFeedbackControlReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; rep.repType = X_Reply; rep.RepType = X_GetFeedbackControl; diff --git a/Xi/getfocus.c b/Xi/getfocus.c index 073913bf2..dfef22fb7 100644 --- a/Xi/getfocus.c +++ b/Xi/getfocus.c @@ -60,7 +60,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getfocus.h" @@ -93,12 +92,15 @@ ProcXGetDeviceFocus(ClientPtr client) DeviceIntPtr dev; FocusClassPtr focus; xGetDeviceFocusReply rep; + int rc; REQUEST(xGetDeviceFocusReq); REQUEST_SIZE_MATCH(xGetDeviceFocusReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL || !dev->focus) + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetFocusAccess); + if (rc != Success) + return rc; + if (!dev->focus) return BadDevice; rep.repType = X_Reply; diff --git a/Xi/getkmap.c b/Xi/getkmap.c index eaa0cffcc..0eec1d8df 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" @@ -94,13 +93,14 @@ ProcXGetDeviceKeyMapping(ClientPtr client) xGetDeviceKeyMappingReply rep; DeviceIntPtr dev; KeySymsPtr k; + int rc; REQUEST(xGetDeviceKeyMappingReq); REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; if (dev->key == NULL) return BadMatch; k = &dev->key->curKeySyms; diff --git a/Xi/getmmap.c b/Xi/getmmap.c index 8a99d63ed..c6c9c3362 100644 --- a/Xi/getmmap.c +++ b/Xi/getmmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> /* Request macro */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getmmap.h" @@ -94,13 +93,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client) DeviceIntPtr dev; xGetDeviceModifierMappingReply rep; KeyClassPtr kp; + int rc; REQUEST(xGetDeviceModifierMappingReq); REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; kp = dev->key; if (kp == NULL) diff --git a/Xi/getprop.c b/Xi/getprop.c index 531e65f27..188f549e5 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structs */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" @@ -112,7 +111,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client) rep.length = 0; rep.count = 0; - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/getselev.c b/Xi/getselev.c index 819b2dbd0..caa376fcb 100644 --- a/Xi/getselev.c +++ b/Xi/getselev.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XIproto.h> #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window struct */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" @@ -114,7 +113,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client) rep.this_client_count = 0; rep.all_clients_count = 0; - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/getvers.c b/Xi/getvers.c index a223a5d1e..a4afe808f 100644 --- a/Xi/getvers.c +++ b/Xi/getvers.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getvers.h" diff --git a/Xi/grabdev.c b/Xi/grabdev.c index b303695fd..0671e0ea7 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixevents.h" /* GrabDevice */ @@ -79,8 +78,6 @@ int SProcXGrabDevice(ClientPtr client) { char n; - long *p; - int i; REQUEST(xGrabDeviceReq); swaps(&stuff->length, n); @@ -88,11 +85,11 @@ SProcXGrabDevice(ClientPtr client) swapl(&stuff->grabWindow, n); swapl(&stuff->time, n); swaps(&stuff->event_count, n); - p = (long *)&stuff[1]; - for (i = 0; i < stuff->event_count; i++) { - swapl(p, n); - p++; - } + + if (stuff->length != (sizeof(xGrabDeviceReq) >> 2) + stuff->event_count) + return BadLength; + + SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDevice(client)); } @@ -122,9 +119,9 @@ ProcXGrabDevice(ClientPtr client) rep.sequenceNumber = client->sequence; rep.length = 0; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); + if (rc != Success) + return rc; if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1], stuff->event_count, tmp, dev, @@ -153,7 +150,7 @@ int CreateMaskFromList(ClientPtr client, XEventClass * list, int count, struct tmask *mask, DeviceIntPtr dev, int req) { - int i, j; + int rc, i, j; int device; DeviceIntPtr tdev; @@ -167,8 +164,10 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count, if (device > 255) return BadClass; - tdev = LookupDeviceIntRec(device); - if (tdev == NULL || (dev != NULL && tdev != dev)) + rc = dixLookupDevice(&tdev, device, client, DixReadAccess); + if (rc != BadDevice && rc != Success) + return rc; + if (rc == BadDevice || (dev != NULL && tdev != dev)) return BadClass; for (j = 0; j < ExtEventIndex; j++) diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c index 21e46fceb..ce0dcc5f9 100644 --- a/Xi/grabdevb.c +++ b/Xi/grabdevb.c @@ -61,8 +61,8 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" +#include "xace.h" #include "grabdev.h" #include "grabdevb.h" @@ -77,8 +77,6 @@ int SProcXGrabDeviceButton(ClientPtr client) { char n; - long *p; - int i; REQUEST(xGrabDeviceButtonReq); swaps(&stuff->length, n); @@ -86,11 +84,9 @@ SProcXGrabDeviceButton(ClientPtr client) swapl(&stuff->grabWindow, n); swaps(&stuff->modifiers, n); swaps(&stuff->event_count, n); - p = (long *)&stuff[1]; - for (i = 0; i < stuff->event_count; i++) { - swapl(p, n); - p++; - } + REQUEST_FIXED_SIZE(xGrabDeviceButtonReq, + stuff->event_count * sizeof(CARD32)); + SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDeviceButton(client)); } @@ -117,18 +113,23 @@ ProcXGrabDeviceButton(ClientPtr client) (sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) return BadLength; - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (ret != Success) + return ret; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - return BadDevice; + ret = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (ret != Success) + return ret; if (mdev->key == NULL) return BadMatch; - } else - mdev = (DeviceIntPtr) LookupKeyboardDevice(); + } else { + mdev = inputInfo.keyboard; + ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess); + if (ret != Success) + return ret; + } class = (XEventClass *) (&stuff[1]); /* first word of values */ diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c index 8da36ba8f..d4b7fe815 100644 --- a/Xi/grabdevk.c +++ b/Xi/grabdevk.c @@ -61,8 +61,8 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" +#include "xace.h" #include "grabdev.h" #include "grabdevk.h" @@ -77,8 +77,6 @@ int SProcXGrabDeviceKey(ClientPtr client) { char n; - long *p; - int i; REQUEST(xGrabDeviceKeyReq); swaps(&stuff->length, n); @@ -86,11 +84,8 @@ SProcXGrabDeviceKey(ClientPtr client) swapl(&stuff->grabWindow, n); swaps(&stuff->modifiers, n); swaps(&stuff->event_count, n); - p = (long *)&stuff[1]; - for (i = 0; i < stuff->event_count; i++) { - swapl(p, n); - p++; - } + REQUEST_FIXED_SIZE(xGrabDeviceKeyReq, stuff->event_count * sizeof(CARD32)); + SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count); return (ProcXGrabDeviceKey(client)); } @@ -115,18 +110,23 @@ ProcXGrabDeviceKey(ClientPtr client) if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) return BadLength; - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (ret != Success) + return ret; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - return BadDevice; + ret = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (ret != Success) + return ret; if (mdev->key == NULL) return BadMatch; - } else - mdev = (DeviceIntPtr) LookupKeyboardDevice(); + } else { + mdev = inputInfo.keyboard; + ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess); + if (ret != Success) + return ret; + } class = (XEventClass *) (&stuff[1]); /* first word of values */ diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index ad2bec391..4f4d7cb77 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -96,7 +95,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client) INT32 *coords = NULL, *bufptr; xGetDeviceMotionEventsReply rep; unsigned long i; - int num_events, axes, size = 0, tsize; + int rc, num_events, axes, size = 0, tsize; unsigned long nEvents; DeviceIntPtr dev; TimeStamp start, stop; @@ -106,9 +105,9 @@ ProcXGetDeviceMotionEvents(ClientPtr client) REQUEST(xGetDeviceMotionEventsReq); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess); + if (rc != Success) + return rc; v = dev->valuator; if (v == NULL || v->numAxes == 0) return BadMatch; diff --git a/Xi/listdev.c b/Xi/listdev.c index 160ad02fb..041de7635 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -63,8 +63,8 @@ SOFTWARE. #include <X11/extensions/XIproto.h> #include "XIstubs.h" #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" /* FIXME */ +#include "xace.h" #include "listdev.h" @@ -310,7 +310,7 @@ ProcXListInputDevices(ClientPtr client) xListInputDevicesReply rep; int numdevs = 0; int namesize = 1; /* need 1 extra byte for strcpy */ - int size = 0; + int rc, size = 0; int total_length; char *devbuf; char *classbuf; @@ -329,10 +329,16 @@ ProcXListInputDevices(ClientPtr client) AddOtherInputDevices(); for (d = inputInfo.devices; d; d = d->next) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess); + if (rc != Success) + return rc; SizeDeviceInfo(d, &namesize, &size); numdevs++; } for (d = inputInfo.off_devices; d; d = d->next) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess); + if (rc != Success) + return rc; SizeDeviceInfo(d, &namesize, &size); numdevs++; } diff --git a/Xi/opendev.c b/Xi/opendev.c index dfefe055c..acda38530 100644 --- a/Xi/opendev.c +++ b/Xi/opendev.c @@ -61,7 +61,6 @@ SOFTWARE. #include <X11/extensions/XIproto.h> #include "XIstubs.h" #include "windowstr.h" /* window structure */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "opendev.h" @@ -107,13 +106,15 @@ ProcXOpenDevice(ClientPtr client) stuff->deviceid == inputInfo.keyboard->id) return BadDevice; - if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */ + status = dixLookupDevice(&dev, stuff->deviceid, client, DixUseAccess); + if (status == BadDevice) { /* not open */ for (dev = inputInfo.off_devices; dev; dev = dev->next) if (dev->id == stuff->deviceid) break; if (dev == NULL) return BadDevice; - } + } else if (status != Success) + return status; OpenInputDevice(dev, client, &status); if (status != Success) diff --git a/Xi/queryst.c b/Xi/queryst.c index 2b66b7eb2..71ab79be8 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -42,7 +42,6 @@ from The Open Group. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -74,7 +73,7 @@ int ProcXQueryDeviceState(ClientPtr client) { char n; - int i; + int rc, i; int num_classes = 0; int total_length = 0; char *buf, *savbuf; @@ -96,9 +95,9 @@ ProcXQueryDeviceState(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess); + if (rc != Success) + return rc; v = dev->valuator; if (v != NULL && v->motionHintWindow != NULL) diff --git a/Xi/selectev.c b/Xi/selectev.c index a5cf56754..d3670ab1b 100644 --- a/Xi/selectev.c +++ b/Xi/selectev.c @@ -61,7 +61,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -128,19 +127,16 @@ int SProcXSelectExtensionEvent(ClientPtr client) { char n; - long *p; - int i; REQUEST(xSelectExtensionEventReq); swaps(&stuff->length, n); REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq); swapl(&stuff->window, n); swaps(&stuff->count, n); - p = (long *)&stuff[1]; - for (i = 0; i < stuff->count; i++) { - swapl(p, n); - p++; - } + REQUEST_FIXED_SIZE(xSelectExtensionEventReq, + stuff->count * sizeof(CARD32)); + SwapLongs((CARD32 *) (&stuff[1]), stuff->count); + return (ProcXSelectExtensionEvent(client)); } @@ -164,7 +160,7 @@ ProcXSelectExtensionEvent(ClientPtr client) if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) return BadLength; - ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + ret = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); if (ret != Success) return ret; diff --git a/Xi/sendexev.c b/Xi/sendexev.c index 20b415a1f..588c91023 100644 --- a/Xi/sendexev.c +++ b/Xi/sendexev.c @@ -59,9 +59,9 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* Window */ +#include "extnsionst.h" /* EventSwapPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -80,7 +80,7 @@ int SProcXSendExtensionEvent(ClientPtr client) { char n; - long *p; + CARD32 *p; int i; xEvent eventT; xEvent *eventP; @@ -91,6 +91,11 @@ SProcXSendExtensionEvent(ClientPtr client) REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq); swapl(&stuff->destination, n); swaps(&stuff->count, n); + + if (stuff->length != (sizeof(xSendExtensionEventReq) >> 2) + stuff->count + + (stuff->num_events * (sizeof(xEvent) >> 2))) + return BadLength; + eventP = (xEvent *) & stuff[1]; for (i = 0; i < stuff->num_events; i++, eventP++) { proc = EventSwapVector[eventP->u.u.type & 0177]; @@ -100,11 +105,8 @@ SProcXSendExtensionEvent(ClientPtr client) *eventP = eventT; } - p = (long *)(((xEvent *) & stuff[1]) + stuff->num_events); - for (i = 0; i < stuff->count; i++) { - swapl(p, n); - p++; - } + p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events); + SwapLongs(p, stuff->count); return (ProcXSendExtensionEvent(client)); } @@ -131,9 +133,9 @@ ProcXSendExtensionEvent(ClientPtr client) (stuff->num_events * (sizeof(xEvent) >> 2))) return BadLength; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess); + if (ret != Success) + return ret; /* The client's event type must be one defined by an extension. */ diff --git a/Xi/setbmap.c b/Xi/setbmap.c index 40f0f9a99..f05225531 100644 --- a/Xi/setbmap.c +++ b/Xi/setbmap.c @@ -63,7 +63,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setbmap.h" @@ -110,9 +109,9 @@ ProcXSetDeviceButtonMapping(ClientPtr client) rep.sequenceNumber = client->sequence; rep.status = MappingSuccess; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess); + if (ret != Success) + return ret; ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]); diff --git a/Xi/setdval.c b/Xi/setdval.c index cb35b9157..b1e22fc21 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setdval.h" @@ -92,6 +91,7 @@ ProcXSetDeviceValuators(ClientPtr client) { DeviceIntPtr dev; xSetDeviceValuatorsReply rep; + int rc; REQUEST(xSetDeviceValuatorsReq); REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq); @@ -106,9 +106,9 @@ ProcXSetDeviceValuators(ClientPtr client) stuff->num_valuators) return BadLength; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (rc != Success) + return rc; if (dev->valuator == NULL) return BadMatch; diff --git a/Xi/setfocus.c b/Xi/setfocus.c index 74de17e97..c6edbc2e5 100644 --- a/Xi/setfocus.c +++ b/Xi/setfocus.c @@ -63,7 +63,6 @@ SOFTWARE. #include "dixevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setfocus.h" @@ -102,8 +101,10 @@ ProcXSetDeviceFocus(ClientPtr client) REQUEST(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq); - dev = LookupDeviceIntRec(stuff->device); - if (dev == NULL || !dev->focus) + ret = dixLookupDevice(&dev, stuff->device, client, DixSetFocusAccess); + if (ret != Success) + return ret; + if (!dev->focus) return BadDevice; ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo, diff --git a/Xi/setmmap.c b/Xi/setmmap.c index 19ec71bbe..34efde595 100644 --- a/Xi/setmmap.c +++ b/Xi/setmmap.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setmmap.h" @@ -99,9 +98,9 @@ ProcXSetDeviceModifierMapping(ClientPtr client) REQUEST(xSetDeviceModifierMappingReq); REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess); + if (ret != Success) + return ret; rep.repType = X_Reply; rep.RepType = X_SetDeviceModifierMapping; diff --git a/Xi/setmode.c b/Xi/setmode.c index 957721c66..8b6003ad0 100644 --- a/Xi/setmode.c +++ b/Xi/setmode.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setmode.h" @@ -92,6 +91,7 @@ ProcXSetDeviceMode(ClientPtr client) { DeviceIntPtr dev; xSetDeviceModeReply rep; + int rc; REQUEST(xSetDeviceModeReq); REQUEST_SIZE_MATCH(xSetDeviceModeReq); @@ -101,9 +101,9 @@ ProcXSetDeviceMode(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (rc != Success) + return rc; if (dev->valuator == NULL) return BadMatch; if ((dev->grab) && !SameClient(dev->grab, client)) diff --git a/Xi/stubs.c b/Xi/stubs.c index 40cd02fe1..80ddd73c0 100644 --- a/Xi/stubs.c +++ b/Xi/stubs.c @@ -65,6 +65,7 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" +#include "xace.h" /*********************************************************************** * @@ -153,6 +154,7 @@ AddOtherInputDevices(void) void OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) { + *status = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess); } /**************************************************************************** diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c index 505d6690f..7abb1d061 100644 --- a/Xi/ungrdev.c +++ b/Xi/ungrdev.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "ungrdev.h" @@ -94,13 +93,14 @@ ProcXUngrabDevice(ClientPtr client) DeviceIntPtr dev; GrabPtr grab; TimeStamp time; + int rc; REQUEST(xUngrabDeviceReq); REQUEST_SIZE_MATCH(xUngrabDeviceReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; grab = dev->grab; time = ClientTimeToServerTime(stuff->time); diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c index 0dfe805b7..590699f05 100644 --- a/Xi/ungrdevb.c +++ b/Xi/ungrdevb.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixgrabs.h" @@ -107,22 +106,23 @@ ProcXUngrabDeviceButton(ClientPtr client) REQUEST(xUngrabDeviceButtonReq); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (rc != Success) + return rc; if (dev->button == NULL) return BadMatch; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) + rc = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (rc != Success) return BadDevice; if (mdev->key == NULL) return BadMatch; } else - mdev = (DeviceIntPtr) LookupKeyboardDevice(); + mdev = inputInfo.keyboard; - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index e6307af01..521765ea3 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixgrabs.h" @@ -107,22 +106,23 @@ ProcXUngrabDeviceKey(ClientPtr client) REQUEST(xUngrabDeviceKeyReq); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (rc != Success) + return rc; if (dev->key == NULL) return BadMatch; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) + rc = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (rc != Success) return BadDevice; if (mdev->key == NULL) return BadMatch; } else - mdev = (DeviceIntPtr) LookupKeyboardDevice(); + mdev = inputInfo.keyboard; - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; @@ -55,11 +55,11 @@ SOFTWARE. #include "gc.h" #include "colormap.h" #include "regionstr.h" +#include "privates.h" #include "mibstore.h" #include "mfb.h" extern int afbInverseAlu[]; -extern int afbScreenPrivateIndex; /* warning: PixelType definition duplicated in maskbits.h */ #ifndef PixelType #define PixelType CARD32 @@ -731,20 +731,21 @@ typedef struct { } afbPrivGC; typedef afbPrivGC *afbPrivGCPtr; -extern int afbGCPrivateIndex; /* index into GC private array */ -extern int afbWindowPrivateIndex; /* index into Window private array */ +extern DevPrivateKey afbScreenPrivateKey; +extern DevPrivateKey afbGCPrivateKey; +extern DevPrivateKey afbWindowPrivateKey; #ifdef PIXMAP_PER_WINDOW -extern int frameWindowPrivateIndex; /* index into Window private array */ +extern DevPrivateKey frameWindowPrivateKey; #endif #define afbGetGCPrivate(pGC) \ - ((afbPrivGC *)((pGC)->devPrivates[afbGCPrivateIndex].ptr)) + ((afbPrivGC *)dixLookupPrivate(&(pGC)->devPrivates, afbGCPrivateKey)) /* Common macros for extracting drawing information */ #define afbGetTypedWidth(pDrawable,wtype)( \ (((pDrawable)->type == DRAWABLE_WINDOW) ? \ - (int)(((PixmapPtr)((pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr))->devKind) : \ + (int)(((PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey)->devKind) : \ (int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype)) #define afbGetByteWidth(pDrawable) afbGetTypedWidth(pDrawable, unsigned char) @@ -754,7 +755,7 @@ extern int frameWindowPrivateIndex; /* index into Window private array */ #define afbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\ PixmapPtr _pPix; \ if ((pDrawable)->type == DRAWABLE_WINDOW) \ - _pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \ + _pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \ else \ _pPix = (PixmapPtr)(pDrawable); \ (pointer) = (ptype *) _pPix->devPrivate.ptr; \ @@ -764,7 +765,7 @@ extern int frameWindowPrivateIndex; /* index into Window private array */ #define afbGetPixelWidthSizeDepthAndPointer(pDrawable, width, size, dep, pointer) {\ PixmapPtr _pPix; \ if ((pDrawable)->type == DRAWABLE_WINDOW) \ - _pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \ + _pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \ else \ _pPix = (PixmapPtr)(pDrawable); \ (pointer) = (PixelType *)_pPix->devPrivate.ptr; \ @@ -780,7 +781,7 @@ extern int frameWindowPrivateIndex; /* index into Window private array */ afbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType) #define afbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\ - PixmapPtr _pPix = (PixmapPtr)(pWin)->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr; \ + PixmapPtr _pPix = (PixmapPtr)dixLookupPrivate(&(pWin)->drawable.pScreen->devPrivates, afbScreenPrivateKey); \ (pointer) = (ptype *) _pPix->devPrivate.ptr; \ (width) = ((int) _pPix->devKind) / sizeof (wtype); \ } diff --git a/afb/afbfillarc.c b/afb/afbfillarc.c index fa685ba9a..cfc3133ee 100644 --- a/afb/afbfillarc.c +++ b/afb/afbfillarc.c @@ -321,7 +321,8 @@ afbPolyFillArcSolid(register DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parc RegionPtr cclip; unsigned char *rrops; - priv = (afbPrivGC *) pGC->devPrivates[afbGCPrivateIndex].ptr; + priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey); rrops = priv->rrops; cclip = pGC->pCompositeClip; for (arc = parcs, i = narcs; --i >= 0; arc++) { diff --git a/afb/afbfillrct.c b/afb/afbfillrct.c index 1600deab3..4dff9576f 100644 --- a/afb/afbfillrct.c +++ b/afb/afbfillrct.c @@ -93,7 +93,8 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre unsigned char *rrops; unsigned char *rropsOS; - priv = (afbPrivGC *)pGC->devPrivates[afbGCPrivateIndex].ptr; + priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey); prgnClip = pGC->pCompositeClip; rrops = priv->rrops; rropsOS = priv->rropOS; diff --git a/afb/afbfillsp.c b/afb/afbfillsp.c index b00185922..16295067b 100644 --- a/afb/afbfillsp.c +++ b/afb/afbfillsp.c @@ -123,7 +123,8 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst, pBase); - rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops; + rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rrops; while (n--) { addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth); @@ -238,8 +239,8 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) tileHeight = pStipple->drawable.height; psrc = (PixelType *)(pStipple->devPrivate.ptr); - rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops; - + rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rrops; while (n--) { src = psrc[ppt->y % tileHeight]; addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth); @@ -484,8 +485,8 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) tileHeight = pTile->drawable.height; psrc = (PixelType *)(pTile->devPrivate.ptr); rop = pGC->alu; - rropsOS = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rropOS; - + rropsOS = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rropOS; switch(rop) { case GXcopy: while (n--) { @@ -793,8 +794,8 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) tileWidth = pTile->drawable.width; tileHeight = pTile->drawable.height; - rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops; - + rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rrops; /* this replaces rotating the stipple. Instead, we just adjust the offset * at which we start grabbing bits from the stipple. * Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0, diff --git a/afb/afbgc.c b/afb/afbgc.c index 59c09e097..1d1fdc58b 100644 --- a/afb/afbgc.c +++ b/afb/afbgc.c @@ -154,7 +154,8 @@ afbCreateGC(pGC) /* afb wants to translate before scan convesion */ pGC->miTranslate = 1; - pPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr); + pPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey); afbReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth, pPriv->rrops); afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask, @@ -295,8 +296,8 @@ afbValidateGC(pGC, changes, pDrawable) (oldOrg.y != pGC->lastWinOrg.y); - devPriv = ((afbPrivGCPtr)(pGC->devPrivates[afbGCPrivateIndex].ptr)); - + devPriv = (afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey); /* if the client clip is different or moved OR diff --git a/afb/afbimggblt.c b/afb/afbimggblt.c index ca49ee3ba..36818ac50 100644 --- a/afb/afbimggblt.c +++ b/afb/afbimggblt.c @@ -145,8 +145,8 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) register int nFirst;/* bits of glyph in current longword */ PixelType *pdstSave; int oldFill; - afbPrivGC *pPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr); - + afbPrivGC *pPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey); xorg = pDrawable->x; yorg = pDrawable->y; afbGetPixelWidthSizeDepthAndPointer(pDrawable, widthDst, sizeDst, depthDst, diff --git a/afb/afbline.c b/afb/afbline.c index 9e2e4b9f4..d05675869 100644 --- a/afb/afbline.c +++ b/afb/afbline.c @@ -147,7 +147,8 @@ afbLineSS(pDrawable, pGC, mode, npt, pptInit) RegionPtr cclip; cclip = pGC->pCompositeClip; - rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops; + rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rrops; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); @@ -487,7 +488,8 @@ afbLineSD(pDrawable, pGC, mode, npt, pptInit) #endif cclip = pGC->pCompositeClip; - rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops; + rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rrops; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); diff --git a/afb/afbpixmap.c b/afb/afbpixmap.c index c6196182d..ad591a1af 100644 --- a/afb/afbpixmap.c +++ b/afb/afbpixmap.c @@ -115,6 +115,7 @@ afbDestroyPixmap(pPixmap) { if(--pPixmap->refcnt) return(TRUE); + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return(TRUE); } diff --git a/afb/afbply1rct.c b/afb/afbply1rct.c index 86ec174f4..e9d4d5e09 100644 --- a/afb/afbply1rct.c +++ b/afb/afbply1rct.c @@ -100,8 +100,8 @@ afbFillPolygonSolid (pDrawable, pGC, shape, mode, count, ptsIn) int depthDst; register PixelType *pdst; - devPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr); - + devPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey); if (mode == CoordModePrevious || shape != Convex || REGION_NUM_RECTS(pGC->pCompositeClip) != 1) { miFillPolygon (pDrawable, pGC, shape, mode, count, ptsIn); diff --git a/afb/afbplygblt.c b/afb/afbplygblt.c index bcb08c7a6..d1de102d7 100644 --- a/afb/afbplygblt.c +++ b/afb/afbplygblt.c @@ -146,8 +146,8 @@ afbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) bbox.y1 = y - info.overallAscent; bbox.y2 = y + info.overallDescent; - rrops = ((afbPrivGCPtr) pGC->devPrivates[afbGCPrivateIndex].ptr)->rrops; - + rrops = ((afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rrops; switch (RECT_IN_REGION(pGC->pScreen, pGC->pCompositeClip, &bbox)) { case rgnOUT: break; diff --git a/afb/afbpolypnt.c b/afb/afbpolypnt.c index a9d96edfe..b8ea3ed3e 100644 --- a/afb/afbpolypnt.c +++ b/afb/afbpolypnt.c @@ -90,8 +90,8 @@ afbPolyPoint(pDrawable, pGC, mode, npt, pptInit) register unsigned char *rrops; afbPrivGC *pGCPriv; - pGCPriv = (afbPrivGC *) pGC->devPrivates[afbGCPrivateIndex].ptr; - + pGCPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey); afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst, pBaseSave); diff --git a/afb/afbscrinit.c b/afb/afbscrinit.c index f3a054268..cbabb894e 100644 --- a/afb/afbscrinit.c +++ b/afb/afbscrinit.c @@ -69,12 +69,10 @@ SOFTWARE. #include "servermd.h" #ifdef PIXMAP_PER_WINDOW -int frameWindowPrivateIndex; +DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey; #endif -int afbGCPrivateIndex; -int afbScreenPrivateIndex; - -static unsigned long afbGeneration = 0; +DevPrivateKey afbGCPrivateKey = &afbGCPrivateKey; +DevPrivateKey afbScreenPrivateKey = &afbScreenPrivateKey; static Bool afbCloseScreen(int index, ScreenPtr pScreen) @@ -86,7 +84,7 @@ afbCloseScreen(int index, ScreenPtr pScreen) xfree(depths[d].vids); xfree(depths); xfree(pScreen->visuals); - xfree(pScreen->devPrivates[afbScreenPrivateIndex].ptr); + xfree(dixLookupPrivate(&pScreen->devPrivates, afbScreenPrivateKey)); return(TRUE); } @@ -97,7 +95,8 @@ afbCreateScreenResources(ScreenPtr pScreen) pointer oldDevPrivate = pScreen->devPrivate; - pScreen->devPrivate = pScreen->devPrivates[afbScreenPrivateIndex].ptr; + pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates, + afbScreenPrivateKey); retval = miCreateScreenResources(pScreen); /* Modify screen's pixmap devKind value stored off devPrivate to @@ -105,7 +104,8 @@ afbCreateScreenResources(ScreenPtr pScreen) * of a chunky screen in longs as incorrectly setup by the mi routine. */ ((PixmapPtr)pScreen->devPrivate)->devKind = BitmapBytePad(pScreen->width); - pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate; + dixSetPrivate(&pScreen->devPrivates, afbScreenPrivateKey, + pScreen->devPrivate); pScreen->devPrivate = oldDevPrivate; return(retval); } @@ -114,7 +114,8 @@ static PixmapPtr afbGetWindowPixmap(WindowPtr pWin) { #ifdef PIXMAP_PER_WINDOW - return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr); + return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates, + frameWindowPrivateKey); #else ScreenPtr pScreen = pWin->drawable.pScreen; @@ -126,29 +127,21 @@ static void afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix) { #ifdef PIXMAP_PER_WINDOW - pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix; + dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix); #else (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); #endif } static Bool -afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex) +afbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey) { - if (afbGeneration != serverGeneration) { -#ifdef PIXMAP_PER_WINDOW - frameWindowPrivateIndex = AllocateWindowPrivateIndex(); -#endif - afbGCPrivateIndex = AllocateGCPrivateIndex(); - afbGeneration = serverGeneration; - } - if (pGCIndex) - *pGCIndex = afbGCPrivateIndex; + if (pGCKey) + *pGCKey = afbGCPrivateKey; - afbScreenPrivateIndex = AllocateScreenPrivateIndex(); pScreen->GetWindowPixmap = afbGetWindowPixmap; pScreen->SetWindowPixmap = afbSetWindowPixmap; - return(AllocateGCPrivate(pScreen, afbGCPrivateIndex, sizeof(afbPrivGC))); + return dixRequestPrivate(afbGCPrivateKey, sizeof(afbPrivGC)); } /* dts * (inch/dot) * (25.4 mm / inch) = mm */ @@ -174,7 +167,7 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i ErrorF("afbInitVisuals: FALSE\n"); return FALSE; } - if (!afbAllocatePrivates(pScreen,(int *)NULL, (int *)NULL)) { + if (!afbAllocatePrivates(pScreen, NULL)) { ErrorF("afbAllocatePrivates: FALSE\n"); return FALSE; } @@ -217,7 +210,8 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i pScreen->CloseScreen = afbCloseScreen; pScreen->CreateScreenResources = afbCreateScreenResources; - pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate; + dixSetPrivate(&pScreen->devPrivates, afbScreenPrivateKey, + pScreen->devPrivate); pScreen->devPrivate = oldDevPrivate; return TRUE; diff --git a/afb/afbtegblt.c b/afb/afbtegblt.c index ba889cb80..c89b23a5d 100644 --- a/afb/afbtegblt.c +++ b/afb/afbtegblt.c @@ -261,8 +261,8 @@ afbTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) xpos += FONTMAXBOUNDS(pfont,leftSideBearing); ypos -= FONTASCENT(pfont); - rrops = ((afbPrivGCPtr) pGC->devPrivates[afbGCPrivateIndex].ptr)->rropOS; - + rrops = ((afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rropOS; bbox.x1 = xpos; bbox.x2 = xpos + (widthGlyph * nglyph); bbox.y1 = ypos; diff --git a/afb/afbwindow.c b/afb/afbwindow.c index 61641ee31..c0dee980d 100644 --- a/afb/afbwindow.c +++ b/afb/afbwindow.c @@ -56,6 +56,7 @@ SOFTWARE. #include <X11/X.h> #include "scrnintstr.h" #include "windowstr.h" +#include "privates.h" #include "afb.h" #include "mistruct.h" #include "regionstr.h" diff --git a/afb/afbzerarc.c b/afb/afbzerarc.c index 2cc30687f..e53488e02 100644 --- a/afb/afbzerarc.c +++ b/afb/afbzerarc.c @@ -96,8 +96,8 @@ afbZeroArcSS(DrawablePtr pDraw, GCPtr pGC, xArc *arc) register PixelType *paddr; register unsigned char *rrops; - rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops; - + rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + afbGCPrivateKey))->rrops; afbGetPixelWidthSizeDepthAndPointer(pDraw, nlwidth, sizeDst, depthDst, addrl); do360 = miZeroArcSetup(arc, &info, TRUE); @@ -37,6 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "colormap.h" #include "miscstruct.h" #include "servermd.h" +#include "privates.h" #include "windowstr.h" #include "mfb.h" #undef PixelType @@ -55,7 +56,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. pixmap.devKind = width_of_pixmap_in_bytes */ -extern int cfbGCPrivateIndex; +extern DevPrivateKey cfbGCPrivateKey; /* private field of GC */ typedef struct { @@ -70,7 +71,7 @@ typedef struct { typedef cfbPrivGC *cfbPrivGCPtr; #define cfbGetGCPrivate(pGC) ((cfbPrivGCPtr)\ - (pGC)->devPrivates[cfbGCPrivateIndex].ptr) + dixLookupPrivate(&(pGC)->devPrivates, cfbGCPrivateKey)) #define cfbGetCompositeClip(pGC) ((pGC)->pCompositeClip) @@ -298,7 +299,7 @@ extern int cfb8SegmentSS1RectXor( extern Bool cfbAllocatePrivates( ScreenPtr /*pScreen*/, - int * /*gc_index*/ + DevPrivateKey * /*gc_key*/ ); /* cfbbitblt.c */ @@ -1193,7 +1194,7 @@ extern void cfbZeroPolyArcSS8Xor( #define CFB_NEED_SCREEN_PRIVATE -extern int cfbScreenPrivateIndex; +extern DevPrivateKey cfbScreenPrivateKey; #endif #ifndef CFB_PROTOTYPES_ONLY diff --git a/cfb/cfballpriv.c b/cfb/cfballpriv.c index 858ff6061..3b58266c5 100644 --- a/cfb/cfballpriv.c +++ b/cfb/cfballpriv.c @@ -45,38 +45,26 @@ in this Software without prior written authorization from The Open Group. #include "mibstore.h" #if 1 || PSZ==8 -int cfbGCPrivateIndex = -1; +DevPrivateKey cfbGCPrivateKey = &cfbGCPrivateKey; #endif #ifdef CFB_NEED_SCREEN_PRIVATE -int cfbScreenPrivateIndex = -1; -static unsigned long cfbGeneration = 0; +DevPrivateKey cfbScreenPrivateKey = &cfbScreenPrivateKey; #endif Bool -cfbAllocatePrivates(ScreenPtr pScreen, int *gc_index) +cfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *gc_key) { - if (!gc_index || *gc_index == -1) + if (!gc_key || !*gc_key) { - if (!mfbAllocatePrivates(pScreen, &cfbGCPrivateIndex)) + if (!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey)) return FALSE; - if (gc_index) - *gc_index = cfbGCPrivateIndex; + if (gc_key) + *gc_key = cfbGCPrivateKey; } else { - cfbGCPrivateIndex = *gc_index; + cfbGCPrivateKey = *gc_key; } - if (!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC))) - return FALSE; -#ifdef CFB_NEED_SCREEN_PRIVATE - if (cfbGeneration != serverGeneration) - { - cfbScreenPrivateIndex = AllocateScreenPrivateIndex (); - cfbGeneration = serverGeneration; - } - if (cfbScreenPrivateIndex == -1) - return FALSE; -#endif - return TRUE; + return dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC)); } diff --git a/cfb/cfbmap.h b/cfb/cfbmap.h index d6d447555..16e4afc3c 100644 --- a/cfb/cfbmap.h +++ b/cfb/cfbmap.h @@ -140,7 +140,7 @@ cfb can not hack PSZ yet #define cfbFillSpanTileOddGeneral CFBNAME(FillSpanTileOddGeneral) #define cfbFinishScreenInit CFBNAME(FinishScreenInit) #define cfbGCFuncs CFBNAME(GCFuncs) -#define cfbGCPrivateIndex CFBNAME(GCPrivateIndex) +#define cfbGCPrivateKey CFBNAME(GCPrivateKey) #define cfbGetImage CFBNAME(GetImage) #define cfbGetScreenPixmap CFBNAME(GetScreenPixmap) #define cfbGetSpans CFBNAME(GetSpans) @@ -170,7 +170,7 @@ cfb can not hack PSZ yet #define cfbRestoreAreas CFBNAME(RestoreAreas) #define cfbSaveAreas CFBNAME(SaveAreas) #define cfbScreenInit CFBNAME(ScreenInit) -#define cfbScreenPrivateIndex CFBNAME(ScreenPrivateIndex) +#define cfbScreenPrivateKey CFBNAME(ScreenPrivateKey) #define cfbSegmentSD CFBNAME(SegmentSD) #define cfbSegmentSS CFBNAME(SegmentSS) #define cfbSetScanline CFBNAME(SetScanline) @@ -194,7 +194,7 @@ cfb can not hack PSZ yet #define cfbUnnaturalTileFS CFBNAME(UnnaturalTileFS) #define cfbValidateGC CFBNAME(ValidateGC) #define cfbVertS CFBNAME(VertS) -#define cfbWindowPrivateIndex CFBNAME(WindowPrivateIndex) +#define cfbWindowPrivateKey CFBNAME(WindowPrivateKey) #define cfbXRotatePixmap CFBNAME(XRotatePixmap) #define cfbYRotatePixmap CFBNAME(YRotatePixmap) #define cfbZeroPolyArcSS8Copy CFBNAME(ZeroPolyArcSSCopy) diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c index f5a9a41ef..1166f90b7 100644 --- a/cfb/cfbpixmap.c +++ b/cfb/cfbpixmap.c @@ -109,6 +109,7 @@ cfbDestroyPixmap(pPixmap) { if(--pPixmap->refcnt) return TRUE; + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/cfb/cfbrrop.h b/cfb/cfbrrop.h index eeb373a5e..e9ca881be 100644 --- a/cfb/cfbrrop.h +++ b/cfb/cfbrrop.h @@ -35,7 +35,8 @@ in this Software without prior written authorization from The Open Group. #endif #define RROP_FETCH_GC(gc) \ - RROP_FETCH_GCPRIV(((cfbPrivGCPtr)(gc)->devPrivates[cfbGCPrivateIndex].ptr)) + RROP_FETCH_GCPRIV((cfbPrivGCPtr)dixLookupPrivate(&(gc)->devPrivates, \ + cfbGCPrivateKey)) #ifndef RROP #define RROP GXset diff --git a/cfb/cfbscrinit.c b/cfb/cfbscrinit.c index ddfb41e6b..6f9ba2e85 100644 --- a/cfb/cfbscrinit.c +++ b/cfb/cfbscrinit.c @@ -59,7 +59,7 @@ cfbCloseScreen (index, pScreen) xfree (depths); xfree (pScreen->visuals); #ifdef CFB_NEED_SCREEN_PRIVATE - xfree (pScreen->devPrivates[cfbScreenPrivateIndex].ptr); + xfree (dixLookupPrivate(&pScreen->devPrivates, cfbScreenPrivateKey)); #else xfree (pScreen->devPrivate); #endif @@ -130,9 +130,11 @@ cfbCreateScreenResources(pScreen) Bool retval; pointer oldDevPrivate = pScreen->devPrivate; - pScreen->devPrivate = pScreen->devPrivates[cfbScreenPrivateIndex].ptr; + pScreen->devPrivate = dixLookupPrivate(&pScreen->devPrivates, + cfbScreenPrivateKey); retval = miCreateScreenResources(pScreen); - pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; + dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey, + pScreen->devPrivate); pScreen->devPrivate = oldDevPrivate; return retval; } @@ -171,7 +173,8 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width) pScreen->CloseScreen = cfbCloseScreen; #ifdef CFB_NEED_SCREEN_PRIVATE pScreen->CreateScreenResources = cfbCreateScreenResources; - pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate; + dixSetPrivate(&pScreen->devPrivates, cfbScreenPrivateKey, + pScreen->devPrivate); pScreen->devPrivate = oldDevPrivate; #endif pScreen->GetScreenPixmap = cfbGetScreenPixmap; @@ -198,7 +201,8 @@ cfbGetScreenPixmap(pScreen) ScreenPtr pScreen; { #ifdef CFB_NEED_SCREEN_PRIVATE - return (PixmapPtr)pScreen->devPrivates[cfbScreenPrivateIndex].ptr; + return (PixmapPtr)dixLookupPrivate(&pScreen->devPrivates, + cfbScreenPrivateKey); #else return (PixmapPtr)pScreen->devPrivate; #endif @@ -210,8 +214,8 @@ cfbSetScreenPixmap(pPix) { #ifdef CFB_NEED_SCREEN_PRIVATE if (pPix) - pPix->drawable.pScreen->devPrivates[cfbScreenPrivateIndex].ptr = - (pointer)pPix; + dixSetPrivate(&pPix->drawable.pScreen->devPrivates, + cfbScreenPrivateKey, pPix); #else if (pPix) pPix->drawable.pScreen->devPrivate = (pointer)pPix; diff --git a/cfb/cfbunmap.h b/cfb/cfbunmap.h index d15c23e30..db9889217 100644 --- a/cfb/cfbunmap.h +++ b/cfb/cfbunmap.h @@ -93,7 +93,7 @@ #undef cfbFillSpanTileOddGeneral #undef cfbFinishScreenInit #undef cfbGCFuncs -#undef cfbGCPrivateIndex +#undef cfbGCPrivateKey #undef cfbGetImage #undef cfbGetScreenPixmap #undef cfbGetSpans @@ -123,7 +123,7 @@ #undef cfbRestoreAreas #undef cfbSaveAreas #undef cfbScreenInit -#undef cfbScreenPrivateIndex +#undef cfbScreenPrivateKey #undef cfbSegmentSD #undef cfbSegmentSS #undef cfbSetScanline @@ -147,7 +147,7 @@ #undef cfbUnnaturalTileFS #undef cfbValidateGC #undef cfbVertS -#undef cfbWindowPrivateIndex +#undef cfbWindowPrivateKey #undef cfbXRotatePixmap #undef cfbYRotatePixmap #undef cfbZeroPolyArcSS8Copy diff --git a/cfb/cfbwindow.c b/cfb/cfbwindow.c index 234501212..50728764e 100644 --- a/cfb/cfbwindow.c +++ b/cfb/cfbwindow.c @@ -64,8 +64,8 @@ cfbCreateWindow(WindowPtr pWin) { #ifdef PIXMAP_PER_WINDOW /* Setup pointer to Screen pixmap */ - pWin->devPrivates[frameWindowPrivateIndex].ptr = - (pointer) cfbGetScreenPixmap(pWin->drawable.pScreen); + dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, + cfbGetScreenPixmap(pWin->drawable.pScreen)); #endif return TRUE; diff --git a/composite/compalloc.c b/composite/compalloc.c index dd5faa021..0372b9bfa 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -137,7 +137,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) cw->oldy = COMP_ORIGIN_INVALID; cw->damageRegistered = FALSE; cw->damaged = FALSE; - pWin->devPrivates[CompWindowPrivateIndex].ptr = cw; + dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw); } ccw->next = cw->clients; cw->clients = ccw; @@ -212,7 +212,7 @@ compFreeClientWindow (WindowPtr pWin, XID id) REGION_UNINIT (pScreen, &cw->borderClip); - pWin->devPrivates[CompWindowPrivateIndex].ptr = 0; + dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, NULL); xfree (cw); } else if (cw->update == CompositeRedirectAutomatic && @@ -297,7 +297,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update) } csw->update = CompositeRedirectAutomatic; csw->clients = 0; - pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = csw; + dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw); } /* * Redirect all existing windows @@ -312,7 +312,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update) if (!csw->clients) { xfree (csw); - pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0; + dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0); } xfree (ccw); return ret; @@ -385,7 +385,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id) */ if (!csw->clients) { - pWin->devPrivates[CompSubwindowsPrivateIndex].ptr = 0; + dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL); xfree (csw); } } diff --git a/composite/compext.c b/composite/compext.c index ece51d099..2918556f8 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -45,12 +45,13 @@ #endif #include "compint.h" +#include "xace.h" #define SERVER_COMPOSITE_MAJOR 0 #define SERVER_COMPOSITE_MINOR 4 static CARD8 CompositeReqCode; -static int CompositeClientPrivateIndex; +static DevPrivateKey CompositeClientPrivateKey = &CompositeClientPrivateKey; RESTYPE CompositeClientWindowType; RESTYPE CompositeClientSubwindowsType; static RESTYPE CompositeClientOverlayType; @@ -63,7 +64,8 @@ typedef struct _CompositeClient { int minor_version; } CompositeClientRec, *CompositeClientPtr; -#define GetCompositeClient(pClient) ((CompositeClientPtr) (pClient)->devPrivates[CompositeClientPrivateIndex].ptr) +#define GetCompositeClient(pClient) ((CompositeClientPtr) \ + dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey)) static void CompositeClientCallback (CallbackListPtr *list, @@ -156,14 +158,16 @@ static int ProcCompositeRedirectWindow (ClientPtr client) { WindowPtr pWin; + int rc; REQUEST(xCompositeRedirectWindowReq); REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client, + DixSetAttrAccess|DixManageAccess|DixBlendAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } return compRedirectWindow (client, pWin, stuff->update); } @@ -172,14 +176,16 @@ static int ProcCompositeRedirectSubwindows (ClientPtr client) { WindowPtr pWin; + int rc; REQUEST(xCompositeRedirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client, + DixSetAttrAccess|DixManageAccess|DixBlendAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } return compRedirectSubwindows (client, pWin, stuff->update); } @@ -222,14 +228,16 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client) WindowPtr pWin; CompWindowPtr cw; RegionPtr pBorderClip, pRegion; + int rc; REQUEST(xCompositeCreateRegionFromBorderClipReq); REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client, + DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } LEGAL_NEW_RESOURCE (stuff->region, client); @@ -256,14 +264,16 @@ ProcCompositeNameWindowPixmap (ClientPtr client) WindowPtr pWin; CompWindowPtr cw; PixmapPtr pPixmap; + int rc; REQUEST(xCompositeNameWindowPixmapReq); REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client, + DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } if (!pWin->viewable) @@ -428,13 +438,15 @@ ProcCompositeGetOverlayWindow (ClientPtr client) ScreenPtr pScreen; CompScreenPtr cs; CompOverlayClientPtr pOc; + int rc; REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client, + DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } pScreen = pWin->drawable.pScreen; @@ -445,6 +457,12 @@ ProcCompositeGetOverlayWindow (ClientPtr client) return BadAlloc; } } + + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id, + RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess); + if (rc != Success) + return rc; + MapWindow(cs->pOverlayWin, serverClient); /* Record that client is using this overlay window */ @@ -715,9 +733,8 @@ CompositeExtensionInit (void) if (!CompositeClientOverlayType) return; - CompositeClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (CompositeClientPrivateIndex, - sizeof (CompositeClientRec))) + if (!dixRequestPrivate(CompositeClientPrivateKey, + sizeof(CompositeClientRec))) return; if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0)) return; diff --git a/composite/compinit.c b/composite/compinit.c index 5f09fe2a4..49b2044b0 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -46,10 +46,9 @@ #include "compint.h" -int CompScreenPrivateIndex; -int CompWindowPrivateIndex; -int CompSubwindowsPrivateIndex; -static int CompGeneration; +DevPrivateKey CompScreenPrivateKey = &CompScreenPrivateKey; +DevPrivateKey CompWindowPrivateKey = &CompWindowPrivateKey; +DevPrivateKey CompSubwindowsPrivateKey = &CompSubwindowsPrivateKey; static Bool @@ -86,7 +85,7 @@ compCloseScreen (int index, ScreenPtr pScreen) cs->pOverlayWin = NULL; xfree (cs); - pScreen->devPrivates[CompScreenPrivateIndex].ptr = 0; + dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (index, pScreen); return ret; @@ -374,25 +373,6 @@ compScreenInit (ScreenPtr pScreen) { CompScreenPtr cs; - if (CompGeneration != serverGeneration) - { - CompScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (CompScreenPrivateIndex == -1) - return FALSE; - CompWindowPrivateIndex = AllocateWindowPrivateIndex (); - if (CompWindowPrivateIndex == -1) - return FALSE; - CompSubwindowsPrivateIndex = AllocateWindowPrivateIndex (); - if (CompSubwindowsPrivateIndex == -1) - return FALSE; - CompGeneration = serverGeneration; - } - if (!AllocateWindowPrivate (pScreen, CompWindowPrivateIndex, 0)) - return FALSE; - - if (!AllocateWindowPrivate (pScreen, CompSubwindowsPrivateIndex, 0)) - return FALSE; - if (GetCompScreen (pScreen)) return TRUE; cs = (CompScreenPtr) xalloc (sizeof (CompScreenRec)); @@ -457,7 +437,7 @@ compScreenInit (ScreenPtr pScreen) cs->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = compCloseScreen; - pScreen->devPrivates[CompScreenPrivateIndex].ptr = (pointer) cs; + dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs); RegisterRealChildHeadProc(CompositeRealChildHead); diff --git a/composite/compint.h b/composite/compint.h index 535e1a423..4b0fe0834 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -64,6 +64,7 @@ #include "globals.h" #include "picturestr.h" #include "extnsionst.h" +#include "privates.h" #include "mi.h" #include "damage.h" #include "damageextint.h" @@ -158,13 +159,16 @@ typedef struct _CompScreen { } CompScreenRec, *CompScreenPtr; -extern int CompScreenPrivateIndex; -extern int CompWindowPrivateIndex; -extern int CompSubwindowsPrivateIndex; +extern DevPrivateKey CompScreenPrivateKey; +extern DevPrivateKey CompWindowPrivateKey; +extern DevPrivateKey CompSubwindowsPrivateKey; -#define GetCompScreen(s) ((CompScreenPtr) ((s)->devPrivates[CompScreenPrivateIndex].ptr)) -#define GetCompWindow(w) ((CompWindowPtr) ((w)->devPrivates[CompWindowPrivateIndex].ptr)) -#define GetCompSubwindows(w) ((CompSubwindowsPtr) ((w)->devPrivates[CompSubwindowsPrivateIndex].ptr)) +#define GetCompScreen(s) ((CompScreenPtr) \ + dixLookupPrivate(&(s)->devPrivates, CompScreenPrivateKey)) +#define GetCompWindow(w) ((CompWindowPtr) \ + dixLookupPrivate(&(w)->devPrivates, CompWindowPrivateKey)) +#define GetCompSubwindows(w) ((CompSubwindowsPtr) \ + dixLookupPrivate(&(w)->devPrivates, CompSubwindowsPrivateKey)) extern RESTYPE CompositeClientWindowType; extern RESTYPE CompositeClientSubwindowsType; diff --git a/composite/compwindow.c b/composite/compwindow.c index 579236713..ee0f7d270 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -165,6 +165,29 @@ compCheckRedirect (WindowPtr pWin) return TRUE; } +static int +updateOverlayWindow(ScreenPtr pScreen) +{ + CompScreenPtr cs; + WindowPtr pWin; /* overlay window */ + XID vlist[2]; + + cs = GetCompScreen(pScreen); + if ((pWin = cs->pOverlayWin) != NULL) { + if ((pWin->drawable.width == pScreen->width) && + (pWin->drawable.height == pScreen->height)) + return Success; + + /* Let's resize the overlay window. */ + vlist[0] = pScreen->width; + vlist[1] = pScreen->height; + return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin)); + } + + /* Let's be on the safe side and not assume an overlay window is always allocated. */ + return Success; +} + Bool compPositionWindow (WindowPtr pWin, int x, int y) { @@ -203,6 +226,8 @@ compPositionWindow (WindowPtr pWin, int x, int y) cs->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = compPositionWindow; compCheckTree (pWin->drawable.pScreen); + if (updateOverlayWindow(pScreen) != Success) + ret = FALSE; return ret; } diff --git a/config/dbus-core.c b/config/dbus-core.c index eab72a530..b349c6e3c 100644 --- a/config/dbus-core.c +++ b/config/dbus-core.c @@ -56,8 +56,9 @@ wakeup_handler(pointer data, int err, pointer read_mask) if (info->connection && FD_ISSET(info->fd, (fd_set *) read_mask)) { do { dbus_connection_read_write_dispatch(info->connection, 0); - } while (dbus_connection_get_dispatch_status(info->connection) == - DBUS_DISPATCH_DATA_REMAINS); + } while (info->connection && + dbus_connection_get_is_connected(info->connection) && + dbus_connection_get_dispatch_status(info->connection) == DBUS_DISPATCH_DATA_REMAINS); } } @@ -76,7 +77,7 @@ teardown(void) struct config_dbus_core_hook *hook; if (bus_info.timer) { - TimerCancel(bus_info.timer); + TimerFree(bus_info.timer); bus_info.timer = NULL; } @@ -116,6 +117,8 @@ message_filter(DBusConnection *connection, DBusMessage *message, void *data) bus_info.connection = NULL; teardown(); + if (bus_info.timer) + TimerFree(bus_info.timer); bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL); return DBUS_HANDLER_RESULT_HANDLED; @@ -186,6 +189,7 @@ static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg) { if (connect_to_bus()) { + TimerFree(bus_info.timer); bus_info.timer = NULL; return 0; } diff --git a/config/dbus.c b/config/dbus.c index 6fe061815..0be42afb6 100644 --- a/config/dbus.c +++ b/config/dbus.c @@ -213,7 +213,7 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error) MALFORMED_MESSAGE_ERROR(); } - dev = LookupDeviceIntRec(deviceid); + dixLookupDevice(&dev, deviceid, serverClient, DixUnknownAccess); if (!dev) { DebugF("[config/dbus] bogus device id %d given\n", deviceid); ret = BadMatch; @@ -396,9 +396,6 @@ err_start: static void disconnect_hook(void *data) { - struct connection_info *info = data; - - reset_info(info); } #if 0 @@ -440,4 +437,6 @@ void config_dbus_fini(void) { config_dbus_core_remove_hook(&core_hook); + connection_data.busname[0] = '\0'; + connection_data.busobject[0] = '\0'; } diff --git a/config/hal.c b/config/hal.c index 6bb449d5a..1575422c3 100644 --- a/config/hal.c +++ b/config/hal.c @@ -92,6 +92,8 @@ add_option(InputOption **options, const char *key, const char *value) for (; *options; options = &(*options)->next) ; *options = xcalloc(sizeof(**options), 1); + if (!*options) /* Yeesh. */ + return; (*options)->key = xstrdup(key); (*options)->value = xstrdup(value); (*options)->next = NULL; @@ -103,7 +105,7 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name) char *prop, *ret; prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL); - DebugF(" [config/hal] getting %s on %s returned %s\n", name, udi, prop); + DebugF("[config/hal] getting %s on %s returned %s\n", name, udi, prop); if (prop) { ret = xstrdup(prop); libhal_free_string(prop); @@ -134,10 +136,11 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop) str = ret; for (i = 0; props[i]; i++) { - str = strcpy(str, props[i]); + strcpy(str, props[i]); + str += strlen(props[i]); *str++ = ','; } - *str = '\0'; + *(str-1) = '\0'; libhal_free_string_array(props); } @@ -155,7 +158,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL; char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL; char *xkb_options = NULL, *config_info = NULL; - InputOption *options = NULL; + InputOption *options = NULL, *tmpo = NULL; DeviceIntPtr dev; DBusError error; int type = TYPE_NONE; @@ -220,6 +223,8 @@ device_added(LibHalContext *hal_ctx, const char *udi) goto unwind; sprintf(config_info, "hal:%s", udi); + if (xkb_rules) + add_option(&options, "xkb_rules", xkb_rules); if (xkb_model) add_option(&options, "xkb_model", xkb_model); if (xkb_layout) @@ -229,8 +234,10 @@ device_added(LibHalContext *hal_ctx, const char *udi) if (xkb_options) add_option(&options, "xkb_options", xkb_options); + DebugF("[config/hal] Adding device %s\n", name); if (NewInputDeviceRequest(options, &dev) != Success) { - DebugF("[config/hal] NewInputDeviceRequest failed\n"); + ErrorF("[config/hal] NewInputDeviceRequest failed\n"); + dev = NULL; goto unwind; } @@ -250,10 +257,18 @@ unwind: xfree(xkb_model); if (xkb_layout) xfree(xkb_layout); + if (xkb_variant) + xfree(xkb_variant); if (xkb_options) xfree(xkb_options); if (config_info) xfree(config_info); + while (!dev && (tmpo = options)) { + options = tmpo->next; + xfree(tmpo->key); + xfree(tmpo->value); + xfree(tmpo); + } out_error: dbus_error_free(&error); @@ -268,12 +283,14 @@ disconnect_hook(void *data) struct config_hal_info *info = data; if (info->hal_ctx) { - dbus_error_init(&error); - if (!libhal_ctx_shutdown(info->hal_ctx, &error)) - DebugF("[config/hal] couldn't shut down context: %s (%s)\n", - error.name, error.message); + if (dbus_connection_get_is_connected(info->system_bus)) { + dbus_error_init(&error); + if (!libhal_ctx_shutdown(info->hal_ctx, &error)) + DebugF("[config/hal] couldn't shut down context: %s (%s)\n", + error.name, error.message); + dbus_error_free(&error); + } libhal_ctx_free(info->hal_ctx); - dbus_error_free(&error); } info->hal_ctx = NULL; diff --git a/configure.ac b/configure.ac index f58b9712e..bc30d57d7 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([xorg-server], 1.4.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +AC_INIT([xorg-server], 1.4.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([dist-bzip2 foreign]) AM_MAINTAINER_MODE @@ -66,6 +66,8 @@ AC_SYS_LARGEFILE XORG_PROG_RAWCPP dnl Check for dtrace program (needed to build Xserver dtrace probes) +dnl Also checks for <sys/sdt.h>, since some Linux distros have an +dnl ISDN trace program named dtrace AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH], [Enable dtrace probes (default: enabled if dtrace found)]), [WDTRACE=$withval], [WDTRACE=auto]) @@ -82,6 +84,11 @@ if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then AC_MSG_FAILURE([dtrace requested but not found]) fi WDTRACE="no" + else + AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"]) + if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then + WDTRACE="no" + fi fi fi if test "x$WDTRACE" != "xno" ; then @@ -90,13 +97,6 @@ if test "x$WDTRACE" != "xno" ; then fi AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"]) -# DTrace support uses XErrorDB to get request names -AC_ARG_WITH(xerrordb, - AS_HELP_STRING([--with-xerrordb=PATH], [Path to XErrorDB file (default: ${datadir}/X11/XErrorDB)]), - [ XERRORDB_PATH="$withval" ], - [ XERRORDB_PATH="${datadir}/X11/XErrorDB" ]) -AC_DEFINE_DIR(XERRORDB_PATH, XERRORDB_PATH, [Path to XErrorDB file]) - AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h]) @@ -304,6 +304,7 @@ case $host_cpu in *freebsd*) SYS_LIBS=-lio ;; *netbsd*) AC_DEFINE(USE_ALPHA_PIO, 1, [NetBSD PIO alpha IO]) ;; esac + GLX_ARCH_DEFINES="-D__GLX_ALIGN64 -mieee" ;; arm*) ARM_VIDEO=yes @@ -333,6 +334,7 @@ case $host_cpu in xorg_loader_sparcmuldiv="yes" SPARC64_VIDEO=yes BSD_ARCH_SOURCES="sparc64_video.c ioperm_noop.c" + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" ;; x86_64*|amd64*) use_x86_asm="yes" @@ -347,8 +349,16 @@ case $host_cpu in SYS_LIBS=-lamd64 ;; esac + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" + ;; + ia64*) + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" + ;; + s390*) + GLX_ARCH_DEFINES="-D__GLX_ALIGN64" ;; esac +AC_SUBST(GLX_ARCH_DEFINES) dnl BSD *_video.c selection AM_CONDITIONAL(ALPHA_VIDEO, [test "x$ALPHA_VIDEO" = xyes]) @@ -358,6 +368,7 @@ AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes]) AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes]) DRI=no +DRI2=no KDRIVE_HW=no dnl it would be nice to autodetect these *CONS_SUPPORTs case $host_os in @@ -370,6 +381,7 @@ case $host_os in AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console]) AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console]) DRI=yes + DRI2=yes ;; *netbsd*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) @@ -377,6 +389,7 @@ case $host_os in AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console]) AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console]) DRI=yes + DRI2=yes ;; *openbsd*) AC_DEFINE(CSRG_BASED, 1, [System is BSD-like]) @@ -385,6 +398,7 @@ case $host_os in ;; *linux*) DRI=yes + DRI2=yes KDRIVE_HW=yes ;; *solaris*) @@ -468,20 +482,19 @@ AC_ARG_WITH(xkb-path, AS_HELP_STRING([--with-xkb-path=PATH], [Path to XK AC_ARG_WITH(xkb-output, AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]), [ XKBOUTPUT="$withval" ], [ XKBOUTPUT="compiled" ]) -AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH], [Path to server config (default: ${libdir}/xserver)]), +AC_ARG_WITH(serverconfig-path, AS_HELP_STRING([--with-serverconfig-path=PATH], + [Directory where ancillary server config files are installed (default: ${libdir}/xorg)]), [ SERVERCONFIG="$withval" ], - [ SERVERCONFIG="${libdir}/xserver" ]) -APPLE_APPLICATIONS_DIR="/Applications/Utilities" + [ SERVERCONFIG="${libdir}/xorg" ]) AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: /Applications/Utilities)]), - [ APPLE_APPLICATIONS_DIR="${withval}" ]. + [ APPLE_APPLICATIONS_DIR="${withval}" ], [ APPLE_APPLICATIONS_DIR="/Applications/Utilities" ]) - +AC_SUBST([APPLE_APPLICATIONS_DIR]) AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto]) - -AC_ARG_WITH(pci-txt-ids-dir, AS_HELP_STRING([--with-pci-txt-ids-dir=PATH], -[Path to pci id directory (default: ${datadir}/X11/pci)]), - [ PCI_TXT_IDS_DIR="$withval" ], - [ PCI_TXT_IDS_DIR="${datadir}/X11/pci" ]) +AC_ARG_WITH(launchagents-dir,AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]), + [ launchagentsdir="${withval}" ], + [ launchagentsdir="/Library/LaunchAgents" ]) +AC_SUBST([launchagentsdir]) AC_ARG_ENABLE(builddocs, AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]), [BUILDDOCS=$enableval], [BUILDDOCS=no]) @@ -512,11 +525,12 @@ AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with [GLX_USE_TLS=no]) dnl Extensions. +AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes]) AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes]) AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes]) AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes]) AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes]) -AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes]) +AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: disabled)]), [RECORD=$enableval], [RECORD=no]) AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes]) AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes]) AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto]) @@ -525,12 +539,14 @@ AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP ext AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto]) AC_ARG_ENABLE(glx, AS_HELP_STRING([--disable-glx], [Build GLX extension (default: enabled)]), [GLX=$enableval], [GLX=yes]) AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval]) +AC_ARG_ENABLE(dri2, AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval]) AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes]) AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto]) AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto]) AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes]) -AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=$XACE]) -AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY]) +AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--disable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no]) +AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no]) +AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: disabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY]) AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no]) AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no]) AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes]) @@ -760,6 +776,10 @@ if test "x$XVMC" = xyes; then AC_DEFINE(XvMCExtension, 1, [Build XvMC extension]) fi +AM_CONDITIONAL(XREGISTRY, [test "x$XREGISTRY" = xyes]) +if test "x$XREGISTRY" = xyes; then + AC_DEFINE(XREGISTRY, 1, [Build registry module]) +fi AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes]) if test "x$COMPOSITE" = xyes; then @@ -850,6 +870,14 @@ if test "x$DRI" = xyes; then AC_SUBST(GL_CFLAGS) fi +AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes) +if test "x$DRI2" = xyes; then + # FIXME: Bump the versions once we have releases of these. + AC_DEFINE(DRI2, 1, [Build DRI2 extension]) + PKG_CHECK_MODULES([DRIPROTO], [xf86driproto >= 2.0.3]) + PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1]) +fi + AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes]) if test "x$XINERAMA" = xyes; then AC_DEFINE(XINERAMA, 1, [Support Xinerama extension]) @@ -862,6 +890,19 @@ if test "x$XACE" = xyes; then AC_DEFINE(XACE, 1, [Build X-ACE extension]) fi +AM_CONDITIONAL(XSELINUX, [test "x$XSELINUX" = xyes]) +if test "x$XSELINUX" = xyes; then + if test "x$XACE" != xyes; then + AC_MSG_ERROR([cannot build SELinux extension without X-ACE]) + fi + AC_CHECK_HEADERS([selinux/selinux.h selinux/avc.h], [], AC_MSG_ERROR([SELinux include files not found])) + AC_CHECK_LIB(selinux, avc_init, [], AC_MSG_ERROR([SELinux library not found])) + AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers])) + AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library])) + AC_DEFINE(XSELINUX, 1, [Build SELinux extension]) + SELINUX_LIB="-lselinux -laudit" +fi + AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes]) if test "x$XCSECURITY" = xyes; then if test "x$XACE" != xyes; then @@ -1024,7 +1065,7 @@ fi AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path]) AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path]) -AC_DEFINE_DIR(SERVERCONFIGdir, SERVERCONFIG, [Server config path]) +AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path]) AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path]) AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path]) AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name]) @@ -1063,7 +1104,6 @@ AC_DEFINE(XTEST, 1, [Support XTest extension]) AC_DEFINE(XSYNC, 1, [Support XSync extension]) AC_DEFINE(XCMISC, 1, [Support XCMisc extension]) AC_DEFINE(BIGREQS, 1, [Support BigRequests extension]) -AC_DEFINE(PIXPRIV, 1, [Support pixmap privates]) if test "x$WDTRACE" != "xno" ; then DIX_LIB='$(top_builddir)/dix/dix.O' @@ -1111,10 +1151,6 @@ XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${LIBCRYPTO}" AC_SUBST([XSERVER_LIBS]) AC_SUBST([XSERVER_SYS_LIBS]) -if test "x$HAVE_LAUNCHD" = xyes; then - XSERVER_CFLAGS="$XSERVER_CFLAGS -DHAVE_LAUNCHD" -fi - # The Xorg binary needs to export symbols so that they can be used from modules # Some platforms require extra flags to do this. gcc should set these flags # when -rdynamic is passed to it, other compilers/linkers may need to be added @@ -1291,7 +1327,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then XORG_OSINCS='-I$(top_srcdir)/hw/xfree86/os-support -I$(top_srcdir)/hw/xfree86/os-support/bus -I$(top_srcdir)/os' XORG_INCS="$XORG_DDXINCS $XORG_OSINCS" XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H" - XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB" + XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $SELINUX_LIB" PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0]) XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS" @@ -1703,75 +1739,42 @@ fi if test "x$XQUARTZ" = xyes; then AC_DEFINE([XQUARTZ],[1],[Have Quartz]) -# glxAGL / glxCGL don't work yet -# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[ -# save_LDFLAGS=$LDFLAGS -# LDFLAGS="$LDFLAGS -framework AGL" -# AC_LINK_IFELSE([char aglEnable(); -#int main() { -#aglEnable(); -#return 0;} -# ],[xorg_cv_AGL_framework=yes], -# [xorg_cv_AGL_framework=no]) -# LDFLAGS=$save_LDFLAGS -# ]) - xorg_cv_AGL_framework=no - DARWIN_GLX_LIBS='$(top_builddir)/GL/apple/indirect.o $(top_builddir)/GL/glx/libglx.la' - DARWIN_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB" - AC_SUBST([DARWIN_LIBS]) - AC_CHECK_LIB([Xplugin],[xp_init],[:]) - AC_SUBST([APPLE_APPLICATIONS_DIR]) - CFLAGS="${CFLAGS} -D__DARWIN__ -DROOTLESS_WORKAROUND" - PLIST_VERSION_STRING=$PACKAGE_VERSION - AC_SUBST([PLIST_VERSION_STRING]) - PLIST_VENDOR_WEB=$VENDOR_WEB - AC_SUBST([PLIST_VENDOR_WEB]) - if test "x$XF86MISC" = xyes || test "x$XF86MISC" = xauto; then - AC_MSG_NOTICE([Disabling XF86Misc extension]) - XF86MISC=no - fi - if test "x$XF86VIDMODE" = xyes || test "x$XF86VIDMODE" = xauto; then - AC_MSG_NOTICE([Disabling XF86VidMode extension]) - XF86VIDMODE=no - fi - if test "x$XF86BIGFONT" = xyes || test "x$XF86BIGFONT" = xauto; then - AC_MSG_NOTICE([Disabling XF86BigFont extension]) - XF86BIGFONT=no - fi - if test "x$DGA" = xyes || test "x$DGA" = xauto; then - AC_MSG_NOTICE([Disabling DGA extension]) - DGA=no - fi - if test "x$DMX" = xyes || test "x$DMX" = xauto; then - AC_MSG_NOTICE([Disabling DMX DDX]) - DMX=no - fi -fi - -if test "x$X11APP" = xauto; then - AC_MSG_CHECKING([whether to build X11.app]) - if test "x$XQUARTZ" = xyes ; then - X11APP=yes - else - X11APP=no +#glxAGL / glxCGL don't work yet +# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[ +# save_LDFLAGS=$LDFLAGS +# LDFLAGS="$LDFLAGS -framework AGL" +# AC_LINK_IFELSE( +# [char aglEnable(); int main() { aglEnable(); return 0;}], +# [xorg_cv_AGL_framework=yes], +# [xorg_cv_AGL_framework=no]) +# LDFLAGS=$save_LDFLAGS +# ]) + xorg_cv_AGL_framework=no + DARWIN_GLX_LIBS='$(top_builddir)/GL/apple/indirect.o $(top_builddir)/GL/glx/libglx.la' + DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB" + AC_SUBST([DARWIN_LIBS]) + AC_CHECK_LIB([Xplugin],[xp_init],[:]) + CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DNO_ALLOCA" + if test "x$XF86MISC" = xyes || test "x$XF86MISC" = xauto; then + AC_MSG_NOTICE([Disabling XF86Misc extension]) + XF86MISC=no fi - AC_MSG_RESULT([$X11APP]) -fi - -if test "x$LAUNCHD" = xauto; then - # Do we want to have this default to on for Xquartz builds only or any time we have launchd (like Xnest or Xvfb on OS-X) - #AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no]) - AC_MSG_CHECKING([whether to support launchd]) - if test "x$XQUARTZ" = xyes ; then - LAUNCHD=yes - else - LAUNCHD=no + if test "x$XF86VIDMODE" = xyes || test "x$XF86VIDMODE" = xauto; then + AC_MSG_NOTICE([Disabling XF86VidMode extension]) + XF86VIDMODE=no + fi + if test "x$XF86BIGFONT" = xyes || test "x$XF86BIGFONT" = xauto; then + AC_MSG_NOTICE([Disabling XF86BigFont extension]) + XF86BIGFONT=no + fi + if test "x$DGA" = xyes || test "x$DGA" = xauto; then + AC_MSG_NOTICE([Disabling DGA extension]) + DGA=no + fi + if test "x$DMX" = xyes || test "x$DMX" = xauto; then + AC_MSG_NOTICE([Disabling DMX DDX]) + DMX=no fi - AC_MSG_RESULT([$LAUNCHD]) -fi - -if test "x$LAUNCHD" = xyes ; then - AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available]) fi # Support for objc in autotools is minimal and not documented. @@ -1788,55 +1791,77 @@ _AM_DEPENDENCIES([OBJC]) AM_CONDITIONAL(HAVE_XPLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes]) AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes]) AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes]) + +if test "x$X11APP" = xauto; then + AC_MSG_CHECKING([whether to build X11.app]) + if test "x$XQUARTZ" = xyes ; then + X11APP=yes + else + X11APP=no + fi + AC_MSG_RESULT([$X11APP]) +fi AM_CONDITIONAL(X11APP,[test "X$X11APP" = Xyes]) -dnl DMX DDX +if test "x$LAUNCHD" = "xauto"; then + if test "x$XQUARTZ" = "xyes" ; then + LAUNCHD=yes + else + unset LAUNCHD + AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no]) + fi +fi + +if test "x$LAUNCHD" = "xyes" ; then + AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available]) +fi +AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"]) AC_MSG_CHECKING([whether to build Xdmx DDX]) PKG_CHECK_MODULES([DMXMODULES], [xmuu xext x11 xrender xfixes xfont xi dmxproto xau $XDMCP_MODULES], [have_dmx=yes], [have_dmx=no]) if test "x$DMX" = xauto; then - DMX="$have_dmx" + DMX="$have_dmx" fi AC_MSG_RESULT([$DMX]) AM_CONDITIONAL(DMX, [test "x$DMX" = xyes]) if test "x$DMX" = xyes; then - if test "x$have_dmx" = xno; then - AC_MSG_ERROR([Xdmx build explicitly requested, but required - modules not found.]) - fi - DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC" - XDMX_CFLAGS="$DMXMODULES_CFLAGS" - XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB" - XDMX_SYS_LIBS="$DMXMODULES_LIBS" - AC_SUBST([XDMX_CFLAGS]) - AC_SUBST([XDMX_LIBS]) - AC_SUBST([XDMX_SYS_LIBS]) + if test "x$have_dmx" = xno; then + AC_MSG_ERROR([Xdmx build explicitly requested, but required + modules not found.]) + fi + DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC" + XDMX_CFLAGS="$DMXMODULES_CFLAGS" + XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB" + XDMX_SYS_LIBS="$DMXMODULES_LIBS" + AC_SUBST([XDMX_CFLAGS]) + AC_SUBST([XDMX_LIBS]) + AC_SUBST([XDMX_SYS_LIBS]) dnl USB sources in DMX require <linux/input.h> - AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes", - DMX_BUILD_USB="no") + AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes", + DMX_BUILD_USB="no") dnl Linux sources in DMX require <linux/keyboard.h> - AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes", - DMX_BUILD_LNX="no") - if test "x$GLX" = xyes; then - PKG_CHECK_MODULES([GL], [glproto]) - fi - PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11]) - AC_SUBST(XDMXCONFIG_DEP_CFLAGS) - AC_SUBST(XDMXCONFIG_DEP_LIBS) - PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [dmx xext x11]) - AC_SUBST(DMXEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [dmx xmu xext x11]) - AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [dmx xi xext x11]) - AC_SUBST(DMXXIEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [xtst xext x11]) - AC_SUBST(XTSTEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres xext x11]) - AC_SUBST(XRESEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([X11EXAMPLES_DEP], [xext x11]) - AC_SUBST(X11EXAMPLES_DEP_LIBS) + AC_CHECK_HEADER([linux/keyboard.h], DMX_BUILD_LNX="yes", + DMX_BUILD_LNX="no") + if test "x$GLX" = xyes; then + PKG_CHECK_MODULES([GL], [glproto]) + fi + PKG_CHECK_MODULES([XDMXCONFIG_DEP], [xaw7 xmu xt xpm x11]) + AC_SUBST(XDMXCONFIG_DEP_CFLAGS) + AC_SUBST(XDMXCONFIG_DEP_LIBS) + PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [dmx xext x11]) + AC_SUBST(DMXEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [dmx xmu xext x11]) + AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [dmx xi xext x11]) + AC_SUBST(DMXXIEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [xtst xext x11]) + AC_SUBST(XTSTEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres xext x11]) + AC_SUBST(XRESEXAMPLES_DEP_LIBS) + PKG_CHECK_MODULES([X11EXAMPLES_DEP], [xext x11]) + AC_SUBST(X11EXAMPLES_DEP_LIBS) fi AM_CONDITIONAL([DMX_BUILD_LNX], [test "x$DMX_BUILD_LNX" = xyes]) AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes]) @@ -1905,7 +1930,7 @@ if test "$KDRIVE" = yes; then XEPHYR=$xephyr fi XEPHYR_DRI=no - if test x$XEPHYR = xyes -a x$DRI = xyes; then + if test x$XEPHYR = xyes -a x$DRI = xyes && test "x$GLX" = xyes; then XEPHYR_DRI=yes XEPHYR_DRI_LIBS=-lGL AC_SUBST(XEPHYR_DRI_LIBS) @@ -2135,6 +2160,7 @@ hw/xfree86/doc/devel/Makefile hw/xfree86/doc/man/Makefile hw/xfree86/doc/sgml/Makefile hw/xfree86/dri/Makefile +hw/xfree86/dri2/Makefile hw/xfree86/dummylib/Makefile hw/xfree86/exa/Makefile hw/xfree86/glucose/Makefile @@ -2189,11 +2215,9 @@ hw/xgl/glxext/Makefile hw/xgl/glxext/module/Makefile hw/xnest/Makefile hw/xwin/Makefile -hw/darwin/Makefile -hw/darwin/apple/Makefile -hw/darwin/launcher/Makefile -hw/darwin/quartz/Makefile -hw/darwin/quartz/xpr/Makefile +hw/xquartz/Makefile +hw/xquartz/bundle/Makefile +hw/xquartz/xpr/Makefile hw/kdrive/Makefile hw/kdrive/ati/Makefile hw/kdrive/chips/Makefile diff --git a/damageext/damageext.c b/damageext/damageext.c index e1724ecc7..517c72dac 100755 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -29,7 +29,7 @@ static unsigned char DamageReqCode; static int DamageEventBase; static int DamageErrorBase; -static int DamageClientPrivateIndex; +static DevPrivateKey DamageClientPrivateKey = &DamageClientPrivateKey; static RESTYPE DamageExtType; static RESTYPE DamageExtWinType; @@ -185,7 +185,7 @@ ProcDamageCreate (ClientPtr client) REQUEST_SIZE_MATCH(xDamageCreateReq); LEGAL_NEW_RESOURCE(stuff->damage, client); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixReadAccess); + DixGetAttrAccess|DixReadAccess); if (rc != Success) return rc; @@ -295,7 +295,7 @@ ProcDamageAdd (ClientPtr client) REQUEST_SIZE_MATCH(xDamageAddReq); VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixReadAccess); + DixWriteAccess); if (rc != Success) return rc; @@ -511,9 +511,7 @@ DamageExtensionInit(void) if (!DamageExtWinType) return; - DamageClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (DamageClientPrivateIndex, - sizeof (DamageClientRec))) + if (!dixRequestPrivate(DamageClientPrivateKey, sizeof (DamageClientRec))) return; if (!AddCallback (&ClientStateCallback, DamageClientCallback, 0)) return; diff --git a/damageext/damageextint.h b/damageext/damageextint.h index dfafc9319..e06f28c4e 100644 --- a/damageext/damageextint.h +++ b/damageext/damageextint.h @@ -48,7 +48,7 @@ typedef struct _DamageClient { int critical; } DamageClientRec, *DamageClientPtr; -#define GetDamageClient(pClient) ((DamageClientPtr) (pClient)->devPrivates[DamageClientPrivateIndex].ptr) +#define GetDamageClient(pClient) ((DamageClientPtr)dixLookupPrivate(&(pClient)->devPrivates, DamageClientPrivateKey)) typedef struct _DamageExt { DamagePtr pDamage; @@ -54,23 +54,21 @@ #define NEED_DBE_PROTOCOL #include "dbestruct.h" #include "midbe.h" +#include "xace.h" /* GLOBALS */ /* Per-screen initialization functions [init'ed by DbeRegisterFunction()] */ -static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */ +static Bool (* DbeInitFunct[MAXSCREENS])(); /* pScreen, pDbeScreenPriv */ /* These are static globals copied to DBE's screen private for use by DDX */ -static int dbeScreenPrivIndex; -static int dbeWindowPrivIndex; +static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKey; +static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKey; /* These are static globals copied to DBE's screen private for use by DDX */ static RESTYPE dbeDrawableResType; static RESTYPE dbeWindowPrivResType; -/* This global is used by DbeAllocWinPrivPrivIndex() */ -static int winPrivPrivCount = 0; - /* Used to generate DBE's BadBuffer error. */ static int dbeErrorBase; @@ -115,126 +113,6 @@ DbeRegisterFunction(ScreenPtr pScreen, Bool (*funct) (/* ??? */)) /****************************************************************************** * - * DBE DIX Procedure: DbeAllocWinPriv - * - * Description: - * - * This function was cloned from AllocateWindow() in window.c. - * This function allocates a window priv structure to be associated - * with a double-buffered window. - * - *****************************************************************************/ -static DbeWindowPrivPtr -DbeAllocWinPriv(ScreenPtr pScreen) -{ - DbeWindowPrivPtr pDbeWindowPriv; - DbeScreenPrivPtr pDbeScreenPriv; - register char *ptr; - register DevUnion *ppriv; - register unsigned int *sizes; - register unsigned int size; - register int i; - - pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(pDbeScreenPriv->totalWinPrivSize); - - if (pDbeWindowPriv) - { - ppriv = (DevUnion *)(pDbeWindowPriv + 1); - pDbeWindowPriv->devPrivates = ppriv; - sizes = pDbeScreenPriv->winPrivPrivSizes; - ptr = (char *)(ppriv + pDbeScreenPriv->winPrivPrivLen); - for (i = pDbeScreenPriv->winPrivPrivLen; --i >= 0; ppriv++, sizes++) - { - if ((size = *sizes)) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } - } - - return(pDbeWindowPriv); - -} /* DbeAllocWinPriv() */ - - -/****************************************************************************** - * - * DBE DIX Procedure: DbeAllocWinPrivPrivIndex - * - * Description: - * - * This function was cloned from AllocateWindowPrivateIndex() in window.c. - * This function allocates a new window priv priv index by simply returning - * an incremented private counter. - * - *****************************************************************************/ - -static int -DbeAllocWinPrivPrivIndex(void) -{ - return winPrivPrivCount++; - -} /* DbeAllocWinPrivPrivIndex() */ - - -/****************************************************************************** - * - * DBE DIX Procedure: DbeAllocWinPrivPriv - * - * Description: - * - * This function was cloned from AllocateWindowPrivate() in privates.c. - * This function allocates a private structure to be hung off - * a window private. - * - *****************************************************************************/ - -static Bool -DbeAllocWinPrivPriv(register ScreenPtr pScreen, int index, unsigned int amount) -{ - DbeScreenPrivPtr pDbeScreenPriv; - unsigned int oldamount; - - - pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - - if (index >= pDbeScreenPriv->winPrivPrivLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(pDbeScreenPriv->winPrivPrivSizes, - (index + 1) * sizeof(unsigned)); - if (!nsizes) - { - return(FALSE); - } - - while (pDbeScreenPriv->winPrivPrivLen <= index) - { - nsizes[pDbeScreenPriv->winPrivPrivLen++] = 0; - pDbeScreenPriv->totalWinPrivSize += sizeof(DevUnion); - } - - pDbeScreenPriv->winPrivPrivSizes = nsizes; - } - - oldamount = pDbeScreenPriv->winPrivPrivSizes[index]; - - if (amount > oldamount) - { - pDbeScreenPriv->winPrivPrivSizes[index] = amount; - pDbeScreenPriv->totalWinPrivSize += (amount - oldamount); - } - return(TRUE); - -} /* DbeAllocWinPrivPriv() */ - - -/****************************************************************************** - * * DBE DIX Procedure: DbeStubScreen * * Description: @@ -249,9 +127,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens) { /* Stub DIX. */ pDbeScreenPriv->SetupBackgroundPainter = NULL; - pDbeScreenPriv->AllocWinPriv = NULL; - pDbeScreenPriv->AllocWinPrivPrivIndex = NULL; - pDbeScreenPriv->AllocWinPrivPriv = NULL; /* Do not unwrap PositionWindow nor DestroyWindow. If the DDX * initialization function failed, we assume that it did not wrap @@ -359,7 +234,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq); /* The window must be valid. */ - status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + status = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); if (status != Success) return status; @@ -419,11 +294,10 @@ ProcDbeAllocateBackBufferName(ClientPtr client) * Allocate a window priv. */ - if (!(pDbeWindowPriv = - (*pDbeScreenPriv->AllocWinPriv)(pWin->drawable.pScreen))) - { + pDbeWindowPriv = (DbeWindowPrivPtr)xalloc(sizeof(DbeWindowPrivRec)); + if (!pDbeWindowPriv) return(BadAlloc); - } + bzero(pDbeWindowPriv, sizeof(DbeWindowPrivRec)); /* Make the window priv a DBE window priv resource. */ if (!AddResource(stuff->buffer, dbeWindowPrivResType, @@ -454,7 +328,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) /* Actually connect the window priv to the window. */ - pWin->devPrivates[dbeWindowPrivIndex].ptr = (pointer)pDbeWindowPriv; + dixSetPrivate(&pWin->devPrivates, dbeWindowPrivKey, pDbeWindowPriv); } /* if -- There is no buffer associated with the window. */ @@ -847,7 +721,7 @@ ProcDbeGetVisualInfo(ClientPtr client) for (i = 0; i < stuff->n; i++) { rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0, - DixReadAccess); + DixGetAttrAccess); if (rc != Success) { Xfree(pDrawables); return rc; @@ -875,7 +749,9 @@ ProcDbeGetVisualInfo(ClientPtr client) pDrawables[i]->pScreen; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i])) + rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess); + if ((rc != Success) || + !(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i])) { /* We failed to alloc pScrVisInfo[i].visinfo. */ @@ -891,7 +767,7 @@ ProcDbeGetVisualInfo(ClientPtr client) Xfree(pDrawables); } - return(BadAlloc); + return (rc == Success) ? BadAlloc : rc; } /* Account for n, number of xDbeVisInfo items in list. */ @@ -1004,7 +880,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client) REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq); if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, - stuff->buffer, dbeWindowPrivResType, DixReadAccess))) + stuff->buffer, dbeWindowPrivResType, DixGetAttrAccess))) { rep.attributes = None; } @@ -1572,10 +1448,11 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id) if (pDbeWindowPriv->nBufferIDs == 0) { /* Reset the DBE window priv pointer. */ - pDbeWindowPriv->pWindow->devPrivates[dbeWindowPrivIndex].ptr = - (pointer)NULL; + dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey, + NULL); /* We are done with the window priv. */ + dixFreePrivates(pDbeWindowPriv->devPrivates); xfree(pDbeWindowPriv); } @@ -1602,12 +1479,6 @@ DbeResetProc(ExtensionEntry *extEntry) ScreenPtr pScreen; DbeScreenPrivPtr pDbeScreenPriv; - - if (dbeScreenPrivIndex < 0) - { - return; - } - for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; @@ -1621,11 +1492,7 @@ DbeResetProc(ExtensionEntry *extEntry) if (pDbeScreenPriv->ResetProc) (*pDbeScreenPriv->ResetProc)(pScreen); - if (pDbeScreenPriv->winPrivPrivSizes) - { - xfree(pDbeScreenPriv->winPrivPrivSizes); - } - + dixFreePrivates(pDbeScreenPriv->devPrivates); xfree(pDbeScreenPriv); } } @@ -1746,26 +1613,14 @@ DbeExtensionInit(void) if(!noPanoramiXExtension) return; #endif - /* Allocate private pointers in windows and screens. */ - - if ((dbeScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) - { - return; - } - - if ((dbeWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) - { - return; - } - - /* Initialize the priv priv counts between server generations. */ - winPrivPrivCount = 0; - /* Create the resource types. */ dbeDrawableResType = - CreateNewResourceType(DbeDrawableDelete) | RC_CACHED | RC_DRAWABLE; + CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE; dbeWindowPrivResType = CreateNewResourceType(DbeWindowPrivDelete); + if (!dixRegisterPrivateOffset(dbeDrawableResType, + offsetof(PixmapRec, devPrivates))) + return; for (i = 0; i < screenInfo.numScreens; i++) { @@ -1775,8 +1630,7 @@ DbeExtensionInit(void) pScreen = screenInfo.screens[i]; - if (!AllocateWindowPrivate(pScreen, dbeWindowPrivIndex, 0) || - !(pDbeScreenPriv = + if (!(pDbeScreenPriv = (DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec)))) { /* If we can not alloc a window or screen private, @@ -1785,28 +1639,23 @@ DbeExtensionInit(void) for (j = 0; j < i; j++) { - xfree(screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr); - screenInfo.screens[j]->devPrivates[dbeScreenPrivIndex].ptr = NULL; + xfree(dixLookupPrivate(&screenInfo.screens[j]->devPrivates, + dbeScreenPrivKey)); + dixSetPrivate(&screenInfo.screens[j]->devPrivates, + dbeScreenPrivKey, NULL); } return; } - pScreen->devPrivates[dbeScreenPrivIndex].ptr = (pointer)pDbeScreenPriv; - - /* Store the DBE priv priv size info for later use when allocating - * priv privs at the driver level. - */ - pDbeScreenPriv->winPrivPrivLen = 0; - pDbeScreenPriv->winPrivPrivSizes = (unsigned *)NULL; - pDbeScreenPriv->totalWinPrivSize = sizeof(DbeWindowPrivRec); + dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, pDbeScreenPriv); /* Copy the resource types */ pDbeScreenPriv->dbeDrawableResType = dbeDrawableResType; pDbeScreenPriv->dbeWindowPrivResType = dbeWindowPrivResType; /* Copy the private indices */ - pDbeScreenPriv->dbeScreenPrivIndex = dbeScreenPrivIndex; - pDbeScreenPriv->dbeWindowPrivIndex = dbeWindowPrivIndex; + pDbeScreenPriv->dbeScreenPrivKey = dbeScreenPrivKey; + pDbeScreenPriv->dbeWindowPrivKey = dbeWindowPrivKey; if(DbeInitFunct[i]) { @@ -1814,9 +1663,6 @@ DbeExtensionInit(void) /* Setup DIX. */ pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter; - pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv; - pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex; - pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv; /* Setup DDX. */ ddxInitSuccess = (*DbeInitFunct[i])(pScreen, pDbeScreenPriv); @@ -1848,9 +1694,6 @@ DbeExtensionInit(void) #ifndef DISABLE_MI_DBE_BY_DEFAULT /* Setup DIX. */ pDbeScreenPriv->SetupBackgroundPainter = DbeSetupBackgroundPainter; - pDbeScreenPriv->AllocWinPriv = DbeAllocWinPriv; - pDbeScreenPriv->AllocWinPrivPrivIndex = DbeAllocWinPrivPrivIndex; - pDbeScreenPriv->AllocWinPrivPriv = DbeAllocWinPrivPriv; /* Setup DDX. */ ddxInitSuccess = miDbeInit(pScreen, pDbeScreenPriv); @@ -1889,8 +1732,9 @@ DbeExtensionInit(void) for (i = 0; i < screenInfo.numScreens; i++) { - xfree(screenInfo.screens[i]->devPrivates[dbeScreenPrivIndex].ptr); - pScreen->devPrivates[dbeScreenPrivIndex].ptr = NULL; + xfree(dixLookupPrivate(&screenInfo.screens[i]->devPrivates, + dbeScreenPrivKey)); + dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL); } return; } diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h index 90f13428a..7d5a115ad 100644 --- a/dbe/dbestruct.h +++ b/dbe/dbestruct.h @@ -39,14 +39,13 @@ #define NEED_DBE_PROTOCOL #include <X11/extensions/Xdbeproto.h> #include "windowstr.h" +#include "privates.h" /* DEFINES */ -#define DBE_SCREEN_PRIV(pScreen) \ - ((dbeScreenPrivIndex < 0) ? \ - NULL : \ - ((DbeScreenPrivPtr)((pScreen)->devPrivates[dbeScreenPrivIndex].ptr))) +#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey)) #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \ DBE_SCREEN_PRIV((pDrawable)->pScreen) @@ -63,10 +62,8 @@ #define DBE_SCREEN_PRIV_FROM_GC(pGC)\ DBE_SCREEN_PRIV((pGC)->pScreen) -#define DBE_WINDOW_PRIV(pWindow)\ - ((dbeWindowPrivIndex < 0) ? \ - NULL : \ - ((DbeWindowPrivPtr)(pWindow->devPrivates[dbeWindowPrivIndex].ptr))) +#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey)) /* Initial size of the buffer ID array in the window priv. */ #define DBE_INIT_MAX_IDS 2 @@ -142,7 +139,7 @@ typedef struct _DbeWindowPrivRec /* Device-specific private information. */ - DevUnion *devPrivates; + PrivateRec *devPrivates; } DbeWindowPrivRec, *DbeWindowPrivPtr; @@ -155,18 +152,13 @@ typedef struct _DbeWindowPrivRec typedef struct _DbeScreenPrivRec { - /* Info for creating window privs */ - int winPrivPrivLen; /* Length of privs in DbeWindowPrivRec */ - unsigned int *winPrivPrivSizes; /* Array of private record sizes */ - unsigned int totalWinPrivSize; /* PrivRec + size of all priv priv ptrs */ - /* Resources created by DIX to be used by DDX */ RESTYPE dbeDrawableResType; RESTYPE dbeWindowPrivResType; /* Private indices created by DIX to be used by DDX */ - int dbeScreenPrivIndex; - int dbeWindowPrivIndex; + DevPrivateKey dbeScreenPrivKey; + DevPrivateKey dbeWindowPrivKey; /* Wrapped functions * It is the responsibilty of the DDX layer to wrap PositionWindow(). @@ -180,17 +172,6 @@ typedef struct _DbeScreenPrivRec WindowPtr /*pWin*/, GCPtr /*pGC*/ ); - DbeWindowPrivPtr (*AllocWinPriv)( - ScreenPtr /*pScreen*/ -); - int (*AllocWinPrivPrivIndex)( - void -); - Bool (*AllocWinPrivPriv)( - ScreenPtr /*pScreen*/, - int /*index*/, - unsigned /*amount*/ -); /* Per-screen DDX routines */ Bool (*GetVisualInfo)( @@ -223,7 +204,7 @@ typedef struct _DbeScreenPrivRec /* Device-specific private information. */ - DevUnion *devPrivates; + PrivateRec *devPrivates; } DbeScreenPrivRec, *DbeScreenPrivPtr; diff --git a/dbe/midbe.c b/dbe/midbe.c index ac7ee62d4..c02e591d0 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -56,15 +56,15 @@ #include "gcstruct.h" #include "inputstr.h" #include "midbe.h" +#include "xace.h" #include <stdio.h> -static int miDbePrivPrivGeneration = 0; -static int miDbeWindowPrivPrivIndex = -1; +static DevPrivateKey miDbeWindowPrivPrivKey = &miDbeWindowPrivPrivKey; static RESTYPE dbeDrawableResType; static RESTYPE dbeWindowPrivResType; -static int dbeScreenPrivIndex = -1; -static int dbeWindowPrivIndex = -1; +static DevPrivateKey dbeScreenPrivKey = &dbeScreenPrivKey; +static DevPrivateKey dbeWindowPrivKey = &dbeWindowPrivKey; /****************************************************************************** @@ -154,6 +154,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) DbeScreenPrivPtr pDbeScreenPriv; GCPtr pGC; xRectangle clearRect; + int rc; pScreen = pWin->drawable.pScreen; @@ -192,20 +193,24 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) return(BadAlloc); } + /* Security creation/labeling check. */ + rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId, + dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer, + RT_WINDOW, pWin, DixCreateAccess); /* Make the back pixmap a DBE drawable resource. */ - if (!AddResource(bufId, dbeDrawableResType, - (pointer)pDbeWindowPrivPriv->pBackBuffer)) + if (rc != Success || !AddResource(bufId, dbeDrawableResType, + pDbeWindowPrivPriv->pBackBuffer)) { /* free the buffer and the drawable resource */ FreeResource(bufId, RT_NONE); - return(BadAlloc); + return (rc == Success) ? BadAlloc : rc; } /* Attach the priv priv to the priv. */ - pDbeWindowPriv->devPrivates[miDbeWindowPrivPrivIndex].ptr = - (pointer)pDbeWindowPrivPriv; + dixSetPrivate(&pDbeWindowPriv->devPrivates, miDbeWindowPrivPrivKey, + pDbeWindowPrivPriv); /* Clear the back buffer. */ @@ -778,30 +783,12 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) dbeWindowPrivResType = pDbeScreenPriv->dbeWindowPrivResType; /* Copy private indices created by DIX */ - dbeScreenPrivIndex = pDbeScreenPriv->dbeScreenPrivIndex; - dbeWindowPrivIndex = pDbeScreenPriv->dbeWindowPrivIndex; - - /* Reset the window priv privs if generations do not match. */ - if (miDbePrivPrivGeneration != serverGeneration) - { - /* - ********************************************************************** - ** Allocate the window priv priv. - ********************************************************************** - */ + dbeScreenPrivKey = pDbeScreenPriv->dbeScreenPrivKey; + dbeWindowPrivKey = pDbeScreenPriv->dbeWindowPrivKey; - miDbeWindowPrivPrivIndex = (*pDbeScreenPriv->AllocWinPrivPrivIndex)(); - - /* Make sure we only do this code once. */ - miDbePrivPrivGeneration = serverGeneration; - - } /* if -- Reset priv privs. */ - - if (!(*pDbeScreenPriv->AllocWinPrivPriv)(pScreen, - miDbeWindowPrivPrivIndex, sizeof(MiDbeWindowPrivPrivRec))) - { + if (!dixRequestPrivate(miDbeWindowPrivPrivKey, + sizeof(MiDbeWindowPrivPrivRec))) return(FALSE); - } /* Wrap functions. */ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; diff --git a/dbe/midbestr.h b/dbe/midbestr.h index 1ad0104aa..ae9f206fc 100644 --- a/dbe/midbestr.h +++ b/dbe/midbestr.h @@ -42,19 +42,15 @@ /* DEFINES */ #define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \ - (((miDbeWindowPrivPrivIndex < 0) || (!pDbeWindowPriv)) ? \ - NULL : \ - ((MiDbeWindowPrivPrivPtr) \ - ((pDbeWindowPriv)->devPrivates[miDbeWindowPrivPrivIndex].ptr))) + (!(pDbeWindowPriv) ? NULL : (MiDbeWindowPrivPrivPtr) \ + dixLookupPrivate(&(pDbeWindowPriv)->devPrivates, miDbeWindowPrivPrivKey)) #define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\ MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin)) #define MI_DBE_SCREEN_PRIV_PRIV(pDbeScreenPriv) \ - (((miDbeScreenPrivPrivIndex < 0) || (!pDbeScreenPriv)) ? \ - NULL : \ - ((MiDbeScreenPrivPrivPtr) \ - ((pDbeScreenPriv)->devPrivates[miDbeScreenPrivPrivIndex].ptr))) + (!(pDbeScreenPriv) ? NULL : (MiDbeScreenPrivPrivPtr) \ + dixLookupPrivate(&(pDbeScreenPriv)->devPrivates, miDbeScreenPrivPrivKey)) /* TYPEDEFS */ diff --git a/dix/Makefile.am b/dix/Makefile.am index 28c2d8b6e..2cf90142f 100644 --- a/dix/Makefile.am +++ b/dix/Makefile.am @@ -8,6 +8,7 @@ libdix_la_SOURCES = \ atom.c \ colormap.c \ cursor.c \ + deprecated.c \ devices.c \ dispatch.c \ dispatch.h \ @@ -26,6 +27,7 @@ libdix_la_SOURCES = \ pixmap.c \ privates.c \ property.c \ + registry.c \ resource.c \ swaprep.c \ swapreq.c \ @@ -40,6 +42,10 @@ INCLUDES = -I$(top_srcdir)/Xprint EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in +# Install list of protocol names +miscconfigdir = $(SERVER_MISC_CONFIG_PATH) +dist_miscconfig_DATA = protocol.txt + if XSERVER_DTRACE # Generate dtrace header file for C sources to include BUILT_SOURCES = Xserver-dtrace.h diff --git a/dix/colormap.c b/dix/colormap.c index b27b8bc67..c4c8c8bfe 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -63,9 +63,10 @@ SOFTWARE. #include "scrnintstr.h" #include "resource.h" #include "windowstr.h" +#include "privates.h" +#include "xace.h" extern XID clientErrorValue; -extern int colormapPrivateCount; static Pixel FindBestPixel( EntryPtr /*pentFirst*/, @@ -386,31 +387,25 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual, pmap->numPixelsBlue[client] = size; } } - if (!AddResource(mid, RT_COLORMAP, (pointer)pmap)) - return (BadAlloc); - /* If the device wants a chance to initialize the colormap in any way, - * this is it. In specific, if this is a Static colormap, this is the - * time to fill in the colormap's values */ + pmap->devPrivates = NULL; pmap->flags |= BeingCreated; + if (!AddResource(mid, RT_COLORMAP, (pointer)pmap)) + return (BadAlloc); - /* - * Allocate the array of devPrivate's for this colormap. + /* + * Security creation/labeling check */ - - if (colormapPrivateCount == 0) - pmap->devPrivates = NULL; - else - { - pmap->devPrivates = (DevUnion *) xcalloc ( - sizeof(DevUnion), colormapPrivateCount); - if (!pmap->devPrivates) - { - FreeResource (mid, RT_NONE); - return BadAlloc; - } + i = XaceHook(XACE_RESOURCE_ACCESS, clients[client], mid, RT_COLORMAP, + pmap, RT_NONE, NULL, DixCreateAccess); + if (i != Success) { + FreeResource(mid, RT_NONE); + return i; } + /* If the device wants a chance to initialize the colormap in any way, + * this is it. In specific, if this is a Static colormap, this is the + * time to fill in the colormap's values */ if (!(*pScreen->CreateColormap)(pmap)) { FreeResource (mid, RT_NONE); @@ -474,9 +469,7 @@ FreeColormap (pointer value, XID mid) } } - if (pmap->devPrivates) - xfree(pmap->devPrivates); - + dixFreePrivates(pmap->devPrivates); xfree(pmap); return(Success); } diff --git a/dix/cursor.c b/dix/cursor.c index d903124c4..0ddf9d791 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -59,6 +59,7 @@ SOFTWARE. #include "cursorstr.h" #include "dixfontstr.h" #include "opaque.h" +#include "xace.h" typedef struct _GlyphShare { FontPtr font; @@ -98,6 +99,7 @@ FreeCursorBits(CursorBitsPtr bits) CloseFont(this->font, (Font)0); xfree(this); } + dixFreePrivates(bits->devPrivates); xfree(bits); } } @@ -123,6 +125,7 @@ FreeCursor(pointer value, XID cid) pscr = screenInfo.screens[nscr]; (void)( *pscr->UnrealizeCursor)( pscr, pCurs); } + dixFreePrivates(pCurs->devPrivates); FreeCursorBits(pCurs->bits); xfree( pCurs); return(Success); @@ -161,23 +164,25 @@ CheckForEmptyMask(CursorBitsPtr bits) * \param pmaskbits server-defined padding * \param argb no padding */ -CursorPtr -AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, - CursorMetricPtr cm, - unsigned foreRed, unsigned foreGreen, unsigned foreBlue, - unsigned backRed, unsigned backGreen, unsigned backBlue) +int +AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, + CARD32 *argb, CursorMetricPtr cm, + unsigned foreRed, unsigned foreGreen, unsigned foreBlue, + unsigned backRed, unsigned backGreen, unsigned backBlue, + CursorPtr *ppCurs, ClientPtr client, XID cid) { CursorBitsPtr bits; CursorPtr pCurs; - int nscr; + int rc, nscr; ScreenPtr pscr; + *ppCurs = NULL; pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits)); if (!pCurs) { xfree(psrcbits); xfree(pmaskbits); - return (CursorPtr)NULL; + return BadAlloc; } bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec)); bits->source = psrcbits; @@ -189,9 +194,9 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, bits->height = cm->height; bits->xhot = cm->xhot; bits->yhot = cm->yhot; + bits->devPrivates = NULL; bits->refcnt = -1; CheckForEmptyMask(bits); - pCurs->bits = bits; pCurs->refcnt = 1; #ifdef XFIXES @@ -207,6 +212,19 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; + pCurs->id = cid; + pCurs->devPrivates = NULL; + + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, + pCurs, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + dixFreePrivates(pCurs->devPrivates); + FreeCursorBits(bits); + xfree(pCurs); + return rc; + } + /* * realize the cursor for every screen */ @@ -220,61 +238,46 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb, pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } + dixFreePrivates(pCurs->devPrivates); FreeCursorBits(bits); xfree(pCurs); - return (CursorPtr)NULL; + return BadAlloc; } } - return pCurs; -} - -/** - * - * \param psrcbits server-defined padding - * \param pmaskbits server-defined padding - */ -CursorPtr -AllocCursor(unsigned char *psrcbits, unsigned char *pmaskbits, - CursorMetricPtr cm, - unsigned foreRed, unsigned foreGreen, unsigned foreBlue, - unsigned backRed, unsigned backGreen, unsigned backBlue) -{ - return AllocCursorARGB (psrcbits, pmaskbits, (CARD32 *) 0, cm, - foreRed, foreGreen, foreBlue, - backRed, backGreen, backBlue); + *ppCurs = pCurs; + return rc; } int AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, unsigned foreRed, unsigned foreGreen, unsigned foreBlue, unsigned backRed, unsigned backGreen, unsigned backBlue, - CursorPtr *ppCurs, ClientPtr client) + CursorPtr *ppCurs, ClientPtr client, XID cid) { FontPtr sourcefont, maskfont; unsigned char *srcbits; unsigned char *mskbits; CursorMetricRec cm; - int res; + int rc; CursorBitsPtr bits; CursorPtr pCurs; int nscr; ScreenPtr pscr; GlyphSharePtr pShare; - sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT, - DixReadAccess); - maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT, - DixReadAccess); - - if (!sourcefont) + rc = dixLookupResource((pointer *)&sourcefont, source, RT_FONT, client, + DixUseAccess); + if (rc != Success) { client->errorValue = source; - return(BadFont); + return (rc == BadValue) ? BadFont : rc; } - if (!maskfont && (mask != None)) + rc = dixLookupResource((pointer *)&maskfont, mask, RT_FONT, client, + DixUseAccess); + if (rc != Success && mask != None) { client->errorValue = mask; - return(BadFont); + return (rc == BadValue) ? BadFont : rc; } if (sourcefont != maskfont) pShare = (GlyphSharePtr)NULL; @@ -322,13 +325,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, client->errorValue = maskChar; return BadValue; } - if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0) - return res; + if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits))) + return rc; } - if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0) + if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))) { xfree(mskbits); - return res; + return rc; } if (sourcefont != maskfont) { @@ -362,6 +365,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, bits->height = cm.height; bits->xhot = cm.xhot; bits->yhot = cm.yhot; + bits->devPrivates = NULL; if (sourcefont != maskfont) bits->refcnt = -1; else @@ -398,6 +402,19 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, pCurs->backGreen = backGreen; pCurs->backBlue = backBlue; + pCurs->id = cid; + pCurs->devPrivates = NULL; + + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, + pCurs, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + dixFreePrivates(pCurs->devPrivates); + FreeCursorBits(bits); + xfree(pCurs); + return rc; + } + /* * realize the cursor for every screen */ @@ -411,6 +428,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, pscr = screenInfo.screens[nscr]; ( *pscr->UnrealizeCursor)( pscr, pCurs); } + dixFreePrivates(pCurs->devPrivates); FreeCursorBits(pCurs->bits); xfree(pCurs); return BadAlloc; @@ -447,7 +465,8 @@ CreateRootCursor(char *unused1, unsigned int unused2) cm.xhot = 0; cm.yhot = 0; - curs = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0); + AllocARGBCursor(NULL, NULL, NULL, &cm, 0, 0, 0, 0, 0, 0, + &curs, serverClient, (XID)0); if (curs == NullCursor) return NullCursor; @@ -461,8 +480,8 @@ CreateRootCursor(char *unused1, unsigned int unused2) cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT); if (!cursorfont) return NullCursor; - if (AllocGlyphCursor(fontID, 0, fontID, 1, - 0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success) + if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0, + &curs, serverClient, (XID)0) != Success) return NullCursor; #endif diff --git a/dix/deprecated.c b/dix/deprecated.c new file mode 100644 index 000000000..2bb81190c --- /dev/null +++ b/dix/deprecated.c @@ -0,0 +1,162 @@ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "dix.h" +#include "misc.h" +#include "dixstruct.h" + +/* + * These are deprecated compatibility functions and will be marked as such + * and removed soon! + * + * Please use the noted replacements instead. + */ + +/* replaced by dixLookupWindow */ +_X_EXPORT WindowPtr +SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode) +{ + WindowPtr pWin; + int i = dixLookupWindow(&pWin, id, client, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupWindow()/SecurityLookupWindow() " + "are deprecated. Please convert your driver/module " + "to use dixLookupWindow().\n"); + return (i == Success) ? pWin : NULL; +} + +/* replaced by dixLookupWindow */ +_X_EXPORT WindowPtr +LookupWindow(XID id, ClientPtr client) +{ + return SecurityLookupWindow(id, client, DixUnknownAccess); +} + +/* replaced by dixLookupDrawable */ +_X_EXPORT pointer +SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode) +{ + DrawablePtr pDraw; + int i = dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() " + "are deprecated. Please convert your driver/module " + "to use dixLookupDrawable().\n"); + return (i == Success) ? pDraw : NULL; +} + +/* replaced by dixLookupDrawable */ +_X_EXPORT pointer +LookupDrawable(XID id, ClientPtr client) +{ + return SecurityLookupDrawable(id, client, DixUnknownAccess); +} + +/* replaced by dixLookupClient */ +_X_EXPORT ClientPtr +LookupClient(XID id, ClientPtr client) +{ + ClientPtr pClient; + int i = dixLookupClient(&pClient, id, client, DixUnknownAccess); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupClient() is deprecated. Please convert your " + "driver/module to use dixLookupClient().\n"); + return (i == Success) ? pClient : NULL; +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, + Mask access_mode) +{ + pointer retval; + int i = dixLookupResource(&retval, id, rtype, client, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() " + "are deprecated. Please convert your driver/module " + "to use dixLookupResource().\n"); + return (i == Success) ? retval : NULL; +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, + Mask access_mode) +{ + pointer retval; + int i = dixLookupResource(&retval, id, classes, client, access_mode); + static int warn = 1; + if (warn > 0 && --warn) + ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() " + "are deprecated. Please convert your driver/module " + "to use dixLookupResource().\n"); + return (i == Success) ? retval : NULL; +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +LookupIDByType(XID id, RESTYPE rtype) +{ + return SecurityLookupIDByType(NullClient, id, rtype, DixUnknownAccess); +} + +/* replaced by dixLookupResource */ +_X_EXPORT pointer +LookupIDByClass(XID id, RESTYPE classes) +{ + return SecurityLookupIDByClass(NullClient, id, classes, DixUnknownAccess); +} + +/* end deprecated functions */ diff --git a/dix/devices.c b/dix/devices.c index 3855c2b8b..4b20655c6 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -69,6 +69,7 @@ SOFTWARE. #ifdef XKB #include <xkbsrv.h> #endif +#include "privates.h" #include "xace.h" #include "dispatch.h" @@ -84,8 +85,7 @@ SOFTWARE. * This file handles input device-related stuff. */ -int CoreDevicePrivatesIndex = 0; -static int CoreDevicePrivatesGeneration = -1; +DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKey; /** * Create a new input device and init it to sane values. The device is added @@ -119,7 +119,6 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart) dev->name = (char *)NULL; dev->type = 0; dev->id = devid; - inputInfo.numDevices++; dev->public.on = FALSE; dev->public.processInputProc = (ProcessInputProc)NoopDDA; dev->public.realInputProc = (ProcessInputProc)NoopDDA; @@ -150,13 +149,21 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart) dev->xkb_interest = NULL; #endif dev->config_info = NULL; - dev->nPrivates = 0; dev->devPrivates = NULL; dev->unwrapProc = NULL; dev->coreEvents = TRUE; dev->inited = FALSE; dev->enabled = FALSE; + /* security creation/labeling check + */ + if (XaceHook(XACE_DEVICE_ACCESS, serverClient, dev, DixCreateAccess)) { + xfree(dev); + return NULL; + } + + inputInfo.numDevices++; + for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next) ; *prev = dev; @@ -351,7 +358,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what) break; case DEVICE_CLOSE: - pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; + dixSetPrivate(&pDev->devPrivates, CoreDevicePrivateKey, NULL); break; default: @@ -383,7 +390,7 @@ CorePointerProc(DeviceIntPtr pDev, int what) break; case DEVICE_CLOSE: - pDev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; + dixSetPrivate(&pDev->devPrivates, CoreDevicePrivateKey, NULL); break; default: @@ -404,11 +411,6 @@ InitCoreDevices(void) { DeviceIntPtr dev; - if (CoreDevicePrivatesGeneration != serverGeneration) { - CoreDevicePrivatesIndex = AllocateDevicePrivateIndex(); - CoreDevicePrivatesGeneration = serverGeneration; - } - if (!inputInfo.keyboard) { dev = AddInputDevice(CoreKeyboardProc, TRUE); if (!dev) @@ -426,9 +428,6 @@ InitCoreDevices(void) dev->ActivateGrab = ActivateKeyboardGrab; dev->DeactivateGrab = DeactivateKeyboardGrab; dev->coreEvents = FALSE; - if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex)) - FatalError("Couldn't allocate keyboard devPrivates\n"); - dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; (void)ActivateDevice(dev); inputInfo.keyboard = dev; } @@ -450,9 +449,6 @@ InitCoreDevices(void) dev->ActivateGrab = ActivatePointerGrab; dev->DeactivateGrab = DeactivatePointerGrab; dev->coreEvents = FALSE; - if (!AllocateDevicePrivate(dev, CoreDevicePrivatesIndex)) - FatalError("Couldn't allocate pointer devPrivates\n"); - dev->devPrivates[CoreDevicePrivatesIndex].ptr = NULL; (void)ActivateDevice(dev); inputInfo.pointer = dev; } @@ -473,7 +469,8 @@ InitAndStartDevices(void) for (dev = inputInfo.off_devices; dev; dev = dev->next) { DebugF("(dix) initialising device %d\n", dev->id); - ActivateDevice(dev); + if (!dev->inited) + ActivateDevice(dev); } for (dev = inputInfo.off_devices; dev; dev = next) { @@ -532,6 +529,7 @@ CloseDevice(DeviceIntPtr dev) xfree(dev->key->curKeySyms.map); xfree(dev->key->modifierKeyMap); xfree(dev->key); + dev->key = NULL; } if (dev->valuator) { @@ -603,10 +601,8 @@ CloseDevice(DeviceIntPtr dev) XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); #endif - if (dev->devPrivates) - xfree(dev->devPrivates); - xfree(dev->sync.event); + dixFreePrivates(dev->devPrivates); xfree(dev); } @@ -720,32 +716,28 @@ RegisterKeyboardDevice(DeviceIntPtr device) RegisterOtherDevice(device); } -_X_EXPORT DevicePtr -LookupKeyboardDevice(void) -{ - return inputInfo.keyboard ? &inputInfo.keyboard->public : NULL; -} - -_X_EXPORT DevicePtr -LookupPointerDevice(void) -{ - return inputInfo.pointer ? &inputInfo.pointer->public : NULL; -} - -DevicePtr -LookupDevice(int id) +int +dixLookupDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode) { DeviceIntPtr dev; + int rc; + *pDev = NULL; for (dev=inputInfo.devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) - return (DevicePtr)dev; + goto found; } for (dev=inputInfo.off_devices; dev; dev=dev->next) { if (dev->id == (CARD8)id) - return (DevicePtr)dev; + goto found; } - return NULL; + return BadDevice; + +found: + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc == Success) + *pDev = dev; + return rc; } void @@ -1286,10 +1278,10 @@ AllModifierKeysAreUp(dev, map1, per1, map2, per2) static int DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, - int numKeyPerModifier) + int numKeyPerModifier, xSetModifierMappingReply *rep) { DeviceIntPtr pDev = NULL; - int i = 0, inputMapLen = numKeyPerModifier * 8; + int rc, i = 0, inputMapLen = numKeyPerModifier * 8; for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) { @@ -1304,8 +1296,9 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, } } - if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE)) - return BadAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); + if (rc != Success) + return rc; /* None of the modifiers (old or new) may be down while we change * the map. */ @@ -1315,7 +1308,8 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, !AllModifierKeysAreUp(pDev, inputMap, numKeyPerModifier, pDev->key->modifierKeyMap, pDev->key->maxKeysPerModifier)) { - return MappingBusy; + rep->success = MappingBusy; + return Success; } } } @@ -1352,6 +1346,7 @@ DoSetModifierMapping(ClientPtr client, KeyCode *inputMap, } } + rep->success = Success; return Success; } @@ -1360,8 +1355,8 @@ ProcSetModifierMapping(ClientPtr client) { xSetModifierMappingReply rep; DeviceIntPtr dev; + int rc; REQUEST(xSetModifierMappingReq); - REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq); if (client->req_len != ((stuff->numKeyPerModifier << 1) + @@ -1372,8 +1367,10 @@ ProcSetModifierMapping(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1], - stuff->numKeyPerModifier); + rc = DoSetModifierMapping(client, (KeyCode *)&stuff[1], + stuff->numKeyPerModifier, &rep); + if (rc != Success) + return rc; SendMappingNotify(MappingModifier, 0, 0, client); for (dev = inputInfo.devices; dev; dev = dev->next) @@ -1388,8 +1385,14 @@ ProcGetModifierMapping(ClientPtr client) { xGetModifierMappingReply rep; KeyClassPtr keyc = inputInfo.keyboard->key; - + int rc; REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.numKeyPerModifier = keyc->maxKeysPerModifier; rep.sequenceNumber = client->sequence; @@ -1412,6 +1415,7 @@ ProcChangeKeyboardMapping(ClientPtr client) KeySymsRec keysyms; KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; DeviceIntPtr pDev = NULL; + int rc; REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq); len = client->req_len - (sizeof(xChangeKeyboardMappingReq) >> 2); @@ -1432,8 +1436,9 @@ ProcChangeKeyboardMapping(ClientPtr client) for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) { - if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE)) - return BadAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); + if (rc != Success) + return rc; } } @@ -1458,9 +1463,9 @@ ProcChangeKeyboardMapping(ClientPtr client) } static int -DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n) +DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n) { - int i = 0; + int rc, i = 0; DeviceIntPtr dev = NULL; if (!device || !device->button) @@ -1468,6 +1473,14 @@ DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n) for (dev = inputInfo.devices; dev; dev = dev->next) { if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess); + if (rc != Success) + return rc; + } + } + + for (dev = inputInfo.devices; dev; dev = dev->next) { + if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) { for (i = 0; i < n; i++) { if ((device->button->map[i + 1] != map[i]) && BitIsOn(device->button->down, i + 1)) { @@ -1490,12 +1503,12 @@ DoSetPointerMapping(DeviceIntPtr device, BYTE *map, int n) int ProcSetPointerMapping(ClientPtr client) { - REQUEST(xSetPointerMappingReq); BYTE *map; int ret; xSetPointerMappingReply rep; - + REQUEST(xSetPointerMappingReq); REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq); + if (client->req_len != (sizeof(xSetPointerMappingReq)+stuff->nElts+3) >> 2) return BadLength; rep.type = X_Reply; @@ -1513,7 +1526,7 @@ ProcSetPointerMapping(ClientPtr client) if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue)) return BadValue; - ret = DoSetPointerMapping(inputInfo.pointer, map, stuff->nElts); + ret = DoSetPointerMapping(client, inputInfo.pointer, map, stuff->nElts); if (ret != Success) { rep.success = ret; WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep); @@ -1530,11 +1543,16 @@ int ProcGetKeyboardMapping(ClientPtr client) { xGetKeyboardMappingReply rep; - REQUEST(xGetKeyboardMappingReq); KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms; - + int rc; + REQUEST(xGetKeyboardMappingReq); REQUEST_SIZE_MATCH(xGetKeyboardMappingReq); + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetAttrAccess); + if (rc != Success) + return rc; + if ((stuff->firstKeyCode < curKeySyms->minKeyCode) || (stuff->firstKeyCode > curKeySyms->maxKeyCode)) { client->errorValue = stuff->firstKeyCode; @@ -1567,8 +1585,14 @@ ProcGetPointerMapping(ClientPtr client) { xGetPointerMappingReply rep; ButtonClassPtr butc = inputInfo.pointer->button; - + int rc; REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.nElts = butc->numButtons; @@ -1787,8 +1811,9 @@ ProcChangeKeyboardControl (ClientPtr client) for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->kbdfeed && pDev->kbdfeed->CtrlProc) { - if (!XaceHook(XACE_DEVICE_ACCESS, client, pDev, TRUE)) - return BadAccess; + ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); + if (ret != Success) + return ret; } } @@ -1807,11 +1832,16 @@ ProcChangeKeyboardControl (ClientPtr client) int ProcGetKeyboardControl (ClientPtr client) { - int i; + int rc, i; KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl; xGetKeyboardControlReply rep; - REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 5; rep.sequenceNumber = client->sequence; @@ -1833,6 +1863,7 @@ ProcBell(ClientPtr client) DeviceIntPtr keybd = inputInfo.keyboard; int base = keybd->kbdfeed->ctrl.bell; int newpercent; + int rc; REQUEST(xBellReq); REQUEST_SIZE_MATCH(xBellReq); @@ -1853,6 +1884,10 @@ ProcBell(ClientPtr client) for (keybd = inputInfo.devices; keybd; keybd = keybd->next) { if ((keybd->coreEvents || keybd == inputInfo.keyboard) && keybd->kbdfeed && keybd->kbdfeed->BellProc) { + + rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixBellAccess); + if (rc != Success) + return rc; #ifdef XKB if (!noXkbExtension) XkbHandleBell(FALSE, FALSE, keybd, newpercent, @@ -1872,8 +1907,8 @@ ProcChangePointerControl(ClientPtr client) { DeviceIntPtr mouse = inputInfo.pointer; PtrCtrl ctrl; /* might get BadValue part way through */ + int rc; REQUEST(xChangePointerControlReq); - REQUEST_SIZE_MATCH(xChangePointerControlReq); if (!mouse->ptrfeed->CtrlProc) @@ -1924,6 +1959,14 @@ ProcChangePointerControl(ClientPtr client) } } + for (mouse = inputInfo.devices; mouse; mouse = mouse->next) { + if ((mouse->coreEvents || mouse == inputInfo.pointer) && + mouse->ptrfeed && mouse->ptrfeed->CtrlProc) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixManageAccess); + if (rc != Success) + return rc; + } + } for (mouse = inputInfo.devices; mouse; mouse = mouse->next) { if ((mouse->coreEvents || mouse == inputInfo.pointer) && @@ -1941,8 +1984,14 @@ ProcGetPointerControl(ClientPtr client) { PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl; xGetPointerControlReply rep; - + int rc; REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, + DixGetAttrAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -1980,11 +2029,15 @@ ProcGetMotionEvents(ClientPtr client) DeviceIntPtr mouse = inputInfo.pointer; TimeStamp start, stop; REQUEST(xGetMotionEventsReq); - REQUEST_SIZE_MATCH(xGetMotionEventsReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); if (rc != Success) return rc; + if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; @@ -2040,7 +2093,7 @@ int ProcQueryKeymap(ClientPtr client) { xQueryKeymapReply rep; - int i; + int rc, i; CARD8 *down = inputInfo.keyboard->key->down; REQUEST_SIZE_MATCH(xReq); @@ -2048,11 +2101,13 @@ ProcQueryKeymap(ClientPtr client) rep.sequenceNumber = client->sequence; rep.length = 2; - if (XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE)) - for (i = 0; i<32; i++) - rep.map[i] = down[i]; - else - bzero((char *)&rep.map[0], 32); + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixReadAccess); + if (rc != Success) + return rc; + + for (i = 0; i<32; i++) + rep.map[i] = down[i]; WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep); return Success; diff --git a/dix/dispatch.c b/dix/dispatch.c index c356aed30..e8e650a91 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -134,6 +134,7 @@ int ProcInitialConnection(); #include "panoramiX.h" #include "panoramiXsrv.h" #endif +#include "privates.h" #include "xace.h" #ifdef XAPPGROUP #include "appgroup.h" @@ -147,14 +148,10 @@ int ProcInitialConnection(); #endif #ifdef XSERVER_DTRACE +#include "registry.h" #include <sys/types.h> typedef const char *string; #include "Xserver-dtrace.h" - -char *RequestNames[256]; -static void LoadRequestNames(void); -static void FreeRequestNames(void); -#define GetRequestName(i) (RequestNames[i]) #endif #define mskcnt ((MAXCLIENTS + 31) / 32) @@ -257,34 +254,6 @@ InitSelections(void) CurrentSelections = (Selection *)NULL; NumCurrentSelections = 0; } - -void -FlushClientCaches(XID id) -{ - int i; - ClientPtr client; - - client = clients[CLIENT_ID(id)]; - if (client == NullClient) - return ; - for (i=0; i<currentMaxClients; i++) - { - client = clients[i]; - if (client != NullClient) - { - if (client->lastDrawableID == id) - { - client->lastDrawableID = WindowTable[0]->drawable.id; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - } - else if (client->lastGCID == id) - { - client->lastGCID = INVALID; - client->lastGC = (GCPtr)NULL; - } - } - } -} #ifdef SMART_SCHEDULE #undef SMART_DEBUG @@ -410,10 +379,6 @@ Dispatch(void) if (!clientReady) return; -#ifdef XSERVER_DTRACE - LoadRequestNames(); -#endif - while (!dispatchException) { if (*icheck[0] != *icheck[1]) @@ -452,17 +417,18 @@ Dispatch(void) } isItTimeToYield = FALSE; +#ifdef XPRINT requestingClient = client; +#endif #ifdef SMART_SCHEDULE start_tick = SmartScheduleTime; #endif while (!isItTimeToYield) { if (*icheck[0] != *icheck[1]) - { ProcessInputEvents(); - FlushIfCriticalOutputPending(); - } + + FlushIfCriticalOutputPending(); #ifdef SMART_SCHEDULE if (!SmartScheduleDisable && (SmartScheduleTime - start_tick) >= SmartScheduleSlice) @@ -491,19 +457,20 @@ Dispatch(void) client->requestLogIndex++; #endif #ifdef XSERVER_DTRACE - XSERVER_REQUEST_START(GetRequestName(MAJOROP), MAJOROP, + XSERVER_REQUEST_START(LookupMajorName(MAJOROP), MAJOROP, ((xReq *)client->requestBuffer)->length, client->index, client->requestBuffer); #endif if (result > (maxBigRequestSize << 2)) result = BadLength; else { - XaceHookAuditBegin(client); - result = (* client->requestVector[MAJOROP])(client); + result = XaceHookDispatch(client, MAJOROP); + if (result == Success) + result = (* client->requestVector[MAJOROP])(client); XaceHookAuditEnd(client, result); } #ifdef XSERVER_DTRACE - XSERVER_REQUEST_DONE(GetRequestName(MAJOROP), MAJOROP, + XSERVER_REQUEST_DONE(LookupMajorName(MAJOROP), MAJOROP, client->sequence, client->index, result); #endif @@ -517,9 +484,6 @@ Dispatch(void) client->errorValue, result); break; } -#ifdef DAMAGEEXT - FlushIfCriticalOutputPending (); -#endif } FlushAllOutput(); #ifdef SMART_SCHEDULE @@ -527,7 +491,9 @@ Dispatch(void) if (client) client->smart_stop_tick = SmartScheduleTime; #endif +#ifdef XPRINT requestingClient = NULL; +#endif } dispatchException &= ~DE_PRIORITYCHANGE; } @@ -537,9 +503,6 @@ Dispatch(void) KillAllClients(); xfree(clientReady); dispatchException &= ~DE_RESET; -#ifdef XSERVER_DTRACE - FreeRequestNames(); -#endif } #undef MAJOROP @@ -555,12 +518,12 @@ ProcCreateWindow(ClientPtr client) { WindowPtr pParent, pWin; REQUEST(xCreateWindowReq); - int result, len, rc; + int len, rc; REQUEST_AT_LEAST_SIZE(xCreateWindowReq); LEGAL_NEW_RESOURCE(stuff->wid, client); - rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess); + rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess); if (rc != Success) return rc; len = client->req_len - (sizeof(xCreateWindowReq) >> 2); @@ -576,7 +539,7 @@ ProcCreateWindow(ClientPtr client) stuff->borderWidth, stuff->class, stuff->mask, (XID *) &stuff[1], (int)stuff->depth, - client, stuff->visual, &result); + client, stuff->visual, &rc); if (pWin) { Mask mask = pWin->eventMask; @@ -589,7 +552,7 @@ ProcCreateWindow(ClientPtr client) if (client->noClientException != Success) return(client->noClientException); else - return(result); + return rc; } int @@ -597,11 +560,13 @@ ProcChangeWindowAttributes(ClientPtr client) { WindowPtr pWin; REQUEST(xChangeWindowAttributesReq); - int result; - int len, rc; + int result, len, rc; + Mask access_mode = 0; REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + access_mode |= (stuff->valueMask & CWEventMask) ? DixReceiveAccess : 0; + access_mode |= (stuff->valueMask & ~CWEventMask) ? DixSetAttrAccess : 0; + rc = dixLookupWindow(&pWin, stuff->window, client, access_mode); if (rc != Success) return rc; len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); @@ -626,7 +591,7 @@ ProcGetWindowAttributes(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); if (rc != Success) return rc; GetWindowAttributes(pWin, client, &wa); @@ -645,8 +610,13 @@ ProcDestroyWindow(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess); if (rc != Success) return rc; - if (pWin->parent) + if (pWin->parent) { + rc = dixLookupWindow(&pWin, pWin->parent->drawable.id, client, + DixRemoveAccess); + if (rc != Success) + return rc; FreeResource(stuff->id, RT_NONE); + } return(client->noClientException); } @@ -658,7 +628,7 @@ ProcDestroySubwindows(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixRemoveAccess); if (rc != Success) return rc; DestroySubwindows(pWin, client); @@ -673,7 +643,7 @@ ProcChangeSaveSet(ClientPtr client) int result, rc; REQUEST_SIZE_MATCH(xChangeSaveSetReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); if (rc != Success) return rc; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) @@ -701,10 +671,10 @@ ProcReparentWindow(ClientPtr client) int result, rc; REQUEST_SIZE_MATCH(xReparentWindowReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); if (rc != Success) return rc; - rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess); + rc = dixLookupWindow(&pParent, stuff->parent, client, DixAddAccess); if (rc != Success) return rc; if (SAME_SCREENS(pWin->drawable, pParent->drawable)) @@ -734,7 +704,7 @@ ProcMapWindow(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixShowAccess); if (rc != Success) return rc; MapWindow(pWin, client); @@ -750,7 +720,7 @@ ProcMapSubwindows(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess); if (rc != Success) return rc; MapSubwindows(pWin, client); @@ -766,7 +736,7 @@ ProcUnmapWindow(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixHideAccess); if (rc != Success) return rc; UnmapWindow(pWin, FALSE); @@ -782,7 +752,7 @@ ProcUnmapSubwindows(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess); if (rc != Success) return rc; UnmapSubwindows(pWin); @@ -798,7 +768,8 @@ ProcConfigureWindow(ClientPtr client) int len, rc; REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, + DixManageAccess|DixSetAttrAccess); if (rc != Success) return rc; len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); @@ -826,7 +797,7 @@ ProcCirculateWindow(ClientPtr client) client->errorValue = stuff->direction; return BadValue; } - rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); if (rc != Success) return rc; CirculateWindow(pWin, (int)stuff->direction, client); @@ -841,7 +812,7 @@ GetGeometry(ClientPtr client, xGetGeometryReply *rep) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixReadAccess); + rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixGetAttrAccess); if (rc != Success) return rc; @@ -902,7 +873,7 @@ ProcQueryTree(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess); if (rc != Success) return rc; reply.type = X_Reply; @@ -1001,9 +972,10 @@ ProcSetSelectionOwner(ClientPtr client) { WindowPtr pWin; TimeStamp time; + int rc; REQUEST(xSetSelectionOwnerReq); - REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); + UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); @@ -1013,7 +985,7 @@ ProcSetSelectionOwner(ClientPtr client) return Success; if (stuff->window != None) { - int rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess); if (rc != Success) return rc; } @@ -1023,6 +995,11 @@ ProcSetSelectionOwner(ClientPtr client) { int i = 0; + rc = XaceHookSelectionAccess(client, stuff->selection, + DixSetAttrAccess); + if (rc != Success) + return rc; + /* * First, see if the selection is already set... */ @@ -1069,6 +1046,7 @@ ProcSetSelectionOwner(ClientPtr client) NumCurrentSelections++; CurrentSelections = newsels; CurrentSelections[i].selection = stuff->selection; + CurrentSelections[i].devPrivates = NULL; } CurrentSelections[i].lastTimeChanged = time; CurrentSelections[i].window = stuff->window; @@ -1079,6 +1057,7 @@ ProcSetSelectionOwner(ClientPtr client) SelectionInfoRec info; info.selection = &CurrentSelections[i]; + info.client = client; info.kind= SelectionSetOwner; CallCallbacks(&SelectionCallback, &info); } @@ -1099,18 +1078,30 @@ ProcGetSelectionOwner(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); if (ValidAtom(stuff->id)) { - int i; + int rc, i; xGetSelectionOwnerReply reply; + rc = XaceHookSelectionAccess(client, stuff->id, DixGetAttrAccess); + if (rc != Success) + return rc; + i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->id) i++; reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; - if (i < NumCurrentSelections) + if (i < NumCurrentSelections) { + if (SelectionCallback) { + SelectionInfoRec info; + + info.selection = &CurrentSelections[i]; + info.client = client; + info.kind= SelectionGetOwner; + CallCallbacks(&SelectionCallback, &info); + } reply.owner = CurrentSelections[i].window; - else + } else reply.owner = None; WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); return(client->noClientException); @@ -1132,9 +1123,12 @@ ProcConvertSelection(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xConvertSelectionReq); - rc = dixLookupWindow(&pWin, stuff->requestor, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess); if (rc != Success) return rc; + rc = XaceHookSelectionAccess(client, stuff->selection, DixReadAccess); + if (rc != Success) + return rc; paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); if (stuff->property != None) @@ -1146,16 +1140,18 @@ ProcConvertSelection(ClientPtr client) i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; - if ((i < NumCurrentSelections) && - (CurrentSelections[i].window != None) && - XaceHook(XACE_RESOURCE_ACCESS, client, - CurrentSelections[i].window, RT_WINDOW, - DixReadAccess, CurrentSelections[i].pWin)) - { + if (i < NumCurrentSelections && CurrentSelections[i].window != None) { + if (SelectionCallback) { + SelectionInfoRec info; + + info.selection = &CurrentSelections[i]; + info.client = client; + info.kind= SelectionConvertSelection; + CallCallbacks(&SelectionCallback, &info); + } event.u.u.type = SelectionRequest; event.u.selectionRequest.time = stuff->time; - event.u.selectionRequest.owner = - CurrentSelections[i].window; + event.u.selectionRequest.owner = CurrentSelections[i].window; event.u.selectionRequest.requestor = stuff->requestor; event.u.selectionRequest.selection = stuff->selection; event.u.selectionRequest.target = stuff->target; @@ -1185,6 +1181,7 @@ ProcConvertSelection(ClientPtr client) int ProcGrabServer(ClientPtr client) { + int rc; REQUEST_SIZE_MATCH(xReq); if (grabState != GrabNone && client != grabClient) { @@ -1194,7 +1191,9 @@ ProcGrabServer(ClientPtr client) IgnoreClient(client); return(client->noClientException); } - OnlyListenToOneClient(client); + rc = OnlyListenToOneClient(client); + if (rc != Success) + return rc; grabState = GrabKickout; grabClient = client; @@ -1254,10 +1253,10 @@ ProcTranslateCoords(ClientPtr client) int rc; REQUEST_SIZE_MATCH(xTranslateCoordsReq); - rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixGetAttrAccess); if (rc != Success) return rc; - rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess); + rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess); if (rc != Success) return rc; rep.type = X_Reply; @@ -1367,23 +1366,21 @@ ProcQueryFont(ClientPtr client) xQueryFontReply *reply; FontPtr pFont; GC *pGC; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); + client->errorValue = stuff->id; /* EITHER font or gc */ - pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - DixReadAccess); - if (!pFont) - { - pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, - DixReadAccess); - if (!pGC) - { - client->errorValue = stuff->id; - return(BadFont); /* procotol spec says only error is BadFont */ - } - pFont = pGC->font; + rc = dixLookupResource((pointer *)&pFont, stuff->id, RT_FONT, client, + DixGetAttrAccess); + if (rc == BadValue) { + rc = dixLookupResource((pointer *)&pGC, stuff->id, RT_GC, client, + DixGetAttrAccess); + if (rc == Success) + pFont = pGC->font; } + if (rc != Success) + return (rc == BadValue) ? BadFont: rc; { xCharInfo *pmax = FONTINKMAX(pFont); @@ -1422,28 +1419,27 @@ ProcQueryFont(ClientPtr client) int ProcQueryTextExtents(ClientPtr client) { - REQUEST(xQueryTextExtentsReq); xQueryTextExtentsReply reply; FontPtr pFont; GC *pGC; ExtentInfoRec info; unsigned long length; - + int rc; + REQUEST(xQueryTextExtentsReq); REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); - pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT, - DixReadAccess); - if (!pFont) - { - pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC, - DixReadAccess); - if (!pGC) - { - client->errorValue = stuff->fid; - return(BadFont); - } - pFont = pGC->font; + client->errorValue = stuff->fid; /* EITHER font or gc */ + rc = dixLookupResource((pointer *)&pFont, stuff->fid, RT_FONT, client, + DixGetAttrAccess); + if (rc == BadValue) { + rc = dixLookupResource((pointer *)&pGC, stuff->fid, RT_GC, client, + DixGetAttrAccess); + if (rc == Success) + pFont = pGC->font; } + if (rc != Success) + return (rc == BadValue) ? BadFont: rc; + length = client->req_len - (sizeof(xQueryTextExtentsReq) >> 2); length = length << 1; if (stuff->oddLength) @@ -1516,7 +1512,7 @@ ProcCreatePixmap(ClientPtr client) LEGAL_NEW_RESOURCE(stuff->pid, client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, - DixReadAccess); + DixGetAttrAccess); if (rc != Success) return rc; @@ -1559,9 +1555,17 @@ CreatePmap: { pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP, + pMap, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + (*pDraw->pScreen->DestroyPixmap)(pMap); + return rc; + } if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap)) return(client->noClientException); } + (*pDraw->pScreen->DestroyPixmap)(pMap); return (BadAlloc); } @@ -1569,13 +1573,13 @@ int ProcFreePixmap(ClientPtr client) { PixmapPtr pMap; - + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - pMap = (PixmapPtr)SecurityLookupIDByType(client, stuff->id, RT_PIXMAP, - DixDestroyAccess); - if (pMap) + + rc = dixLookupResource((pointer *)&pMap, stuff->id, RT_PIXMAP, client, + DixDestroyAccess); + if (rc == Success) { FreeResource(stuff->id, RT_NONE); return(client->noClientException); @@ -1583,7 +1587,7 @@ ProcFreePixmap(ClientPtr client) else { client->errorValue = stuff->id; - return (BadPixmap); + return (rc == BadValue) ? BadPixmap : rc; } } @@ -1599,15 +1603,16 @@ ProcCreateGC(ClientPtr client) REQUEST_AT_LEAST_SIZE(xCreateGCReq); client->errorValue = stuff->gc; LEGAL_NEW_RESOURCE(stuff->gc, client); - rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess); + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixGetAttrAccess); if (rc != Success) return rc; len = client->req_len - (sizeof(xCreateGCReq) >> 2); if (len != Ones(stuff->mask)) return BadLength; - pGC = (GC *)CreateGC(pDraw, stuff->mask, - (XID *) &stuff[1], &error); + pGC = (GC *)CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error, + stuff->gc, client); if (error != Success) return error; if (!AddResource(stuff->gc, RT_GC, (pointer)pGC)) @@ -1624,7 +1629,7 @@ ProcChangeGC(ClientPtr client) REQUEST(xChangeGCReq); REQUEST_AT_LEAST_SIZE(xChangeGCReq); - result = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess); + result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess); if (result != Success) return result; @@ -1651,10 +1656,10 @@ ProcCopyGC(ClientPtr client) REQUEST(xCopyGCReq); REQUEST_SIZE_MATCH(xCopyGCReq); - result = dixLookupGC(&pGC, stuff->srcGC, client, DixReadAccess); + result = dixLookupGC(&pGC, stuff->srcGC, client, DixGetAttrAccess); if (result != Success) return result; - result = dixLookupGC(&dstGC, stuff->dstGC, client, DixWriteAccess); + result = dixLookupGC(&dstGC, stuff->dstGC, client, DixSetAttrAccess); if (result != Success) return result; if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth)) @@ -1683,7 +1688,7 @@ ProcSetDashes(ClientPtr client) return BadValue; } - result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess); + result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess); if (result != Success) return result; @@ -1712,7 +1717,7 @@ ProcSetClipRectangles(ClientPtr client) client->errorValue = stuff->ordering; return BadValue; } - result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess); + result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess); if (result != Success) return result; @@ -1783,7 +1788,7 @@ ProcCopyArea(ClientPtr client) REQUEST_SIZE_MATCH(xCopyAreaReq); - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess); if (stuff->dstDrawable != stuff->srcDrawable) { rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0, @@ -1824,7 +1829,7 @@ ProcCopyPlane(ClientPtr client) REQUEST_SIZE_MATCH(xCopyPlaneReq); - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess); if (stuff->dstDrawable != stuff->srcDrawable) { rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0, @@ -1877,7 +1882,7 @@ ProcPolyPoint(ClientPtr client) client->errorValue = stuff->coordMode; return BadValue; } - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; if (npoint) (*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint, @@ -1900,7 +1905,7 @@ ProcPolyLine(ClientPtr client) client->errorValue = stuff->coordMode; return BadValue; } - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; if (npoint > 1) (*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint, @@ -1917,7 +1922,7 @@ ProcPolySegment(ClientPtr client) REQUEST(xPolySegmentReq); REQUEST_AT_LEAST_SIZE(xPolySegmentReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq); if (nsegs & 4) return(BadLength); @@ -1936,7 +1941,7 @@ ProcPolyRectangle (ClientPtr client) REQUEST(xPolyRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq); if (nrects & 4) return(BadLength); @@ -1956,7 +1961,7 @@ ProcPolyArc(ClientPtr client) REQUEST(xPolyArcReq); REQUEST_AT_LEAST_SIZE(xPolyArcReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); narcs = (client->req_len << 2) - sizeof(xPolyArcReq); if (narcs % sizeof(xArc)) return(BadLength); @@ -1988,7 +1993,7 @@ ProcFillPoly(ClientPtr client) return BadValue; } - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); things = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; if (things) (*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape, @@ -2006,7 +2011,7 @@ ProcPolyFillRectangle(ClientPtr client) REQUEST(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); if (things & 4) return(BadLength); @@ -2027,7 +2032,7 @@ ProcPolyFillArc(ClientPtr client) REQUEST(xPolyFillArcReq); REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); if (narcs % sizeof(xArc)) return(BadLength); @@ -2102,7 +2107,7 @@ ProcPutImage(ClientPtr client) REQUEST(xPutImageReq); REQUEST_AT_LEAST_SIZE(xPutImageReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); if (stuff->format == XYBitmap) { if ((stuff->depth != 1) || @@ -2265,8 +2270,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); } - if (pDraw->type == DRAWABLE_WINDOW && - !XaceHook(XACE_DRAWABLE_ACCESS, client, pDraw)) + if (pDraw->type == DRAWABLE_WINDOW) { pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw); if (pVisibleRegion) @@ -2388,7 +2392,7 @@ ProcPolyText(ClientPtr client) GC *pGC; REQUEST_AT_LEAST_SIZE(xPolyTextReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); err = PolyText(client, pDraw, @@ -2418,7 +2422,7 @@ ProcImageText8(ClientPtr client) REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); err = ImageText(client, pDraw, @@ -2448,7 +2452,7 @@ ProcImageText16(ClientPtr client) REQUEST(xImageTextReq); REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); err = ImageText(client, pDraw, @@ -2489,7 +2493,7 @@ ProcCreateColormap(ClientPtr client) } mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + result = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (result != Success) return result; @@ -2515,12 +2519,13 @@ int ProcFreeColormap(ClientPtr client) { ColormapPtr pmap; + int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pmap = (ColormapPtr )SecurityLookupIDByType(client, stuff->id, RT_COLORMAP, - DixDestroyAccess); - if (pmap) + rc = dixLookupResource((pointer *)&pmap, stuff->id, RT_COLORMAP, client, + DixDestroyAccess); + if (rc == Success) { /* Freeing a default colormap is a no-op */ if (!(pmap->flags & IsDefault)) @@ -2530,7 +2535,7 @@ ProcFreeColormap(ClientPtr client) else { client->errorValue = stuff->id; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2541,24 +2546,25 @@ ProcCopyColormapAndFree(ClientPtr client) Colormap mid; ColormapPtr pSrcMap; REQUEST(xCopyColormapAndFreeReq); - int result; + int rc; REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - if( (pSrcMap = (ColormapPtr )SecurityLookupIDByType(client, stuff->srcCmap, - RT_COLORMAP, DixReadAccess|DixWriteAccess)) ) + rc = dixLookupResource((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP, + client, DixReadAccess|DixRemoveAccess); + if (rc == Success) { - result = CopyColormapAndFree(mid, pSrcMap, client->index); + rc = CopyColormapAndFree(mid, pSrcMap, client->index); if (client->noClientException != Success) return(client->noClientException); else - return(result); + return rc; } else { client->errorValue = stuff->srcCmap; - return(BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2566,43 +2572,51 @@ int ProcInstallColormap(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, - RT_COLORMAP, DixReadAccess); - if (pcmp) - { - (*(pcmp->pScreen->InstallColormap)) (pcmp); - return (client->noClientException); - } - else - { - client->errorValue = stuff->id; - return (BadColor); - } + + rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, + DixInstallAccess); + if (rc != Success) + goto out; + + rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); + if (rc != Success) + goto out; + + (*(pcmp->pScreen->InstallColormap)) (pcmp); + + rc = client->noClientException; +out: + client->errorValue = stuff->id; + return (rc == BadValue) ? BadColor : rc; } int ProcUninstallColormap(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->id, - RT_COLORMAP, DixReadAccess); - if (pcmp) - { - if(pcmp->mid != pcmp->pScreen->defColormap) - (*(pcmp->pScreen->UninstallColormap)) (pcmp); - return (client->noClientException); - } - else - { - client->errorValue = stuff->id; - return (BadColor); - } + + rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client, + DixUninstallAccess); + if (rc != Success) + goto out; + + rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); + if (rc != Success) + goto out; + + if(pcmp->mid != pcmp->pScreen->defColormap) + (*(pcmp->pScreen->UninstallColormap)) (pcmp); + + rc = client->noClientException; +out: + client->errorValue = stuff->id; + return (rc == BadValue) ? BadColor : rc; } int @@ -2612,11 +2626,16 @@ ProcListInstalledColormaps(ClientPtr client) int nummaps, rc; WindowPtr pWin; REQUEST(xResourceReq); - REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); if (rc != Success) - return rc; + goto out; + + rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixGetAttrAccess); + if (rc != Success) + goto out; preply = (xListInstalledColormapsReply *) xalloc(sizeof(xListInstalledColormapsReply) + @@ -2635,21 +2654,23 @@ ProcListInstalledColormaps(ClientPtr client) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]); xfree(preply); - return(client->noClientException); + rc = client->noClientException; +out: + return rc; } int ProcAllocColor (ClientPtr client) { ColormapPtr pmap; - int retval; + int rc; xAllocColorReply acr; REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); - pmap = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); - if (pmap) + rc = dixLookupResource((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { acr.type = X_Reply; acr.length = 0; @@ -2658,13 +2679,13 @@ ProcAllocColor (ClientPtr client) acr.green = stuff->green; acr.blue = stuff->blue; acr.pixel = 0; - if( (retval = AllocColor(pmap, &acr.red, &acr.green, &acr.blue, + if( (rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue, &acr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else - return (retval); + return rc; } #ifdef PANORAMIX if (noPanoramiXExtension || !pmap->pScreen->myNum) @@ -2676,7 +2697,7 @@ ProcAllocColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2684,15 +2705,14 @@ int ProcAllocNamedColor (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xAllocNamedColorReq); REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { - int retval; - xAllocNamedColorReply ancr; ancr.type = X_Reply; @@ -2706,14 +2726,14 @@ ProcAllocNamedColor (ClientPtr client) ancr.screenGreen = ancr.exactGreen; ancr.screenBlue = ancr.exactBlue; ancr.pixel = 0; - if( (retval = AllocColor(pcmp, + if( (rc = AllocColor(pcmp, &ancr.screenRed, &ancr.screenGreen, &ancr.screenBlue, &ancr.pixel, client->index)) ) { if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) @@ -2728,7 +2748,7 @@ ProcAllocNamedColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2736,15 +2756,16 @@ int ProcAllocColorCells (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xAllocColorCellsReq); REQUEST_SIZE_MATCH(xAllocColorCellsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { xAllocColorCellsReply accr; - int npixels, nmasks, retval; + int npixels, nmasks; long length; Pixel *ppixels, *pmasks; @@ -2766,14 +2787,14 @@ ProcAllocColorCells (ClientPtr client) return(BadAlloc); pmasks = ppixels + npixels; - if( (retval = AllocColorCells(client->index, pcmp, npixels, nmasks, + if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks, (Bool)stuff->contiguous, ppixels, pmasks)) ) { xfree(ppixels); if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) @@ -2794,7 +2815,7 @@ ProcAllocColorCells (ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2802,15 +2823,16 @@ int ProcAllocColorPlanes(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixAddAccess); + if (rc == Success) { xAllocColorPlanesReply acpr; - int npixels, retval; + int npixels; long length; Pixel *ppixels; @@ -2832,7 +2854,7 @@ ProcAllocColorPlanes(ClientPtr client) ppixels = (Pixel *)xalloc(length); if(!ppixels) return(BadAlloc); - if( (retval = AllocColorPlanes(client->index, pcmp, npixels, + if( (rc = AllocColorPlanes(client->index, pcmp, npixels, (int)stuff->red, (int)stuff->green, (int)stuff->blue, (Bool)stuff->contiguous, ppixels, &acpr.redMask, &acpr.greenMask, &acpr.blueMask)) ) @@ -2841,7 +2863,7 @@ ProcAllocColorPlanes(ClientPtr client) if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } acpr.length = length >> 2; #ifdef PANORAMIX @@ -2858,7 +2880,7 @@ ProcAllocColorPlanes(ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2866,34 +2888,34 @@ int ProcFreeColors(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xFreeColorsReq); REQUEST_AT_LEAST_SIZE(xFreeColorsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixRemoveAccess); + if (rc == Success) { int count; - int retval; if(pcmp->flags & AllAllocated) return(BadAccess); count = ((client->req_len << 2)- sizeof(xFreeColorsReq)) >> 2; - retval = FreeColors(pcmp, client->index, count, + rc = FreeColors(pcmp, client->index, count, (Pixel *)&stuff[1], (Pixel)stuff->planeMask); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; - return(retval); + return rc; } } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2901,33 +2923,33 @@ int ProcStoreColors (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xStoreColorsReq); REQUEST_AT_LEAST_SIZE(xStoreColorsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixWriteAccess); + if (rc == Success) { int count; - int retval; count = (client->req_len << 2) - sizeof(xStoreColorsReq); if (count % sizeof(xColorItem)) return(BadLength); count /= sizeof(xColorItem); - retval = StoreColors(pcmp, count, (xColorItem *)&stuff[1]); + rc = StoreColors(pcmp, count, (xColorItem *)&stuff[1]); if (client->noClientException != Success) return(client->noClientException); else { client->errorValue = clientErrorValue; - return(retval); + return rc; } } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2935,33 +2957,33 @@ int ProcStoreNamedColor (ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xStoreNamedColorReq); REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixWriteAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixWriteAccess); + if (rc == Success) { xColorItem def; - int retval; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &def.red, &def.green, &def.blue)) { def.flags = stuff->flags; def.pixel = stuff->pixel; - retval = StoreColors(pcmp, 1, &def); + rc = StoreColors(pcmp, 1, &def); if (client->noClientException != Success) return(client->noClientException); else - return(retval); + return rc; } return (BadName); } else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -2969,14 +2991,15 @@ int ProcQueryColors(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xQueryColorsReq); REQUEST_AT_LEAST_SIZE(xQueryColorsReq); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixReadAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixReadAccess); + if (rc == Success) { - int count, retval; + int count; xrgb *prgbs; xQueryColorsReply qcr; @@ -2984,7 +3007,7 @@ ProcQueryColors(ClientPtr client) prgbs = (xrgb *)xalloc(count * sizeof(xrgb)); if(!prgbs && count) return(BadAlloc); - if( (retval = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) + if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) ) { if (prgbs) xfree(prgbs); if (client->noClientException != Success) @@ -2992,7 +3015,7 @@ ProcQueryColors(ClientPtr client) else { client->errorValue = clientErrorValue; - return (retval); + return rc; } } qcr.type = X_Reply; @@ -3012,7 +3035,7 @@ ProcQueryColors(ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -3020,12 +3043,13 @@ int ProcLookupColor(ClientPtr client) { ColormapPtr pcmp; + int rc; REQUEST(xLookupColorReq); REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes); - pcmp = (ColormapPtr)SecurityLookupIDByType(client, stuff->cmap, - RT_COLORMAP, DixReadAccess); - if (pcmp) + rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client, + DixReadAccess); + if (rc == Success) { xLookupColorReply lcr; @@ -3050,7 +3074,7 @@ ProcLookupColor(ClientPtr client) else { client->errorValue = stuff->cmap; - return (BadColor); + return (rc == BadValue) ? BadColor : rc; } } @@ -3065,28 +3089,28 @@ ProcCreateCursor (ClientPtr client) unsigned short width, height; long n; CursorMetricRec cm; - + int rc; REQUEST(xCreateCursorReq); REQUEST_SIZE_MATCH(xCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); - src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source, - RT_PIXMAP, DixReadAccess); - msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask, - RT_PIXMAP, DixReadAccess); - if ( src == (PixmapPtr)NULL) - { + rc = dixLookupResource((pointer *)&src, stuff->source, RT_PIXMAP, client, + DixReadAccess); + if (rc != Success) { client->errorValue = stuff->source; - return (BadPixmap); + return (rc == BadValue) ? BadPixmap : rc; } - if ( msk == (PixmapPtr)NULL) + + rc = dixLookupResource((pointer *)&msk, stuff->mask, RT_PIXMAP, client, + DixReadAccess); + if (rc != Success) { if (stuff->mask != None) { client->errorValue = stuff->mask; - return (BadPixmap); + return (rc == BadValue) ? BadPixmap : rc; } } else if ( src->drawable.width != msk->drawable.width @@ -3134,13 +3158,17 @@ ProcCreateCursor (ClientPtr client) cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; - pCursor = AllocCursor( srcbits, mskbits, &cm, - stuff->foreRed, stuff->foreGreen, stuff->foreBlue, - stuff->backRed, stuff->backGreen, stuff->backBlue); + rc = AllocARGBCursor(srcbits, mskbits, NULL, &cm, + stuff->foreRed, stuff->foreGreen, stuff->foreBlue, + stuff->backRed, stuff->backGreen, stuff->backBlue, + &pCursor, client, stuff->cid); - if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) - return (client->noClientException); - return BadAlloc; + if (rc != Success) + return rc; + if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) + return BadAlloc; + + return client->noClientException; } int @@ -3158,7 +3186,7 @@ ProcCreateGlyphCursor (ClientPtr client) stuff->mask, stuff->maskChar, stuff->foreRed, stuff->foreGreen, stuff->foreBlue, stuff->backRed, stuff->backGreen, stuff->backBlue, - &pCursor, client); + &pCursor, client, stuff->cid); if (res != Success) return res; if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) @@ -3171,12 +3199,13 @@ int ProcFreeCursor (ClientPtr client) { CursorPtr pCursor; + int rc; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id, - RT_CURSOR, DixDestroyAccess); - if (pCursor) + rc = dixLookupResource((pointer *)&pCursor, stuff->id, RT_CURSOR, client, + DixDestroyAccess); + if (rc == Success) { FreeResource(stuff->id, RT_NONE); return (client->noClientException); @@ -3184,7 +3213,7 @@ ProcFreeCursor (ClientPtr client) else { client->errorValue = stuff->id; - return (BadCursor); + return (rc == BadValue) ? BadCursor : rc; } } @@ -3207,12 +3236,15 @@ ProcQueryBestSize (ClientPtr client) } rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, - DixReadAccess); + DixGetAttrAccess); if (rc != Success) return rc; if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW) return (BadMatch); pScreen = pDraw->pScreen; + rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess); + if (rc != Success) + return rc; (* pScreen->QueryBestSize)(stuff->class, &stuff->width, &stuff->height, pScreen); reply.type = X_Reply; @@ -3228,10 +3260,17 @@ ProcQueryBestSize (ClientPtr client) int ProcSetScreenSaver (ClientPtr client) { - int blankingOption, exposureOption; + int rc, i, blankingOption, exposureOption; REQUEST(xSetScreenSaverReq); - REQUEST_SIZE_MATCH(xSetScreenSaverReq); + + for (i = 0; i < screenInfo.numScreens; i++) { + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i], + DixSetAttrAccess); + if (rc != Success) + return rc; + } + blankingOption = stuff->preferBlank; if ((blankingOption != DontPreferBlanking) && (blankingOption != PreferBlanking) && @@ -3285,8 +3324,16 @@ int ProcGetScreenSaver(ClientPtr client) { xGetScreenSaverReply rep; - + int rc, i; REQUEST_SIZE_MATCH(xReq); + + for (i = 0; i < screenInfo.numScreens; i++) { + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i], + DixGetAttrAccess); + if (rc != Success) + return rc; + } + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -3333,8 +3380,9 @@ ProcListHosts(ClientPtr client) REQUEST_SIZE_MATCH(xListHostsReq); /* untrusted clients can't list hosts */ - if (!XaceHook(XACE_HOSTLIST_ACCESS, client, DixReadAccess)) - return BadAccess; + result = XaceHook(XACE_SERVER_ACCESS, client, DixReadAccess); + if (result != Success) + return result; result = GetHosts(&pdata, &nHosts, &len, &reply.enabled); if (result != Success) @@ -3464,12 +3512,14 @@ int ProcGetFontPath(ClientPtr client) { xGetFontPathReply reply; - int stringLens, numpaths; + int rc, stringLens, numpaths; unsigned char *bufferStart; /* REQUEST (xReq); */ REQUEST_SIZE_MATCH(xReq); - bufferStart = GetFontPath(&numpaths, &stringLens); + rc = GetFontPath(client, &numpaths, &stringLens, &bufferStart); + if (rc != Success) + return rc; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -3485,9 +3535,14 @@ ProcGetFontPath(ClientPtr client) int ProcChangeCloseDownMode(ClientPtr client) { + int rc; REQUEST(xSetCloseDownModeReq); - REQUEST_SIZE_MATCH(xSetCloseDownModeReq); + + rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess); + if (rc != Success) + return rc; + if ((stuff->mode == AllTemporary) || (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) @@ -3504,6 +3559,7 @@ ProcChangeCloseDownMode(ClientPtr client) int ProcForceScreenSaver(ClientPtr client) { + int rc; REQUEST(xForceScreenSaverReq); REQUEST_SIZE_MATCH(xForceScreenSaverReq); @@ -3514,7 +3570,9 @@ int ProcForceScreenSaver(ClientPtr client) client->errorValue = stuff->mode; return BadValue; } - SaveScreens(SCREEN_SAVER_FORCER, (int)stuff->mode); + rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, (int)stuff->mode); + if (rc != Success) + return rc; return client->noClientException; } @@ -3636,6 +3694,7 @@ CloseDownClient(ClientPtr client) #ifdef SMART_SCHEDULE SmartLastClient = NullClient; #endif + dixFreePrivates(client->devPrivates); xfree(client); while (!clients[currentMaxClients-1]) @@ -3655,30 +3714,13 @@ KillAllClients(void) } } -extern int clientPrivateLen; -extern unsigned *clientPrivateSizes; -extern unsigned totalClientSize; - void InitClient(ClientPtr client, int i, pointer ospriv) { client->index = i; client->sequence = 0; client->clientAsMask = ((Mask)i) << CLIENTOFFSET; client->clientGone = FALSE; - if (i) - { - client->closeDownMode = DestroyAll; - client->lastDrawable = (DrawablePtr)WindowTable[0]; - client->lastDrawableID = WindowTable[0]->drawable.id; - } - else - { - client->closeDownMode = RetainPermanent; - client->lastDrawable = (DrawablePtr)NULL; - client->lastDrawableID = INVALID; - } - client->lastGC = (GCPtr) NULL; - client->lastGCID = INVALID; + client->closeDownMode = i ? DestroyAll : RetainPermanent; client->numSaved = 0; client->saveSet = (SaveSetElt *)NULL; client->noClientException = Success; @@ -3691,6 +3733,7 @@ void InitClient(ClientPtr client, int i, pointer ospriv) client->big_requests = FALSE; client->priority = 0; client->clientState = ClientStateInitial; + client->devPrivates = NULL; #ifdef XKB if (!noXkbExtension) { client->xkbClientFlags = 0; @@ -3711,54 +3754,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv) #endif } -int -InitClientPrivates(ClientPtr client) -{ - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; - - if (totalClientSize == sizeof(ClientRec)) - ppriv = (DevUnion *)NULL; - else if (client->index) - ppriv = (DevUnion *)(client + 1); - else - { - ppriv = (DevUnion *)xalloc(totalClientSize - sizeof(ClientRec)); - if (!ppriv) - return 0; - } - client->devPrivates = ppriv; - sizes = clientPrivateSizes; - ptr = (char *)(ppriv + clientPrivateLen); - if (ppriv) - bzero(ppriv, totalClientSize - sizeof(ClientRec)); - for (i = clientPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } - - /* Allow registrants to initialize the serverClient devPrivates */ - if (!client->index && ClientStateCallback) - { - NewClientInfoRec clientinfo; - - clientinfo.client = client; - clientinfo.prefix = (xConnSetupPrefix *)NULL; - clientinfo.setup = (xConnSetup *) NULL; - CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); - } - return 1; -} - /************************ * int NextAvailableClient(ospriv) * @@ -3775,11 +3770,10 @@ ClientPtr NextAvailableClient(pointer ospriv) i = nextFreeClientID; if (i == MAXCLIENTS) return (ClientPtr)NULL; - clients[i] = client = (ClientPtr)xalloc(totalClientSize); + clients[i] = client = (ClientPtr)xalloc(sizeof(ClientRec)); if (!client) return (ClientPtr)NULL; InitClient(client, i, ospriv); - InitClientPrivates(client); if (!InitClientResources(client)) { xfree(client); @@ -4002,9 +3996,11 @@ DeleteWindowFromAnySelections(WindowPtr pWin) info.kind = SelectionWindowDestroy; CallCallbacks(&SelectionCallback, &info); } + dixFreePrivates(CurrentSelections[i].devPrivates); CurrentSelections[i].pWin = (WindowPtr)NULL; CurrentSelections[i].window = None; CurrentSelections[i].client = NullClient; + CurrentSelections[i].devPrivates = NULL; } } @@ -4024,9 +4020,11 @@ DeleteClientFromAnySelections(ClientPtr client) info.kind = SelectionWindowDestroy; CallCallbacks(&SelectionCallback, &info); } + dixFreePrivates(CurrentSelections[i].devPrivates); CurrentSelections[i].pWin = (WindowPtr)NULL; CurrentSelections[i].window = None; CurrentSelections[i].client = NullClient; + CurrentSelections[i].devPrivates = NULL; } } @@ -4035,60 +4033,3 @@ MarkClientException(ClientPtr client) { client->noClientException = -1; } - -#ifdef XSERVER_DTRACE -#include <ctype.h> - -/* Load table of request names for dtrace probes */ -static void LoadRequestNames(void) -{ - int i; - FILE *xedb; - extern void LoadExtensionNames(char **RequestNames); - - bzero(RequestNames, 256 * sizeof(char *)); - - xedb = fopen(XERRORDB_PATH, "r"); - if (xedb != NULL) { - char buf[256]; - while (fgets(buf, sizeof(buf), xedb)) { - if ((strncmp("XRequest.", buf, 9) == 0) && (isdigit(buf[9]))) { - char *name; - i = strtol(buf + 9, &name, 10); - if (RequestNames[i] == 0) { - char *end = strchr(name, '\n'); - if (end) { *end = '\0'; } - RequestNames[i] = strdup(name + 1); - } - } - } - fclose(xedb); - } - - LoadExtensionNames(RequestNames); - - for (i = 0; i < 256; i++) { - if (RequestNames[i] == 0) { -#define RN_SIZE 12 /* "Request#' + up to 3 digits + \0 */ - RequestNames[i] = xalloc(RN_SIZE); - if (RequestNames[i]) { - snprintf(RequestNames[i], RN_SIZE, "Request#%d", i); - } - } - /* fprintf(stderr, "%d: %s\n", i, RequestNames[i]); */ - } -} - -static void FreeRequestNames(void) -{ - int i; - - for (i = 0; i < 256; i++) { - if (RequestNames[i] != 0) { - free(RequestNames[i]); - RequestNames[i] = 0; - } - } -} - -#endif diff --git a/dix/dixfonts.c b/dix/dixfonts.c index f214ef5ad..e9a3f3963 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -65,6 +65,7 @@ Equipment Corporation. #include "dixfontstr.h" #include "closestr.h" #include "dixfont.h" +#include "xace.h" #ifdef DEBUG #include <stdio.h> @@ -325,6 +326,13 @@ doOpenFont(ClientPtr client, OFclosurePtr c) err = BadFontName; goto bail; } + /* check values for firstCol, lastCol, firstRow, and lastRow */ + if (pfont->info.firstCol > pfont->info.lastCol || + pfont->info.firstRow > pfont->info.lastRow || + pfont->info.lastCol - pfont->info.firstCol > 255) { + err = AllocError; + goto bail; + } if (!pfont->fpe) pfont->fpe = fpe; pfont->refcnt++; @@ -833,6 +841,10 @@ ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, if (length > XLFDMAXFONTNAMELEN) return BadAlloc; + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + if (!(c = (LFclosurePtr) xalloc(sizeof *c))) return BadAlloc; c->fpe_list = (FontPathElementPtr *) @@ -1105,6 +1117,10 @@ StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern, if (length > XLFDMAXFONTNAMELEN) return BadAlloc; + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + if (!(c = (LFWIclosurePtr) xalloc(sizeof *c))) goto badAlloc; c->fpe_list = (FontPathElementPtr *) @@ -1628,9 +1644,6 @@ FreeFontPath(FontPathElementPtr *list, int n, Bool force) found++; } if (list[i]->refcount != found) { - ErrorF("FreeFontPath: FPE \"%.*s\" refcount is %d, should be %d; fixing.\n", - list[i]->name_length, list[i]->name, - list[i]->refcount, found); list[i]->refcount = found; /* ensure it will get freed */ } } @@ -1771,7 +1784,9 @@ bail: int SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error) { - int err = Success; + int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess); + if (err != Success) + return err; if (npaths == 0) { if (SetDefaultFontPath(defaultFontPath) != Success) @@ -1823,14 +1838,18 @@ SetDefaultFontPath(char *path) return err; } -unsigned char * -GetFontPath(int *count, int *length) +int +GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result) { int i; unsigned char *c; int len; FontPathElementPtr fpe; + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + len = 0; for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; @@ -1838,7 +1857,7 @@ GetFontPath(int *count, int *length) } font_path_string = (unsigned char *) xrealloc(font_path_string, len); if (!font_path_string) - return NULL; + return BadAlloc; c = font_path_string; *length = 0; @@ -1850,7 +1869,8 @@ GetFontPath(int *count, int *length) c += fpe->name_length; } *count = num_fpes; - return font_path_string; + *result = font_path_string; + return Success; } _X_EXPORT int @@ -1911,12 +1931,15 @@ GetDefaultPointSize () FontResolutionPtr GetClientResolutions (int *num) { +#ifdef XPRINT if (requestingClient && requestingClient->fontResFunc != NULL && !requestingClient->clientGone) { return (*requestingClient->fontResFunc)(requestingClient, num); } - else { + else +#endif + { static struct _FontResolution res; ScreenPtr pScreen; diff --git a/dix/dixutils.c b/dix/dixutils.c index c1e30ff18..aaf510623 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -208,34 +208,23 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, Mask type, Mask access) { DrawablePtr pTmp; - RESTYPE rtype; + int rc; + *pDraw = NULL; client->errorValue = id; if (id == INVALID) return BadDrawable; - if (id == client->lastDrawableID) { - pTmp = client->lastDrawable; - - /* an access check is required for cached drawables */ - rtype = (type & M_WINDOW) ? RT_WINDOW : RT_PIXMAP; - if (!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, access, pTmp)) - return BadDrawable; - } else - pTmp = (DrawablePtr)SecurityLookupIDByClass(client, id, RC_DRAWABLE, - access); - if (!pTmp) + rc = dixLookupResource((pointer *)&pTmp, id, RC_DRAWABLE, client, access); + + if (rc == BadValue) return BadDrawable; + if (rc != Success) + return rc; if (!((1 << pTmp->type) & (type ? type : M_DRAWABLE))) return BadMatch; - if (type & M_DRAWABLE) { - client->lastDrawable = pTmp; - client->lastDrawableID = id; - client->lastGCID = INVALID; - client->lastGC = (GCPtr)NULL; - } *pDraw = pTmp; return Success; } @@ -264,75 +253,28 @@ dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) _X_EXPORT int dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) { - pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, - access); - int clientIndex = CLIENT_ID(rid); - client->errorValue = rid; - - if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) { - *pClient = clients[clientIndex]; - return Success; - } - *pClient = NULL; - return BadValue; -} - -/* - * These are deprecated compatibility functions and will be removed soon! - * Please use the new dixLookup*() functions above. - */ -_X_EXPORT _X_DEPRECATED WindowPtr -SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode) -{ - WindowPtr pWin; - int i = dixLookupWindow(&pWin, id, client, access_mode); - static int warn = 1; - if (warn-- > 0) - ErrorF("Warning: LookupWindow()/SecurityLookupWindow() " - "are deprecated. Please convert your driver/module " - "to use dixLookupWindow().\n"); - return (i == Success) ? pWin : NULL; -} + pointer pRes; + int rc = BadValue, clientIndex = CLIENT_ID(rid); -_X_EXPORT _X_DEPRECATED WindowPtr -LookupWindow(XID id, ClientPtr client) -{ - return SecurityLookupWindow(id, client, DixUnknownAccess); -} + if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT)) + goto bad; -_X_EXPORT _X_DEPRECATED pointer -SecurityLookupDrawable(XID id, ClientPtr client, Mask access_mode) -{ - DrawablePtr pDraw; - int i = dixLookupDrawable(&pDraw, id, client, M_DRAWABLE, access_mode); - static int warn = 1; - if (warn-- > 0) - ErrorF("Warning: LookupDrawable()/SecurityLookupDrawable() " - "are deprecated. Please convert your driver/module " - "to use dixLookupDrawable().\n"); - return (i == Success) ? pDraw : NULL; -} + rc = dixLookupResource(&pRes, rid, RC_ANY, client, DixGetAttrAccess); + if (rc != Success) + goto bad; -_X_EXPORT _X_DEPRECATED pointer -LookupDrawable(XID id, ClientPtr client) -{ - return SecurityLookupDrawable(id, client, DixUnknownAccess); -} + rc = XaceHook(XACE_CLIENT_ACCESS, client, clients[clientIndex], access); + if (rc != Success) + goto bad; -_X_EXPORT _X_DEPRECATED ClientPtr -LookupClient(XID id, ClientPtr client) -{ - ClientPtr pClient; - int i = dixLookupClient(&pClient, id, client, DixUnknownAccess); - static int warn = 1; - if (warn-- > 0) - ErrorF("Warning: LookupClient() is deprecated. Please convert your " - "driver/module to use dixLookupClient().\n"); - return (i == Success) ? pClient : NULL; + *pClient = clients[clientIndex]; + return Success; +bad: + client->errorValue = rid; + *pClient = NULL; + return rc; } -/* end deprecated functions */ - int AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode, Bool toRoot, Bool remap) @@ -858,7 +800,7 @@ _DeleteCallbackList( for (i = 0; i < numCallbackListsToCleanup; i++) { - if ((listsToCleanup[i] = pcbl) != 0) + if (listsToCleanup[i] == pcbl) { listsToCleanup[i] = NULL; break; @@ -874,16 +816,8 @@ _DeleteCallbackList( *pcbl = NULL; } -static CallbackFuncsRec default_cbfuncs = -{ - _AddCallback, - _DeleteCallback, - _CallCallbacks, - _DeleteCallbackList -}; - static Bool -CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) +CreateCallbackList(CallbackListPtr *pcbl) { CallbackListPtr cbl; int i; @@ -891,7 +825,6 @@ CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs) if (!pcbl) return FALSE; cbl = (CallbackListPtr) xalloc(sizeof(CallbackListRec)); if (!cbl) return FALSE; - cbl->funcs = cbfuncs ? *cbfuncs : default_cbfuncs; cbl->inCallback = 0; cbl->deleted = FALSE; cbl->numDeleted = 0; @@ -922,31 +855,31 @@ AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) if (!pcbl) return FALSE; if (!*pcbl) { /* list hasn't been created yet; go create it */ - if (!CreateCallbackList(pcbl, (CallbackFuncsPtr)NULL)) + if (!CreateCallbackList(pcbl)) return FALSE; } - return ((*(*pcbl)->funcs.AddCallback) (pcbl, callback, data)); + return _AddCallback(pcbl, callback, data); } _X_EXPORT Bool DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data) { if (!pcbl || !*pcbl) return FALSE; - return ((*(*pcbl)->funcs.DeleteCallback) (pcbl, callback, data)); + return _DeleteCallback(pcbl, callback, data); } void CallCallbacks(CallbackListPtr *pcbl, pointer call_data) { if (!pcbl || !*pcbl) return; - (*(*pcbl)->funcs.CallCallbacks) (pcbl, call_data); + _CallCallbacks(pcbl, call_data); } void DeleteCallbackList(CallbackListPtr *pcbl) { if (!pcbl || !*pcbl) return; - (*(*pcbl)->funcs.DeleteCallbackList) (pcbl); + _DeleteCallbackList(pcbl); } void diff --git a/dix/events.c b/dix/events.c index 85f42b31e..4a8e480c8 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1754,8 +1754,10 @@ DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count, if (filter != CantBeFiltered && !((wOtherEventMasks(pWin)|pWin->eventMask) & filter)) return 0; - if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count, - pWin->eventMask, filter, grab)) ) + if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) + /* do nothing */; + else if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count, + pWin->eventMask, filter, grab)) ) { if (attempt > 0) { @@ -1782,7 +1784,10 @@ DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count, other = (InputClients *)wOtherClients(pWin); for (; other; other = other->next) { - if ( (attempt = TryClientEvents(rClient(other), pEvents, count, + if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, + count)) + /* do nothing */; + else if ( (attempt = TryClientEvents(rClient(other), pEvents, count, other->mask[mskidx], filter, grab)) ) { if (attempt > 0) @@ -1879,6 +1884,8 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, return XineramaTryClientEventsResult( wClient(pWin), NullGrab, pWin->eventMask, filter); #endif + if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count)) + return 1; /* don't send, but pretend we did */ return TryClientEvents(wClient(pWin), pEvents, count, pWin->eventMask, filter, NullGrab); } @@ -1893,6 +1900,9 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, return XineramaTryClientEventsResult( rClient(other), NullGrab, other->mask, filter); #endif + if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents, + count)) + return 1; /* don't send, but pretend we did */ return TryClientEvents(rClient(other), pEvents, count, other->mask, filter, NullGrab); } @@ -1987,6 +1997,9 @@ DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab, Mask filter = filters[type]; int deliveries = 0; + if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count)) + return 0; + if (type & EXTENSION_EVENT_BASE) { OtherInputMasks *inputMasks; @@ -2579,18 +2592,24 @@ ProcWarpPointer(ClientPtr client) WindowPtr dest = NULL; int x, y, rc; ScreenPtr newScreen; - + DeviceIntPtr dev; REQUEST(xWarpPointerReq); - REQUEST_SIZE_MATCH(xWarpPointerReq); + for (dev = inputInfo.devices; dev; dev = dev->next) { + if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess); + if (rc != Success) + return rc; + } + } #ifdef PANORAMIX if(!noPanoramiXExtension) return XineramaWarpPointer(client); #endif if (stuff->dstWid != None) { - rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess); if (rc != Success) return rc; } @@ -2603,7 +2622,7 @@ ProcWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - rc = dixLookupWindow(&source, winID, client, DixReadAccess); + rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -2745,8 +2764,6 @@ CheckPassiveGrabsOnWindow( (grab->confineTo->realized && BorderSizeNotEmpty(grab->confineTo)))) { - if (!XaceHook(XACE_DEVICE_ACCESS, wClient(pWin), device, FALSE)) - return FALSE; #ifdef XKB if (!noXkbExtension) { XE_KBPTR.state &= 0x1f00; @@ -2880,6 +2897,8 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count) if (DeliverDeviceEvents(window, xE, NullGrab, focus, keybd, count)) return; } + if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count)) + return; /* just deliver it to the focus window */ FixUpEventFromWindow(xE, focus, None, FALSE); if (xE->u.u.type & EXTENSION_EVENT_BASE) @@ -2929,9 +2948,14 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev, if (!deliveries) { FixUpEventFromWindow(xE, grab->window, None, TRUE); - deliveries = TryClientEvents(rClient(grab), xE, count, - (Mask)grab->eventMask, - filters[xE->u.u.type], grab); + if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, grab->window, xE, count) || + XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), grab->window, xE, + count)) + deliveries = 1; /* don't send, but pretend we did */ + else + deliveries = TryClientEvents(rClient(grab), xE, count, + (Mask)grab->eventMask, + filters[xE->u.u.type], grab); if (deliveries && (xE->u.u.type == MotionNotify #ifdef XINPUT || xE->u.u.type == DeviceMotionNotify @@ -3288,7 +3312,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) deactivateGrab = TRUE; break; default: - FatalError("bogus pointer event from ddx"); + FatalError("bogus pointer event from ddx: %d", xE->u.u.type); } } else if (!CheckMotion(xE)) @@ -3304,6 +3328,8 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count) #define AtMostOneClient \ (SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask) +#define ManagerMask \ + (SubstructureRedirectMask | ResizeRedirectMask) /** * Recalculate which events may be deliverable for the given window. @@ -3392,12 +3418,20 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask) { Mask check; OtherClients * others; + int rc; if (mask & ~AllEventMasks) { client->errorValue = mask; return BadValue; } + check = (mask & ManagerMask); + if (check) { + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, + RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess); + if (rc != Success) + return rc; + } check = (mask & AtMostOneClient); if (check & (pWin->eventMask|wOtherEventMasks(pWin))) { /* It is illegal for two different @@ -3599,10 +3633,10 @@ EnterLeaveEvent( xKeymapEvent ke; ClientPtr client = grab ? rClient(grab) : clients[CLIENT_ID(pWin->drawable.id)]; - if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, FALSE)) - memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); - else + if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) bzero((char *)&ke.map[0], 31); + else + memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31); ke.type = KeymapNotify; if (grab) @@ -3706,10 +3740,10 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) { xKeymapEvent ke; ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)]; - if (XaceHook(XACE_DEVICE_ACCESS, client, dev, FALSE)) - memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); - else + if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess)) bzero((char *)&ke.map[0], 31); + else + memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31); ke.type = KeymapNotify; (void)DeliverEventsToWindow(pWin, (xEvent *)&ke, 1, @@ -3934,7 +3968,7 @@ SetInputFocus( else if ((focusID == FollowKeyboard) && followOK) focusWin = inputInfo.keyboard->focus->win; else { - rc = dixLookupWindow(&focusWin, focusID, client, DixReadAccess); + rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess); if (rc != Success) return rc; /* It is a match error to try to set the input focus to an @@ -3942,6 +3976,10 @@ SetInputFocus( if(!focusWin->realized) return(BadMatch); } + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess); + if (rc != Success) + return Success; + focus = dev->focus; if ((CompareTimeStamps(time, currentTime) == LATER) || (CompareTimeStamps(time, focus->time) == EARLIER)) @@ -3994,9 +4032,6 @@ ProcSetInputFocus(client) REQUEST_SIZE_MATCH(xSetInputFocusReq); - if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE)) - return Success; - return SetInputFocus(client, inputInfo.keyboard, stuff->focus, stuff->revertTo, stuff->time, FALSE); } @@ -4011,10 +4046,16 @@ int ProcGetInputFocus(ClientPtr client) { xGetInputFocusReply rep; - /* REQUEST(xReq); */ FocusClassPtr focus = inputInfo.keyboard->focus; - + int rc; + /* REQUEST(xReq); */ REQUEST_SIZE_MATCH(xReq); + + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, + DixGetFocusAccess); + if (rc != Success) + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -4044,6 +4085,7 @@ ProcGrabPointer(ClientPtr client) CursorPtr cursor, oldCursor; REQUEST(xGrabPointerReq); TimeStamp time; + Mask access_mode = DixGrabAccess; int rc; REQUEST_SIZE_MATCH(xGrabPointerReq); @@ -4070,7 +4112,7 @@ ProcGrabPointer(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (stuff->confineTo == None) @@ -4078,7 +4120,7 @@ ProcGrabPointer(ClientPtr client) else { rc = dixLookupWindow(&confineTo, stuff->confineTo, client, - DixReadAccess); + DixSetAttrAccess); if (rc != Success) return rc; } @@ -4086,14 +4128,22 @@ ProcGrabPointer(ClientPtr client) cursor = NullCursor; else { - cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, DixReadAccess); - if (!cursor) + rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) { client->errorValue = stuff->cursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } + access_mode |= DixForceAccess; } + if (stuff->pointerMode == GrabModeSync || + stuff->keyboardMode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, device, access_mode); + if (rc != Success) + return rc; + /* at this point, some sort of reply is guaranteed. */ time = ClientTimeToServerTime(stuff->time); rep.type = X_Reply; @@ -4168,12 +4218,12 @@ ProcChangeActivePointerGrab(ClientPtr client) newCursor = NullCursor; else { - newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, DixReadAccess); - if (!newCursor) + int rc = dixLookupResource((pointer *)&newCursor, stuff->cursor, + RT_CURSOR, client, DixUseAccess); + if (rc != Success) { client->errorValue = stuff->cursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } } if (!grab) @@ -4245,6 +4295,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, WindowPtr pWin; GrabPtr grab; TimeStamp time; + Mask access_mode = DixGrabAccess; int rc; UpdateCurrentTime(); @@ -4263,9 +4314,16 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, client->errorValue = ownerEvents; return BadValue; } - rc = dixLookupWindow(&pWin, grabWindow, client, DixReadAccess); + + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (this_mode == GrabModeSync || other_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); if (rc != Success) return rc; + time = ClientTimeToServerTime(ctime); grab = dev->grab; if (grab && !SameClient(grab, client)) @@ -4309,15 +4367,10 @@ ProcGrabKeyboard(ClientPtr client) REQUEST_SIZE_MATCH(xGrabKeyboardReq); - if (XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE)) - result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode, - stuff->pointerMode, stuff->grabWindow, - stuff->ownerEvents, stuff->time, - KeyPressMask | KeyReleaseMask, &rep.status); - else { - result = Success; - rep.status = AlreadyGrabbed; - } + result = GrabDevice(client, inputInfo.keyboard, stuff->keyboardMode, + stuff->pointerMode, stuff->grabWindow, + stuff->ownerEvents, stuff->time, + KeyPressMask | KeyReleaseMask, &rep.status); if (result != Success) return result; @@ -4362,14 +4415,18 @@ ProcQueryPointer(ClientPtr client) { xQueryPointerReply rep; WindowPtr pWin, t; - REQUEST(xResourceReq); DeviceIntPtr mouse = inputInfo.pointer; int rc; - + REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + + rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); if (rc != Success) return rc; + rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess); + if (rc != Success) + return rc; + if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; @@ -4542,7 +4599,7 @@ ProcSendEvent(ClientPtr client) effectiveFocus = pWin = inputFocus; } else - dixLookupWindow(&pWin, stuff->destination, client, DixReadAccess); + dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess); if (!pWin) return BadWindow; @@ -4556,6 +4613,9 @@ ProcSendEvent(ClientPtr client) { for (;pWin; pWin = pWin->parent) { + if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, + &stuff->event, 1)) + return Success; if (DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0)) return Success; @@ -4566,7 +4626,7 @@ ProcSendEvent(ClientPtr client) break; } } - else + else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1)) (void)DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, NullGrab, 0); return Success; @@ -4666,7 +4726,7 @@ ProcGrabKey(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; @@ -4677,7 +4737,7 @@ ProcGrabKey(ClientPtr client) NullWindow, NullCursor); if (!grab) return BadAlloc; - return AddPassiveGrabToList(grab); + return AddPassiveGrabToList(client, grab); } @@ -4694,6 +4754,7 @@ ProcGrabButton(ClientPtr client) REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; + Mask access_mode = DixGrabAccess; int rc; REQUEST_SIZE_MATCH(xGrabButtonReq); @@ -4725,14 +4786,14 @@ ProcGrabButton(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { rc = dixLookupWindow(&confineTo, stuff->confineTo, client, - DixReadAccess); + DixSetAttrAccess); if (rc != Success) return rc; } @@ -4740,15 +4801,22 @@ ProcGrabButton(ClientPtr client) cursor = NullCursor; else { - cursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, DixReadAccess); + rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) if (!cursor) { client->errorValue = stuff->cursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } + access_mode |= DixForceAccess; } - + if (stuff->pointerMode == GrabModeSync || + stuff->keyboardMode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, access_mode); + if (rc != Success) + return rc; grab = CreateGrab(client->index, inputInfo.pointer, pWin, (Mask)stuff->eventMask, (Bool)stuff->ownerEvents, @@ -4757,7 +4825,7 @@ ProcGrabButton(ClientPtr client) stuff->button, confineTo, cursor); if (!grab) return BadAlloc; - return AddPassiveGrabToList(grab); + return AddPassiveGrabToList(client, grab); } /** @@ -4943,18 +5011,18 @@ int ProcRecolorCursor(ClientPtr client) { CursorPtr pCursor; - int nscr; + int rc, nscr; ScreenPtr pscr; Bool displayed; REQUEST(xRecolorCursorReq); REQUEST_SIZE_MATCH(xRecolorCursorReq); - pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, DixWriteAccess); - if ( !pCursor) + rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR, + client, DixWriteAccess); + if (rc != Success) { client->errorValue = stuff->cursor; - return (BadCursor); + return (rc == BadValue) ? BadCursor : rc; } pCursor->foreRed = stuff->foreRed; diff --git a/dix/extension.c b/dix/extension.c index 282d60ab7..9740c1b50 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -59,6 +59,8 @@ SOFTWARE. #include "gcstruct.h" #include "scrnintstr.h" #include "dispatch.h" +#include "privates.h" +#include "registry.h" #include "xace.h" #define EXTENSION_BASE 128 @@ -72,39 +74,6 @@ int lastEvent = EXTENSION_EVENT_BASE; static int lastError = FirstExtensionError; static unsigned int NumExtensions = 0; -extern int extensionPrivateLen; -extern unsigned *extensionPrivateSizes; -extern unsigned totalExtensionSize; - -static void -InitExtensionPrivates(ExtensionEntry *ext) -{ - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; - - if (totalExtensionSize == sizeof(ExtensionEntry)) - ppriv = (DevUnion *)NULL; - else - ppriv = (DevUnion *)(ext + 1); - - ext->devPrivates = ppriv; - sizes = extensionPrivateSizes; - ptr = (char *)(ppriv + extensionPrivateLen); - for (i = extensionPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } -} - _X_EXPORT ExtensionEntry * AddExtension(char *name, int NumEvents, int NumErrors, int (*MainProc)(ClientPtr c1), @@ -121,14 +90,13 @@ AddExtension(char *name, int NumEvents, int NumErrors, (unsigned)(lastError + NumErrors > LAST_ERROR)) return((ExtensionEntry *) NULL); - ext = (ExtensionEntry *) xalloc(totalExtensionSize); + ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry)); if (!ext) return((ExtensionEntry *) NULL); - bzero(ext, totalExtensionSize); - InitExtensionPrivates(ext); ext->name = (char *)xalloc(strlen(name) + 1); ext->num_aliases = 0; ext->aliases = (char **)NULL; + ext->devPrivates = NULL; if (!ext->name) { xfree(ext); @@ -176,6 +144,7 @@ AddExtension(char *name, int NumEvents, int NumErrors, ext->errorLast = 0; } + RegisterExtensionNames(ext); return(ext); } @@ -251,14 +220,6 @@ GetExtensionEntry(int major) return extensions[major]; } -_X_EXPORT void -DeclareExtensionSecurity(char *extname, Bool secure) -{ - int i = FindExtension(extname, strlen(extname)); - if (i >= 0) - XaceHook(XACE_DECLARE_EXT_SECURE, extensions[i], secure); -} - _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr client) { @@ -292,6 +253,7 @@ CloseDownExtensions(void) for (j = extensions[i]->num_aliases; --j >= 0;) xfree(extensions[i]->aliases[j]); xfree(extensions[i]->aliases); + dixFreePrivates(extensions[i]->devPrivates); xfree(extensions[i]); } xfree(extensions); @@ -319,7 +281,7 @@ ProcQueryExtension(ClientPtr client) else { i = FindExtension((char *)&stuff[1], stuff->nbytes); - if (i < 0 || !XaceHook(XACE_EXT_ACCESS, client, extensions[i])) + if (i < 0 || XaceHook(XACE_EXT_ACCESS, client, extensions[i])) reply.present = xFalse; else { @@ -355,7 +317,7 @@ ProcListExtensions(ClientPtr client) for (i=0; i<NumExtensions; i++) { /* call callbacks to find out whether to show extension */ - if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i])) + if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success) continue; total_length += strlen(extensions[i]->name) + 1; @@ -370,7 +332,7 @@ ProcListExtensions(ClientPtr client) for (i=0; i<NumExtensions; i++) { int len; - if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i])) + if (XaceHook(XACE_EXT_ACCESS, client, extensions[i]) != Success) continue; *bufptr++ = len = strlen(extensions[i]->name); @@ -392,17 +354,3 @@ ProcListExtensions(ClientPtr client) } return(client->noClientException); } - -#ifdef XSERVER_DTRACE -void LoadExtensionNames(char **RequestNames) { - int i; - - for (i=0; i<NumExtensions; i++) { - int r = extensions[i]->base; - - if (RequestNames[r] == NULL) { - RequestNames[r] = strdup(extensions[i]->name); - } - } -} -#endif @@ -61,7 +61,9 @@ SOFTWARE. #include "scrnintstr.h" #include "region.h" +#include "privates.h" #include "dix.h" +#include "xace.h" #include <assert.h> extern XID clientErrorValue; @@ -147,7 +149,7 @@ _X_EXPORT int dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion) { BITS32 index2; - int error = 0; + int rc, error = 0; PixmapPtr pPixmap; BITS32 maskQ; @@ -266,14 +268,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); + rc = Success; } else { NEXTVAL(XID, newpix); - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - newpix, RT_PIXMAP, DixReadAccess); + rc = dixLookupResource((pointer *)&pPixmap, newpix, + RT_PIXMAP, client, DixReadAccess); } - if (pPixmap) + if (rc == Success) { if ((pPixmap->drawable.depth != pGC->depth) || (pPixmap->drawable.pScreen != pGC->pScreen)) @@ -292,7 +295,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr else { clientErrorValue = newpix; - error = BadPixmap; + error = (rc == BadValue) ? BadPixmap : rc; } break; } @@ -302,14 +305,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr if (pUnion) { NEXT_PTR(PixmapPtr, pPixmap); + rc = Success; } else { NEXTVAL(XID, newstipple) - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - newstipple, RT_PIXMAP, DixReadAccess); + rc = dixLookupResource((pointer *)&pPixmap, newstipple, + RT_PIXMAP, client, DixReadAccess); } - if (pPixmap) + if (rc == Success) { if ((pPixmap->drawable.depth != 1) || (pPixmap->drawable.pScreen != pGC->pScreen)) @@ -327,7 +331,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr else { clientErrorValue = newstipple; - error = BadPixmap; + error = (rc == BadValue) ? BadPixmap : rc; } break; } @@ -344,14 +348,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr if (pUnion) { NEXT_PTR(FontPtr, pFont); + rc = Success; } else { NEXTVAL(XID, newfont) - pFont = (FontPtr)SecurityLookupIDByType(client, newfont, - RT_FONT, DixReadAccess); + rc = dixLookupResource((pointer *)&pFont, newfont, + RT_FONT, client, DixUseAccess); } - if (pFont) + if (rc == Success) { pFont->refcnt++; if (pGC->font) @@ -361,7 +366,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr else { clientErrorValue = newfont; - error = BadFont; + error = (rc == BadValue) ? BadFont : rc; } break; } @@ -414,9 +419,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr clipType = CT_NONE; pPixmap = NullPixmap; } - else - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - pid, RT_PIXMAP, DixReadAccess); + else { + rc = dixLookupResource((pointer *)&pPixmap, pid, + RT_PIXMAP, client, + DixReadAccess); + if (rc != Success) { + clientErrorValue = pid; + error = (rc == BadValue) ? BadPixmap : rc; + } + } } if (pPixmap) @@ -432,11 +443,6 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr pPixmap->refcnt++; } } - else if (!pUnion && (pid != None)) - { - clientErrorValue = pid; - error = BadPixmap; - } if(error == Success) { (*pGC->funcs->ChangeClip)(pGC, clipType, @@ -567,44 +573,13 @@ BUG: should check for failure to create default tile */ - -static GCPtr -AllocateGC(ScreenPtr pScreen) -{ - GCPtr pGC; - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; - - pGC = (GCPtr)xalloc(pScreen->totalGCSize); - if (pGC) - { - ppriv = (DevUnion *)(pGC + 1); - pGC->devPrivates = ppriv; - sizes = pScreen->GCPrivateSizes; - ptr = (char *)(ppriv + pScreen->GCPrivateLen); - for (i = pScreen->GCPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } - } - return pGC; -} - _X_EXPORT GCPtr -CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) +CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus, + XID gcid, ClientPtr client) { GCPtr pGC; - pGC = AllocateGC(pDrawable->pScreen); + pGC = (GCPtr)xalloc(sizeof(GC)); if (!pGC) { *pStatus = BadAlloc; @@ -617,7 +592,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) pGC->planemask = ~0; pGC->serialNumber = GC_CHANGE_SERIAL_BIT; pGC->funcs = 0; - + pGC->devPrivates = NULL; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; @@ -662,6 +637,12 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) pGC->stipple = pGC->pScreen->PixmapPerDepth[0]; pGC->stipple->refcnt++; + /* security creation/labeling check */ + *pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC, + RT_NONE, NULL, DixCreateAccess|DixSetAttrAccess); + if (*pStatus != Success) + goto out; + pGC->stateChanges = (1 << (GCLastBit+1)) - 1; if (!(*pGC->pScreen->CreateGC)(pGC)) *pStatus = BadAlloc; @@ -669,6 +650,8 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus) *pStatus = ChangeGC(pGC, mask, pval); else *pStatus = Success; + +out: if (*pStatus != Success) { if (!pGC->tileIsPixel && !pGC->tile.pixmap) @@ -903,6 +886,7 @@ FreeGC(pointer value, XID gid) (*pGC->funcs->DestroyGC) (pGC); if (pGC->dash != DefaultDash) xfree(pGC->dash); + dixFreePrivates(pGC->devPrivates); xfree(pGC); return(Success); } @@ -925,7 +909,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth) { GCPtr pGC; - pGC = AllocateGC(pScreen); + pGC = (GCPtr)xalloc(sizeof(GC)); if (!pGC) return (GCPtr)NULL; @@ -934,7 +918,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth) pGC->alu = GXcopy; /* dst <- src */ pGC->planemask = ~0; pGC->serialNumber = 0; - + pGC->devPrivates = NULL; pGC->fgPixel = 0; pGC->bgPixel = 1; pGC->lineWidth = 0; diff --git a/dix/getevents.c b/dix/getevents.c index 3754c72f4..3e6fe5ae0 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -308,10 +308,13 @@ clipAxis(DeviceIntPtr pDev, int axisNum, int *val) { AxisInfoPtr axes = pDev->valuator->axes + axisNum; - if (*val < axes->min_value) - *val = axes->min_value; - if (axes->max_value >= 0 && *val > axes->max_value) - *val = axes->max_value; + /* No clipping if the value-range <= 0 */ + if(axes->min_value < axes->min_value) { + if (*val < axes->min_value) + *val = axes->min_value; + if (*val > axes->max_value) + *val = axes->max_value; + } } /** @@ -346,7 +349,7 @@ getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator, for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) { xv->type = DeviceValuator; xv->first_valuator = i; - xv->num_valuators = num_valuators; + xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i); xv->deviceid = pDev->id; switch (final_valuator - i) { case 6: @@ -525,12 +528,10 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, int num_events = 0, final_valuator = 0; CARD32 ms = 0; deviceKeyButtonPointer *kbp = NULL; - /* Thanks to a broken lib, we _always_ have to chase DeviceMotionNotifies - * with DeviceValuators. */ - Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE); DeviceIntPtr cp = inputInfo.pointer; int x = 0, y = 0; Bool coreOnly = (pDev == inputInfo.pointer); + ScreenPtr scr = miPointerGetScreen(pDev); /* Sanity checks. */ if (type != MotionNotify && type != ButtonPress && type != ButtonRelease) @@ -553,7 +554,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, return 0; /* Do we need to send a DeviceValuator event? */ - if (!coreOnly && sendValuators) { + if (!coreOnly && num_valuators) { if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS) num_valuators = MAX_VALUATOR_EVENTS * 6; num_events += ((num_valuators - 1) / 6) + 1; @@ -574,21 +575,44 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, x = valuators[0]; } else { - if (pDev->coreEvents) - x = cp->valuator->lastx; - else - x = pDev->valuator->lastx; + /* If we're sending core events but didn't provide a value, + * translate the core value (but use the device coord if + * it translates to the same coord to preserve sub-pixel + * coord information). If we're not sending core events use + * whatever value we have */ + x = pDev->valuator->lastx; + if(pDev->coreEvents) { + int min = pDev->valuator->axes[0].min_value; + int max = pDev->valuator->axes[0].max_value; + if(min < max) { + if((int)((float)(x-min)*scr->width/(max-min+1)) != cp->valuator->lastx) + x = (int)((float)(cp->valuator->lastx)*(max-min+1)/scr->width)+min; + } + else + x = cp->valuator->lastx; + } } if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) { y = valuators[1 - first_valuator]; } else { - if (pDev->coreEvents) - y = cp->valuator->lasty; - else - y = pDev->valuator->lasty; + y = pDev->valuator->lasty; + if(pDev->coreEvents) { + int min = pDev->valuator->axes[1].min_value; + int max = pDev->valuator->axes[1].max_value; + if(min < max) { + if((int)((float)(y-min)*scr->height/(max-min+1)) != cp->valuator->lasty) + y = (int)((float)(cp->valuator->lasty)*(max-min+1)/scr->height)+min; + } + else + y = cp->valuator->lasty; + } } + + /* Clip both x and y to the defined limits (usually co-ord space limit). */ + clipAxis(pDev, 0, &x); + clipAxis(pDev, 1, &y); } else { if (flags & POINTER_ACCELERATE) @@ -596,54 +620,107 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, valuators); if (pDev->coreEvents) { - if (first_valuator == 0 && num_valuators >= 1) - x = cp->valuator->lastx + valuators[0]; + /* Get and convert the core pointer coordinate space into + * device coordinates. Use the device coords if it translates + * into the same position as the core to preserve relative sub- + * pixel movements from the device. */ + int min = pDev->valuator->axes[0].min_value; + int max = pDev->valuator->axes[0].max_value; + if(min < max) { + x = pDev->valuator->lastx; + if((int)((float)(x-min)*scr->width/(max-min+1)) != cp->valuator->lastx) + x = (int)((float)(cp->valuator->lastx)*(max-min+1)/scr->width)+min; + } else x = cp->valuator->lastx; - if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) - y = cp->valuator->lasty + valuators[1 - first_valuator]; + min = pDev->valuator->axes[1].min_value; + max = pDev->valuator->axes[1].max_value; + if(min < max) { + y = pDev->valuator->lasty; + if((int)((float)(y-min)*scr->height/(max-min+1)) != cp->valuator->lasty) + y = (int)((float)(cp->valuator->lasty)*(max-min+1)/scr->height)+min; + } else y = cp->valuator->lasty; + + /* Add relative movement */ + if (first_valuator == 0 && num_valuators >= 1) + x += valuators[0]; + if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) + y += valuators[1 - first_valuator]; } else { + x = pDev->valuator->lastx; + y = pDev->valuator->lasty; if (first_valuator == 0 && num_valuators >= 1) - x = pDev->valuator->lastx + valuators[0]; - else - x = pDev->valuator->lastx; - + x += valuators[0]; if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) - y = pDev->valuator->lasty + valuators[1 - first_valuator]; - else - y = pDev->valuator->lasty; + y += valuators[1 - first_valuator]; + + if(!coreOnly) { + /* Since we're not sending core-events we must clip both x and y + * to the defined limits so we don't run outside the box. */ + clipAxis(pDev, 0, &x); + clipAxis(pDev, 1, &y); + } } } - /* Clip both x and y to the defined limits (usually co-ord space limit). */ - clipAxis(pDev, 0, &x); - clipAxis(pDev, 1, &y); + pDev->valuator->lastx = x; + pDev->valuator->lasty = y; + /* Convert the dev coord back to screen coord if we're + * sending core events */ + if (pDev->coreEvents) { + int min = pDev->valuator->axes[0].min_value; + int max = pDev->valuator->axes[0].max_value; + if(min < max) + x = (int)((float)(x-min)*scr->width/(max-min+1)); + cp->valuator->lastx = x; + min = pDev->valuator->axes[1].min_value; + max = pDev->valuator->axes[1].max_value; + if(min < max) + y = (int)((float)(y-min)*scr->height/(max-min+1)); + cp->valuator->lasty = y; + } /* This takes care of crossing screens for us, as well as clipping * to the current screen. Right now, we only have one history buffer, * so we don't set this for both the device and core.*/ miPointerSetPosition(pDev, &x, &y, ms); + if (pDev->coreEvents) { + /* miPointerSetPosition may have changed screen */ + scr = miPointerGetScreen(pDev); + if(x != cp->valuator->lastx) { + int min = pDev->valuator->axes[0].min_value; + int max = pDev->valuator->axes[0].max_value; + cp->valuator->lastx = pDev->valuator->lastx = x; + if(min < max) + pDev->valuator->lastx = (int)((float)(x)*(max-min+1)/scr->width)+min; + } + if(y != cp->valuator->lasty) { + int min = pDev->valuator->axes[1].min_value; + int max = pDev->valuator->axes[1].max_value; + cp->valuator->lasty = pDev->valuator->lasty = y; + if(min < max) + pDev->valuator->lasty = (int)((float)(y)*(max-min+1)/scr->height)+min; + } + } + else if (coreOnly) { + cp->valuator->lastx = x; + cp->valuator->lasty = y; + } + /* Drop x and y back into the valuators list, if they were originally * present. */ if (first_valuator == 0 && num_valuators >= 1) - valuators[0] = x; + valuators[0] = pDev->valuator->lastx; if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) - valuators[1 - first_valuator] = y; + valuators[1 - first_valuator] = pDev->valuator->lasty; updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators); - if (pDev->coreEvents) { - cp->valuator->lastx = x; - cp->valuator->lasty = y; - } - pDev->valuator->lastx = x; - pDev->valuator->lasty = y; - /* for some reason inputInfo.pointer does not have coreEvents set */ if (coreOnly || pDev->coreEvents) { events->u.u.type = type; @@ -680,11 +757,11 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, kbp->detail = pDev->button->map[buttons]; } - kbp->root_x = x; - kbp->root_y = y; + kbp->root_x = pDev->valuator->lastx; + kbp->root_y = pDev->valuator->lasty; events++; - if (sendValuators) { + if (num_valuators) { kbp->deviceid |= MORE_EVENTS; clipValuators(pDev, first_valuator, num_valuators, valuators); events = getValuatorEvents(events, pDev, first_valuator, @@ -707,7 +784,7 @@ _X_EXPORT int GetProximityEvents(xEvent *events, DeviceIntPtr pDev, int type, int first_valuator, int num_valuators, int *valuators) { - int num_events = 0; + int num_events = 1; deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) events; /* Sanity checks. */ @@ -762,7 +839,8 @@ SwitchCoreKeyboard(DeviceIntPtr pDev) KeyClassPtr ckeyc = inputInfo.keyboard->key; int i = 0; - if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) { + if (pDev != dixLookupPrivate(&inputInfo.keyboard->devPrivates, + CoreDevicePrivateKey)) { memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH); if (ckeyc->modifierKeyMap) xfree(ckeyc->modifierKeyMap); @@ -806,7 +884,8 @@ SwitchCoreKeyboard(DeviceIntPtr pDev) (ckeyc->curKeySyms.maxKeyCode - ckeyc->curKeySyms.minKeyCode), serverClient); - inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev; + dixSetPrivate(&inputInfo.keyboard->devPrivates, CoreDevicePrivateKey, + pDev); } } @@ -820,8 +899,10 @@ SwitchCoreKeyboard(DeviceIntPtr pDev) _X_EXPORT void SwitchCorePointer(DeviceIntPtr pDev) { - if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) - inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev; + if (pDev != dixLookupPrivate(&inputInfo.pointer->devPrivates, + CoreDevicePrivateKey)) + dixSetPrivate(&inputInfo.pointer->devPrivates, + CoreDevicePrivateKey, pDev); } diff --git a/dix/globals.c b/dix/globals.c index d76b604da..7f95eabd5 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -143,7 +143,9 @@ Bool loadableFonts = FALSE; CursorPtr rootCursor; Bool blackRoot=FALSE; Bool whiteRoot=FALSE; +#ifdef XPRINT ClientPtr requestingClient; /* XXX this should be obsolete now, remove? */ +#endif _X_EXPORT TimeStamp currentTime; _X_EXPORT TimeStamp lastDeviceEventTime; diff --git a/dix/grabs.c b/dix/grabs.c index 70d234857..85e101c6a 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -58,6 +58,7 @@ SOFTWARE. #include "inputstr.h" #include "cursorstr.h" #include "dixgrabs.h" +#include "xace.h" #define BITMASK(i) (((Mask)1) << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) @@ -306,9 +307,11 @@ GrabsAreIdentical(GrabPtr pFirstGrab, GrabPtr pSecondGrab) * @return Success or X error code on failure. */ int -AddPassiveGrabToList(GrabPtr pGrab) +AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab) { GrabPtr grab; + Mask access_mode = DixGrabAccess; + int rc; for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) { @@ -322,6 +325,12 @@ AddPassiveGrabToList(GrabPtr pGrab) } } + if (pGrab->keyboardMode == GrabModeSync||pGrab->pointerMode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, pGrab->device, access_mode); + if (rc != Success) + return rc; + /* Remove all grabs that match the new one exactly */ for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) { diff --git a/dix/main.c b/dix/main.c index eea7eed3e..068dae92e 100644 --- a/dix/main.c +++ b/dix/main.c @@ -100,6 +100,8 @@ Equipment Corporation. #include "site.h" #include "dixfont.h" #include "extnsionst.h" +#include "privates.h" +#include "registry.h" #ifdef XPRINT #include "DiPrint.h" #endif @@ -116,15 +118,12 @@ Equipment Corporation. #include "dpmsproc.h" #endif -extern int InitClientPrivates(ClientPtr client); - extern void Dispatch(void); char *ConnectionInfo; xConnSetupPrefix connSetupPrefix; extern FontPtr defaultFont; -extern int screenPrivateCount; extern void InitProcVectors(void); extern Bool CreateGCperDepthArray(void); @@ -134,14 +133,10 @@ static #endif Bool CreateConnectionBlock(void); -static void FreeScreen(ScreenPtr); - _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[33]; int connBlockScreenStart; -static int restart = 0; - _X_EXPORT void NotImplemented(xEvent *from, xEvent *to) { @@ -241,6 +236,10 @@ static int indexForScanlinePad[ 65 ] = { #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif +#ifdef __APPLE__ +void DarwinHandleGUI(int argc, char **argv, char **envp); +#endif + int main(int argc, char *argv[], char *envp[]) { @@ -263,13 +262,6 @@ main(int argc, char *argv[], char *envp[]) DarwinHandleGUI(argc, argv, envp); #endif - /* Notice if we're restarted. Probably this is because we jumped through - * an uninitialized pointer */ - if (restart) - FatalError("server restarted. Jumped through uninitialized pointer?\n"); - else - restart = 1; - CheckUserParameters(argc, argv, envp); CheckUserAuthorization(); @@ -355,15 +347,10 @@ main(int argc, char *argv[], char *envp[]) InitAtoms(); InitEvents(); InitGlyphCaching(); - ResetExtensionPrivates(); - ResetClientPrivates(); - ResetScreenPrivates(); - ResetWindowPrivates(); - ResetGCPrivates(); - ResetPixmapPrivates(); - ResetColormapPrivates(); + if (!dixResetPrivates()) + FatalError("couldn't init private data storage"); + dixResetRegistry(); ResetFontPrivateIndex(); - ResetDevicePrivateIndex(); InitCallbackManager(); InitVisualWrap(); InitOutput(&screenInfo, argc, argv); @@ -376,8 +363,6 @@ main(int argc, char *argv[], char *envp[]) if (screenInfo.numVideoScreens < 0) screenInfo.numVideoScreens = screenInfo.numScreens; InitExtensions(argc, argv); - if (!InitClientPrivates(serverClient)) - FatalError("failed to allocate serverClient devprivates"); for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; @@ -399,9 +384,9 @@ main(int argc, char *argv[], char *envp[]) FatalError("failed to initialize core devices"); InitFonts(); - if (loadableFonts) { - SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error); - } + if (loadableFonts) + SetFontPath(serverClient, 0, (unsigned char *)defaultFontPath, + &error); else { if (SetDefaultFontPath(defaultFontPath) != Success) ErrorF("failed to set default font path '%s'", @@ -434,7 +419,7 @@ main(int argc, char *argv[], char *envp[]) for (i = 0; i < screenInfo.numScreens; i++) InitRootWindow(WindowTable[i]); DefineInitialRootWindow(WindowTable[0]); - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); #ifdef PANORAMIX if (!noPanoramiXExtension) { @@ -455,7 +440,7 @@ main(int argc, char *argv[], char *envp[]) /* Now free up whatever must be freed */ if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); FreeScreenSaverTimer(); CloseDownExtensions(); @@ -478,7 +463,8 @@ main(int argc, char *argv[], char *envp[]) FreeGCperDepth(i); FreeDefaultStipple(i); (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]); - FreeScreen(screenInfo.screens[i]); + dixFreePrivates(screenInfo.screens[i]->devPrivates); + xfree(screenInfo.screens[i]); screenInfo.numScreens = i; } CloseDownEvents(); @@ -488,7 +474,7 @@ main(int argc, char *argv[], char *envp[]) FreeAuditTimer(); - xfree(serverClient->devPrivates); + dixFreePrivates(serverClient->devPrivates); serverClient->devPrivates = NULL; if (dispatchException & DE_TERMINATE) @@ -700,24 +686,8 @@ AddScreen( if (!pScreen) return -1; - pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion), - screenPrivateCount); - if (!pScreen->devPrivates && screenPrivateCount) - { - xfree(pScreen); - return -1; - } + pScreen->devPrivates = NULL; pScreen->myNum = i; - pScreen->WindowPrivateLen = 0; - pScreen->WindowPrivateSizes = (unsigned *)NULL; - pScreen->totalWindowSize = - ((sizeof(WindowRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); - pScreen->GCPrivateLen = 0; - pScreen->GCPrivateSizes = (unsigned *)NULL; - pScreen->totalGCSize = - ((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); - pScreen->PixmapPrivateLen = 0; - pScreen->PixmapPrivateSizes = (unsigned *)NULL; pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8); pScreen->ClipNotify = 0; /* for R4 ddx compatibility */ pScreen->CreateScreenResources = 0; @@ -770,19 +740,10 @@ AddScreen( screenInfo.numScreens++; if (!(*pfnInit)(i, pScreen, argc, argv)) { - FreeScreen(pScreen); + dixFreePrivates(pScreen->devPrivates); + xfree(pScreen); screenInfo.numScreens--; return -1; } return i; } - -static void -FreeScreen(ScreenPtr pScreen) -{ - xfree(pScreen->WindowPrivateSizes); - xfree(pScreen->GCPrivateSizes); - xfree(pScreen->PixmapPrivateSizes); - xfree(pScreen->devPrivates); - xfree(pScreen); -} diff --git a/dix/pixmap.c b/dix/pixmap.c index 5b9a6a3aa..82e388cf3 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -109,11 +109,6 @@ _X_EXPORT PixmapPtr AllocatePixmap(ScreenPtr pScreen, int pixDataSize) { PixmapPtr pPixmap; - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) return NullPixmap; @@ -121,27 +116,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize); if (!pPixmap) return NullPixmap; - ppriv = (DevUnion *)(pPixmap + 1); - pPixmap->devPrivates = ppriv; - sizes = pScreen->PixmapPrivateSizes; - ptr = (char *)(ppriv + pScreen->PixmapPrivateLen); - for (i = pScreen->PixmapPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ((size = *sizes) != 0) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } - -#ifdef _XSERVER64 - if (pPixmap) { - pPixmap->drawable.pad0 = 0; - pPixmap->drawable.pad1 = 0; - } -#endif + pPixmap->devPrivates = NULL; return pPixmap; } diff --git a/dix/privates.c b/dix/privates.c index 246597117..47a0e1a29 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -30,425 +30,220 @@ from The Open Group. #include <dix-config.h> #endif -#include <X11/X.h> -#include "scrnintstr.h" -#include "misc.h" -#include "os.h" +#include <stddef.h> #include "windowstr.h" #include "resource.h" -#include "dixstruct.h" +#include "privates.h" #include "gcstruct.h" +#include "cursorstr.h" #include "colormapst.h" -#include "servermd.h" -#include "site.h" #include "inputstr.h" -#include "extnsionst.h" -/* - * See the Wrappers and devPrivates section in "Definition of the - * Porting Layer for the X v11 Sample Server" (doc/Server/ddx.tbl.ms) - * for information on how to use devPrivates. - */ - -/* - * extension private machinery - */ - -static int extensionPrivateCount; -int extensionPrivateLen; -unsigned *extensionPrivateSizes; -unsigned totalExtensionSize; - -void -ResetExtensionPrivates(void) -{ - extensionPrivateCount = 0; - extensionPrivateLen = 0; - xfree(extensionPrivateSizes); - extensionPrivateSizes = (unsigned *)NULL; - totalExtensionSize = - ((sizeof(ExtensionEntry) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); -} - -_X_EXPORT int -AllocateExtensionPrivateIndex(void) -{ - return extensionPrivateCount++; -} - -_X_EXPORT Bool -AllocateExtensionPrivate(int index2, unsigned amount) -{ - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= extensionPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(extensionPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) - return FALSE; - while (extensionPrivateLen <= index2) - { - nsizes[extensionPrivateLen++] = 0; - totalExtensionSize += sizeof(DevUnion); - } - extensionPrivateSizes = nsizes; +typedef struct _PrivateDesc { + DevPrivateKey key; + unsigned size; + CallbackListPtr initfuncs; + CallbackListPtr deletefuncs; + struct _PrivateDesc *next; +} PrivateDescRec; + +/* list of all allocated privates */ +static PrivateDescRec *items = NULL; + +static _X_INLINE PrivateDescRec * +findItem(const DevPrivateKey key) +{ + PrivateDescRec *item = items; + while (item) { + if (item->key == key) + return item; + item = item->next; } - oldamount = extensionPrivateSizes[index2]; - if (amount > oldamount) - { - extensionPrivateSizes[index2] = amount; - totalExtensionSize += (amount - oldamount); - } - return TRUE; + return NULL; } /* - * client private machinery + * Request pre-allocated space. */ - -static int clientPrivateCount; -int clientPrivateLen; -unsigned *clientPrivateSizes; -unsigned totalClientSize; - -void -ResetClientPrivates(void) -{ - clientPrivateCount = 0; - clientPrivateLen = 0; - xfree(clientPrivateSizes); - clientPrivateSizes = (unsigned *)NULL; - totalClientSize = - ((sizeof(ClientRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long); -} - _X_EXPORT int -AllocateClientPrivateIndex(void) -{ - return clientPrivateCount++; -} - -_X_EXPORT Bool -AllocateClientPrivate(int index2, unsigned amount) +dixRequestPrivate(const DevPrivateKey key, unsigned size) { - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= clientPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(clientPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) + PrivateDescRec *item = findItem(key); + if (item) { + if (size > item->size) + item->size = size; + } else { + item = (PrivateDescRec *)xalloc(sizeof(PrivateDescRec)); + if (!item) return FALSE; - while (clientPrivateLen <= index2) - { - nsizes[clientPrivateLen++] = 0; - totalClientSize += sizeof(DevUnion); - } - clientPrivateSizes = nsizes; - } - oldamount = clientPrivateSizes[index2]; - if (amount > oldamount) - { - clientPrivateSizes[index2] = amount; - totalClientSize += (amount - oldamount); + memset(item, 0, sizeof(PrivateDescRec)); + + /* add privates descriptor */ + item->key = key; + item->size = size; + item->next = items; + items = item; } return TRUE; } /* - * screen private machinery - */ - -int screenPrivateCount; - -void -ResetScreenPrivates(void) -{ - screenPrivateCount = 0; -} - -/* this can be called after some screens have been created, - * so we have to worry about resizing existing devPrivates + * Allocate a private and attach it to an existing object. */ -_X_EXPORT int -AllocateScreenPrivateIndex(void) -{ - int idx; - int i; - ScreenPtr pScreen; - DevUnion *nprivs; - - idx = screenPrivateCount++; - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - nprivs = (DevUnion *)xrealloc(pScreen->devPrivates, - screenPrivateCount * sizeof(DevUnion)); - if (!nprivs) - { - screenPrivateCount--; - return -1; - } - /* Zero the new private */ - bzero(&nprivs[idx], sizeof(DevUnion)); - pScreen->devPrivates = nprivs; +_X_EXPORT pointer * +dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) +{ + PrivateDescRec *item = findItem(key); + PrivateRec *ptr; + unsigned size = sizeof(PrivateRec); + + if (item) + size += item->size; + + ptr = (PrivateRec *)xcalloc(size, 1); + if (!ptr) + return NULL; + ptr->key = key; + ptr->value = (size > sizeof(PrivateRec)) ? (ptr + 1) : NULL; + ptr->next = *privates; + *privates = ptr; + + /* call any init funcs and return */ + if (item) { + PrivateCallbackRec calldata = { key, &ptr->value }; + CallCallbacks(&item->initfuncs, &calldata); } - return idx; + return &ptr->value; } - /* - * window private machinery + * Called to free privates at object deletion time. */ - -static int windowPrivateCount; - -void -ResetWindowPrivates(void) -{ - windowPrivateCount = 0; -} - -_X_EXPORT int -AllocateWindowPrivateIndex(void) -{ - return windowPrivateCount++; -} - -_X_EXPORT Bool -AllocateWindowPrivate(ScreenPtr pScreen, int index2, unsigned amount) -{ - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= pScreen->WindowPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(pScreen->WindowPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) - return FALSE; - while (pScreen->WindowPrivateLen <= index2) - { - nsizes[pScreen->WindowPrivateLen++] = 0; - pScreen->totalWindowSize += sizeof(DevUnion); +_X_EXPORT void +dixFreePrivates(PrivateRec *privates) +{ + PrivateRec *ptr, *next; + PrivateDescRec *item; + PrivateCallbackRec calldata; + + /* first pass calls the delete callbacks */ + for (ptr = privates; ptr; ptr = ptr->next) { + item = findItem(ptr->key); + if (item) { + calldata.key = ptr->key; + calldata.value = &ptr->value; + CallCallbacks(&item->deletefuncs, &calldata); } - pScreen->WindowPrivateSizes = nsizes; } - oldamount = pScreen->WindowPrivateSizes[index2]; - if (amount > oldamount) - { - pScreen->WindowPrivateSizes[index2] = amount; - pScreen->totalWindowSize += (amount - oldamount); + + /* second pass frees the memory */ + ptr = privates; + while (ptr) { + next = ptr->next; + xfree(ptr); + ptr = next; } - return TRUE; } - /* - * gc private machinery + * Callback registration */ - -static int gcPrivateCount; - -void -ResetGCPrivates(void) -{ - gcPrivateCount = 0; -} - _X_EXPORT int -AllocateGCPrivateIndex(void) -{ - return gcPrivateCount++; -} - -_X_EXPORT Bool -AllocateGCPrivate(ScreenPtr pScreen, int index2, unsigned amount) +dixRegisterPrivateInitFunc(const DevPrivateKey key, + CallbackProcPtr callback, pointer data) { - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= pScreen->GCPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(pScreen->GCPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) + PrivateDescRec *item = findItem(key); + if (!item) { + if (!dixRequestPrivate(key, 0)) return FALSE; - while (pScreen->GCPrivateLen <= index2) - { - nsizes[pScreen->GCPrivateLen++] = 0; - pScreen->totalGCSize += sizeof(DevUnion); - } - pScreen->GCPrivateSizes = nsizes; + item = findItem(key); } - oldamount = pScreen->GCPrivateSizes[index2]; - if (amount > oldamount) - { - pScreen->GCPrivateSizes[index2] = amount; - pScreen->totalGCSize += (amount - oldamount); - } - return TRUE; -} - - -/* - * pixmap private machinery - */ -static int pixmapPrivateCount; - -void -ResetPixmapPrivates(void) -{ - pixmapPrivateCount = 0; + return AddCallback(&item->initfuncs, callback, data); } _X_EXPORT int -AllocatePixmapPrivateIndex(void) +dixRegisterPrivateDeleteFunc(const DevPrivateKey key, + CallbackProcPtr callback, pointer data) { - return pixmapPrivateCount++; -} - -_X_EXPORT Bool -AllocatePixmapPrivate(ScreenPtr pScreen, int index2, unsigned amount) -{ - unsigned oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= pScreen->PixmapPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *)xrealloc(pScreen->PixmapPrivateSizes, - (index2 + 1) * sizeof(unsigned)); - if (!nsizes) + PrivateDescRec *item = findItem(key); + if (!item) { + if (!dixRequestPrivate(key, 0)) return FALSE; - while (pScreen->PixmapPrivateLen <= index2) - { - nsizes[pScreen->PixmapPrivateLen++] = 0; - pScreen->totalPixmapSize += sizeof(DevUnion); - } - pScreen->PixmapPrivateSizes = nsizes; - } - oldamount = pScreen->PixmapPrivateSizes[index2]; - if (amount > oldamount) - { - pScreen->PixmapPrivateSizes[index2] = amount; - pScreen->totalPixmapSize += (amount - oldamount); + item = findItem(key); } - pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8); - return TRUE; -} - + return AddCallback(&item->deletefuncs, callback, data); +} + +/* Table of devPrivates offsets */ +static const int offsetDefaults[] = { + -1, /* RT_NONE */ + offsetof(WindowRec, devPrivates), /* RT_WINDOW */ + offsetof(PixmapRec, devPrivates), /* RT_PIXMAP */ + offsetof(GC, devPrivates), /* RT_GC */ + -1, /* RT_FONT */ + offsetof(CursorRec, devPrivates), /* RT_CURSOR */ + offsetof(ColormapRec, devPrivates), /* RT_COLORMAP */ + -1, /* RT_CMAPENTRY */ + -1, /* RT_OTHERCLIENT */ + -1 /* RT_PASSIVEGRAB */ +}; + +static int *offsets = NULL; +static int offsetsSize = 0; /* - * colormap private machinery + * Specify where the devPrivates field is located in a structure type */ - -int colormapPrivateCount; - -void -ResetColormapPrivates(void) -{ - colormapPrivateCount = 0; -} - - _X_EXPORT int -AllocateColormapPrivateIndex (InitCmapPrivFunc initPrivFunc) +dixRegisterPrivateOffset(RESTYPE type, int offset) { - int index; - int i; - ColormapPtr pColormap; - DevUnion *privs; - - index = colormapPrivateCount++; - - for (i = 0; i < screenInfo.numScreens; i++) - { - /* - * AllocateColormapPrivateIndex may be called after the - * default colormap has been created on each screen! - * - * We must resize the devPrivates array for the default - * colormap on each screen, making room for this new private. - * We also call the initialization function 'initPrivFunc' on - * the new private allocated for each default colormap. - */ - - ScreenPtr pScreen = screenInfo.screens[i]; + type = type & TypeMask; - pColormap = (ColormapPtr) LookupIDByType ( - pScreen->defColormap, RT_COLORMAP); - - if (pColormap) - { - privs = (DevUnion *) xrealloc (pColormap->devPrivates, - colormapPrivateCount * sizeof(DevUnion)); - if (!privs) { - colormapPrivateCount--; - return -1; - } - bzero(&privs[index], sizeof(DevUnion)); - pColormap->devPrivates = privs; - if (!(*initPrivFunc)(pColormap,index)) - { - colormapPrivateCount--; - return -1; - } + /* resize offsets table if necessary */ + while (type >= offsetsSize) { + unsigned i = offsetsSize * 2 * sizeof(int); + offsets = (int *)xrealloc(offsets, i); + if (!offsets) { + offsetsSize = 0; + return FALSE; } + for (i=offsetsSize; i < 2*offsetsSize; i++) + offsets[i] = -1; + offsetsSize *= 2; } - return index; + offsets[type] = offset; + return TRUE; } -/* - * device private machinery - */ - -static int devicePrivateIndex = 0; - _X_EXPORT int -AllocateDevicePrivateIndex(void) +dixLookupPrivateOffset(RESTYPE type) { - return devicePrivateIndex++; + type = type & TypeMask; + assert(type < offsetsSize); + return offsets[type]; } -_X_EXPORT Bool -AllocateDevicePrivate(DeviceIntPtr device, int index) +int +dixResetPrivates(void) { - if (device->nPrivates < ++index) { - DevUnion *nprivs = (DevUnion *) xrealloc(device->devPrivates, - index * sizeof(DevUnion)); - if (!nprivs) - return FALSE; - device->devPrivates = nprivs; - bzero(&nprivs[device->nPrivates], sizeof(DevUnion) - * (index - device->nPrivates)); - device->nPrivates = index; - return TRUE; - } else { - return TRUE; - } -} + PrivateDescRec *next; -void -ResetDevicePrivateIndex(void) -{ - devicePrivateIndex = 0; + /* reset internal structures */ + while (items) { + next = items->next; + DeleteCallbackList(&items->initfuncs); + DeleteCallbackList(&items->deletefuncs); + xfree(items); + items = next; + } + if (offsets) + xfree(offsets); + offsetsSize = sizeof(offsetDefaults); + offsets = (int *)xalloc(offsetsSize); + offsetsSize /= sizeof(int); + if (!offsets) + return FALSE; + memcpy(offsets, offsetDefaults, sizeof(offsetDefaults)); + return TRUE; } diff --git a/dix/property.c b/dix/property.c index 994d3a7a5..ce6116992 100644 --- a/dix/property.c +++ b/dix/property.c @@ -91,6 +91,19 @@ PrintPropertys(WindowPtr pWin) } #endif +static _X_INLINE PropertyPtr +FindProperty(WindowPtr pWin, Atom propertyName) +{ + PropertyPtr pProp = wUserProps(pWin); + while (pProp) + { + if (pProp->propertyName == propertyName) + break; + pProp = pProp->next; + } + return pProp; +} + static void deliverPropertyNotifyEvent(WindowPtr pWin, int state, Atom atom) { @@ -116,7 +129,7 @@ ProcRotateProperties(ClientPtr client) REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); - rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess); if (rc != Success) return rc; if (!stuff->nAtoms) @@ -127,35 +140,29 @@ ProcRotateProperties(ClientPtr client) return(BadAlloc); for (i = 0; i < stuff->nAtoms; i++) { - char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i], - DixReadAccess|DixWriteAccess); - - if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) { + if (!ValidAtom(atoms[i])) { xfree(props); client->errorValue = atoms[i]; return BadAtom; } - if (XaceIgnoreOperation == action) { - xfree(props); - return Success; - } - for (j = i + 1; j < stuff->nAtoms; j++) if (atoms[j] == atoms[i]) { xfree(props); return BadMatch; } - pProp = wUserProps (pWin); - while (pProp) - { - if (pProp->propertyName == atoms[i]) - goto found; - pProp = pProp->next; - } - xfree(props); - return BadMatch; -found: + pProp = FindProperty(pWin, atoms[i]); + if (!pProp) { + xfree(props); + return BadMatch; + } + rc = XaceHookPropertyAccess(client, pWin, pProp, + DixReadAccess|DixWriteAccess); + if (rc != Success) { + xfree(props); + client->errorValue = atoms[i]; + return rc; + } props[i] = pProp; } delta = stuff->nPositions; @@ -210,7 +217,7 @@ ProcChangeProperty(ClientPtr client) totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); - err = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + err = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess); if (err != Success) return err; if (!ValidAtom(stuff->property)) @@ -224,18 +231,9 @@ ProcChangeProperty(ClientPtr client) return(BadAtom); } - switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - DixWriteAccess)) - { - case XaceErrorOperation: - client->errorValue = stuff->property; - return BadAtom; - case XaceIgnoreOperation: - return Success; - } - - err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format, - (int)mode, len, (pointer)&stuff[1], TRUE); + err = dixChangeWindowProperty(client, pWin, stuff->property, stuff->type, + (int)format, (int)mode, len, &stuff[1], + TRUE); if (err != Success) return err; else @@ -243,27 +241,20 @@ ProcChangeProperty(ClientPtr client) } _X_EXPORT int -ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, - int mode, unsigned long len, pointer value, - Bool sendevent) +dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property, + Atom type, int format, int mode, unsigned long len, + pointer value, Bool sendevent) { PropertyPtr pProp; - int sizeInBytes; - int totalSize; + int sizeInBytes, totalSize, rc; pointer data; sizeInBytes = format>>3; totalSize = len * sizeInBytes; /* first see if property already exists */ + pProp = FindProperty(pWin, property); - pProp = wUserProps (pWin); - while (pProp) - { - if (pProp->propertyName == property) - break; - pProp = pProp->next; - } if (!pProp) /* just add to list */ { if (!pWin->optional && !MakeWindowOptional (pWin)) @@ -284,11 +275,25 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, if (len) memmove((char *)data, (char *)value, totalSize); pProp->size = len; + pProp->devPrivates = NULL; + rc = XaceHookPropertyAccess(pClient, pWin, pProp, + DixCreateAccess|DixWriteAccess); + if (rc != Success) { + xfree(data); + xfree(pProp); + pClient->errorValue = property; + return rc; + } pProp->next = pWin->optional->userProps; pWin->optional->userProps = pProp; } else { + rc = XaceHookPropertyAccess(pClient, pWin, pProp, DixWriteAccess); + if (rc != Success) { + pClient->errorValue = property; + return rc; + } /* To append or prepend to a property the request format and type must match those of the already defined property. The existing format and type are irrelevant when using the mode @@ -349,10 +354,20 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, return(Success); } +_X_EXPORT int +ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, + int mode, unsigned long len, pointer value, + Bool sendevent) +{ + return dixChangeWindowProperty(serverClient, pWin, property, type, format, + mode, len, value, sendevent); +} + int -DeleteProperty(WindowPtr pWin, Atom propName) +DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName) { PropertyPtr pProp, prevProp; + int rc; if (!(pProp = wUserProps (pWin))) return(Success); @@ -366,6 +381,10 @@ DeleteProperty(WindowPtr pWin, Atom propName) } if (pProp) { + rc = XaceHookPropertyAccess(client, pWin, pProp, DixDestroyAccess); + if (rc != Success) + return rc; + if (prevProp == (PropertyPtr)NULL) /* takes care of head */ { if (!(pWin->optional->userProps = pProp->next)) @@ -376,6 +395,7 @@ DeleteProperty(WindowPtr pWin, Atom propName) prevProp->next = pProp->next; } deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); + dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); } @@ -392,6 +412,7 @@ DeleteAllWindowProperties(WindowPtr pWin) { deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); pNextProp = pProp->next; + dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); pProp = pNextProp; @@ -428,16 +449,19 @@ int ProcGetProperty(ClientPtr client) { PropertyPtr pProp, prevProp; - unsigned long n, len, ind, rc; + unsigned long n, len, ind; + int rc; WindowPtr pWin; xGetPropertyReply reply; - Mask access_mode = DixReadAccess; + Mask access_mode = DixGetPropAccess; REQUEST(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq); - if (stuff->delete) + if (stuff->delete) { UpdateCurrentTime(); - rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + access_mode |= DixSetPropAccess; + } + rc = dixLookupWindow(&pWin, stuff->window, client, access_mode); if (rc != Success) return rc; @@ -472,16 +496,14 @@ ProcGetProperty(ClientPtr client) if (!pProp) return NullPropertyReply(client, None, 0, &reply); + access_mode = DixReadAccess; if (stuff->delete) access_mode |= DixDestroyAccess; - switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - access_mode)) - { - case XaceErrorOperation: + + rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode); + if (rc != Success) { client->errorValue = stuff->property; - return BadAtom;; - case XaceIgnoreOperation: - return NullPropertyReply(client, pProp->type, pProp->format, &reply); + return rc; } /* If the request type and actual type don't match. Return the @@ -547,6 +569,7 @@ ProcGetProperty(ClientPtr client) } else prevProp->next = pProp->next; + dixFreePrivates(pProp->devPrivates); xfree(pProp->data); xfree(pProp); } @@ -564,7 +587,7 @@ ProcListProperties(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->id, client, DixListPropAccess); if (rc != Success) return rc; @@ -608,7 +631,7 @@ ProcDeleteProperty(ClientPtr client) REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); - result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + result = dixLookupWindow(&pWin, stuff->window, client, DixSetPropAccess); if (result != Success) return result; if (!ValidAtom(stuff->property)) @@ -617,17 +640,7 @@ ProcDeleteProperty(ClientPtr client) return (BadAtom); } - switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property, - DixDestroyAccess)) - { - case XaceErrorOperation: - client->errorValue = stuff->property; - return BadAtom;; - case XaceIgnoreOperation: - return Success; - } - - result = DeleteProperty(pWin, stuff->property); + result = DeleteProperty(client, pWin, stuff->property); if (client->noClientException != Success) return(client->noClientException); else diff --git a/dix/protocol.txt b/dix/protocol.txt new file mode 100644 index 000000000..f4cdf7bbb --- /dev/null +++ b/dix/protocol.txt @@ -0,0 +1,1054 @@ +# Registry of protocol names used by X Server +# This will eventually be replaced by server-side XCB +# +# Format is Xnnn <extension-name>:<object-name> +# R=Request, V=Event, E=Error +# +# This is a security-sensitive file, please set permissions as appropriate. +# +R001 Adobe-DPS-Extension:Init +R002 Adobe-DPS-Extension:CreateContext +R003 Adobe-DPS-Extension:CreateSpace +R004 Adobe-DPS-Extension:GiveInput +R005 Adobe-DPS-Extension:GetStatus +R006 Adobe-DPS-Extension:DestroySpace +R007 Adobe-DPS-Extension:Reset +R008 Adobe-DPS-Extension:NotifyContext +R009 Adobe-DPS-Extension:CreateContextFromID +R010 Adobe-DPS-Extension:XIDFromContext +R011 Adobe-DPS-Extension:ContextFromXID +R012 Adobe-DPS-Extension:SetStatusMask +R013 Adobe-DPS-Extension:CreateSecureContext +R014 Adobe-DPS-Extension:NotifyWhenReady +R000 Apple-DRI:QueryVersion +R001 Apple-DRI:QueryDirectRenderingCapable +R002 Apple-DRI:CreateSurface +R003 Apple-DRI:DestroySurface +R004 Apple-DRI:AuthConnection +V000 Apple-DRI:ObsoleteEvent1 +V001 Apple-DRI:ObsoleteEvent2 +V002 Apple-DRI:ObsoleteEvent3 +V003 Apple-DRI:SurfaceNotify +E000 Apple-DRI:ClientNotLocal +E001 Apple-DRI:OperationNotSupported +R000 Apple-WM:QueryVersion +R001 Apple-WM:FrameGetRect +R002 Apple-WM:FrameHitTest +R003 Apple-WM:FrameDraw +R004 Apple-WM:DisableUpdate +R005 Apple-WM:ReenableUpdate +R006 Apple-WM:SelectInput +R007 Apple-WM:SetWindowMenuCheck +R008 Apple-WM:SetFrontProcess +R009 Apple-WM:SetWindowLevel +R010 Apple-WM:SetCanQuit +R011 Apple-WM:SetWindowMenu +V000 Apple-WM:ControllerNotify +V001 Apple-WM:ActivationNotify +V002 Apple-WM:PasteboardNotify +E000 Apple-WM:ClientNotLocal +E001 Apple-WM:OperationNotSupported +R000 BIG-REQUESTS:Enable +R000 Composite:CompositeQueryVersion +R001 Composite:CompositeRedirectWindow +R002 Composite:CompositeRedirectSubwindows +R003 Composite:CompositeUnredirectWindow +R004 Composite:CompositeUnredirectSubwindows +R005 Composite:CompositeCreateRegionFromBorderClip +R006 Composite:CompositeNameWindowPixmap +R007 Composite:CompositeGetOverlayWindow +R008 Composite:CompositeReleaseOverlayWindow +R000 DAMAGE:QueryVersion +R001 DAMAGE:Create +R002 DAMAGE:Destroy +R003 DAMAGE:Subtract +R004 DAMAGE:Add +V000 DAMAGE:Notify +E000 DAMAGE:BadDamage +R000 DEC-XTRAP:Reset +R001 DEC-XTRAP:GetAvailable +R002 DEC-XTRAP:Config +R003 DEC-XTRAP:StartTrap +R004 DEC-XTRAP:StopTrap +R005 DEC-XTRAP:GetCurrent +R006 DEC-XTRAP:GetStatistics +R007 DEC-XTRAP:SimulateXEvent +R008 DEC-XTRAP:GetVersion +R009 DEC-XTRAP:GetLastInpTime +V000 DEC-XTRAP:Event +E002 DEC-XTRAP:BadIO +E004 DEC-XTRAP:BadStatistics +E005 DEC-XTRAP:BadDevices +E007 DEC-XTRAP:BadScreen +E008 DEC-XTRAP:BadSwapReq +R000 DMX:DMXQueryVersion +R001 DMX:DMXGetScreenCount +R002 DMX:DMXGetScreenInfoDEPRECATED +R003 DMX:DMXGetWindowAttributes +R004 DMX:DMXGetInputCount +R005 DMX:DMXGetInputAttributes +R006 DMX:DMXForceWindowCreationDEPRECATED +R007 DMX:DMXReconfigureScreenDEPRECATED +R008 DMX:DMXSync +R009 DMX:DMXForceWindowCreation +R010 DMX:DMXGetScreenAttributes +R011 DMX:DMXChangeScreensAttributes +R012 DMX:DMXAddScreen +R013 DMX:DMXRemoveScreen +R014 DMX:DMXGetDesktopAttributes +R015 DMX:DMXChangeDesktopAttributes +R016 DMX:DMXAddInput +R017 DMX:DMXRemoveInput +R000 DOUBLE-BUFFER:GetVersion +R001 DOUBLE-BUFFER:AllocateBackBufferName +R002 DOUBLE-BUFFER:DeallocateBackBufferName +R003 DOUBLE-BUFFER:SwapBuffers +R004 DOUBLE-BUFFER:BeginIdiom +R005 DOUBLE-BUFFER:EndIdiom +R006 DOUBLE-BUFFER:GetVisualInfo +R007 DOUBLE-BUFFER:GetBackBufferAttributes +E000 DOUBLE-BUFFER:BadBuffer +R000 DPMS:GetVersion +R001 DPMS:Capable +R002 DPMS:GetTimeouts +R003 DPMS:SetTimeouts +R004 DPMS:Enable +R005 DPMS:Disable +R006 DPMS:ForceLevel +R007 DPMS:Info +R000 Extended-Visual-Information:QueryVersion +R001 Extended-Visual-Information:GetVisualInfo +R000 FontCache:QueryVersion +R001 FontCache:GetCacheSettings +R002 FontCache:ChangeCacheSettings +R003 FontCache:GetCacheStatistics +E000 FontCache:BadProtocol +E001 FontCache:CannotAllocMemory +R001 GLX: +R002 GLX:Large +R003 GLX:CreateContext +R004 GLX:DestroyContext +R005 GLX:MakeCurrent +R006 GLX:IsDirect +R007 GLX:QueryVersion +R008 GLX:WaitGL +R009 GLX:WaitX +R010 GLX:CopyContext +R011 GLX:SwapBuffers +R012 GLX:UseXFont +R013 GLX:CreateGLXPixmap +R014 GLX:GetVisualConfigs +R015 GLX:DestroyGLXPixmap +R016 GLX:VendorPrivate +R017 GLX:VendorPrivateWithReply +R018 GLX:QueryExtensionsString +R019 GLX:QueryServerString +R020 GLX:ClientInfo +R101 GLX:NewList +R102 GLX:EndList +R103 GLX:DeleteLists +R104 GLX:GenLists +R105 GLX:FeedbackBuffer +R106 GLX:SelectBuffer +R107 GLX:Mode +R108 GLX:Finish +R109 GLX:PixelStoref +R110 GLX:PixelStorei +R111 GLX:ReadPixels +R112 GLX:GetBooleanv +R113 GLX:GetClipPlane +R114 GLX:GetDoublev +R115 GLX:GetError +R116 GLX:GetFloatv +R117 GLX:GetIntegerv +R118 GLX:GetLightfv +R119 GLX:GetLightiv +R120 GLX:GetMapdv +R121 GLX:GetMapfv +R122 GLX:GetMapiv +R123 GLX:GetMaterialfv +R124 GLX:GetMaterialiv +R125 GLX:GetPixelfv +R126 GLX:GetPixelMapuiv +R127 GLX:GetPixelMapusv +R128 GLX:GetPolygonStipple +R129 GLX:GetString +R130 GLX:GetTexEnvfv +R131 GLX:GetTexEnviv +R132 GLX:GetTexGendv +R133 GLX:GetTexGenfv +R134 GLX:GetTexGeniv +R135 GLX:GetTexImage +R136 GLX:GetTexParameterfv +R137 GLX:GetTexParameteriv +R138 GLX:GetTexLevelParameterfv +R139 GLX:GetTexLevelParameteriv +R140 GLX:IsEnabled +R141 GLX:IsList +R142 GLX:Flush +E000 GLX:BadContext +E001 GLX:BadContextState +E002 GLX:BadDrawable +E003 GLX:BadPixmap +E004 GLX:BadContextTag +E005 GLX:BadCurrentWindow +E006 GLX:BadRenderRequest +E007 GLX:BadLargeRequest +E008 GLX:UnsupportedPrivateRequest +R000 LBX:QueryVersion +R001 LBX:StartProxy +R002 LBX:StopProxy +R003 LBX:Switch +R004 LBX:NewClient +R005 LBX:CloseClient +R006 LBX:ModifySequence +R007 LBX:AllowMotion +R008 LBX:IncrementPixel +R009 LBX:Delta +R010 LBX:GetModifierMapping +R011 LBX:QueryTag +R012 LBX:InvalidateTag +R013 LBX:PolyPoint +R014 LBX:PolyLine +R015 LBX:PolySegment +R016 LBX:PolyRectangle +R017 LBX:PolyArc +R018 LBX:FillPoly +R019 LBX:PolyFillRectangle +R020 LBX:PolyFillArc +R021 LBX:GetKeyboardMapping +R022 LBX:QueryFont +R023 LBX:ChangeProperty +R024 LBX:GetProperty +R025 LBX:TagData +R026 LBX:CopyArea +R027 LBX:CopyPlane +R028 LBX:PolyText8 +R029 LBX:PolyText16 +R030 LBX:ImageText8 +R031 LBX:ImageText16 +R032 LBX:QueryExtension +R033 LBX:PutImage +R034 LBX:GetImage +R035 LBX:BeginLargeRequest +R036 LBX:LargeRequestData +R037 LBX:EndLargeRequest +R038 LBX:InternAtoms +R039 LBX:GetWinAttrAndGeom +R040 LBX:GrabCmap +R041 LBX:ReleaseCmap +R042 LBX:AllocColor +R043 LBX:Sync +E000 LBX:BadLbxClient +R000 MIT-SCREEN-SAVER:QueryVersion +R001 MIT-SCREEN-SAVER:QueryInfo +R002 MIT-SCREEN-SAVER:SelectInput +R003 MIT-SCREEN-SAVER:SetAttributes +R004 MIT-SCREEN-SAVER:UnsetAttributes +R005 MIT-SCREEN-SAVER:Suspend +V000 MIT-SCREEN-SAVER:Notify +R000 MIT-SHM:QueryVersion +R001 MIT-SHM:Attach +R002 MIT-SHM:Detach +R003 MIT-SHM:PutImage +R004 MIT-SHM:GetImage +R005 MIT-SHM:CreatePixmap +V000 MIT-SHM:Completion +E000 MIT-SHM:BadShmSeg +R000 MIT-SUNDRY-NONSTANDARD:SetBugMode +R001 MIT-SUNDRY-NONSTANDARD:GetBugMode +R000 Multi-Buffering:GetBufferVersion +R001 Multi-Buffering:CreateImageBuffers +R002 Multi-Buffering:DestroyImageBuffers +R003 Multi-Buffering:DisplayImageBuffers +R004 Multi-Buffering:SetMBufferAttributes +R005 Multi-Buffering:GetMBufferAttributes +R006 Multi-Buffering:SetBufferAttributes +R007 Multi-Buffering:GetBufferAttributes +R008 Multi-Buffering:GetBufferInfo +R009 Multi-Buffering:CreateStereoWindow +R010 Multi-Buffering:ClearImageBufferArea +V000 Multi-Buffering:ClobberNotify +V001 Multi-Buffering:UpdateNotify +E000 Multi-Buffering:BadBuffer +R000 RANDR:QueryVersion +R001 RANDR:OldGetScreenInfo +R002 RANDR:SetScreenConfig +R003 RANDR:OldScreenChangeSelectInput +R004 RANDR:SelectInput +R005 RANDR:GetScreenInfo +R006 RANDR:GetScreenSizeRange +R007 RANDR:SetScreenSize +R008 RANDR:GetScreenResources +R009 RANDR:GetOutputInfo +R010 RANDR:ListOutputProperties +R011 RANDR:QueryOutputProperty +R012 RANDR:ConfigureOutputProperty +R013 RANDR:ChangeOutputProperty +R014 RANDR:DeleteOutputProperty +R015 RANDR:GetOutputProperty +R016 RANDR:CreateMode +R017 RANDR:DestroyMode +R018 RANDR:AddOutputMode +R019 RANDR:DeleteOutputMode +R020 RANDR:GetCrtcInfo +R021 RANDR:SetCrtcConfig +R022 RANDR:GetCrtcGammaSize +R023 RANDR:GetCrtcGamma +R024 RANDR:SetCrtcGamma +V000 RANDR:ScreenChangeNotify +V001 RANDR:Notify +E000 RANDR:BadRROutput +E001 RANDR:BadRRCrtc +E002 RANDR:BadRRMode +R000 RECORD:QueryVersion +R001 RECORD:CreateContext +R002 RECORD:RegisterClients +R003 RECORD:UnregisterClients +R004 RECORD:GetContext +R005 RECORD:EnableContext +R006 RECORD:DisableContext +R007 RECORD:FreeContext +E000 RECORD:BadContext +R000 RENDER:QueryVersion +R001 RENDER:QueryPictFormats +R002 RENDER:QueryPictIndexValues +R003 RENDER:QueryDithers +R004 RENDER:CreatePicture +R005 RENDER:ChangePicture +R006 RENDER:SetPictureClipRectangles +R007 RENDER:FreePicture +R008 RENDER:Composite +R009 RENDER:Scale +R010 RENDER:Trapezoids +R011 RENDER:Triangles +R012 RENDER:TriStrip +R013 RENDER:TriFan +R014 RENDER:ColorTrapezoids +R015 RENDER:ColorTriangles +R016 RENDER:Transform +R017 RENDER:CreateGlyphSet +R018 RENDER:ReferenceGlyphSet +R019 RENDER:FreeGlyphSet +R020 RENDER:AddGlyphs +R021 RENDER:AddGlyphsFromPicture +R022 RENDER:FreeGlyphs +R023 RENDER:CompositeGlyphs8 +R024 RENDER:CompositeGlyphs16 +R025 RENDER:CompositeGlyphs32 +R026 RENDER:FillRectangles +R027 RENDER:CreateCursor +R028 RENDER:SetPictureTransform +R029 RENDER:QueryFilters +R030 RENDER:SetPictureFilter +R031 RENDER:CreateAnimCursor +R032 RENDER:AddTraps +R033 RENDER:CreateSolidFill +R034 RENDER:CreateLinearGradient +R035 RENDER:CreateRadialGradient +R036 RENDER:CreateConicalGradient +E000 RENDER:BadPictFormat +E001 RENDER:BadPicture +E002 RENDER:BadPictOp +E003 RENDER:BadGlyphSet +E004 RENDER:BadGlyph +R000 SECURITY:QueryVersion +R001 SECURITY:GenerateAuthorization +R002 SECURITY:RevokeAuthorization +V000 SECURITY:AuthorizationRevoked +E000 SECURITY:BadAuthorization +E001 SECURITY:BadAuthorizationProtocol +R000 SELinux:SELinuxQueryVersion +R001 SELinux:SELinuxSetSelectionManager +R002 SELinux:SELinuxGetSelectionManager +R003 SELinux:SELinuxSetDeviceContext +R004 SELinux:SELinuxGetDeviceContext +R005 SELinux:SELinuxSetPropertyCreateContext +R006 SELinux:SELinuxGetPropertyCreateContext +R007 SELinux:SELinuxGetPropertyContext +R008 SELinux:SELinuxSetWindowCreateContext +R009 SELinux:SELinuxGetWindowCreateContext +R010 SELinux:SELinuxGetWindowContext +R000 SHAPE:QueryVersion +R001 SHAPE:Rectangles +R002 SHAPE:Mask +R003 SHAPE:Combine +R004 SHAPE:Offset +R005 SHAPE:QueryExtents +R006 SHAPE:SelectInput +R007 SHAPE:InputSelected +R008 SHAPE:GetRectangles +V000 SHAPE:Notify +R000 SYNC:Initialize +R001 SYNC:ListSystemCounters +R002 SYNC:CreateCounter +R003 SYNC:SetCounter +R004 SYNC:ChangeCounter +R005 SYNC:QueryCounter +R006 SYNC:DestroyCounter +R007 SYNC:Await +R008 SYNC:CreateAlarm +R009 SYNC:ChangeAlarm +R010 SYNC:QueryAlarm +R011 SYNC:DestroyAlarm +R012 SYNC:SetPriority +R013 SYNC:GetPriority +V000 SYNC:CounterNotify +V001 SYNC:AlarmNotify +E000 SYNC:BadCounter +E001 SYNC:BadAlarm +R000 TOG-CUP:QueryVersion +R001 TOG-CUP:GetReservedColormapEntries +R002 TOG-CUP:StoreColors +R000 Windows-WM:QueryVersion +R001 Windows-WM:FrameGetRect +R002 Windows-WM:FrameDraw +R003 Windows-WM:FrameSetTitle +R004 Windows-WM:DisableUpdate +R005 Windows-WM:ReenableUpdate +R006 Windows-WM:SelectInput +R007 Windows-WM:SetFrontProcess +V000 Windows-WM:ControllerNotify +V001 Windows-WM:ActivationNotify +E000 Windows-WM:ClientNotLocal +E001 Windows-WM:OperationNotSupported +R000 X-Resource:QueryVersion +R001 X-Resource:QueryClients +R002 X-Resource:QueryClientResources +R003 X-Resource:QueryClientPixmapBytes +R001 X11:CreateWindow +R002 X11:ChangeWindowAttributes +R003 X11:GetWindowAttributes +R004 X11:DestroyWindow +R005 X11:DestroySubwindows +R006 X11:ChangeSaveSet +R007 X11:ReparentWindow +R008 X11:MapWindow +R009 X11:MapSubwindows +R010 X11:UnmapWindow +R011 X11:UnmapSubwindows +R012 X11:ConfigureWindow +R013 X11:CirculateWindow +R014 X11:GetGeometry +R015 X11:QueryTree +R016 X11:InternAtom +R017 X11:GetAtomName +R018 X11:ChangeProperty +R019 X11:DeleteProperty +R020 X11:GetProperty +R021 X11:ListProperties +R022 X11:SetSelectionOwner +R023 X11:GetSelectionOwner +R024 X11:ConvertSelection +R025 X11:SendEvent +R026 X11:GrabPointer +R027 X11:UngrabPointer +R028 X11:GrabButton +R029 X11:UngrabButton +R030 X11:ChangeActivePointerGrab +R031 X11:GrabKeyboard +R032 X11:UngrabKeyboard +R033 X11:GrabKey +R034 X11:UngrabKey +R035 X11:AllowEvents +R036 X11:GrabServer +R037 X11:UngrabServer +R038 X11:QueryPointer +R039 X11:GetMotionEvents +R040 X11:TranslateCoords +R041 X11:WarpPointer +R042 X11:SetInputFocus +R043 X11:GetInputFocus +R044 X11:QueryKeymap +R045 X11:OpenFont +R046 X11:CloseFont +R047 X11:QueryFont +R048 X11:QueryTextExtents +R049 X11:ListFonts +R050 X11:ListFontsWithInfo +R051 X11:SetFontPath +R052 X11:GetFontPath +R053 X11:CreatePixmap +R054 X11:FreePixmap +R055 X11:CreateGC +R056 X11:ChangeGC +R057 X11:CopyGC +R058 X11:SetDashes +R059 X11:SetClipRectangles +R060 X11:FreeGC +R061 X11:ClearArea +R062 X11:CopyArea +R063 X11:CopyPlane +R064 X11:PolyPoint +R065 X11:PolyLine +R066 X11:PolySegment +R067 X11:PolyRectangle +R068 X11:PolyArc +R069 X11:FillPoly +R070 X11:PolyFillRectangle +R071 X11:PolyFillArc +R072 X11:PutImage +R073 X11:GetImage +R074 X11:PolyText8 +R075 X11:PolyText16 +R076 X11:ImageText8 +R077 X11:ImageText16 +R078 X11:CreateColormap +R079 X11:FreeColormap +R080 X11:CopyColormapAndFree +R081 X11:InstallColormap +R082 X11:UninstallColormap +R083 X11:ListInstalledColormaps +R084 X11:AllocColor +R085 X11:AllocNamedColor +R086 X11:AllocColorCells +R087 X11:AllocColorPlanes +R088 X11:FreeColors +R089 X11:StoreColors +R090 X11:StoreNamedColor +R091 X11:QueryColors +R092 X11:LookupColor +R093 X11:CreateCursor +R094 X11:CreateGlyphCursor +R095 X11:FreeCursor +R096 X11:RecolorCursor +R097 X11:QueryBestSize +R098 X11:QueryExtension +R099 X11:ListExtensions +R100 X11:ChangeKeyboardMapping +R101 X11:GetKeyboardMapping +R102 X11:ChangeKeyboardControl +R103 X11:GetKeyboardControl +R104 X11:Bell +R105 X11:ChangePointerControl +R106 X11:GetPointerControl +R107 X11:SetScreenSaver +R108 X11:GetScreenSaver +R109 X11:ChangeHosts +R110 X11:ListHosts +R111 X11:SetAccessControl +R112 X11:SetCloseDownMode +R113 X11:KillClient +R114 X11:RotateProperties +R115 X11:ForceScreenSaver +R116 X11:SetPointerMapping +R117 X11:GetPointerMapping +R118 X11:SetModifierMapping +R119 X11:GetModifierMapping +R127 X11:NoOperation +V000 X11:X_Error +V001 X11:X_Reply +V002 X11:KeyPress +V003 X11:KeyRelease +V004 X11:ButtonPress +V005 X11:ButtonRelease +V006 X11:MotionNotify +V007 X11:EnterNotify +V008 X11:LeaveNotify +V009 X11:FocusIn +V010 X11:FocusOut +V011 X11:KeymapNotify +V012 X11:Expose +V013 X11:GraphicsExpose +V014 X11:NoExpose +V015 X11:VisibilityNotify +V016 X11:CreateNotify +V017 X11:DestroyNotify +V018 X11:UnmapNotify +V019 X11:MapNotify +V020 X11:MapRequest +V021 X11:ReparentNotify +V022 X11:ConfigureNotify +V023 X11:ConfigureRequest +V024 X11:GravityNotify +V025 X11:ResizeRequest +V026 X11:CirculateNotify +V027 X11:CirculateRequest +V028 X11:PropertyNotify +V029 X11:SelectionClear +V030 X11:SelectionRequest +V031 X11:SelectionNotify +V032 X11:ColormapNotify +V033 X11:ClientMessage +V034 X11:MappingNotify +E000 X11:Success +E001 X11:BadRequest +E002 X11:BadValue +E003 X11:BadWindow +E004 X11:BadPixmap +E005 X11:BadAtom +E006 X11:BadCursor +E007 X11:BadFont +E008 X11:BadMatch +E009 X11:BadDrawable +E010 X11:BadAccess +E011 X11:BadAlloc +E012 X11:BadColor +E013 X11:BadGC +E014 X11:BadIDChoice +E015 X11:BadName +E016 X11:BadLength +E017 X11:BadImplementation +R001 X3D-PEX:GetExtensionInfo +R002 X3D-PEX:GetEnumeratedTypeInfo +R003 X3D-PEX:GetImpDepConstants +R004 X3D-PEX:CreateLookupTable +R005 X3D-PEX:CopyLookupTable +R006 X3D-PEX:FreeLookupTable +R007 X3D-PEX:GetTableInfo +R008 X3D-PEX:GetPredefinedEntries +R009 X3D-PEX:GetDefinedIndices +R010 X3D-PEX:GetTableEntry +R011 X3D-PEX:GetTableEntries +R012 X3D-PEX:SetTableEntries +R013 X3D-PEX:DeleteTableEntries +R014 X3D-PEX:CreatePipelineContext +R015 X3D-PEX:CopyPipelineContext +R016 X3D-PEX:FreePipelineContext +R017 X3D-PEX:GetPipelineContext +R018 X3D-PEX:ChangePipelineContext +R019 X3D-PEX:CreateRenderer +R020 X3D-PEX:FreeRenderer +R021 X3D-PEX:ChangeRenderer +R022 X3D-PEX:GetRendererAttributes +R023 X3D-PEX:GetRendererDynamics +R024 X3D-PEX:BeginRendering +R025 X3D-PEX:EndRendering +R026 X3D-PEX:BeginStructure +R027 X3D-PEX:EndStructure +R028 X3D-PEX:OutputCommands +R029 X3D-PEX:Network +R030 X3D-PEX:CreateStructure +R031 X3D-PEX:CopyStructure +R032 X3D-PEX:DestroyStructures +R033 X3D-PEX:GetStructureInfo +R034 X3D-PEX:GetElementInfo +R035 X3D-PEX:GetStructuresInNetwork +R036 X3D-PEX:GetAncestors +R037 X3D-PEX:GetDescendants +R038 X3D-PEX:FetchElements +R039 X3D-PEX:SetEditingMode +R040 X3D-PEX:SetElementPointer +R041 X3D-PEX:SetElementPointerAtLabel +R042 X3D-PEX:ElementSearch +R043 X3D-PEX:StoreElements +R044 X3D-PEX:DeleteElements +R045 X3D-PEX:DeleteElementsToLabel +R046 X3D-PEX:DeleteBetweenLabels +R047 X3D-PEX:CopyElements +R048 X3D-PEX:ChangeStructureRefs +R049 X3D-PEX:CreateNameSet +R050 X3D-PEX:CopyNameSet +R051 X3D-PEX:FreeNameSet +R052 X3D-PEX:GetNameSet +R053 X3D-PEX:ChangeNameSet +R054 X3D-PEX:CreateSearchContext +R055 X3D-PEX:CopySearchContext +R056 X3D-PEX:FreeSearchContext +R057 X3D-PEX:GetSearchContext +R058 X3D-PEX:ChangeSearchContext +R059 X3D-PEX:SearchNetwork +R060 X3D-PEX:CreatePhigsWks +R061 X3D-PEX:FreePhigsWks +R062 X3D-PEX:GetWksInfo +R063 X3D-PEX:GetDynamics +R064 X3D-PEX:GetViewRep +R065 X3D-PEX:RedrawAllStructures +R066 X3D-PEX:UpdateWorkstation +R067 X3D-PEX:RedrawClipRegion +R068 X3D-PEX:ExecuteDeferredActions +R069 X3D-PEX:SetViewPriority +R070 X3D-PEX:SetDisplayUpdateMode +R071 X3D-PEX:MapDCtoWC +R072 X3D-PEX:MapWCtoDC +R073 X3D-PEX:SetViewRep +R074 X3D-PEX:SetWksWindow +R075 X3D-PEX:SetWksViewport +R076 X3D-PEX:SetHlhsrMode +R077 X3D-PEX:SetWksBufferMode +R078 X3D-PEX:PostStructure +R079 X3D-PEX:UnpostStructure +R080 X3D-PEX:UnpostAllStructures +R081 X3D-PEX:GetWksPostings +R082 X3D-PEX:GetPickDevice +R083 X3D-PEX:ChangePickDevice +R084 X3D-PEX:CreatePickMeasure +R085 X3D-PEX:FreePickMeasure +R086 X3D-PEX:GetPickMeasure +R087 X3D-PEX:UpdatePickMeasure +R088 X3D-PEX:OpenFont +R089 X3D-PEX:CloseFont +R090 X3D-PEX:QueryFont +R091 X3D-PEX:ListFonts +R092 X3D-PEX:ListFontsWithInfo +R093 X3D-PEX:QueryTextExtents +R094 X3D-PEX:MatchRenderingTargets +R095 X3D-PEX:Escape +R096 X3D-PEX:EscapeWithReply +R097 X3D-PEX:Elements +R098 X3D-PEX:AccumulateState +R099 X3D-PEX:BeginPickOne +R100 X3D-PEX:EndPickOne +R101 X3D-PEX:PickOne +R102 X3D-PEX:BeginPickAll +R103 X3D-PEX:EndPickAll +R104 X3D-PEX:PickAll +E000 X3D-PEX:ColorTypeError +E001 X3D-PEX:erStateError +E002 X3D-PEX:FloatingPointFormatError +E003 X3D-PEX:LabelError +E004 X3D-PEX:LookupTableError +E005 X3D-PEX:NameSetError +E006 X3D-PEX:PathError +E007 X3D-PEX:FontError +E008 X3D-PEX:PhigsWksError +E009 X3D-PEX:PickMeasureError +E010 X3D-PEX:PipelineContextError +E011 X3D-PEX:erError +E012 X3D-PEX:SearchContextError +E013 X3D-PEX:StructureError +E014 X3D-PEX:OutputCommandError +R000 XC-APPGROUP:QueryVersion +R001 XC-APPGROUP:Create +R002 XC-APPGROUP:Destroy +R003 XC-APPGROUP:GetAttr +R004 XC-APPGROUP:Query +R005 XC-APPGROUP:CreateAssoc +R006 XC-APPGROUP:DestroyAssoc +E000 XC-APPGROUP:BadAppGroup +R000 XC-MISC:GetVersion +R001 XC-MISC:GetXIDRange +R002 XC-MISC:GetXIDList +R000 XEVIE:QueryVersion +R001 XEVIE:Start +R002 XEVIE:End +R003 XEVIE:Send +R004 XEVIE:SelectInput +R000 XFIXES:QueryVersion +R001 XFIXES:ChangeSaveSet +R002 XFIXES:SelectSelectionInput +R003 XFIXES:SelectCursorInput +R004 XFIXES:GetCursorImage +R005 XFIXES:CreateRegion +R006 XFIXES:CreateRegionFromBitmap +R007 XFIXES:CreateRegionFromWindow +R008 XFIXES:CreateRegionFromGC +R009 XFIXES:CreateRegionFromPicture +R010 XFIXES:DestroyRegion +R011 XFIXES:SetRegion +R012 XFIXES:CopyRegion +R013 XFIXES:UnionRegion +R014 XFIXES:IntersectRegion +R015 XFIXES:SubtractRegion +R016 XFIXES:InvertRegion +R017 XFIXES:TranslateRegion +R018 XFIXES:RegionExtents +R019 XFIXES:FetchRegion +R020 XFIXES:SetGCClipRegion +R021 XFIXES:SetWindowShapeRegion +R022 XFIXES:SetPictureClipRegion +R023 XFIXES:SetCursorName +R024 XFIXES:GetCursorName +R025 XFIXES:GetCursorImageAndName +R026 XFIXES:ChangeCursor +R027 XFIXES:ChangeCursorByName +R028 XFIXES:ExpandRegion +R029 XFIXES:HideCursor +R030 XFIXES:ShowCursor +V000 XFIXES:SelectionNotify +V001 XFIXES:CursorNotify +E000 XFIXES:BadRegion +R000 XFree86-Bigfont:QueryVersion +R001 XFree86-Bigfont:QueryFont +R000 XFree86-DGA:QueryVersion +R001 XFree86-DGA:GetVideoLL +R002 XFree86-DGA:DirectVideo +R003 XFree86-DGA:GetViewPortSize +R004 XFree86-DGA:SetViewPort +R005 XFree86-DGA:GetVidPage +R006 XFree86-DGA:SetVidPage +R007 XFree86-DGA:InstallColormap +R008 XFree86-DGA:QueryDirectVideo +R009 XFree86-DGA:ViewPortChanged +R010 XFree86-DGA:Obsolete1 +R011 XFree86-DGA:Obsolete2 +R012 XFree86-DGA:QueryModes +R013 XFree86-DGA:SetMode +R014 XFree86-DGA:SetViewport +R015 XFree86-DGA:InstallColormap +R016 XFree86-DGA:SelectInput +R017 XFree86-DGA:FillRectangle +R018 XFree86-DGA:CopyArea +R019 XFree86-DGA:CopyTransparentArea +R020 XFree86-DGA:GetViewportStatus +R021 XFree86-DGA:Sync +R022 XFree86-DGA:OpenFramebuffer +R023 XFree86-DGA:CloseFramebuffer +R024 XFree86-DGA:SetClientVersion +R025 XFree86-DGA:ChangePixmapMode +R026 XFree86-DGA:CreateColormap +E000 XFree86-DGA:ClientNotLocal +E001 XFree86-DGA:NoDirectVideoMode +E002 XFree86-DGA:ScreenNotActive +E003 XFree86-DGA:DirectNotActivated +E004 XFree86-DGA:OperationNotSupported +R000 XFree86-DRI:QueryVersion +R001 XFree86-DRI:QueryDirectRenderingCapable +R002 XFree86-DRI:OpenConnection +R003 XFree86-DRI:CloseConnection +R004 XFree86-DRI:GetClientDriverName +R005 XFree86-DRI:CreateContext +R006 XFree86-DRI:DestroyContext +R007 XFree86-DRI:CreateDrawable +R008 XFree86-DRI:DestroyDrawable +R009 XFree86-DRI:GetDrawableInfo +R010 XFree86-DRI:GetDeviceInfo +R011 XFree86-DRI:AuthConnection +R012 XFree86-DRI:OpenFullScreen +R013 XFree86-DRI:CloseFullScreen +E000 XFree86-DRI:ClientNotLocal +E001 XFree86-DRI:OperationNotSupported +R000 XFree86-Misc:QueryVersion +R001 XFree86-Misc:GetSaver +R002 XFree86-Misc:SetSaver +R003 XFree86-Misc:GetMouseSettings +R004 XFree86-Misc:GetKbdSettings +R005 XFree86-Misc:SetMouseSettings +R006 XFree86-Misc:SetKbdSettings +R007 XFree86-Misc:SetGrabKeysState +R008 XFree86-Misc:SetClientVersion +R009 XFree86-Misc:GetFilePaths +R010 XFree86-Misc:PassMessage +E000 XFree86-Misc:BadMouseProtocol +E001 XFree86-Misc:BadMouseBaudRate +E002 XFree86-Misc:BadMouseFlags +E003 XFree86-Misc:BadMouseCombo +E004 XFree86-Misc:BadKbdType +E005 XFree86-Misc:ModInDevDisabled +E006 XFree86-Misc:ModInDevClientNotLocal +E007 XFree86-Misc:NoModule +R000 XFree86-VidModeExtension:QueryVersion +R001 XFree86-VidModeExtension:GetModeLine +R002 XFree86-VidModeExtension:ModModeLine +R003 XFree86-VidModeExtension:SwitchMode +R004 XFree86-VidModeExtension:GetMonitor +R005 XFree86-VidModeExtension:LockModeSwitch +R006 XFree86-VidModeExtension:GetAllModeLines +R007 XFree86-VidModeExtension:AddModeLine +R008 XFree86-VidModeExtension:DeleteModeLine +R009 XFree86-VidModeExtension:ValidateModeLine +R010 XFree86-VidModeExtension:SwitchToMode +R011 XFree86-VidModeExtension:GetViewPort +R012 XFree86-VidModeExtension:SetViewPort +R013 XFree86-VidModeExtension:GetDotClocks +R014 XFree86-VidModeExtension:SetClientVersion +R015 XFree86-VidModeExtension:SetGamma +R016 XFree86-VidModeExtension:GetGamma +R017 XFree86-VidModeExtension:GetGammaRamp +R018 XFree86-VidModeExtension:SetGammaRamp +R019 XFree86-VidModeExtension:GetGammaRampSize +R020 XFree86-VidModeExtension:GetPermissions +V000 XFree86-VidModeExtension:Notify +E000 XFree86-VidModeExtension:BadClock +E001 XFree86-VidModeExtension:BadHTimings +E002 XFree86-VidModeExtension:BadVTimings +E003 XFree86-VidModeExtension:ModeUnsuitable +E004 XFree86-VidModeExtension:ExtensionDisabled +E005 XFree86-VidModeExtension:ClientNotLocal +E006 XFree86-VidModeExtension:ZoomLocked +R001 XIE:QueryImageExtension +R002 XIE:QueryTechniques +R003 XIE:CreateColorList +R004 XIE:DestroyColorList +R005 XIE:PurgeColorList +R006 XIE:QueryColorList +R007 XIE:CreateLUT +R008 XIE:DestroyLUT +R009 XIE:CreatePhotomap +R010 XIE:DestroyPhotomap +R011 XIE:QueryPhotomap +R012 XIE:CreateROI +R013 XIE:DestroyROI +R014 XIE:CreatePhotospace +R015 XIE:DestroyPhotospace +R016 XIE:ExecuteImmediate +R017 XIE:CreatePhotoflo +R018 XIE:DestroyPhotoflo +R019 XIE:ExecutePhotoflo +R020 XIE:ModifyPhotoflo +R021 XIE:RedefinePhotoflo +R022 XIE:PutClientData +R023 XIE:GetClientData +R024 XIE:QueryPhotoflo +R025 XIE:Await +R026 XIE:Abort +E000 XIE:ColorListError +E001 XIE:LUTError +E002 XIE:PhotofloError +E003 XIE:PhotomapError +E004 XIE:PhotospaceError +E005 XIE:ROIError +E006 XIE:FloError +R000 XINERAMA:QueryVersion +R001 XINERAMA:GetState +R002 XINERAMA:GetScreenCount +R003 XINERAMA:GetScreenSize +R004 XINERAMA:IsActive +R005 XINERAMA:QueryScreens +R001 XInputExtension:GetExtensionVersion +R002 XInputExtension:ListInputDevices +R003 XInputExtension:OpenDevice +R004 XInputExtension:CloseDevice +R005 XInputExtension:SetDeviceMode +R006 XInputExtension:SelectExtensionEvent +R007 XInputExtension:GetSelectedExtensionEvents +R008 XInputExtension:ChangeDeviceDontPropagateList +R009 XInputExtension:GetDeviceDontPropagageList +R010 XInputExtension:GetDeviceMotionEvents +R011 XInputExtension:ChangeKeyboardDevice +R012 XInputExtension:ChangePointerDevice +R013 XInputExtension:GrabDevice +R014 XInputExtension:UngrabDevice +R015 XInputExtension:GrabDeviceKey +R016 XInputExtension:UngrabDeviceKey +R017 XInputExtension:GrabDeviceButton +R018 XInputExtension:UngrabDeviceButton +R019 XInputExtension:AllowDeviceEvents +R020 XInputExtension:GetDeviceFocus +R021 XInputExtension:SetDeviceFocus +R022 XInputExtension:GetFeedbackControl +R023 XInputExtension:ChangeFeedbackControl +R024 XInputExtension:GetDeviceKeyMapping +R025 XInputExtension:ChangeDeviceKeyMapping +R026 XInputExtension:GetDeviceModifierMapping +R027 XInputExtension:SetDeviceModifierMapping +R028 XInputExtension:GetDeviceButtonMapping +R029 XInputExtension:SetDeviceButtonMapping +R030 XInputExtension:QueryDeviceState +R031 XInputExtension:SendExtensionEvent +R032 XInputExtension:DeviceBell +R033 XInputExtension:SetDeviceValuators +R034 XInputExtension:GetDeviceControl +R035 XInputExtension:ChangeDeviceControl +V000 XInputExtension:DeviceValuator +V001 XInputExtension:DeviceKeyPress +V002 XInputExtension:DeviceKeyRelease +V003 XInputExtension:DeviceButtonPress +V004 XInputExtension:DeviceButtonRelease +V005 XInputExtension:DeviceMotionNotify +V006 XInputExtension:DeviceFocusIn +V007 XInputExtension:DeviceFocusOut +V008 XInputExtension:ProximityIn +V009 XInputExtension:ProximityOut +V010 XInputExtension:DeviceStateNotify +V011 XInputExtension:DeviceMappingNotify +V012 XInputExtension:ChangeDeviceNotify +V013 XInputExtension:DeviceKeystateNotify +V014 XInputExtension:DeviceButtonstateNotify +V015 XInputExtension:DevicePresenceNotify +E000 XInputExtension:BadDevice +E001 XInputExtension:BadEvent +E002 XInputExtension:BadMode +E003 XInputExtension:DeviceBusy +E004 XInputExtension:BadClass +R000 XKEYBOARD:UseExtension +R001 XKEYBOARD:SelectEvents +R002 XKEYBOARD:Obsolete +R003 XKEYBOARD:Bell +R004 XKEYBOARD:GetState +R005 XKEYBOARD:LatchLockState +R006 XKEYBOARD:GetControls +R007 XKEYBOARD:SetControls +R008 XKEYBOARD:GetMap +R009 XKEYBOARD:SetMap +R010 XKEYBOARD:GetCompatMap +R011 XKEYBOARD:SetCompatMap +R012 XKEYBOARD:GetIndicatorState +R013 XKEYBOARD:GetIndicatorMap +R014 XKEYBOARD:SetIndicatorMap +R015 XKEYBOARD:GetNamedIndicator +R016 XKEYBOARD:SetNamedIndicator +R017 XKEYBOARD:GetNames +R018 XKEYBOARD:SetNames +R019 XKEYBOARD:GetGeometry +R020 XKEYBOARD:SetGeometry +R021 XKEYBOARD:PerClientFlags +R022 XKEYBOARD:ListComponents +R023 XKEYBOARD:GetKbdByName +R024 XKEYBOARD:GetDeviceInfo +R025 XKEYBOARD:SetDeviceInfo +R101 XKEYBOARD:SetDebuggingFlags +V000 XKEYBOARD:EventCode +E000 XKEYBOARD:BadKeyboard +R000 XTEST:GetVersion +R001 XTEST:CompareCursor +R002 XTEST:FakeInput +R003 XTEST:GrabControl +R000 XVideo:QueryExtension +R001 XVideo:QueryAdaptors +R002 XVideo:QueryEncodings +R003 XVideo:GrabPort +R004 XVideo:UngrabPort +R005 XVideo:PutVideo +R006 XVideo:PutStill +R007 XVideo:GetVideo +R008 XVideo:GetStill +R009 XVideo:StopVideo +R010 XVideo:SelectVideoNotify +R011 XVideo:SelectPortNotify +R012 XVideo:QueryBestSize +R013 XVideo:SetPortAttribute +R014 XVideo:GetPortAttribute +R015 XVideo:QueryPortAttributes +R016 XVideo:ListImageFormats +R017 XVideo:QueryImageAttributes +R018 XVideo:PutImage +R019 XVideo:ShmPutImage +V000 XVideo:VideoNotify +V001 XVideo:PortNotify +E000 XVideo:BadPort +E001 XVideo:BadEncoding +E002 XVideo:BadControl +R000 XVideo-MotionCompensation:QueryVersion +R001 XVideo-MotionCompensation:ListSurfaceTypes +R002 XVideo-MotionCompensation:CreateContext +R003 XVideo-MotionCompensation:DestroyContext +R004 XVideo-MotionCompensation:CreateSurface +R005 XVideo-MotionCompensation:DestroySurface +R006 XVideo-MotionCompensation:CreateSubpicture +R007 XVideo-MotionCompensation:DestroySubpicture +R008 XVideo-MotionCompensation:ListSubpictureTypes +R009 XVideo-MotionCompensation:GetDRInfo +E000 XVideo-MotionCompensation:BadContext +E001 XVideo-MotionCompensation:BadSurface +E002 XVideo-MotionCompensation:BadSubpicture +R000 XpExtension:QueryVersion +R001 XpExtension:GetPrinterList +R002 XpExtension:CreateContext +R003 XpExtension:SetContext +R004 XpExtension:GetContext +R005 XpExtension:DestroyContext +R006 XpExtension:GetContextScreen +R007 XpExtension:StartJob +R008 XpExtension:EndJob +R009 XpExtension:StartDoc +R010 XpExtension:EndDoc +R011 XpExtension:PutDocumentData +R012 XpExtension:GetDocumentData +R013 XpExtension:StartPage +R014 XpExtension:EndPage +R015 XpExtension:SelectInput +R016 XpExtension:InputSelected +R017 XpExtension:GetAttributes +R018 XpExtension:SetAttributes +R019 XpExtension:GetOneAttribute +R020 XpExtension:RehashPrinterList +R021 XpExtension:GetPageDimensions +R022 XpExtension:QueryScreens +R023 XpExtension:SetImageResolution +R024 XpExtension:GetImageResolution +V000 XpExtension:PrintNotify +V001 XpExtension:AttributeNotify +E000 XpExtension:BadContext +E001 XpExtension:BadSequence +E002 XpExtension:BadResourceID diff --git a/dix/registry.c b/dix/registry.c new file mode 100644 index 000000000..10fa21f84 --- /dev/null +++ b/dix/registry.c @@ -0,0 +1,328 @@ +/************************************************************ + +Author: Eamon Walsh <ewalsh@epoch.ncsc.mil> + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +this permission notice appear in supporting documentation. This permission +notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR 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. + +********************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifdef XREGISTRY + +#include <stdlib.h> +#include <string.h> +#include <X11/X.h> +#include <X11/Xproto.h> +#include "resource.h" +#include "registry.h" + +#define BASE_SIZE 16 +#define CORE "X11" +#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt" + +#define PROT_COMMENT '#' +#define PROT_REQUEST 'R' +#define PROT_EVENT 'V' +#define PROT_ERROR 'E' + +static FILE *fh; + +static char ***requests, **events, **errors, **resources; +static unsigned nmajor, *nminor, nevent, nerror, nresource; + +/* + * File parsing routines + */ +static int double_size(void *p, unsigned n, unsigned size) +{ + char **ptr = (char **)p; + unsigned s, f; + + if (n) { + s = n * size; + n *= 2 * size; + f = n; + } else { + s = 0; + n = f = BASE_SIZE * size; + } + + *ptr = xrealloc(*ptr, n); + if (!*ptr) { + dixResetRegistry(); + return FALSE; + } + memset(*ptr + s, 0, f - s); + return TRUE; +} + +static void +RegisterRequestName(unsigned major, unsigned minor, char *name) +{ + while (major >= nmajor) { + if (!double_size(&requests, nmajor, sizeof(char **))) + return; + if (!double_size(&nminor, nmajor, sizeof(unsigned))) + return; + nmajor = nmajor ? nmajor * 2 : BASE_SIZE; + } + while (minor >= nminor[major]) { + if (!double_size(requests+major, nminor[major], sizeof(char *))) + return; + nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE; + } + + free(requests[major][minor]); + requests[major][minor] = name; +} + +static void +RegisterEventName(unsigned event, char *name) { + while (event >= nevent) { + if (!double_size(&events, nevent, sizeof(char *))) + return; + nevent = nevent ? nevent * 2 : BASE_SIZE; + } + + free(events[event]); + events[event] = name; +} + +static void +RegisterErrorName(unsigned error, char *name) { + while (error >= nerror) { + if (!double_size(&errors, nerror, sizeof(char *))) + return; + nerror = nerror ? nerror * 2 : BASE_SIZE; + } + + free(errors[error]); + errors[error] = name; +} + +void +RegisterExtensionNames(ExtensionEntry *extEntry) +{ + char buf[256], *lineobj, *ptr; + unsigned offset; + + if (fh == NULL) + return; + + rewind(fh); + + while (fgets(buf, sizeof(buf), fh)) { + ptr = strchr(buf, '\n'); + if (ptr) + *ptr = 0; + + switch (buf[0]) { + case PROT_REQUEST: + case PROT_EVENT: + case PROT_ERROR: + break; + case PROT_COMMENT: + case '\0': + continue; + default: + continue; + } + + ptr = strchr(buf, ' '); + if (!ptr || ptr != buf + 4) { + LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); + continue; + } + lineobj = strdup(ptr + 1); + if (!lineobj) + continue; + + ptr = strchr(buf, ':'); + if (!ptr) { + LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); + continue; + } + *ptr = 0; + + if (strcmp(buf + 5, extEntry->name)) + continue; + + offset = strtol(buf + 1, &ptr, 10); + if (offset == 0 && ptr == buf + 1) { + LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n"); + continue; + } + + switch(buf[0]) { + case PROT_REQUEST: + if (extEntry->base) + RegisterRequestName(extEntry->base, offset, lineobj); + else + RegisterRequestName(offset, 0, lineobj); + break; + case PROT_EVENT: + RegisterEventName(extEntry->eventBase + offset, lineobj); + break; + case PROT_ERROR: + RegisterErrorName(extEntry->errorBase + offset, lineobj); + break; + } + } +} + +/* + * Registration functions + */ + +void +RegisterResourceName(RESTYPE resource, char *name) +{ + resource &= TypeMask; + + while (resource >= nresource) { + if (!double_size(&resources, nresource, sizeof(char *))) + return; + nresource = nresource ? nresource * 2 : BASE_SIZE; + } + + resources[resource] = name; +} + +/* + * Lookup functions + */ + +const char * +LookupRequestName(int major, int minor) +{ + if (major >= nmajor) + return XREGISTRY_UNKNOWN; + if (minor >= nminor[major]) + return XREGISTRY_UNKNOWN; + + return requests[major][minor] ? requests[major][minor] : XREGISTRY_UNKNOWN; +} + +const char * +LookupMajorName(int major) +{ + if (major < 128) { + const char *retval; + + if (major >= nmajor) + return XREGISTRY_UNKNOWN; + if (0 >= nminor[major]) + return XREGISTRY_UNKNOWN; + + retval = requests[major][0]; + return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN; + } else { + ExtensionEntry *extEntry = GetExtensionEntry(major); + return extEntry ? extEntry->name : XREGISTRY_UNKNOWN; + } +} + +const char * +LookupEventName(int event) +{ + event &= 127; + if (event >= nevent) + return XREGISTRY_UNKNOWN; + + return events[event] ? events[event] : XREGISTRY_UNKNOWN; +} + +const char * +LookupErrorName(int error) +{ + if (error >= nerror) + return XREGISTRY_UNKNOWN; + + return errors[error] ? errors[error] : XREGISTRY_UNKNOWN; +} + +const char * +LookupResourceName(RESTYPE resource) +{ + resource &= TypeMask; + if (resource >= nresource) + return XREGISTRY_UNKNOWN; + + return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN; +} + +/* + * Setup and teardown + */ +void +dixResetRegistry(void) +{ + ExtensionEntry extEntry; + + /* Free all memory */ + while (nmajor--) { + while (nminor[nmajor]) + free(requests[nmajor][--nminor[nmajor]]); + xfree(requests[nmajor]); + } + xfree(requests); + xfree(nminor); + + while (nevent--) + free(events[nevent]); + xfree(events); + + while (nerror--) + free(errors[nerror]); + xfree(errors); + + xfree(resources); + + requests = NULL; + nminor = NULL; + events = NULL; + errors = NULL; + resources = NULL; + + nmajor = nevent = nerror = nresource = 0; + + /* Open the protocol file */ + if (fh) + fclose(fh); + fh = fopen(FILENAME, "r"); + if (!fh) + LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME); + + /* Add built-in resources */ + RegisterResourceName(RT_NONE, "NONE"); + RegisterResourceName(RT_WINDOW, "WINDOW"); + RegisterResourceName(RT_PIXMAP, "PIXMAP"); + RegisterResourceName(RT_GC, "GC"); + RegisterResourceName(RT_FONT, "FONT"); + RegisterResourceName(RT_CURSOR, "CURSOR"); + RegisterResourceName(RT_COLORMAP, "COLORMAP"); + RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY"); + RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT"); + RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB"); + + /* Add the core protocol */ + memset(&extEntry, 0, sizeof(extEntry)); + extEntry.name = CORE; + RegisterExtensionNames(&extEntry); +} + +#endif /* XREGISTRY */ diff --git a/dix/resource.c b/dix/resource.c index c8297fb67..f318de3c0 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -151,10 +151,11 @@ Equipment Corporation. #ifdef XSERVER_DTRACE #include <sys/types.h> +#include "registry.h" typedef const char *string; #include "Xserver-dtrace.h" -#define TypeNameString(t) NameForAtom(ResourceNames[t & TypeMask]) +#define TypeNameString(t) LookupResourceName(t) #endif static void RebuildTable( @@ -191,17 +192,17 @@ _X_EXPORT RESTYPE TypeMask; static DeleteType *DeleteFuncs = (DeleteType *)NULL; -#ifdef XResExtension +_X_EXPORT CallbackListPtr ResourceStateCallback; -_X_EXPORT Atom * ResourceNames = NULL; - -_X_EXPORT void RegisterResourceName (RESTYPE type, char *name) +static _X_INLINE void +CallResourceStateCallback(ResourceState state, ResourceRec *res) { - ResourceNames[type & TypeMask] = MakeAtom(name, strlen(name), TRUE); + if (ResourceStateCallback) { + ResourceStateInfoRec rsi = { state, res->id, res->type, res->value }; + CallCallbacks(&ResourceStateCallback, &rsi); + } } -#endif - _X_EXPORT RESTYPE CreateNewResourceType(DeleteType deleteFunc) { @@ -214,17 +215,8 @@ CreateNewResourceType(DeleteType deleteFunc) (next + 1) * sizeof(DeleteType)); if (!funcs) return 0; - -#ifdef XResExtension - { - Atom *newnames; - newnames = xrealloc(ResourceNames, (next + 1) * sizeof(Atom)); - if(!newnames) - return 0; - ResourceNames = newnames; - ResourceNames[next] = 0; - } -#endif + if (!dixRegisterPrivateOffset(next, -1)) + return 0; lastResourceType = next; DeleteFuncs = funcs; @@ -278,14 +270,6 @@ InitClientResources(ClientPtr client) DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels; DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone; DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; - -#ifdef XResExtension - if(ResourceNames) - xfree(ResourceNames); - ResourceNames = xalloc((lastResourceType + 1) * sizeof(Atom)); - if(!ResourceNames) - return FALSE; -#endif } clientTable[i = client->index].resources = (ResourcePtr *)xalloc(INITBUCKETS*sizeof(ResourcePtr)); @@ -490,6 +474,7 @@ AddResource(XID id, RESTYPE type, pointer value) rrec->elements++; if (!(id & SERVER_BIT) && (id >= rrec->expectID)) rrec->expectID = id + 1; + CallResourceStateCallback(ResourceStateAdding, res); return TRUE; } @@ -550,7 +535,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) ResourcePtr *prev, *head; int *eltptr; int elements; - Bool gotOne = FALSE; if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets) { @@ -570,27 +554,19 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) #endif *prev = res->next; elements = --*eltptr; - if (rtype & RC_CACHED) - FlushClientCaches(res->id); + + CallResourceStateCallback(ResourceStateFreeing, res); + if (rtype != skipDeleteFuncType) (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); xfree(res); if (*eltptr != elements) prev = head; /* prev may no longer be valid */ - gotOne = TRUE; } else prev = &res->next; } - if(clients[cid] && (id == clients[cid]->lastDrawableID)) - { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; - } } - if (!gotOne) - ErrorF("Freeing resource id=%lX which isn't there.\n", - (unsigned long)id); } @@ -614,8 +590,9 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) res->value, TypeNameString(res->type)); #endif *prev = res->next; - if (type & RC_CACHED) - FlushClientCaches(res->id); + + CallResourceStateCallback(ResourceStateFreeing, res); + if (!skipFree) (*DeleteFuncs[type & TypeMask])(res->value, res->id); xfree(res); @@ -624,11 +601,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) else prev = &res->next; } - if(clients[cid] && (id == clients[cid]->lastDrawableID)) - { - clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0]; - clients[cid]->lastDrawableID = WindowTable[0]->drawable.id; - } } } @@ -651,8 +623,6 @@ ChangeResourceValue (XID id, RESTYPE rtype, pointer value) for (; res; res = res->next) if ((res->id == id) && (res->type == rtype)) { - if (rtype & RC_CACHED) - FlushClientCaches(res->id); res->value = value; return TRUE; } @@ -780,10 +750,11 @@ FreeClientNeverRetainResources(ClientPtr client) this->value, TypeNameString(this->type)); #endif *prev = this->next; - if (rtype & RC_CACHED) - FlushClientCaches(this->id); + + CallResourceStateCallback(ResourceStateFreeing, this); + (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); - xfree(this); + xfree(this); } else prev = &this->next; @@ -830,10 +801,11 @@ FreeClientResources(ClientPtr client) this->value, TypeNameString(this->type)); #endif *head = this->next; - if (rtype & RC_CACHED) - FlushClientCaches(this->id); + + CallResourceStateCallback(ResourceStateFreeing, this); + (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); - xfree(this); + xfree(this); } } xfree(clientTable[client->index].resources); @@ -873,81 +845,35 @@ LegalNewID(XID id, ClientPtr client) !LookupIDByClass(id, RC_ANY))); } -/* SecurityLookupIDByType and SecurityLookupIDByClass: - * These are the heart of the resource ID security system. They take - * two additional arguments compared to the old LookupID functions: - * the client doing the lookup, and the access mode (see resource.h). - * The resource is returned if it exists and the client is allowed access, - * else NULL is returned. - */ - -_X_EXPORT pointer -SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode) +_X_EXPORT int +dixLookupResource(pointer *result, XID id, RESTYPE rtype, + ClientPtr client, Mask mode) { - int cid; - ResourcePtr res; - pointer retval = NULL; - - if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && - clientTable[cid].buckets) - { - res = clientTable[cid].resources[Hash(cid, id)]; - - for (; res; res = res->next) - if ((res->id == id) && (res->type == rtype)) - { - retval = res->value; - break; - } - } - if (retval && client && - !XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, mode, retval)) - retval = NULL; - - return retval; -} - - -_X_EXPORT pointer -SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode) -{ - int cid; + int cid = CLIENT_ID(id); + int istype = (rtype & TypeMask) && (rtype != RC_ANY); ResourcePtr res = NULL; - pointer retval = NULL; - if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && - clientTable[cid].buckets) - { + *result = NULL; + + if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) - if ((res->id == id) && (res->type & classes)) - { - retval = res->value; + if ((res->id == id) && ((istype && res->type == rtype) || + (!istype && res->type & rtype))) break; - } } - if (retval && client && - !XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, mode, retval)) - retval = NULL; - - return retval; -} - -/* We can't replace the LookupIDByType and LookupIDByClass functions with - * macros because of compatibility with loadable servers. - */ - -_X_EXPORT pointer -LookupIDByType(XID id, RESTYPE rtype) -{ - return SecurityLookupIDByType(NullClient, id, rtype, - DixUnknownAccess); -} + if (!res) + return BadValue; + + if (client) { + client->errorValue = id; + cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, + res->value, RT_NONE, NULL, mode); + if (cid != Success) + return cid; + } -_X_EXPORT pointer -LookupIDByClass(XID id, RESTYPE classes) -{ - return SecurityLookupIDByClass(NullClient, id, classes, - DixUnknownAccess); + *result = res->value; + return Success; } diff --git a/dix/window.c b/dix/window.c index a43613ed9..8d61b8e3c 100644 --- a/dix/window.c +++ b/dix/window.c @@ -126,6 +126,7 @@ Equipment Corporation. #ifdef XAPPGROUP #include "appgroup.h" #endif +#include "privates.h" #include "xace.h" #include "mi.h" @@ -290,9 +291,8 @@ SetWindowToDefaults(WindowPtr pWin) pWin->deliverableEvents = 0; pWin->dontPropagate = 0; pWin->forcedBS = FALSE; -#ifdef COMPOSITE pWin->redirectDraw = RedirectDrawNone; -#endif + pWin->forcedBG = FALSE; } static void @@ -338,41 +338,6 @@ MakeRootTile(WindowPtr pWin) } -WindowPtr -AllocateWindow(ScreenPtr pScreen) -{ - WindowPtr pWin; - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int i; - - pWin = (WindowPtr)xalloc(pScreen->totalWindowSize); - if (pWin) - { - ppriv = (DevUnion *)(pWin + 1); - pWin->devPrivates = ppriv; - sizes = pScreen->WindowPrivateSizes; - ptr = (char *)(ppriv + pScreen->WindowPrivateLen); - for (i = pScreen->WindowPrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } -#if _XSERVER64 - pWin->drawable.pad0 = 0; - pWin->drawable.pad1 = 0; -#endif - } - return pWin; -} - /***** * CreateRootWindow * Makes a window at initialization time for specified screen @@ -385,7 +350,7 @@ CreateRootWindow(ScreenPtr pScreen) BoxRec box; PixmapFormatRec *format; - pWin = AllocateWindow(pScreen); + pWin = (WindowPtr)xalloc(sizeof(WindowRec)); if (!pWin) return FALSE; @@ -398,6 +363,7 @@ CreateRootWindow(ScreenPtr pScreen) pWin->drawable.pScreen = pScreen; pWin->drawable.type = DRAWABLE_WINDOW; + pWin->devPrivates = NULL; pWin->drawable.depth = pScreen->rootDepth; for (format = screenInfo.formats; @@ -461,6 +427,12 @@ CreateRootWindow(ScreenPtr pScreen) pWin->border.pixel = pScreen->blackPixel; pWin->borderWidth = 0; + /* security creation/labeling check + */ + if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id, + RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess)) + return FALSE; + if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin)) return FALSE; @@ -518,8 +490,6 @@ InitRootWindow(WindowPtr pWin) /* We SHOULD check for an error value here XXX */ (*pScreen->ChangeWindowAttributes)(pWin, backFlag); - XaceHook(XACE_WINDOW_INIT, serverClient, pWin); - MapWindow(pWin, serverClient); } @@ -684,13 +654,14 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, return NullWindow; } - pWin = AllocateWindow(pScreen); + pWin = (WindowPtr)xalloc(sizeof(WindowRec)); if (!pWin) { *error = BadAlloc; return NullWindow; } pWin->drawable = pParent->drawable; + pWin->devPrivates = NULL; pWin->drawable.depth = depth; if (depth == pParent->drawable.depth) pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel; @@ -724,16 +695,18 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, pWin->borderWidth = bw; - /* can't let untrusted clients have background None windows; - * they make it too easy to steal window contents + /* security creation/labeling check */ - if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin)) - pWin->backgroundState = None; - else { - pWin->backgroundState = BackgroundPixel; - pWin->background.pixel = 0; + *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin, + RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess); + if (*error != Success) { + xfree(pWin); + return NullWindow; } + pWin->backgroundState = XaceBackgroundNoneState(pWin); + pWin->background.pixel = pScreen->whitePixel; + pWin->borderIsPixel = pParent->borderIsPixel; pWin->border = pParent->border; if (pWin->borderIsPixel == FALSE) @@ -752,8 +725,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, REGION_NULL(pScreen, &pWin->winSize); REGION_NULL(pScreen, &pWin->borderSize); - XaceHook(XACE_WINDOW_INIT, client, pWin); - pHead = RealChildHead(pParent); if (pHead) { @@ -963,11 +934,12 @@ DeleteWindow(pointer value, XID wid) if (pWin->prevSib) pWin->prevSib->nextSib = pWin->nextSib; } + dixFreePrivates(pWin->devPrivates); xfree(pWin); return Success; } -void +int DestroySubwindows(WindowPtr pWin, ClientPtr client) { /* XXX @@ -979,8 +951,15 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client) * If you care, simply delete the call to UnmapSubwindows. */ UnmapSubwindows(pWin); - while (pWin->lastChild) + while (pWin->lastChild) { + int rc = XaceHook(XACE_RESOURCE_ACCESS, client, + pWin->lastChild->drawable.id, RT_WINDOW, + pWin->lastChild, RT_NONE, NULL, DixDestroyAccess); + if (rc != Success) + return rc; FreeResource(pWin->lastChild->drawable.id, RT_NONE); + } + return Success; } #define DeviceEventMasks (KeyPressMask | KeyReleaseMask | ButtonPressMask | \ @@ -997,25 +976,20 @@ DestroySubwindows(WindowPtr pWin, ClientPtr client) _X_EXPORT int ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) { - Mask index2; XID *pVlist; PixmapPtr pPixmap; Pixmap pixID; CursorPtr pCursor, pOldCursor; Cursor cursorID; - WindowPtr pChild; + WindowPtr pChild, pLayerWin; Colormap cmap; ColormapPtr pCmap; xEvent xE; - int result; + int error, rc; ScreenPtr pScreen; - Mask vmaskCopy = 0; - Mask tmask; + Mask index2, tmask, vmaskCopy = 0; unsigned int val; - int error; - Bool checkOptional = FALSE; - Bool borderRelative = FALSE; - WindowPtr pLayerWin; + Bool checkOptional = FALSE, borderRelative = FALSE; if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK))) return BadMatch; @@ -1037,17 +1011,13 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) borderRelative = TRUE; if (pixID == None) { - /* can't let untrusted clients have background None windows */ - if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin)) { - if (pWin->backgroundState == BackgroundPixmap) - (*pScreen->DestroyPixmap)(pWin->background.pixmap); - if (!pWin->parent) - MakeRootTile(pWin); - else - pWin->backgroundState = None; - } else { - /* didn't change the backgrnd to None, so don't tell ddx */ - index2 = 0; + if (pWin->backgroundState == BackgroundPixmap) + (*pScreen->DestroyPixmap)(pWin->background.pixmap); + if (!pWin->parent) + MakeRootTile(pWin); + else { + pWin->backgroundState = XaceBackgroundNoneState(pWin); + pWin->background.pixel = pScreen->whitePixel; } } else if (pixID == ParentRelative) @@ -1070,9 +1040,9 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, - RT_PIXMAP, DixReadAccess); - if (pPixmap != (PixmapPtr) NULL) + rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (rc == Success) { if ((pPixmap->drawable.depth != pWin->drawable.depth) || (pPixmap->drawable.pScreen != pScreen)) @@ -1088,7 +1058,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - error = BadPixmap; + error = (rc == BadValue) ? BadPixmap : rc; client->errorValue = pixID; goto PatchUp; } @@ -1117,42 +1087,40 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) error = BadMatch; goto PatchUp; } - if (pWin->borderIsPixel == FALSE) - (*pScreen->DestroyPixmap)(pWin->border.pixmap); - pWin->border = pWin->parent->border; - if ((pWin->borderIsPixel = pWin->parent->borderIsPixel) == TRUE) - { + if (pWin->parent->borderIsPixel == TRUE) { + if (pWin->borderIsPixel == FALSE) + (*pScreen->DestroyPixmap)(pWin->border.pixmap); + pWin->border = pWin->parent->border; + pWin->borderIsPixel = TRUE; index2 = CWBorderPixel; + break; } else { - pWin->parent->border.pixmap->refcnt++; + pixID = pWin->parent->border.pixmap->drawable.id; } } - else - { - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, pixID, - RT_PIXMAP, DixReadAccess); - if (pPixmap) - { - if ((pPixmap->drawable.depth != pWin->drawable.depth) || - (pPixmap->drawable.pScreen != pScreen)) - { - error = BadMatch; - goto PatchUp; - } - if (pWin->borderIsPixel == FALSE) - (*pScreen->DestroyPixmap)(pWin->border.pixmap); - pWin->borderIsPixel = FALSE; - pWin->border.pixmap = pPixmap; - pPixmap->refcnt++; - } - else + rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (rc == Success) + { + if ((pPixmap->drawable.depth != pWin->drawable.depth) || + (pPixmap->drawable.pScreen != pScreen)) { - error = BadPixmap; - client->errorValue = pixID; + error = BadMatch; goto PatchUp; } + if (pWin->borderIsPixel == FALSE) + (*pScreen->DestroyPixmap)(pWin->border.pixmap); + pWin->borderIsPixel = FALSE; + pWin->border.pixmap = pPixmap; + pPixmap->refcnt++; + } + else + { + error = (rc == BadValue) ? BadPixmap : rc; + client->errorValue = pixID; + goto PatchUp; } break; case CWBorderPixel: @@ -1277,20 +1245,20 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) #endif /* DO_SAVE_UNDERS */ break; case CWEventMask: - result = EventSelectForWindow(pWin, client, (Mask )*pVlist); - if (result) + rc = EventSelectForWindow(pWin, client, (Mask )*pVlist); + if (rc) { - error = result; + error = rc; goto PatchUp; } pVlist++; break; case CWDontPropagate: - result = EventSuppressForWindow(pWin, client, (Mask )*pVlist, + rc = EventSuppressForWindow(pWin, client, (Mask )*pVlist, &checkOptional); - if (result) + if (rc) { - error = result; + error = rc; goto PatchUp; } pVlist++; @@ -1304,6 +1272,15 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) client->errorValue = val; goto PatchUp; } + if (val == xTrue) { + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, + RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess); + if (rc != Success) { + error = rc; + client->errorValue = pWin->drawable.id; + goto PatchUp; + } + } pWin->overrideRedirect = val; break; case CWColormap: @@ -1341,11 +1318,11 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) error = BadMatch; goto PatchUp; } - pCmap = (ColormapPtr)SecurityLookupIDByType(client, cmap, - RT_COLORMAP, DixReadAccess); - if (!pCmap) + rc = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP, + client, DixUseAccess); + if (rc != Success) { - error = BadColor; + error = (rc == BadValue) ? BadColor : rc; client->errorValue = cmap; goto PatchUp; } @@ -1417,11 +1394,11 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - pCursor = (CursorPtr)SecurityLookupIDByType(client, cursorID, - RT_CURSOR, DixReadAccess); - if (!pCursor) + rc = dixLookupResource((pointer *)&pCursor, cursorID, + RT_CURSOR, client, DixUseAccess); + if (rc != Success) { - error = BadCursor; + error = (rc == BadValue) ? BadCursor : rc; client->errorValue = cursorID; goto PatchUp; } @@ -2178,7 +2155,7 @@ WhereDoIGoInTheStack( return pWin->nextSib; default: { - ErrorF("Internal error in ConfigureWindow, smode == %d\n",smode ); + /* should never happen; make something up. */ return pWin->nextSib; } } @@ -2254,7 +2231,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) unsigned short w = pWin->drawable.width, h = pWin->drawable.height, bw = pWin->borderWidth; - int action, smode = Above; + int rc, action, smode = Above; #ifdef XAPPGROUP ClientPtr win_owner; ClientPtr ag_leader = NULL; @@ -2315,12 +2292,11 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) case CWSibling: sibwid = (Window ) *pVlist; pVlist++; - pSib = (WindowPtr )SecurityLookupIDByType(client, sibwid, - RT_WINDOW, DixReadAccess); - if (!pSib) + rc = dixLookupWindow(&pSib, sibwid, client, DixGetAttrAccess); + if (rc != Success) { client->errorValue = sibwid; - return(BadWindow); + return rc; } if (pSib->parent != pParent) return(BadMatch); @@ -2767,8 +2743,9 @@ MapWindow(WindowPtr pWin, ClientPtr client) return(Success); /* general check for permission to map window */ - if (!XaceHook(XACE_MAP_ACCESS, client, pWin)) - return Success; + if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW, + pWin, RT_NONE, NULL, DixShowAccess) != Success) + return Success; pScreen = pWin->drawable.pScreen; if ( (pParent = pWin->parent) ) @@ -3016,7 +2993,8 @@ UnrealizeTree( } #endif (* Unrealize)(pChild); - DeleteWindowFromAnyEvents(pChild, FALSE); + if (MapUnmapEventsEnabled(pWin)) + DeleteWindowFromAnyEvents(pChild, FALSE); if (pChild->viewable) { #ifdef DO_SAVE_UNDERS @@ -3352,12 +3330,10 @@ static void DrawLogo( ); #endif -_X_EXPORT void -SaveScreens(int on, int mode) +_X_EXPORT int +dixSaveScreens(ClientPtr client, int on, int mode) { - int i; - int what; - int type; + int rc, i, what, type; if (on == SCREEN_SAVER_FORCER) { @@ -3376,6 +3352,13 @@ SaveScreens(int on, int mode) if (what == screenIsSaved) type = SCREEN_SAVER_CYCLE; } + + for (i = 0; i < screenInfo.numScreens; i++) { + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i], + DixShowAccess | DixHideAccess); + if (rc != Success) + return rc; + } for (i = 0; i < screenInfo.numScreens; i++) { if (on == SCREEN_SAVER_FORCER) @@ -3463,6 +3446,13 @@ SaveScreens(int on, int mode) screenIsSaved = what; if (mode == ScreenSaverReset) SetScreenSaverTimer(); + return Success; +} + +_X_EXPORT int +SaveScreens(int on, int mode) +{ + return dixSaveScreens(serverClient, on, mode); } static Bool @@ -3524,7 +3514,8 @@ TileScreenSaver(int i, int kind) { for (j=0; j<BitmapBytePad(32)*16; j++) srcbits[j] = mskbits[j] = 0x0; - cursor = AllocCursor(srcbits, mskbits, &cm, 0, 0, 0, 0, 0, 0); + result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0, + &cursor, serverClient, (XID)0); if (cursor) { cursorID = FakeClientID(0); diff --git a/doc/Makefile.am b/doc/Makefile.am index ce1979d4f..d3911c9bf 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -5,7 +5,7 @@ filemandir = $(FILE_MAN_DIR) # (i.e. those handled in the os/utils.c options processing instead of in # the DDX-level options processing) appman_PRE = Xserver.man.pre -fileman_PRE = SecurityPolicy.man.pre +fileman_PRE = appman_PROCESSED = $(appman_PRE:man.pre=man) fileman_PROCESSED = $(fileman_PRE:man.pre=man) diff --git a/doc/SecurityPolicy.man.pre b/doc/SecurityPolicy.man.pre deleted file mode 100644 index f5aff0c6c..000000000 --- a/doc/SecurityPolicy.man.pre +++ /dev/null @@ -1,258 +0,0 @@ -.\" Split out of Xserver.man, which was covered by this notice: -.\" Copyright 1984 - 1991, 1993, 1994, 1998 The Open Group -.\" -.\" Permission to use, copy, modify, distribute, and sell this software and its -.\" documentation for any purpose is hereby granted without fee, provided that -.\" the above copyright notice appear in all copies and that both that -.\" copyright notice and this permission notice appear in supporting -.\" documentation. -.\" -.\" The above copyright notice and this permission notice shall be included -.\" in all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -.\" OTHER DEALINGS IN THE SOFTWARE. -.\" -.\" Except as contained in this notice, the name of The Open Group shall -.\" not be used in advertising or otherwise to promote the sale, use or -.\" other dealings in this Software without prior written authorization -.\" from The Open Group. -.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.31 2004/01/10 22:27:46 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SecurityPolicy __filemansuffix__ __xorgversion__ -.SH NAME -SecurityPolicy \- X Window System SECURITY Extension Policy file format -.SH DESCRIPTION -The SECURITY extension to the X Window System uses a policy file to determine -which operations should be allowed or denied. The default location for this -file is -.IR __projectroot__/lib/xserver/SecurityPolicy . -.PP -The syntax of the security policy file is as follows. -Notation: "*" means zero or more occurrences of the preceding element, -and "+" means one or more occurrences. To interpret <foo/bar>, ignore -the text after the /; it is used to distinguish between instances of -<foo> in the next section. -.PP -.nf -<policy file> ::= <version line> <other line>* - -<version line> ::= <string/v> '\en' - -<other line > ::= <comment> | <access rule> | <site policy> | <blank line> - -<comment> ::= # <not newline>* '\en' - -<blank line> ::= <space> '\en' - -<site policy> ::= sitepolicy <string/sp> '\en' - -<access rule> ::= property <property/ar> <window> <perms> '\en' - -<property> ::= <string> - -<window> ::= any | root | <required property> - -<required property> ::= <property/rp> | <property with value> - -<property with value> ::= <property/rpv> = <string/rv> - -<perms> ::= [ <operation> | <action> | <space> ]* - -<operation> ::= r | w | d - -<action> ::= a | i | e - -<string> ::= <dbl quoted string> | <single quoted string> | <unquoted string> - -<dbl quoted string> ::= <space> " <not dquote>* " <space> - -<single quoted string> ::= <space> ' <not squote>* ' <space> - -<unquoted string> ::= <space> <not space>+ <space> - -<space> ::= [ ' ' | '\et' ]* - -Character sets: - -<not newline> ::= any character except '\en' -<not dquote> ::= any character except " -<not squote> ::= any character except ' -<not space> ::= any character except those in <space> -.fi -.PP -The semantics associated with the above syntax are as follows. -.PP -<version line>, the first line in the file, specifies the file format -version. If the server does not recognize the version <string/v>, it -ignores the rest of the file. The version string for the file format -described here is "version-1" . -.PP -Once past the <version line>, lines that do not match the above syntax -are ignored. -.PP -<comment> lines are ignored. -.PP -<sitepolicy> lines are currently ignored. They are intended to -specify the site policies used by the XC-QUERY-SECURITY-1 -authorization method. -.PP -<access rule> lines specify how the server should react to untrusted -client requests that affect the X Window property named <property/ar>. -The rest of this section describes the interpretation of an -<access rule>. -.PP -For an <access rule> to apply to a given instance of <property/ar>, -<property/ar> must be on a window that is in the set of windows -specified by <window>. If <window> is any, the rule applies to -<property/ar> on any window. If <window> is root, the rule applies to -<property/ar> only on root windows. -.PP -If <window> is <required property>, the following apply. If <required -property> is a <property/rp>, the rule applies when the window also -has that <property/rp>, regardless of its value. If <required -property> is a <property with value>, <property/rpv> must also have -the value specified by <string/rv>. In this case, the property must -have type STRING and format 8, and should contain one or more -null-terminated strings. If any of the strings match <string/rv>, the -rule applies. -.PP -The definition of string matching is simple case-sensitive string -comparison with one elaboration: the occurrence of the character '*' in -<string/rv> is a wildcard meaning "any string." A <string/rv> can -contain multiple wildcards anywhere in the string. For example, "x*" -matches strings that begin with x, "*x" matches strings that end with -x, "*x*" matches strings containing x, and "x*y*" matches strings that -start with x and subsequently contain y. -.PP -There may be multiple <access rule> lines for a given <property/ar>. -The rules are tested in the order that they appear in the file. The -first rule that applies is used. -.PP -<perms> specify operations that untrusted clients may attempt, and -the actions that the server should take in response to those operations. -.PP -<operation> can be r (read), w (write), or d (delete). The following -table shows how X Protocol property requests map to these operations -in the X.Org server implementation. -.PP -.nf -GetProperty r, or r and d if delete = True -ChangeProperty w -RotateProperties r and w -DeleteProperty d -ListProperties none, untrusted clients can always list all properties -.fi -.PP -<action> can be a (allow), i (ignore), or e (error). Allow means -execute the request as if it had been issued by a trusted client. -Ignore means treat the request as a no-op. In the case of -GetProperty, ignore means return an empty property value if the -property exists, regardless of its actual value. Error means do not -execute the request and return a BadAtom error with the atom set to -the property name. Error is the default action for all properties, -including those not listed in the security policy file. -.PP -An <action> applies to all <operation>s that follow it, until the next -<action> is encountered. Thus, irwad means ignore read and write, -allow delete. -.PP -GetProperty and RotateProperties may do multiple operations (r and d, -or r and w). If different actions apply to the operations, the most -severe action is applied to the whole request; there is no partial -request execution. The severity ordering is: allow < ignore < error. -Thus, if the <perms> for a property are ired (ignore read, error -delete), and an untrusted client attempts GetProperty on that property -with delete = True, an error is returned, but the property value is -not. Similarly, if any of the properties in a RotateProperties do not -allow both read and write, an error is returned without changing any -property values. -.PP -Here is an example security policy file. -.PP -.ta 3i 4i -.nf -version-1 - -XCOMM Allow reading of application resources, but not writing. -property RESOURCE_MANAGER root ar iw -property SCREEN_RESOURCES root ar iw - -XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash, -XCOMM and allowing access may give away too much information. -property CUT_BUFFER0 root irw -property CUT_BUFFER1 root irw -property CUT_BUFFER2 root irw -property CUT_BUFFER3 root irw -property CUT_BUFFER4 root irw -property CUT_BUFFER5 root irw -property CUT_BUFFER6 root irw -property CUT_BUFFER7 root irw - -XCOMM If you are using Motif, you probably want these. -property _MOTIF_DEFAULT_BINDINGS root ar iw -property _MOTIF_DRAG_WINDOW root ar iw -property _MOTIF_DRAG_TARGETS any ar iw -property _MOTIF_DRAG_ATOMS any ar iw -property _MOTIF_DRAG_ATOM_PAIRS any ar iw - -XCOMM The next two rules let xwininfo -tree work when untrusted. -property WM_NAME any ar - -XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME. -XCOMM This might be more restrictive than necessary, but demonstrates -XCOMM the <required property> facility, and is also an attempt to -XCOMM say "top level windows only." -property WM_CLASS WM_NAME ar - -XCOMM These next three let xlsclients work untrusted. Think carefully -XCOMM before including these; giving away the client machine name and command -XCOMM may be exposing too much. -property WM_STATE WM_NAME ar -property WM_CLIENT_MACHINE WM_NAME ar -property WM_COMMAND WM_NAME ar - -XCOMM To let untrusted clients use the standard colormaps created by -XCOMM xstdcmap, include these lines. -property RGB_DEFAULT_MAP root ar -property RGB_BEST_MAP root ar -property RGB_RED_MAP root ar -property RGB_GREEN_MAP root ar -property RGB_BLUE_MAP root ar -property RGB_GRAY_MAP root ar - -XCOMM To let untrusted clients use the color management database created -XCOMM by xcmsdb, include these lines. -property XDCCC_LINEAR_RGB_CORRECTION root ar -property XDCCC_LINEAR_RGB_MATRICES root ar -property XDCCC_GRAY_SCREENWHITEPOINT root ar -property XDCCC_GRAY_CORRECTION root ar - -XCOMM To let untrusted clients use the overlay visuals that many vendors -XCOMM support, include this line. -property SERVER_OVERLAY_VISUALS root ar - -XCOMM Dumb examples to show other capabilities. - -XCOMM oddball property names and explicit specification of error conditions -property "property with spaces" 'property with "' aw er ed - -XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value -XCOMM ending in "son". Reads and writes will cause an error. -property Woo-Hoo OhBoy = "*son" ad - -.fi -.SH FILES -.TP 30 -.I __projectroot__/lib/xserver/SecurityPolicy -Default X server security policy -.SH "SEE ALSO" -.PP -\fIXserver\fp(__appmansuffix__), -.I "Security Extension Specification" diff --git a/doc/Xserver.man.pre b/doc/Xserver.man.pre index c9ee019c6..c47a3966b 100644 --- a/doc/Xserver.man.pre +++ b/doc/Xserver.man.pre @@ -407,15 +407,6 @@ elapse between autorepeat-generated keystrokes). .TP 8 .B \-xkbmap \fIfilename\fP loads keyboard description in \fIfilename\fP on server startup. -.SH SECURITY EXTENSION OPTIONS -X servers that support the SECURITY extension accept the following option: -.TP 8 -.B \-sp \fIfilename\fP -causes the server to attempt to read and interpret filename as a security -policy file with the format described below. The file is read at server -startup and reread at each server reset. -The syntax of the security policy file is described in -\fISecurityPolicy\fP(__filemansuffix__). .SH "NETWORK CONNECTIONS" The X server supports client connections via a platform-dependent subset of the following transport types: TCP\/IP, Unix Domain sockets, DECnet, @@ -580,9 +571,6 @@ Error log file for display number \fBn\fP if run from \fIinit\fP(__adminmansuffi .TP 30 .I __projectroot__/lib/X11/xdm/xdm-errors Default error log file if the server is run from \fIxdm\fP(1) -.TP 30 -.I __projectroot__/lib/xserver/SecurityPolicy -Default X server security policy .SH "SEE ALSO" General information: \fIX\fP(__miscmansuffix__) .PP @@ -597,7 +585,6 @@ Fonts: \fIbdftopcf\fP(1), \fImkfontdir\fP(1), \fImkfontscale\fP(1), .PP Security: \fIXsecurity\fP(__miscmansuffix__), \fIxauth\fP(1), \fIXau\fP(1), \fIxdm\fP(1), \fIxhost\fP(1), \fIxfwp\fP(1), -\fISecurityPolicy\fP(__filemansuffix__), .I "Security Extension Specification" .PP Starting the server: \fIxdm\fP(1), \fIxinit\fP(1) @@ -40,9 +40,8 @@ #include "exa.h" #include "cw.h" -static int exaGeneration; -int exaScreenPrivateIndex; -int exaPixmapPrivateIndex; +DevPrivateKey exaScreenPrivateKey = &exaScreenPrivateKey; +DevPrivateKey exaPixmapPrivateKey = &exaPixmapPrivateKey; static _X_INLINE void* ExaGetPixmapAddress(PixmapPtr p) @@ -813,12 +812,6 @@ exaDriverInit (ScreenPtr pScreen, #ifdef RENDER ps = GetPictureScreenIfSet(pScreen); #endif - if (exaGeneration != serverGeneration) - { - exaScreenPrivateIndex = AllocateScreenPrivateIndex(); - exaPixmapPrivateIndex = AllocatePixmapPrivateIndex(); - exaGeneration = serverGeneration; - } pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1); @@ -830,7 +823,7 @@ exaDriverInit (ScreenPtr pScreen, pExaScr->info = pScreenInfo; - pScreen->devPrivates[exaScreenPrivateIndex].ptr = (pointer) pExaScr; + dixSetPrivate(&pScreen->devPrivates, exaScreenPrivateKey, pExaScr); pExaScr->migration = ExaMigrationAlways; @@ -885,8 +878,7 @@ exaDriverInit (ScreenPtr pScreen, */ if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) { - if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, - sizeof (ExaPixmapPrivRec))) { + if (!dixRequestPrivate(exaPixmapPrivateKey, sizeof(ExaPixmapPrivRec))) { LogMessage(X_WARNING, "EXA(%d): Failed to allocate pixmap private\n", pScreen->myNum); @@ -911,11 +903,7 @@ exaDriverInit (ScreenPtr pScreen, } } else - { LogMessage(X_INFO, "EXA(%d): No offscreen pixmaps\n", pScreen->myNum); - if (!AllocatePixmapPrivate(pScreen, exaPixmapPrivateIndex, 0)) - return FALSE; - } if (!pExaScr->info->CreatePixmap) { DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase, @@ -790,6 +790,9 @@ exaMoveOutPixmap (PixmapPtr pPixmap); void * exaGetPixmapDriverPrivate(PixmapPtr p); +CARD32 +exaGetPixmapFirstPixel (PixmapPtr pPixmap); + /** * Returns TRUE if the given planemask covers all the significant bits in the * pixel values for pDrawable. diff --git a/exa/exa_accel.c b/exa/exa_accel.c index ae951ed9a..c2bfdee6b 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -739,6 +739,14 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg, prect[i].y = pSeg[i].y2; prect[i].height = pSeg[i].y1 - pSeg[i].y2 + 1; } + + /* don't paint last pixel */ + if (pGC->capStyle == CapNotLast) { + if (prect[i].width == 1) + prect[i].height--; + else + prect[i].width--; + } } pGC->ops->PolyFillRect(pDrawable, pGC, nseg, prect); xfree(prect); diff --git a/exa/exa_priv.h b/exa/exa_priv.h index 7656a0278..89f47184f 100644 --- a/exa/exa_priv.h +++ b/exa/exa_priv.h @@ -134,9 +134,9 @@ typedef struct { (PixmapWidthPaddingInfo[d].padRoundUp+1))) #endif -extern int exaScreenPrivateIndex; -extern int exaPixmapPrivateIndex; -#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)(s)->devPrivates[exaScreenPrivateIndex].ptr) +extern DevPrivateKey exaScreenPrivateKey; +extern DevPrivateKey exaPixmapPrivateKey; +#define ExaGetScreenPriv(s) ((ExaScreenPrivPtr)dixLookupPrivate(&(s)->devPrivates, exaScreenPrivateKey)) #define ExaScreenPriv(s) ExaScreenPrivPtr pExaScr = ExaGetScreenPriv(s) /** Align an offset to an arbitrary alignment */ @@ -152,8 +152,8 @@ extern int exaPixmapPrivateIndex; #define EXA_PIXMAP_SCORE_PINNED 1000 #define EXA_PIXMAP_SCORE_INIT 1001 -#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)(p)->devPrivates[exaPixmapPrivateIndex].ptr) -#define ExaSetPixmapPriv(p,a) ((p)->devPrivates[exaPixmapPrivateIndex].ptr = (pointer) (a)) +#define ExaGetPixmapPriv(p) ((ExaPixmapPrivPtr)dixLookupPrivate(&(p)->devPrivates, exaPixmapPrivateKey)) +#define ExaSetPixmapPriv(p,a) dixSetPrivate(&(p)->devPrivates, exaPixmapPrivateKey, a) #define ExaPixmapPriv(p) ExaPixmapPrivPtr pExaPixmap = ExaGetPixmapPriv(p) #define EXA_RANGE_PITCH (1 << 0) @@ -291,9 +291,6 @@ ExaCheckGetSpans (DrawablePtr pDrawable, int nspans, char *pdstStart); -CARD32 -exaGetPixmapFirstPixel (PixmapPtr pPixmap); - /* exa_accel.c */ static _X_INLINE Bool diff --git a/exa/exa_render.c b/exa/exa_render.c index a510e54f6..6df2a23c8 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -587,7 +587,6 @@ exaComposite(CARD8 op, int ret = -1; Bool saveSrcRepeat = pSrc->repeat; Bool saveMaskRepeat = pMask ? pMask->repeat : 0; - PixmapPtr pSrcPixmap = NULL; RegionRec region; /* We currently don't support acceleration of gradients, or other pictures @@ -624,7 +623,9 @@ exaComposite(CARD8 op, if (ret == 1) goto done; } - else if (pSrcPixmap && !pSrc->repeat && !pSrc->transform) + else if (pSrc->pDrawable != NULL && + !pSrc->repeat && + !pSrc->transform) { xDst += pDst->pDrawable->x; yDst += pDst->pDrawable->y; @@ -644,7 +645,9 @@ exaComposite(CARD8 op, REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); goto done; } - else if (pSrcPixmap && !pSrc->transform && + else if (pSrc->pDrawable != NULL && + pSrc->pDrawable->type == DRAWABLE_PIXMAP && + !pSrc->transform && pSrc->repeatType == RepeatNormal) { DDXPointRec srcOrg; @@ -671,10 +674,11 @@ exaComposite(CARD8 op, width, height)) goto done; - srcOrg.x = (xSrc - xDst) % pSrcPixmap->drawable.width; - srcOrg.y = (ySrc - yDst) % pSrcPixmap->drawable.height; + srcOrg.x = (xSrc - xDst) % pSrc->pDrawable->width; + srcOrg.y = (ySrc - yDst) % pSrc->pDrawable->height; - ret = exaFillRegionTiled(pDst->pDrawable, ®ion, pSrcPixmap, + ret = exaFillRegionTiled(pDst->pDrawable, ®ion, + (PixmapPtr)pSrc->pDrawable, &srcOrg, FB_ALLONES, GXcopy); REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); @@ -37,6 +37,7 @@ #include "miscstruct.h" #include "servermd.h" #include "windowstr.h" +#include "privates.h" #include "mi.h" #include "migc.h" #include "mibstore.h" @@ -598,13 +599,9 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); } \ } -/* XXX fb*PrivateIndex should be static, but it breaks the ABI */ - -extern int fbGCPrivateIndex; -extern int fbGetGCPrivateIndex(void); +extern DevPrivateKey fbGetGCPrivateKey(void); #ifndef FB_NO_WINDOW_PIXMAPS -extern int fbWinPrivateIndex; -extern int fbGetWinPrivateIndex(void); +extern DevPrivateKey fbGetWinPrivateKey(void); #endif extern const GCOps fbGCOps; extern const GCFuncs fbGCFuncs; @@ -640,8 +637,7 @@ typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw); #ifdef FB_SCREEN_PRIVATE -extern int fbScreenPrivateIndex; -extern int fbGetScreenPrivateIndex(void); +extern DevPrivateKey fbGetScreenPrivateKey(void); /* private field of a screen */ typedef struct { @@ -654,7 +650,7 @@ typedef struct { } FbScreenPrivRec, *FbScreenPrivPtr; #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \ - (pScreen)->devPrivates[fbGetScreenPrivateIndex()].ptr) + dixLookupPrivate(&(pScreen)->devPrivates, fbGetScreenPrivateKey())) #endif /* private field of GC */ @@ -669,7 +665,7 @@ typedef struct { } FbGCPrivRec, *FbGCPrivPtr; #define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\ - (pGC)->devPrivates[fbGetGCPrivateIndex()].ptr) + dixLookupPrivate(&(pGC)->devPrivates, fbGetGCPrivateKey())) #define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip) #define fbGetExpose(pGC) ((pGC)->fExpose) @@ -681,7 +677,7 @@ typedef struct { #define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen) #else #define fbGetWindowPixmap(pWin) ((PixmapPtr)\ - ((WindowPtr) (pWin))->devPrivates[fbGetWinPrivateIndex()].ptr) + dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey())) #endif #ifdef ROOTLESS @@ -834,7 +830,7 @@ fb24_32ModifyPixmapHeader (PixmapPtr pPixmap, * fballpriv.c */ Bool -fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex); +fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCIndex); /* * fbarc.c @@ -2091,11 +2087,6 @@ fbFillRegionSolid (DrawablePtr pDrawable, FbBits and, FbBits xor); -void -fbFillRegionTiled (DrawablePtr pDrawable, - RegionPtr pRegion, - PixmapPtr pTile); - pixman_image_t *image_from_pict (PicturePtr pict, Bool has_clip); void free_pixman_pict (PicturePtr, pixman_image_t *); diff --git a/fb/fballpriv.c b/fb/fballpriv.c index 8efb8fa99..68cb2e4c0 100644 --- a/fb/fballpriv.c +++ b/fb/fballpriv.c @@ -27,51 +27,33 @@ #include "fb.h" #ifdef FB_SCREEN_PRIVATE -int fbScreenPrivateIndex; -int fbGetScreenPrivateIndex(void) +static DevPrivateKey fbScreenPrivateKey = &fbScreenPrivateKey; +DevPrivateKey fbGetScreenPrivateKey(void) { - return fbScreenPrivateIndex; + return fbScreenPrivateKey; } #endif -int fbGCPrivateIndex; -int fbGetGCPrivateIndex(void) +static DevPrivateKey fbGCPrivateKey = &fbGCPrivateKey; +DevPrivateKey fbGetGCPrivateKey(void) { - return fbGCPrivateIndex; + return fbGCPrivateKey; } #ifndef FB_NO_WINDOW_PIXMAPS -int fbWinPrivateIndex; -int fbGetWinPrivateIndex(void) +static DevPrivateKey fbWinPrivateKey = &fbWinPrivateKey; +DevPrivateKey fbGetWinPrivateKey(void) { - return fbWinPrivateIndex; + return fbWinPrivateKey; } #endif -int fbGeneration; Bool -fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex) +fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey) { - if (fbGeneration != serverGeneration) - { - fbGCPrivateIndex = miAllocateGCPrivateIndex (); -#ifndef FB_NO_WINDOW_PIXMAPS - fbWinPrivateIndex = AllocateWindowPrivateIndex(); -#endif -#ifdef FB_SCREEN_PRIVATE - fbScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (fbScreenPrivateIndex == -1) - return FALSE; -#endif - - fbGeneration = serverGeneration; - } - if (pGCIndex) - *pGCIndex = fbGCPrivateIndex; - if (!AllocateGCPrivate(pScreen, fbGCPrivateIndex, sizeof(FbGCPrivRec))) + if (pGCKey) + *pGCKey = fbGCPrivateKey; + + if (!dixRequestPrivate(fbGCPrivateKey, sizeof(FbGCPrivRec))) return FALSE; -#ifndef FB_NO_WINDOW_PIXMAPS - if (!AllocateWindowPrivate(pScreen, fbWinPrivateIndex, 0)) - return FALSE; -#endif #ifdef FB_SCREEN_PRIVATE { FbScreenPrivPtr pScreenPriv; @@ -79,7 +61,7 @@ fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex) pScreenPriv = (FbScreenPrivPtr) xalloc (sizeof (FbScreenPrivRec)); if (!pScreenPriv) return FALSE; - pScreen->devPrivates[fbScreenPrivateIndex].ptr = (pointer) pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, fbScreenPrivateKey, pScreenPriv); } #endif return TRUE; diff --git a/fb/fboverlay.c b/fb/fboverlay.c index 456c921a6..f9f7c52a3 100644 --- a/fb/fboverlay.c +++ b/fb/fboverlay.c @@ -33,12 +33,11 @@ #include "fboverlay.h" #include "shmint.h" -int fbOverlayGeneration; -int fbOverlayScreenPrivateIndex = -1; +static DevPrivateKey fbOverlayScreenPrivateKey = &fbOverlayScreenPrivateKey; -int fbOverlayGetScreenPrivateIndex(void) +DevPrivateKey fbOverlayGetScreenPrivateKey(void) { - return fbOverlayScreenPrivateIndex; + return fbOverlayScreenPrivateKey; } /* @@ -65,7 +64,7 @@ fbOverlayCreateWindow(WindowPtr pWin) pPixmap = pScrPriv->layer[i].u.run.pixmap; if (pWin->drawable.depth == pPixmap->drawable.depth) { - pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap; + dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap); /* * Make sure layer keys are written correctly by * having non-root layers set to full while the @@ -108,7 +107,7 @@ fbOverlayWindowLayer(WindowPtr pWin) int i; for (i = 0; i < pScrPriv->nlayers; i++) - if (pWin->devPrivates[fbWinPrivateIndex].ptr == + if (dixLookupPrivate(&pWin->devPrivates, fbGetWinPrivateKey()) == (pointer) pScrPriv->layer[i].u.run.pixmap) return i; return 0; @@ -348,12 +347,6 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen, VisualID defaultVisual; FbOverlayScrPrivPtr pScrPriv; - if (fbOverlayGeneration != serverGeneration) - { - fbOverlayScreenPrivateIndex = AllocateScreenPrivateIndex (); - fbOverlayGeneration = serverGeneration; - } - pScrPriv = xalloc (sizeof (FbOverlayScrPrivRec)); if (!pScrPriv) return FALSE; @@ -423,7 +416,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen, pScrPriv->layer[1].u.init.width = width2; pScrPriv->layer[1].u.init.depth = depth2; - pScreen->devPrivates[fbOverlayScreenPrivateIndex].ptr = (pointer) pScrPriv; + dixSetPrivate(&pScreen->devPrivates, fbOverlayScreenPrivateKey, pScrPriv); /* overwrite miCloseScreen with our own */ pScreen->CloseScreen = fbOverlayCloseScreen; diff --git a/fb/fboverlay.h b/fb/fboverlay.h index 55135ea4e..f3db0bb7d 100644 --- a/fb/fboverlay.h +++ b/fb/fboverlay.h @@ -25,9 +25,9 @@ #ifndef _FBOVERLAY_H_ #define _FBOVERLAY_H_ -extern int fbOverlayGeneration; -extern int fbOverlayScreenPrivateIndex; /* XXX should be static */ -extern int fbOverlayGetScreenPrivateIndex(void); +#include "privates.h" + +extern DevPrivateKey fbOverlayGetScreenPrivateKey(void); #ifndef FB_OVERLAY_MAX #define FB_OVERLAY_MAX 2 @@ -58,8 +58,7 @@ typedef struct _fbOverlayScrPriv { } FbOverlayScrPrivRec, *FbOverlayScrPrivPtr; #define fbOverlayGetScrPriv(s) \ - ((fbOverlayGetScreenPrivateIndex() != -1) ? \ - (s)->devPrivates[fbOverlayGetScreenPrivateIndex()].ptr : NULL) + dixLookupPrivate(&(s)->devPrivates, fbOverlayGetScreenPrivateKey()) Bool fbOverlayCreateWindow(WindowPtr pWin); diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c index b9c93ea96..311da9e62 100644 --- a/fb/fbpixmap.c +++ b/fb/fbpixmap.c @@ -100,6 +100,7 @@ fbDestroyPixmap (PixmapPtr pPixmap) { if(--pPixmap->refcnt) return TRUE; + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/fb/fbpseudocolor.c b/fb/fbpseudocolor.c index 8a48c3819..06cf15992 100644 --- a/fb/fbpseudocolor.c +++ b/fb/fbpseudocolor.c @@ -123,13 +123,11 @@ typedef struct { } xxScrPrivRec, *xxScrPrivPtr; #define xxGetScrPriv(s) ((xxScrPrivPtr) \ - (xxScrPrivateIndex != -1) \ - ? (s)->devPrivates[xxScrPrivateIndex].ptr\ - : NULL) + dixLookupPrivate(&(s)->devPrivates, xxScrPrivateKey)) #define xxScrPriv(s) xxScrPrivPtr pScrPriv = xxGetScrPriv(s) #define xxGetCmapPriv(s) ((xxCmapPrivPtr) \ - (s)->devPrivates[xxColormapPrivateIndex].ptr) + dixLookupPrivate(&(s)->devPrivates, xxColormapPrivateKey)) #define xxCmapPriv(s) xxCmapPrivPtr pCmapPriv = xxGetCmapPriv(s); typedef struct _xxGCPriv { @@ -138,13 +136,12 @@ typedef struct _xxGCPriv { } xxGCPrivRec, *xxGCPrivPtr; #define xxGetGCPriv(pGC) ((xxGCPrivPtr) \ - (pGC)->devPrivates[xxGCPrivateIndex].ptr) + dixLookupPrivate(&(pGC)->devPrivates, xxGCPrivateKey)) #define xxGCPriv(pGC) xxGCPrivPtr pGCPriv = xxGetGCPriv(pGC) -int xxScrPrivateIndex = -1; -int xxGCPrivateIndex; -int xxColormapPrivateIndex = -1; -int xxGeneration; +static DevPrivateKey xxScrPrivateKey = &xxScrPrivateKey; +static DevPrivateKey xxGCPrivateKey = &xxGCPrivateKey; +static DevPrivateKey xxColormapPrivateKey = &xxColormapPrivateKey; #define wrap(priv,real,mem,func) {\ @@ -354,26 +351,20 @@ xxMyVisual(ScreenPtr pScreen, VisualID vid) } static Bool -xxInitColormapDummy(ColormapPtr pmap, int index) -{ - return TRUE; -} - -static Bool xxInitColormapPrivate(ColormapPtr pmap) { xxScrPriv(pmap->pScreen); xxCmapPrivPtr pCmapPriv; pointer cmap; - pmap->devPrivates[xxColormapPrivateIndex].ptr = (pointer) -1; + dixSetPrivate(&pmap->devPrivates, xxColormapPrivateKey, (pointer) -1); if (xxMyVisual(pmap->pScreen,pmap->pVisual->vid)) { DBG("CreateColormap\n"); pCmapPriv = (xxCmapPrivPtr) xalloc (sizeof (xxCmapPrivRec)); if (!pCmapPriv) return FALSE; - pmap->devPrivates[xxColormapPrivateIndex].ptr = (pointer) pCmapPriv; + dixSetPrivate(&pmap->devPrivates, xxColormapPrivateKey, pCmapPriv); cmap = xalloc(sizeof (CARD32) * (1 << pScrPriv->myDepth)); if (!cmap) return FALSE; @@ -675,7 +666,7 @@ xxCreateWindow(WindowPtr pWin) DBG("CreateWindow\n"); - pWin->devPrivates[fbWinPrivateIndex].ptr = (pointer) pScrPriv->pPixmap; + dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pScrPriv->pPixmap); PRINT_RECTS(pScrPriv->region); if (!pWin->parent) { REGION_EMPTY (pWin->drawable.pScreen, &pScrPriv->region); @@ -744,9 +735,10 @@ xxCopyWindow(WindowPtr pWin, xxPickMyWindows(pWin,&rgn); unwrap (pScrPriv, pScreen, CopyWindow); - pWin->devPrivates[fbWinPrivateIndex].ptr = fbGetScreenPixmap(pScreen); + dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), + fbGetScreenPixmap(pScreen)); pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc); - pWin->devPrivates[fbWinPrivateIndex].ptr = pPixmap; + dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), pPixmap); wrap(pScrPriv, pScreen, CopyWindow, xxCopyWindow); REGION_INTERSECT(pScreen,&rgn,&rgn,&rgn_new); @@ -1032,21 +1024,7 @@ xxSetup(ScreenPtr pScreen, int myDepth, int baseDepth, char* addr, xxSyncFunc sy PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif - if (xxGeneration != serverGeneration) { - xxScrPrivateIndex = AllocateScreenPrivateIndex (); - if (xxScrPrivateIndex == -1) - return FALSE; - xxColormapPrivateIndex - = AllocateColormapPrivateIndex (xxInitColormapDummy); - if (xxColormapPrivateIndex == -1) - return FALSE; - xxGCPrivateIndex = AllocateGCPrivateIndex (); - if (xxGCPrivateIndex == -1) - return FALSE; - xxGeneration = serverGeneration; - } - - if (!AllocateGCPrivate (pScreen, xxGCPrivateIndex, sizeof (xxGCPrivRec))) + if (!dixRequestPrivate(xxGCPrivateKey, sizeof (xxGCPrivRec))) return FALSE; pScrPriv = (xxScrPrivPtr) xalloc (sizeof (xxScrPrivRec)); @@ -1122,7 +1100,7 @@ xxSetup(ScreenPtr pScreen, int myDepth, int baseDepth, char* addr, xxSyncFunc sy } #endif pScrPriv->addr = addr; - pScreen->devPrivates[xxScrPrivateIndex].ptr = (pointer) pScrPriv; + dixSetPrivate(&pScreen->devPrivates, xxScrPrivateKey, pScrPriv); pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); if (!xxInitColormapPrivate(pDefMap)) diff --git a/fb/fbscreen.c b/fb/fbscreen.c index 41bef4739..12b19e419 100644 --- a/fb/fbscreen.c +++ b/fb/fbscreen.c @@ -38,7 +38,7 @@ fbCloseScreen (int index, ScreenPtr pScreen) xfree (pScreen->visuals); xfree (pScreen->devPrivate); #ifdef FB_SCREEN_PRIVATE - xfree (pScreen->devPrivates[fbScreenPrivateIndex].ptr); + xfree (dixLookupPrivate(&pScreen->devPrivates, fbGetScreenPrivateKey())); #endif return TRUE; } @@ -93,7 +93,7 @@ _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap) #ifdef FB_NO_WINDOW_PIXMAPS FatalError ("Attempted to set window pixmap without fb support\n"); #else - pWindow->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap; + dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(), pPixmap); #endif } @@ -107,7 +107,7 @@ fbSetupScreen(ScreenPtr pScreen, int width, /* pixel width of frame buffer */ int bpp) /* bits per pixel for screen */ { - if (!fbAllocatePrivates(pScreen, (int *) 0)) + if (!fbAllocatePrivates(pScreen, NULL)) return FALSE; pScreen->defColormap = FakeClientID(0); /* let CreateDefColormap do whatever it wants for pixels */ diff --git a/fb/fbwindow.c b/fb/fbwindow.c index 602b7e0dc..f6fe8aa83 100644 --- a/fb/fbwindow.c +++ b/fb/fbwindow.c @@ -32,8 +32,8 @@ Bool fbCreateWindow(WindowPtr pWin) { #ifndef FB_NO_WINDOW_PIXMAPS - pWin->devPrivates[fbWinPrivateIndex].ptr = - (pointer) fbGetScreenPixmap(pWin->drawable.pScreen); + dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(), + fbGetScreenPixmap(pWin->drawable.pScreen)); #endif #ifdef FB_SCREEN_PRIVATE if (pWin->drawable.bitsPerPixel == 32) @@ -250,68 +250,3 @@ fbFillRegionSolid (DrawablePtr pDrawable, fbFinishAccess (pDrawable); } - -#ifdef PANORAMIX -#include "panoramiX.h" -#include "panoramiXsrv.h" -#endif - -void -fbFillRegionTiled (DrawablePtr pDrawable, - RegionPtr pRegion, - PixmapPtr pTile) -{ - FbBits *dst; - FbStride dstStride; - int dstBpp; - int dstXoff, dstYoff; - FbBits *tile; - FbStride tileStride; - int tileBpp; - int tileXoff, tileYoff; /* XXX assumed to be zero */ - int tileWidth, tileHeight; - int n = REGION_NUM_RECTS(pRegion); - BoxPtr pbox = REGION_RECTS(pRegion); - int xRot = pDrawable->x; - int yRot = pDrawable->y; - -#ifdef PANORAMIX - if(!noPanoramiXExtension) - { - int index = pDrawable->pScreen->myNum; - if(&WindowTable[index]->drawable == pDrawable) - { - xRot -= panoramiXdataPtr[index].x; - yRot -= panoramiXdataPtr[index].y; - } - } -#endif - fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); - fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); - tileWidth = pTile->drawable.width; - tileHeight = pTile->drawable.height; - xRot += dstXoff; - yRot += dstYoff; - - while (n--) - { - fbTile (dst + (pbox->y1 + dstYoff) * dstStride, - dstStride, - (pbox->x1 + dstXoff) * dstBpp, - (pbox->x2 - pbox->x1) * dstBpp, - pbox->y2 - pbox->y1, - tile, - tileStride, - tileWidth * dstBpp, - tileHeight, - GXcopy, - FB_ALLONES, - dstBpp, - xRot * dstBpp, - yRot - (pbox->y1 + dstYoff)); - pbox++; - } - - fbFinishAccess (&pTile->drawable); - fbFinishAccess (pDrawable); -} diff --git a/fb/wfbrename.h b/fb/wfbrename.h index 93ce41baf..dc0528559 100644 --- a/fb/wfbrename.h +++ b/fb/wfbrename.h @@ -79,19 +79,18 @@ #define fbExpandDirectColors wfbExpandDirectColors #define fbFill wfbFill #define fbFillRegionSolid wfbFillRegionSolid -#define fbFillRegionTiled wfbFillRegionTiled #define fbFillSpans wfbFillSpans #define fbFixCoordModePrevious wfbFixCoordModePrevious #define fbGCFuncs wfbGCFuncs #define fbGCOps wfbGCOps -#define fbGCPrivateIndex wfbGCPrivateIndex +#define fbGCPrivateKey wfbGCPrivateKey #define fbGeneration wfbGeneration -#define fbGetGCPrivateIndex wfbGetGCPrivateIndex +#define fbGetGCPrivateKey wfbGetGCPrivateKey #define fbGetImage wfbGetImage -#define fbGetScreenPrivateIndex wfbGetScreenPrivateIndex +#define fbGetScreenPrivateKey wfbGetScreenPrivateKey #define fbGetSpans wfbGetSpans #define _fbGetWindowPixmap _wfbGetWindowPixmap -#define fbGetWinPrivateIndex wfbGetWinPrivateIndex +#define fbGetWinPrivateKey wfbGetWinPrivateKey #define fbGlyph16 wfbGlyph16 #define fbGlyph24 wfbGlyph24 #define fbGlyph32 wfbGlyph32 @@ -117,9 +116,9 @@ #define fbOverlayCreateWindow wfbOverlayCreateWindow #define fbOverlayFinishScreenInit wfbOverlayFinishScreenInit #define fbOverlayGeneration wfbOverlayGeneration -#define fbOverlayGetScreenPrivateIndex wfbOverlayGetScreenPrivateIndex +#define fbOverlayGetScreenPrivateKey wfbOverlayGetScreenPrivateKey #define fbOverlayPaintKey wfbOverlayPaintKey -#define fbOverlayScreenPrivateIndex wfbOverlayScreenPrivateIndex +#define fbOverlayScreenPrivateKey wfbOverlayScreenPrivateKey #define fbOverlaySetupScreen wfbOverlaySetupScreen #define fbOverlayUpdateLayerRegion wfbOverlayUpdateLayerRegion #define fbOverlayWindowExposures wfbOverlayWindowExposures @@ -158,7 +157,7 @@ #define fbResolveColor wfbResolveColor #define fbRestoreAreas wfbRestoreAreas #define fbSaveAreas wfbSaveAreas -#define fbScreenPrivateIndex wfbScreenPrivateIndex +#define fbScreenPrivateKey wfbScreenPrivateKey #define fbSegment wfbSegment #define fbSelectBres wfbSelectBres #define fbSetSpans wfbSetSpans @@ -183,14 +182,14 @@ #define fbUnrealizeFont wfbUnrealizeFont #define fbValidateGC wfbValidateGC #define fbWalkCompositeRegion wfbWalkCompositeRegion -#define fbWinPrivateIndex wfbWinPrivateIndex +#define fbWinPrivateKey wfbWinPrivateKey #define fbZeroLine wfbZeroLine #define fbZeroSegment wfbZeroSegment #define free_pixman_pict wfb_free_pixman_pict #define image_from_pict wfb_image_from_pict -#define xxScrPrivateIndex wfbxxScrPrivateIndex -#define xxGCPrivateIndex wfbxxGCPrivateIndex -#define xxColormapPrivateIndex wfbxxColormapPrivateIndex +#define xxScrPrivateKey wfbxxScrPrivateKey +#define xxGCPrivateKey wfbxxGCPrivateKey +#define xxColormapPrivateKey wfbxxColormapPrivateKey #define xxGeneration wfbxxGeneration #define xxPrintVisuals wfbxxPrintVisuals #define xxGCFuncs wfbxxGCFuncs diff --git a/hw/Makefile.am b/hw/Makefile.am index 0e65f7106..c2b9571b9 100644 --- a/hw/Makefile.am +++ b/hw/Makefile.am @@ -31,21 +31,21 @@ XPRINT_SUBDIRS = xprint endif if XQUARTZ -XQUARTZ_SUBDIRS = darwin +XQUARTZ_SUBDIRS = xquartz endif SUBDIRS = \ $(XORG_SUBDIRS) \ $(XGL_SUBDIRS) \ $(XWIN_SUBDIRS) \ - $(XQUARTZ_SUBDIRS) \ $(XVFB_SUBDIRS) \ $(XNEST_SUBDIRS) \ - $(DMX_SUBDIRS) \ + $(DMX_SUBDIRS) \ $(KDRIVE_SUBDIRS) \ + $(XQUARTZ_SUBDIRS) \ $(XPRINT_SUBDIRS) -DIST_SUBDIRS = dmx xfree86 vfb xnest xwin darwin kdrive xgl xprint +DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xgl xprint relink: for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink ; done diff --git a/hw/darwin/apple/English.lproj/main.nib/classes.nib b/hw/darwin/apple/English.lproj/main.nib/classes.nib deleted file mode 100644 index a82159bd5..000000000 --- a/hw/darwin/apple/English.lproj/main.nib/classes.nib +++ /dev/null @@ -1,318 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBClasses</key> - <array> - <dict> - <key>CLASS</key> - <string>IBLibraryObjectTemplate</string> - <key>LANGUAGE</key> - <string>ObjC</string> - <key>OUTLETS</key> - <dict> - <key>draggedView</key> - <string>NSView</string> - <key>representedObject</key> - <string>NSObject</string> - </dict> - <key>SUPERCLASS</key> - <string>NSView</string> - </dict> - <dict> - <key>CLASS</key> - <string>IBInspector</string> - <key>LANGUAGE</key> - <string>ObjC</string> - <key>OUTLETS</key> - <dict> - <key>inspectorView</key> - <string>NSView</string> - </dict> - <key>SUPERCLASS</key> - <string>NSObject</string> - </dict> - <dict> - <key>CLASS</key> - <string>NSDateFormatter</string> - <key>LANGUAGE</key> - <string>ObjC</string> - <key>SUPERCLASS</key> - <string>NSFormatter</string> - </dict> - <dict> - <key>ACTIONS</key> - <dict> - <key>apps_table_cancel</key> - <string>id</string> - <key>apps_table_delete</key> - <string>id</string> - <key>apps_table_done</key> - <string>id</string> - <key>apps_table_duplicate</key> - <string>id</string> - <key>apps_table_new</key> - <string>id</string> - <key>apps_table_show</key> - <string>id</string> - <key>bring_to_front</key> - <string>id</string> - <key>close_window</key> - <string>id</string> - <key>enable_fullscreen_changed</key> - <string>id</string> - <key>minimize_window</key> - <string>id</string> - <key>next_window</key> - <string>id</string> - <key>prefs_changed</key> - <string>id</string> - <key>prefs_show</key> - <string>id</string> - <key>previous_window</key> - <string>id</string> - <key>toggle_fullscreen</key> - <string>id</string> - <key>x11_help</key> - <string>id</string> - <key>zoom_window</key> - <string>id</string> - </dict> - <key>CLASS</key> - <string>X11Controller</string> - <key>LANGUAGE</key> - <string>ObjC</string> - <key>OUTLETS</key> - <dict> - <key>apps_separator</key> - <string>id</string> - <key>apps_table</key> - <string>id</string> - <key>depth</key> - <string>id</string> - <key>dock_apps_menu</key> - <string>id</string> - <key>dock_menu</key> - <string>id</string> - <key>dock_window_separator</key> - <string>id</string> - <key>enable_auth</key> - <string>id</string> - <key>enable_fullscreen</key> - <string>id</string> - <key>enable_keyequivs</key> - <string>id</string> - <key>enable_tcp</key> - <string>id</string> - <key>fake_buttons</key> - <string>id</string> - <key>prefs_panel</key> - <string>id</string> - <key>sync_keymap</key> - <string>id</string> - <key>toggle_fullscreen_item</key> - <string>id</string> - <key>use_sysbeep</key> - <string>id</string> - <key>window_separator</key> - <string>id</string> - <key>x11_about_item</key> - <string>id</string> - </dict> - <key>SUPERCLASS</key> - <string>NSObject</string> - </dict> - <dict> - <key>CLASS</key> - <string>NSNumberFormatter</string> - <key>LANGUAGE</key> - <string>ObjC</string> - <key>SUPERCLASS</key> - <string>NSFormatter</string> - </dict> - <dict> - <key>CLASS</key> - <string>NSFormatter</string> - <key>LANGUAGE</key> - <string>ObjC</string> - <key>SUPERCLASS</key> - <string>NSObject</string> - </dict> - <dict> - <key>ACTIONS</key> - <dict> - <key>alignCenter:</key> - <string>id</string> - <key>alignJustified:</key> - <string>id</string> - <key>alignLeft:</key> - <string>id</string> - <key>alignRight:</key> - <string>id</string> - <key>arrangeInFront:</key> - <string>id</string> - <key>centerSelectionInVisibleArea:</key> - <string>id</string> - <key>changeFont:</key> - <string>id</string> - <key>checkSpelling:</key> - <string>id</string> - <key>clear:</key> - <string>id</string> - <key>clearRecentDocuments:</key> - <string>id</string> - <key>complete:</key> - <string>id</string> - <key>copy:</key> - <string>id</string> - <key>copyFont:</key> - <string>id</string> - <key>copyRuler:</key> - <string>id</string> - <key>cut:</key> - <string>id</string> - <key>delete:</key> - <string>id</string> - <key>deminiaturize:</key> - <string>id</string> - <key>fax:</key> - <string>id</string> - <key>hide:</key> - <string>id</string> - <key>hideOtherApplications:</key> - <string>id</string> - <key>loosenKerning:</key> - <string>id</string> - <key>lowerBaseline:</key> - <string>id</string> - <key>makeKeyAndOrderFront:</key> - <string>id</string> - <key>miniaturize:</key> - <string>id</string> - <key>newDocument:</key> - <string>id</string> - <key>openDocument:</key> - <string>id</string> - <key>orderBack:</key> - <string>id</string> - <key>orderFront:</key> - <string>id</string> - <key>orderFrontColorPanel:</key> - <string>id</string> - <key>orderFrontHelpPanel:</key> - <string>id</string> - <key>orderOut:</key> - <string>id</string> - <key>outline:</key> - <string>id</string> - <key>paste:</key> - <string>id</string> - <key>pasteAsPlainText:</key> - <string>id</string> - <key>pasteAsRichText:</key> - <string>id</string> - <key>pasteFont:</key> - <string>id</string> - <key>pasteRuler:</key> - <string>id</string> - <key>pause:</key> - <string>id</string> - <key>performClose:</key> - <string>id</string> - <key>performFindPanelAction:</key> - <string>id</string> - <key>performMiniaturize:</key> - <string>id</string> - <key>performZoom:</key> - <string>id</string> - <key>play:</key> - <string>id</string> - <key>print:</key> - <string>id</string> - <key>printDocument:</key> - <string>id</string> - <key>raiseBaseline:</key> - <string>id</string> - <key>record:</key> - <string>id</string> - <key>redo:</key> - <string>id</string> - <key>resume:</key> - <string>id</string> - <key>revertDocumentToSaved:</key> - <string>id</string> - <key>run:</key> - <string>id</string> - <key>runPageLayout:</key> - <string>id</string> - <key>runToolbarCustomizationPalette:</key> - <string>id</string> - <key>saveAllDocuments:</key> - <string>id</string> - <key>saveDocument:</key> - <string>id</string> - <key>saveDocumentAs:</key> - <string>id</string> - <key>saveDocumentTo:</key> - <string>id</string> - <key>selectAll:</key> - <string>id</string> - <key>selectText:</key> - <string>id</string> - <key>showGuessPanel:</key> - <string>id</string> - <key>showHelp:</key> - <string>id</string> - <key>start:</key> - <string>id</string> - <key>startSpeaking:</key> - <string>id</string> - <key>stop:</key> - <string>id</string> - <key>stopSpeaking:</key> - <string>id</string> - <key>subscript:</key> - <string>id</string> - <key>superscript:</key> - <string>id</string> - <key>terminate:</key> - <string>id</string> - <key>tightenKerning:</key> - <string>id</string> - <key>toggleContinuousSpellChecking:</key> - <string>id</string> - <key>toggleRuler:</key> - <string>id</string> - <key>toggleToolbarShown:</key> - <string>id</string> - <key>turnOffKerning:</key> - <string>id</string> - <key>turnOffLigatures:</key> - <string>id</string> - <key>underline:</key> - <string>id</string> - <key>undo:</key> - <string>id</string> - <key>unhideAllApplications:</key> - <string>id</string> - <key>unscript:</key> - <string>id</string> - <key>useAllLigatures:</key> - <string>id</string> - <key>useStandardKerning:</key> - <string>id</string> - <key>useStandardLigatures:</key> - <string>id</string> - </dict> - <key>CLASS</key> - <string>FirstResponder</string> - <key>LANGUAGE</key> - <string>ObjC</string> - <key>SUPERCLASS</key> - <string>NSObject</string> - </dict> - </array> - <key>IBVersion</key> - <integer>1</integer> -</dict> -</plist> diff --git a/hw/darwin/apple/English.lproj/main.nib/info.nib b/hw/darwin/apple/English.lproj/main.nib/info.nib deleted file mode 100644 index 88bc6260d..000000000 --- a/hw/darwin/apple/English.lproj/main.nib/info.nib +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IBFramework Version</key> - <string>588</string> - <key>IBOpenObjects</key> - <array> - <integer>244</integer> - <integer>29</integer> - <integer>423</integer> - </array> - <key>IBSystem Version</key> - <string>9A356</string> - <key>targetFramework</key> - <string>IBCocoaFramework</string> -</dict> -</plist> diff --git a/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib b/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib Binary files differdeleted file mode 100644 index 8b31450ff..000000000 --- a/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib +++ /dev/null diff --git a/hw/darwin/apple/Makefile.am b/hw/darwin/apple/Makefile.am deleted file mode 100644 index 02a2c25b1..000000000 --- a/hw/darwin/apple/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -bin_SCRIPTS = x11app - -.PHONY: x11app - -x11app: - xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)" - -install-data-hook: - xcodebuild install DSTROOT=$(DESTDIR) INSTALL_PATH=$(prefix) DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)" - -clean-local: - rm -rf build - -EXTRA_DIST = \ - Info.plist \ - X11.icns \ - bundle-main.c \ - English.lproj/InfoPlist.strings \ - English.lproj/Localizable.strings \ - English.lproj/main.nib/classes.nib \ - English.lproj/main.nib/info.nib \ - English.lproj/main.nib/keyedobjects.nib \ - X11.xcodeproj/project.pbxproj diff --git a/hw/darwin/apple/bundle-main.c b/hw/darwin/apple/bundle-main.c deleted file mode 100644 index 10d2f2041..000000000 --- a/hw/darwin/apple/bundle-main.c +++ /dev/null @@ -1,904 +0,0 @@ -/* bundle-main.c -- X server launcher - - Copyright (c) 2002-2007 Apple 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 and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. - - Parts of this file are derived from xdm, which has this copyright: - - Copyright 1988, 1998 The Open Group - - Permission to use, copy, modify, distribute, and sell this software - and its documentation for any purpose is hereby granted without fee, - provided that the above copyright notice appear in all copies and - that both that copyright notice and this permission notice appear in - supporting documentation. - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - Except as contained in this notice, the name of The Open Group shall - not be used in advertising or otherwise to promote the sale, use or - other dealings in this Software without prior written authorization - from The Open Group. */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/socket.h> -#include <sys/utsname.h> -#include <ifaddrs.h> -#include <netdb.h> -#include <netinet/in.h> -#include <time.h> -#include <sys/wait.h> -#include <setjmp.h> -#include <sys/ioctl.h> - -#include <X11/Xlib.h> -#include <X11/Xauth.h> -#include <xcb/xcb.h> - -#include <CoreFoundation/CoreFoundation.h> -#include <SystemConfiguration/SystemConfiguration.h> - -#define X_SERVER "/usr/X11/bin/Xquartz" -#define XTERM_PATH "/usr/X11/bin/xterm" -#define WM_PATH "/usr/bin/quartz-wm" -#define DEFAULT_XINITRC "/usr/X11/lib/X11/xinit/xinitrc" -#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin" - -/* what xinit does */ -#ifndef SHELL -# define SHELL "sh" -#endif - -#undef FALSE -#define FALSE 0 -#undef TRUE -#define TRUE 1 - -#define MAX_DISPLAYS 64 - -static int server_pid = -1, client_pid = -1; -static int xinit_kills_server = FALSE; -static jmp_buf exit_continuation; -static const char *server_name = NULL; -static Display *server_dpy; - -static char *auth_file; - -typedef struct addr_list_struct addr_list; - -struct addr_list_struct { - addr_list *next; - Xauth auth; -}; - -static addr_list *addresses; - - -/* Utility functions. */ - -/* Return the current host name. Matches what Xlib does. */ -static char * -host_name (void) -{ -#ifdef NEED_UTSNAME - static struct utsname name; - - uname(&name); - - return name.nodename; -#else - static char buf[100]; - - gethostname(buf, sizeof(buf)); - - return buf; -#endif -} - -static int -read_boolean_pref (CFStringRef name, int default_) -{ - int value; - Boolean ok; - - value = CFPreferencesGetAppBooleanValue (name, - CFSTR ("com.apple.x11"), &ok); - return ok ? value : default_; -} - -static inline int -binary_equal (const void *a, const void *b, int length) -{ - return memcmp (a, b, length) == 0; -} - -static inline void * -binary_dup (const void *a, int length) -{ - void *b = malloc (length); - if (b != NULL) - memcpy (b, a, length); - return b; -} - -static inline void -binary_free (void *data, int length) -{ - if (data != NULL) - free (data); -} - - -/* Functions for managing the authentication entries. */ - -/* Returns true if something matching AUTH is in our list of auth items */ -static int -check_auth_item (Xauth *auth) -{ - addr_list *a; - - for (a = addresses; a != NULL; a = a->next) - { - if (a->auth.family == auth->family - && a->auth.address_length == auth->address_length - && binary_equal (a->auth.address, auth->address, auth->address_length) - && a->auth.number_length == auth->number_length - && binary_equal (a->auth.number, auth->number, auth->number_length) - && a->auth.name_length == auth->name_length - && binary_equal (a->auth.name, auth->name, auth->name_length)) - { - return TRUE; - } - } - - return FALSE; -} - -/* Add one item to our list of auth items. */ -static void -add_auth_item (Xauth *auth) -{ - addr_list *a = malloc (sizeof (addr_list)); - - a->auth.family = auth->family; - a->auth.address_length = auth->address_length; - a->auth.address = binary_dup (auth->address, auth->address_length); - a->auth.number_length = auth->number_length; - a->auth.number = binary_dup (auth->number, auth->number_length); - a->auth.name_length = auth->name_length; - a->auth.name = binary_dup (auth->name, auth->name_length); - a->auth.data_length = auth->data_length; - a->auth.data = binary_dup (auth->data, auth->data_length); - - a->next = addresses; - addresses = a; -} - -/* Free all allocated auth items. */ -static void -free_auth_items (void) -{ - addr_list *a; - - while ((a = addresses) != NULL) - { - addresses = a->next; - - binary_free (a->auth.address, a->auth.address_length); - binary_free (a->auth.number, a->auth.number_length); - binary_free (a->auth.name, a->auth.name_length); - binary_free (a->auth.data, a->auth.data_length); - free (a); - } -} - -/* Add the unix domain auth item. */ -static void -define_local (Xauth *auth) -{ - char *host = host_name (); - -#ifdef DEBUG - fprintf (stderr, "x11: hostname is %s\n", host); -#endif - - auth->family = FamilyLocal; - auth->address_length = strlen (host); - auth->address = host; - - add_auth_item (auth); -} - -/* Add the tcp auth item. */ -static void -define_named (Xauth *auth, const char *name) -{ - struct ifaddrs *addrs, *ptr; - - if (getifaddrs (&addrs) != 0) - return; - - for (ptr = addrs; ptr != NULL; ptr = ptr->ifa_next) - { - if (ptr->ifa_addr->sa_family != AF_INET) - continue; - - auth->family = FamilyInternet; - auth->address_length = sizeof (struct in_addr); - auth->address = (char *) &(((struct sockaddr_in *) ptr->ifa_addr)->sin_addr); - -#ifdef DEBUG - fprintf (stderr, "x11: ipaddr is %d.%d.%d.%d\n", - (unsigned char) auth->address[0], - (unsigned char) auth->address[1], - (unsigned char) auth->address[2], - (unsigned char) auth->address[3]); -#endif - - add_auth_item (auth); - } - - freeifaddrs (addrs); -} - -/* Parse the display number from NAME and add it to AUTH. */ -static void -set_auth_number (Xauth *auth, const char *name) -{ - char *colon; - char *dot, *number; - - colon = strrchr(name, ':'); - if (colon != NULL) - { - colon++; - dot = strchr(colon, '.'); - - if (dot != NULL) - auth->number_length = dot - colon; - else - auth->number_length = strlen (colon); - - number = malloc (auth->number_length + 1); - if (number != NULL) - { - strncpy (number, colon, auth->number_length); - number[auth->number_length] = '\0'; - } - else - { - auth->number_length = 0; - } - - auth->number = number; - } -} - -/* Put 128 bits of random data into DATA. If possible, it will be "high - quality" */ -static int -generate_mit_magic_cookie (char data[16]) -{ - int fd, ret, i; - long *ldata = (long *) data; - - fd = open ("/dev/random", O_RDONLY); - if (fd > 0) { - ret = read (fd, data, 16); - close (fd); - if (ret == 16) return TRUE; - } - - /* fall back to the usual crappy rng */ - - srand48 (getpid () ^ time (NULL)); - - for (i = 0; i < 4; i++) - ldata[i] = lrand48 (); - - return TRUE; -} - -/* Create the keys we'll be using for the display named NAME. */ -static int -make_auth_keys (const char *name) -{ - Xauth auth; - char key[16]; - - if (auth_file == NULL) - return FALSE; - - auth.name = "MIT-MAGIC-COOKIE-1"; - auth.name_length = strlen (auth.name); - - if (!generate_mit_magic_cookie (key)) - { - auth_file = NULL; - return FALSE; - } - - auth.data = key; - auth.data_length = 16; - - set_auth_number (&auth, name); - - define_named (&auth, host_name ()); - define_local (&auth); - - free (auth.number); - - return TRUE; -} - -/* If ADD-ENTRIES is true, merge our auth entries into the existing - Xauthority file. If ADD-ENTRIES is false, remove our entries. */ -static int -write_auth_file (int add_entries) -{ - char *home, newname[1024]; - int fd, ret; - FILE *new_fh, *old_fh; - addr_list *addr; - Xauth *auth; - - if (auth_file == NULL) - return FALSE; - - home = getenv ("HOME"); - if (home == NULL) - { - auth_file = NULL; - return FALSE; - } - - snprintf (newname, sizeof (newname), "%s/.XauthorityXXXXXX", home); - mktemp (newname); - - if (XauLockAuth (auth_file, 1, 2, 10) != LOCK_SUCCESS) - { - /* FIXME: do something here? */ - - auth_file = NULL; - return FALSE; - } - - fd = open (newname, O_WRONLY | O_CREAT | O_TRUNC, 0600); - if (fd >= 0) - { - new_fh = fdopen (fd, "w"); - if (new_fh != NULL) - { - if (add_entries) - { - for (addr = addresses; addr != NULL; addr = addr->next) - { - XauWriteAuth (new_fh, &addr->auth); - } - } - - old_fh = fopen (auth_file, "r"); - if (old_fh != NULL) - { - while ((auth = XauReadAuth (old_fh)) != NULL) - { - if (!check_auth_item (auth)) - XauWriteAuth (new_fh, auth); - XauDisposeAuth (auth); - } - fclose (old_fh); - } - - fclose (new_fh); - unlink (auth_file); - - ret = rename (newname, auth_file); - - if (ret != 0) - auth_file = NULL; - - XauUnlockAuth (auth_file); - return ret == 0; - } - - close (fd); - } - - XauUnlockAuth (auth_file); - auth_file = NULL; - return FALSE; -} - - -/* Subprocess management functions. */ - -static int -start_server (char **xargv) -{ - int child; - - child = fork (); - - switch (child) - { - case -1: /* error */ - perror ("fork"); - return FALSE; - - case 0: /* child */ - execv (X_SERVER, xargv); - perror ("Couldn't exec " X_SERVER); - _exit (1); - - default: /* parent */ - server_pid = child; - return TRUE; - } -} - -static int -wait_for_server (void) -{ - int count = 100; - - while (count-- > 0) - { - int status; - - server_dpy = XOpenDisplay (server_name); - if (server_dpy != NULL) - return TRUE; - - if (waitpid (server_pid, &status, WNOHANG) == server_pid) - return FALSE; - - sleep (1); - } - - return FALSE; -} - -static int -start_client (void) -{ - int child; - - child = fork(); - - switch (child) { - char *temp, buf[1024]; - - case -1: /* error */ - perror("fork"); - return FALSE; - - case 0: /* child */ - /* Setup environment */ - temp = getenv("DISPLAY"); - if (temp != NULL && temp[0] != 0) - setenv("DISPLAY", server_name, TRUE); - - temp = getenv("PATH"); - if (temp == NULL || temp[0] == 0) - setenv ("PATH", DEFAULT_PATH, TRUE); - else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) { - snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp); - setenv("PATH", buf, TRUE); - } - - /* First try value of $XINITRC, if set. */ - temp = getenv("XINITRC"); - if (temp != NULL && temp[0] != 0 && access(temp, R_OK) == 0) - execlp (SHELL, SHELL, temp, NULL); - - /* Then look for .xinitrc in user's home directory. */ - temp = getenv("HOME"); - if (temp != NULL && temp[0] != 0) { - chdir(temp); - snprintf (buf, sizeof (buf), "%s/.xinitrc", temp); - if (access(buf, R_OK) == 0) - execlp(SHELL, SHELL, buf, NULL); - } - - /* Then try the default xinitrc in the lib directory. */ - - if (access(DEFAULT_XINITRC, R_OK) == 0) - execlp(SHELL, SHELL, DEFAULT_XINITRC, NULL); - - /* Then fallback to hardcoding an xterm and the window manager. */ - - // system(XTERM_PATH " &"); - execl(WM_PATH, WM_PATH, NULL); - - perror("exec"); - _exit(1); - - default: /* parent */ - client_pid = child; - return TRUE; - } -} - -static void -sigchld_handler (int sig) -{ - int pid, status; - - again: - pid = waitpid (WAIT_ANY, &status, WNOHANG); - - if (pid > 0) - { - if (pid == server_pid) - { - server_pid = -1; - - if (client_pid >= 0) - kill (client_pid, SIGTERM); - } - else if (pid == client_pid) - { - client_pid = -1; - - if (server_pid >= 0 && xinit_kills_server) - kill (server_pid, SIGTERM); - } - goto again; - } - - if (server_pid == -1 && client_pid == -1) - longjmp (exit_continuation, 1); - - signal (SIGCHLD, sigchld_handler); -} - - -/* Server utilities. */ - -static Boolean -display_exists_p (int number) -{ - char buf[64]; - xcb_connection_t *conn; - char *fullname = NULL; - int idisplay, iscreen; - char *conn_auth_name, *conn_auth_data; - int conn_auth_namelen, conn_auth_datalen; - - // extern void *_X11TransConnectDisplay (); - // extern void _XDisconnectDisplay (); - - /* Since connecting to the display waits for a few seconds if the - display doesn't exist, check for trivial non-existence - if the - socket in /tmp exists or not.. (note: if the socket exists, the - server may still not, so we need to try to connect in that case..) */ - - sprintf (buf, "/tmp/.X11-unix/X%d", number); - if (access (buf, F_OK) != 0) - return FALSE; - - sprintf (buf, ":%d", number); - conn = xcb_connect(buf, NULL); - if (xcb_connection_has_error(conn)) return FALSE; - - xcb_disconnect(conn); - return TRUE; -} - - -/* Monitoring when the system's ip addresses change. */ - -static Boolean pending_timer; - -static void -timer_callback (CFRunLoopTimerRef timer, void *info) -{ - pending_timer = FALSE; - - /* Update authentication names. Need to write .Xauthority file first - without the existing entries, then again with the new entries.. */ - - write_auth_file (FALSE); - - free_auth_items (); - make_auth_keys (server_name); - - write_auth_file (TRUE); -} - -/* This function is called when the system's ip addresses may have changed. */ -static void -ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *info) -{ -#if DEBUG - if (changed_keys != NULL) { - fprintf (stderr, "x11: changed sc keys: "); - CFShow (changed_keys); - } -#endif - - if (auth_file != NULL && !pending_timer) - { - CFRunLoopTimerRef timer; - - timer = CFRunLoopTimerCreate (NULL, CFAbsoluteTimeGetCurrent () + 1.0, - 0.0, 0, 0, timer_callback, NULL); - CFRunLoopAddTimer (CFRunLoopGetCurrent (), timer, - kCFRunLoopDefaultMode); - CFRelease (timer); - - pending_timer = TRUE; - } -} - -/* This code adapted from "Living in a Dynamic TCP/IP Environment" technote. */ -static Boolean -install_ipaddr_source (void) -{ - CFRunLoopSourceRef source = NULL; - - SCDynamicStoreContext context = {0}; - SCDynamicStoreRef ref; - - ref = SCDynamicStoreCreate (NULL, - CFSTR ("AddIPAddressListChangeCallbackSCF"), - ipaddr_callback, &context); - - if (ref != NULL) - { - const void *keys[4], *patterns[2]; - int i; - - keys[0] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4); - keys[1] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6); - keys[2] = SCDynamicStoreKeyCreateComputerName (NULL); - keys[3] = SCDynamicStoreKeyCreateHostNames (NULL); - - patterns[0] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4); - patterns[1] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6); - - if (keys[0] != NULL && keys[1] != NULL && keys[2] != NULL - && keys[3] != NULL && patterns[0] != NULL && patterns[1] != NULL) - { - CFArrayRef key_array, pattern_array; - - key_array = CFArrayCreate (NULL, keys, 4, &kCFTypeArrayCallBacks); - pattern_array = CFArrayCreate (NULL, patterns, 2, &kCFTypeArrayCallBacks); - - if (key_array != NULL || pattern_array != NULL) - { - SCDynamicStoreSetNotificationKeys (ref, key_array, pattern_array); - source = SCDynamicStoreCreateRunLoopSource (NULL, ref, 0); - } - - if (key_array != NULL) - CFRelease (key_array); - if (pattern_array != NULL) - CFRelease (pattern_array); - } - - - for (i = 0; i < 4; i++) - if (keys[i] != NULL) - CFRelease (keys[i]); - for (i = 0; i < 2; i++) - if (patterns[i] != NULL) - CFRelease (patterns[i]); - - CFRelease (ref); - } - - if (source != NULL) - { - CFRunLoopAddSource (CFRunLoopGetCurrent (), - source, kCFRunLoopDefaultMode); - CFRelease (source); - } - - return source != NULL; -} - - -/* Entrypoint. */ - -void -termination_signal_handler (int unused_sig) -{ - signal (SIGTERM, SIG_DFL); - signal (SIGHUP, SIG_DFL); - signal (SIGINT, SIG_DFL); - signal (SIGQUIT, SIG_DFL); - - longjmp (exit_continuation, 1); -} - -int -main (int argc, char **argv) -{ - char **xargv; - int i, j; - int fd; - - xargv = alloca (sizeof (char *) * (argc + 32)); - - if (!read_boolean_pref (CFSTR ("no_auth"), FALSE)) - auth_file = XauFileName (); - - /* The standard X11 behaviour is for the server to quit when the first - client exits. But it can be useful for debugging (and to mimic our - behaviour in the beta releases) to not do that. */ - - xinit_kills_server = read_boolean_pref (CFSTR ("xinit_kills_server"), TRUE); - - for (i = 1; i < argc; i++) - { - if (argv[i][0] == ':') - server_name = argv[i]; - } - - if (server_name == NULL) - { - static char name[8]; - - /* No display number specified, so search for the first unused. - - There's a big old race condition here if two servers start at - the same time, but that's fairly unlikely. We could create - lockfiles or something, but that's seems more likely to cause - problems than the race condition itself.. */ - - for (i = 0; i < MAX_DISPLAYS; i++) - { - if (!display_exists_p (i)) - break; - } - - if (i == MAX_DISPLAYS) - { - fprintf (stderr, "%s: couldn't allocate a display number", argv[0]); - exit (1); - } - - sprintf (name, ":%d", i); - server_name = name; - } - - if (auth_file != NULL) - { - /* Create new Xauth keys and add them to the .Xauthority file */ - - make_auth_keys (server_name); - write_auth_file (TRUE); - } - - /* Construct our new argv */ - - i = j = 0; - - xargv[i++] = argv[j++]; - - if (auth_file != NULL) - { - xargv[i++] = "-auth"; - xargv[i++] = auth_file; - } - - /* By default, don't listen on tcp sockets if Xauth is disabled. */ - - if (read_boolean_pref (CFSTR ("nolisten_tcp"), auth_file == NULL)) - { - xargv[i++] = "-nolisten"; - xargv[i++] = "tcp"; - } - - while (j < argc) - { - if (argv[j++][0] != ':') - xargv[i++] = argv[j-1]; - } - - xargv[i++] = (char *) server_name; - xargv[i++] = NULL; - - /* Detach from any controlling terminal and connect stdin to /dev/null */ - -#ifdef TIOCNOTTY - fd = open ("/dev/tty", O_RDONLY); - if (fd != -1) - { - ioctl (fd, TIOCNOTTY, 0); - close (fd); - } -#endif - - fd = open ("/dev/null", O_RDWR, 0); - if (fd >= 0) - { - dup2 (fd, 0); - if (fd > 0) - close (fd); - } - - if (!start_server (xargv)) - return 1; - - if (!wait_for_server ()) - { - kill (server_pid, SIGTERM); - return 1; - } - - if (!start_client ()) - { - kill (server_pid, SIGTERM); - return 1; - } - - signal (SIGCHLD, sigchld_handler); - - signal (SIGTERM, termination_signal_handler); - signal (SIGHUP, termination_signal_handler); - signal (SIGINT, termination_signal_handler); - signal (SIGQUIT, termination_signal_handler); - - if (setjmp (exit_continuation) == 0) - { - if (install_ipaddr_source ()) - CFRunLoopRun (); - else - while (1) pause (); - } - - signal (SIGCHLD, SIG_IGN); - - if (client_pid >= 0) kill (client_pid, SIGTERM); - if (server_pid >= 0) kill (server_pid, SIGTERM); - - if (auth_file != NULL) - { - /* Remove our Xauth keys */ - - write_auth_file (FALSE); - } - - free_auth_items (); - - return 0; -} diff --git a/hw/darwin/launcher/Info.plist b/hw/darwin/launcher/Info.plist deleted file mode 100644 index b5385b61a..000000000 --- a/hw/darwin/launcher/Info.plist +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>X11</string> - <key>CFBundleGetInfoString</key> - <string>2.0, Copyright © 2003-2007, Apple Inc.</string> - <key>CFBundleIconFile</key> - <string>X11.icns</string> - <key>CFBundleIdentifier</key> - <string>org.x.X11_launcher</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>X11</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>2.0</string> - <key>CFBundleSignature</key> - <string>x11l</string> - <key>LSUIElement</key> - <string>1</string> - <key>NSHumanReadableCopyright</key> - <string>Copyright © 2007, Apple Inc.</string> -</dict> -</plist> diff --git a/hw/darwin/launcher/Makefile.am b/hw/darwin/launcher/Makefile.am deleted file mode 100644 index c291731d1..000000000 --- a/hw/darwin/launcher/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -bin_SCRIPTS = x11launcher - -.PHONY: x11launcher - -x11launcher: - xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)" - -install-data-hook: - xcodebuild install DSTROOT=$(DESTDIR) INSTALL_PATH=$(APPLE_APPLICATIONS_DIR) DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)" - -clean-local: - rm -rf build - -EXTRA_DIST = \ - bundle-main.c \ - Info.plist \ - X11.icns \ - X11.xcodeproj/project.pbxproj diff --git a/hw/darwin/launcher/X11.icns b/hw/darwin/launcher/X11.icns Binary files differdeleted file mode 100644 index d770e617d..000000000 --- a/hw/darwin/launcher/X11.icns +++ /dev/null diff --git a/hw/darwin/launcher/X11.xcodeproj/project.pbxproj b/hw/darwin/launcher/X11.xcodeproj/project.pbxproj deleted file mode 100644 index 34b76dafb..000000000 --- a/hw/darwin/launcher/X11.xcodeproj/project.pbxproj +++ /dev/null @@ -1,290 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; }; - 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; }; - 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; }; - 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; }; - 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; }; - 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; - 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; }; - 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 527F241E0B5D938C007840A7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 195DF8CFFE9D517E11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 527F24270B5D938C007840A7 /* X11.app */, - ); - name = Products; - sourceTree = "<group>"; - }; - 20286C29FDCF999611CA2CEA /* X11 */ = { - isa = PBXGroup; - children = ( - 20286C2AFDCF999611CA2CEA /* Sources */, - 20286C2CFDCF999611CA2CEA /* Resources */, - 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */, - 195DF8CFFE9D517E11CA2CBB /* Products */, - 527F24260B5D938C007840A7 /* Info.plist */, - ); - name = X11; - sourceTree = "<group>"; - }; - 20286C2AFDCF999611CA2CEA /* Sources */ = { - isa = PBXGroup; - children = ( - 50EE2AB703849F0B0ECA21EC /* bundle-main.c */, - ); - name = Sources; - sourceTree = "<group>"; - }; - 20286C2CFDCF999611CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 50459C5F038587C60ECA21EC /* X11.icns */, - ); - name = Resources; - sourceTree = "<group>"; - }; - 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 527F24170B5D938C007840A7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 527F24160B5D938C007840A7 /* X11 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */; - buildPhases = ( - 527F24170B5D938C007840A7 /* Headers */, - 527F24180B5D938C007840A7 /* Resources */, - 527F241C0B5D938C007840A7 /* Sources */, - 527F241E0B5D938C007840A7 /* Frameworks */, - 527F24210B5D938C007840A7 /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = X11; - productName = X11; - productReference = 527F24270B5D938C007840A7 /* X11.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 20286C28FDCF999611CA2CEA /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */; - compatibilityVersion = "Xcode 2.4"; - hasScannedForEncodings = 1; - mainGroup = 20286C29FDCF999611CA2CEA /* X11 */; - projectDirPath = ""; - projectRoot = ""; - shouldCheckCompatibility = 1; - targets = ( - 527F24160B5D938C007840A7 /* X11 */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 527F24180B5D938C007840A7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F24370B5D9D89007840A7 /* Info.plist in Resources */, - 527F241B0B5D938C007840A7 /* X11.icns in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 527F24210B5D938C007840A7 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 527F241C0B5D938C007840A7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 527F24090B5D8FFC007840A7 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Development; - }; - 527F240A0B5D8FFC007840A7 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Deployment; - }; - 527F240B0B5D8FFC007840A7 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - INSTALL_MODE_FLAG = "a+rX"; - }; - name = Default; - }; - 527F24230B5D938C007840A7 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = $DSTROOT/Applications/Utilties; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Development; - }; - 527F24240B5D938C007840A7 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /Applications/Utilties; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Deployment; - }; - 527F24250B5D938C007840A7 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ""; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = /usr/X11/include; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = /Applications/Utilties; - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-lXau", - "-lxcb", - "-lX11", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = X11; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = app; - }; - name = Default; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 527F24090B5D8FFC007840A7 /* Development */, - 527F240A0B5D8FFC007840A7 /* Deployment */, - 527F240B0B5D8FFC007840A7 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 527F24230B5D938C007840A7 /* Development */, - 527F24240B5D938C007840A7 /* Deployment */, - 527F24250B5D938C007840A7 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; -/* End XCConfigurationList section */ - }; - rootObject = 20286C28FDCF999611CA2CEA /* Project object */; -} diff --git a/hw/darwin/launcher/bundle-main.c b/hw/darwin/launcher/bundle-main.c deleted file mode 100644 index ca6255307..000000000 --- a/hw/darwin/launcher/bundle-main.c +++ /dev/null @@ -1,81 +0,0 @@ -/* main.c -- X application launcher - - Copyright (c) 2007 Apple Inc. - - 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 and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> - -#include <CoreFoundation/CoreFoundation.h> - -#define DEFAULT_APP "/usr/X11/bin/xterm" - -int main (int argc, char **argv) { - char *command = DEFAULT_APP; - const char *newargv[7]; - int child; - - - CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(CFSTR("app_to_run"), - kCFPreferencesCurrentApplication); - - if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { - CFPreferencesSetAppValue(CFSTR("app_to_run"), CFSTR(DEFAULT_APP), - kCFPreferencesCurrentApplication); - CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); - } else { - int len = CFStringGetLength((CFStringRef)PlistRef)+1; - command = (char *) malloc(len); - CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); - fprintf(stderr, "command=%s\n", command); - } - - if (PlistRef) CFRelease(PlistRef); - - newargv[0] = "/usr/bin/login"; - newargv[1] = "-fp"; - newargv[2] = getlogin(); - newargv[3] = "/bin/sh"; - newargv[4] = "-c"; - newargv[5] = command; - newargv[6] = NULL; - - child = fork(); - - switch (child) { - case -1: /* error */ - perror ("fork"); - return EXIT_FAILURE; - case 0: /* child */ - execvp (newargv[0], (char **const) newargv); - perror ("Couldn't exec"); - _exit (1); - } - - return 0; -} diff --git a/hw/darwin/quartz/Makefile.am b/hw/darwin/quartz/Makefile.am deleted file mode 100644 index f5199dfa2..000000000 --- a/hw/darwin/quartz/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -noinst_LIBRARIES = libXQuartz.a - -AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) -AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir) -I$(srcdir)/.. \ - -I$(top_srcdir)/miext/rootless - -SUBDIRS = xpr - -libXQuartz_a_SOURCES = \ - X11Application.m \ - X11Controller.m \ - applewm.c \ - keysym2ucs.c \ - pseudoramiX.c \ - quartz.c \ - quartzAudio.c \ - quartzCocoa.m \ - quartzKeyboard.c \ - quartzPasteboard.c \ - quartzStartup.c - -EXTRA_DIST = \ - X11Application.h \ - X11Controller.h \ - applewmExt.h \ - keysym2ucs.h \ - pseudoramiX.h \ - quartzAudio.h \ - quartzCommon.h \ - quartzCursor.c \ - quartzCursor.h \ - quartz.h \ - quartzPasteboard.h diff --git a/hw/darwin/quartz/cr/XView.m b/hw/darwin/quartz/cr/XView.m deleted file mode 100644 index 130b15f59..000000000 --- a/hw/darwin/quartz/cr/XView.m +++ /dev/null @@ -1,77 +0,0 @@ -/* - * NSView subclass for Mac OS X rootless X server - * - * Each rootless window contains an instance of this class. - * This class handles events while drawing is handled by Carbon - * code in the rootless Aqua implementation. - * - * Copyright (c) 2001 Greg Parker. 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#import "XView.h" - - -@implementation XView - -- (BOOL)isFlipped -{ - return NO; -} - -- (BOOL)isOpaque -{ - return YES; -} - -- (BOOL)acceptsFirstResponder -{ - return YES; -} - -- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent -{ - return YES; -} - -- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent -{ - return YES; -} - -- (void)mouseDown:(NSEvent *)anEvent -{ - // Only X is allowed to restack windows. - [NSApp preventWindowOrdering]; - if (! [NSApp isActive]) { - [NSApp activateIgnoringOtherApps:YES]; - } - [[self nextResponder] mouseDown:anEvent]; -} - -@end diff --git a/hw/darwin/quartz/cr/cr.h b/hw/darwin/quartz/cr/cr.h deleted file mode 100644 index 0ebad5da0..000000000 --- a/hw/darwin/quartz/cr/cr.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Internal definitions of the Cocoa rootless implementation - * - * Copyright (c) 2003 Torrey T. Lyons. 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifndef _CR_H -#define _CR_H - -#ifdef __OBJC__ -#import <Cocoa/Cocoa.h> -#import "XView.h" -#else -typedef struct OpaqueNSWindow NSWindow; -typedef struct OpaqueXView XView; -#endif - -#undef BOOL -#define BOOL xBOOL -#include "screenint.h" -#include "window.h" -#undef BOOL - -// Predefined style for the window which is about to be framed -extern WindowPtr nextWindowToFrame; -extern unsigned int nextWindowStyle; - -typedef struct { - NSWindow *window; - XView *view; - GrafPtr port; - CGContextRef context; -} CRWindowRec, *CRWindowPtr; - -Bool CRInit(ScreenPtr pScreen); -void CRAppleWMInit(void); - -#endif /* _CR_H */ diff --git a/hw/darwin/quartz/cr/crAppleWM.m b/hw/darwin/quartz/cr/crAppleWM.m deleted file mode 100644 index 246f52170..000000000 --- a/hw/darwin/quartz/cr/crAppleWM.m +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Cocoa rootless implementation functions for AppleWM extension - * - * Copyright (c) 2003 Torrey T. Lyons. 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartz/quartzCommon.h" -#include "quartz/cr/cr.h" - -#undef BOOL -#define BOOL xBOOL -#include "rootless.h" -#include "X11/X.h" -#define _APPLEWM_SERVER_ -#include "X11/extensions/applewm.h" -#include "quartz/applewmExt.h" -#undef BOOL - -#define StdDocumentStyleMask (NSTitledWindowMask | \ - NSClosableWindowMask | \ - NSMiniaturizableWindowMask | \ - NSResizableWindowMask) - -static int -CRDisableUpdate(void) -{ - return Success; -} - - -static int -CREnableUpdate(void) -{ - return Success; -} - - -static int CRSetWindowLevel( - WindowPtr pWin, - int level) -{ - CRWindowPtr crWinPtr; - - crWinPtr = (CRWindowPtr) RootlessFrameForWindow(pWin, TRUE); - if (crWinPtr == 0) - return BadWindow; - - RootlessStopDrawing(pWin, FALSE); - - [crWinPtr->window setLevel:level]; - - return Success; -} - - -static int CRFrameGetRect( - int type, - int class, - const BoxRec *outer, - const BoxRec *inner, - BoxRec *ret) -{ - return Success; -} - - -static int CRFrameHitTest( - int class, - int x, - int y, - const BoxRec *outer, - const BoxRec *inner, - int *ret) -{ - return 0; -} - - -static int CRFrameDraw( - WindowPtr pWin, - int class, - unsigned int attr, - const BoxRec *outer, - const BoxRec *inner, - unsigned int title_len, - const unsigned char *title_bytes) -{ - CRWindowPtr crWinPtr; - NSWindow *window; - Bool hasResizeIndicator; - - /* We assume the window has not yet been framed so - RootlessFrameForWindow() will cause it to be. Record the window - style so that the appropriate one will be used when it is framed. - If the window is already framed, we can't change the window - style and the following will have no effect. */ - - nextWindowToFrame = pWin; - if (class == AppleWMFrameClassDocument) - nextWindowStyle = StdDocumentStyleMask; - else - nextWindowStyle = NSBorderlessWindowMask; - - crWinPtr = (CRWindowPtr) RootlessFrameForWindow(pWin, TRUE); - if (crWinPtr == 0) - return BadWindow; - - window = crWinPtr->window; - - [window setTitle:[NSString stringWithCString:title_bytes - length:title_len]]; - - hasResizeIndicator = (attr & AppleWMFrameGrowBox) ? YES : NO; - [window setShowsResizeIndicator:hasResizeIndicator]; - - return Success; -} - - -static AppleWMProcsRec crAppleWMProcs = { - CRDisableUpdate, - CREnableUpdate, - CRSetWindowLevel, - CRFrameGetRect, - CRFrameHitTest, - CRFrameDraw -}; - - -void CRAppleWMInit(void) -{ - AppleWMExtensionInit(&crAppleWMProcs); -} diff --git a/hw/darwin/quartz/cr/crFrame.m b/hw/darwin/quartz/cr/crFrame.m deleted file mode 100644 index 86c75d2e4..000000000 --- a/hw/darwin/quartz/cr/crFrame.m +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Cocoa rootless implementation frame functions - * - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartz/quartzCommon.h" -#include "quartz/cr/cr.h" - -#undef BOOL -#define BOOL xBOOL -#include "rootless.h" -#include "quartz/applewmExt.h" -#include "windowstr.h" -#undef BOOL - -WindowPtr nextWindowToFrame = NULL; -unsigned int nextWindowStyle = 0; - -static void CRReshapeFrame(RootlessFrameID wid, RegionPtr pShape); - - -/* - * CRCreateFrame - * Create a new physical window. - * Rootless windows must not autodisplay! Autodisplay can cause a deadlock. - * Event thread - autodisplay: locks view hierarchy, then window - * X Server thread - window resize: locks window, then view hierarchy - * Deadlock occurs if each thread gets one lock and waits for the other. - */ -static Bool -CRCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, - int newX, int newY, RegionPtr pShape) -{ - CRWindowPtr crWinPtr; - NSRect bounds; - NSWindow *theWindow; - XView *theView; - unsigned int theStyleMask = NSBorderlessWindowMask; - - crWinPtr = (CRWindowPtr) xalloc(sizeof(CRWindowRec)); - - bounds = NSMakeRect(newX, - NSHeight([[NSScreen mainScreen] frame]) - - newY - pFrame->height, - pFrame->width, pFrame->height); - - // Check if AppleWM has specified a style for this window - if (pFrame->win == nextWindowToFrame) { - theStyleMask = nextWindowStyle; - } - nextWindowToFrame = NULL; - - // Create an NSWindow for the new X11 window - theWindow = [[NSWindow alloc] initWithContentRect:bounds - styleMask:theStyleMask - backing:NSBackingStoreBuffered -#ifdef DEFER_NSWINDOW - defer:YES]; -#else - defer:NO]; -#endif - - if (!theWindow) return FALSE; - - [theWindow setBackgroundColor:[NSColor clearColor]]; // erase transparent - [theWindow setAlphaValue:1.0]; // draw opaque - [theWindow setOpaque:YES]; // changed when window is shaped - - [theWindow useOptimizedDrawing:YES]; // Has no overlapping sub-views - [theWindow setAutodisplay:NO]; // See comment above - [theWindow disableFlushWindow]; // We do all the flushing manually - [theWindow setHasShadow:YES]; // All windows have shadows - [theWindow setReleasedWhenClosed:YES]; // Default, but we want to be sure - - theView = [[XView alloc] initWithFrame:bounds]; - [theWindow setContentView:theView]; - [theWindow setInitialFirstResponder:theView]; - -#ifdef DEFER_NSWINDOW - // We need the NSWindow to actually be created now. - // If we had to defer creating it, we have to order it - // onto the screen to force it to be created. - - if (pFrame->win->prevSib) { - CRWindowPtr crWinPtr = (CRWindowPtr) RootlessFrameForWindow( - pFrame->win->prevSib, FALSE); - int upperNum = [crWinPtr->window windowNumber]; - [theWindow orderWindow:NSWindowBelow relativeTo:upperNum]; - } else { - [theWindow orderFront:nil]; - } -#endif - - [theWindow setAcceptsMouseMovedEvents:YES]; - - crWinPtr->window = theWindow; - crWinPtr->view = theView; - - [theView lockFocus]; - // Fill the window with white to make sure alpha channel is set - NSEraseRect(bounds); - crWinPtr->port = [theView qdPort]; - crWinPtr->context = [[NSGraphicsContext currentContext] graphicsPort]; - // CreateCGContextForPort(crWinPtr->port, &crWinPtr->context); - [theView unlockFocus]; - - // Store the implementation private frame ID - pFrame->wid = (RootlessFrameID) crWinPtr; - - // Reshape the frame if it was created shaped. - if (pShape != NULL) - CRReshapeFrame(pFrame->wid, pShape); - - return TRUE; -} - - -/* - * CRDestroyFrame - * Destroy a frame. - */ -static void -CRDestroyFrame(RootlessFrameID wid) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - - [crWinPtr->window orderOut:nil]; - [crWinPtr->window close]; - [crWinPtr->view release]; - free(crWinPtr); -} - - -/* - * CRMoveFrame - * Move a frame on screen. - */ -static void -CRMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - NSPoint topLeft; - - topLeft = NSMakePoint(newX, - NSHeight([[NSScreen mainScreen] frame]) - newY); - - [crWinPtr->window setFrameTopLeftPoint:topLeft]; -} - - -/* - * CRResizeFrame - * Move and resize a frame. - */ -static void -CRResizeFrame(RootlessFrameID wid, ScreenPtr pScreen, - int newX, int newY, unsigned int newW, unsigned int newH, - unsigned int gravity) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - NSRect bounds = NSMakeRect(newX, NSHeight([[NSScreen mainScreen] frame]) - - newY - newH, newW, newH); - - [crWinPtr->window setFrame:bounds display:NO]; -} - - -/* - * CRRestackFrame - * Change the frame order. Put the frame behind nextWid or on top if - * it is NULL. Unmapped frames are mapped by restacking them. - */ -static void -CRRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - CRWindowPtr crNextWinPtr = (CRWindowPtr) nextWid; - - if (crNextWinPtr) { - int upperNum = [crNextWinPtr->window windowNumber]; - - [crWinPtr->window orderWindow:NSWindowBelow relativeTo:upperNum]; - } else { - [crWinPtr->window makeKeyAndOrderFront:nil]; - } -} - - -/* - * CRReshapeFrame - * Set the shape of a frame. - */ -static void -CRReshapeFrame(RootlessFrameID wid, RegionPtr pShape) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - NSRect bounds = [crWinPtr->view frame]; - int winHeight = NSHeight(bounds); - BoxRec localBox = {0, 0, NSWidth(bounds), winHeight}; - - [crWinPtr->view lockFocus]; - - if (pShape != NULL) { - // Calculate the region outside the new shape. - miInverse(pShape, pShape, &localBox); - } - - // If window is currently shaped we need to undo the previous shape. - if (![crWinPtr->window isOpaque]) { - [[NSColor whiteColor] set]; - NSRectFillUsingOperation(bounds, NSCompositeDestinationAtop); - } - - if (pShape != NULL) { - int count = REGION_NUM_RECTS(pShape); - BoxRec *extRects = REGION_RECTS(pShape); - BoxRec *rects, *end; - - // Make transparent if window is now shaped. - [crWinPtr->window setOpaque:NO]; - - // Clear the areas outside the window shape - [[NSColor clearColor] set]; - for (rects = extRects, end = extRects+count; rects < end; rects++) { - int rectHeight = rects->y2 - rects->y1; - NSRectFill( NSMakeRect(rects->x1, - winHeight - rects->y1 - rectHeight, - rects->x2 - rects->x1, rectHeight) ); - } - [[NSGraphicsContext currentContext] flushGraphics]; - - // force update of window shadow - [crWinPtr->window setHasShadow:NO]; - [crWinPtr->window setHasShadow:YES]; - - } else { - [crWinPtr->window setOpaque:YES]; - [[NSGraphicsContext currentContext] flushGraphics]; - } - - [crWinPtr->view unlockFocus]; -} - - -/* - * CRUnmapFrame - * Unmap a frame. - */ -static void -CRUnmapFrame(RootlessFrameID wid) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - - [crWinPtr->window orderOut:nil]; -} - - -/* - * CRStartDrawing - * When a window's buffer is not being drawn to, the CoreGraphics - * window server may compress or move it. Call this routine - * to lock down the buffer during direct drawing. It returns - * a pointer to the backing buffer. - */ -static void -CRStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - PixMapHandle pix; - - [crWinPtr->view lockFocus]; - crWinPtr->port = [crWinPtr->view qdPort]; - LockPortBits(crWinPtr->port); - [crWinPtr->view unlockFocus]; - pix = GetPortPixMap(crWinPtr->port); - - *pixelData = GetPixBaseAddr(pix); - *bytesPerRow = GetPixRowBytes(pix) & 0x3fff; // fixme is mask needed? -} - - -/* - * CRStopDrawing - * When direct access to a window's buffer is no longer needed, this - * routine should be called to allow CoreGraphics to compress or - * move it. - */ -static void -CRStopDrawing(RootlessFrameID wid, Bool flush) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - - UnlockPortBits(crWinPtr->port); - - if (flush) { - QDFlushPortBuffer(crWinPtr->port, NULL); - } -} - - -/* - * CRUpdateRegion - * Flush a region from a window's backing buffer to the screen. - */ -static void -CRUpdateRegion(RootlessFrameID wid, RegionPtr pDamage) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - -#ifdef ROOTLESS_TRACK_DAMAGE - int count = REGION_NUM_RECTS(pDamage); - BoxRec *rects = REGION_RECTS(pDamage); - BoxRec *end; - - static RgnHandle rgn = NULL; - static RgnHandle box = NULL; - - if (!rgn) rgn = NewRgn(); - if (!box) box = NewRgn(); - - for (end = rects+count; rects < end; rects++) { - Rect qdRect; - qdRect.left = rects->x1; - qdRect.top = rects->y1; - qdRect.right = rects->x2; - qdRect.bottom = rects->y2; - - RectRgn(box, &qdRect); - UnionRgn(rgn, box, rgn); - } - - QDFlushPortBuffer(crWinPtr->port, rgn); - - SetEmptyRgn(rgn); - SetEmptyRgn(box); - -#else /* !ROOTLESS_TRACK_DAMAGE */ - QDFlushPortBuffer(crWinPtr->port, NULL); -#endif -} - - -/* - * CRDamageRects - * Mark damaged rectangles as requiring redisplay to screen. - */ -static void -CRDamageRects(RootlessFrameID wid, int count, const BoxRec *rects, - int shift_x, int shift_y) -{ - CRWindowPtr crWinPtr = (CRWindowPtr) wid; - const BoxRec *end; - - for (end = rects + count; rects < end; rects++) { - Rect qdRect; - qdRect.left = rects->x1 + shift_x; - qdRect.top = rects->y1 + shift_y; - qdRect.right = rects->x2 + shift_x; - qdRect.bottom = rects->y2 + shift_y; - - QDAddRectToDirtyRegion(crWinPtr->port, &qdRect); - } -} - - -/* - * Called to check if the frame should be reordered when it is restacked. - */ -Bool CRDoReorderWindow(RootlessWindowPtr pFrame) -{ - WindowPtr pWin = pFrame->win; - - return AppleWMDoReorderWindow(pWin); -} - - -static RootlessFrameProcsRec CRRootlessProcs = { - CRCreateFrame, - CRDestroyFrame, - CRMoveFrame, - CRResizeFrame, - CRRestackFrame, - CRReshapeFrame, - CRUnmapFrame, - CRStartDrawing, - CRStopDrawing, - CRUpdateRegion, - CRDamageRects, - NULL, - CRDoReorderWindow, - NULL, - NULL, - NULL, - NULL -}; - - -/* - * Initialize CR implementation - */ -Bool -CRInit(ScreenPtr pScreen) -{ - RootlessInit(pScreen, &CRRootlessProcs); - - rootless_CopyBytes_threshold = 0; - rootless_FillBytes_threshold = 0; - rootless_CompositePixels_threshold = 0; - rootless_CopyWindow_threshold = 0; - - return TRUE; -} diff --git a/hw/darwin/quartz/cr/crScreen.m b/hw/darwin/quartz/cr/crScreen.m deleted file mode 100644 index cc82afbd1..000000000 --- a/hw/darwin/quartz/cr/crScreen.m +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Cocoa rootless implementation initialization - * - * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2004 Torrey T. Lyons. 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartz/quartzCommon.h" -#include "quartz/cr/cr.h" - -#undef BOOL -#define BOOL xBOOL -#include "darwin.h" -#include "quartz/quartz.h" -#include "quartz/quartzCursor.h" -#include "rootless.h" -#include "safeAlpha/safeAlpha.h" -#include "quartz/pseudoramiX.h" -#include "quartz/applewmExt.h" - -#include "regionstr.h" -#include "scrnintstr.h" -#include "picturestr.h" -#include "globals.h" -#ifdef DAMAGE -# include "damage.h" -#endif -#undef BOOL - -// Name of GLX bundle using AGL framework -static const char *crOpenGLBundle = "glxAGL.bundle"; - -static Class classXView = nil; - - -/* - * CRDisplayInit - * Find all screens. - * - * Multihead note: When rootless mode uses PseudoramiX, the - * X server only sees one screen; only PseudoramiX itself knows - * about all of the screens. - */ -static void -CRDisplayInit(void) -{ - ErrorF("Display mode: Rootless Quartz -- Cocoa implementation\n"); - - if (noPseudoramiXExtension) { - darwinScreensFound = [[NSScreen screens] count]; - } else { - darwinScreensFound = 1; // only PseudoramiX knows about the rest - } - - CRAppleWMInit(); -} - - -/* - * CRAddPseudoramiXScreens - * Add a single virtual screen encompassing all the physical screens - * with PseudoramiX. - */ -static void -CRAddPseudoramiXScreens(int *x, int *y, int *width, int *height) -{ - int i; - NSRect unionRect = NSMakeRect(0, 0, 0, 0); - NSArray *screens = [NSScreen screens]; - - // Get the union of all screens (minus the menu bar on main screen) - for (i = 0; i < [screens count]; i++) { - NSScreen *screen = [screens objectAtIndex:i]; - NSRect frame = [screen frame]; - frame.origin.y = [[NSScreen mainScreen] frame].size.height - - frame.size.height - frame.origin.y; - if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { - frame.origin.y += aquaMenuBarHeight; - frame.size.height -= aquaMenuBarHeight; - } - unionRect = NSUnionRect(unionRect, frame); - } - - // Use unionRect as the screen size for the X server. - *x = unionRect.origin.x; - *y = unionRect.origin.y; - *width = unionRect.size.width; - *height = unionRect.size.height; - - // Tell PseudoramiX about the real screens. - // InitOutput() will move the big screen to (0,0), - // so compensate for that here. - for (i = 0; i < [screens count]; i++) { - NSScreen *screen = [screens objectAtIndex:i]; - NSRect frame = [screen frame]; - int j; - - // Skip this screen if it's a mirrored copy of an earlier screen. - for (j = 0; j < i; j++) { - if (NSEqualRects(frame, [[screens objectAtIndex:j] frame])) { - ErrorF("PseudoramiX screen %d is a mirror of screen %d.\n", - i, j); - break; - } - } - if (j < i) continue; // this screen is a mirrored copy - - frame.origin.y = [[NSScreen mainScreen] frame].size.height - - frame.size.height - frame.origin.y; - - if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { - frame.origin.y += aquaMenuBarHeight; - frame.size.height -= aquaMenuBarHeight; - } - - ErrorF("PseudoramiX screen %d added: %dx%d @ (%d,%d).\n", i, - (int)frame.size.width, (int)frame.size.height, - (int)frame.origin.x, (int)frame.origin.y); - - frame.origin.x -= unionRect.origin.x; - frame.origin.y -= unionRect.origin.y; - - ErrorF("PseudoramiX screen %d placed at X11 coordinate (%d,%d).\n", - i, (int)frame.origin.x, (int)frame.origin.y); - - PseudoramiXAddScreen(frame.origin.x, frame.origin.y, - frame.size.width, frame.size.height); - } -} - - -/* - * CRScreenParams - * Set the basic screen parameters. - */ -static void -CRScreenParams(int index, DarwinFramebufferPtr dfb) -{ - dfb->bitsPerComponent = CGDisplayBitsPerSample(kCGDirectMainDisplay); - dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay); - dfb->colorBitsPerPixel = 3 * dfb->bitsPerComponent; - - if (noPseudoramiXExtension) { - NSScreen *screen = [[NSScreen screens] objectAtIndex:index]; - NSRect frame = [screen frame]; - - // set x, y so (0,0) is top left of main screen - dfb->x = NSMinX(frame); - dfb->y = NSHeight([[NSScreen mainScreen] frame]) - - NSHeight(frame) - NSMinY(frame); - - dfb->width = NSWidth(frame); - dfb->height = NSHeight(frame); - - // Shift the usable part of main screen down to avoid the menu bar. - if (NSEqualRects(frame, [[NSScreen mainScreen] frame])) { - dfb->y += aquaMenuBarHeight; - dfb->height -= aquaMenuBarHeight; - } - - } else { - CRAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height); - } -} - - -/* - * CRAddScreen - * Init the framebuffer and record pixmap parameters for the screen. - */ -static Bool -CRAddScreen(int index, ScreenPtr pScreen) -{ - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - QuartzScreenPtr displayInfo = QUARTZ_PRIV(pScreen); - CGRect cgRect; - CGDisplayCount numDisplays; - CGDisplayCount allocatedDisplays = 0; - CGDirectDisplayID *displays = NULL; - CGDisplayErr cgErr; - - CRScreenParams(index, dfb); - - dfb->colorType = TrueColor; - - /* Passing zero width (pitch) makes miCreateScreenResources set the - screen pixmap to the framebuffer pointer, i.e. NULL. The generic - rootless code takes care of making this work. */ - dfb->pitch = 0; - dfb->framebuffer = NULL; - - // Get all CoreGraphics displays covered by this X11 display. - cgRect = CGRectMake(dfb->x, dfb->y, dfb->width, dfb->height); - do { - cgErr = CGGetDisplaysWithRect(cgRect, 0, NULL, &numDisplays); - if (cgErr) break; - allocatedDisplays = numDisplays; - displays = xrealloc(displays, - numDisplays * sizeof(CGDirectDisplayID)); - cgErr = CGGetDisplaysWithRect(cgRect, allocatedDisplays, displays, - &numDisplays); - if (cgErr != CGDisplayNoErr) break; - } while (numDisplays > allocatedDisplays); - - if (cgErr != CGDisplayNoErr || numDisplays == 0) { - ErrorF("Could not find CGDirectDisplayID(s) for X11 screen %d: %dx%d @ %d,%d.\n", - index, dfb->width, dfb->height, dfb->x, dfb->y); - return FALSE; - } - - // This X11 screen covers all CoreGraphics displays we just found. - // If there's more than one CG display, then video mirroring is on - // or PseudoramiX is on. - displayInfo->displayCount = allocatedDisplays; - displayInfo->displayIDs = displays; - - return TRUE; -} - - -/* - * CRSetupScreen - * Setup the screen for rootless access. - */ -static Bool -CRSetupScreen(int index, ScreenPtr pScreen) -{ - // Add alpha protecting replacements for fb screen functions - pScreen->PaintWindowBackground = SafeAlphaPaintWindow; - pScreen->PaintWindowBorder = SafeAlphaPaintWindow; - -#ifdef RENDER - { - PictureScreenPtr ps = GetPictureScreen(pScreen); - ps->Composite = SafeAlphaComposite; - } -#endif /* RENDER */ - - // Initialize accelerated rootless drawing - // Note that this must be done before DamageSetup(). - RootlessAccelInit(pScreen); - -#ifdef DAMAGE - // The Damage extension needs to wrap underneath the - // generic rootless layer, so do it now. - if (!DamageSetup(pScreen)) - return FALSE; -#endif - - // Initialize generic rootless code - return CRInit(pScreen); -} - - -/* - * CRScreenChanged - * Configuration of displays has changed. - */ -static void -CRScreenChanged(void) -{ - QuartzMessageServerThread(kXDarwinDisplayChanged, 0); -} - - -/* - * CRUpdateScreen - * Update screen after configuation change. - */ -static void -CRUpdateScreen(ScreenPtr pScreen) -{ - rootlessGlobalOffsetX = darwinMainScreenX; - rootlessGlobalOffsetY = darwinMainScreenY; - - AppleWMSetScreenOrigin(WindowTable[pScreen->myNum]); - - RootlessRepositionWindows(pScreen); - RootlessUpdateScreenPixmap(pScreen); -} - - -/* - * CRInitInput - * Finalize CR specific setup. - */ -static void -CRInitInput(int argc, char **argv) -{ - int i; - - rootlessGlobalOffsetX = darwinMainScreenX; - rootlessGlobalOffsetY = darwinMainScreenY; - - for (i = 0; i < screenInfo.numScreens; i++) - AppleWMSetScreenOrigin(WindowTable[i]); -} - - -/* - * CRIsX11Window - * Returns TRUE if cr is displaying this window. - */ -static Bool -CRIsX11Window(void *nsWindow, int windowNumber) -{ - NSWindow *theWindow = nsWindow; - - if (!theWindow) - return FALSE; - - if ([[theWindow contentView] isKindOfClass:classXView]) - return TRUE; - else - return FALSE; -} - - -/* - * Quartz display mode function list. - */ -static QuartzModeProcsRec crModeProcs = { - CRDisplayInit, - CRAddScreen, - CRSetupScreen, - CRInitInput, - QuartzInitCursor, - QuartzReallySetCursor, - QuartzSuspendXCursor, - QuartzResumeXCursor, - NULL, // No capture or release in rootless mode - NULL, - CRScreenChanged, - CRAddPseudoramiXScreens, - CRUpdateScreen, - CRIsX11Window, - NULL, // Cocoa NSWindows hide themselves - RootlessFrameForWindow, - TopLevelParent, - NULL, // No support for DRI surfaces - NULL -}; - - -/* - * QuartzModeBundleInit - * Initialize the display mode bundle after loading. - */ -Bool -QuartzModeBundleInit(void) -{ - quartzProcs = &crModeProcs; - quartzOpenGLBundle = crOpenGLBundle; - classXView = [XView class]; - return TRUE; -} diff --git a/hw/darwin/quartz/fullscreen/fullscreen.c b/hw/darwin/quartz/fullscreen/fullscreen.c deleted file mode 100644 index c4a049f8f..000000000 --- a/hw/darwin/quartz/fullscreen/fullscreen.c +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Screen routines for full screen Quartz mode - * - * Copyright (c) 2002-2003 Torrey T. Lyons. 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * TORREY T. LYONS 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartz/quartzCommon.h" -#include "darwin.h" -#include "quartz/quartz.h" -#include "quartz/quartzCursor.h" -#include "colormapst.h" -#include "scrnintstr.h" -#include "micmap.h" -#include "shadow.h" - -// Full screen specific per screen storage structure -typedef struct { - CGDirectDisplayID displayID; - CFDictionaryRef xDisplayMode; - CFDictionaryRef aquaDisplayMode; - CGDirectPaletteRef xPalette; - CGDirectPaletteRef aquaPalette; - unsigned char *framebuffer; - unsigned char *shadowPtr; -} FSScreenRec, *FSScreenPtr; - -#define FULLSCREEN_PRIV(pScreen) \ - ((FSScreenPtr)pScreen->devPrivates[fsScreenIndex].ptr) - -static int fsScreenIndex; -static CGDirectDisplayID *quartzDisplayList = NULL; -static int quartzNumScreens = 0; -static FSScreenPtr quartzScreens[MAXSCREENS]; - -static int darwinCmapPrivateIndex = -1; -static unsigned long darwinCmapGeneration = 0; - -#define CMAP_PRIV(pCmap) \ - ((CGDirectPaletteRef) (pCmap)->devPrivates[darwinCmapPrivateIndex].ptr) - -/* - ============================================================================= - - Colormap handling - - ============================================================================= -*/ - -/* - * FSInitCmapPrivates - * Colormap privates may be allocated after the default colormap has - * already been created for some screens. This initialization procedure - * is called for each default colormap that is found. - */ -static Bool -FSInitCmapPrivates( - ColormapPtr pCmap) -{ - return TRUE; -} - - -/* - * FSCreateColormap - * This is a callback from X after a new colormap is created. - * We allocate a new CoreGraphics pallete for each colormap. - */ -static Bool -FSCreateColormap( - ColormapPtr pCmap) -{ - CGDirectPaletteRef pallete; - - // Allocate private storage for the hardware dependent colormap info. - if (darwinCmapGeneration != serverGeneration) { - if ((darwinCmapPrivateIndex = - AllocateColormapPrivateIndex(FSInitCmapPrivates)) < 0) - { - return FALSE; - } - darwinCmapGeneration = serverGeneration; - } - - pallete = CGPaletteCreateDefaultColorPalette(); - if (!pallete) return FALSE; - - CMAP_PRIV(pCmap) = pallete; - return TRUE; -} - - -/* - * FSDestroyColormap - * This is called by DIX FreeColormap after it has uninstalled a colormap - * and notified all interested parties. We deallocated the corresponding - * CoreGraphics pallete. - */ -static void -FSDestroyColormap( - ColormapPtr pCmap) -{ - CGPaletteRelease( CMAP_PRIV(pCmap) ); -} - - -/* - * FSInstallColormap - * Set the current CoreGraphics pallete to the pallete corresponding - * to the provided colormap. - */ -static void -FSInstallColormap( - ColormapPtr pCmap) -{ - CGDirectPaletteRef palette = CMAP_PRIV(pCmap); - ScreenPtr pScreen = pCmap->pScreen; - FSScreenPtr fsDisplayInfo = FULLSCREEN_PRIV(pScreen); - - // Inform all interested parties that the map is being changed. - miInstallColormap(pCmap); - - if (quartzServerVisible) - CGDisplaySetPalette(fsDisplayInfo->displayID, palette); - - fsDisplayInfo->xPalette = palette; -} - - -/* - * FSStoreColors - * This is a callback from X to change the hardware colormap - * when using PsuedoColor in full screen mode. - */ -static void -FSStoreColors( - ColormapPtr pCmap, - int numEntries, - xColorItem *pdefs) -{ - CGDirectPaletteRef palette = CMAP_PRIV(pCmap); - ScreenPtr pScreen = pCmap->pScreen; - FSScreenPtr fsDisplayInfo = FULLSCREEN_PRIV(pScreen); - CGDeviceColor color; - int i; - - if (! palette) - return; - - for (i = 0; i < numEntries; i++) { - color.red = pdefs[i].red / 65535.0; - color.green = pdefs[i].green / 65535.0; - color.blue = pdefs[i].blue / 65535.0; - CGPaletteSetColorAtIndex(palette, color, pdefs[i].pixel); - } - - // Update hardware colormap - if (quartzServerVisible) - CGDisplaySetPalette(fsDisplayInfo->displayID, palette); -} - - -/* - ============================================================================= - - Switching between Aqua and X - - ============================================================================= -*/ - -/* - * FSCapture - * Capture the screen so we can draw. Called directly from the main thread - * to synchronize with hiding the menubar. - */ -static void FSCapture(void) -{ - int i; - - if (quartzRootless) return; - - for (i = 0; i < quartzNumScreens; i++) { - FSScreenPtr fsDisplayInfo = quartzScreens[i]; - CGDirectDisplayID cgID = fsDisplayInfo->displayID; - - if (!CGDisplayIsCaptured(cgID)) { - CGDisplayCapture(cgID); - fsDisplayInfo->aquaDisplayMode = CGDisplayCurrentMode(cgID); - if (fsDisplayInfo->xDisplayMode != fsDisplayInfo->aquaDisplayMode) - CGDisplaySwitchToMode(cgID, fsDisplayInfo->xDisplayMode); - if (fsDisplayInfo->xPalette) - CGDisplaySetPalette(cgID, fsDisplayInfo->xPalette); - } - } -} - - -/* - * FSRelease - * Release the screen so others can draw. - */ -static void FSRelease(void) -{ - int i; - - if (quartzRootless) return; - - for (i = 0; i < quartzNumScreens; i++) { - FSScreenPtr fsDisplayInfo = quartzScreens[i]; - CGDirectDisplayID cgID = fsDisplayInfo->displayID; - - if (CGDisplayIsCaptured(cgID)) { - if (fsDisplayInfo->xDisplayMode != fsDisplayInfo->aquaDisplayMode) - CGDisplaySwitchToMode(cgID, fsDisplayInfo->aquaDisplayMode); - if (fsDisplayInfo->aquaPalette) - CGDisplaySetPalette(cgID, fsDisplayInfo->aquaPalette); - CGDisplayRelease(cgID); - } - } -} - - -/* - * FSSuspendScreen - * Suspend X11 cursor and drawing to the screen. - */ -static void FSSuspendScreen( - ScreenPtr pScreen) -{ - QuartzSuspendXCursor(pScreen); - xf86SetRootClip(pScreen, FALSE); -} - - -/* - * FSResumeScreen - * Resume X11 cursor and drawing to the screen. - */ -static void FSResumeScreen( - ScreenPtr pScreen, - int x, // cursor location - int y ) -{ - QuartzResumeXCursor(pScreen, x, y); - xf86SetRootClip(pScreen, TRUE); -} - - -/* - ============================================================================= - - Screen initialization - - ============================================================================= -*/ - -/* - * FSDisplayInit - * Full screen specific initialization called from InitOutput. - */ -static void FSDisplayInit(void) -{ - static unsigned long generation = 0; - CGDisplayCount quartzDisplayCount = 0; - - ErrorF("Display mode: Full screen Quartz -- Direct Display\n"); - - // Allocate private storage for each screen's mode specific info - if (generation != serverGeneration) { - fsScreenIndex = AllocateScreenPrivateIndex(); - generation = serverGeneration; - } - - // Find all the CoreGraphics displays - CGGetActiveDisplayList(0, NULL, &quartzDisplayCount); - quartzDisplayList = xalloc(quartzDisplayCount * sizeof(CGDirectDisplayID)); - CGGetActiveDisplayList(quartzDisplayCount, quartzDisplayList, - &quartzDisplayCount); - - darwinScreensFound = quartzDisplayCount; - atexit(FSRelease); -} - - -/* - * FSFindDisplayMode - * Find the appropriate display mode to use in full screen mode. - * If display mode is not the same as the current Aqua mode, switch - * to the new mode. - */ -static Bool FSFindDisplayMode( - FSScreenPtr fsDisplayInfo) -{ - CGDirectDisplayID cgID = fsDisplayInfo->displayID; - size_t height, width, bpp; - boolean_t exactMatch; - - fsDisplayInfo->aquaDisplayMode = CGDisplayCurrentMode(cgID); - - // If no user options, use current display mode - if (darwinDesiredWidth == 0 && darwinDesiredDepth == -1 && - darwinDesiredRefresh == -1) - { - fsDisplayInfo->xDisplayMode = fsDisplayInfo->aquaDisplayMode; - return TRUE; - } - - // If the user has no choice for size, use current - if (darwinDesiredWidth == 0) { - width = CGDisplayPixelsWide(cgID); - height = CGDisplayPixelsHigh(cgID); - } else { - width = darwinDesiredWidth; - height = darwinDesiredHeight; - } - - switch (darwinDesiredDepth) { - case 0: - bpp = 8; - break; - case 1: - bpp = 16; - break; - case 2: - bpp = 32; - break; - default: - bpp = CGDisplayBitsPerPixel(cgID); - } - - if (darwinDesiredRefresh == -1) { - fsDisplayInfo->xDisplayMode = - CGDisplayBestModeForParameters(cgID, bpp, width, height, - &exactMatch); - } else { - fsDisplayInfo->xDisplayMode = - CGDisplayBestModeForParametersAndRefreshRate(cgID, bpp, - width, height, darwinDesiredRefresh, &exactMatch); - } - if (!exactMatch) { - fsDisplayInfo->xDisplayMode = fsDisplayInfo->aquaDisplayMode; - return FALSE; - } - - // Switch to the new display mode - CGDisplaySwitchToMode(cgID, fsDisplayInfo->xDisplayMode); - return TRUE; -} - - -/* - * FSAddScreen - * Do initialization of each screen for Quartz in full screen mode. - */ -static Bool FSAddScreen( - int index, - ScreenPtr pScreen) -{ - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - QuartzScreenPtr displayInfo = QUARTZ_PRIV(pScreen); - CGDirectDisplayID cgID = quartzDisplayList[index]; - CGRect bounds; - FSScreenPtr fsDisplayInfo; - - // Allocate space for private per screen fullscreen specific storage. - fsDisplayInfo = xalloc(sizeof(FSScreenRec)); - FULLSCREEN_PRIV(pScreen) = fsDisplayInfo; - - displayInfo->displayCount = 1; - displayInfo->displayIDs = xrealloc(displayInfo->displayIDs, - 1 * sizeof(CGDirectDisplayID)); - displayInfo->displayIDs[0] = cgID; - - fsDisplayInfo->displayID = cgID; - fsDisplayInfo->xDisplayMode = 0; - fsDisplayInfo->aquaDisplayMode = 0; - fsDisplayInfo->xPalette = 0; - fsDisplayInfo->aquaPalette = 0; - - // Capture full screen because X doesn't like read-only framebuffer. - // We need to do this before we (potentially) switch the display mode. - CGDisplayCapture(cgID); - - if (! FSFindDisplayMode(fsDisplayInfo)) { - ErrorF("Could not support specified display mode on screen %i.\n", - index); - xfree(fsDisplayInfo); - return FALSE; - } - - // Don't need to flip y-coordinate as CoreGraphics treats (0, 0) - // as the top left of main screen. - bounds = CGDisplayBounds(cgID); - dfb->x = bounds.origin.x; - dfb->y = bounds.origin.y; - dfb->width = bounds.size.width; - dfb->height = bounds.size.height; - dfb->pitch = CGDisplayBytesPerRow(cgID); - dfb->bitsPerPixel = CGDisplayBitsPerPixel(cgID); - - if (dfb->bitsPerPixel == 8) { - if (CGDisplayCanSetPalette(cgID)) { - dfb->colorType = PseudoColor; - } else { - dfb->colorType = StaticColor; - } - dfb->bitsPerComponent = 8; - dfb->colorBitsPerPixel = 8; - } else { - dfb->colorType = TrueColor; - dfb->bitsPerComponent = CGDisplayBitsPerSample(cgID); - dfb->colorBitsPerPixel = CGDisplaySamplesPerPixel(cgID) * - dfb->bitsPerComponent; - } - - fsDisplayInfo->framebuffer = CGDisplayBaseAddress(cgID); - - // allocate shadow framebuffer - fsDisplayInfo->shadowPtr = xalloc(dfb->pitch * dfb->height); - dfb->framebuffer = fsDisplayInfo->shadowPtr; - - return TRUE; -} - - -/* - * FSShadowUpdate - * Update the damaged regions of the shadow framebuffer on the display. - */ -static void FSShadowUpdate( - ScreenPtr pScreen, - shadowBufPtr pBuf) -{ - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - FSScreenPtr fsDisplayInfo = FULLSCREEN_PRIV(pScreen); - RegionPtr damage = &pBuf->damage; - int numBox = REGION_NUM_RECTS(damage); - BoxPtr pBox = REGION_RECTS(damage); - int pitch = dfb->pitch; - int bpp = dfb->bitsPerPixel/8; - - // Don't update if the X server is not visible - if (!quartzServerVisible) - return; - - // Loop through all the damaged boxes - while (numBox--) { - int width, height, offset; - unsigned char *src, *dst; - - width = (pBox->x2 - pBox->x1) * bpp; - height = pBox->y2 - pBox->y1; - offset = (pBox->y1 * pitch) + (pBox->x1 * bpp); - src = fsDisplayInfo->shadowPtr + offset; - dst = fsDisplayInfo->framebuffer + offset; - - while (height--) { - memcpy(dst, src, width); - dst += pitch; - src += pitch; - } - - // Get the next box - pBox++; - } -} - - -/* - * FSSetupScreen - * Finalize full screen specific setup of each screen. - */ -static Bool FSSetupScreen( - int index, - ScreenPtr pScreen) -{ - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - FSScreenPtr fsDisplayInfo = FULLSCREEN_PRIV(pScreen); - CGDirectDisplayID cgID = fsDisplayInfo->displayID; - - // Initialize shadow framebuffer support - if (! shadowInit(pScreen, FSShadowUpdate, NULL)) { - ErrorF("Failed to initalize shadow framebuffer for screen %i.\n", - index); - return FALSE; - } - - if (dfb->colorType == PseudoColor) { - // Initialize colormap handling - size_t aquaBpp; - - // If Aqua is using 8 bits we need to keep track of its pallete. - CFNumberGetValue(CFDictionaryGetValue(fsDisplayInfo->aquaDisplayMode, - kCGDisplayBitsPerPixel), kCFNumberLongType, &aquaBpp); - if (aquaBpp <= 8) - fsDisplayInfo->aquaPalette = CGPaletteCreateWithDisplay(cgID); - - pScreen->CreateColormap = FSCreateColormap; - pScreen->DestroyColormap = FSDestroyColormap; - pScreen->InstallColormap = FSInstallColormap; - pScreen->StoreColors = FSStoreColors; - - } - - quartzScreens[quartzNumScreens++] = fsDisplayInfo; - return TRUE; -} - - -/* - * Quartz display mode function list. - */ -static QuartzModeProcsRec fsModeProcs = { - FSDisplayInit, - FSAddScreen, - FSSetupScreen, - NULL, // Not needed - QuartzInitCursor, - QuartzReallySetCursor, - FSSuspendScreen, - FSResumeScreen, - FSCapture, - FSRelease, - NULL, // No dynamic screen change support - NULL, - NULL, - NULL, // No rootless code in fullscreen - NULL, - NULL, - NULL, - NULL, // No support for DRI surfaces - NULL -}; - - -/* - * QuartzModeBundleInit - * Initialize the display mode bundle after loading. - */ -Bool -QuartzModeBundleInit(void) -{ - quartzProcs = &fsModeProcs; - quartzOpenGLBundle = NULL; // Only Mesa support for now - return TRUE; -} diff --git a/hw/darwin/quartz/fullscreen/quartzCursor.c b/hw/darwin/quartz/fullscreen/quartzCursor.c deleted file mode 100644 index 3ffa1c3d8..000000000 --- a/hw/darwin/quartz/fullscreen/quartzCursor.c +++ /dev/null @@ -1,654 +0,0 @@ -/************************************************************** - * - * Support for using the Quartz Window Manager cursor - * - * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker. - * 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "quartz/quartzCommon.h" -#include "quartz/quartzCursor.h" -#include "darwin.h" - -#include <pthread.h> - -#include "mi.h" -#include "scrnintstr.h" -#include "cursorstr.h" -#include "mipointrst.h" -#include "globals.h" - -// Size of the QuickDraw cursor -#define CURSORWIDTH 16 -#define CURSORHEIGHT 16 - -typedef struct { - int qdCursorMode; - int qdCursorVisible; - int useQDCursor; - QueryBestSizeProcPtr QueryBestSize; - miPointerSpriteFuncPtr spriteFuncs; -} QuartzCursorScreenRec, *QuartzCursorScreenPtr; - -static int darwinCursorScreenIndex = -1; -static unsigned long darwinCursorGeneration = 0; -static CursorPtr quartzLatentCursor = NULL; -static QD_Cursor gQDArrow; // QuickDraw arrow cursor - -// Cursor for the main thread to set (NULL = arrow cursor). -static CCrsrHandle currentCursor = NULL; -static pthread_mutex_t cursorMutex; -static pthread_cond_t cursorCondition; - -#define CURSOR_PRIV(pScreen) \ - ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr) - -#define HIDE_QD_CURSOR(pScreen, visible) \ - if (visible) { \ - int ix; \ - for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \ - CGDisplayHideCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \ - } \ - visible = FALSE; \ - } ((void)0) - -#define SHOW_QD_CURSOR(pScreen, visible) \ - { \ - int ix; \ - for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \ - CGDisplayShowCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \ - } \ - visible = TRUE; \ - } ((void)0) - -#define CHANGE_QD_CURSOR(cursorH) \ - if (!quartzServerQuitting) { \ - /* Acquire lock and tell the main thread to change cursor */ \ - pthread_mutex_lock(&cursorMutex); \ - currentCursor = (CCrsrHandle) (cursorH); \ - QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \ - \ - /* Wait for the main thread to change the cursor */ \ - pthread_cond_wait(&cursorCondition, &cursorMutex); \ - pthread_mutex_unlock(&cursorMutex); \ - } ((void)0) - - -/* - * MakeQDCursor helpers: CTAB_ENTER, interleave - */ - -// Add a color entry to a ctab -#define CTAB_ENTER(ctab, index, r, g, b) \ - ctab->ctTable[index].value = index; \ - ctab->ctTable[index].rgb.red = r; \ - ctab->ctTable[index].rgb.green = g; \ - ctab->ctTable[index].rgb.blue = b - -// Make an unsigned short by interleaving the bits of bytes c1 and c2. -// High bit of c1 is first; low bit of c2 is last. -// Interleave is a built-in INTERCAL operator. -static unsigned short -interleave( - unsigned char c1, - unsigned char c2 ) -{ - return - ((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) | - ((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) | - ((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) | - ((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) | - ((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) | - ((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) | - ((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) | - ((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ; -} - -/* - * MakeQDCursor - * Make a QuickDraw color cursor from the given X11 cursor. - * Warning: This code is nasty. Color cursors were meant to be read - * from resources; constructing the structures programmatically is messy. - */ -/* - QuickDraw cursor representation: - Our color cursor is a 2 bit per pixel pixmap. - Each pixel's bits are (source<<1 | mask) from the original X cursor pixel. - The cursor's color table maps the colors like this: - (2-bit value | X result | colortable | Mac result) - 00 | transparent | white | transparent (white outside mask) - 01 | back color | back color | back color - 10 | undefined | black | invert background (just for fun) - 11 | fore color | fore color | fore color -*/ -static CCrsrHandle -MakeQDCursor( - CursorPtr pCursor ) -{ - CCrsrHandle result; - CCrsrPtr curs; - int i, w, h; - unsigned short rowMask; - PixMap *pix; - ColorTable *ctab; - unsigned short *image; - - result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr)); - if (!result) return NULL; - HLock((Handle)result); - curs = *result; - - // Initialize CCrsr - curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color - curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap)); - if (!curs->crsrMap) goto pixAllocFailed; - HLock((Handle)curs->crsrMap); - pix = *curs->crsrMap; - curs->crsrData = NULL; // raw cursor image data (set below) - curs->crsrXData = NULL; // QD's processed data - curs->crsrXValid = 0; // zero means QD must re-process cursor data - curs->crsrXHandle = NULL; // reserved - memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data - memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask - curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot - curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot - curs->crsrXTable = 0; // reserved - curs->crsrID = GetCTSeed(); // unique ID from Color Manager - - // Set the b&w data and mask - w = min(pCursor->bits->width, CURSORWIDTH); - h = min(pCursor->bits->height, CURSORHEIGHT); - rowMask = ~((1 << (CURSORWIDTH - w)) - 1); - for (i = 0; i < h; i++) { - curs->crsr1Data[i] = rowMask & - ((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]); - curs->crsrMask[i] = rowMask & - ((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]); - } - - // Set the color data and mask - // crsrMap: defines bit depth and size and colortable only - pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap - SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020 - pix->pixelSize = 2; - pix->cmpCount = 1; - pix->cmpSize = 2; - // pix->pmTable set below - - // crsrData is the pixel data. crsrMap's baseAddr is not used. - curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8); - if (!curs->crsrData) goto imageAllocFailed; - HLock((Handle)curs->crsrData); - image = (unsigned short *) *curs->crsrData; - // Pixel data is just 1-bit data and mask interleaved (see above) - for (i = 0; i < h; i++) { - unsigned char s, m; - s = pCursor->bits->source[i*4] & (rowMask >> 8); - m = pCursor->bits->mask[i*4] & (rowMask >> 8); - image[2*i] = interleave(s, m); - s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff); - m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff); - image[2*i+1] = interleave(s, m); - } - - // Build the color table (entries described above) - // NewPixMap allocates a color table handle. - pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3 - * sizeof(ColorSpec)); - if (!pix->pmTable) goto ctabAllocFailed; - HLock((Handle)pix->pmTable); - ctab = *pix->pmTable; - ctab->ctSeed = GetCTSeed(); - ctab->ctFlags = 0; - ctab->ctSize = 3; // color count - 1 - CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff); - CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen, - pCursor->backBlue); - CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000); - CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen, - pCursor->foreBlue); - - HUnlock((Handle)pix->pmTable); // ctab - HUnlock((Handle)curs->crsrData); // image data - HUnlock((Handle)curs->crsrMap); // pix - HUnlock((Handle)result); // cursor - - return result; - - // "What we have here is a failure to allocate" -ctabAllocFailed: - HUnlock((Handle)curs->crsrData); - DisposeHandle((Handle)curs->crsrData); -imageAllocFailed: - HUnlock((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrMap); -pixAllocFailed: - HUnlock((Handle)result); - DisposeHandle((Handle)result); - return NULL; -} - - -/* - * FreeQDCursor - * Destroy a QuickDraw color cursor created with MakeQDCursor(). - * The cursor must not currently be on screen. - */ -static void FreeQDCursor(CCrsrHandle cursHandle) -{ - CCrsrPtr curs; - PixMap *pix; - - HLock((Handle)cursHandle); - curs = *cursHandle; - HLock((Handle)curs->crsrMap); - pix = *curs->crsrMap; - DisposeHandle((Handle)pix->pmTable); - HUnlock((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrMap); - DisposeHandle((Handle)curs->crsrData); - HUnlock((Handle)cursHandle); - DisposeHandle((Handle)cursHandle); -} - - -/* -=========================================================================== - - Pointer sprite functions - -=========================================================================== -*/ - -/* - * QuartzRealizeCursor - * Convert the X cursor representation to QuickDraw format if possible. - */ -Bool -QuartzRealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor ) -{ - CCrsrHandle qdCursor; - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if(!pCursor || !pCursor->bits) - return FALSE; - - // if the cursor is too big we use a software cursor - if ((pCursor->bits->height > CURSORHEIGHT) || - (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor) - { - if (quartzRootless) { - // rootless can't use a software cursor - return TRUE; - } else { - return (*ScreenPriv->spriteFuncs->RealizeCursor) - (pScreen, pCursor); - } - } - - // make new cursor image - qdCursor = MakeQDCursor(pCursor); - if (!qdCursor) return FALSE; - - // save the result - pCursor->devPriv[pScreen->myNum] = (pointer) qdCursor; - - return TRUE; -} - - -/* - * QuartzUnrealizeCursor - * Free the storage space associated with a realized cursor. - */ -Bool -QuartzUnrealizeCursor( - ScreenPtr pScreen, - CursorPtr pCursor ) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if ((pCursor->bits->height > CURSORHEIGHT) || - (pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor) - { - if (quartzRootless) { - return TRUE; - } else { - return (*ScreenPriv->spriteFuncs->UnrealizeCursor) - (pScreen, pCursor); - } - } else { - CCrsrHandle oldCursor = (CCrsrHandle) pCursor->devPriv[pScreen->myNum]; - - if (currentCursor != oldCursor) { - // This should only fail when quitting, in which case we just leak. - FreeQDCursor(oldCursor); - } - pCursor->devPriv[pScreen->myNum] = NULL; - return TRUE; - } -} - - -/* - * QuartzSetCursor - * Set the cursor sprite and position. - * Use QuickDraw cursor if possible. - */ -static void -QuartzSetCursor( - ScreenPtr pScreen, - CursorPtr pCursor, - int x, - int y) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - quartzLatentCursor = pCursor; - - // Don't touch Mac OS cursor if X is hidden! - if (!quartzServerVisible) - return; - - if (!pCursor) { - // Remove the cursor completely. - HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - if (! ScreenPriv->qdCursorMode) - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - } - else if ((pCursor->bits->height <= CURSORHEIGHT) && - (pCursor->bits->width <= CURSORWIDTH) && ScreenPriv->useQDCursor) - { - // Cursor is small enough to use QuickDraw directly. - if (! ScreenPriv->qdCursorMode) // remove the X cursor - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); - ScreenPriv->qdCursorMode = TRUE; - - CHANGE_QD_CURSOR(pCursor->devPriv[pScreen->myNum]); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - } - else if (quartzRootless) { - // Rootless can't use a software cursor, so we just use Mac OS arrow. - CHANGE_QD_CURSOR(NULL); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - } - else { - // Cursor is too big for QuickDraw. Use X software cursor. - HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); - ScreenPriv->qdCursorMode = FALSE; - (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y); - } -} - - -/* - * QuartzReallySetCursor - * Set the QuickDraw cursor. Called from the main thread since changing the - * cursor with QuickDraw is not thread safe on dual processor machines. - */ -void -QuartzReallySetCursor() -{ - pthread_mutex_lock(&cursorMutex); - - if (currentCursor) { - SetCCursor(currentCursor); - } else { - SetCursor(&gQDArrow); - } - - pthread_cond_signal(&cursorCondition); - pthread_mutex_unlock(&cursorMutex); -} - - -/* - * QuartzMoveCursor - * Move the cursor. This is a noop for QuickDraw. - */ -static void -QuartzMoveCursor( - ScreenPtr pScreen, - int x, - int y) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - // only the X cursor needs to be explicitly moved - if (!ScreenPriv->qdCursorMode) - (*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y); -} - - -static miPointerSpriteFuncRec quartzSpriteFuncsRec = { - QuartzRealizeCursor, - QuartzUnrealizeCursor, - QuartzSetCursor, - QuartzMoveCursor -}; - - -/* -=========================================================================== - - Pointer screen functions - -=========================================================================== -*/ - -/* - * QuartzCursorOffScreen - */ -static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y) -{ - return FALSE; -} - - -/* - * QuartzCrossScreen - */ -static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering) -{ - return; -} - - -/* - * QuartzWarpCursor - * Change the cursor position without generating an event or motion history. - * The input coordinates (x,y) are in pScreen-local X11 coordinates. - * - */ -static void -QuartzWarpCursor( - ScreenPtr pScreen, - int x, - int y) -{ - static int neverMoved = TRUE; - - if (neverMoved) { - // Don't move the cursor the first time. This is the jump-to-center - // initialization, and it's annoying because we may still be in MacOS. - neverMoved = FALSE; - return; - } - - if (quartzServerVisible) { - CGDisplayErr cgErr; - CGPoint cgPoint; - // Only need to do this for one display. Any display will do. - CGDirectDisplayID cgID = QUARTZ_PRIV(pScreen)->displayIDs[0]; - CGRect cgRect = CGDisplayBounds(cgID); - - // Convert (x,y) to CoreGraphics screen-local CG coordinates. - // This is necessary because the X11 screen and CG screen may not - // coincide. (e.g. X11 screen may be moved to dodge the menu bar) - - // Make point in X11 global coordinates - cgPoint = CGPointMake(x + dixScreenOrigins[pScreen->myNum].x, - y + dixScreenOrigins[pScreen->myNum].y); - // Shift to CoreGraphics global screen coordinates - cgPoint.x += darwinMainScreenX; - cgPoint.y += darwinMainScreenY; - // Shift to CoreGraphics screen-local coordinates - cgPoint.x -= cgRect.origin.x; - cgPoint.y -= cgRect.origin.y; - - cgErr = CGDisplayMoveCursorToPoint(cgID, cgPoint); - if (cgErr != CGDisplayNoErr) { - ErrorF("Could not set cursor position with error code 0x%x.\n", - cgErr); - } - } - - miPointerWarpCursor(pScreen, x, y); - miPointerUpdate(); -} - - -static miPointerScreenFuncRec quartzScreenFuncsRec = { - QuartzCursorOffScreen, - QuartzCrossScreen, - QuartzWarpCursor, - DarwinEQPointerPost, - DarwinEQSwitchScreen -}; - - -/* -=========================================================================== - - Other screen functions - -=========================================================================== -*/ - -/* - * QuartzCursorQueryBestSize - * Handle queries for best cursor size - */ -static void -QuartzCursorQueryBestSize( - int class, - unsigned short *width, - unsigned short *height, - ScreenPtr pScreen) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - if (class == CursorShape) { - *width = CURSORWIDTH; - *height = CURSORHEIGHT; - } else { - (*ScreenPriv->QueryBestSize)(class, width, height, pScreen); - } -} - - -/* - * QuartzInitCursor - * Initialize cursor support - */ -Bool -QuartzInitCursor( - ScreenPtr pScreen ) -{ - QuartzCursorScreenPtr ScreenPriv; - miPointerScreenPtr PointPriv; - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - - // initialize software cursor handling (always needed as backup) - if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) { - return FALSE; - } - - // allocate private storage for this screen's QuickDraw cursor info - if (darwinCursorGeneration != serverGeneration) { - if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - darwinCursorGeneration = serverGeneration; - } - - ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) ); - if (!ScreenPriv) return FALSE; - - CURSOR_PRIV(pScreen) = ScreenPriv; - - // override some screen procedures - ScreenPriv->QueryBestSize = pScreen->QueryBestSize; - pScreen->QueryBestSize = QuartzCursorQueryBestSize; - - // initialize QuickDraw cursor handling - GetQDGlobalsArrow(&gQDArrow); - PointPriv = (miPointerScreenPtr) - pScreen->devPrivates[miPointerScreenIndex].ptr; - - ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; - PointPriv->spriteFuncs = &quartzSpriteFuncsRec; - - if (!quartzRootless) - ScreenPriv->useQDCursor = QuartzFSUseQDCursor(dfb->colorBitsPerPixel); - else - ScreenPriv->useQDCursor = TRUE; - ScreenPriv->qdCursorMode = TRUE; - ScreenPriv->qdCursorVisible = TRUE; - - // initialize cursor mutex lock - pthread_mutex_init(&cursorMutex, NULL); - - // initialize condition for waiting - pthread_cond_init(&cursorCondition, NULL); - - return TRUE; -} - - -// X server is hiding. Restore the Aqua cursor. -void QuartzSuspendXCursor( - ScreenPtr pScreen ) -{ - QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen); - - CHANGE_QD_CURSOR(NULL); - SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); -} - - -// X server is showing. Restore the X cursor. -void QuartzResumeXCursor( - ScreenPtr pScreen, - int x, - int y ) -{ - QuartzSetCursor(pScreen, quartzLatentCursor, x, y); -} diff --git a/hw/darwin/quartz/xpr/Makefile.am b/hw/darwin/quartz/xpr/Makefile.am deleted file mode 100644 index 8980ad7d3..000000000 --- a/hw/darwin/quartz/xpr/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -noinst_LIBRARIES = libxpr.a -AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) -AM_CPPFLAGS = \ - -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../.. \ - -I$(top_srcdir)/miext \ - -I$(top_srcdir)/miext/rootless \ - -I$(top_srcdir)/miext/rootless/safeAlpha - -libxpr_a_SOURCES = \ - appledri.c \ - dri.c \ - xprAppleWM.c \ - xprCursor.c \ - xprFrame.c \ - xprScreen.c \ - x-hash.c \ - x-hook.c \ - x-list.c - -EXTRA_DIST = \ - dri.h \ - dristruct.h \ - appledri.h \ - appledristr.h \ - x-hash.h \ - x-hook.h \ - x-list.h \ - Xplugin.h \ - xpr.h diff --git a/hw/darwin/quartz/xpr/Xplugin.h b/hw/darwin/quartz/xpr/Xplugin.h deleted file mode 100644 index a10b1b8e1..000000000 --- a/hw/darwin/quartz/xpr/Xplugin.h +++ /dev/null @@ -1,589 +0,0 @@ -/* Xplugin.h -- windowing API for rootless X11 server - - Copyright (c) 2002 Apple Computer, 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 and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT - HOLDER(S) 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(s) of the above - copyright holders shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software without - prior written authorization. - - Note that these interfaces are provided solely for the use of the - X11 server. Any other uses are unsupported and strongly discouraged. */ - -#ifndef XPLUGIN_H -#define XPLUGIN_H 1 - -#include <stdint.h> - -/* By default we use the X server definition of BoxRec to define xp_box, - so that the compiler can silently convert between the two. But if - XP_NO_X_HEADERS is defined, we'll define it ourselves. */ - -#ifndef XP_NO_X_HEADERS -# include "miscstruct.h" - typedef BoxRec xp_box; -#else - struct xp_box_struct { - short x1, y1, x2, y2; - }; - typedef struct xp_box_struct xp_box; -#endif - -typedef unsigned int xp_resource_id; -typedef xp_resource_id xp_window_id; -typedef xp_resource_id xp_surface_id; -typedef unsigned int xp_client_id; -typedef unsigned int xp_request_type; -typedef int xp_error; -typedef int xp_bool; - - -/* Error codes that the functions declared here may return. They all - numerically match their X equivalents, i.e. the XP_ can be dropped - if <X11/X.h> has been included. */ - -enum xp_error_enum { - XP_Success = 0, - XP_BadRequest = 1, - XP_BadValue = 2, - XP_BadWindow = 3, - XP_BadMatch = 8, - XP_BadAccess = 10, - XP_BadImplementation = 17, -}; - - -/* Event types generated by the plugin. */ - -enum xp_event_type_enum { - /* The global display configuration changed somehow. */ - XP_EVENT_DISPLAY_CHANGED = 1 << 0, - - /* A window changed state. Argument is xp_window_state_event */ - XP_EVENT_WINDOW_STATE_CHANGED = 1 << 1, - - /* An async request encountered an error. Argument is of type - xp_async_error_event */ - XP_EVENT_ASYNC_ERROR = 1 << 2, - - /* Sent when a surface is destroyed as a side effect of destroying - a window. Arg is of type xp_surface_id. */ - XP_EVENT_SURFACE_DESTROYED = 1 << 3, - - /* Sent when any GL contexts pointing at the given surface need to - call xp_update_gl_context () to refresh their state (because the - window moved or was resized. Arg is of type xp_surface_id. */ - XP_EVENT_SURFACE_CHANGED = 1 << 4, - - /* Sent when a window has been moved. Arg is of type xp_window_id. */ - XP_EVENT_WINDOW_MOVED = 1 << 5, -}; - -/* Function type used to receive events. */ - -typedef void (xp_event_fun) (unsigned int type, const void *arg, - unsigned int arg_size, void *user_data); - - -/* Operation types. Used when reporting errors asynchronously. */ - -enum xp_request_type_enum { - XP_REQUEST_NIL = 0, - XP_REQUEST_DESTROY_WINDOW = 1, - XP_REQUEST_CONFIGURE_WINDOW = 2, - XP_REQUEST_FLUSH_WINDOW = 3, - XP_REQUEST_COPY_WINDOW = 4, - XP_REQUEST_UNLOCK_WINDOW = 5, - XP_REQUEST_DISABLE_UPDATE = 6, - XP_REQUEST_REENABLE_UPDATE = 7, - XP_REQUEST_HIDE_CURSOR = 8, - XP_REQUEST_SHOW_CURSOR = 9, - XP_REQUEST_FRAME_DRAW = 10, -}; - -/* Structure used to report an error asynchronously. Passed as the "arg" - of an XP_EVENT_ASYNC_ERROR event. */ - -struct xp_async_error_event_struct { - xp_request_type request_type; - xp_resource_id id; - xp_error error; -}; - -typedef struct xp_async_error_event_struct xp_async_error_event; - - -/* Possible window states. */ - -enum xp_window_state_enum { - /* The window is not in the global list of possibly-visible windows. */ - XP_WINDOW_STATE_OFFSCREEN = 1 << 0, - - /* Parts of the window may be obscured by other windows. */ - XP_WINDOW_STATE_OBSCURED = 1 << 1, -}; - -/* Structure passed as argument of an XP_EVENT_WINDOW_STATE_CHANGED event. */ - -struct xp_window_state_event_struct { - xp_window_id id; - unsigned int state; -}; - -typedef struct xp_window_state_event_struct xp_window_state_event; - - -/* Function type used to supply a colormap for indexed drawables. */ - -typedef xp_error (xp_colormap_fun) (void *data, int first_color, - int n_colors, uint32_t *colors); - - -/* Window attributes structure. Used when creating and configuring windows. - Also used when configuring surfaces attached to windows. Functions that - take one of these structures also take a bit mask defining which - fields are set to meaningful values. */ - -enum xp_window_changes_enum { - XP_ORIGIN = 1 << 0, - XP_SIZE = 1 << 1, - XP_BOUNDS = XP_ORIGIN | XP_SIZE, - XP_SHAPE = 1 << 2, - XP_STACKING = 1 << 3, - XP_DEPTH = 1 << 4, - XP_COLORMAP = 1 << 5, - XP_WINDOW_LEVEL = 1 << 6, -}; - -struct xp_window_changes_struct { - /* XP_ORIGIN */ - int x, y; - - /* XP_SIZE */ - unsigned int width, height; - int bit_gravity; /* how to resize the backing store */ - - /* XP_SHAPE */ - int shape_nrects; /* -1 = remove shape */ - xp_box *shape_rects; - int shape_tx, shape_ty; /* translation for shape */ - - /* XP_STACKING */ - int stack_mode; - xp_window_id sibling; /* may be zero; in ABOVE/BELOW modes - it may specify a relative window */ - /* XP_DEPTH, window-only */ - unsigned int depth; - - /* XP_COLORMAP, window-only */ - xp_colormap_fun *colormap; - void *colormap_data; - - /* XP_WINDOW_LEVEL, window-only */ - int window_level; -}; - -typedef struct xp_window_changes_struct xp_window_changes; - -/* Values for bit_gravity field */ - -enum xp_bit_gravity_enum { - XP_GRAVITY_NONE = 0, /* no gravity, fill everything */ - XP_GRAVITY_NORTH_WEST = 1, /* anchor to top-left corner */ - XP_GRAVITY_NORTH_EAST = 2, /* anchor to top-right corner */ - XP_GRAVITY_SOUTH_EAST = 3, /* anchor to bottom-right corner */ - XP_GRAVITY_SOUTH_WEST = 4, /* anchor to bottom-left corner */ -}; - -/* Values for stack_mode field */ - -enum xp_window_stack_mode_enum { - XP_UNMAPPED = 0, /* remove the window */ - XP_MAPPED_ABOVE = 1, /* display the window on top */ - XP_MAPPED_BELOW = 2, /* display the window at bottom */ -}; - -/* Data formats for depth field and composite functions */ - -enum xp_depth_enum { - XP_DEPTH_NIL = 0, /* null source when compositing */ - XP_DEPTH_ARGB8888, - XP_DEPTH_RGB555, - XP_DEPTH_A8, /* for masks when compositing */ - XP_DEPTH_INDEX8, -}; - -/* Options that may be passed to the xp_init () function. */ - -enum xp_init_options_enum { - /* Don't mark that this process can be in the foreground. */ - XP_IN_BACKGROUND = 1 << 0, - - /* Deliver background pointer events to this process. */ - XP_BACKGROUND_EVENTS = 1 << 1, -}; - - - -/* Miscellaneous functions */ - -/* Initialize the plugin library. Only the copy/fill/composite functions - may be called without having previously called xp_init () */ - -extern xp_error xp_init (unsigned int options); - -/* Sets the current set of requested notifications to MASK. When any of - these arrive, CALLBACK will be invoked with CALLBACK-DATA. Note that - calling this function cancels any previously requested notifications - that aren't set in MASK. */ - -extern xp_error xp_select_events (unsigned int mask, - xp_event_fun *callback, - void *callback_data); - -/* Waits for all initiated operations to complete. */ - -extern xp_error xp_synchronize (void); - -/* Causes any display update initiated through the plugin libary to be - queued until update is reenabled. Note that calls to these functions - nest. */ - -extern xp_error xp_disable_update (void); -extern xp_error xp_reenable_update (void); - - - -/* Cursor functions. */ - -/* Installs the specified cursor. ARGB-DATA should point to 32-bit - premultiplied big-endian ARGB data. The HOT-X,HOT-Y parameters - specify the offset to the cursor's hot spot from its top-left - corner. */ - -extern xp_error xp_set_cursor (unsigned int width, unsigned int height, - unsigned int hot_x, unsigned int hot_y, - const uint32_t *argb_data, - unsigned int rowbytes); - -/* Hide and show the cursor if it's owned by the current process. Calls - to these functions nest. */ - -extern xp_error xp_hide_cursor (void); -extern xp_error xp_show_cursor (void); - - - -/* Window functions. */ - -/* Create a new window as defined by MASK and VALUES. MASK must contain - XP_BOUNDS or an error is raised. The id of the newly created window - is stored in *RET-ID if this function returns XP_Success. */ - -extern xp_error xp_create_window (unsigned int mask, - const xp_window_changes *values, - xp_window_id *ret_id); - -/* Destroys the window identified by ID. */ - -extern xp_error xp_destroy_window (xp_window_id id); - -/* Reconfigures the given window according to MASK and VALUES. */ - -extern xp_error xp_configure_window (xp_window_id id, unsigned int mask, - const xp_window_changes *values); - - -/* Returns true if NATIVE-ID is a window created by the plugin library. - If so and RET-ID is non-null, stores the id of the window in *RET-ID. */ - -extern xp_bool xp_lookup_native_window (unsigned int native_id, - xp_window_id *ret_id); - -/* If ID names a window created by the plugin library, stores it's native - window id in *RET-NATIVE-ID. */ - -extern xp_error xp_get_native_window (xp_window_id id, - unsigned int *ret_native_id); - - -/* Locks the rectangle IN-RECT (or, if null, the entire window) of the - given window's backing store. Any other non-null parameters are filled - in as follows: - - DEPTH = format of returned data. Currently either XP_DEPTH_ARGB8888 - or XP_DEPTH_RGB565 (possibly with 8 bit planar alpha). Data is - always stored in native byte order. - - BITS[0] = pointer to top-left pixel of locked color data - BITS[1] = pointer to top-left of locked alpha data, or null if window - has no alpha. If the alpha data is meshed, then BITS[1] = BITS[0]. - - ROWBYTES[0,1] = size in bytes of each row of color,alpha data - - OUT-RECT = rectangle specifying the current position and size of the - locked region relative to the window origin. - - Note that an error is raised when trying to lock an already locked - window. While the window is locked, the only operations that may - be performed on it are to modify, access or flush its marked region. */ - -extern xp_error xp_lock_window (xp_window_id id, - const xp_box *in_rect, - unsigned int *depth, - void *bits[2], - unsigned int rowbytes[2], - xp_box *out_rect); - -/* Mark that the region specified by SHAPE-NRECTS, SHAPE-RECTS, - SHAPE-TX, and SHAPE-TY in the specified window has been updated, and - will need to subsequently be redisplayed. */ - -extern xp_error xp_mark_window (xp_window_id id, int shape_nrects, - const xp_box *shape_rects, - int shape_tx, int shape_ty); - -/* Unlocks the specified window. If FLUSH is true, then any marked - regions are immediately redisplayed. Note that it's an error to - unlock an already unlocked window. */ - -extern xp_error xp_unlock_window (xp_window_id id, xp_bool flush); - -/* If anything is marked in the given window for redisplay, do it now. */ - -extern xp_error xp_flush_window (xp_window_id id); - -/* Moves the contents of the region DX,DY pixels away from that specified - by DST_RECTS and DST_NRECTS in the window with SRC-ID to the - destination region in the window DST-ID. Note that currently source - and destination windows must be the same. */ - -extern xp_error xp_copy_window (xp_window_id src_id, xp_window_id dst_id, - int dst_nrects, const xp_box *dst_rects, - int dx, int dy); - -/* Returns true if the given window has any regions marked for - redisplay. */ - -extern xp_bool xp_is_window_marked (xp_window_id id); - -/* If successful returns a superset of the region marked for update in - the given window. Use xp_free_region () to release the returned data. */ - -extern xp_error xp_get_marked_shape (xp_window_id id, - int *ret_nrects, xp_box **ret_rects); - -extern void xp_free_shape (int nrects, xp_box *rects); - -/* Searches for the first window below ABOVE-ID containing the point X,Y, - and returns it's window id in *RET-ID. If no window is found, *RET-ID - is set to zero. If ABOVE-ID is zero, finds the topmost window - containing the given point. */ - -extern xp_error xp_find_window (int x, int y, xp_window_id above_id, - xp_window_id *ret_id); - -/* Returns the current origin and size of the window ID in *BOUNDS-RET if - successful. */ -extern xp_error xp_get_window_bounds (xp_window_id id, xp_box *bounds_ret); - - - -/* Window surface functions. */ - -/* Create a new VRAM surface on the specified window. If successful, - returns the identifier of the new surface in *RET-SID. */ - -extern xp_error xp_create_surface (xp_window_id id, xp_surface_id *ret_sid); - -/* Destroys the specified surface. */ - -extern xp_error xp_destroy_surface (xp_surface_id sid); - -/* Reconfigures the specified surface as defined by MASK and VALUES. - Note that specifying XP_DEPTH is an error. */ - -extern xp_error xp_configure_surface (xp_surface_id sid, unsigned int mask, - const xp_window_changes *values); - -/* If successful, places the client identifier of the current process - in *RET-CLIENT. */ - -extern xp_error xp_get_client_id (xp_client_id *ret_client); - -/* Given a valid window,surface combination created by the current - process, attempts to allow the specified external client access - to that surface. If successful, returns two integers in RET-KEY - which the client can use to import the surface into their process. */ - -extern xp_error xp_export_surface (xp_window_id wid, xp_surface_id sid, - xp_client_id client, - unsigned int ret_key[2]); - -/* Given a two integer key returned from xp_export_surface (), tries - to import the surface into the current process. If successful the - local surface identifier is stored in *SID-RET. */ - -extern xp_error xp_import_surface (const unsigned int key[2], - xp_surface_id *sid_ret); - -/* If successful, stores the number of surfaces attached to the - specified window in *RET. */ - -extern xp_error xp_get_window_surface_count (xp_window_id id, - unsigned int *ret); - -/* Attaches the CGLContextObj CGL-CTX to the specified surface. */ - -extern xp_error xp_attach_gl_context (void *cgl_ctx, xp_surface_id sid); - -/* Updates the CGLContextObj CGL-CTX to reflect any recent changes to - the surface it's attached to. */ - -extern xp_error xp_update_gl_context (void *cgl_ctx); - - - -/* Window frame functions. */ - -/* Possible arguments to xp_frame_get_rect (). */ - -enum xp_frame_rect_enum { - XP_FRAME_RECT_TITLEBAR = 1, - XP_FRAME_RECT_TRACKING = 2, - XP_FRAME_RECT_GROWBOX = 3, -}; - -/* Classes of window frame. */ - -enum xp_frame_class_enum { - XP_FRAME_CLASS_DOCUMENT = 1 << 0, - XP_FRAME_CLASS_DIALOG = 1 << 1, - XP_FRAME_CLASS_MODAL_DIALOG = 1 << 2, - XP_FRAME_CLASS_SYSTEM_MODAL_DIALOG = 1 << 3, - XP_FRAME_CLASS_UTILITY = 1 << 4, - XP_FRAME_CLASS_TOOLBAR = 1 << 5, - XP_FRAME_CLASS_MENU = 1 << 6, - XP_FRAME_CLASS_SPLASH = 1 << 7, - XP_FRAME_CLASS_BORDERLESS = 1 << 8, -}; - -/* Attributes of window frames. */ - -enum xp_frame_attr_enum { - XP_FRAME_ACTIVE = 0x0001, - XP_FRAME_URGENT = 0x0002, - XP_FRAME_TITLE = 0x0004, - XP_FRAME_PRELIGHT = 0x0008, - XP_FRAME_SHADED = 0x0010, - XP_FRAME_CLOSE_BOX = 0x0100, - XP_FRAME_COLLAPSE = 0x0200, - XP_FRAME_ZOOM = 0x0400, - XP_FRAME_ANY_BUTTON = 0x0700, - XP_FRAME_CLOSE_BOX_CLICKED = 0x0800, - XP_FRAME_COLLAPSE_BOX_CLICKED = 0x1000, - XP_FRAME_ZOOM_BOX_CLICKED = 0x2000, - XP_FRAME_ANY_CLICKED = 0x3800, - XP_FRAME_GROW_BOX = 0x4000, -}; - -#define XP_FRAME_ATTR_IS_SET(a,b) (((a) & (b)) == (b)) -#define XP_FRAME_ATTR_IS_CLICKED(a,m) ((a) & ((m) << 3)) -#define XP_FRAME_ATTR_SET_CLICKED(a,m) ((a) |= ((m) << 3)) -#define XP_FRAME_ATTR_UNSET_CLICKED(a,m) ((a) &= ~((m) << 3)) - -#define XP_FRAME_POINTER_ATTRS (XP_FRAME_PRELIGHT \ - | XP_FRAME_ANY_BUTTON \ - | XP_FRAME_ANY_CLICKED) - -extern xp_error xp_frame_get_rect (int type, int class, const xp_box *outer, - const xp_box *inner, xp_box *ret); -extern xp_error xp_frame_hit_test (int class, int x, int y, - const xp_box *outer, - const xp_box *inner, int *ret); -extern xp_error xp_frame_draw (xp_window_id wid, int class, unsigned int attr, - const xp_box *outer, const xp_box *inner, - unsigned int title_len, - const unsigned char *title_bytes); - - - -/* Memory manipulation functions. */ - -enum xp_composite_op_enum { - XP_COMPOSITE_SRC = 0, - XP_COMPOSITE_OVER, -}; - -#define XP_COMPOSITE_FUNCTION(op, src_depth, mask_depth, dest_depth) \ - (((op) << 24) | ((src_depth) << 16) \ - | ((mask_depth) << 8) | ((dest_depth) << 0)) - -#define XP_COMPOSITE_FUNCTION_OP(f) (((f) >> 24) & 255) -#define XP_COMPOSITE_FUNCTION_SRC_DEPTH(f) (((f) >> 16) & 255) -#define XP_COMPOSITE_FUNCTION_MASK_DEPTH(f) (((f) >> 8) & 255) -#define XP_COMPOSITE_FUNCTION_DEST_DEPTH(f) (((f) >> 0) & 255) - -/* Composite WIDTH by HEIGHT pixels from source and mask to destination - using a specified function (if source and destination overlap, - undefined behavior results). - - For SRC and DEST, the first element of the array is the color data. If - the second element is non-null it implies that there is alpha data - (which may be meshed or planar). Data without alpha is assumed to be - opaque. - - Passing a null SRC-ROWBYTES pointer implies that the data SRC points - to is a single element. - - Operations that are not supported will return XP_BadImplementation. */ - -extern xp_error xp_composite_pixels (unsigned int width, unsigned int height, - unsigned int function, - void *src[2], unsigned int src_rowbytes[2], - void *mask, unsigned int mask_rowbytes, - void *dest[2], unsigned int dest_rowbytes[2]); - -/* Fill HEIGHT rows of data starting at DST. Each row will have WIDTH - bytes filled with the 32-bit pattern VALUE. Each row is DST-ROWBYTES - wide in total. */ - -extern void xp_fill_bytes (unsigned int width, - unsigned int height, uint32_t value, - void *dst, unsigned int dst_rowbytes); - -/* Copy HEIGHT rows of bytes from SRC to DST. Each row will have WIDTH - bytes copied. SRC and DST may overlap, and the right thing will happen. */ - -extern void xp_copy_bytes (unsigned int width, unsigned int height, - const void *src, unsigned int src_rowbytes, - void *dst, unsigned int dst_rowbytes); - -/* Suggestions for the minimum number of bytes or pixels for which it - makes sense to use some of the xp_ functions */ - -extern unsigned int xp_fill_bytes_threshold, xp_copy_bytes_threshold, - xp_composite_area_threshold, xp_scroll_area_threshold; - - -#endif /* XPLUGIN_H */ diff --git a/hw/darwin/utils/Makefile.am b/hw/darwin/utils/Makefile.am deleted file mode 100644 index 911e14d53..000000000 --- a/hw/darwin/utils/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -bin_PROGRAMS = dumpkeymap - -dumpkeymap_SOURCES = dumpkeymap.c - -dumpkeymap_LDFLAGS = -Wl,-framework,IOKit - -man1_MANS = dumpkeymap.man - -EXTRA_DIST = \ - README.txt \ - dumpkeymap.man diff --git a/hw/darwin/utils/README.txt b/hw/darwin/utils/README.txt deleted file mode 100644 index 1dd64794e..000000000 --- a/hw/darwin/utils/README.txt +++ /dev/null @@ -1,107 +0,0 @@ -dumpkeymap - Diagnostic dump and detailed description of .keymapping files -Version 4 - -Copyright (C)1999,2000 by Eric Sunshine <sunshine@sunshineco.com> -Eric Sunshine, 1 December 2000 - -OVERVIEW -======== -This package contains the diagnostic utility dumpkeymap, as well as highly -detailed documentation describing the internal layout of the Apple/NeXT -.keymapping file. - -The dumpkeymap utility displays detailed information about each .keymapping -file mentioned on the command-line. On Apple and NeXT platforms, if no -.keymapping files are mentioned on the command-line, then it will instead -dissect the key mapping currently in use by the WindowServer and AppKit. - -Documentation includes a thorough and detailed description of the internal -layout of the .keymapping file, as well as an explanation of how to interpret -the output of dumpkeymap. - -The complete set of documentation is available for perusal via dumpkeymap's -manual page (dumpkeymap.1), as well as via the command-line options described -below. - - --help - Usage summary. - --help-keymapping - Detailed discussion of the internal format of a .keymapping file. - --help-output - Explanation of dumpkeymap's output. - --help-files - List of key mapping-related files and directories. - --help-diagnostics - Explanation of diagnostic messages. - -Once the manual page is been installed, documentation can also be accessed -with the Unix `man' command: - - % man dumpkeymap - - -COMPILATION -=========== -MacOS/X, Darwin - - cc -Wall -o dumpkeymap dumpkeymap.c -framework IOKit - -MacOS/X DP4 (Developer Preview 4) - - cc -Wall -o dumpkeymap dumpkeymap.c -FKernel -framework IOKit - -MacOS/X Server, OpenStep, NextStep - - cc -Wall -o dumpkeymap dumpkeymap.c - -By default, dumpkeymap is configured to interface with the HID driver (Apple) -or event-status driver (NeXT), thus allowing it to dump the key mapping which -is currently in use by the WindowServer and AppKit. However, these facilities -are specific to Apple/NeXT. In order to build dumpkeymap for non-Apple/NeXT -platforms, you must define the DUMPKEYMAP_FILE_ONLY flag when compiling the -program. This flag inhibits use of the HID and event-status drivers and -configures dumpkeymap to work strictly with raw key mapping files. - -For example, to compile for Linux: - - gcc -Wall -DDUMPKEYMAP_FILE_ONLY -o dumpkeymap dumpkeymap.c - - -INSTALLATION -============ -Install the dumpkeymap executable image in a location mentioned in the PATH -environment variable. Typicall locations for executable files are: - - /usr/local/bin - $(HOME)/bin - -Install the manual page, dumpkeymap.1, in the `man1' subdirectory one of the -standard manual page locations or in any other location mentioned by the -MANPATH environment variable. - -Typical locations for manual pages on most Unix platforms are: - - /usr/local/man/man1 - -Typical locations for manual pages on MacOS/X, Darwin, and MacOS/X Server are: - - /usr/local/man/man1 - /Local/Documentation/ManPages/man1 - /Network/Documentation/ManPages/man1 - -Typical locations for manual pages on OpenStep and NextStep are: - - /usr/local/man/man1 - /LocalLibrary/Documentation/ManPages/man1 - /LocalDeveloper/Documentation/ManPages/man1 - - -CONCLUSION -========== -This program and its accompanying documentation were written by Eric Sunshine -and are copyright (C)1999,2000 by Eric Sunshine <sunshine@sunshineco.com>. - -The implementation of dumpkeymap is based upon information gathered on -September 3, 1997 by Eric Sunshine <sunshine@sunshineco.com> and Paul S. -McCarthy <zarnuk@zarnuk.com> during an effort to reverse engineer the format -of the NeXT .keymapping file. diff --git a/hw/darwin/utils/dumpkeymap.c b/hw/darwin/utils/dumpkeymap.c deleted file mode 100644 index 0c8bdcd01..000000000 --- a/hw/darwin/utils/dumpkeymap.c +++ /dev/null @@ -1,1453 +0,0 @@ -//============================================================================= -// -// Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com> -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 3. The name of the author may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -// NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//============================================================================= -//----------------------------------------------------------------------------- -// dumpkeymap.c -// -// Prints a textual representation of each Apple/NeXT .keymapping file -// mentioned on the command-line. If no files are mentioned and if the -// local machine is an Apple or NeXT installation, then the key mapping -// currently in use by the WindowServer and the AppKit is printed -// instead. -// -// Invoke dumpkeymap with one of the options listed below in order to -// view detailed documentation about .keymapping files and the use of -// this program. -// -// --help: Usage summary. -// --help-keymapping: Detailed discussion of the internal format of a -// .keymapping file. -// --help-output: Explanation of dumpkeymap's output. -// --help-files: List of key mapping-related files and directories. -// --help-diagnostics: Explanation of diagnostic messages. -// -// COMPILATION INSTRUCTIONS -// -// MacOS/X, Darwin -// cc -Wall -o dumpkeymap dumpkeymap.c -framework IOKit -// -// MacOS/X DP4 (Developer Preview 4) -// cc -Wall -o dumpkeymap dumpkeymap.c -FKernel -framework IOKit -// -// MacOS/X Server, OpenStep, NextStep -// cc -Wall -o dumpkeymap dumpkeymap.c -// -// By default, dumpkeymap is configured to interface with the HID driver -// (Apple) or event-status driver (NeXT), thus allowing it to dump the -// key mapping which is currently in use by the WindowServer and AppKit. -// However, these facilities are specific to Apple/NeXT. In order to -// build dumpkeymap for non-Apple/NeXT platforms, you must define the -// DUMPKEYMAP_FILE_ONLY flag when compiling the program. This flag -// inhibits use of the HID and event-status drivers and configures -// dumpkeymap to work strictly with raw key mapping files. -// -// For example, to compile for Linux: -// gcc -Wall -DDUMPKEYMAP_FILE_ONLY -o dumpkeymap dumpkeymap.c -// -// CONCLUSION -// -// This program and its accompanying documentation were written by Eric -// Sunshine and are copyright (C)1999,2000 by Eric Sunshine -// <sunshine@sunshineco.com>. -// -// The implementation of dumpkeymap is based upon information gathered -// on September 3, 1997 by Eric Sunshine <sunshine@sunshineco.com> and -// Paul S. McCarthy <zarnuk@zarnuk.com> during an effort to reverse -// engineer the format of the NeXT .keymapping file. -// -// HISTORY -// -// v4 2000/12/01 Eric Sunshine <sunshine@sunshineco.com> -// Updated manual page to work with `rman', the `man' to `HTML' -// translator. Unfortunately, however, rman is missing important -// roff features such as diversions, indentation, and tab stops, -// and is also hideously buggy, so getting the manual to work with -// rman required quite a few work-arounds. -// The manual page has now been tested with nroff (plain text), troff -// (PostScript, etc.), groff (PostScript), and rman (HTML, etc.) -// -// v3 2000/11/28 Eric Sunshine <sunshine@sunshineco.com> -// Considerably expanded the documentation. -// Augmented the existing description of .keymapping internals. -// Added these new documentation topics: -// - Output: Very important section describing how to interpret -// the output of dumpkeymap. -// - Files: Lists files and directories related to key mappings. -// - Diagnostics: Explains diagnostic messages issued by -// dumpkeymap. -// Created a manual page (dumpkeymap.1) which contains the complete -// set of documentation for key mapping files and dumpkeymap. -// Added command-line options (--help, --help-keymapping, -// --help-output, --help-files, --help-diagnostics) which allow -// access to all key mapping documentation. Previously the -// description of the internal layout of a .keymapping file was -// only available as source code comments. -// Added --version option. -// Ported to non-Apple/NeXT platforms. Defining the pre-processor -// flag DUMPKEYMAP_FILE_ONLY at compilation time inhibits use of -// Apple/NeXT-specific API. -// Added a README file. -// -// v2 2000/11/13 Eric Sunshine <sunshine@sunshineco.com> -// Converted from C++ to plain-C. -// Now parses and takes into account the "number-size" flag stored -// with each key map. This flag indicates the size, in bytes, of -// all remaining numeric values in the mapping. Updated all code -// to respect this flag. (Previously, the purpose of this field -// was unknown, and it was thus denoted as -// `KeyMapping::fill[2]'.) -// Updated all documentation; especially the "KEY MAPPING -// DESCRIPTION" section. Added discussion of the "number-size" -// flag and revamped all structure definitions to use the generic -// data type `number' instead of `uchar' or 'byte'. Clarified -// several sections of the documentation and added missing -// discussions about type definitions and the relationship of -// `interface' and `handler_id' to .keymapping and .keyboard -// files. -// Updated compilation instructions to include directions for all -// platforms on which this program might be built. -// Now published under the formal BSD license rather than a -// home-grown license. -// -// v1 1999/09/08 Eric Sunshine <sunshine@sunshineco.com> -// Created. -//----------------------------------------------------------------------------- -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#if !defined(DUMPKEYMAP_FILE_ONLY) -#include <IOKit/hidsystem/event_status_driver.h> -#endif - -#define PROG_NAME "dumpkeymap" -#define PROG_VERSION "4" -#define AUTHOR_NAME "Eric Sunshine" -#define AUTHOR_EMAIL "sunshine@sunshineco.com" -#define AUTHOR_INFO AUTHOR_NAME " <" AUTHOR_EMAIL ">" -#define COPYRIGHT "Copyright (C) 1999,2000 by " AUTHOR_INFO - -typedef unsigned char byte; -typedef unsigned short word; -typedef unsigned int natural; -typedef unsigned long dword; -typedef dword number; - -#define ASCII_SET 0x00 -#define BIND_FUNCTION 0xfe -#define BIND_SPECIAL 0xff - -#define OPT_SWITCH(X) { char const* switched_str__=(X); if (0) { -#define OPT_CASE(X,Y) } else if (strcmp(switched_str__,(#X)) == 0 || \ - strcmp(switched_str__,(#Y)) == 0) { -#define OPT_DEFAULT } else { -#define OPT_SWITCH_END }} - -//----------------------------------------------------------------------------- -// Translation Tables -//----------------------------------------------------------------------------- -static char const* const SPECIAL_CODE[] = - { - "sound-up", - "sound-down", - "brightness-up", - "brightness-down", - "alpha-lock", - "help", - "power", - "secondary-up-arrow", - "secondary-down-arrow" - }; -#define N_SPECIAL_CODE (sizeof(SPECIAL_CODE) / sizeof(SPECIAL_CODE[0])) - -static char const* const MODIFIER_CODE[] = - { - "alpha-lock", - "shift", - "control", - "alternate", - "command", - "keypad", - "help" - }; -#define N_MODIFIER_CODE (sizeof(MODIFIER_CODE) / sizeof(MODIFIER_CODE[0])) - -static char const* const MODIFIER_MASK[] = - { - "-----", // R = carriage-return - "----L", // A = alternate - "---S-", // C = control - "---SL", // S = shift - "--C--", // L = alpha-lock - "--C-L", - "--CS-", - "--CSL", - "-A---", - "-A--L", - "-A-S-", - "-A-SL", - "-AC--", - "-AC-L", - "-ACS-", - "-ACSL", - "R----", - "R---L", - "R--S-", - "R--SL", - "R-C--", - "R-C-L", - "R-CS-", - "R-CSL", - "RA---", - "RA--L", - "RA-S-", - "RA-SL", - "RAC--", - "RAC-L", - "RACS-", - "RACSL", - }; -#define N_MODIFIER_MASK (sizeof(MODIFIER_MASK) / sizeof(MODIFIER_MASK[0])) - -#define FUNCTION_KEY_FIRST 0x20 -static char const* const FUNCTION_KEY[] = - { - "F1", // 0x20 - "F2", // 0x21 - "F3", // 0x22 - "F4", // 0x23 - "F5", // 0x24 - "F6", // 0x25 - "F7", // 0x26 - "F8", // 0x27 - "F9", // 0x28 - "F10", // 0x29 - "F11", // 0x2a - "F12", // 0x2b - "insert", // 0x2c - "delete", // 0x2d - "home", // 0x2e - "end", // 0x2f - "page up", // 0x30 - "page down", // 0x31 - "print screen", // 0x32 - "scroll lock", // 0x33 - "pause", // 0x34 - "sys-request", // 0x35 - "break", // 0x36 - "reset (HIL)", // 0x37 - "stop (HIL)", // 0x38 - "menu (HIL)", // 0x39 - "user (HIL)", // 0x3a - "system (HIL)", // 0x3b - "print (HIL)", // 0x3c - "clear line (HIL)", // 0x3d - "clear display (HIL)", // 0x3e - "insert line (HIL)", // 0x3f - "delete line (HIL)", // 0x40 - "insert char (HIL)", // 0x41 - "delete char (HIL)", // 0x42 - "prev (HIL)", // 0x43 - "next (HIL)", // 0x44 - "select (HIL)", // 0x45 - }; -#define N_FUNCTION_KEY (sizeof(FUNCTION_KEY) / sizeof(FUNCTION_KEY[0])) - - -//----------------------------------------------------------------------------- -// Data Stream Object -// Can be configured to treat embedded "numbers" as being composed of -// either 1, 2, or 4 bytes, apiece. -//----------------------------------------------------------------------------- -typedef struct _DataStream - { - byte const* data; - byte const* data_end; - natural number_size; // Size in bytes of a "number" in the stream. - } DataStream; - -static DataStream* new_data_stream( byte const* data, int size ) - { - DataStream* s = (DataStream*)malloc( sizeof(DataStream) ); - s->data = data; - s->data_end = data + size; - s->number_size = 1; // Default to byte-sized numbers. - return s; - } - -static void destroy_data_stream( DataStream* s ) - { - free(s); - } - -static int end_of_stream( DataStream* s ) - { - return (s->data >= s->data_end); - } - -static void expect_nbytes( DataStream* s, int nbytes ) - { - if (s->data + nbytes > s->data_end) - { - fputs( "Insufficient data in keymapping data stream.\n", stderr ); - exit(-1); - } - } - -static byte get_byte( DataStream* s ) - { - expect_nbytes( s, 1 ); - return *s->data++; - } - -static word get_word( DataStream* s ) - { - word hi, lo; - expect_nbytes( s, 2 ); - hi = *s->data++; - lo = *s->data++; - return ((hi << 8) | lo); - } - -static dword get_dword( DataStream* s ) - { - dword b1, b2, b3, b4; - expect_nbytes( s, 4 ); - b4 = *s->data++; - b3 = *s->data++; - b2 = *s->data++; - b1 = *s->data++; - return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1); - } - -static number get_number( DataStream* s ) - { - switch (s->number_size) - { - case 4: return get_dword(s); - case 2: return get_word(s); - default: return get_byte(s); - } - } - - -//----------------------------------------------------------------------------- -// Translation Utility Functions -//----------------------------------------------------------------------------- -static char const* special_code_desc( number n ) - { - if (n < N_SPECIAL_CODE) - return SPECIAL_CODE[n]; - else - return "invalid"; - } - -static char const* modifier_code_desc( number n ) - { - if (n < N_MODIFIER_CODE) - return MODIFIER_CODE[n]; - else - return "invalid"; - } - -static char const* modifier_mask_desc( number n ) - { - if (n < N_MODIFIER_MASK) - return MODIFIER_MASK[n]; - else - return "?????"; - } - -static char const* function_key_desc( number n ) - { - if (n >= FUNCTION_KEY_FIRST && n < N_FUNCTION_KEY + FUNCTION_KEY_FIRST) - return FUNCTION_KEY[ n - FUNCTION_KEY_FIRST ]; - else - return "unknown"; - } - -static number bits_set( number mask ) - { - number n = 0; - for ( ; mask != 0; mask >>= 1) - if ((mask & 0x01) != 0) - n++; - return n; - } - - -//----------------------------------------------------------------------------- -// Unparse a list of Modifier records. -//----------------------------------------------------------------------------- -static void unparse_modifiers( DataStream* s ) - { - number nmod = get_number(s); // Modifier count - printf( "MODIFIERS [%lu]\n", nmod ); - while (nmod-- > 0) - { - number nscan; - number const code = get_number(s); - printf( "%s:", modifier_code_desc(code) ); - nscan = get_number(s); - while (nscan-- > 0) - printf( " 0x%02x", (natural)get_number(s) ); - putchar( '\n' ); - } - putchar( '\n' ); - } - - -//----------------------------------------------------------------------------- -// Unparse a list of Character records. -//----------------------------------------------------------------------------- -typedef void (*UnparseSpecialFunc)( number code ); - -static void unparse_char_codes( - DataStream* s, number ncodes, UnparseSpecialFunc unparse_special ) - { - if (ncodes != 0) - { - while (ncodes-- > 0) - { - number const char_set = get_number(s); - number const code = get_number(s); - putchar(' '); - switch (char_set) - { - case ASCII_SET: - { - int const c = (int)code; - if (isprint(c)) - printf( "\"%c\"", c ); - else if (code < ' ') - printf( "\"^%c\"", c + '@' ); - else - printf( "%02x", c ); - break; - } - case BIND_FUNCTION: - printf( "[%s]", function_key_desc(code) ); - break; - case BIND_SPECIAL: - unparse_special( code ); - break; - default: - printf( "%02x/%02x", (natural)char_set, (natural)code ); - break; - } - } - } - } - - -//----------------------------------------------------------------------------- -// Unparse a list of scan code bindings. -//----------------------------------------------------------------------------- -static void unparse_key_special( number code ) - { - printf( "{seq#%lu}", code ); - } - -static void unparse_characters( DataStream* s ) - { - number const NOT_BOUND = 0xff; - number const nscans = get_number(s); - number scan; - printf( "CHARACTERS [%lu]\n", nscans ); - for (scan = 0; scan < nscans; scan++) - { - number const mask = get_number(s); - printf( "scan 0x%02x: ", (natural)scan ); - if (mask == NOT_BOUND) - fputs( "not-bound\n", stdout ); - else - { - number const bits = bits_set( mask ); - number const codes = 1 << bits; - printf( "%s ", modifier_mask_desc(mask) ); - unparse_char_codes( s, codes, unparse_key_special ); - putchar( '\n' ); - } - } - putchar( '\n' ); - } - - -//----------------------------------------------------------------------------- -// Unparse a list of key sequences. -//----------------------------------------------------------------------------- -static void unparse_sequence_special( number code ) - { - printf( "{%s}", (code == 0 ? "unmodify" : modifier_code_desc(code)) ); - } - -static void unparse_sequences( DataStream* s ) - { - number const nseqs = get_number(s); - number seq; - printf( "SEQUENCES [%lu]\n", nseqs ); - for (seq = 0; seq < nseqs; seq++) - { - number const nchars = get_number(s); - printf( "sequence %lu:", seq ); - unparse_char_codes( s, nchars, unparse_sequence_special ); - putchar( '\n' ); - } - putchar( '\n' ); - } - - -//----------------------------------------------------------------------------- -// Unparse a list of special keys. -//----------------------------------------------------------------------------- -static void unparse_specials( DataStream* s ) - { - number nspecials = get_number(s); - printf( "SPECIALS [%lu]\n", nspecials ); - while (nspecials-- > 0) - { - number const special = get_number(s); - number const scan = get_number(s); - printf( "%s: 0x%02x\n", special_code_desc(special), (natural)scan ); - } - putchar( '\n' ); - } - - -//----------------------------------------------------------------------------- -// Unparse the number-size flag. -//----------------------------------------------------------------------------- -static void unparse_numeric_size( DataStream* s ) - { - word const numbers_are_shorts = get_word(s); - s->number_size = numbers_are_shorts ? 2 : 1; - } - - -//----------------------------------------------------------------------------- -// Unparse an entire key map. -//----------------------------------------------------------------------------- -static void unparse_keymap_data( DataStream* s ) - { - unparse_numeric_size(s); - unparse_modifiers(s); - unparse_characters(s); - unparse_sequences(s); - unparse_specials(s); - } - - -//----------------------------------------------------------------------------- -// Unparse the active key map. -//----------------------------------------------------------------------------- -#if !defined(DUMPKEYMAP_FILE_ONLY) -static int unparse_active_keymap( void ) - { - int rc = 1; - NXEventHandle const h = NXOpenEventStatus(); - if (h == 0) - fputs( "Unable to open event status driver.\n", stderr ); - else - { - NXKeyMapping km; - km.size = NXKeyMappingLength(h); - if (km.size <= 0) - fprintf( stderr, "Bad key mapping length (%d).\n", km.size ); - else - { - km.mapping = (char*)malloc( km.size ); - if (NXGetKeyMapping( h, &km ) == 0) - fputs( "Unable to get current key mapping.\n", stderr ); - else - { - DataStream* stream = - new_data_stream( (byte const*)km.mapping, km.size ); - fputs( "=============\nACTIVE KEYMAP\n=============\n\n", - stdout); - unparse_keymap_data( stream ); - destroy_data_stream( stream ); - rc = 0; - } - free( km.mapping ); - } - NXCloseEventStatus(h); - } - return rc; - } -#endif - - -//----------------------------------------------------------------------------- -// Unparse one key map from a keymapping file. -//----------------------------------------------------------------------------- -static void unparse_keymap( DataStream* s ) - { - dword const interface = get_dword(s); - dword const handler_id = get_dword(s); - dword const map_size = get_dword(s); - printf( "interface: 0x%02lx\nhandler_id: 0x%02lx\nmap_size: %lu bytes\n\n", - interface, handler_id, map_size ); - unparse_keymap_data(s); - } - - -//----------------------------------------------------------------------------- -// Check the magic number of a keymapping file. -//----------------------------------------------------------------------------- -static int check_magic_number( DataStream* s ) - { - return (get_byte(s) == 'K' && - get_byte(s) == 'Y' && - get_byte(s) == 'M' && - get_byte(s) == '1'); - } - - -//----------------------------------------------------------------------------- -// Unparse all key maps within a keymapping file. -//----------------------------------------------------------------------------- -static int unparse_keymaps( DataStream* s ) - { - int rc = 0; - if (check_magic_number(s)) - { - int n = 1; - while (!end_of_stream(s)) - { - printf( "---------\nKEYMAP #%d\n---------\n", n++ ); - unparse_keymap(s); - } - } - else - { - fputs( "Bad magic number.\n", stderr ); - rc = 1; - } - return rc; - } - - -//----------------------------------------------------------------------------- -// Unparse a keymapping file. -//----------------------------------------------------------------------------- -static int unparse_keymap_file( char const* const path ) - { - int rc = 1; - FILE* file; - printf( "===========\nKEYMAP FILE\n===========\n%s\n\n", path ); - file = fopen( path, "rb" ); - if (file == 0) - perror( "Unable to open key mapping file" ); - else - { - struct stat st; - if (fstat( fileno(file), &st ) != 0) - perror( "Unable to determine key mapping file size" ); - else - { - byte* buffer = (byte*)malloc( st.st_size ); - if (fread( buffer, st.st_size, 1, file ) != 1) - perror( "Unable to read key mapping file" ); - else - { - DataStream* stream = new_data_stream(buffer, (int)st.st_size); - fclose( file ); file = 0; - rc = unparse_keymaps( stream ); - destroy_data_stream( stream ); - } - free( buffer ); - } - if (file != 0) - fclose( file ); - } - return rc; - } - - -//----------------------------------------------------------------------------- -// Handle the case when no documents are mentioned on the command-line. For -// Apple/NeXT platforms, dump the currently active key mapping; else display -// an error message. -//----------------------------------------------------------------------------- -static int handle_empty_document_list( void ) - { -#if !defined(DUMPKEYMAP_FILE_ONLY) - return unparse_active_keymap(); -#else - fputs( "ERROR: Must specify at least one .keymapping file.\n\n", stderr ); - return 1; -#endif - } - - -//----------------------------------------------------------------------------- -// Print a detailed description of the internal layout of a key mapping. -//----------------------------------------------------------------------------- -static void print_internal_layout_info( FILE* f ) - { - fputs( -"What follows is a detailed descriptions of the internal layout of an\n" -"Apple/NeXT .keymapping file.\n" -"\n" -"Types and Data\n" -"--------------\n" -"The following type definitions are employed throughout this discussion:\n" -"\n" -" typedef unsigned char byte;\n" -" typedef unsigned short word;\n" -" typedef unsigned long dword;\n" -"\n" -"Additionally, the type definition `number' is used generically to indicate\n" -"a numeric value. The actual size of the `number' type may be one or two\n" -"bytes depending upon how the data is stored in the key map. Although most\n" -"key maps use byte-sized numeric values, word-sized values are also allowed.\n" -"\n" -"Multi-byte values in a key mapping file are stored in big-endian byte\n" -"order.\n" -"\n" -"Key Mapping File and Device Mapping\n" -"-----------------------------------\n" -"A key mapping file begins with a magic-number and continues with a variable\n" -"number of device-specific key mappings.\n" -"\n" -" struct KeyMappingFile {\n" -" char magic_number[4]; // `KYM1'\n" -" DeviceMapping maps[...]; // Variable number of maps\n" -" };\n" -"\n" -" struct DeviceMapping {\n" -" dword interface; // Interface type\n" -" dword handler_id; // Interface subtype\n" -" dword map_size; // Byte count of `map' (below)\n" -" KeyMapping map;\n" -" };\n" -"\n" -"The value of `interface' represents a family of keyboard device types\n" -"(such as Intel PC, ADB, NeXT, Sun Type5, etc.), and is generally\n" -"specified as one of the constant values NX_EVS_DEVICE_INTERFACE_ADB,\n" -"NX_EVS_DEVICE_INTERFACE_ACE, etc., which are are defined in IOHIDTypes.h on\n" -"MacOS/X and Darwin, and in ev_types.h on MacOS/X Server, OpenStep, and\n" -"NextStep.\n" -"\n" -"The value of `handler_id' represents a specific keyboard layout within the\n" -"much broader `interface' family. For instance, for a 101-key Intel PC\n" -"keyboard (of type NX_EVS_DEVICE_INTERFACE_ACE) the `handler_id' is '0',\n" -"whereas for a 102-key keyboard it is `1'.\n" -"\n" -"Together, `interface' and `handler_id' identify the exact keyboard hardware\n" -"to which this mapping applies. Programs which display a visual\n" -"representation of a keyboard layout, match `interface' and `handler_id'\n" -"from the .keymapping file against the `interface' and `handler_id' values\n" -"found in each .keyboard file.\n" -"\n" -"Key Mapping\n" -"-----------\n" -"A key mapping completely defines the relationship of all scan codes with\n" -"their associated functionality. A KeyMapping structure is embedded within\n" -"the DeviceMapping structure in a KeyMappingFile. The key mapping currently\n" -"in use by the WindowServer and AppKit is also represented by a KeyMapping\n" -"structure, and can be referred to directly by calling NXGetKeyMapping() and\n" -"accessing the `mapping' data member of the returned NXKeyMapping structure.\n" -"\n" -" struct KeyMapping {\n" -" word number_size; // 0=1 byte, non-zero=2 bytes\n" -" number num_modifier_groups; // Modifier groups\n" -" ModifierGroup modifier_groups[...];\n" -" number num_scan_codes; // Scan groups\n" -" ScanGroup scan_table[...];\n" -" number num_sequence_lists; // Sequence lists\n" -" Sequence sequence_lists[...];\n" -" number num_special_keys; // Special keys\n" -" SpecialKey special_key[...];\n" -" };\n" -"\n" -"The `number_size' flag determines the size, in bytes, of all remaining\n" -"numeric values (denoted by the type definition `number') within the key\n" -"mapping. If its value is zero, then numbers are represented by a single\n" -"byte. If it is non-zero, then numbers are represented by a word (two\n" -"bytes).\n" -"\n" -"Modifier Group\n" -"--------------\n" -"A modifier group defines all scan codes which map to a particular type of\n" -"modifier, such as `shift', `control', etc.\n" -"\n" -" enum Modifier {\n" -" ALPHALOCK = 0,\n" -" SHIFT,\n" -" CONTROL,\n" -" ALTERNATE,\n" -" COMMAND,\n" -" KEYPAD,\n" -" HELP\n" -" };\n" -"\n" -" struct ModifierGroup {\n" -" number modifier; // A Modifier constant\n" -" number num_scan_codes;\n" -" number scan_codes[...]; // Variable number of scan codes\n" -" };\n" -"\n" -"The scan_codes[] array contains a list of all scan codes which map to the\n" -"specified modifier. The `shift', `command', and `alternate' modifiers are\n" -"frequently mapped to two different scan codes, apiece, since these\n" -"modifiers often appear on both the left and right sides of the keyboard.\n" -"\n" -"Scan Group\n" -"----------\n" -"There is one ScanGroup for each scan code generated by the given keyboard.\n" -"This number is given by KeyMapping::num_scan_codes. The first scan group\n" -"represents hardware scan code 0, the second represents scan code 1, etc.\n" -"\n" -" enum ModifierMask {\n" -" ALPHALOCK_MASK = 1 << 0,\n" -" SHIFT_MASK = 1 << 1,\n" -" CONTROL_MASK = 1 << 2,\n" -" ALTERNATE_MASK = 1 << 3,\n" -" CARRIAGE_RETURN_MASK = 1 << 4\n" -" };\n" -" #define NOT_BOUND 0xff\n" -"\n" -" struct ScanGroup {\n" -" number mask;\n" -" Character characters[...];\n" -" };\n" -"\n" -"For each scan code, `mask' defines which modifier combinations generate\n" -"characters. If `mask' is NOT_BOUND (0xff) then then this scan code does\n" -"not generate any characters ever, and its characters[] array is zero\n" -"length. Otherwise, the characters[] array contains one Character record\n" -"for each modifier combination.\n" -"\n" -"The number of records in characters[] is determined by computing (1 <<\n" -"bits_set_in_mask). In other words, if mask is zero, then zero bits are\n" -"set, so characters[] contains only one record. If `mask' is (SHIFT_MASK |\n" -"CONTROL_MASK), then two bits are set, so characters[] contains four\n" -"records.\n" -"\n" -"The first record always represents the character which is generated by that\n" -"key when no modifiers are active. The remaining records represent\n" -"characters generated by the various modifier combinations. Using the\n" -"example with the `shift' and `control' masks set, record two would\n" -"represent the character with the `shift' modifier active; record three, the\n" -"`control' modifier active; and record four, both the `shift' and `control'\n" -"modifiers active.\n" -"\n" -"As a special case, ALPHALOCK_MASK implies SHIFT_MASK, though only\n" -"ALPHALOCK_MASK appears in `mask'. In this case the same character is\n" -"generated for both the `shift' and `alpha-lock' modifiers, but only needs\n" -"to appear once in the characters[] array.\n" -"\n" -"CARRIAGE_RETURN_MASK does not actually refer to a modifier key. Instead,\n" -"it is used to distinguish the scan code which is given the special\n" -"pseudo-designation of `carriage return' key. Typically, this mask appears\n" -"solo in a ScanGroup record and only the two Character records for control-M\n" -"and control-C follow. This flag may be a throwback to an earlier time or\n" -"may be specially interpreted by the low-level keyboard driver, but its\n" -"purpose is otherwise enigmatic.\n" -"Character\n" -"---------\n" -"Each Character record indicates the character generated when this key is\n" -"pressed, as well as the character set which contains the character. Well\n" -"known character sets are `ASCII' and `Symbol'. The character set can also\n" -"be one of the meta values FUNCTION_KEY or KEY_SEQUENCE. If it is\n" -"FUNCTION_KEY then `char_code' represents a generally well-known function\n" -"key such as those enumerated by FunctionKey. If the character set is\n" -"KEY_SEQUENCE then `char_code' represents a zero-base index into\n" -"KeyMapping::sequence_lists[].\n" -"\n" -" enum CharacterSet {\n" -" ASCII = 0x00,\n" -" SYMBOL = 0x01,\n" -" ...\n" -" FUNCTION_KEY = 0xfe,\n" -" KEY_SEQUENCE = 0xff\n" -" };\n" -"\n" -" struct Character {\n" -" number set; // CharacterSet of generated character\n" -" number char_code; // Actual character generated\n" -" };\n" -"\n" -" enum FunctionKey {\n" -" F1 = 0x20, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,\n" -" INSERT, DELETE, HOME, END, PAGE_UP, PAGE_DOWN, PRINT_SCREEN,\n" -" SCROLL_LOCK, PAUSE, SYS_REQUEST, BREAK, RESET, STOP, MENU, USER,\n" -" SYSTEM, PRINT, CLEAR_LINE, CLEAR_DISPLAY, INSERT_LINE,\n" -" DELETE_LINE, INSERT_CHAR, DELETE_CHAR, PREV, NEXT, SELECT\n" -" };\n" -"\n" -"Sequence\n" -"--------\n" -"When Character::set contains the meta value KEY_SEQUENCE, the scan code is\n" -"bound to a sequence of keys rather than a single character. A sequence is\n" -"a series of modifiers and characters which are automatically generated when\n" -"the associated key is depressed.\n" -"\n" -" #define MODIFIER_KEY 0xff\n" -"\n" -" struct Sequence {\n" -" number num_chars;\n" -" Character characters[...];\n" -" };\n" -"\n" -"Each generated Character is represented as previously described, with the\n" -"exception that MODIFIER_KEY may appear in place of KEY_SEQUENCE. When the\n" -"value of Character::set is MODIFIER_KEY then Character::char_code\n" -"represents a modifier key rather than an actual character. If the modifier\n" -"represented by `char_code' is non-zero, then it indicates that the\n" -"associated modifier key has been depressed. In this case, the value is one\n" -"of the constants enumerated by Modifier (SHIFT, CONTROL, ALTERNATE, etc.).\n" -"If the value is zero then it means that the modifier keys have been\n" -"released.\n" -"\n" -"Special Key\n" -"-----------\n" -"A special key is one which is scanned directly by the Mach kernel rather\n" -"than by the WindowServer. In general, events are not generated for special\n" -"keys.\n" -"\n" -" enum SpecialKeyType {\n" -" VOLUME_UP = 0,\n" -" VOLUME_DOWN,\n" -" BRIGHTNESS_UP,\n" -" BRIGHTNESS_DOWN,\n" -" ALPHA_LOCK,\n" -" HELP,\n" -" POWER,\n" -" SECONDARY_ARROW_UP,\n" -" SECONDARY_ARROW_DOWN\n" -" };\n" -"\n" -" struct SpecialKey {\n" -" number type; // A SpecialKeyType constant\n" -" number scan_code; // Actual scan code\n" -" };\n" -"\n", f ); - } - - -//----------------------------------------------------------------------------- -// Print an explanation of the output generated by this program. -//----------------------------------------------------------------------------- -static void print_output_info( FILE* f ) - { - fputs( -"What follows is an explanation and description of the various pieces of\n" -"information emitted by dumpkeymap.\n" -"\n" -"For a more thorough discussion of any particular piece of information\n" -"described here, refer to the detailed description of the internal layout of\n" -"a key mapping given by the --help-layout option.\n" -"\n" -"Conventions\n" -"-----------\n" -"Depending upon context, some numeric values are displayed in decimal\n" -"notation, whereas others are displayed in hexadecimal notation.\n" -"Hexadecimal numbers are denoted by a `0x' prefix (for instance, `0x7b'),\n" -"except when explicitly noted otherwise.\n" -"\n" -"Key Mapping Source\n" -"------------------\n" -"The first piece of information presented about a particular key mapping is\n" -"the source from which the data was gleaned. For a .keymapping file, the\n" -"title `KEYMAP FILE' is emitted along with the path and name of the file in\n" -"question. For the key mapping currently in use by the WindowServer and\n" -"AppKit, the title `ACTIVE KEYMAP' is emitted instead.\n" -"\n" -"Device Information\n" -"------------------\n" -"Each .keymapping file may contain one or more raw key mappings. For\n" -"example, a file which maps keys to a Dvorak-style layout might contain raw\n" -"mappings for Intel PC, ADB, NeXT, and Sun Type5 keyboards.\n" -"\n" -"For each raw mapping, the following information is emitted:\n" -"\n" -" o The title `KEYMAP' along with the mapping's relative position in the\n" -" .keymapping file.\n" -" o The `interface' identifier.\n" -" o The `handler_id' sub-identifier.\n" -" o The size of the raw mapping resource counted in bytes.\n" -"\n" -"The `interface' and `handler_id' values, taken together, define a specific\n" -"keyboard device. A .keyboard file, which describes the visual layout of a\n" -"keyboard, also contains `interface' and `handler_id' identifiers. The\n" -".keyboard file corresponding to a particular key mapping can be found by\n" -"matching the `interface' and `handler_id' values from each resource.\n" -"\n" -"Modifiers\n" -"---------\n" -"Each mapping may contain zero or more modifier records which associate\n" -"hardware scan codes with modifier descriptions such as `shift', `control',\n" -"`alternate', etc. The title `MODIFIERS' is printed along with the count of\n" -"modifier records which follow. For each modifier record, the modifier's\n" -"name is printed along with a list of scan codes, in hexadecimal format,\n" -"which generate that modifier value. For example:\n" -"\n" -" MODIFIERS [4]\n" -" alternate: 0x1d 0x60\n" -" control: 0x3a\n" -" keypad: 0x52 0x53 ... 0x63 0x62\n" -" shift: 0x2a 0x36\n" -"\n" -"Characters\n" -"----------\n" -"Each mapping may contain zero or more character records which associate\n" -"hardware scan codes with the actual characters generated by those scan\n" -"codes in the presence or absence of various modifier combinations. The\n" -"title `CHARACTERS' is printed along with the count of character records\n" -"which follow. Here is a highly abbreviated example:\n" -"\n" -" CHARACTERS [9]\n" -" scan 0x00: -AC-L \"a\" \"A\" \"^A\" \"^A\" ca c7 \"^A\" \"^A\"\n" -" scan 0x07: -AC-L \"x\" \"X\" \"^X\" \"^X\" 01/b4 01/ce \"^X\" \"^X\"\n" -" scan 0x0a: ---S- \"<\" \">\"\n" -" scan 0x13: -ACS- \"2\" \"@\" \"^@\" \"^@\" b2 b3 \"^@\" \"^@\"\n" -" scan 0x24: R---- \"^M\" \"^C\"\n" -" scan 0x3e: ----- [F4]\n" -" scan 0x4a: ----- [page up]\n" -" scan 0x60: ----- {seq#3}\n" -" scan 0x68: not-bound\n" -"\n" -"For each record, the hexadecimal value of the hardware scan code is\n" -"printed, followed by a list of modifier flag combinations and the actual\n" -"characters generated by this scan code with and without modifiers applied.\n" -"\n" -"The modifier flags field is composed of a combination of single letter\n" -"representations of the various modifier types. The letters stand for:\n" -"\n" -" L - alpha-lock\n" -" S - shift\n" -" C - control\n" -" A - alternate\n" -" R - carriage-return\n" -"\n" -"As a special case, the `alpha-lock' flag also implies the `shift' flag, so\n" -"these two flags never appear together in the same record.\n" -"\n" -"The combination of modifier flags determines the meaning and number of\n" -"fields which follow. The first field after the modifier flags always\n" -"represents the character that will be generated if no modifier keys are\n" -"depressed. The remaining fields represent characters generated by the\n" -"various modifier combinations. The order of the fields follows this\n" -"general pattern:\n" -"\n" -" o The character generated by this scan code when no modifiers are in\n" -" effect is listed first.\n" -"\n" -" o If the `L' or `S' flag is active, then the shifted character\n" -" generated by this scan code is listed next.\n" -"\n" -" o If the `C' flag is active, then the control-character generated by\n" -" this scan code is listed next. Furthermore, if the `L' or `S' flag\n" -" is also active, then the shifted control-character is listed after\n" -" that.\n" -"\n" -" o If the `A' flag is active, then the alternate-character generated by\n" -" this scan code is listed next. Furthermore, if the `L' or `S' flag\n" -" is active, then the shifted alternate-character is listed after that.\n" -" If the `C' flag is also active, then the alternate-control-character\n" -" is listed next. Finally, if the `C' and `L' or `C' and `S' flags are\n" -" also active, then the shifted alternate-control-character is listed.\n" -"\n" -"The `R' flag does not actually refer to a modifier key. Instead, it is\n" -"used to distinguish the scan code which is given the special\n" -"pseudo-designation of `carriage return' key. Typically, this mask appears\n" -"solo and only the two fields for control-M and control-C follow. This flag\n" -"may be a throwback to an earlier time or may be specially interpreted by\n" -"the low-level keyboard driver, but its purpose is otherwise enigmatic.\n" -"\n" -"Recalling the example from above, the following fields can be identified:\n" -"\n" -" scan 0x00: -AC-L \"a\" \"A\" \"^A\" \"^A\" ca c7 \"^A\" \"^A\"\n" -"\n" -" o Lower-case `a' is generated when no modifiers are active.\n" -" o Upper-case `A' is generated when `shift' or `alpha-lock' are active.\n" -" o Control-A is generated when `control' is active.\n" -" o Control-A is generated when `control' and `shift' are active.\n" -" o The character represented by the hexadecimal code 0xca is generated\n" -" when `alternate' is active.\n" -" o The character represented by 0xc7 is generated when `alternate' and\n" -" `shift' (or `alpha-lock') are active.\n" -" o Control-A is generated when `alternate' and `control' are active.\n" -" o Control-A is generated when `alternate', `control' and `shift' (or\n" -" `alpha-lock') are active.\n" -"\n" -"The notation used to represent a particular generated character varies.\n" -"\n" -" o Printable ASCII characters are quoted, as in \"x\" or \"X\".\n" -"\n" -" o Control-characters are quoted and prefixed with `^', as in \"^X\".\n" -"\n" -" o Characters with values greater than 127 (0x7f) are displayed as\n" -" hexadecimal values without the `0x' prefix.\n" -"\n" -" o Characters in a non-ASCII character set (such as `Symbol') are\n" -" displayed as two hexadecimal numbers separated by a slash, as in\n" -" `01/4a'. The first number is the character set's identification code\n" -" (such as `01' for the `Symbol' set), and the second number is the\n" -" value of the generated character.\n" -"\n" -" o Non-printing special function characters are displayed with the\n" -" function's common name enclosed in brackets, as in `[page up]' or\n" -" `[F4]'.\n" -"\n" -" o If the binding represents a key sequence rather than a single\n" -" character, then the sequence's identification number is enclosed in\n" -" braces, as in `{seq#3}'.\n" -"\n" -"Recalling a few examples from above, the following interpretations can be\n" -"made:\n" -"\n" -" scan 0x07: -AC-L \"x\" \"X\" \"^X\" \"^X\" 01/b4 01/ce \"^X\" \"^X\"\n" -" scan 0x3e: ----- [F4]\n" -" scan 0x4a: ----- [page up]\n" -" scan 0x60: ----- {seq#3}\n" -"\n" -" o \"x\" and \"X\" are printable ASCII characters.\n" -" o \"^X\" is a control-character.\n" -" o `01/b4' and `01/ce' represent the character codes 0xb4 and 0xce in\n" -" the `Symbol' character set.\n" -" o Scan code 0x3e generates function-key `F4', and scan code 0x4a\n" -" generates function-key `page up'.\n" -" o Scan code 0x60 is bound to key sequence #3.\n" -"\n" -"Finally, if a scan code is not bound to any characters, then it is\n" -"annotated with the label `not-bound', as with example scan code 0x68 from\n" -"above.\n" -"\n" -"Sequences\n" -"---------\n" -"A scan code (modified and unmodified) can be bound to a key sequence rather\n" -"than generating a single character or acting as a modifier. When it is\n" -"bound to a key sequence, a series of character invocations and modifier\n" -"actions are automatically generated rather than a single keystroke.\n" -"\n" -"Each mapping may contain zero or more key sequence records. The title\n" -"`SEQUENCES' is printed along with the count of sequence records which\n" -"follow. For example:\n" -"\n" -" SEQUENCES [3]\n" -" sequence 0: \"f\" \"o\" \"o\"\n" -" sequence 1: {alternate} \"b\" \"a\" \"r\" {unmodify}\n" -" sequence 2: [home] \"b\" \"a\" \"z\"\n" -"\n" -"The notation used to represent the sequence of generated characters is\n" -"identical to the notation already described in the `Characters' section\n" -"above, with the exception that modifier actions may be interposed between\n" -"generated characters. Such modifier actions are represented by the\n" -"modifier's name enclosed in braces. The special name `{unmodify}'\n" -"indicates the release of the modifier keys.\n" -"\n" -"Thus, the sequences in the above example can be interpreted as follows:\n" -"\n" -" o Sequence #0 generates `foo'.\n" -" o Sequence #1 invokes the `alternate' modifier, generates `bar', and\n" -" then releases `alternate'.\n" -" o Sequence #2 invokes the `home' key and then generates `baz'. In a\n" -" text editor, this would probably result in `baz' being prepended to\n" -" the line of text on which the cursor resides.\n" -"\n" -"Special Keys\n" -"------------\n" -"Certain keyboards feature keys which perform some type of special purpose\n" -"function rather than generating a character or acting as a modifier. For\n" -"instance, Apple keyboards often contain a `power' key, and NeXT keyboards\n" -"have historically featured screen brightness and volume control keys.\n" -"\n" -"Each mapping may contain zero or more special-key records which associate\n" -"hardware scan codes with such special purpose functions. The title\n" -"`SPECIALS' is printed along with the count of records which follow. For\n" -"each record, the special function's name is printed along with a list of\n" -"scan codes, in hexadecimal format, which are bound to that function. For\n" -"example:\n" -"\n" -" SPECIALS [6]\n" -" alpha-lock: 0x39\n" -" brightness-down: 0x79\n" -" brightness-up: 0x74\n" -" power: 0x7f\n" -" sound-down: 0x77\n" -" sound-up: 0x73\n" -"\n", f ); - } - - -//----------------------------------------------------------------------------- -// Print a summary of the various files and directories which are related to -// key mappings. -//----------------------------------------------------------------------------- -static void print_files_info( FILE* f ) - { - fputs( -"This is a summary of the various files and directories which are related to\n" -"key mappings.\n" -"\n" -"*.keymapping\n" -" A key mapping file which precisely defines the relationship of all\n" -" hardware-specific keyboard scan-codes with their associated\n" -" functionality.\n" -"\n" -"*.keyboard\n" -" A file describing the physical layout of keys on a particular type of\n" -" keyboard. Each `key' token in this file defines the position and shape\n" -" of the key on the keyboard, as well as the associated scan code which\n" -" that key generates. A .keymapping file, on the other hand, defines the\n" -" characters which are generated by a particular scan code depending upon\n" -" the state of the various modifier keys (such as shift, control, etc.).\n" -" The `interface' and `handler_id' values from a .keymapping file are\n" -" matched against those in each .keyboard file in order to associate a\n" -" particular .keyboard file with a key mapping. Various GUI programs use\n" -" the .keyboard file to display a visual representation of a keyboard for\n" -" the user. Since these files are just plain text, they can be easily\n" -" viewed and interpreted without the aid of a specialized program, thus\n" -" dumpkeymap leaves these files alone.\n" -"\n" -"/System/Library/Keyboards\n" -"/Network/Library/Keyboards\n" -"/Local/Library/Keyboards\n" -"/Library/Keyboards\n" -" Repositories for .keymapping and .keyboard files for MacOS/X, Darwin,\n" -" and MacOS/X Server.\n" -"\n" -"/NextLibrary/Keyboards\n" -"/LocalLibrary/Keyboards\n" -" Repositories for .keymapping and .keyboard files for OpenStep and\n" -" NextStep.\n" -"\n" -"$(HOME)/Library/Keyboards\n" -" Repository for personal .keymapping and .keyboard files.\n" -"\n", f ); - } - - -//----------------------------------------------------------------------------- -// Print a list of the various diagnostic messages which may be emitted. -//----------------------------------------------------------------------------- -static void print_diagnostics_info( FILE* f ) - { - fputs( -"The following diagnostic messages may be issued to the standard error\n" -"stream.\n" -"\n" -"Unrecognized option.\n" -" An unrecognized option was specified on the command-line. Invoke\n" -" dumpkeymap with the --help option to view a list of valid options.\n" -"\n" -"Insufficient data in keymapping data stream.\n" -" The key mapping file or data stream is corrupt. Either the file has\n" -" been incorrectly truncated or a field, such as those which indicates\n" -" the number of variable records which follow, contains a corrupt value.\n" -"\n" -"The following diagnostic messages have significance only when trying to\n" -"print .keymapping files mentioned on the command-line.\n" -"\n" -"Bad magic number.\n" -" The mentioned file is not a .keymapping file. The file's content does\n" -" not start with the string `KYM1'.\n" -"\n" -"Unable to open key mapping file.\n" -" The call to fopen() failed; probably because the specified path is\n" -" invalid or dumpkeymap does not have permission to read the file.\n" -"\n" -"Unable to determine key mapping file size.\n" -" The call to fstat() failed, thus memory can not be allocated for\n" -" loading the file.\n" -"\n" -"Unable to read key mapping file.\n" -" The call to fread() failed.\n" -"\n" -"The following diagnostic messages have significance only when trying to\n" -"print the currently active key mapping when no .keymapping files have been\n" -"mentioned on the command-line.\n" -"\n" -"Unable to open event status driver.\n" -" The call to NXOpenEventStatus() failed.\n" -"\n" -"Bad key mapping length.\n" -" The call to NXKeyMappingLength() returned a bogus value.\n" -"\n" -"Unable to get current key mapping.\n" -" The call to NXGetKeyMapping() failed.\n" -"\n" -"The following diagnostic messages have significance only when using\n" -"dumpkeymap on a non-Apple/NeXT platform.\n" -"\n" -"Must specify at least one .keymapping file.\n" -" No .keymapping files were mentioned on the command-line. On\n" -" non-Apple/NeXT platforms, there is no concept of a currently active\n" -" .keymapping file, so at least one file must be mentioned on the\n" -" command-line.\n" -"\n", f ); - } - - -//----------------------------------------------------------------------------- -// Print warranty. -//----------------------------------------------------------------------------- -static void print_warranty( FILE* f ) - { - fputs( -"This software is provided by the author `AS IS' and any express or implied\n" -"WARRANTIES, including, but not limited to, the implied warranties of\n" -"MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE are DISCLAIMED. In NO\n" -"EVENT shall the author be LIABLE for any DIRECT, INDIRECT, INCIDENTAL,\n" -"SPECIAL, EXEMPLARY, or CONSEQUENTIAL damages (including, but not limited\n" -"to, procurement of substitute goods or services; loss of use, data, or\n" -"profits; or business interruption) however caused and on any theory of\n" -"liability, whether in contract, strict liability, or tort (including\n" -"negligence or otherwise) arising in any way out of the use of this\n" -"software, even if advised of the possibility of such damage.\n" -"\n", f ); - } - - -//----------------------------------------------------------------------------- -// Print this program's version number. -//----------------------------------------------------------------------------- -static void print_version( FILE* f ) - { - fputs( "Version " PROG_VERSION " (built " __DATE__ ")\n\n", f ); - } - - -//----------------------------------------------------------------------------- -// Print a usage summary. -//----------------------------------------------------------------------------- -static void print_usage( FILE* f ) - { - fputs( -"Usage: dumpkeymap [options] [-] [file ...]\n" -"\n" -"Prints a textual representation of each Apple/NeXT .keymapping file\n" -"mentioned on the command-line. If no files are mentioned and if the local\n" -"machine is an Apple or NeXT installation, then the key mapping currently in\n" -"use by the WindowServer and the AppKit is printed instead.\n" -"\n" -"Options:\n" -" -h --help\n" -" Display general program instructions and option summary.\n" -"\n" -" -k --help-keymapping\n" -" Display a detailed description of the internal layout of a\n" -" .keymapping file.\n" -"\n" -" -o --help-output\n" -" Display an explanation of the output generated by dumpkeymap when\n" -" dissecting a .keymapping file.\n" -"\n" -" -f --help-files\n" -" Display a summary of the various files and directories which are\n" -" related to key mappings.\n" -"\n" -" -d --help-diagnostics\n" -" Display a list of the various diagnostic messages which may be\n" -" emitted by dumpkeymap.\n" -"\n" -" -v --version\n" -" Display the dumpkeymap version number and warranty information.\n" -"\n" -" - --\n" -" Inhibit processing of options at this point in the argument list.\n" -" An occurrence of `-' or `--' in the argument list causes all\n" -" following arguments to be treated as file names even if an argument\n" -" begins with a `-' character.\n" -"\n", f ); - } - - -//----------------------------------------------------------------------------- -// Print an informational banner. -//----------------------------------------------------------------------------- -static void print_banner( FILE* f ) - { - fputs( "\n" PROG_NAME " v" PROG_VERSION " by " AUTHOR_INFO "\n" - COPYRIGHT "\n\n", f ); - } - - -//----------------------------------------------------------------------------- -// Process command-line arguments. Examine options first; collecting files -// along the way. If all is well, process collected file list. -//----------------------------------------------------------------------------- -int main( int const argc, char const* const argv[] ) - { - int rc = 0, i, nfiles = 0, more_options = 1, process_files = 1; - int* files = (int*)calloc( argc - 1, sizeof(int) ); - print_banner( stdout ); - - for (i = 1; i < argc; i++) - { - char const* const s = argv[i]; - if (!more_options || *s != '-') - files[ nfiles++ ] = i; - else - { - OPT_SWITCH(s) - OPT_CASE(-,--) - more_options = 0; - OPT_CASE(-h,--help) - print_usage( stdout ); - process_files = 0; - OPT_CASE(-k,--help-keymapping) - print_internal_layout_info( stdout ); - process_files = 0; - OPT_CASE(-o,--help-output) - print_output_info( stdout ); - process_files = 0; - OPT_CASE(-f,--help-files) - print_files_info( stdout ); - process_files = 0; - OPT_CASE(-d,--help-diagnostics) - print_diagnostics_info( stdout ); - process_files = 0; - OPT_CASE(-v,--version) - print_version( stdout ); - print_warranty( stdout ); - process_files = 0; - OPT_DEFAULT - fprintf( stderr, "ERROR: Unrecognized option: %s\n\n", s ); - process_files = 0; - rc = 1; - OPT_SWITCH_END - } - } - - if (process_files) - { - if (nfiles == 0) - rc = handle_empty_document_list(); - else - for (i = 0; i < nfiles; i++) - rc |= unparse_keymap_file( argv[files[i]] ); - } - - free( files ); - return rc; - } diff --git a/hw/darwin/utils/dumpkeymap.man b/hw/darwin/utils/dumpkeymap.man deleted file mode 100644 index 02b09e6ca..000000000 --- a/hw/darwin/utils/dumpkeymap.man +++ /dev/null @@ -1,1002 +0,0 @@ -.ig -//============================================================================= -// -// Manual page for `dumpkeymap'. -// -// Copyright (C) 1999,2000 by Eric Sunshine <sunshine@sunshineco.com> -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 3. The name of the author may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -//============================================================================= -// -.. -.ig -//----------------------------------------------------------------------------- -// Local identification information. -//----------------------------------------------------------------------------- -.. -.nr VE 4 \" Version number -.TH DUMPKEYMAP 1 "v\n(VE \-\- 1 December 2000" "Version \n(VE" -.de UP -1 December 2000 -.. -.ig -//----------------------------------------------------------------------------- -// Annotation Macros -// ----------------- -// Facilitate creation of annotated, non-filled blocks of text. An -// annotated block is initiated with the `AS' macro. Each annotated, -// non-filled line within the block must be introduced with the `AN' macro -// which takes three arguments. The first argument is the detail text to -// be annotated. The second is a string of spaces used to align the -// annotations by certain (broken) roff interpreters which fail to -// implement the proper set of roff commands (such as diversions, -// indentation, and tab stops). It is assumed that the spaces will be -// used with fixed-point font. The third argument is the annotation -// itself. The block should be terminated with the `AE' macro. For all -// roff interpreters which properly implement diversions, indentation, and -// tab stops, all annotations within the block are automatically aligned at -// the same horizontal position. This position is guaranteed to be just -// to the right of the widest `AN' detail line. For broken roff -// interpreters, such as `rman', the string of spaces from the second -// argument are used to align the annotations. Finally, the `AZ' macro, -// which takes a single argument, can be used to to insert a non-annotated -// line into the block which does not play a part in the calculation of -// the horizontal annotation alignment. -// -// Implementation Notes -// -------------------- -// *1* These macros utilize a diversion (named `AD'). Since the prevailing -// indentation is stored along with the diverted text, we must muck with -// the indentation level in order to prevent the indentation from being -// applied to the text a second time when `AD' is finally emitted. -// -// *2* Unfortunately, `.if' strips leading whitespace from following text, so -// `AN' uses \& to preserve the whitespace. -// -// *3* This manual page has been tested for proper formatting with troff, -// groff, nroff and rman (the `man' to `HTML' converter). Unfortunately, -// rman fails to implement many useful features such as diversions, -// indentation, and tab stops, and is also hideously buggy. Furthermore -// it identifies itself as nroff and fails to provide any further -// identification, so there is no way to create macros which specifically -// work around its limitations. Following is a list of several bugs in -// rman which the implementation of these macros must avoid: -// o Fails with multi-line conditionals within macros. -// o Fails on macro definition within multi-line conditionals. -// o Fails when macro arguments are not delimited by exactly 1 space. -// o String definition `.ds' ignores the value; uses empty "" instead. -// As a consequence of these problems, the following macros are written -// using a series of ugly single-line `.if' conditionals rather than the -// more natural multi-line `.if' and `.ie' conditionals. Also, rman fails -// to understand the common idiom of `.\"' to introduce a comment, which -// is why all comments in this file are wrapped in ignore `.ig' blocks. -//----------------------------------------------------------------------------- -.. -.de AS -.if t .nr AW 0 -.if t .nr AI \\n(.i -.if t .in -\\n(AI -.nf -.. -.de AN -.if t .if \w'\\$1'>\\n(AW .nr AW \w'\\$1' -.if t .da AD -.if t \\&\\$1\\t\\$3 -.if t .da -.if n \\&\\$1 \\$2\\$3 -.. -.de AZ -.if t .da AD -\\$1 -.if t .da -.. -.de AE -.if t .in +\\n(AIu -.if t .if \\n(AW .ta \\n(AWu+\w'\\(em'u -.if t .AD -.if t .DT -.if t .rm AD -.if t .rm AW -.fi -.. -.ig -//----------------------------------------------------------------------------- -// Bulleted list macros -- `BG' begins a bulleted list; `BU' delimits -// bulleted entries; `BE' ends a bulleted list. -//----------------------------------------------------------------------------- -.. -.de BG -.PP -.RS -.. -.de BU -.HP -\\(bu\\ \\c -.. -.de BE -.RE -.PP -.. -.ig -//----------------------------------------------------------------------------- -// Indented paragraph with stylized hanging tag macro. `TG' takes a single -// argument and treats it as the hanging tag of the indented paragraph. -// The tag is italicized in troff but not in nroff. -//----------------------------------------------------------------------------- -.. -.de TG -.TP -.ie t .I "\\$1" -.el \\$1 -.. -.ig -//----------------------------------------------------------------------------- -// Manual page for `dumpkeymap'. -//----------------------------------------------------------------------------- -.. -.SH NAME -dumpkeymap \- Dianostic dump of a .keymapping file -.SH SYNOPSIS -.B dumpkeymap -.RI [ options "] [-] [" file "...]" -.SH DESCRIPTION -.I dumpkeymap -prints a textual representation of each Apple/\c -.SM NeXT -.I .keymapping -file mentioned on the command-line. If no files are mentioned and if the -local machine is an Apple or -.SM NeXT -installation, then the key mapping currently in use by the WindowServer and the -AppKit is printed instead. -.SH OPTIONS -.TP -.B "\-h \-\^\-help" -Display general program instructions and option summary. -.TP -.B "\-k \-\^\-help\-keymapping" -Display a detailed description of the internal layout of a -.I .keymapping -file. This is the same information as that presented in the -.I "Key Mapping Description" -section of this document. -.TP -.B "\-o \-\^\-help\-output" -Display an explanation of the output generated by -.I dumpkeymap -when dissecting a -.I .keymapping -file. This is the same information as that presented in the -.I "Output Description" -section of this document. -.TP -.B "\-f \-\^\-help\-files" -Display a summary of the various files and directories which are related to -key mappings. This is the same information as that presented in the -.I "Files" -section of this document. -.TP -.B "\-d \-\^\-help\-diagnostics" -Display a list of the various diagnostic messages which may be emitted by -.I dumpkeymap. -This is the same information as that presented in the -.I "Diagnostics" -section of this document. -.TP -.B "\-v \-\^\-version" -Display the -.I dumpkeymap -version number and warranty information. -.TP -.B "\- \-\^\-" -Inhibit processing of options at this point in the argument list. An -occurrence of `\-' or `\-\^\-' in the argument list causes all following -arguments to be treated as file names even if an argument begins with a `\-' -character. -.SH "KEY MAPPING DESCRIPTION" -The following sections describe, in complete detail, the format of a raw key -mapping resource, as well as the format of the -.I .keymapping -file which encapsulates one or more raw mappings. -.SH "Types and Data" -The following type definitions are employed throughout this discussion: -.PP -.RS -.AS -.AZ "typedef unsigned char byte;" -.AZ "typedef unsigned short word;" -.AZ "typedef unsigned long dword;" -.AE -.RE -.PP -Additionally, the type definition -.RI ` number ' -is used generically to -indicate a numeric value. The actual size of the -.RI ` number ' -type may be one or two bytes depending upon how the data is stored in the key -map. Although most key maps use byte-sized numeric values, word-sized values -are also allowed. -.PP -Multi-byte values in a key mapping file are stored in big-endian byte order. -.SH "Key Mapping File and Device Mapping" -A key mapping file begins with a magic-number and continues with a -variable number of device-specific key mappings. -.PP -.RS -.AS -.AZ "struct KeyMappingFile {" -.AN " char magic_number[4];" " " "// `KYM1'" -.AN " DeviceMapping maps[...];" "" "// Variable number of maps" -.AZ }; -.AE -.PP -.AS -.AZ "struct DeviceMapping {" -.AN " dword interface;" " " "// Interface type" -.AN " dword handler_id;" "" "// Interface subtype" -.AN " dword map_size;" " " "// Byte count of `map' (below)" -.AN " KeyMapping map;" -.AZ }; -.AE -.RE -.PP -The value of `interface' represents a family of keyboard device types -(such as Intel -.SM "PC, ADB, NeXT," -Sun Type5, etc.), and is generally specified as one of the constant values -.SM "NX_EVS_DEVICE_INTERFACE_ADB, NX_EVS_DEVICE_INTERFACE_ACE," -etc., which are are defined in IOHIDTypes.h on MacOS/X and Darwin, and in -ev_types.h on MacOS/X Server, OpenStep, and NextStep. -.PP -The value of `handler_id' represents a specific keyboard layout within the -much broader `interface' family. For instance, for a 101-key Intel -.SM PC -keyboard (of type -.SM NX_EVS_DEVICE_INTERFACE_ACE\c -) the `handler_id' is '0', whereas for a 102-key keyboard it is `1'. -.PP -Together, `interface' and `handler_id' identify the exact keyboard hardware to -which this mapping applies. Programs which display a visual representation of -a keyboard layout, match `interface' and `handler_id' from the -.I .keymapping -file against the `interface' and `handler_id' values found in each -.I .keyboard -file. -.SH "Key Mapping" -A key mapping completely defines the relationship of all scan codes with their -associated functionality. A -.I KeyMapping -structure is embedded within the -.I DeviceMapping -structure in a -.IR KeyMappingFile . -The key mapping currently in use by the WindowServer and AppKit is also -represented by a -.I KeyMapping -structure, and can be referred to directly by calling NXGetKeyMapping() and -accessing the `mapping' data member of the returned -.I NXKeyMapping -structure. -.PP -.RS -.AS -.AZ "struct KeyMapping {" -.AN " word number_size;" " " "// 0=1 byte, non-zero=2 bytes" -.AN " number num_modifier_groups;" "" "// Modifier groups" -.AZ " ModifierGroup modifier_groups[...];" -.AN " number num_scan_codes;" " " "// Scan groups" -.AN " ScanGroup scan_table[...];" -.AN " number num_sequence_lists;" " " "// Sequence lists" -.AN " Sequence sequence_lists[...];" -.AN " number num_special_keys;" " " "// Special keys" -.AN " SpecialKey special_key[...];" -.AZ }; -.AE -.RE -.PP -The `number_size' flag determines the size, in bytes, of all remaining numeric -values (denoted by the type definition -.RI ` number ') -within the -key mapping. If its value is zero, then numbers are represented by a single -byte. If it is non-zero, then numbers are represented by a word (two bytes). -.SH "Modifier Group" -A modifier group defines all scan codes which map to a particular type of -modifier, such as -.IR shift , -.IR control , -etc. -.PP -.RS -.AS -.AZ "enum Modifier {" -.AZ " ALPHALOCK = 0," -.AZ " SHIFT," -.AZ " CONTROL," -.AZ " ALTERNATE," -.AZ " COMMAND," -.AZ " KEYPAD," -.AZ " HELP" -.AZ }; -.AE -.PP -.AS -.AZ "struct ModifierGroup {" -.AN " number modifier;" " " "// A Modifier constant" -.AN " number num_scan_codes;" -.AN " number scan_codes[...];" "" "// Variable number of scan codes" -.AZ }; -.AE -.RE -.PP -The scan_codes[] array contains a list of all scan codes which map to the -specified modifier. The -.IR shift ", " command ", and " alternate -modifiers are frequently mapped to two different scan codes, apiece, -since these modifiers often appear on both the left and right sides of -the keyboard. -.SH "Scan Group" -There is one -.I ScanGroup -for each scan code generated by the given keyboard. This number is given by -KeyMapping::num_scan_codes. The first scan group represents hardware scan -code 0, the second represents scan code 1, etc. -.PP -.RS -.AS -.AZ "enum ModifierMask {" -.AN " ALPHALOCK_MASK" " " "= 1 << 0," -.AN " SHIFT_MASK" " " "= 1 << 1," -.AN " CONTROL_MASK" " " "= 1 << 2," -.AN " ALTERNATE_MASK" " " "= 1 << 3," -.AN " CARRIAGE_RETURN_MASK" "" "= 1 << 4" -.AZ }; -.AZ "#define NOT_BOUND 0xff" -.AE -.PP -.AS -.AZ "struct ScanGroup {" -.AN " number mask;" -.AN " Character characters[...];" -.AZ }; -.AE -.RE -.PP -For each scan code, `mask' defines which modifier combinations generate -characters. If `mask' is -.SM NOT_BOUND -(0xff) then then this scan code does not generate any characters ever, and its -characters[] array is zero length. Otherwise, the characters[] array contains -one -.I Character -record for each modifier combination. -.PP -The number of records in characters[] is determined by computing (1 << -bits_set_in_mask). In other words, if mask is zero, then zero bits are set, -so characters[] contains only one record. If `mask' is -.SM "(SHIFT_MASK | CONTROL_MASK)," -then two bits are set, so characters[] contains four records. -.PP -The first record always represents the character which is generated by that -key when no modifiers are active. The remaining records represent characters -generated by the various modifier combinations. Using the example with the -.I shift -and -.I control -masks set, record two would represent the character with the -.I shift -modifier active; record three, the -.I control -modifier active; and record four, both the -.I shift -and -.I control -modifiers active. -.PP -As a special case, -.SM ALPHALOCK_MASK -implies -.SM SHIFT_MASK, -though only -.SM ALPHALOCK_MASK -appears in `mask'. In this case the same character is generated for both the -.I shift -and -.I alpha-lock -modifiers, but only needs to appear once in the characters[] array. -.PP -.SM CARRIAGE_RETURN_MASK -does not actually refer to a modifier key. Instead, it is used to -distinguish the scan code which is given the special pseudo-designation of -.I "carriage return" -key. Typically, this mask appears solo in a -.I ScanGroup -record and only the two -.I Character -records for control-M and control-C follow. This flag may be a throwback to -an earlier time or may be specially interpreted by the low-level keyboard -driver, but its purpose is otherwise enigmatic. -.SH Character -Each -.I Character -record indicates the character generated when this key is pressed, as well as -the character set which contains the character. Well known character sets are -.SM `ASCII' -and `Symbol'. The character set can also be one of the meta values -.SM FUNCTION_KEY -or -.SM KEY_SEQUENCE. -If it is -.SM FUNCTION_KEY -then `char_code' represents a generally well-known function key such as those -enumerated by -.I FunctionKey. -If the character set is -.SM KEY_SEQUENCE -then `char_code' represents is a zero-base index into -KeyMapping::sequence_lists[]. -.PP -.RS -.AS -.AZ "enum CharacterSet {" -.AN " ASCII" " " "= 0x00," -.AN " SYMBOL" " " "= 0x01," -.AN " ..." -.AN " FUNCTION_KEY" "" "= 0xfe," -.AN " KEY_SEQUENCE" "" "= 0xff" -.AZ }; -.AE -.PP -.AS -.AZ "struct Character {" -.AN " number set;" " " "// CharacterSet of generated character" -.AN " number char_code;" "" "// Actual character generated" -.AZ }; -.AE -.PP -.AS -.AZ "enum FunctionKey {" -.AZ " F1 = 0x20, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12," -.AZ " INSERT, DELETE, HOME, END, PAGE_UP, PAGE_DOWN, PRINT_SCREEN," -.AZ " SCROLL_LOCK, PAUSE, SYS_REQUEST, BREAK, RESET, STOP, MENU," -.AZ " USER, SYSTEM, PRINT, CLEAR_LINE, CLEAR_DISPLAY, INSERT_LINE," -.AZ " DELETE_LINE, INSERT_CHAR, DELETE_CHAR, PREV, NEXT, SELECT" -.AZ }; -.AE -.RE -.SH Sequence -When Character::set contains the meta value -.SM KEY_SEQUENCE, -the scan code is bound to a sequence of keys rather than a single character. -A sequence is a series of modifiers and characters which are automatically -generated when the associated key is depressed. -.PP -.RS -.AS -.AZ "#define MODIFIER_KEY 0xff" -.AE -.PP -.AS -.AZ "struct Sequence {" -.AN " number num_chars;" -.AN " Character characters[...];" -.AZ }; -.AE -.RE -.PP -Each generated -.I Character -is represented as previously described, with the exception that -.SM MODIFIER_KEY -may appear in place of -.SM KEY_SEQUENCE. -When the value of Character::set is -.SM MODIFIER_KEY -then Character::char_code represents a modifier key rather than an actual -character. If the modifier represented by `char_code' is non-zero, then it -indicates that the associated modifier key has been depressed. In this case, -the value is one of the constants enumerated by -.I Modifier -(\c -.SM "SHIFT, CONTROL, ALTERNATE," -etc.). If the value is zero then it means that the modifier keys have been -released. -.SH "Special Key" -A special key is one which is scanned directly by the Mach kernel rather than -by the WindowServer. In general, events are not generated for special keys. -.PP -.RS -.AS -.AZ "enum SpecialKeyType {" -.AZ " VOLUME_UP = 0," -.AZ " VOLUME_DOWN," -.AZ " BRIGHTNESS_UP," -.AZ " BRIGHTNESS_DOWN," -.AZ " ALPHA_LOCK," -.AZ " HELP," -.AZ " POWER," -.AZ " SECONDARY_ARROW_UP," -.AZ " SECONDARY_ARROW_DOWN" -.AZ }; -.AE -.PP -.AS -.AZ "struct SpecialKey {" -.AN " number type;" " " "// A SpecialKeyType constant" -.AN " number scan_code;" "" "// Actual scan code" -.AZ }; -.AE -.RE -.SH OUTPUT -What follows is an explanation and description of the various pieces of -information emitted by -.I dumpkeymap. -.PP -For a more thorough discussion of any particular piece of information described -here, refer to the detailed description of the internal layout of a key mapping -provided by the -.I "Key Mapping Description" -section above. -.SH Conventions -Depending upon context, some numeric values are displayed in decimal -notation, whereas others are displayed in hexadecimal notation. -Hexadecimal numbers are denoted by a `0x' prefix (for instance, `0x7b'), -except when explicitly noted otherwise. -.SH "Key Mapping Source" -The first piece of information presented about a particular key mapping is the -source from which the data was gleaned. For a -.I .keymapping -file, the title -.SM "`KEYMAP FILE'" -is emitted along with the path and name of the file in question. For the key -mapping currently in use by the WindowServer and AppKit, the title -.SM "`ACTIVE KEYMAP'" -is emitted instead. -.SH "Device Information" -Each -.I .keymapping -file may contain one or more raw key mappings. For example, a file which maps -keys to a Dvorak-style layout might contain raw mappings for Intel -.SM "PC, ADB, NeXT," -and Sun Type5 keyboards. -.PP -For each raw mapping, the following information is emitted: -.BG -.BU -The title -.SM `KEYMAP' -along with the mapping's relative position in the -.I .keymapping -file. -.BU -The `interface' identifier. -.BU -The `handler_id' sub-identifier. -.BU -The size of the raw mapping resource counted in bytes. -.BE -The `interface' and `handler_id' values, taken together, define a specific -keyboard device. A -.I .keyboard -file, which describes the visual layout of a keyboard, also contains -`interface' and `handler_id' identifiers. The -.I .keyboard -file corresponding to a particular key mapping can be found by matching the -`interface' and `handler_id' values from each resource. -.SH Modifiers -Each mapping may contain zero or more modifier records which associate hardware -scan codes with modifier descriptions such as -.I "shift, control, alternate," -etc. The title -.SM `MODIFIERS' -is printed along with the count of modifier records which follow. For each -modifier record, the modifier's name is printed along with a list of scan -codes, in hexadecimal format, which generate that modifier value. For example: -.PP -.RS -.nf -MODIFIERS [4] -alternate: 0x1d 0x60 -control: 0x3a -keypad: 0x52 0x53 ... 0x63 0x62 -shift: 0x2a 0x36 -.fi -.RE -.SH Characters -Each mapping may contain zero or more character records which associate -hardware scan codes with the actual characters generated by those scan -codes in the presence or absence of various modifier combinations. The -title -.SM `CHARACTERS' -is printed along with the count of character records which follow. Here is a -highly abbreviated example: -.PP -.RS -.nf -CHARACTERS [9] -scan 0x00: -AC-L "a" "A" "^A" "^A" ca c7 "^A" "^A" -scan 0x07: -AC-L "x" "X" "^X" "^X" 01/b4 01/ce "^X" "^X" -scan 0x0a: ---S- "<" ">" -scan 0x13: -ACS- "2" "@" "^@" "^@" b2 b3 "^@" "^@" -scan 0x24: R---- "^M" "^C" -scan 0x3e: ----- [F4] -scan 0x4a: ----- [page up] -scan 0x60: ----- {seq#3} -scan 0x68: not-bound -.fi -.RE -.PP -For each record, the hexadecimal value of the hardware scan code is printed, -followed by a list of modifier flag combinations and the actual characters -generated by this scan code with and without modifiers applied. -.PP -The modifier flags field is composed of a combination of single letter -representations of the various modifier types. The letters stand for: -.PP -.RS -.nf -L \- alpha-lock -S \- shift -C \- control -A \- alternate -R \- carriage-return -.fi -.RE -.PP -As a special case, the -.I alpha-lock -flag also implies the -.I shift -flag, so these two flags never appear together in the same record. -.PP -The combination of modifier flags determines the meaning and number of fields -which follow. The first field after the modifier flags always represents the -character that will be generated if no modifier keys are depressed. The -remaining fields represent characters generated by the various modifier -combinations. The order of the fields follows this general pattern: -.BG -.BU -The character generated by this scan code when no modifiers are in effect is -listed first. -.BU -If the `L' or `S' flag is active, then the shifted character generated by this -scan code is listed next. -.BU -If the `C' flag is active, then the control-character generated by this scan -code is listed next. Furthermore, if the `L' or `S' flag is also active, then -the shifted control-character is listed after that. -.BU -If the `A' flag is active, then the alternate-character generated by this scan -code is listed next. Furthermore, if the `L' or `S' flag is active, then the -shifted alternate-character is listed after that. If the `C' flag is also -active, then the alternate-control-character is listed next. Finally, if the -`C' and `L' or `C' and `S' flags are also active, then the shifted -alternate-control-character is listed. -.BE -The `R' flag does not actually refer to a modifier key. Instead, it is used to -distinguish the scan code which is given the special pseudo-designation of -.I "carriage return" -key. Typically, this mask appears solo and only the two fields for control-M -and control-C follow. This flag may be a throwback to an earlier time or may -be specially interpreted by the low-level keyboard driver, but its purpose is -otherwise enigmatic. -.PP -Recalling the example from above, the following fields can be identified: -.PP -.RS -.nf -scan 0x00: -AC-L "a" "A" "^A" "^A" ca c7 "^A" "^A" -.fi -.RE -.BG -.BU -Lower-case `a' is generated when no modifiers are active. -.BU -Upper-case `A' is generated when -.IR shift " or " alpha-lock -are active. -.BU -Control-A is generated when -.I control -is active. -.BU -Control-A is generated when -.IR control " and " shift -are active. -.BU -The character represented by the hexadecimal code 0xca is generated when -.I alternate -is active. -.BU -The character represented by 0xc7 is generated when -.IR alternate " and " shift " (or " alpha-lock ") are active." -.BU -Control-A is generated when -.IR alternate " and " control -are active. -.BU -Control-A is generated when -.IR "alternate, control" " and " shift " (or " alpha-lock ") are active." -.BE -The notation used to represent a particular generated character varies. -.BG -.BU -Printable -.SM ASCII -characters are quoted, as in "x" or "X". -.BU -Control-characters are quoted and prefixed with `^', as in "^X". -.BU -Characters with values greater than 127 (0x7f) are displayed as hexadecimal -values without the `0x' prefix. -.BU -Characters in a non-\c -.SM ASCII -character set (such as `Symbol') are displayed as two hexadecimal numbers -separated by a slash, as in `01/4a'. The first number is the character set's -identification code (such as `01' for the `Symbol' set), and the second number -is the value of the generated character. -.BU -Non-printing special function characters are displayed with the function's -common name enclosed in brackets, as in `[page up]' or `[F4]'. -.BU -If the binding represents a key sequence rather than a single character, then -the sequence's identification number is enclosed in braces, as in `{seq#3}'. -.BE -Recalling a few examples from above, the following interpretations can be made: -.PP -.RS -.nf -scan 0x07: -AC-L "x" "X" "^X" "^X" 01/b4 01/ce "^X" "^X" -scan 0x3e: ----- [F4] -scan 0x4a: ----- [page up] -scan 0x60: ----- {seq#3} -.fi -.RE -.BG -.BU -"x" and "X" are printable -.SM ASCII -characters. -.BU -"^X" is a control-character. -.BU -`01/b4' and `01/ce' represent the character codes 0xb4 and 0xce in the `Symbol' -character set. -.BU -Scan code 0x3e generates function-key `F4', and scan code 0x4a generates -function-key `page up'. -.BU -Scan code 0x60 is bound to key sequence #3. -.BE -Finally, if a scan code is not bound to any characters, then it is annotated -with the label `not-bound', as with example scan code 0x68 from above. -.SH Sequences -A scan code (modified and unmodified) can be bound to a key sequence rather -than generating a single character or acting as a modifier. When it is bound -to a key sequence, a series of character invocations and modifier actions are -automatically generated rather than a single keystroke. -.PP -Each mapping may contain zero or more key sequence records. The title -.SM `SEQUENCES' -is printed along with the count of sequence records which follow. For example: -.PP -.RS -.nf -SEQUENCES [3] -sequence 0: "f" "o" "o" -sequence 1: {alternate} "b" "a" "r" {unmodify} -sequence 2: [home] "b" "a" "z" -.fi -.RE -.PP -The notation used to represent the sequence of generated characters is -identical to the notation already described in the -.I Characters -section above, with the exception that modifier actions may be interposed -between generated characters. Such modifier actions are represented by the -modifier's name enclosed in braces. The special name `{unmodify}' indicates -the release of the modifier keys. -.PP -Thus, the sequences in the above example can be interpreted as follows: -.BG -.BU -Sequence\ #0 generates `foo'. -.BU -Sequence\ #1 invokes the -.I alternate -modifier, generates `bar', and then releases -.I alternate. -.BU -Sequence\ #2 invokes the -.I home -key and then generates `baz'. In a text editor, this would probably result in -`baz' being prepended to the line of text on which the cursor resides. -.BE -.SH Special Keys -Certain keyboards feature keys which perform some type of special purpose -function rather than generating a character or acting as a modifier. For -instance, Apple keyboards often contain a -.I power -key, and -.SM NeXT -keyboards have historically featured screen brightness and volume control keys. -.PP -Each mapping may contain zero or more special-key records which associate -hardware scan codes with such special purpose functions. The title -.SM `SPECIALS' -is printed along with the count of records which follow. For each record, the -special function's name is printed along with a list of scan codes, in -hexadecimal format, which are bound to that function. For example: -.PP -.RS -.nf -SPECIALS [6] -alpha-lock: 0x39 -brightness-down: 0x79 -brightness-up: 0x74 -power: 0x7f -sound-down: 0x77 -sound-up: 0x73 -.fi -.RE -.SH FILES -.IP *.keymapping -A key mapping file which precisely defines the relationship of all -hardware-specific keyboard scan-codes with their associated functionality. -.IP *.keyboard -A file describing the physical layout of keys on a particular type of -keyboard. Each `key' token in this file defines the position and shape of the -key on the keyboard, as well as the associated scan code which that key -generates. A -.I .keymapping -file, on the other hand, defines the characters which are generated by a -particular scan code depending upon the state of the various modifier keys -(such as -.I shift, -.I control, -etc.). The `interface' and `handler_id' values from a -.I .keymapping -file are matched against those in each -.I .keyboard -file in order to associate a particular -.I .keyboard -file with a key mapping. Various -.SM GUI -programs use the -.I .keyboard -file to display a visual representation of a keyboard for the user. Since -these files are just plain text, they can be easily viewed and interpreted -without the aid of a specialized program, thus -.I dumpkeymap -leaves these files alone. -.PP -/System/Library/Keyboards -.br -/Network/Library/Keyboards -.br -/Local/Library/Keyboards -.br -/Library/Keyboards -.RS -Repositories for -.I .keymapping -and -.I .keyboard -files for MacOS/X, Darwin, and MacOS/X Server. -.RE -.PP -/NextLibrary/Keyboards -.br -/LocalLibrary/Keyboards -.RS -Repositories for -.I .keymapping -and -.I .keyboard -files for OpenStep and NextStep. -.RE -.IP $(HOME)/Library/Keyboards -Repository for personal -.I .keymapping -and -.I .keyboard -files. -.SH DIGANOSTICS -The following diagnostic messages may be issued to the standard error stream. -.TG "Unrecognized option." -An unrecognized option was specified on the command-line. Invoke -.I dumpkeymap -with the -.B "\-\^\-help" -option to view a list of valid options. -.TG "Insufficient data in keymapping data stream." -The key mapping file or data stream is corrupt. Either the file has been -incorrectly truncated or a field, such as those which indicates the number of -variable records which follow, contains a corrupt value. -.PP -The following diagnostic messages have significance only when trying to print -.I .keymapping -files mentioned on the command-line. -.TG "Bad magic number." -The mentioned file is not a -.I .keymapping -file. The file's content does not start with the string `KYM1'. -.TG "Unable to open key mapping file." -The call to fopen() failed; probably because the specified path is invalid or -.I dumpkeymap -does not have permission to read the file. -.TG "Unable to determine key mapping file size." -The call to fstat() failed, thus memory can not be allocated for loading the -file. -.TG "Unable to read key mapping file." -The call to fread() failed. -.PP -The following diagnostic messages have significance only when trying to print -the currently active key mapping when no -.I .keymapping -files have been mentioned on the command-line. -.TG "Unable to open event status driver." -The call to NXOpenEventStatus() failed. -.TG "Bad key mapping length." -The call to NXKeyMappingLength() returned a bogus value. -.TG "Unable to get current key mapping." -The call to NXGetKeyMapping() failed. -.PP -The following diagnostic messages have significance only when using -.I dumpkeymap -on a non-Apple/\c -.SM NeXT -platform. -.TG "Must specify at least one .keymapping file." -No -.I .keymapping -files were mentioned on the command-line. On non-Apple/\c -.SM NeXT -platforms, there is no concept of a currently active -.I .keymapping -file, so at least one file must be mentioned on the command-line. -.SH AUTHOR -Eric Sunshine <sunshine@sunshineco.com> wrote -.I dumpkeymap -and this document, the -.I "dumpkeymap user's manual." -Both -.I dumpkeymap -and this document are copyright \(co1999,2000 by Eric Sunshine -<sunshine@sunshineco.com>. All rights reserved. -.PP -The implementation of -.I dumpkeymap -is based upon information gathered on September 3, 1997 by Eric Sunshine -<sunshine@sunshineco.com> and Paul S. McCarthy <zarnuk@zarnuk.com> during an -effort to reverse engineer the format of the -.SM NeXT -.I .keymapping -file. -.if n .PP -.if n Version \n(VE \-\- -.if n .UP diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c index 949d7d689..4aa586aff 100644 --- a/hw/dmx/dmxcmap.c +++ b/hw/dmx/dmxcmap.c @@ -46,24 +46,10 @@ #include "micmap.h" -static int dmxInitColormapPrivateFunc(ColormapPtr pColormap, int index) -{ - return TRUE; -} - static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap) { - static unsigned long dmxColormapGeneration; dmxColormapPrivPtr pCmapPriv; - if (dmxColormapGeneration != serverGeneration) { - if ((dmxColormapPrivateIndex - = AllocateColormapPrivateIndex(dmxInitColormapPrivateFunc)) < 0) - return FALSE; - - dmxColormapGeneration = serverGeneration; - } - pCmapPriv = (dmxColormapPrivPtr)xalloc(sizeof(*pCmapPriv)); if (!pCmapPriv) return FALSE; diff --git a/hw/dmx/dmxcmap.h b/hw/dmx/dmxcmap.h index 228f8662e..f968f8622 100644 --- a/hw/dmx/dmxcmap.h +++ b/hw/dmx/dmxcmap.h @@ -56,15 +56,14 @@ extern Bool dmxBECreateColormap(ColormapPtr pColormap); extern Bool dmxBEFreeColormap(ColormapPtr pColormap); /** Private index. \see dmxcmap.c \see dmxscrinit.c \see dmxwindow.c */ -extern int dmxColormapPrivateIndex; +extern DevPrivateKey dmxColormapPrivateKey; /** Set colormap private structure. */ #define DMX_SET_COLORMAP_PRIV(_pCMap, _pCMapPriv) \ - (_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr \ - = (pointer)(_pCMapPriv); + dixSetPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey, _pCMapPriv) /** Get colormap private structure. */ -#define DMX_GET_COLORMAP_PRIV(_pCMap) \ - (dmxColormapPrivPtr)(_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr +#define DMX_GET_COLORMAP_PRIV(_pCMap) (dmxColormapPrivPtr) \ + dixLookupPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey) #endif /* DMXCMAP_H */ diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c index 1ad199d58..8a801169c 100644 --- a/hw/dmx/dmxcursor.c +++ b/hw/dmx/dmxcursor.c @@ -662,8 +662,8 @@ static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor); - pCursor->devPriv[pScreen->myNum] = xalloc(sizeof(*pCursorPriv)); - if (!pCursor->devPriv[pScreen->myNum]) + DMX_SET_CURSOR_PRIV(pCursor, pScreen, xalloc(sizeof(*pCursorPriv))); + if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen)) return FALSE; pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); @@ -700,9 +700,9 @@ static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) if (dmxScreen->beDisplay) { if (dmxBEFreeCursor(pScreen, pCursor)) - xfree(pCursor->devPriv[pScreen->myNum]); + xfree(DMX_GET_CURSOR_PRIV(pCursor, pScreen)); } - pCursor->devPriv[pScreen->myNum] = NULL; + DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL); return TRUE; } diff --git a/hw/dmx/dmxcursor.h b/hw/dmx/dmxcursor.h index 7b70c6250..d909bd01e 100644 --- a/hw/dmx/dmxcursor.h +++ b/hw/dmx/dmxcursor.h @@ -63,7 +63,10 @@ extern void dmxHideCursor(DMXScreenInfo *dmxScreen); extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor); extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor); -#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \ - (dmxCursorPrivPtr)(_pCursor)->devPriv[(_pScreen)->myNum] +#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \ + ((dmxCursorPrivPtr)dixLookupPrivate(&(_pCursor)->devPrivates, _pScreen)) + +#define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \ + dixSetPrivate(&(_pCursor)->devPrivates, _pScreen, v) #endif /* DMXCURSOR_H */ diff --git a/hw/dmx/dmxdpms.c b/hw/dmx/dmxdpms.c index 5c176dfc3..2af160556 100644 --- a/hw/dmx/dmxdpms.c +++ b/hw/dmx/dmxdpms.c @@ -175,9 +175,9 @@ void dmxDPMSTerm(DMXScreenInfo *dmxScreen) void dmxDPMSWakeup(void) { if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); #ifdef DPMSExtension - if (DPMSPowerLevel) DPMSSet(0); + if (DPMSPowerLevel) DPMSSet(serverClient, 0); #endif } @@ -190,11 +190,11 @@ Bool DPMSSupported(void) } /** This is used by clients (e.g., xset) to set the DPMS level. */ -void DPMSSet(int level) +int DPMSSet(ClientPtr client, int level) { int i; - if (!dpmsSupported) return; + if (!dpmsSupported) return Success; if (level < 0) level = DPMSModeOn; if (level > 3) level = DPMSModeOff; @@ -208,5 +208,6 @@ void DPMSSet(int level) dmxSync(dmxScreen, FALSE); } } + return Success; } #endif diff --git a/hw/dmx/dmxfont.c b/hw/dmx/dmxfont.c index 500b5682a..b70f7d2df 100644 --- a/hw/dmx/dmxfont.c +++ b/hw/dmx/dmxfont.c @@ -66,7 +66,7 @@ static char **dmxGetFontPath(int *npaths) char *newfp; int len, l, i; - paths = GetFontPath(npaths, &len); + GetFontPath(serverClient, npaths, &len, &paths); newfp = xalloc(*npaths + len); c = (unsigned char *)newfp; @@ -194,7 +194,7 @@ static int dmxProcSetFontPath(ClientPtr client) if (total >= 4) return BadLength; - tmpFontPath = GetFontPath(&nOldPaths, &lenOldPaths); + GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath); oldFontPath = xalloc(nOldPaths + lenOldPaths); memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths); @@ -361,7 +361,8 @@ Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont) } } - if (SetFontPath(NULL, newnpaths, (unsigned char *)newfp, &error)) { + if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp, + &error)) { /* Note that this should never happen since all of the * FPEs were previously valid. */ dmxLog(dmxError, "Cannot reset the default font path.\n"); diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c index 981f64d0a..ce1730cff 100644 --- a/hw/dmx/dmxgc.c +++ b/hw/dmx/dmxgc.c @@ -82,13 +82,9 @@ static GCOps dmxGCOps = { dmxPushPixels }; -/** Initialize the GC on \a pScreen, which currently involves allocating - * the GC private associated with this screen. */ +/** Initialize the GC on \a pScreen */ Bool dmxInitGC(ScreenPtr pScreen) { - if (!AllocateGCPrivate(pScreen, dmxGCPrivateIndex, sizeof(dmxGCPrivRec))) - return FALSE; - return TRUE; } diff --git a/hw/dmx/dmxgc.h b/hw/dmx/dmxgc.h index 3d49f6735..2da3ba85e 100644 --- a/hw/dmx/dmxgc.h +++ b/hw/dmx/dmxgc.h @@ -64,11 +64,11 @@ extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC); extern Bool dmxBEFreeGC(GCPtr pGC); /** Private index. \see dmxgc.c \see dmxscrinit.c */ -extern int dmxGCPrivateIndex; +extern DevPrivateKey dmxGCPrivateKey; /** Get private. */ #define DMX_GET_GC_PRIV(_pGC) \ - (dmxGCPrivPtr)(_pGC)->devPrivates[dmxGCPrivateIndex].ptr + (dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey) #define DMX_GC_FUNC_PROLOGUE(_pGC) \ do { \ diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c index bbb744c45..37dfa10ac 100644 --- a/hw/dmx/dmxpict.c +++ b/hw/dmx/dmxpict.c @@ -144,8 +144,7 @@ Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) if (!miPictureInit(pScreen, formats, nformats)) return FALSE; - if (!AllocatePicturePrivate(pScreen, dmxPictPrivateIndex, - sizeof(dmxPictPrivRec))) + if (!dixRequestPrivate(dmxPictPrivateKey, sizeof(dmxPictPrivRec))) return FALSE; ps = GetPictureScreen(pScreen); diff --git a/hw/dmx/dmxpict.h b/hw/dmx/dmxpict.h index c178ef39c..a81eb7d37 100644 --- a/hw/dmx/dmxpict.h +++ b/hw/dmx/dmxpict.h @@ -116,19 +116,19 @@ extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet); extern int dmxBECreatePicture(PicturePtr pPicture); extern Bool dmxBEFreePicture(PicturePtr pPicture); -extern int dmxPictPrivateIndex; /**< Index for picture private data */ -extern int dmxGlyphSetPrivateIndex; /**< Index for glyphset private data */ +extern DevPrivateKey dmxPictPrivateKey; /**< Index for picture private data */ +extern DevPrivateKey dmxGlyphSetPrivateKey; /**< Index for glyphset private data */ /** Get the picture private data given a picture pointer */ #define DMX_GET_PICT_PRIV(_pPict) \ - (dmxPictPrivPtr)(_pPict)->devPrivates[dmxPictPrivateIndex].ptr + (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey) /** Set the glyphset private data given a glyphset pointer */ #define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \ - GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateIndex, (_pPriv)) + GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv)) /** Get the glyphset private data given a glyphset pointer */ #define DMX_GET_GLYPH_PRIV(_pGlyph) \ - (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateIndex) + (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey) #endif /* DMXPICT_H */ diff --git a/hw/dmx/dmxpixmap.c b/hw/dmx/dmxpixmap.c index 29162f971..66224031a 100644 --- a/hw/dmx/dmxpixmap.c +++ b/hw/dmx/dmxpixmap.c @@ -44,12 +44,12 @@ #include "pixmapstr.h" #include "servermd.h" +#include "privates.h" /** Initialize a private area in \a pScreen for pixmap information. */ Bool dmxInitPixmap(ScreenPtr pScreen) { - if (!AllocatePixmapPrivate(pScreen, dmxPixPrivateIndex, - sizeof(dmxPixPrivRec))) + if (!dixRequestPrivate(dmxPixPrivateKey, sizeof(dmxPixPrivRec))) return FALSE; return TRUE; @@ -174,6 +174,7 @@ Bool dmxDestroyPixmap(PixmapPtr pPixmap) dmxSync(dmxScreen, FALSE); } } + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); #if 0 diff --git a/hw/dmx/dmxpixmap.h b/hw/dmx/dmxpixmap.h index 5cca7f44a..64418340c 100644 --- a/hw/dmx/dmxpixmap.h +++ b/hw/dmx/dmxpixmap.h @@ -58,10 +58,10 @@ extern void dmxBECreatePixmap(PixmapPtr pPixmap); extern Bool dmxBEFreePixmap(PixmapPtr pPixmap); /** Private index. \see dmxpicmap.h \see dmxscrinit.c */ -extern int dmxPixPrivateIndex; +extern DevPrivateKey dmxPixPrivateKey; /** Get pixmap private pointer. */ #define DMX_GET_PIXMAP_PRIV(_pPix) \ - (dmxPixPrivPtr)(_pPix)->devPrivates[dmxPixPrivateIndex].ptr + (dmxPixPrivPtr)dixLookupPrivate(&(_pPix)->devPrivates, dmxPixPrivateKey) #endif /* DMXPIXMAP_H */ diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c index a78e3ae8d..1d12ec32d 100644 --- a/hw/dmx/dmxscrinit.c +++ b/hw/dmx/dmxscrinit.c @@ -67,15 +67,15 @@ static Bool dmxSaveScreen(ScreenPtr pScreen, int what); static unsigned long dmxGeneration; static unsigned long *dmxCursorGeneration; -int dmxGCPrivateIndex; /**< Private index for GCs */ -int dmxWinPrivateIndex; /**< Private index for Windows */ -int dmxPixPrivateIndex; /**< Private index for Pixmaps */ +DevPrivateKey dmxGCPrivateKey = &dmxGCPrivateKey; /**< Private index for GCs */ +DevPrivateKey dmxWinPrivateKey = &dmxWinPrivateKey; /**< Private index for Windows */ +DevPrivateKey dmxPixPrivateKey = &dmxPixPrivateKey; /**< Private index for Pixmaps */ int dmxFontPrivateIndex; /**< Private index for Fonts */ -int dmxScreenPrivateIndex; /**< Private index for Screens */ -int dmxColormapPrivateIndex; /**< Private index for Colormaps */ +DevPrivateKey dmxScreenPrivateKey = &dmxScreenPrivateKey; /**< Private index for Screens */ +DevPrivateKey dmxColormapPrivateKey = &dmxColormapPrivateKey; /**< Private index for Colormaps */ #ifdef RENDER -int dmxPictPrivateIndex; /**< Private index for Picts */ -int dmxGlyphSetPrivateIndex; /**< Private index for GlyphSets */ +DevPrivateKey dmxPictPrivateKey = &dmxPictPrivateKey; /**< Private index for Picts */ +DevPrivateKey dmxGlyphSetPrivateKey = &dmxGlyphSetPrivateKey; /**< Private index for GlyphSets */ #endif /** Initialize the parts of screen \a idx that require access to the @@ -208,43 +208,11 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]) int i, j; if (dmxGeneration != serverGeneration) { -#ifdef RENDER - /* Allocate picture private index */ - dmxPictPrivateIndex = AllocatePicturePrivateIndex(); - if (dmxPictPrivateIndex == -1) - return FALSE; - - /* Allocate glyph set private index */ - dmxGlyphSetPrivateIndex = AllocateGlyphSetPrivateIndex(); - if (dmxGlyphSetPrivateIndex == -1) - return FALSE; -#endif - - /* Allocate GC private index */ - dmxGCPrivateIndex = AllocateGCPrivateIndex(); - if (dmxGCPrivateIndex == -1) - return FALSE; - - /* Allocate window private index */ - dmxWinPrivateIndex = AllocateWindowPrivateIndex(); - if (dmxWinPrivateIndex == -1) - return FALSE; - - /* Allocate pixmap private index */ - dmxPixPrivateIndex = AllocatePixmapPrivateIndex(); - if (dmxPixPrivateIndex == -1) - return FALSE; - /* Allocate font private index */ dmxFontPrivateIndex = AllocateFontPrivateIndex(); if (dmxFontPrivateIndex == -1) return FALSE; - /* Allocate screen private index */ - dmxScreenPrivateIndex = AllocateScreenPrivateIndex(); - if (dmxScreenPrivateIndex == -1) - return FALSE; - dmxGeneration = serverGeneration; } diff --git a/hw/dmx/dmxscrinit.h b/hw/dmx/dmxscrinit.h index 46a0a00a4..a4642350c 100644 --- a/hw/dmx/dmxscrinit.h +++ b/hw/dmx/dmxscrinit.h @@ -41,7 +41,7 @@ #include "scrnintstr.h" /** Private index. \see dmxscrrinit.c \see input/dmxconcole.c */ -extern int dmxScreenPrivateIndex; +extern DevPrivateKey dmxScreenPrivateKey; extern Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]); diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c index 7ccecfb5b..7494e6df2 100644 --- a/hw/dmx/dmxwindow.c +++ b/hw/dmx/dmxwindow.c @@ -64,8 +64,7 @@ static void dmxDoSetShape(WindowPtr pWindow); /** Initialize the private area for the window functions. */ Bool dmxInitWindow(ScreenPtr pScreen) { - if (!AllocateWindowPrivate(pScreen, dmxWinPrivateIndex, - sizeof(dmxWinPrivRec))) + if (!dixRequestPrivate(dmxWinPrivateKey, sizeof(dmxWinPrivRec))) return FALSE; return TRUE; diff --git a/hw/dmx/dmxwindow.h b/hw/dmx/dmxwindow.h index 79f85ac3a..72c76aa3b 100644 --- a/hw/dmx/dmxwindow.h +++ b/hw/dmx/dmxwindow.h @@ -103,11 +103,11 @@ extern void dmxSetShape(WindowPtr pWindow); #endif /** Private index. \see dmxwindow.c \see dmxscrinit.c */ -extern int dmxWinPrivateIndex; +extern DevPrivateKey dmxWinPrivateKey; /** Get window private pointer. */ -#define DMX_GET_WINDOW_PRIV(_pWin) \ - ((dmxWinPrivPtr)(_pWin)->devPrivates[dmxWinPrivateIndex].ptr) +#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \ + dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey)) /* All of these macros are only used in dmxwindow.c */ #define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \ diff --git a/hw/dmx/examples/ev.c b/hw/dmx/examples/ev.c index 10912266d..ba45c2b25 100644 --- a/hw/dmx/examples/ev.c +++ b/hw/dmx/examples/ev.c @@ -174,7 +174,7 @@ int main(int argc, char **argv) } printf("\n"); } - printf("rc = %d, errno = %d (%s)\n", rc, errno, strerror(errno)); + printf("rc = %d, (%s)\n", rc, strerror(errno)); close(fd); } } diff --git a/hw/dmx/examples/xinput.c b/hw/dmx/examples/xinput.c index 74353a93b..b6753e4ec 100644 --- a/hw/dmx/examples/xinput.c +++ b/hw/dmx/examples/xinput.c @@ -38,7 +38,7 @@ #include <X11/XKBlib.h> #include <X11/extensions/XInput.h> #include <X11/extensions/XKB.h> -#include <X11/extensions/XKBstr.h> +#include "xkbstr.h" #include <X11/extensions/dmxext.h> #include <sys/time.h> diff --git a/hw/dmx/examples/xled.c b/hw/dmx/examples/xled.c index 270f80511..322dda2f3 100644 --- a/hw/dmx/examples/xled.c +++ b/hw/dmx/examples/xled.c @@ -37,7 +37,7 @@ #include <X11/Xlib.h> #include <X11/XKBlib.h> #include <X11/extensions/XKB.h> -#include <X11/extensions/XKBstr.h> +#include "xkbstr.h" #include <sys/time.h> int main(int argc, char **argv) diff --git a/hw/dmx/glxProxy/Makefile.am b/hw/dmx/glxProxy/Makefile.am index 1fbc8d764..f99549817 100644 --- a/hw/dmx/glxProxy/Makefile.am +++ b/hw/dmx/glxProxy/Makefile.am @@ -32,6 +32,7 @@ libglxproxy_a_SOURCES = compsize.c \ unpack.h AM_CFLAGS = \ + @GLX_ARCH_DEFINES@ \ $(DIX_CFLAGS) \ -I$(top_srcdir)/hw/dmx \ -I$(top_srcdir)/include \ diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index 6771cf1de..85e0f8701 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -66,7 +66,6 @@ #ifdef PANORAMIX #include "panoramiXsrv.h" -extern XID *PanoramiXVisualTable; #endif extern __GLXFBConfig **__glXFBConfigs; @@ -2824,14 +2823,8 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) #ifdef PANORAMIX else if (!noPanoramiXExtension) { /* convert the associated visualId to the panoramix one */ - for (v=0; v<255; v++) { - if ( PanoramiXVisualTable[ v * MAXSCREENS + screen ] == - associatedVisualId ) { - associatedVisualId = v; - break; - } - } - pFBConfig->associatedVisualId = associatedVisualId; + pFBConfig->associatedVisualId = + PanoramiXTranslateVisualID(screen, v); } #endif } diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c index cc820a204..b2a2ec302 100644 --- a/hw/dmx/input/dmxconsole.c +++ b/hw/dmx/input/dmxconsole.c @@ -612,7 +612,8 @@ static Bool dmxCloseConsoleScreen(int idx, ScreenPtr pScreen) { myPrivate *priv, *last; - for (last = priv = pScreen->devPrivates[dmxScreenPrivateIndex].ptr; + for (last = priv = (myPrivate *)dixLookupPrivate(&pScreen->devPrivates, + dmxScreenPrivateKey); priv; priv = priv->next) dmxCloseConsole(last = priv); @@ -846,13 +847,15 @@ void dmxConsoleInit(DevicePtr pDev) dmxConsoleDraw(priv, 1, 1); - if (screenInfo.screens[0]->devPrivates[dmxScreenPrivateIndex].ptr) - priv->next = (screenInfo.screens[0] - ->devPrivates[dmxScreenPrivateIndex].ptr); + if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates, + dmxScreenPrivateKey)) + priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, + dmxScreenPrivateKey); else DMX_WRAP(CloseScreen, dmxCloseConsoleScreen, priv, screenInfo.screens[0]); - screenInfo.screens[0]->devPrivates[dmxScreenPrivateIndex].ptr = priv; + dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey, + priv); } /** Fill in the \a info structure for the specified \a pDev. Only used diff --git a/hw/dmx/input/dmxeq.c b/hw/dmx/input/dmxeq.c index 3e98fb799..dff0b4423 100644 --- a/hw/dmx/input/dmxeq.c +++ b/hw/dmx/input/dmxeq.c @@ -82,7 +82,6 @@ #ifdef XINPUT #include <X11/extensions/XIproto.h> #define EXTENSION_PROC_ARGS void * -#include "extinit.h" /* For LookupDeviceIntRec */ #endif #if DMX_EQ_DEBUG @@ -217,8 +216,9 @@ static void dmxeqProcessXInputEvent(xEvent *xe, EventRec *e) { deviceKeyButtonPointer *ev = (deviceKeyButtonPointer *)xe; int id = ev->deviceid & DEVICE_BITS; - DeviceIntPtr pDevice = LookupDeviceIntRec(id); + DeviceIntPtr pDevice; + dixLookupDevice(&pDevice, id, serverClient, DixUnknownAccess); if (!pDevice) { dmxLog(dmxError, "dmxeqProcessInputEvents: id %d not found\n", id); return; diff --git a/hw/kdrive/ati/ati_stub.c b/hw/kdrive/ati/ati_stub.c index 3669fd743..f881b7f7b 100644 --- a/hw/kdrive/ati/ati_stub.c +++ b/hw/kdrive/ati/ati_stub.c @@ -50,14 +50,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) void InitInput(int argc, char **argv) { - KdKeyboardInfo *ki = NULL; - - KdAddPointerDriver(&LinuxMouseDriver); - ki = KdNewKeyboard(); - if (ki) { - ki->driver = &LinuxKeyboardDriver; - KdAddKeyboard(ki); - } + KdOsAddInputDrivers(); KdInitInput(); } diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c index c11da0634..506d7bed8 100644 --- a/hw/kdrive/ephyr/XF86dri.c +++ b/hw/kdrive/ephyr/XF86dri.c @@ -385,7 +385,7 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext) context, hHWContext ); } -Bool XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context) +GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context) { Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); @@ -406,7 +406,7 @@ Bool XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid conte return True; } -Bool +GLboolean XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen, __DRIid drawable, drm_drawable_t * hHWDrawable) { @@ -437,7 +437,7 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen, return True; } -Bool XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, +GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, __DRIid drawable ) { Display * const dpy = (Display *) ndpy; diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 282b52868..e95001dcd 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -402,6 +402,7 @@ ephyrUnsetInternalDamage (ScreenPtr pScreen) pPixmap = (*pScreen->GetScreenPixmap) (pScreen); DamageUnregister (&pPixmap->drawable, scrpriv->pDamage); + DamageDestroy (scrpriv->pDamage); RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, ephyrInternalDamageWakeupHandler, @@ -634,7 +635,9 @@ ephyrInitScreen (ScreenPtr pScreen) if (!ephyrNoDRI && !hostx_has_dri ()) { EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ; ephyrNoDRI = TRUE ; +#ifdef GLXEXT noGlxVisualInit = FALSE ; +#endif } if (!ephyrNoDRI) { ephyrDRIExtensionInit (pScreen) ; @@ -737,7 +740,7 @@ ephyrUpdateModifierState(unsigned int state) int i; CARD8 mask; - pkeydev = (DeviceIntPtr)LookupKeyboardDevice(); + pkeydev = inputInfo.keyboard; if (!pkeydev) return; @@ -838,6 +841,39 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs = ephyrWarpCursor }; +#ifdef XEPHYR_DRI +/** + * find if the remote window denoted by a_remote + * is paired with an internal Window within the Xephyr server. + * If the remove window is paired with an internal window, send an + * expose event to the client insterested in the internal window expose event. + * + * Pairing happens when a drawable inside Xephyr is associated with + * a GL surface in a DRI environment. + * Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to + * know a paired window is created. + * + * This is useful to make GL drawables (only windows for now) handle + * expose events and send those events to clients. + */ +static void +ephyrExposePairedWindow (int a_remote) +{ + EphyrWindowPair *pair = NULL; + RegionRec reg; + ScreenPtr screen; + + if (!findWindowPairFromRemote (a_remote, &pair)) { + EPHYR_LOG ("did not find a pair for this window\n"); + return; + } + screen = pair->local->drawable.pScreen; + REGION_NULL (screen, ®); + REGION_COPY (screen, ®, &pair->local->clipList); + screen->WindowExposures (pair->local, ®, NullRegion); + REGION_UNINIT (screen, ®); +} +#endif /*XEPHYR_DRI*/ void ephyrPoll(void) @@ -858,9 +894,13 @@ ephyrPoll(void) if (ephyrCurScreen != ev.data.mouse_motion.screen) { EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ; - ephyrWarpCursor(screenInfo.screens[ev.data.mouse_motion.screen], - ev.data.mouse_motion.x, - ev.data.mouse_motion.y ); + if (ev.data.mouse_motion.screen >= 0) + { + ephyrWarpCursor + (screenInfo.screens[ev.data.mouse_motion.screen], + ev.data.mouse_motion.x, + ev.data.mouse_motion.y ); + } } else { @@ -910,6 +950,18 @@ ephyrPoll(void) KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE); break; +#ifdef XEPHYR_DRI + case EPHYR_EV_EXPOSE: + /* + * We only receive expose events when the expose event have + * be generated for a drawable that is a host X window managed + * by Xephyr. Host X windows managed by Xephyr exists for instance + * when Xephyr is asked to create a GL drawable in a DRI environment. + */ + ephyrExposePairedWindow (ev.data.expose.window); + break; +#endif /*XEPHYR_DRI*/ + default: break; } @@ -1028,6 +1080,7 @@ EphyrKeyboardInit (KdKeyboardInfo *ki) ki->minScanCode = ki->keySyms.minKeyCode; ki->maxScanCode = ki->keySyms.maxKeyCode; ki->keySyms.mapWidth = ephyrKeySyms.mapWidth; + xfree(ki->keySyms.map); ki->keySyms.map = ephyrKeySyms.map; ki->name = KdSaveString("Xephyr virtual keyboard"); ephyrKbd = ki; diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c index e3d0cfbb4..fafe56d1f 100644 --- a/hw/kdrive/ephyr/ephyrdriext.c +++ b/hw/kdrive/ephyr/ephyrdriext.c @@ -44,6 +44,7 @@ #include <X11/dri/xf86dri.h> #include <X11/dri/xf86dristr.h> #include "misc.h" +#include "privates.h" #include "dixstruct.h" #include "extnsionst.h" #include "colormapst.h" @@ -58,10 +59,6 @@ #define _HAVE_XALLOC_DECLS #include "ephyrlog.h" -typedef struct { - WindowPtr local ; - int remote ; -} EphyrWindowPair; typedef struct { int foo; @@ -118,14 +115,13 @@ static Bool findWindowPairFromLocal (WindowPtr a_local, static unsigned char DRIReqCode = 0; -static int ephyrDRIGeneration=-1 ; -static int ephyrDRIWindowIndex=-1 ; -static int ephyrDRIScreenIndex=-1 ; +static DevPrivateKey ephyrDRIWindowKey = &ephyrDRIWindowKey; +static DevPrivateKey ephyrDRIScreenKey = &ephyrDRIScreenKey; -#define GET_EPHYR_DRI_WINDOW_PRIV(win) \ - ((EphyrDRIWindowPrivPtr)((win)->devPrivates[ephyrDRIWindowIndex].ptr)) -#define GET_EPHYR_DRI_SCREEN_PRIV(screen) \ - ((EphyrDRIScreenPrivPtr)((screen)->devPrivates[ephyrDRIScreenIndex].ptr)) +#define GET_EPHYR_DRI_WINDOW_PRIV(win) ((EphyrDRIWindowPrivPtr) \ + dixLookupPrivate(&(win)->devPrivates, ephyrDRIWindowKey)) +#define GET_EPHYR_DRI_SCREEN_PRIV(screen) ((EphyrDRIScreenPrivPtr) \ + dixLookupPrivate(&(screen)->devPrivates, ephyrDRIScreenKey)) Bool @@ -164,28 +160,18 @@ ephyrDRIExtensionInit (ScreenPtr a_screen) EPHYR_LOG_ERROR ("failed to register DRI extension\n") ; goto out ; } - if (ephyrDRIGeneration != serverGeneration) { - ephyrDRIScreenIndex = AllocateScreenPrivateIndex () ; - if (ephyrDRIScreenIndex < 0) { - EPHYR_LOG_ERROR ("failed to allocate screen priv index\n") ; - goto out ; - } - } screen_priv = xcalloc (1, sizeof (EphyrDRIScreenPrivRec)) ; if (!screen_priv) { EPHYR_LOG_ERROR ("failed to allocate screen_priv\n") ; goto out ; } - a_screen->devPrivates[ephyrDRIScreenIndex].ptr = screen_priv; + dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv); if (!ephyrDRIScreenInit (a_screen)) { EPHYR_LOG_ERROR ("ephyrDRIScreenInit() failed\n") ; goto out ; } EphyrMirrorHostVisuals (a_screen) ; - if (ephyrDRIGeneration != serverGeneration) { - ephyrDRIGeneration = serverGeneration ; - } is_ok=TRUE ; out: EPHYR_LOG ("leave\n") ; @@ -203,17 +189,6 @@ ephyrDRIScreenInit (ScreenPtr a_screen) screen_priv=GET_EPHYR_DRI_SCREEN_PRIV (a_screen) ; EPHYR_RETURN_VAL_IF_FAIL (screen_priv, FALSE) ; - if (ephyrDRIGeneration != serverGeneration) { - ephyrDRIWindowIndex = AllocateWindowPrivateIndex () ; - if (ephyrDRIWindowIndex < 0) { - EPHYR_LOG_ERROR ("failed to allocate window priv index\n") ; - goto out ; - } - } - if (!AllocateWindowPrivate (a_screen, ephyrDRIWindowIndex, 0)) { - EPHYR_LOG_ERROR ("failed to allocate window privates\n") ; - goto out ; - } screen_priv->CreateWindow = a_screen->CreateWindow ; screen_priv->DestroyWindow = a_screen->DestroyWindow ; screen_priv->MoveWindow = a_screen->MoveWindow ; @@ -227,7 +202,7 @@ ephyrDRIScreenInit (ScreenPtr a_screen) a_screen->ClipNotify = ephyrDRIClipNotify ; is_ok = TRUE ; -out: + return is_ok ; } @@ -254,7 +229,7 @@ ephyrDRICreateWindow (WindowPtr a_win) screen->CreateWindow = ephyrDRICreateWindow ; if (is_ok) { - a_win->devPrivates[ephyrDRIWindowIndex].ptr = NULL ; + dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL); } return is_ok ; } @@ -285,7 +260,7 @@ ephyrDRIDestroyWindow (WindowPtr a_win) if (win_priv) { destroyHostPeerWindow (a_win) ; xfree (win_priv) ; - a_win->devPrivates[ephyrDRIWindowIndex].ptr = NULL ; + dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL); EPHYR_LOG ("destroyed the remote peer window\n") ; } } @@ -971,6 +946,26 @@ findWindowPairFromLocal (WindowPtr a_local, return FALSE ; } +Bool +findWindowPairFromRemote (int a_remote, + EphyrWindowPair **a_pair) +{ + int i=0 ; + + EPHYR_RETURN_VAL_IF_FAIL (a_pair, FALSE) ; + + for (i=0; i < NUM_WINDOW_PAIRS; i++) { + if (window_pairs[i].remote == a_remote) { + *a_pair = &window_pairs[i] ; + EPHYR_LOG ("found (%p, %d)\n", + (*a_pair)->local, + (*a_pair)->remote) ; + return TRUE ; + } + } + return FALSE ; +} + static Bool createHostPeerWindow (const WindowPtr a_win, int *a_peer_win) @@ -1088,7 +1083,7 @@ ProcXF86DRICreateDrawable (ClientPtr client) EPHYR_LOG_ERROR ("failed to allocate window private\n") ; return BadAlloc ; } - window->devPrivates[ephyrDRIWindowIndex].ptr = win_priv ; + dixSetPrivate(&window->devPrivates, ephyrDRIWindowKey, win_priv); EPHYR_LOG ("paired window '%#x' with remote '%d'\n", (unsigned int)window, remote_win) ; } diff --git a/hw/kdrive/ephyr/ephyrdriext.h b/hw/kdrive/ephyr/ephyrdriext.h index 66af833b9..01c9421fb 100644 --- a/hw/kdrive/ephyr/ephyrdriext.h +++ b/hw/kdrive/ephyr/ephyrdriext.h @@ -27,6 +27,16 @@ */ #ifndef __EPHYRDRIEXT_H__ #define __EPHYRDRIEXT_H__ + +typedef struct { + WindowPtr local ; + int remote ; +} EphyrWindowPair; + Bool ephyrDRIExtensionInit (ScreenPtr a_screen) ; + +Bool findWindowPairFromRemote (int a_remote, + EphyrWindowPair **a_pair); + #endif /*__EPHYRDRIEXT_H__*/ diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c index 381c9d7ed..43a634d24 100644 --- a/hw/kdrive/ephyr/ephyrglxext.c +++ b/hw/kdrive/ephyr/ephyrglxext.c @@ -362,7 +362,7 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc) ClientPtr client = a_cl->client; xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) a_pc; xGLXQueryServerStringReply reply; - char *server_string=NULL ; + char *server_string=NULL, *buf=NULL; int length=0 ; EPHYR_LOG ("enter\n") ; @@ -379,9 +379,15 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc) reply.sequenceNumber = client->sequence ; reply.length = __GLX_PAD (length) >> 2 ; reply.n = length ; + buf = xcalloc (reply.length << 2, 1); + if (!buf) { + EPHYR_LOG_ERROR ("failed to allocate string\n;"); + return BadAlloc; + } + memcpy (buf, server_string, length); WriteToClient(client, sz_xGLXQueryServerStringReply, (char*)&reply); - WriteToClient(client, (int)length, server_string); + WriteToClient(client, (int)(reply.length << 2), server_string); res = Success ; @@ -391,6 +397,10 @@ out: xfree (server_string) ; server_string = NULL; } + if (buf) { + xfree (buf); + buf = NULL; + } return res ; } diff --git a/hw/kdrive/ephyr/ephyrhostglx.c b/hw/kdrive/ephyr/ephyrhostglx.c index 5d9a482e8..f5db5be16 100644 --- a/hw/kdrive/ephyr/ephyrhostglx.c +++ b/hw/kdrive/ephyr/ephyrhostglx.c @@ -151,6 +151,7 @@ ephyrHostGLXGetStringFromServer (int a_screen_number, { Bool is_ok=FALSE ; Display *dpy = hostx_get_display () ; + int default_screen = DefaultScreen (dpy); xGLXGenericGetStringReq *req=NULL; xGLXSingleReply reply; int length=0, numbytes=0, major_opcode=0, get_string_op=0; @@ -188,13 +189,17 @@ ephyrHostGLXGetStringFromServer (int a_screen_number, GetReq (GLXGenericGetString, req); req->reqType = major_opcode; req->glxCode = get_string_op; - req->for_whom = DefaultScreen (dpy); + req->for_whom = default_screen; req->name = a_string_name; _XReply (dpy, (xReply *)&reply, 0, False); length = reply.length * 4; - numbytes = reply.size; + if (!length) { + numbytes = 0; + } else { + numbytes = reply.size; + } EPHYR_LOG ("going to get a string of size:%d\n", numbytes) ; *a_string = (char *) Xmalloc (numbytes +1); diff --git a/hw/kdrive/ephyr/ephyrlog.h b/hw/kdrive/ephyr/ephyrlog.h index 4c6435edd..71f797777 100644 --- a/hw/kdrive/ephyr/ephyrlog.h +++ b/hw/kdrive/ephyr/ephyrlog.h @@ -33,8 +33,8 @@ #ifdef NDEBUG /*we are not in debug mode*/ -#define EPHYR_LOG -#define EPHYR_LOG_ERROR +#define EPHYR_LOG(...) +#define EPHYR_LOG_ERROR(...) #endif /*NDEBUG*/ #define ERROR_LOG_LEVEL 3 diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index b5ffdd075..ae1bb4bf9 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -839,16 +839,38 @@ hostx_load_keymap(void) static struct EphyrHostScreen * host_screen_from_window (Window w) { - int index; + int index = 0; + struct EphyrHostScreen *result = NULL; +#if 0 + unsigned int num_children = 0; + Window root = None, parent = None, *children = NULL; +#endif for (index = 0 ; index < HostX.n_screens ; index++) { if (HostX.screens[index].win == w) { - return &HostX.screens[index]; + result = &HostX.screens[index]; + goto out; } } - return NULL; +#if 0 + XQueryTree (hostx_get_display (), w, &root, &parent, + &children, &num_children); + if (parent == root || parent == None) + goto out; + result = host_screen_from_window (parent); +#endif + +out: +#if 0 + if (children) + { + XFree (children); + children = NULL; + } +#endif + return result; } int @@ -870,9 +892,19 @@ hostx_get_event(EphyrHostXEvent *ev) { struct EphyrHostScreen *host_screen = host_screen_from_window (xev.xexpose.window); - hostx_paint_rect (host_screen->info, 0, 0, 0, 0, - host_screen->win_width, - host_screen->win_height); + if (host_screen) + { + hostx_paint_rect (host_screen->info, 0, 0, 0, 0, + host_screen->win_width, + host_screen->win_height); + } + else + { + EPHYR_LOG_ERROR ("failed to get host screen\n"); + ev->type = EPHYR_EV_EXPOSE; + ev->data.expose.window = xev.xexpose.window; + return 1; + } } return 0; @@ -1078,16 +1110,6 @@ out: } -typedef struct { - int is_valid ; - int local_id ; - int remote_id ; -} ResourcePair ; - -#define RESOURCE_PEERS_SIZE 1024*10 -static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ; - - int hostx_create_window (int a_screen_number, EphyrBox *a_geometry, @@ -1123,12 +1145,18 @@ hostx_create_window (int a_screen_number, visual_info->screen), visual_info->visual, AllocNone) ; - winmask = CWColormap; + attrs.event_mask = ButtonPressMask + |ButtonReleaseMask + |PointerMotionMask + |KeyPressMask + |KeyReleaseMask + |ExposureMask; + winmask = CWColormap|CWEventMask; win = XCreateWindow (dpy, hostx_get_window (a_screen_number), a_geometry->x, a_geometry->y, a_geometry->width, a_geometry->height, 0, - visual_info->depth, InputOutput, + visual_info->depth, CopyFromParent, visual_info->visual, winmask, &attrs) ; if (win == None) { EPHYR_LOG_ERROR ("failed to create peer window\n") ; @@ -1259,6 +1287,16 @@ hostx_has_xshape (void) } #ifdef XEPHYR_DRI +typedef struct { + int is_valid ; + int local_id ; + int remote_id ; +} ResourcePair ; + +#define RESOURCE_PEERS_SIZE 1024*10 +static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ; + + int hostx_allocate_resource_id_peer (int a_local_resource_id, int *a_remote_resource_id) diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h index 3caa466a7..f72cfe700 100644 --- a/hw/kdrive/ephyr/hostx.h +++ b/hw/kdrive/ephyr/hostx.h @@ -47,7 +47,8 @@ typedef enum EphyrHostXEventType EPHYR_EV_MOUSE_PRESS, EPHYR_EV_MOUSE_RELEASE, EPHYR_EV_KEY_PRESS, - EPHYR_EV_KEY_RELEASE + EPHYR_EV_KEY_RELEASE, + EPHYR_EV_EXPOSE } EphyrHostXEventType; @@ -87,6 +88,10 @@ struct EphyrHostXEvent int scancode; } key_down; + struct expose { + int window; + } expose; + } data; int key_state; diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c index 5e1c88b2c..de80c79aa 100644 --- a/hw/kdrive/fbdev/fbinit.c +++ b/hw/kdrive/fbdev/fbinit.c @@ -42,17 +42,7 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) void InitInput (int argc, char **argv) { - KdKeyboardInfo *ki; - - KdAddKeyboardDriver (&LinuxKeyboardDriver); - KdAddPointerDriver (&LinuxMouseDriver); -#ifdef TSLIB - KdAddPointerDriver (&TsDriver); -#endif - - ki = KdParseKeyboard ("keybd"); - KdAddKeyboard(ki); - + KdOsAddInputDrivers (); KdInitInput (); } diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c index 23cd8f59f..258dc7b81 100644 --- a/hw/kdrive/linux/linux.c +++ b/hw/kdrive/linux/linux.c @@ -441,7 +441,7 @@ LinuxFini (void) memset (&vts, '\0', sizeof (vts)); /* valgrind */ ioctl (fd, VT_GETSTATE, &vts); if (ioctl (fd, VT_DISALLOCATE, vtno) < 0) - fprintf (stderr, "Can't deallocate console %d errno %d\n", vtno, errno); + fprintf (stderr, "Can't deallocate console %d %s\n", vtno, strerror(errno)); close (fd); } return; diff --git a/hw/kdrive/savage/s3draw.c b/hw/kdrive/savage/s3draw.c index e2766df0f..da0d6849f 100644 --- a/hw/kdrive/savage/s3draw.c +++ b/hw/kdrive/savage/s3draw.c @@ -78,9 +78,8 @@ short s3alu[16] = { #define PixTransStore(t) *pix_trans = (t) #endif -int s3GCPrivateIndex; -int s3WindowPrivateIndex; -int s3Generation; +DevPrivateKey s3GCPrivateKey = &s3GCPrivateKey; +DevPrivateKey s3WindowPrivateKey = &s3WindowPrivateKey; /* s3DoBitBlt @@ -2182,7 +2181,7 @@ s3CreateWindow (WindowPtr pWin) KdScreenPriv(pWin->drawable.pScreen); s3ScreenInfo(pScreenPriv); - pWin->devPrivates[s3WindowPrivateIndex].ptr = 0; + dixSetPrivate(&pWin->devPrivates, s3WindowPrivateKey, NULL); return KdCreateWindow (pWin); } @@ -2979,15 +2978,7 @@ s3DrawInit (ScreenPtr pScreen) } else { - if (serverGeneration != s3Generation) - { - s3GCPrivateIndex = AllocateGCPrivateIndex (); - s3WindowPrivateIndex = AllocateWindowPrivateIndex (); - s3Generation = serverGeneration; - } - if (!AllocateWindowPrivate(pScreen, s3WindowPrivateIndex, 0)) - return FALSE; - if (!AllocateGCPrivate(pScreen, s3GCPrivateIndex, sizeof (s3PrivGCRec))) + if (!dixRequestPrivate(s3GCPrivateKey, sizeof (s3PrivGCRec))) return FALSE; pScreen->CreateGC = s3CreateGC; pScreen->CreateWindow = s3CreateWindow; diff --git a/hw/kdrive/savage/s3draw.h b/hw/kdrive/savage/s3draw.h index 068904370..eab8e395e 100644 --- a/hw/kdrive/savage/s3draw.h +++ b/hw/kdrive/savage/s3draw.h @@ -24,8 +24,8 @@ #ifndef _S3DRAW_H_ #define _S3DRAW_H_ -extern int s3GCPrivateIndex; -extern int s3WindowPrivateIndex; +extern DevPrivateKey s3GCPrivateKey; +extern DevPrivateKey s3WindowPrivateKey; typedef struct _s3Pattern { S3PatternCache *cache; @@ -42,16 +42,16 @@ typedef struct _s3PrivGC { s3PatternPtr pPattern; /* pattern */ } s3PrivGCRec, *s3PrivGCPtr; -#define s3GetGCPrivate(g) ((s3PrivGCPtr) \ - (g)->devPrivates[s3GCPrivateIndex].ptr) +#define s3GetGCPrivate(g) ((s3PrivGCPtr) \ + dixLookupPrivate(&(g)->devPrivates, s3GCPrivateKey)) -#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g) +#define s3GCPrivate(g) s3PrivGCPtr s3Priv = s3GetGCPrivate(g) -#define s3GetWindowPrivate(w) ((s3PatternPtr) \ - (w)->devPrivates[s3WindowPrivateIndex].ptr) +#define s3GetWindowPrivate(w) ((s3PatternPtr) \ + dixLookupPrivate(&(w)->devPrivates, s3WindowPrivateKey)) -#define s3SetWindowPrivate(w,p) (\ - (w)->devPrivates[s3WindowPrivateIndex].ptr = (pointer) p) +#define s3SetWindowPrivate(w,p) \ + dixSetPrivate(&(w)->devPrivates, s3WindowPrivateKey, p) void _s3LoadPattern (ScreenPtr pScreen, int fb, s3PatternPtr pPattern); diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c index 027163024..db09e9dba 100644 --- a/hw/kdrive/src/kaa.c +++ b/hw/kdrive/src/kaa.c @@ -42,9 +42,8 @@ #define DBG_PIXMAP(a) #endif -int kaaGeneration; -int kaaScreenPrivateIndex; -int kaaPixmapPrivateIndex; +DevPrivateKey kaaScreenPrivateKey = &kaaScreenPrivateKey; +DevPrivateKey kaaPixmapPrivateKey = &kaaPixmapPrivateKey; #define KAA_PIXMAP_SCORE_MOVE_IN 10 #define KAA_PIXMAP_SCORE_MAX 20 @@ -997,18 +996,6 @@ kaaFillRegionSolid (DrawablePtr pDrawable, kaaDrawableDirty (pDrawable); } -#if 0 -static void -kaaFillRegionTiled (DrawablePtr pDrawable, - RegionPtr pRegion, - Pixmap pTile) -{ - else - { - kaaWaitSync -} -#endif - Bool kaaDrawInit (ScreenPtr pScreen, KaaScreenInfoPtr pScreenInfo) @@ -1020,13 +1007,6 @@ kaaDrawInit (ScreenPtr pScreen, PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif - if (kaaGeneration != serverGeneration) - { - kaaScreenPrivateIndex = AllocateScreenPrivateIndex(); - kaaPixmapPrivateIndex = AllocatePixmapPrivateIndex(); - kaaGeneration = serverGeneration; - } - pKaaScr = xalloc (sizeof (KaaScreenPrivRec)); if (!pKaaScr) @@ -1034,7 +1014,7 @@ kaaDrawInit (ScreenPtr pScreen, pKaaScr->info = pScreenInfo; - pScreen->devPrivates[kaaScreenPrivateIndex].ptr = (pointer) pKaaScr; + dixSetPrivate(&pScreen->devPrivates, kaaScreenPrivateKey, pKaaScr); /* * Hook up asynchronous drawing @@ -1058,17 +1038,11 @@ kaaDrawInit (ScreenPtr pScreen, if ((pKaaScr->info->flags & KAA_OFFSCREEN_PIXMAPS) && screen->off_screen_base < screen->memory_size) { - if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, - sizeof (KaaPixmapPrivRec))) + if (!dixRequestPrivate(kaaPixmapPrivateKey, sizeof (KaaPixmapPrivRec))) return FALSE; pScreen->CreatePixmap = kaaCreatePixmap; pScreen->DestroyPixmap = kaaDestroyPixmap; } - else - { - if (!AllocatePixmapPrivate(pScreen, kaaPixmapPrivateIndex, 0)) - return FALSE; - } return TRUE; } diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h index db890a75b..90b963b10 100644 --- a/hw/kdrive/src/kaa.h +++ b/hw/kdrive/src/kaa.h @@ -27,11 +27,14 @@ #include "picturestr.h" -#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr)(s)->devPrivates[kaaScreenPrivateIndex].ptr) +#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \ + dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey)) #define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s) -#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr)(p)->devPrivates[kaaPixmapPrivateIndex].ptr) -#define KaaSetPixmapPriv(p,a) ((p)->devPrivates[kaaPixmapPrivateIndex].ptr = (pointer) (a)) +#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \ + dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey)) +#define KaaSetPixmapPriv(p,a) \ + dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, a) #define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p) typedef struct { @@ -46,8 +49,8 @@ typedef struct { Bool dirty; } KaaPixmapPrivRec, *KaaPixmapPrivPtr; -extern int kaaScreenPrivateIndex; -extern int kaaPixmapPrivateIndex; +extern DevPrivateKey kaaScreenPrivateKey; +extern DevPrivateKey kaaPixmapPrivateKey; void diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 5376f19db..50148c49c 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -29,6 +29,7 @@ #endif #include <mivalidate.h> #include <dixstruct.h> +#include "privates.h" #ifdef RANDR #include <randrstr.h> #endif @@ -66,8 +67,8 @@ KdDepths kdDepths[] = { #define KD_DEFAULT_BUTTONS 5 -int kdScreenPrivateIndex; -unsigned long kdGeneration; +DevPrivateKey kdScreenPrivateKey = &kdScreenPrivateKey; +unsigned long kdGeneration; Bool kdVideoTest; unsigned long kdVideoTestTime; @@ -751,10 +752,8 @@ KdAllocatePrivates (ScreenPtr pScreen) KdPrivScreenPtr pScreenPriv; if (kdGeneration != serverGeneration) - { - kdScreenPrivateIndex = AllocateScreenPrivateIndex(); - kdGeneration = serverGeneration; - } + kdGeneration = serverGeneration; + pScreenPriv = (KdPrivScreenPtr) xalloc(sizeof (*pScreenPriv)); if (!pScreenPriv) return FALSE; @@ -1401,8 +1400,8 @@ KdInitOutput (ScreenInfo *pScreenInfo, } #ifdef DPMSExtension -void -DPMSSet(int level) +int +DPMSSet(ClientPtr client, int level) { } diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index 2fde66c4d..4e04b59f7 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -498,7 +498,7 @@ typedef struct _KaaScreenInfo { (PixmapWidthPaddingInfo[d].padRoundUp+1))) #endif -extern int kdScreenPrivateIndex; +extern DevPrivateKey kdScreenPrivateKey; extern unsigned long kdGeneration; extern Bool kdEnabled; extern Bool kdSwitchPending; @@ -510,9 +510,9 @@ extern char *kdSwitchCmd; extern KdOsFuncs *kdOsFuncs; #define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \ - (pScreen)->devPrivates[kdScreenPrivateIndex].ptr) -#define KdSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[kdScreenPrivateIndex].ptr = \ - (pointer) v) + dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey)) +#define KdSetScreenPriv(pScreen,v) \ + dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v) #define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen) /* kaa.c */ @@ -832,7 +832,10 @@ KdSetPointerMatrix (KdPointerMatrix *pointer); void KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height); - + +void +KdScreenToPointerCoords (int *x, int *y); + void KdBlockHandler (int screen, pointer blockData, diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 6c247c185..df73942e7 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -631,6 +631,18 @@ KdComputePointerMatrix (KdPointerMatrix *m, Rotation randr, int width, } } +void +KdScreenToPointerCoords (int *x, int *y) +{ + int (*m)[3] = kdPointerMatrix.matrix; + int div = m[0][1] * m[1][0] - m[1][1] * m[0][0]; + int sx = *x; + int sy = *y; + + *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - m[1][1] * sx) / div; + *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - m[0][0] * sy) / div; +} + static void KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) { diff --git a/hw/kdrive/src/kmap.c b/hw/kdrive/src/kmap.c index b92c1a84f..ce1e28ae4 100644 --- a/hw/kdrive/src/kmap.c +++ b/hw/kdrive/src/kmap.c @@ -132,8 +132,8 @@ KdSetMappedMode (CARD32 addr, CARD32 size, int mode) sentry.type = type; if (ioctl (mtrr, MTRRIOC_ADD_ENTRY, &sentry) < 0) - ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (errno %d)\n", - base, bound - base, type, errno); + ErrorF ("MTRRIOC_ADD_ENTRY failed 0x%x 0x%x %d (%s)\n", + base, bound - base, type, strerror(errno)); } #endif } @@ -171,8 +171,8 @@ KdResetMappedMode (CARD32 addr, CARD32 size, int mode) sentry.type = type; if (ioctl (mtrr, MTRRIOC_DEL_ENTRY, &sentry) < 0) - ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (errno %d)\n", - base, bound - base, type, errno); + ErrorF ("MTRRIOC_DEL_ENTRY failed 0x%x 0x%x %d (%s)\n", + base, bound - base, type, strerror(errno)); } #endif } diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c index 046ab27b3..0b8d1c4e0 100644 --- a/hw/kdrive/src/kxv.c +++ b/hw/kdrive/src/kxv.c @@ -104,23 +104,23 @@ static void KdXVClipNotify(WindowPtr pWin, int dx, int dy); static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr*, int); -int KdXVWindowIndex = -1; -int KdXvScreenIndex = -1; +DevPrivateKey KdXVWindowKey = &KdXVWindowKey; +DevPrivateKey KdXvScreenKey = &KdXvScreenKey; static unsigned long KdXVGeneration = 0; static unsigned long PortResource = 0; -int (*XvGetScreenIndexProc)(void) = XvGetScreenIndex; +DevPrivateKey (*XvGetScreenKeyProc)(void) = XvGetScreenKey; unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort; int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit; -#define GET_XV_SCREEN(pScreen) \ - ((XvScreenPtr)((pScreen)->devPrivates[KdXvScreenIndex].ptr)) +#define GET_XV_SCREEN(pScreen) ((XvScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey)) #define GET_KDXV_SCREEN(pScreen) \ ((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) -#define GET_KDXV_WINDOW(pWin) \ - ((KdXVWindowPtr)((pWin)->devPrivates[KdXVWindowIndex].ptr)) +#define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey)) static KdXVInitGenericAdaptorPtr *GenDrivers = NULL; static int NumGenDrivers = 0; @@ -192,21 +192,15 @@ KdXVScreenInit( /* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */ - if(KdXVGeneration != serverGeneration) { - if((KdXVWindowIndex = AllocateWindowPrivateIndex()) < 0) - return FALSE; - KdXVGeneration = serverGeneration; - } - - if(!AllocateWindowPrivate(pScreen,KdXVWindowIndex,0)) - return FALSE; + if (KdXVGeneration != serverGeneration) + KdXVGeneration = serverGeneration; - if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc) + if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc) return FALSE; if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; - KdXvScreenIndex = (*XvGetScreenIndexProc)(); + KdXvScreenKey = (*XvGetScreenKeyProc)(); PortResource = (*XvGetRTPortProc)(); pxvs = GET_XV_SCREEN(pScreen); @@ -938,7 +932,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) if(!winPriv) return BadAlloc; winPriv->PortRec = portPriv; winPriv->next = PrivRoot; - pWin->devPrivates[KdXVWindowIndex].ptr = (pointer)winPriv; + dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv); } return Success; } @@ -956,8 +950,7 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) if(prevPriv) prevPriv->next = winPriv->next; else - pWin->devPrivates[KdXVWindowIndex].ptr = - (pointer)winPriv->next; + dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next); xfree(winPriv); break; } @@ -981,7 +974,8 @@ KdXVCreateWindow(WindowPtr pWin) ret = (*pScreen->CreateWindow)(pWin); pScreen->CreateWindow = KdXVCreateWindow; - if(ret) pWin->devPrivates[KdXVWindowIndex].ptr = NULL; + if (ret) + dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL); return ret; } @@ -1010,7 +1004,7 @@ KdXVDestroyWindow(WindowPtr pWin) xfree(tmp); } - pWin->devPrivates[KdXVWindowIndex].ptr = NULL; + dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL); pScreen->DestroyWindow = ScreenPriv->DestroyWindow; ret = (*pScreen->DestroyWindow)(pWin); @@ -1067,8 +1061,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) pPriv->pDraw = NULL; if(!pPrev) - pWin->devPrivates[KdXVWindowIndex].ptr = - (pointer)(WinPriv->next); + dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; tmp = WinPriv; @@ -1117,8 +1110,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy) pPriv->pDraw = NULL; if(!pPrev) - pWin->devPrivates[KdXVWindowIndex].ptr = - (pointer)(WinPriv->next); + dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; tmp = WinPriv; diff --git a/hw/kdrive/vesa/vesainit.c b/hw/kdrive/vesa/vesainit.c index 90b168108..a5e216cfd 100644 --- a/hw/kdrive/vesa/vesainit.c +++ b/hw/kdrive/vesa/vesainit.c @@ -70,15 +70,7 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv) void InitInput (int argc, char **argv) { - KdKeyboardInfo *ki = NULL; - - KdAddPointerDriver(&LinuxMouseDriver); - KdAddKeyboardDriver(&LinuxKeyboardDriver); - ki = KdNewKeyboard(); - if (ki) { - ki->driver = &LinuxKeyboardDriver; - KdAddKeyboard(ki); - } + KdOsAddInputDrivers(); KdInitInput(); } diff --git a/hw/kdrive/vesa/vm86.c b/hw/kdrive/vesa/vm86.c index 78fc593a7..0f7bb2262 100644 --- a/hw/kdrive/vesa/vm86.c +++ b/hw/kdrive/vesa/vm86.c @@ -567,7 +567,7 @@ vm86_loop(Vm86InfoPtr vi) if(errno == ENOSYS) { ErrorF("No vm86 support. Are you running on AMD64?\n"); } else { - ErrorF("vm86 failed (errno = %d).\n", errno); + ErrorF("vm86 failed (%s).\n", strerror(errno)); Vm86Debug(vi); } } else { diff --git a/hw/kdrive/vxworks/vxkbd.c b/hw/kdrive/vxworks/vxkbd.c index be528c78a..ac83ef729 100644 --- a/hw/kdrive/vxworks/vxkbd.c +++ b/hw/kdrive/vxworks/vxkbd.c @@ -232,7 +232,7 @@ VxWorksKeyboardRead (int fd) void VxWorksKeyboardLeds (int leds) { - DeviceIntPtr pKeyboard = (DeviceIntPtr) LookupKeyboardDevice (); + DeviceIntPtr pKeyboard = inputInfo.keyboard; KeyboardCtrl *ctrl = &pKeyboard->kbdfeed->ctrl; led_ioctl_info led_info; int i; diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index 0d4ca57fe..1edceb930 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -179,8 +179,8 @@ ddxGiveUp() if (-1 == unlink(vfbScreens[i].mmap_file)) { perror("unlink"); - ErrorF("unlink %s failed, errno %d", - vfbScreens[i].mmap_file, errno); + ErrorF("unlink %s failed, %s", + vfbScreens[i].mmap_file, strerror(errno)); } } break; @@ -196,7 +196,7 @@ ddxGiveUp() if (-1 == shmdt((char *)vfbScreens[i].pXWDHeader)) { perror("shmdt"); - ErrorF("shmdt failed, errno %d", errno); + ErrorF("shmdt failed, %s", strerror(errno)); } } break; @@ -220,7 +220,7 @@ AbortDDX() ddxGiveUp(); } -#ifdef __DARWIN__ +#ifdef __APPLE__ void DarwinHandleGUI(int argc, char *argv[]) { @@ -582,7 +582,7 @@ vfbBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) #endif { perror("msync"); - ErrorF("msync failed, errno %d", errno); + ErrorF("msync failed, %s", strerror(errno)); } } } @@ -605,7 +605,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb) if (-1 == (pvfb->mmap_fd = open(pvfb->mmap_file, O_CREAT|O_RDWR, 0666))) { perror("open"); - ErrorF("open %s failed, errno %d", pvfb->mmap_file, errno); + ErrorF("open %s failed, %s", pvfb->mmap_file, strerror(errno)); return; } @@ -621,7 +621,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb) if (-1 == write(pvfb->mmap_fd, dummyBuffer, writeThisTime)) { perror("write"); - ErrorF("write %s failed, errno %d", pvfb->mmap_file, errno); + ErrorF("write %s failed, %s", pvfb->mmap_file, strerror(errno)); return; } } @@ -635,7 +635,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb) if (-1 == (long)pvfb->pXWDHeader) { perror("mmap"); - ErrorF("mmap %s failed, errno %d", pvfb->mmap_file, errno); + ErrorF("mmap %s failed, %s", pvfb->mmap_file, strerror(errno)); pvfb->pXWDHeader = NULL; return; } @@ -659,7 +659,7 @@ vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb) if (pvfb->shmid < 0) { perror("shmget"); - ErrorF("shmget %d bytes failed, errno %d", pvfb->sizeInBytes, errno); + ErrorF("shmget %d bytes failed, %s", pvfb->sizeInBytes, strerror(errno)); return; } @@ -669,7 +669,7 @@ vfbAllocateSharedMemoryFramebuffer(vfbScreenInfoPtr pvfb) if (-1 == (long)pvfb->pXWDHeader) { perror("shmat"); - ErrorF("shmat failed, errno %d", errno); + ErrorF("shmat failed, %s", strerror(errno)); pvfb->pXWDHeader = NULL; return; } diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am index 4c46d5e69..7200dc7f5 100644 --- a/hw/xfree86/Makefile.am +++ b/hw/xfree86/Makefile.am @@ -8,6 +8,10 @@ if GLUCOSE GLUCOSE_DIR=glucose endif +if DRI2 +DRI2_SUBDIR = dri2 +endif + if XF86UTILS XF86UTILS_SUBDIR = utils endif @@ -25,12 +29,21 @@ DOC_SUBDIR = doc SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \ ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \ xf8_16bpp loader dixmods exa modes \ +<<<<<<< HEAD:hw/xfree86/Makefile.am $(DRI_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR) $(GLUCOSE_DIR) +======= + $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR) +>>>>>>> 41aea6194bd29ab34cc166b3fd90eee64299ddf8:hw/xfree86/Makefile.am DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \ parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \ +<<<<<<< HEAD:hw/xfree86/Makefile.am xf8_16bpp xf8_32bpp loader dixmods dri exa modes \ utils doc glucose +======= + xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \ + utils doc +>>>>>>> 41aea6194bd29ab34cc166b3fd90eee64299ddf8:hw/xfree86/Makefile.am bin_PROGRAMS = Xorg diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 5499b694e..4f0a2d6b3 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -31,7 +31,7 @@ BUILT_SOURCES = xf86DefModeSet.c AM_LDFLAGS = -r libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \ xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \ - xf86DoProbe.c xf86DoScanPci.c xf86Events.c \ + xf86DoProbe.c xf86Events.c \ xf86Globals.c xf86AutoConfig.c \ xf86MiscExt.c xf86Option.c \ xf86VidMode.c xf86fbman.c xf86cmap.c \ @@ -85,9 +85,8 @@ EXTRA_DIST = \ xf86Version.h \ xorgVersion.h \ xf86Date.h \ - xf86DefModes.c \ $(MODEDEFSOURCES) \ - modeline2c.pl \ + modeline2c.awk \ $(DISTKBDSOURCES) if LNXACPI diff --git a/hw/xfree86/common/modeline2c.awk b/hw/xfree86/common/modeline2c.awk index 7a893300c..d4b9649c8 100644 --- a/hw/xfree86/common/modeline2c.awk +++ b/hw/xfree86/common/modeline2c.awk @@ -29,7 +29,7 @@ # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# Usage: modeline2c.awk < modefile > xf86DefModes.c +# Usage: modeline2c.awk < modefile > xf86DefModeSet.c # BEGIN { diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 064107428..4b3e10463 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -57,9 +57,9 @@ /* General parameters */ extern int xf86DoConfigure; extern Bool xf86DoConfigurePass1; -extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */ -extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */ -extern int xf86PixmapIndex; +extern DevPrivateKey xf86ScreenKey; +extern DevPrivateKey xf86CreateRootWindowKey; +extern DevPrivateKey xf86PixmapKey; extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern const unsigned char byte_reversed[256]; extern ScrnInfoPtr xf86CurrentScreen; @@ -72,8 +72,8 @@ extern Bool sbusSlotClaimed; extern confDRIRec xf86ConfigDRI; extern Bool xf86inSuspend; -#define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) - +#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \ + xf86ScreenKey)) #define XF86FLIP_PIXELS() \ do { \ if (xf86GetFlipPixels()) { \ @@ -337,8 +337,9 @@ int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, pointer value); Bool xf86IsUnblank(int mode); -void xf86AddModuleInfo(ModuleInfoPtr info, pointer module); -void xf86DeleteModuleInfo(int idx); +_X_DEPRECATED void xf86AddModuleInfo(pointer info, pointer module); +_X_DEPRECATED void xf86DeleteModuleInfo(int idx); +void xf86getsecs(long *, long *); /* xf86Debug.c */ #ifdef BUILDDEBUG diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index c6e197216..da6c3f38d 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -184,7 +184,7 @@ videoPtrToDriverName(struct pci_device *dev) case 0x3d3d: return "glint"; case 0x1023: return "trident"; case 0x100c: return "tseng"; - case 0x1106: return "via"; + case 0x1106: return "openchrome"; case 0x15ad: return "vmware"; default: break; } diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 599f7a46e..f7ffac85e 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -290,8 +290,10 @@ xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex) if (entityIndex == -1) return; if (xf86Entities[entityIndex]->inUse && - !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) - FatalError("Requested Entity already in use!\n"); + !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) { + ErrorF("Requested Entity already in use!\n"); + return; + } pScrn->numEntities++; pScrn->entityList = xnfrealloc(pScrn->entityList, diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 622c31850..605c6b347 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -733,7 +733,6 @@ typedef enum { FLAG_DISABLEMODINDEV, FLAG_MODINDEVALLOWNONLOCAL, FLAG_ALLOWMOUSEOPENFAIL, - FLAG_VTINIT, FLAG_VTSYSREQ, FLAG_XKBDISABLE, FLAG_PCIPROBE1, @@ -785,8 +784,6 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_ALLOWMOUSEOPENFAIL, "AllowMouseOpenFail", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_VTINIT, "VTInit", OPTV_STRING, - {0}, FALSE }, { FLAG_VTSYSREQ, "VTSysReq", OPTV_BOOLEAN, {0}, FALSE }, { FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN, @@ -977,8 +974,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) #endif } - xf86Info.vtinit = xf86GetOptValString(FlagOptions, FLAG_VTINIT); - if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1)) xf86Info.pciFlags = PCIProbe1; if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2)) diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 85d4b2ea0..0daf1de44 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -49,8 +49,7 @@ #include "mi.h" -static unsigned long DGAGeneration = 0; -static int DGAScreenIndex = -1; +static DevPrivateKey DGAScreenKey = NULL; static int mieq_installed = 0; static Bool DGACloseScreen(int i, ScreenPtr pScreen); @@ -68,8 +67,8 @@ DGACopyModeInfo( _X_EXPORT int *XDGAEventBase = NULL; -#define DGA_GET_SCREEN_PRIV(pScreen) \ - ((DGAScreenPtr)((pScreen)->devPrivates[DGAScreenIndex].ptr)) +#define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, DGAScreenKey)) typedef struct _FakedVisualList{ @@ -116,11 +115,7 @@ DGAInit( if(!modes || num <= 0) return FALSE; - if(DGAGeneration != serverGeneration) { - if((DGAScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - DGAGeneration = serverGeneration; - } + DGAScreenKey = &DGAScreenKey; if(!(pScreenPriv = (DGAScreenPtr)xalloc(sizeof(DGAScreenRec)))) return FALSE; @@ -148,7 +143,7 @@ DGAInit( modes[i].flags &= ~DGA_PIXMAP_AVAILABLE; #endif - pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, DGAScreenKey, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = DGACloseScreen; pScreenPriv->DestroyColormap = pScreen->DestroyColormap; @@ -176,7 +171,7 @@ DGAReInitModes( int i; /* No DGA? Ignore call (but don't make it look like it failed) */ - if(DGAScreenIndex < 0) + if(DGAScreenKey == NULL) return TRUE; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); @@ -350,7 +345,7 @@ xf86SetDGAMode( DGAModePtr pMode = NULL; /* First check if DGAInit was successful on this screen */ - if (DGAScreenIndex < 0) + if (DGAScreenKey == NULL) return BadValue; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if (!pScreenPriv) @@ -485,7 +480,7 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode) DGAModePtr pMode; PixmapPtr pPix; - if(DGAScreenIndex < 0) + if(DGAScreenKey == NULL) return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); @@ -535,11 +530,12 @@ DGAChangePixmapMode(int index, int *x, int *y, int mode) _X_EXPORT Bool DGAAvailable(int index) { - if(DGAScreenIndex < 0) + if(DGAScreenKey == NULL) return FALSE; - if (!xf86NoSharedResources(((ScrnInfoPtr)screenInfo.screens[index]-> - devPrivates[xf86ScreenIndex].ptr)->scrnIndex,MEM)) + if (!xf86NoSharedResources(((ScrnInfoPtr)dixLookupPrivate( + &screenInfo.screens[index]->devPrivates, + xf86ScreenKey))->scrnIndex, MEM)) return FALSE; if(DGA_GET_SCREEN_PRIV(screenInfo.screens[index])) @@ -553,7 +549,7 @@ DGAActive(int index) { DGAScreenPtr pScreenPriv; - if(DGAScreenIndex < 0) + if(DGAScreenKey == NULL) return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); @@ -574,7 +570,7 @@ DGAShutdown() ScrnInfoPtr pScrn; int i; - if(DGAScreenIndex < 0) + if(DGAScreenKey == NULL) return; for(i = 0; i < screenInfo.numScreens; i++) { @@ -904,7 +900,7 @@ DGAVTSwitch(void) /* Alternatively, this could send events to DGA clients */ - if(DGAScreenIndex >= 0) { + if(DGAScreenKey) { DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); if(pScreenPriv && pScreenPriv->current) @@ -921,7 +917,7 @@ DGAStealKeyEvent(int index, int key_code, int is_down) DGAScreenPtr pScreenPriv; dgaEvent de; - if(DGAScreenIndex < 0) /* no DGA */ + if(DGAScreenKey == NULL) /* no DGA */ return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); @@ -945,7 +941,7 @@ DGAStealMotionEvent(int index, int dx, int dy) DGAScreenPtr pScreenPriv; dgaEvent de; - if(DGAScreenIndex < 0) /* no DGA */ + if(DGAScreenKey == NULL) /* no DGA */ return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); @@ -980,7 +976,7 @@ DGAStealButtonEvent(int index, int button, int is_down) DGAScreenPtr pScreenPriv; dgaEvent de; - if (DGAScreenIndex < 0) + if (DGAScreenKey == NULL) return FALSE; pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); @@ -1006,7 +1002,7 @@ Bool DGAIsDgaEvent (xEvent *e) { int coreEquiv; - if (DGAScreenIndex < 0 || XDGAEventBase == 0) + if (DGAScreenKey == NULL || XDGAEventBase == 0) return FALSE; coreEquiv = e->u.u.type - *XDGAEventBase; if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify) @@ -1275,7 +1271,7 @@ DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents) int coreEquiv; /* no DGA */ - if (DGAScreenIndex < 0 || XDGAEventBase == 0) + if (DGAScreenKey == NULL || XDGAEventBase == 0) return; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c index 3aa83e882..4fb901aae 100644 --- a/hw/xfree86/common/xf86DPMS.c +++ b/hw/xfree86/common/xf86DPMS.c @@ -47,8 +47,7 @@ #ifdef DPMSExtension -static int DPMSGeneration = 0; -static int DPMSIndex = -1; +static DevPrivateKey DPMSKey = NULL; static Bool DPMSClose(int i, ScreenPtr pScreen); static int DPMSCount = 0; #endif @@ -61,19 +60,17 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; DPMSPtr pDPMS; pointer DPMSOpt; + MessageType enabled_from = X_INFO; - if (serverGeneration != DPMSGeneration) { - if ((DPMSIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - DPMSGeneration = serverGeneration; - } + DPMSKey = &DPMSKey; if (DPMSDisabledSwitch) DPMSEnabled = FALSE; - if (!(pScreen->devPrivates[DPMSIndex].ptr = xcalloc(sizeof(DPMSRec), 1))) + if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey, + xcalloc(sizeof(DPMSRec), 1))) return FALSE; - pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr; + pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey); pScrn->DPMSSet = set; pDPMS->Flags = flags; DPMSOpt = xf86FindOption(pScrn->options, "dpms"); @@ -82,8 +79,8 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) = xf86SetBoolOption(pScrn->options, "dpms", FALSE)) && !DPMSDisabledSwitch) DPMSEnabled = TRUE; + enabled_from = X_CONFIG; xf86MarkOptionUsed(DPMSOpt); - xf86DrvMsg(pScreen->myNum, X_CONFIG, "DPMS enabled\n"); } else if (DPMSEnabledSwitch) { if (!DPMSDisabledSwitch) DPMSEnabled = TRUE; @@ -92,6 +89,8 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags) else { pDPMS->Enabled = defaultDPMSEnabled; } + if (pDPMS->Enabled) + xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n"); pDPMS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = DPMSClose; DPMSCount++; @@ -110,10 +109,10 @@ DPMSClose(int i, ScreenPtr pScreen) DPMSPtr pDPMS; /* This shouldn't happen */ - if (DPMSIndex < 0) + if (DPMSKey == NULL) return FALSE; - pDPMS = (DPMSPtr)pScreen->devPrivates[DPMSIndex].ptr; + pDPMS = (DPMSPtr)dixLookupPrivate(&pScreen->devPrivates, DPMSKey); /* This shouldn't happen */ if (!pDPMS) @@ -132,9 +131,9 @@ DPMSClose(int i, ScreenPtr pScreen) } xfree((pointer)pDPMS); - pScreen->devPrivates[DPMSIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DPMSKey, NULL); if (--DPMSCount == 0) - DPMSIndex = -1; + DPMSKey = NULL; return pScreen->CloseScreen(i, pScreen); } @@ -144,30 +143,35 @@ DPMSClose(int i, ScreenPtr pScreen) * Device dependent DPMS mode setting hook. This is called whenever * the DPMS mode is to be changed. */ -_X_EXPORT void -DPMSSet(int level) +_X_EXPORT int +DPMSSet(ClientPtr client, int level) { - int i; + int rc, i; DPMSPtr pDPMS; ScrnInfoPtr pScrn; DPMSPowerLevel = level; - if (DPMSIndex < 0) - return; + if (DPMSKey == NULL) + return Success; - if (level != DPMSModeOn) - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverActive); + if (level != DPMSModeOn) { + rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive); + if (rc != Success) + return rc; + } /* For each screen, set the DPMS level */ for (i = 0; i < xf86NumScreens; i++) { pScrn = xf86Screens[i]; - pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr; + pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates, + DPMSKey); if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) { xf86EnableAccess(pScrn); pScrn->DPMSSet(pScrn, level, 0); } } + return Success; } @@ -182,14 +186,15 @@ DPMSSupported(void) DPMSPtr pDPMS; ScrnInfoPtr pScrn; - if (DPMSIndex < 0) { + if (DPMSKey == NULL) { return FALSE; } /* For each screen, check if DPMS is supported */ for (i = 0; i < xf86NumScreens; i++) { pScrn = xf86Screens[i]; - pDPMS = (DPMSPtr)screenInfo.screens[i]->devPrivates[DPMSIndex].ptr; + pDPMS = (DPMSPtr)dixLookupPrivate(&screenInfo.screens[i]->devPrivates, + DPMSKey); if (pDPMS && pScrn->DPMSSet) return TRUE; } diff --git a/hw/xfree86/common/xf86DefModes.c b/hw/xfree86/common/xf86DefModes.c deleted file mode 100644 index bdb64fe8e..000000000 --- a/hw/xfree86/common/xf86DefModes.c +++ /dev/null @@ -1,155 +0,0 @@ -/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at - * modeline2c.pl */ - -/* - * Copyright 1999-2003 by The XFree86 Project, Inc. - * - * Author: Dirk Hohndel <hohndel@XFree86.Org> - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86.h" -#include "xf86Config.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -#include "globals.h" - -#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT -#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 - -DisplayModeRec xf86DefaultModes [] = { -/* 640x350 @ 85Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("640x350"),31500, 640,672,736,832,0, 350,382,385,445,0, V_PHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x175"),15750, 320,336,368,416,0, 175,191,192,222,0, V_PHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x400 @ 85Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("640x400"),31500, 640,672,736,832,0, 400,401,404,445,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("320x200"),15750, 320,336,368,416,0, 200,200,202,222,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 720x400 @ 85Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("720x400"),35500, 720,756,828,936,0, 400,401,404,446,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("360x200"),17750, 360,378,414,468,0, 200,200,202,223,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz */ - {MODEPREFIX("640x480"),25200, 640,656,752,800,0, 480,490,492,525,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),12600, 320,328,376,400,0, 240,245,246,262,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 72Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("640x480"),31500, 640,664,704,832,0, 480,489,491,520,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),15750, 320,332,352,416,0, 240,244,245,260,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 75Hz (VESA) hsync: 37.5kHz */ - {MODEPREFIX("640x480"),31500, 640,656,720,840,0, 480,481,484,500,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),15750, 320,328,360,420,0, 240,240,242,250,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 640x480 @ 85Hz (VESA) hsync: 43.3kHz */ - {MODEPREFIX("640x480"),36000, 640,696,752,832,0, 480,481,484,509,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("320x240"),18000, 320,348,376,416,0, 240,240,242,254,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 56Hz (VESA) hsync: 35.2kHz */ - {MODEPREFIX("800x600"),36000, 800,824,896,1024,0, 600,601,603,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),18000, 400,412,448,512,0, 300,300,301,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 60Hz (VESA) hsync: 37.9kHz */ - {MODEPREFIX("800x600"),40000, 800,840,968,1056,0, 600,601,605,628,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),20000, 400,420,484,528,0, 300,300,302,314,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 72Hz (VESA) hsync: 48.1kHz */ - {MODEPREFIX("800x600"),50000, 800,856,976,1040,0, 600,637,643,666,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),25000, 400,428,488,520,0, 300,318,321,333,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 75Hz (VESA) hsync: 46.9kHz */ - {MODEPREFIX("800x600"),49500, 800,816,896,1056,0, 600,601,604,625,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),24750, 400,408,448,528,0, 300,300,302,312,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 800x600 @ 85Hz (VESA) hsync: 53.7kHz */ - {MODEPREFIX("800x600"),56300, 800,832,896,1048,0, 600,601,604,631,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("400x300"),28150, 400,416,448,524,0, 300,300,302,315,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz */ - {MODEPREFIX("1024x768"),44900, 1024,1032,1208,1264,0, 768,768,776,817,0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX}, - {MODEPREFIX("512x384"),22450, 512,516,604,632,0, 384,384,388,408,0, V_PHSYNC | V_PVSYNC | V_INTERLACE | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 60Hz (VESA) hsync: 48.4kHz */ - {MODEPREFIX("1024x768"),65000, 1024,1048,1184,1344,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),32500, 512,524,592,672,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 70Hz (VESA) hsync: 56.5kHz */ - {MODEPREFIX("1024x768"),75000, 1024,1048,1184,1328,0, 768,771,777,806,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),37500, 512,524,592,664,0, 384,385,388,403,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 75Hz (VESA) hsync: 60.0kHz */ - {MODEPREFIX("1024x768"),78800, 1024,1040,1136,1312,0, 768,769,772,800,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),39400, 512,520,568,656,0, 384,384,386,400,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1024x768 @ 85Hz (VESA) hsync: 68.7kHz */ - {MODEPREFIX("1024x768"),94500, 1024,1072,1168,1376,0, 768,769,772,808,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("512x384"),47250, 512,536,584,688,0, 384,384,386,404,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1152x864 @ 75Hz (VESA) hsync: 67.5kHz */ - {MODEPREFIX("1152x864"),108000, 1152,1216,1344,1600,0, 864,865,868,900,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("576x432"),54000, 576,608,672,800,0, 432,432,434,450,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x960 @ 60Hz (VESA) hsync: 60.0kHz */ - {MODEPREFIX("1280x960"),108000, 1280,1376,1488,1800,0, 960,961,964,1000,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x480"),54000, 640,688,744,900,0, 480,480,482,500,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x960 @ 85Hz (VESA) hsync: 85.9kHz */ - {MODEPREFIX("1280x960"),148500, 1280,1344,1504,1728,0, 960,961,964,1011,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x480"),74250, 640,672,752,864,0, 480,480,482,505,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz */ - {MODEPREFIX("1280x1024"),108000, 1280,1328,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x512"),54000, 640,664,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz */ - {MODEPREFIX("1280x1024"),135000, 1280,1296,1440,1688,0, 1024,1025,1028,1066,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x512"),67500, 640,648,720,844,0, 512,512,514,533,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz */ - {MODEPREFIX("1280x1024"),157500, 1280,1344,1504,1728,0, 1024,1025,1028,1072,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("640x512"),78750, 640,672,752,864,0, 512,512,514,536,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz */ - {MODEPREFIX("1600x1200"),162000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),81000, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz */ - {MODEPREFIX("1600x1200"),175500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),87750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz */ - {MODEPREFIX("1600x1200"),189000, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),94500, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz */ - {MODEPREFIX("1600x1200"),202500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),101250, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz */ - {MODEPREFIX("1600x1200"),229500, 1600,1664,1856,2160,0, 1200,1201,1204,1250,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("800x600"),114750, 800,832,928,1080,0, 600,600,602,625,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz */ - {MODEPREFIX("1792x1344"),204800, 1792,1920,2120,2448,0, 1344,1345,1348,1394,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("896x672"),102400, 896,960,1060,1224,0, 672,672,674,697,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz */ - {MODEPREFIX("1792x1344"),261000, 1792,1888,2104,2456,0, 1344,1345,1348,1417,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("896x672"),130500, 896,944,1052,1228,0, 672,672,674,708,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz */ - {MODEPREFIX("1856x1392"),218300, 1856,1952,2176,2528,0, 1392,1393,1396,1439,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("928x696"),109150, 928,976,1088,1264,0, 696,696,698,719,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz */ - {MODEPREFIX("1856x1392"),288000, 1856,1984,2208,2560,0, 1392,1393,1396,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("928x696"),144000, 928,992,1104,1280,0, 696,696,698,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz */ - {MODEPREFIX("1920x1440"),234000, 1920,2048,2256,2600,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("960x720"),117000, 960,1024,1128,1300,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz */ - {MODEPREFIX("1920x1440"),297000, 1920,2064,2288,2640,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("960x720"),148500, 960,1032,1144,1320,0, 720,720,722,750,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz */ - {MODEPREFIX("832x624"),57284, 832,864,928,1152,0, 624,625,628,667,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("416x312"),28642, 416,432,464,576,0, 312,312,314,333,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz */ - {MODEPREFIX("1152x768"),64995, 1152,1178,1314,1472,0, 768,771,777,806,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("576x384"),32497, 576,589,657,736,0, 384,385,388,403,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz */ - {MODEPREFIX("1400x1050"),122000, 1400,1488,1640,1880,0, 1050,1052,1064,1082,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("700x525"),61000, 700,744,820,940,0, 525,526,532,541,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz */ - {MODEPREFIX("1400x1050"),155800, 1400,1464,1784,1912,0, 1050,1052,1064,1090,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("700x525"),77900, 700,732,892,956,0, 525,526,532,545,0, V_PHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz */ - {MODEPREFIX("1600x1024"),106910, 1600,1620,1640,1670,0, 1024,1027,1030,1067,0, V_NHSYNC | V_NVSYNC, MODESUFFIX}, - {MODEPREFIX("800x512"),53455, 800,810,820,835,0, 512,513,515,533,0, V_NHSYNC | V_NVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz */ - {MODEPREFIX("1920x1440"),341350, 1920,2072,2288,2656,0, 1440,1441,1444,1512,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("960x720"),170675, 960,1036,1144,1328,0, 720,720,722,756,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz */ - {MODEPREFIX("2048x1536"),266950, 2048,2200,2424,2800,0, 1536,1537,1540,1589,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("1024x768"),133475, 1024,1100,1212,1400,0, 768,768,770,794,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz */ - {MODEPREFIX("2048x1536"),340480, 2048,2216,2440,2832,0, 1536,1537,1540,1603,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("1024x768"),170240, 1024,1108,1220,1416,0, 768,768,770,801,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, -/* 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz */ - {MODEPREFIX("2048x1536"),388040, 2048,2216,2440,2832,0, 1536,1537,1540,1612,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, - {MODEPREFIX("1024x768"),194020, 1024,1108,1220,1416,0, 768,768,770,806,0, V_NHSYNC | V_PVSYNC | V_DBLSCAN, MODESUFFIX}, - {MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX} -}; diff --git a/hw/xfree86/common/xf86DoScanPci.c b/hw/xfree86/common/xf86DoScanPci.c deleted file mode 100644 index 51892f041..000000000 --- a/hw/xfree86/common/xf86DoScanPci.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1999-2002 by The XFree86 Project, Inc. - * - * 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 and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -/* - * Finish setting up the server. - * Call the functions from the scanpci module. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <ctype.h> -#include <stdlib.h> -#include <X11/X.h> -#include <X11/Xmd.h> -#include <pciaccess.h> -#include "os.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Pci.h" -#include "Pci.h" -#include "xf86_OSproc.h" - -static void ScanPciDisplayPCICardInfo(void); - -void -ScanPciDisplayPCICardInfo(void) -{ - struct pci_id_match match; - struct pci_device_iterator *iter; - const struct pci_device *dev; - - xf86EnableIO(); - - if (! xf86scanpci()) { - xf86MsgVerb(X_NONE, 0, "No PCI info available\n"); - return; - } - xf86MsgVerb(X_NONE, 0, - "Probing for PCI devices (Bus:Device:Function)\n\n"); - - iter = pci_id_match_iterator_create(NULL); - while ((dev = pci_device_next(iter)) != NULL) { - const char *svendorname = NULL, *subsysname = NULL; - const char *vendorname = NULL, *devicename = NULL; - - - xf86MsgVerb(X_NONE, 0, "(%d:%d:%d) ", - PCI_MAKE_BUS(dev->domain, dev->bus), dev->dev, dev->func); - - /* - * Lookup as much as we can about the device. - */ - match.vendor_id = dev->vendor_id; - match.device_id = dev->device_id; - match.subvendor_id = (dev->subvendor_id != 0) - ? dev->subvendor_id : PCI_MATCH_ANY; - match.subdevice_id = (dev->subdevice_id != 0) - ? dev->subdevice_id : PCI_MATCH_ANY; - match.device_class = 0; - match.device_class_mask = 0; - - pci_get_strings(& match, & vendorname, & devicename, - & svendorname, & subsysname); - - if ((dev->subvendor_id != 0) || (dev->subdevice_id != 0)) { - xf86MsgVerb(X_NONE, 0, "%s %s (0x%04x / 0x%04x) using ", - (svendorname == NULL) ? "unknown vendor" : svendorname, - (subsysname == NULL) ? "unknown card" : subsysname, - dev->subvendor_id, dev->subdevice_id); - } - - xf86MsgVerb(X_NONE, 0, "%s %s (0x%04x / 0x%04x)\n", - (vendorname == NULL) ? "unknown vendor" : vendorname, - (devicename == NULL) ? "unknown chip" : devicename, - dev->vendor_id, dev->device_id); - } - - pci_iterator_destroy(iter); -} - - -void DoScanPci(int argc, char **argv, int i) -{ - int j,skip,globalVerbose; - - /* - * first we need to finish setup of the OS so that we can call other - * functions in the server - */ - OsInit(); - - /* - * The old verbosity processing that was here isn't useful anymore, but - * for compatibility purposes, ignore verbosity changes after the -scanpci - * flag. - */ - globalVerbose = xf86Verbose; - - /* - * next we process the arguments that are remaining on the command line, - * so that things like the module path can be set there - */ - for ( j = i+1; j < argc; j++ ) { - if ((skip = ddxProcessArgument(argc, argv, j))) - j += (skip - 1); - } - - /* - * Was the verbosity level increased? If so, set it back. - */ - if (xf86Verbose > globalVerbose) - xf86SetVerbosity(globalVerbose); - - ScanPciDisplayPCICardInfo(); - - /* - * That's it; we really should clean things up, but a simple - * exit seems to be all we need. - */ - exit(0); -} diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index e88fc3b3e..2b7cb121d 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -857,7 +857,7 @@ xf86VTSwitch() #endif #ifdef DPMSExtension if (DPMSPowerLevel != DPMSModeOn) - DPMSSet(DPMSModeOn); + DPMSSet(serverClient, DPMSModeOn); #endif for (i = 0; i < xf86NumScreens; i++) { if (!(dispatchException & DE_TERMINATE)) @@ -906,7 +906,7 @@ xf86VTSwitch() (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); } } - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); pInfo = xf86InputDevs; while (pInfo) { @@ -970,7 +970,7 @@ xf86VTSwitch() } /* Turn screen saver off when switching back */ - SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); pInfo = xf86InputDevs; while (pInfo) { diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index b3969b102..0dc42c66b 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -46,10 +46,12 @@ /* Globals that video drivers may access */ -_X_EXPORT int xf86ScreenIndex = -1; /* Index of ScrnInfo in pScreen.devPrivates */ -int xf86CreateRootWindowIndex = -1; /* Index into pScreen.devPrivates */ +/* Index into pScreen.devPrivates */ +DevPrivateKey xf86CreateRootWindowKey = &xf86CreateRootWindowKey; +/* Index of ScrnInfo in pScreen.devPrivates */ +_X_EXPORT DevPrivateKey xf86ScreenKey = &xf86ScreenKey; +_X_EXPORT DevPrivateKey xf86PixmapKey = &xf86PixmapKey; _X_EXPORT ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */ -_X_EXPORT int xf86PixmapIndex = 0; _X_EXPORT const unsigned char byte_reversed[256] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, @@ -95,7 +97,6 @@ InputInfoPtr xf86InputDevs = NULL; xf86InfoRec xf86Info = { -1, /* consoleFd */ -1, /* vtno */ - NULL, /* vtinit */ FALSE, /* vtSysreq */ SKWhenNeeded, /* ddxSpecialKeys */ NULL, /* pMouse */ @@ -152,8 +153,6 @@ DriverPtr *xf86DriverList = NULL; int xf86NumDrivers = 0; InputDriverPtr *xf86InputDriverList = NULL; int xf86NumInputDrivers = 0; -ModuleInfoPtr *xf86ModuleInfoList = NULL; -int xf86NumModuleInfos = 0; int xf86NumScreens = 0; const char *xf86VisualNames[] = { diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index d37875c35..0d2471aa1 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1,4 +1,3 @@ - /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * @@ -170,37 +169,17 @@ xf86LookupInput(const char *name) return NULL; } +/* ABI stubs of despair */ _X_EXPORT void -xf86AddModuleInfo(ModuleInfoPtr info, pointer module) +xf86AddModuleInfo(pointer info, pointer module) { - /* Don't add null entries */ - if (!module) - return; - - if (xf86ModuleInfoList == NULL) - xf86NumModuleInfos = 0; - - xf86NumModuleInfos++; - xf86ModuleInfoList = xnfrealloc(xf86ModuleInfoList, - xf86NumModuleInfos * sizeof(ModuleInfoPtr)); - xf86ModuleInfoList[xf86NumModuleInfos - 1] = xnfalloc(sizeof(ModuleInfoRec)); - *xf86ModuleInfoList[xf86NumModuleInfos - 1] = *info; - xf86ModuleInfoList[xf86NumModuleInfos - 1]->module = module; - xf86ModuleInfoList[xf86NumModuleInfos - 1]->refCount = 0; } _X_EXPORT void xf86DeleteModuleInfo(int idx) { - if (xf86ModuleInfoList[idx]) { - if (xf86ModuleInfoList[idx]->module) - UnloadModule(xf86ModuleInfoList[idx]->module); - xfree(xf86ModuleInfoList[idx]); - xf86ModuleInfoList[idx] = NULL; - } } - /* Allocate a new ScrnInfoRec in xf86Screens */ _X_EXPORT ScrnInfoPtr @@ -1374,7 +1353,7 @@ xf86ErrorF(const char *format, ...) void xf86LogInit() { - char *lf; + char *lf = NULL; #define LOGSUFFIX ".log" #define LOGOLDSUFFIX ".old" @@ -1398,6 +1377,8 @@ xf86LogInit() #undef LOGSUFFIX #undef LOGOLDSUFFIX + + free(lf); } void @@ -2957,3 +2938,17 @@ xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start, { return GetMotionHistory(pDev, buff, start, stop, pScreen); } + +_X_EXPORT void +xf86getsecs(long * secs, long * usecs) +{ + struct timeval tv; + + X_GETTIMEOFDAY(&tv); + if (secs) + *secs = tv.tv_sec; + if (usecs) + *usecs= tv.tv_usec; + + return; +} diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index c72fe30e8..d1603c081 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -102,7 +102,6 @@ static void xf86PrintBanner(void); static void xf86PrintMarkers(void); static void xf86PrintDefaultModulePath(void); static void xf86PrintDefaultLibraryPath(void); -static void xf86RunVtInit(void); static Bool probe_devices_from_device_sections(DriverPtr drvp); static Bool add_matching_devices_to_configure_list(DriverPtr drvp); @@ -139,8 +138,8 @@ xf86CreateRootWindow(WindowPtr pWin) int err = Success; ScreenPtr pScreen = pWin->drawable.pScreen; RootWinPropPtr pProp; - CreateWindowProcPtr CreateWindow = - (CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr); + CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) + dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); #ifdef DEBUG ErrorF("xf86CreateRootWindow(%p)\n", pWin); @@ -156,7 +155,7 @@ xf86CreateRootWindow(WindowPtr pWin) /* Unhook this function ... */ pScreen->CreateWindow = CreateWindow; - pScreen->devPrivates[xf86CreateRootWindowIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL); /* ... and call the previous CreateWindow fuction, if any */ if (NULL!=pScreen->CreateWindow) { @@ -199,13 +198,6 @@ xf86CreateRootWindow(WindowPtr pWin) } -/* - * InitOutput -- - * Initialize screenInfo for all actually accessible framebuffers. - * That includes vt-manager setup, querying all possible devices and - * collecting the pixmap formats. - */ - static void PostConfigInit(void) { @@ -238,9 +230,6 @@ PostConfigInit(void) xf86OSPMClose = xf86OSPMOpen(); #endif - /* Run an external VT Init program if specified in the config file */ - xf86RunVtInit(); - /* Do this after XF86Config is read (it's normally in OsInit()) */ OsInitColors(); } @@ -471,12 +460,16 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only ) return foundScreen; } - +/* + * InitOutput -- + * Initialize screenInfo for all actually accessible framebuffers. + * That includes vt-manager setup, querying all possible devices and + * collecting the pixmap formats. + */ void InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) { int i, j, k, scr_index; - static unsigned long generation = 0; char **modulelist; pointer *optionlist; screenLayoutPtr layout; @@ -487,14 +480,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86Initialising = TRUE; - /* Do this early? */ - if (generation != serverGeneration) { - xf86ScreenIndex = AllocateScreenPrivateIndex(); - xf86CreateRootWindowIndex = AllocateScreenPrivateIndex(); - xf86PixmapIndex = AllocatePixmapPrivateIndex(); - generation = serverGeneration; - } - if (serverGeneration == 1) { pScreenInfo->numScreens = 0; @@ -1070,8 +1055,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) * Hook in our ScrnInfoRec, and initialise some other pScreen * fields. */ - screenInfo.screens[scr_index]->devPrivates[xf86ScreenIndex].ptr - = (pointer)xf86Screens[i]; + dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, + xf86ScreenKey, xf86Screens[i]); xf86Screens[i]->pScreen = screenInfo.screens[scr_index]; /* The driver should set this, but make sure it is set anyway */ xf86Screens[i]->vtSema = TRUE; @@ -1087,8 +1072,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) i, xf86Screens[i]->pScreen->CreateWindow ); #endif - screenInfo.screens[scr_index]->devPrivates[xf86CreateRootWindowIndex].ptr - = (void*)(xf86Screens[i]->pScreen->CreateWindow); + dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, + xf86CreateRootWindowKey, + xf86Screens[i]->pScreen->CreateWindow); xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow; #ifdef RENDER @@ -1143,12 +1129,6 @@ InitInput(argc, argv) for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) { /* Replace obsolete keyboard driver with kbd */ if (!xf86NameCmp((*pDev)->driver, "keyboard")) { - xf86MsgVerb(X_WARNING, 0, - "*** WARNING the legacy keyboard driver \"%s\" has been removed\n", - (*pDev)->driver); - xf86MsgVerb(X_WARNING, 0, - "*** Using the new \"kbd\" driver for \"%s\".\n", - (*pDev)->identifier); strcpy((*pDev)->driver, "kbd"); } @@ -1307,7 +1287,7 @@ AbortDDX() */ #ifdef DPMSExtension /* Turn screens back on */ if (DPMSPowerLevel != DPMSModeOn) - DPMSSet(DPMSModeOn); + DPMSSet(serverClient, DPMSModeOn); #endif if (xf86Screens) { if (xf86Screens[0]->vtSema) @@ -1574,15 +1554,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86sFlag = TRUE; return 0; } - if (!strcmp(argv[i], "-bpp")) - { - ErrorF("The -bpp option is no longer supported.\n" - "\tUse -depth to set the color depth, and use -fbbpp if you really\n" - "\tneed to force a non-default framebuffer (hardware) pixel format.\n"); - if (++i >= argc) - return 1; - return 2; - } if (!strcmp(argv[i], "-pixmap24")) { xf86Pix24 = Pix24Use24; @@ -1695,10 +1666,6 @@ ddxProcessArgument(int argc, char **argv, int i) return 1; } #endif - if (!strcmp(argv[i], "-scanpci")) - { - DoScanPci(argc, argv, i); - } if (!strcmp(argv[i], "-probe")) { xf86DoProbe = TRUE; @@ -1761,7 +1728,6 @@ ddxUseMsg() ErrorF("-config file specify a configuration file, relative to the\n"); ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n"); ErrorF("-probeonly probe for devices, then exit\n"); - ErrorF("-scanpci execute the scanpci module and exit\n"); ErrorF("-verbose [n] verbose startup messages\n"); ErrorF("-logverbose [n] verbose log messages\n"); ErrorF("-quiet minimal startup messages\n"); @@ -1938,44 +1904,6 @@ xf86PrintDefaultLibraryPath(void) ErrorF("%s\n", DEFAULT_LIBRARY_PATH); } -static void -xf86RunVtInit(void) -{ - int i; - - /* - * If VTInit was set, run that program with consoleFd as stdin and stdout - */ - - if (xf86Info.vtinit) { - switch(fork()) { - case -1: - FatalError("xf86RunVtInit: fork failed (%s)\n", strerror(errno)); - break; - case 0: /* child */ - if (setuid(getuid()) == -1) { - xf86Msg(X_ERROR, "xf86RunVtInit: setuid failed (%s)\n", - strerror(errno)); - exit(255); - } - /* set stdin, stdout to the consoleFd */ - for (i = 0; i < 2; i++) { - if (xf86Info.consoleFd != i) { - close(i); - dup(xf86Info.consoleFd); - } - } - execl("/bin/sh", "sh", "-c", xf86Info.vtinit, (void *)NULL); - xf86Msg(X_WARNING, "exec of /bin/sh failed for VTInit (%s)\n", - strerror(errno)); - exit(255); - break; - default: /* parent */ - wait(NULL); - } - } -} - /* * xf86LoadModules iterates over a list that is being passed in. */ diff --git a/hw/xfree86/common/xf86MiscExt.c b/hw/xfree86/common/xf86MiscExt.c index c1b9c60fc..40c196a3e 100644 --- a/hw/xfree86/common/xf86MiscExt.c +++ b/hw/xfree86/common/xf86MiscExt.c @@ -548,6 +548,10 @@ MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval, { ScrnInfoPtr pScr = xf86Screens[scrnIndex]; + /* should check this in the protocol, but xf86NumScreens isn't exported */ + if (scrnIndex >= xf86NumScreens) + return BadValue; + if (*pScr->HandleMessage == NULL) return BadImplementation; return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr); diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index 7fcce10b1..fb899a1e4 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -183,6 +183,8 @@ xf86ModeStatusToString(ModeStatus status) return "all modes must have the same resolution"; case MODE_NO_REDUCED: return "monitor doesn't support reduced blanking"; + case MODE_BANDWIDTH: + return "mode requires too much memory bandwidth"; case MODE_BAD: return "unknown reason"; case MODE_ERROR: @@ -368,52 +370,6 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp, return MODE_OK; } -#if 0 -/** Calculates the horizontal sync rate of a mode */ -_X_EXPORT double -xf86ModeHSync(DisplayModePtr mode) -{ - double hsync = 0.0; - - if (mode->HSync > 0.0) - hsync = mode->HSync; - else if (mode->HTotal > 0) - hsync = (float)mode->Clock / (float)mode->HTotal; - - return hsync; -} - -/** Calculates the vertical refresh rate of a mode */ -_X_EXPORT double -xf86ModeVRefresh(DisplayModePtr mode) -{ - double refresh = 0.0; - - if (mode->VRefresh > 0.0) - refresh = mode->VRefresh; - else if (mode->HTotal > 0 && mode->VTotal > 0) { - refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal; - if (mode->Flags & V_INTERLACE) - refresh *= 2.0; - if (mode->Flags & V_DBLSCAN) - refresh /= 2.0; - if (mode->VScan > 1) - refresh /= (float)(mode->VScan); - } - return refresh; -} - -/** Sets a default mode name of <width>x<height> on a mode. */ -_X_EXPORT void -xf86SetModeDefaultName(DisplayModePtr mode) -{ - if (mode->name != NULL) - xfree(mode->name); - - mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay); -} -#endif - /* * xf86LookupMode * @@ -1259,20 +1215,40 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy) { float aspect = 0.0; MonPtr mon = scrp->monitor; + xf86MonPtr DDC; int x = 0, y = 0; DisplayModePtr mode; if (!mon) return 0; + DDC = mon->DDC; + + if (DDC && DDC->ver.revision >= 4) { + /* For 1.4, we might actually get native pixel format. How novel. */ + if (PREFERRED_TIMING_MODE(DDC->features.msc)) { + for (mode = modes; mode; mode = mode->next) { + if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) { + x = mode->HDisplay; + y = mode->VDisplay; + goto found; + } + } + } + /* + * Even if we don't, we might get aspect ratio from extra CVT info + * or from the monitor size fields. TODO. + */ + } /* - * technically this triggers if _either_ is zero, which is not what EDID - * says, but if only one is zero this is best effort. also we don't - * know that all projectors are 4:3, but we certainly suspect it. + * Technically this triggers if either is zero. That wasn't legal + * before EDID 1.4, but right now we'll get that wrong. TODO. */ - if (!mon->widthmm || !mon->heightmm) - aspect = 4.0/3.0; - else - aspect = (float)mon->widthmm / (float)mon->heightmm; + if (!aspect) { + if (!mon->widthmm || !mon->heightmm) + aspect = 4.0/3.0; + else + aspect = (float)mon->widthmm / (float)mon->heightmm; + } /* find the largest M_T_DRIVER mode with that aspect ratio */ for (mode = modes; mode; mode = mode->next) { @@ -1296,6 +1272,7 @@ inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy) return 0; } +found: *vx = x; *vy = y; diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 852e51f43..240155ca7 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -83,9 +83,9 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(3, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 0) #define ABI_XINPUT_VERSION SET_ABI_VERSION(2, 0) -#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3) +#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 5) #define MODINFOSTRING1 0xef23fdc5 diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c index a6bcc3421..7c8320dee 100644 --- a/hw/xfree86/common/xf86PM.c +++ b/hw/xfree86/common/xf86PM.c @@ -116,7 +116,7 @@ resume(pmEvent event, Bool undo) if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); } - SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev); diff --git a/hw/xfree86/common/xf86PciInfo.h b/hw/xfree86/common/xf86PciInfo.h index 0630cfa82..356c7db4d 100644 --- a/hw/xfree86/common/xf86PciInfo.h +++ b/hw/xfree86/common/xf86PciInfo.h @@ -40,9 +40,8 @@ * or for non-video devices unless they're needed by a driver or elsewhere. * A comprehensive set of PCI vendor, device and subsystem data is * auto-generated from the ../etc/pci.ids file using the pciids2c.pl script, - * and is used in both the scanpci module and the scanpci utility. Don't - * modify the pci.ids file. If new/corrected entries are required, add them - * to ../etc/extrapci.ids. + * and is used in scanpci utility. Don't modify the pci.ids file. If + * new/corrected entries are required, add them to ../etc/extrapci.ids. */ #ifndef _XF86_PCIINFO_H diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index 4723f5aba..fb9ecaea8 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -1,4 +1,3 @@ - /* * Copyright (c) 1997-2002 by The XFree86 Project, Inc. * @@ -97,8 +96,6 @@ extern Bool xf86SupportedMouseTypes[]; extern int xf86NumMouseTypes; extern DriverPtr *xf86DriverList; -extern ModuleInfoPtr *xf86ModuleInfoList; -extern int xf86NumModuleInfos; extern int xf86NumDrivers; extern Bool xf86Resetting; extern Bool xf86Initialising; @@ -158,10 +155,6 @@ Bool xf86PathIsSafe(const char *path); extern DisplayModeRec xf86DefaultModes []; -/* xf86DoScanPci.c */ - -void DoScanPci(int argc, char **argv, int i); - /* xf86DoProbe.c */ void DoProbe(void); void DoConfigure(void); diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 92a6305a0..d97ca440e 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -75,7 +75,6 @@ typedef enum { typedef struct { int consoleFd; int vtno; - char * vtinit; Bool vtSysreq; SpecialKeysInDDX ddxSpecialKeys; diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c index 288d72193..4432ad96b 100644 --- a/hw/xfree86/common/xf86RandR.c +++ b/hw/xfree86/common/xf86RandR.c @@ -45,10 +45,9 @@ typedef struct _xf86RandRInfo { Rotation rotation; } XF86RandRInfoRec, *XF86RandRInfoPtr; -static int xf86RandRIndex = -1; -static int xf86RandRGeneration; +static DevPrivateKey xf86RandRKey = NULL; -#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) (p)->devPrivates[xf86RandRIndex].ptr) +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr)dixLookupPrivate(&(p)->devPrivates, xf86RandRKey)) static int xf86RandRModeRefresh (DisplayModePtr mode) @@ -338,14 +337,14 @@ xf86RandRCloseScreen (int index, ScreenPtr pScreen) scrp->currentMode = scrp->modes; pScreen->CloseScreen = randrp->CloseScreen; xfree (randrp); - pScreen->devPrivates[xf86RandRIndex].ptr = 0; + dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL); return (*pScreen->CloseScreen) (index, pScreen); } _X_EXPORT Rotation xf86GetRotation(ScreenPtr pScreen) { - if (xf86RandRIndex == -1) + if (xf86RandRKey == NULL) return RR_Rotate_0; return XF86RANDRINFO(pScreen)->rotation; @@ -359,7 +358,7 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, { XF86RandRInfoPtr randrp; - if (xf86RandRIndex == -1) + if (xf86RandRKey == NULL) return FALSE; randrp = XF86RANDRINFO(pScreen); @@ -401,11 +400,8 @@ xf86RandRInit (ScreenPtr pScreen) if (!noPanoramiXExtension) return TRUE; #endif - if (xf86RandRGeneration != serverGeneration) - { - xf86RandRIndex = AllocateScreenPrivateIndex(); - xf86RandRGeneration = serverGeneration; - } + + xf86RandRKey = &xf86RandRKey; randrp = xalloc (sizeof (XF86RandRInfoRec)); if (!randrp) @@ -433,7 +429,7 @@ xf86RandRInit (ScreenPtr pScreen) randrp->rotation = RR_Rotate_0; - pScreen->devPrivates[xf86RandRIndex].ptr = randrp; + dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, randrp); return TRUE; } diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c index 16a4d824c..38d605c88 100644 --- a/hw/xfree86/common/xf86VidMode.c +++ b/hw/xfree86/common/xf86VidMode.c @@ -47,12 +47,11 @@ #include "vidmodeproc.h" #include "xf86cmap.h" -static int VidModeGeneration = 0; -static int VidModeIndex = -1; +static DevPrivateKey VidModeKey = NULL; static int VidModeCount = 0; static Bool VidModeClose(int i, ScreenPtr pScreen); -#define VMPTR(p) ((VidModePtr)(p)->devPrivates[VidModeIndex].ptr) +#define VMPTR(p) ((VidModePtr)dixLookupPrivate(&(p)->devPrivates, VidModeKey)) #endif @@ -73,15 +72,10 @@ VidModeExtensionInit(ScreenPtr pScreen) return FALSE; } - if (serverGeneration != VidModeGeneration) { - if ((VidModeIndex = AllocateScreenPrivateIndex()) < 0) { - DEBUG_P("AllocateScreenPrivateIndex() failed"); - return FALSE; - } - VidModeGeneration = serverGeneration; - } + VidModeKey = &VidModeKey; - if (!(pScreen->devPrivates[VidModeIndex].ptr = xcalloc(sizeof(VidModeRec), 1))) { + if (!dixSetPrivate(&pScreen->devPrivates, VidModeKey, + xcalloc(sizeof(VidModeRec), 1))) { DEBUG_P("xcalloc failed"); return FALSE; } @@ -114,10 +108,9 @@ VidModeClose(int i, ScreenPtr pScreen) pScreen->CloseScreen = pVidMode->CloseScreen; if (--VidModeCount == 0) { - if (pScreen->devPrivates[VidModeIndex].ptr) - xfree(pScreen->devPrivates[VidModeIndex].ptr); - pScreen->devPrivates[VidModeIndex].ptr = NULL; - VidModeIndex = -1; + xfree(dixLookupPrivate(&pScreen->devPrivates, VidModeKey)); + dixSetPrivate(&pScreen->devPrivates, VidModeKey, NULL); + VidModeKey = NULL; } return pScreen->CloseScreen(i, pScreen); } @@ -128,8 +121,8 @@ VidModeAvailable(int scrnIndex) ScrnInfoPtr pScrn; VidModePtr pVidMode; - if (VidModeIndex < 0) { - DEBUG_P("VidModeIndex < 0"); + if (VidModeKey == NULL) { + DEBUG_P("VidModeKey == NULL"); return FALSE; } diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index b939fb763..eafc0e9a0 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -77,7 +77,6 @@ #define EXTENSION_PROC_ARGS void * #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "windowstr.h" /* screenIsSaved */ @@ -116,7 +115,7 @@ _X_EXPORT void xf86ProcessCommonOptions(LocalDevicePtr local, pointer list) { - if (xf86SetBoolOption(list, "AlwaysCore", 0) || + if (!xf86SetBoolOption(list, "AlwaysCore", 1) || !xf86SetBoolOption(list, "SendCoreEvents", 1) || !xf86SetBoolOption(list, "CorePointer", 1) || !xf86SetBoolOption(list, "CoreKeyboard", 1)) { @@ -134,6 +133,11 @@ xf86ProcessCommonOptions(LocalDevicePtr local, /* Backwards compatibility. */ local->history_size = GetMotionHistorySize(); + /* Preallocate xEvent store */ + if (!xf86Events) + xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); + if (!xf86Events) + FatalError("Couldn't allocate event store\n"); } /*********************************************************************** @@ -462,6 +466,8 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev) * convenient functions to post events */ +#define MAX_VALUATORS 36 /* XXX from comment in dix/getevents.c */ + _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute, @@ -471,17 +477,12 @@ xf86PostMotionEvent(DeviceIntPtr device, { va_list var; int i = 0; - static int *valuators = NULL; - static int n_valuators = 0; - - if (num_valuators > n_valuators) { - xfree (valuators); - valuators = NULL; - } + static int valuators[MAX_VALUATORS]; - if (!valuators) { - valuators = xcalloc(sizeof(int), num_valuators); - n_valuators = num_valuators; + if (num_valuators > MAX_VALUATORS) { + xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d" + " is greater than MAX_VALUATORS\n", num_valuators); + return; } va_start(var, num_valuators); @@ -506,6 +507,12 @@ xf86PostMotionEventP(DeviceIntPtr device, int index; int flags = 0; + if (num_valuators > MAX_VALUATORS) { + xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d" + " is greater than MAX_VALUATORS\n", num_valuators); + return; + } + if (is_absolute) flags = POINTER_ABSOLUTE; else @@ -530,9 +537,7 @@ xf86PostMotionEventP(DeviceIntPtr device, #endif if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - if (!xf86Events) - FatalError("Couldn't allocate event store\n"); + FatalError("Didn't allocate event store\n"); nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0, flags, first_valuator, num_valuators, @@ -556,9 +561,15 @@ xf86PostProximityEvent(DeviceIntPtr device, ...) { va_list var; - int i, nevents, *valuators = NULL; + int i, nevents; + int valuators[MAX_VALUATORS]; - valuators = xcalloc(sizeof(int), num_valuators); + + if (num_valuators > MAX_VALUATORS) { + xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d" + " is greater than MAX_VALUATORS\n", num_valuators); + return; + } va_start(var, num_valuators); for (i = 0; i < num_valuators; i++) @@ -566,9 +577,7 @@ xf86PostProximityEvent(DeviceIntPtr device, va_end(var); if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - if (!xf86Events) - FatalError("Couldn't allocate event store\n"); + FatalError("Didn't allocate event store\n"); nevents = GetProximityEvents(xf86Events, device, is_in ? ProximityIn : ProximityOut, @@ -576,7 +585,6 @@ xf86PostProximityEvent(DeviceIntPtr device, for (i = 0; i < nevents; i++) mieqEnqueue(device, xf86Events + i); - xfree(valuators); } _X_EXPORT void @@ -589,7 +597,7 @@ xf86PostButtonEvent(DeviceIntPtr device, ...) { va_list var; - int *valuators = NULL; + int valuators[MAX_VALUATORS]; int i = 0, nevents = 0; int index; @@ -600,18 +608,19 @@ xf86PostButtonEvent(DeviceIntPtr device, return; } #endif + if (num_valuators > MAX_VALUATORS) { + xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d" + " is greater than MAX_VALUATORS\n", num_valuators); + return; + } - valuators = xcalloc(sizeof(int), num_valuators); - va_start(var, num_valuators); for (i = 0; i < num_valuators; i++) valuators[i] = va_arg(var, int); va_end(var); if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - if (!xf86Events) - FatalError("Couldn't allocate event store\n"); + FatalError("Didn't allocate event store\n"); nevents = GetPointerEvents(xf86Events, device, is_down ? ButtonPress : ButtonRelease, button, @@ -621,8 +630,6 @@ xf86PostButtonEvent(DeviceIntPtr device, for (i = 0; i < nevents; i++) mieqEnqueue(device, xf86Events + i); - - xfree(valuators); } _X_EXPORT void @@ -635,20 +642,24 @@ xf86PostKeyEvent(DeviceIntPtr device, ...) { va_list var; - int i = 0, nevents = 0, *valuators = NULL; + int i = 0, nevents = 0; + static int valuators[MAX_VALUATORS]; /* instil confidence in the user */ DebugF("this function has never been tested properly. if things go quite " "badly south after this message, then xf86PostKeyEvent is " "broken.\n"); + if (num_valuators > MAX_VALUATORS) { + xf86Msg(X_ERROR, "xf86PostMotionEvent: num_valuator %d" + " is greater than MAX_VALUATORS\n", num_valuators); + return; + } + if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - if (!xf86Events) - FatalError("Couldn't allocate event store\n"); + FatalError("Didn't allocate event store\n"); if (is_absolute) { - valuators = xcalloc(sizeof(int), num_valuators); va_start(var, num_valuators); for (i = 0; i < num_valuators; i++) valuators[i] = va_arg(var, int); @@ -658,7 +669,6 @@ xf86PostKeyEvent(DeviceIntPtr device, is_down ? KeyPress : KeyRelease, key_code, first_valuator, num_valuators, valuators); - xfree(valuators); } else { nevents = GetKeyboardEvents(xf86Events, device, @@ -687,9 +697,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device, #endif if (!xf86Events) - xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum()); - if (!xf86Events) - FatalError("Couldn't allocate event store\n"); + FatalError("Didn't allocate event store\n"); nevents = GetKeyboardEvents(xf86Events, device, is_down ? KeyPress : KeyRelease, key_code); diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index ea6a26dcd..764647ee4 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -60,7 +60,7 @@ #include "xf86cmap.h" #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \ - ((CMapScreenPtr) (pScreen)->devPrivates[CMapScreenIndex].ptr)->field) + ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field) #define SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) @@ -102,9 +102,8 @@ typedef struct { int overscan; } CMapColormapRec, *CMapColormapPtr; -static unsigned long CMapGeneration = 0; -static int CMapScreenIndex = -1; -static int CMapColormapIndex = -1; +static DevPrivateKey CMapScreenKey = NULL; +static DevPrivateKey CMapColormapKey = &CMapColormapKey; static void CMapInstallColormap(ColormapPtr); static void CMapStoreColors(ColormapPtr, int, xColorItem *); @@ -119,7 +118,6 @@ static int CMapChangeGamma(int, Gamma); static void ComputeGamma(CMapScreenPtr); static Bool CMapAllocateColormapPrivate(ColormapPtr); -static Bool CMapInitDefMap(ColormapPtr,int); static void CMapRefreshColors(ColormapPtr, int, int*); static void CMapSetOverscan(ColormapPtr, int, int *); static void CMapReinstallMap(ColormapPtr); @@ -145,13 +143,7 @@ _X_EXPORT Bool xf86HandleColormaps( if(!maxColors || !sigRGBbits || !loadPalette) return FALSE; - if(CMapGeneration != serverGeneration) { - if(((CMapScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((CMapColormapIndex = AllocateColormapPrivateIndex( - CMapInitDefMap)) < 0)) - return FALSE; - CMapGeneration = serverGeneration; - } + CMapScreenKey = &CMapScreenKey; elements = 1 << sigRGBbits; @@ -169,7 +161,7 @@ _X_EXPORT Bool xf86HandleColormaps( return FALSE; } - pScreen->devPrivates[CMapScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, CMapScreenKey, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->CreateColormap = pScreen->CreateColormap; @@ -225,12 +217,6 @@ _X_EXPORT Bool xf86HandleColormaps( return TRUE; } -static Bool -CMapInitDefMap(ColormapPtr cmap, int index) -{ - return TRUE; -} - /**** Screen functions ****/ @@ -254,8 +240,8 @@ CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv) static Bool CMapAllocateColormapPrivate(ColormapPtr pmap) { - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pmap->pScreen->devPrivates, CMapScreenKey); CMapColormapPtr pColPriv; CMapLinkPtr pLink; int numColors; @@ -274,7 +260,7 @@ CMapAllocateColormapPrivate(ColormapPtr pmap) return FALSE; } - pmap->devPrivates[CMapColormapIndex].ptr = (pointer)pColPriv; + dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv); pColPriv->numColors = numColors; pColPriv->colors = colors; @@ -296,8 +282,8 @@ static Bool CMapCreateColormap (ColormapPtr pmap) { ScreenPtr pScreen = pmap->pScreen; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); Bool ret = FALSE; pScreen->CreateColormap = pScreenPriv->CreateColormap; @@ -314,10 +300,10 @@ static void CMapDestroyColormap (ColormapPtr cmap) { ScreenPtr pScreen = cmap->pScreen; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr pColPriv = - (CMapColormapPtr) cmap->devPrivates[CMapColormapIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); + CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate( + &cmap->devPrivates, CMapColormapKey); CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps; if(pColPriv) { @@ -356,8 +342,8 @@ CMapStoreColors( ){ ScreenPtr pScreen = pmap->pScreen; VisualPtr pVisual = pmap->pVisual; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); int *indices = pScreenPriv->PreAllocIndices; int num = ndef; @@ -373,8 +359,8 @@ CMapStoreColors( return; if(pVisual->class == DirectColor) { - CMapColormapPtr pColPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; + CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate( + &pmap->devPrivates, CMapColormapKey); int i; if (CMapColormapUseMax(pVisual, pScreenPriv)) { @@ -431,8 +417,8 @@ CMapInstallColormap(ColormapPtr pmap) { ScreenPtr pScreen = pmap->pScreen; int index = pScreen->myNum; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); if (pmap == miInstalledMaps[index]) return; @@ -462,8 +448,8 @@ static Bool CMapEnterVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); if((*pScreenPriv->EnterVT)(index, flags)) { if(miInstalledMaps[index]) @@ -478,8 +464,8 @@ static Bool CMapSwitchMode(int index, DisplayModePtr mode, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); if((*pScreenPriv->SwitchMode)(index, mode, flags)) { if(miInstalledMaps[index]) @@ -494,8 +480,8 @@ static int CMapSetDGAMode(int index, int num, DGADevicePtr dev) { ScreenPtr pScreen = screenInfo.screens[index]; - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); int ret; ret = (*pScreenPriv->SetDGAMode)(index, num, dev); @@ -516,10 +502,10 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev) static void CMapReinstallMap(ColormapPtr pmap) { - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr cmapPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pmap->pScreen->devPrivates, CMapScreenKey); + CMapColormapPtr cmapPriv = (CMapColormapPtr)dixLookupPrivate( + &pmap->devPrivates, CMapColormapKey); ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; int i = cmapPriv->numColors; int *indices = pScreenPriv->PreAllocIndices; @@ -547,10 +533,10 @@ CMapReinstallMap(ColormapPtr pmap) static void CMapRefreshColors(ColormapPtr pmap, int defs, int* indices) { - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr pColPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pmap->pScreen->devPrivates, CMapScreenKey); + CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate( + &pmap->devPrivates, CMapColormapKey); VisualPtr pVisual = pmap->pVisual; ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; int numColors, i; @@ -681,10 +667,10 @@ CMapCompareColors(LOCO *color1, LOCO *color2) static void CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) { - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pmap->pScreen->devPrivates[CMapScreenIndex].ptr; - CMapColormapPtr pColPriv = - (CMapColormapPtr) pmap->devPrivates[CMapColormapIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pmap->pScreen->devPrivates, CMapScreenKey); + CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate( + &pmap->devPrivates, CMapColormapKey); ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum]; VisualPtr pVisual = pmap->pVisual; int i; @@ -819,8 +805,8 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices) static void CMapUnwrapScreen(ScreenPtr pScreen) { - CMapScreenPtr pScreenPriv = - (CMapScreenPtr) pScreen->devPrivates[CMapScreenIndex].ptr; + CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, CMapScreenKey); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; pScreen->CloseScreen = pScreenPriv->CloseScreen; @@ -904,10 +890,11 @@ CMapChangeGamma( CMapLinkPtr pLink; /* Is this sufficient checking ? */ - if(CMapScreenIndex == -1) + if(CMapScreenKey == NULL) return BadImplementation; - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + CMapScreenKey); if(!pScreenPriv) return BadImplementation; @@ -925,8 +912,8 @@ CMapChangeGamma( /* mark all colormaps on this screen */ pLink = pScreenPriv->maps; while(pLink) { - pColPriv = - (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr; + pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates, + CMapColormapKey); pColPriv->recalculate = TRUE; pLink = pLink->next; } @@ -997,10 +984,11 @@ xf86ChangeGammaRamp( CMapScreenPtr pScreenPriv; CMapLinkPtr pLink; - if(CMapScreenIndex == -1) + if(CMapScreenKey == NULL) return BadImplementation; - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + CMapScreenKey); if(!pScreenPriv) return BadImplementation; @@ -1012,8 +1000,8 @@ xf86ChangeGammaRamp( /* mark all colormaps on this screen */ pLink = pScreenPriv->maps; while(pLink) { - pColPriv = - (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr; + pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates, + CMapColormapKey); pColPriv->recalculate = TRUE; pLink = pLink->next; } @@ -1056,9 +1044,10 @@ xf86GetGammaRampSize(ScreenPtr pScreen) { CMapScreenPtr pScreenPriv; - if(CMapScreenIndex == -1) return 0; + if(CMapScreenKey == NULL) return 0; - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + CMapScreenKey); if(!pScreenPriv) return 0; return pScreenPriv->gammaElements; @@ -1076,10 +1065,11 @@ xf86GetGammaRamp( LOCO *entry; int shift, sigbits; - if(CMapScreenIndex == -1) + if(CMapScreenKey == NULL) return BadImplementation; - pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + CMapScreenKey); if(!pScreenPriv) return BadImplementation; diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c index 537d53d7d..9fd2e6c70 100644 --- a/hw/xfree86/common/xf86fbman.c +++ b/hw/xfree86/common/xf86fbman.c @@ -42,21 +42,15 @@ #define DEBUG */ -static int xf86FBMangerIndex = -1; -static unsigned long xf86ManagerGeneration = 0; +static DevPrivateKey xf86FBManagerKey = NULL; _X_EXPORT Bool xf86RegisterOffscreenManager( ScreenPtr pScreen, FBManagerFuncsPtr funcs ){ - if(xf86ManagerGeneration != serverGeneration) { - if((xf86FBMangerIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - xf86ManagerGeneration = serverGeneration; - } - - pScreen->devPrivates[xf86FBMangerIndex].ptr = (pointer)funcs; + xf86FBManagerKey = &xf86FBManagerKey; + dixSetPrivate(&pScreen->devPrivates, xf86FBManagerKey, funcs); return TRUE; } @@ -65,9 +59,9 @@ _X_EXPORT Bool xf86RegisterOffscreenManager( _X_EXPORT Bool xf86FBManagerRunning(ScreenPtr pScreen) { - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return FALSE; - if(!pScreen->devPrivates[xf86FBMangerIndex].ptr) + if(!dixLookupPrivate(&pScreen->devPrivates, xf86FBManagerKey)) return FALSE; return TRUE; @@ -81,9 +75,10 @@ xf86RegisterFreeBoxCallback( ){ FBManagerFuncsPtr funcs; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBManagerKey))) return FALSE; return (*funcs->RegisterFreeBoxCallback)(pScreen, FreeBoxCallback, devPriv); @@ -101,9 +96,10 @@ xf86AllocateOffscreenArea( ){ FBManagerFuncsPtr funcs; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return NULL; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBManagerKey))) return NULL; return (*funcs->AllocateOffscreenArea)( @@ -122,9 +118,10 @@ xf86AllocateOffscreenLinear( ){ FBManagerFuncsPtr funcs; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return NULL; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBManagerKey))) return NULL; return (*funcs->AllocateOffscreenLinear)( @@ -139,10 +136,10 @@ xf86FreeOffscreenArea(FBAreaPtr area) if(!area) return; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return; - if(!(funcs = - (FBManagerFuncsPtr)area->pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate( + &area->pScreen->devPrivates, xf86FBManagerKey))) return; (*funcs->FreeOffscreenArea)(area); @@ -158,10 +155,10 @@ xf86FreeOffscreenLinear(FBLinearPtr linear) if(!linear) return; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return; - if(!(funcs = - (FBManagerFuncsPtr)linear->pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate( + &linear->pScreen->devPrivates, xf86FBManagerKey))) return; (*funcs->FreeOffscreenLinear)(linear); @@ -179,10 +176,10 @@ xf86ResizeOffscreenArea( if(!resize) return FALSE; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return FALSE; - if(!(funcs = - (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate( + &resize->pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->ResizeOffscreenArea)(resize, w, h); @@ -197,10 +194,10 @@ xf86ResizeOffscreenLinear( if(!resize) return FALSE; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return FALSE; - if(!(funcs = - (FBManagerFuncsPtr)resize->pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate( + &resize->pScreen->devPrivates, xf86FBManagerKey))) return FALSE; return (*funcs->ResizeOffscreenLinear)(resize, size); @@ -220,9 +217,10 @@ xf86QueryLargestOffscreenArea( *w = 0; *h = 0; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBManagerKey))) return FALSE; return (*funcs->QueryLargestOffscreenArea)( @@ -240,9 +238,10 @@ xf86QueryLargestOffscreenLinear( *size = 0; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBManagerKey))) return FALSE; return (*funcs->QueryLargestOffscreenLinear)( @@ -255,9 +254,10 @@ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen) { FBManagerFuncsPtr funcs; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return FALSE; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBManagerKey))) return FALSE; return (*funcs->PurgeOffscreenAreas)(pScreen); @@ -269,8 +269,7 @@ xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen) \************************************************************/ -static unsigned long xf86FBGeneration = 0; -static int xf86FBScreenIndex = -1; +static DevPrivateKey xf86FBScreenKey = &xf86FBScreenKey; typedef struct _FBLink { FBArea area; @@ -320,8 +319,8 @@ localRegisterFreeBoxCallback( FreeBoxCallbackProcPtr *newCallbacks; DevUnion *newPrivates; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); newCallbacks = xrealloc( offman->FreeBoxesUpdateCallback, sizeof(FreeBoxCallbackProcPtr) * (offman->NumCallbacks + 1)); @@ -446,8 +445,8 @@ localAllocateOffscreenArea( FBManagerPtr offman; FBAreaPtr area = NULL; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); if((area = AllocateArea(offman, w, h, gran, moveCB, removeCB, privData))) SendCallFreeBoxCallbacks(offman); @@ -464,8 +463,8 @@ localFreeOffscreenArea(FBAreaPtr area) ScreenPtr pScreen; pScreen = area->pScreen; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); pLink = offman->UsedAreas; if(!pLink) return; @@ -505,8 +504,8 @@ localResizeOffscreenArea( FBLinkPtr pLink, newLink, pLinkPrev = NULL; pScreen = resize->pScreen; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); /* find this link */ if(!(pLink = offman->UsedAreas)) return FALSE; @@ -625,8 +624,8 @@ localQueryLargestOffscreenArea( if((preferences < 0) || (preferences > 3)) return FALSE; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); if(severity < 0) severity = 0; if(severity > 2) severity = 2; @@ -731,8 +730,8 @@ localPurgeUnlockedOffscreenAreas(ScreenPtr pScreen) RegionRec FreedRegion; Bool anyUsed = FALSE; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); pLink = offman->UsedAreas; if(!pLink) return TRUE; @@ -780,8 +779,8 @@ LinearRemoveCBWrapper(FBAreaPtr area) FBLinearLinkPtr pLink, pLinkPrev = NULL; ScreenPtr pScreen = area->pScreen; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); pLink = offman->LinearAreas; if(!pLink) return; @@ -911,7 +910,8 @@ localAllocateOffscreenLinear( BoxPtr extents; int w, h, pitch; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); /* Try to allocate from linear memory first...... */ #ifdef DEBUG @@ -991,8 +991,8 @@ localFreeOffscreenLinear(FBLinearPtr linear) FBLinearLinkPtr pLink, pLinkPrev = NULL; ScreenPtr pScreen = linear->pScreen; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); pLink = offman->LinearAreas; if(!pLink) return; @@ -1049,8 +1049,8 @@ localResizeOffscreenLinear(FBLinearPtr resize, int length) FBLinearLinkPtr pLink; ScreenPtr pScreen = resize->pScreen; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); pLink = offman->LinearAreas; if(!pLink) return FALSE; @@ -1099,7 +1099,8 @@ localQueryLargestOffscreenLinear( int priority ) { - FBManagerPtr offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); FBLinearLinkPtr pLink; FBLinearLinkPtr pLinkRet; @@ -1130,7 +1131,8 @@ localQueryLargestOffscreenLinear( FBManagerPtr offman; BoxPtr extents; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); if((extents->x2 - extents->x1) == w) *size = w * h; @@ -1162,9 +1164,8 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen) { FBLinkPtr pLink, tmp; FBLinearLinkPtr pLinearLink, tmp2; - FBManagerPtr offman = - (FBManagerPtr) pScreen->devPrivates[xf86FBScreenIndex].ptr; - + FBManagerPtr offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); pScreen->CloseScreen = offman->CloseScreen; @@ -1188,7 +1189,7 @@ xf86FBCloseScreen (int i, ScreenPtr pScreen) xfree(offman->FreeBoxesUpdateCallback); xfree(offman->devPrivates); xfree(offman); - pScreen->devPrivates[xf86FBScreenIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL); return (*pScreen->CloseScreen) (i, pScreen); } @@ -1332,19 +1333,13 @@ xf86InitFBManagerRegion( if(REGION_NIL(FullRegion)) return FALSE; - if(xf86FBGeneration != serverGeneration) { - if((xf86FBScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - xf86FBGeneration = serverGeneration; - } - if(!xf86RegisterOffscreenManager(pScreen, &xf86FBManFuncs)) return FALSE; offman = xalloc(sizeof(FBManager)); if(!offman) return FALSE; - pScreen->devPrivates[xf86FBScreenIndex].ptr = (pointer)offman; + dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman); offman->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xf86FBCloseScreen; @@ -1380,11 +1375,11 @@ xf86InitFBManagerLinear( return FALSE; /* we expect people to have called the Area setup first for pixmap cache */ - if (!pScreen->devPrivates[xf86FBScreenIndex].ptr) + if (!dixLookupPrivate(&pScreen->devPrivates, xf86FBScreenKey)) return FALSE; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); offman->LinearAreas = xalloc(sizeof(FBLinearLink)); if (!offman->LinearAreas) return FALSE; @@ -1424,13 +1419,14 @@ xf86AllocateLinearOffscreenArea ( BoxPtr extents; int w, h; - if(xf86FBMangerIndex < 0) + if(xf86FBManagerKey == NULL) return NULL; - if(!(funcs = (FBManagerFuncsPtr)pScreen->devPrivates[xf86FBMangerIndex].ptr)) + if(!(funcs = (FBManagerFuncsPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBManagerKey))) return NULL; - offman = pScreen->devPrivates[xf86FBScreenIndex].ptr; - + offman = (FBManagerPtr)dixLookupPrivate(&pScreen->devPrivates, + xf86FBScreenKey); extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); w = extents->x2 - extents->x1; diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c index 13e13e980..d5ae75b3a 100644 --- a/hw/xfree86/common/xf86pciBus.c +++ b/hw/xfree86/common/xf86pciBus.c @@ -107,127 +107,6 @@ xf86FormatPciBusNumber(int busnum, char *buffer) sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8); } -static void -FindPCIVideoInfo(void) -{ - int i = 0, k; - int num = 0; - struct pci_device *info; - struct pci_device_iterator *iter; - - - if (!xf86scanpci()) { - xf86PciVideoInfo = NULL; - return; - } - - iter = pci_slot_match_iterator_create(& xf86IsolateDevice); - while ((info = pci_device_next(iter)) != NULL) { - if (PCIINFOCLASSES(info->device_class)) { - num++; - xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo, - (sizeof(struct pci_device *) - * (num + 1))); - xf86PciVideoInfo[num] = NULL; - xf86PciVideoInfo[num - 1] = info; - - pci_device_probe(info); - info->user_data = 0; - } - } - - - /* If we haven't found a primary device try a different heuristic */ - if (primaryBus.type == BUS_NONE && num) { - for (i = 0; i < num; i++) { - uint16_t command; - - info = xf86PciVideoInfo[i]; - pci_device_cfg_read_u16(info, & command, 4); - - if ((command & PCI_CMD_MEM_ENABLE) - && ((num == 1) || IS_VGA(info->device_class))) { - if (primaryBus.type == BUS_NONE) { - primaryBus.type = BUS_PCI; - primaryBus.id.pci = info; - } else { - xf86Msg(X_NOTICE, - "More than one possible primary device found\n"); - primaryBus.type ^= (BusType)(-1); - } - } - } - } - - /* Print a summary of the video devices found */ - for (k = 0; k < num; k++) { - const char *vendorname = NULL, *chipname = NULL; - const char *prim = " "; - Bool memdone = FALSE, iodone = FALSE; - - - info = xf86PciVideoInfo[k]; - - vendorname = pci_device_get_vendor_name( info ); - chipname = pci_device_get_device_name( info ); - - if ((!vendorname || !chipname) && - !PCIALWAYSPRINTCLASSES(info->device_class)) - continue; - - if (xf86IsPrimaryPci(info)) - prim = "*"; - - xf86Msg( X_PROBED, "PCI:%s(%u@%u:%u:%u) ", prim, info->domain, - info->bus, info->dev, info->func ); - - if (vendorname) - xf86ErrorF("%s ", vendorname); - else - xf86ErrorF("unknown vendor (0x%04x) ", info->vendor_id); - - if (chipname) - xf86ErrorF("%s ", chipname); - else - xf86ErrorF("unknown chipset (0x%04x) ", info->device_id); - - xf86ErrorF("rev %d", info->revision); - - for (i = 0; i < 6; i++) { - struct pci_mem_region * r = & info->regions[i]; - - if ( r->size && ! r->is_IO ) { - if (!memdone) { - xf86ErrorF(", Mem @ "); - memdone = TRUE; - } else - xf86ErrorF(", "); - xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size); - } - } - - for (i = 0; i < 6; i++) { - struct pci_mem_region * r = & info->regions[i]; - - if ( r->size && r->is_IO ) { - if (!iodone) { - xf86ErrorF(", I/O @ "); - iodone = TRUE; - } else - xf86ErrorF(", "); - xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size); - } - } - - if ( info->rom_size ) { - xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", info->rom_size); - } - - xf86ErrorF("\n"); - } -} - - /* * IO enable/disable related routines for PCI */ @@ -401,10 +280,10 @@ savePciState( struct pci_device * dev, pciSavePtr ptr ) } /* move to OS layer */ +#if 0 static void restorePciState( struct pci_device * dev, pciSavePtr ptr) { -#if 0 int i; /* disable card before setting anything */ @@ -419,8 +298,8 @@ restorePciState( struct pci_device * dev, pciSavePtr ptr) } pci_device_cfg_write_u32(dev, ptr->command, PCI_CMD_STAT_REG); -#endif } +#endif /* move to OS layer */ static void @@ -470,7 +349,121 @@ restorePciBusState(BusAccPtr ptr) void xf86PciProbe(void) { - FindPCIVideoInfo(); + int i = 0, k; + int num = 0; + struct pci_device *info; + struct pci_device_iterator *iter; + + + if (!xf86scanpci()) { + xf86PciVideoInfo = NULL; + return; + } + + iter = pci_slot_match_iterator_create(& xf86IsolateDevice); + while ((info = pci_device_next(iter)) != NULL) { + if (PCIINFOCLASSES(info->device_class)) { + num++; + xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo, + (sizeof(struct pci_device *) + * (num + 1))); + xf86PciVideoInfo[num] = NULL; + xf86PciVideoInfo[num - 1] = info; + + pci_device_probe(info); + info->user_data = 0; + } + } + + + /* If we haven't found a primary device try a different heuristic */ + if (primaryBus.type == BUS_NONE && num) { + for (i = 0; i < num; i++) { + uint16_t command; + + info = xf86PciVideoInfo[i]; + pci_device_cfg_read_u16(info, & command, 4); + + if ((command & PCI_CMD_MEM_ENABLE) + && ((num == 1) || IS_VGA(info->device_class))) { + if (primaryBus.type == BUS_NONE) { + primaryBus.type = BUS_PCI; + primaryBus.id.pci = info; + } else { + xf86Msg(X_NOTICE, + "More than one possible primary device found\n"); + primaryBus.type ^= (BusType)(-1); + } + } + } + } + + /* Print a summary of the video devices found */ + for (k = 0; k < num; k++) { + const char *vendorname = NULL, *chipname = NULL; + const char *prim = " "; + Bool memdone = FALSE, iodone = FALSE; + + + info = xf86PciVideoInfo[k]; + + vendorname = pci_device_get_vendor_name( info ); + chipname = pci_device_get_device_name( info ); + + if ((!vendorname || !chipname) && + !PCIALWAYSPRINTCLASSES(info->device_class)) + continue; + + if (xf86IsPrimaryPci(info)) + prim = "*"; + + xf86Msg( X_PROBED, "PCI:%s(%u@%u:%u:%u) ", prim, info->domain, + info->bus, info->dev, info->func ); + + if (vendorname) + xf86ErrorF("%s ", vendorname); + else + xf86ErrorF("unknown vendor (0x%04x) ", info->vendor_id); + + if (chipname) + xf86ErrorF("%s ", chipname); + else + xf86ErrorF("unknown chipset (0x%04x) ", info->device_id); + + xf86ErrorF("rev %d", info->revision); + + for (i = 0; i < 6; i++) { + struct pci_mem_region * r = & info->regions[i]; + + if ( r->size && ! r->is_IO ) { + if (!memdone) { + xf86ErrorF(", Mem @ "); + memdone = TRUE; + } else + xf86ErrorF(", "); + xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size); + } + } + + for (i = 0; i < 6; i++) { + struct pci_mem_region * r = & info->regions[i]; + + if ( r->size && r->is_IO ) { + if (!iodone) { + xf86ErrorF(", I/O @ "); + iodone = TRUE; + } else + xf86ErrorF(", "); + xf86ErrorF("0x%08lx/%ld", r->base_addr, r->size); + } + } + + if ( info->rom_size ) { + xf86ErrorF(", BIOS @ 0x\?\?\?\?\?\?\?\?/%ld", info->rom_size); + } + + xf86ErrorF("\n"); + } } void diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c index af2cd4a4c..63d1cb31c 100644 --- a/hw/xfree86/common/xf86sbusBus.c +++ b/hw/xfree86/common/xf86sbusBus.c @@ -602,8 +602,7 @@ xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp) pScrn->virtualY = psdp->height; } -static int sbusPaletteIndex = -1; -static unsigned long sbusPaletteGeneration = 0; +static DevPrivateKey sbusPaletteKey = &sbusPaletteKey; typedef struct _sbusCmap { sbusDevicePtr psdp; CloseScreenProcPtr CloseScreen; @@ -613,7 +612,8 @@ typedef struct _sbusCmap { unsigned char origBlue[16]; } sbusCmapRec, *sbusCmapPtr; -#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr)((pScreen)->devPrivates[sbusPaletteIndex].ptr)) +#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, sbusPaletteKey)) static void xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, @@ -673,13 +673,8 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp) struct fbcmap fbcmap; unsigned char data[2]; - if(sbusPaletteGeneration != serverGeneration) { - if((sbusPaletteIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - sbusPaletteGeneration = serverGeneration; - } cmap = xnfcalloc(1, sizeof(sbusCmapRec)); - pScreen->devPrivates[sbusPaletteIndex].ptr = cmap; + dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap); cmap->psdp = psdp; fbcmap.index = 0; fbcmap.count = 16; diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index af98b4fd5..fc94284cb 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -125,6 +125,7 @@ typedef enum { MODE_ONE_HEIGHT, /* only one height is supported */ MODE_ONE_SIZE, /* only one resolution is supported */ MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ + MODE_BANDWIDTH, /* mode requires too much memory bandwidth */ MODE_BAD = -2, /* unspecified reason */ MODE_ERROR = -1 /* error condition */ } ModeStatus; @@ -347,7 +348,7 @@ typedef struct _DriverRec { * functions to configuration tools, the Xserver, or any other * application/module interested in such information. */ -typedef struct _ModuleInfoRec { +_X_DEPRECATED typedef struct _ModuleInfoRec { int moduleVersion; char * moduleName; pointer module; diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index eac0d7e2c..7483e20d2 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -110,23 +110,22 @@ static void xf86XVAdjustFrame(int index, int x, int y, int flags); static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int); -static int XF86XVWindowIndex = -1; -int XF86XvScreenIndex = -1; -static unsigned long XF86XVGeneration = 0; +static DevPrivateKey XF86XVWindowKey = &XF86XVWindowKey; +DevPrivateKey XF86XvScreenKey; static unsigned long PortResource = 0; -int (*XvGetScreenIndexProc)(void) = NULL; +DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL; unsigned long (*XvGetRTPortProc)(void) = NULL; int (*XvScreenInitProc)(ScreenPtr) = NULL; #define GET_XV_SCREEN(pScreen) \ - ((XvScreenPtr)((pScreen)->devPrivates[XF86XvScreenIndex].ptr)) + ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey)) #define GET_XF86XV_SCREEN(pScreen) \ - ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) + ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) #define GET_XF86XV_WINDOW(pWin) \ - ((XF86XVWindowPtr)((pWin)->devPrivates[XF86XVWindowIndex].ptr)) + ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey)) static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL; static int NumGenDrivers = 0; @@ -233,21 +232,12 @@ xf86XVScreenInit( XvScreenPtr pxvs; if(num <= 0 || - !XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc) - return FALSE; - - if(XF86XVGeneration != serverGeneration) { - if((XF86XVWindowIndex = AllocateWindowPrivateIndex()) < 0) - return FALSE; - XF86XVGeneration = serverGeneration; - } - - if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,0)) + !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc) return FALSE; if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; - XF86XvScreenIndex = (*XvGetScreenIndexProc)(); + XF86XvScreenKey = (*XvGetScreenKeyProc)(); PortResource = (*XvGetRTPortProc)(); pxvs = GET_XV_SCREEN(pScreen); @@ -977,7 +967,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) memset(winPriv, 0, sizeof(XF86XVWindowRec)); winPriv->PortRec = portPriv; winPriv->next = PrivRoot; - pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv; + dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv); } portPriv->pDraw = (DrawablePtr)pWin; @@ -998,8 +988,8 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) if(prevPriv) prevPriv->next = winPriv->next; else - pWin->devPrivates[XF86XVWindowIndex].ptr = - (pointer)winPriv->next; + dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, + winPriv->next); xfree(winPriv); break; } @@ -1037,7 +1027,7 @@ xf86XVDestroyWindow(WindowPtr pWin) xfree(tmp); } - pWin->devPrivates[XF86XVWindowIndex].ptr = NULL; + dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL); pScreen->DestroyWindow = ScreenPriv->DestroyWindow; ret = (*pScreen->DestroyWindow)(pWin); @@ -1094,8 +1084,8 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) pPriv->pDraw = NULL; if(!pPrev) - pWin->devPrivates[XF86XVWindowIndex].ptr = - (pointer)(WinPriv->next); + dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, + WinPriv->next); else pPrev->next = WinPriv->next; tmp = WinPriv; @@ -1146,8 +1136,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) pPriv->pDraw = NULL; if(!pPrev) - pWin->devPrivates[XF86XVWindowIndex].ptr = - (pointer)(WinPriv->next); + dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, + WinPriv->next); else pPrev->next = WinPriv->next; tmp = WinPriv; @@ -1844,7 +1834,8 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes) int status; pval[0] = key; pval[1] = IncludeInferiors; - pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status); + pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status, + (XID)0, serverClient); if(!pGC) return; ValidateGC(pDraw, pGC); if (pPriv) pPriv->pGC = pGC; diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c index f8ff0bed4..05267a240 100644 --- a/hw/xfree86/common/xf86xvmc.c +++ b/hw/xfree86/common/xf86xvmc.c @@ -56,11 +56,10 @@ typedef struct { XvMCAdaptorPtr dixinfo; } xf86XvMCScreenRec, *xf86XvMCScreenPtr; -static unsigned long XF86XvMCGeneration = 0; -static int XF86XvMCScreenIndex = -1; +static DevPrivateKey XF86XvMCScreenKey = &XF86XvMCScreenKey; -#define XF86XVMC_GET_PRIVATE(pScreen) \ - (xf86XvMCScreenPtr)((pScreen)->devPrivates[XF86XvMCScreenIndex].ptr) +#define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey) static int @@ -164,19 +163,12 @@ _X_EXPORT Bool xf86XvMCScreenInit( { XvMCAdaptorPtr pAdapt; xf86XvMCScreenPtr pScreenPriv; - XvScreenPtr pxvs = - (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr); - + XvScreenPtr pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + XF86XvScreenKey); int i, j; if(!XvMCScreenInitProc) return FALSE; - if(XF86XvMCGeneration != serverGeneration) { - if((XF86XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - XF86XvMCGeneration = serverGeneration; - } - if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors))) return FALSE; @@ -185,7 +177,7 @@ _X_EXPORT Bool xf86XvMCScreenInit( return FALSE; } - pScreen->devPrivates[XF86XvMCScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv); pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = xf86XvMCCloseScreen; diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h index e716c9c6a..4200dac80 100644 --- a/hw/xfree86/common/xf86xvpriv.h +++ b/hw/xfree86/common/xf86xvpriv.h @@ -30,10 +30,11 @@ #define _XF86XVPRIV_H_ #include "xf86xv.h" +#include "privates.h" /*** These are DDX layer privates ***/ -extern int XF86XvScreenIndex; +extern DevPrivateKey XF86XvScreenKey; typedef struct { DestroyWindowProcPtr DestroyWindow; diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h index 4487273cd..2496e19e6 100644 --- a/hw/xfree86/ddc/edid.h +++ b/hw/xfree86/ddc/edid.h @@ -1,5 +1,5 @@ - -/* edid.h: defines to parse an EDID block +/* + * edid.h: defines to parse an EDID block * * This file contains all information to interpret a standard EDIC block * transmitted by a display device via DDC (Display Data Channel). So far @@ -125,7 +125,11 @@ #define SYNC _SYNC(GET(D_INPUT)) #define _DFP(x) (x & 0x01) #define DFP _DFP(GET(D_INPUT)) -#define _GAMMA(x) (x == 0xff ? 1.0 : ((x + 100.0)/100.0)) +#define _BPC(x) ((x & 0x70) >> 4) +#define BPC _BPC(GET(D_INPUT)) +#define _DIGITAL_INTERFACE(x) (x & 0x0F) +#define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT)) +#define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0)) #define GAMMA _GAMMA(GET(D_GAMMA)) #define HSIZE_MAX GET(D_HSIZE) #define VSIZE_MAX GET(D_VSIZE) @@ -241,14 +245,18 @@ #define SERIAL_NUMBER 0xFF #define ASCII_STR 0xFE #define MONITOR_RANGES 0xFD +#define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255) +#define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255) +#define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255) +#define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255) #define _MIN_V(x) x[5] -#define MIN_V _MIN_V(c) +#define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c)) #define _MAX_V(x) x[6] -#define MAX_V _MAX_V(c) +#define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c)) #define _MIN_H(x) x[7] -#define MIN_H _MIN_H(c) +#define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c)) #define _MAX_H(x) x[8] -#define MAX_H _MAX_H(c) +#define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c)) #define _MAX_CLOCK(x) x[9] #define MAX_CLOCK _MAX_CLOCK(c) #define _HAVE_2ND_GTF(x) (x[10] == 0x02) @@ -282,6 +290,9 @@ #define _WHITE_GAMMA2(x) _GAMMA(x[14]) #define WHITE_GAMMA2 _WHITE_GAMMA2(c) #define ADD_STD_TIMINGS 0xFA +#define COLOR_MANAGEMENT_DATA 0xF9 +#define CVT_3BYTE_DATA 0xF8 +#define ADD_EST_TIMINGS 0xF7 #define ADD_DUMMY 0x10 #define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN)) @@ -315,11 +326,15 @@ #define DPMS_SUSPEND(x) (x & 0x02) #define DPMS_OFF(x) (x & 0x01) -/* display type */ +/* display type, analog */ #define DISP_MONO 0 #define DISP_RGB 1 #define DISP_MULTCOLOR 2 +/* display color encodings, digital */ +#define DISP_YCRCB444 0x01 +#define DISP_YCRCB422 0x02 + /* Msc stuff EDID Ver > 1.1 */ #define STD_COLOR_SPACE(x) (x & 0x4) #define PREFERRED_TIMING_MODE(x) (x & 0x2) @@ -357,6 +372,9 @@ struct disp_features { unsigned int input_setup:1; unsigned int input_sync:5; unsigned int input_dfp:1; + unsigned int input_bpc:3; + unsigned int input_interface:4; + /* 15 bit hole */ int hsize; int vsize; float gamma; @@ -414,8 +432,13 @@ struct detailed_timings { #define DS_RANGES 0xFD #define DS_WHITE_P 0xFB #define DS_STD_TIMINGS 0xFA +#define DS_CMD 0xF9 +#define DS_CVT 0xF8 +#define DS_EST_III 0xF7 #define DS_DUMMY 0x10 #define DS_UNKOWN 0x100 /* type is an int */ +#define DS_VENDOR 0x101 +#define DS_VENDOR_MAX 0x110 struct monitor_ranges { int min_v; @@ -437,17 +460,33 @@ struct whitePoints{ float white_gamma; }; +struct cvt_timings { + int width; + int height; + int rate; + int rates; +}; + +/* + * Be careful when adding new sections; this structure can't grow, it's + * embedded in the middle of xf86Monitor which is ABI. Sizes below are + * in bytes, for ILP32 systems. If all else fails just copy the section + * literally like serial and friends. + */ struct detailed_monitor_section { int type; union { - struct detailed_timings d_timings; + struct detailed_timings d_timings; /* 56 */ Uchar serial[13]; Uchar ascii_data[13]; Uchar name[13]; - struct monitor_ranges ranges; - struct std_timings std_t[5]; - struct whitePoints wp[2]; - } section; + struct monitor_ranges ranges; /* 40 */ + struct std_timings std_t[5]; /* 80 */ + struct whitePoints wp[2]; /* 32 */ + /* color management data */ + struct cvt_timings cvt[4]; /* 64 */ + /* established timings III */ + } section; /* max: 80 */ }; typedef struct { diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c index 7b4b2b9ec..14b0fd73a 100644 --- a/hw/xfree86/ddc/interpret_edid.c +++ b/hw/xfree86/ddc/interpret_edid.c @@ -1,8 +1,28 @@ - -/* interpret_edid.c: interpret a primary EDID block - * +/* * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE> + * Copyright 2007 Red Hat, Inc. + * + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) 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 MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS 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. + * + * interpret_edid.c: interpret a primary EDID block */ + #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif @@ -128,8 +148,12 @@ get_display_section(Uchar *c, struct disp_features *r, r->input_voltage = INPUT_VOLTAGE; r->input_setup = SETUP; r->input_sync = SYNC; - } else if (v->version > 1 || v->revision > 2) + } else if (v->revision == 2 || v->revision == 3) { r->input_dfp = DFP; + } else if (v->revision >= 4) { + r->input_bpc = BPC; + r->input_interface = DIGITAL_INTERFACE; + } r->hsize = HSIZE_MAX; r->vsize = VSIZE_MAX; r->gamma = GAMMA; @@ -155,6 +179,34 @@ get_established_timing_section(Uchar *c, struct established_timings *r) } static void +get_cvt_timing_section(Uchar *c, struct cvt_timings *r) +{ + int i; + + for (i = 0; i < 4; i++) { + if (c[0] && c[1] && c[2]) { + r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2; + switch (c[1] & 0xc0) { + case 0x00: r[i].width = r[i].height * 4 / 3; break; + case 0x40: r[i].width = r[i].height * 16 / 9; break; + case 0x80: r[i].width = r[i].height * 16 / 10; break; + case 0xc0: r[i].width = r[i].height * 15 / 9; break; + } + switch (c[2] & 0x60) { + case 0x00: r[i].rate = 50; break; + case 0x20: r[i].rate = 60; break; + case 0x40: r[i].rate = 75; break; + case 0x60: r[i].rate = 85; break; + } + r[i].rates = c[2] & 0x1f; + } else { + return; + } + c += 3; + } +} + +static void get_std_timing_section(Uchar *c, struct std_timings *r, struct edid_version *v) { @@ -207,6 +259,16 @@ get_dt_md_section(Uchar *c, struct edid_version *ver, det_mon[i].type = DS_STD_TIMINGS; get_dst_timing_section(c,det_mon[i].section.std_t, ver); break; + case COLOR_MANAGEMENT_DATA: + det_mon[i].type = DS_CMD; + break; + case CVT_3BYTE_DATA: + det_mon[i].type = DS_CVT; + get_cvt_timing_section(c, det_mon[i].section.cvt); + break; + case ADD_EST_TIMINGS: + det_mon[i].type = DS_EST_III; + break; case ADD_DUMMY: det_mon[i].type = DS_DUMMY; break; @@ -214,6 +276,9 @@ get_dt_md_section(Uchar *c, struct edid_version *ver, det_mon[i].type = DS_UNKOWN; break; } + if (c[3] <= 0x0F) { + det_mon[i].type = DS_VENDOR + c[3]; + } } else { det_mon[i].type = DT; get_detailed_timing_section(c,&det_mon[i].section.d_timings); @@ -304,13 +369,16 @@ get_detailed_timing_section(Uchar *c, struct detailed_timings *r) r->misc = MISC; } -#define MAX_EDID_MINOR 3 +#define MAX_EDID_MINOR 4 static Bool validate_version(int scrnIndex, struct edid_version *r) { - if (r->version != 1) + if (r->version != 1) { + xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n", + r->version); return FALSE; + } if (r->revision > MAX_EDID_MINOR) xf86DrvMsg(scrnIndex, X_WARNING, diff --git a/hw/xfree86/ddc/print_edid.c b/hw/xfree86/ddc/print_edid.c index 30b607d4f..d9f18fa9f 100644 --- a/hw/xfree86/ddc/print_edid.c +++ b/hw/xfree86/ddc/print_edid.c @@ -1,8 +1,28 @@ - -/* print_edid.c: print out all information retrieved from display device - * +/* * Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE> + * Copyright 2007 Red Hat, Inc. + * + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) 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 MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS 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. + * + * print_edid.c: print out all information retrieved from display device */ + #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> #endif @@ -11,53 +31,9 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "xf86DDC.h" +#include "edid.h" -static void print_vendor(int scrnIndex, struct vendor *); -static void print_version(int scrnIndex, struct edid_version *); -static void print_display(int scrnIndex, struct disp_features *, - struct edid_version *); -static void print_established_timings(int scrnIndex, - struct established_timings *); -static void print_std_timings(int scrnIndex, struct std_timings *); -static void print_detailed_monitor_section(int scrnIndex, - struct detailed_monitor_section *); -static void print_detailed_timings(int scrnIndex, struct detailed_timings *); - -static void print_input_features(int scrnIndex, struct disp_features *); -static void print_dpms_features(int scrnIndex, struct disp_features *, - struct edid_version *v); -static void print_whitepoint(int scrnIndex, struct disp_features *); -static void print_number_sections(int scrnIndex, int); - #define EDID_WIDTH 16 - -xf86MonPtr -xf86PrintEDID(xf86MonPtr m) -{ - CARD16 i, j; - char buf[EDID_WIDTH * 2 + 1]; - - if (!(m)) return NULL; - - print_vendor(m->scrnIndex,&m->vendor); - print_version(m->scrnIndex,&m->ver); - print_display(m->scrnIndex,&m->features, &m->ver); - print_established_timings(m->scrnIndex,&m->timings1); - print_std_timings(m->scrnIndex,m->timings2); - print_detailed_monitor_section(m->scrnIndex,m->det_mon); - print_number_sections(m->scrnIndex,m->no_sections); - - xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n"); - - for (i = 0; i < 128; i += j) { - for (j = 0; j < EDID_WIDTH; ++j) { - sprintf(&buf[j * 2], "%02x", m->rawData[i + j]); - } - xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf); - } - - return m; -} static void print_vendor(int scrnIndex, struct vendor *c) @@ -66,7 +42,7 @@ print_vendor(int scrnIndex, struct vendor *c) (char *)&c->name, c->prod_id, c->serial); xf86DrvMsg(scrnIndex, X_INFO, "Year: %u Week: %u\n", c->year, c->week); } - + static void print_version(int scrnIndex, struct edid_version *c) { @@ -74,32 +50,38 @@ print_version(int scrnIndex, struct edid_version *c) c->revision); } -static void -print_display(int scrnIndex, struct disp_features *disp, - struct edid_version *version) -{ - print_input_features(scrnIndex,disp); - xf86DrvMsg(scrnIndex,X_INFO,"Max H-Image Size [cm]: "); - if (disp->hsize) - xf86ErrorF("horiz.: %i ",disp->hsize); - else - xf86ErrorF("H-Size may change, "); - if (disp->vsize) - xf86ErrorF("vert.: %i\n",disp->vsize); - else - xf86ErrorF("V-Size may change\n"); - xf86DrvMsg(scrnIndex,X_INFO,"Gamma: %.2f\n", disp->gamma); - print_dpms_features(scrnIndex,disp,version); - print_whitepoint(scrnIndex,disp); -} - +static const char *digital_interfaces[] = { + "undefined", + "DVI", + "HDMI-a", + "HDMI-b", + "MDDI", + "DisplayPort", + "unknown" +}; + static void -print_input_features(int scrnIndex, struct disp_features *c) +print_input_features(int scrnIndex, struct disp_features *c, + struct edid_version *v) { if (DIGITAL(c->input_type)) { - xf86DrvMsg(scrnIndex,X_INFO,"Digital Display Input\n"); - if (DFP1(c->input_dfp)) - xf86DrvMsg(scrnIndex,X_INFO,"DFP 1.x compatible TMDS\n"); + xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n"); + if (v->revision == 2 || v->revision == 3) { + if (DFP1(c->input_dfp)) + xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n"); + } else if (v->revision >= 4) { + int interface = c->input_interface; + int bpc = c->input_bpc; + if (interface > 6) + interface = 6; /* unknown */ + if (bpc == 0 || bpc == 7) + xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n"); + else + xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n", + bpc * 2 + 4); + xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n", + digital_interfaces[interface]); + } } else { xf86DrvMsg(scrnIndex,X_INFO,"Analog Display Input, "); xf86ErrorF("Input Voltage Level: "); @@ -146,33 +128,53 @@ print_dpms_features(int scrnIndex, struct disp_features *c, if (DPMS_OFF(c->dpms)) xf86ErrorF(" Off"); } else xf86DrvMsg(scrnIndex,X_INFO,"No DPMS capabilities specified"); - switch (c->display_type){ - case DISP_MONO: - xf86ErrorF("; Monochorome/GrayScale Display\n"); - break; - case DISP_RGB: - xf86ErrorF("; RGB/Color Display\n"); - break; - case DISP_MULTCOLOR: - xf86ErrorF("; Non RGB Multicolor Display\n"); - break; - default: - xf86ErrorF("\n"); - break; + if (!c->input_type) { /* analog */ + switch (c->display_type){ + case DISP_MONO: + xf86ErrorF("; Monochorome/GrayScale Display\n"); + break; + case DISP_RGB: + xf86ErrorF("; RGB/Color Display\n"); + break; + case DISP_MULTCOLOR: + xf86ErrorF("; Non RGB Multicolor Display\n"); + break; + default: + xf86ErrorF("\n"); + break; + } + } else { + int enc = c->display_type; + xf86DrvMsg(scrnIndex, X_INFO, "\nSupported color encodings: " + "RGB 4:4:4 %s%s\n", + enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "", + enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : ""); } + if (STD_COLOR_SPACE(c->msc)) xf86DrvMsg(scrnIndex,X_INFO, "Default color space is primary color space\n"); - if (PREFERRED_TIMING_MODE(c->msc)) - xf86DrvMsg(scrnIndex,X_INFO, + + if (PREFERRED_TIMING_MODE(c->msc) || v->revision >= 4) { + xf86DrvMsg(scrnIndex, X_INFO, "First detailed timing is preferred mode\n"); - else if (v->version == 1 && v->revision >= 3) + if (v->revision >= 4) + xf86DrvMsg(scrnIndex, X_INFO, + "Preferred mode is native pixel format and refresh rate\n"); + } else if (v->revision == 3) { xf86DrvMsg(scrnIndex,X_INFO, "First detailed timing not preferred " "mode in violation of standard!"); - if (GFT_SUPPORTED(c->msc)) - xf86DrvMsg(scrnIndex,X_INFO, - "GTF timings supported\n"); + } + + if (v->revision >= 4) { + if (GFT_SUPPORTED(c->msc)) { + xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n"); + } + } else { + if (GFT_SUPPORTED(c->msc)) + xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n"); + } } static void @@ -187,7 +189,37 @@ print_whitepoint(int scrnIndex, struct disp_features *disp) xf86ErrorF("whiteX: %.3f whiteY: %.3f\n", disp->whitex,disp->whitey); } - + +static void +print_display(int scrnIndex, struct disp_features *disp, + struct edid_version *v) +{ + print_input_features(scrnIndex, disp, v); + if (disp->hsize && disp->vsize) { + xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: "); + xf86ErrorF("horiz.: %i ", disp->hsize); + xf86ErrorF("vert.: %i\n", disp->vsize); + } else if (v->revision >= 4 && (disp->hsize || disp->vsize)) { + if (disp->hsize) + xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n", + (disp->hsize + 99) / 100.0); + if (disp->vsize) + xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n", + 100.0 / (float)(disp->vsize + 99)); + + } else { + xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n"); + } + + if (!disp->gamma && v->revision >= 1.4) + xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n"); + else + xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma); + + print_dpms_features(scrnIndex, disp, v); + print_whitepoint(scrnIndex, disp); +} + static void print_established_timings(int scrnIndex, struct established_timings *t) { @@ -235,7 +267,68 @@ print_std_timings(int scrnIndex, struct std_timings *t) } } } - + +static void +print_cvt_timings(int si, struct cvt_timings *t) +{ + int i; + + for (i = 0; i < 4; i++) { + if (t[i].height) { + xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n", + t[i].width, t[i].height, + t[i].rates & 0x10 ? "50," : "", + t[i].rates & 0x08 ? "60," : "", + t[i].rates & 0x04 ? "75," : "", + t[i].rates & 0x02 ? "85," : "", + t[i].rates & 0x01 ? "60RB" : ""); + } else break; + } +} + +static void +print_detailed_timings(int scrnIndex, struct detailed_timings *t) +{ + + if (t->clock > 15000000) { /* sanity check */ + xf86DrvMsg(scrnIndex,X_INFO,"Supported additional Video Mode:\n"); + xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz ",t->clock/1000000.0); + xf86ErrorF("Image Size: %i x %i mm\n",t->h_size,t->v_size); + xf86DrvMsg(scrnIndex,X_INFO, + "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ", + t->h_active, t->h_sync_off + t->h_active, + t->h_sync_off + t->h_sync_width + t->h_active, + t->h_active + t->h_blanking); + xf86ErrorF("h_border: %i\n",t->h_border); + xf86DrvMsg(scrnIndex,X_INFO, + "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ", + t->v_active, t->v_sync_off + t->v_active, + t->v_sync_off + t->v_sync_width + t->v_active, + t->v_active + t->v_blanking); + xf86ErrorF("v_border: %i\n",t->v_border); + if (IS_STEREO(t->stereo)) { + xf86DrvMsg(scrnIndex,X_INFO,"Stereo: "); + if (IS_RIGHT_STEREO(t->stereo)) { + if (!t->stereo_1) + xf86ErrorF("right channel on sync\n"); + else + xf86ErrorF("left channel on sync\n"); + } else if (IS_LEFT_STEREO(t->stereo)) { + if (!t->stereo_1) + xf86ErrorF("right channel on even line\n"); + else + xf86ErrorF("left channel on evel line\n"); + } + if (IS_4WAY_STEREO(t->stereo)) { + if (!t->stereo_1) + xf86ErrorF("4-way interleaved\n"); + else + xf86ErrorF("side-by-side interleaved"); + } + } + } +} + static void print_detailed_monitor_section(int scrnIndex, struct detailed_monitor_section *m) @@ -290,56 +383,31 @@ print_detailed_monitor_section(int scrnIndex, m[i].section.wp[j].white_y, m[i].section.wp[j].white_gamma); break; + case DS_CMD: + xf86DrvMsg(scrnIndex, X_INFO, + "Color management data: (not decoded)\n"); + break; + case DS_CVT: + xf86DrvMsg(scrnIndex, X_INFO, + "CVT 3-byte-code modes:\n"); + print_cvt_timings(scrnIndex, m[i].section.cvt); + break; + case DS_EST_III: + xf86DrvMsg(scrnIndex, X_INFO, + "Established timings III: (not decoded)\n"); + break; case DS_DUMMY: default: break; } - } -} - -static void -print_detailed_timings(int scrnIndex, struct detailed_timings *t) -{ - - if (t->clock > 15000000) { /* sanity check */ - xf86DrvMsg(scrnIndex,X_INFO,"Supported additional Video Mode:\n"); - xf86DrvMsg(scrnIndex,X_INFO,"clock: %.1f MHz ",t->clock/1000000.0); - xf86ErrorF("Image Size: %i x %i mm\n",t->h_size,t->v_size); - xf86DrvMsg(scrnIndex,X_INFO, - "h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ", - t->h_active, t->h_sync_off + t->h_active, - t->h_sync_off + t->h_sync_width + t->h_active, - t->h_active + t->h_blanking); - xf86ErrorF("h_border: %i\n",t->h_border); - xf86DrvMsg(scrnIndex,X_INFO, - "v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ", - t->v_active, t->v_sync_off + t->v_active, - t->v_sync_off + t->v_sync_width + t->v_active, - t->v_active + t->v_blanking); - xf86ErrorF("v_border: %i\n",t->v_border); - if (IS_STEREO(t->stereo)) { - xf86DrvMsg(scrnIndex,X_INFO,"Stereo: "); - if (IS_RIGHT_STEREO(t->stereo)) { - if (!t->stereo_1) - xf86ErrorF("right channel on sync\n"); - else - xf86ErrorF("left channel on sync\n"); - } else if (IS_LEFT_STEREO(t->stereo)) { - if (!t->stereo_1) - xf86ErrorF("right channel on even line\n"); - else - xf86ErrorF("left channel on evel line\n"); - } - if (IS_4WAY_STEREO(t->stereo)) { - if (!t->stereo_1) - xf86ErrorF("4-way interleaved\n"); - else - xf86ErrorF("side-by-side interleaved"); - } + if (m[i].type >= DS_VENDOR && m[i].type <= DS_VENDOR_MAX) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Unknown vendor-specific block %hx\n", + m[i].type - DS_VENDOR); } } } - + static void print_number_sections(int scrnIndex, int num) { @@ -348,3 +416,30 @@ print_number_sections(int scrnIndex, int num) num); } +xf86MonPtr +xf86PrintEDID(xf86MonPtr m) +{ + CARD16 i, j; + char buf[EDID_WIDTH * 2 + 1]; + + if (!(m)) return NULL; + + print_vendor(m->scrnIndex,&m->vendor); + print_version(m->scrnIndex,&m->ver); + print_display(m->scrnIndex,&m->features, &m->ver); + print_established_timings(m->scrnIndex,&m->timings1); + print_std_timings(m->scrnIndex,m->timings2); + print_detailed_monitor_section(m->scrnIndex,m->det_mon); + print_number_sections(m->scrnIndex,m->no_sections); + + xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n"); + + for (i = 0; i < 128; i += j) { + for (j = 0; j < EDID_WIDTH; ++j) { + sprintf(&buf[j * 2], "%02x", m->rawData[i + j]); + } + xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf); + } + + return m; +} diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c index acd700694..d0d892aaf 100644 --- a/hw/xfree86/dixmods/extmod/modinit.c +++ b/hw/xfree86/dixmods/extmod/modinit.c @@ -38,6 +38,15 @@ static MODULESETUPPROTO(extmodSetup); * Array describing extensions to be initialized */ static ExtensionModule extensionModules[] = { +#ifdef XSELINUX + { + SELinuxExtensionInit, + SELINUX_EXTENSION_NAME, + NULL, + NULL, + NULL + }, +#endif #ifdef SHAPE { ShapeExtensionInit, diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h index 41f060b2a..3c2e2022a 100644 --- a/hw/xfree86/dixmods/extmod/modinit.h +++ b/hw/xfree86/dixmods/extmod/modinit.h @@ -125,12 +125,12 @@ extern void ShmRegisterFuncs( ShmFuncsPtr funcs); #endif -#ifdef XACE -extern void XaceExtensionInit(INITARGS); +#ifdef XSELINUX +extern void SELinuxExtensionInit(INITARGS); +#include "xselinux.h" #endif #if 1 -extern void SecurityExtensionSetup(INITARGS); extern void SecurityExtensionInit(INITARGS); #endif diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c index fa9530860..295e05e9e 100644 --- a/hw/xfree86/dixmods/extmod/xf86dga2.c +++ b/hw/xfree86/dixmods/extmod/xf86dga2.c @@ -62,8 +62,7 @@ unsigned char DGAReqCode = 0; int DGAErrorBase; int DGAEventBase; -static int DGAGeneration = 0; -static int DGAClientPrivateIndex; +static DevPrivateKey DGAClientPrivateKey = &DGAClientPrivateKey; static int DGACallbackRefCount = 0; /* This holds the client's version information */ @@ -72,7 +71,11 @@ typedef struct { int minor; } DGAPrivRec, *DGAPrivPtr; -#define DGAPRIV(c) ((c)->devPrivates[DGAClientPrivateIndex].ptr) +#define DGA_GETPRIV(c) ((DGAPrivPtr) \ + dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey)) +#define DGA_SETPRIV(c,p) \ + dixSetPrivate(&(c)->devPrivates, DGAClientPrivateKey, p) + void XFree86DGAExtensionInit(INITARGS) @@ -97,23 +100,6 @@ XFree86DGAExtensionInit(INITARGS) for (i = KeyPress; i <= MotionNotify; i++) SetCriticalEvent (DGAEventBase + i); } - - /* - * Allocate a client private index to hold the client's version - * information. - */ - if (DGAGeneration != serverGeneration) { - DGAClientPrivateIndex = AllocateClientPrivateIndex(); - /* - * Allocate 0 length, and use the private to hold a pointer to - * our DGAPrivRec. - */ - if (!AllocateClientPrivate(DGAClientPrivateIndex, 0)) { - ErrorF("XFree86DGAExtensionInit: AllocateClientPrivate failed\n"); - return; - } - DGAGeneration = serverGeneration; - } } @@ -590,12 +576,12 @@ ProcXDGASetClientVersion(ClientPtr client) DGAPrivPtr pPriv; REQUEST_SIZE_MATCH(xXDGASetClientVersionReq); - if ((pPriv = DGAPRIV(client)) == NULL) { + if ((pPriv = DGA_GETPRIV(client)) == NULL) { pPriv = xalloc(sizeof(DGAPrivRec)); /* XXX Need to look into freeing this */ if (!pPriv) return BadAlloc; - DGAPRIV(client) = pPriv; + DGA_SETPRIV(client, pPriv); } pPriv->major = stuff->major; pPriv->minor = stuff->minor; diff --git a/hw/xfree86/dixmods/extmod/xf86misc.c b/hw/xfree86/dixmods/extmod/xf86misc.c index 3a6f83eca..8127afdff 100644 --- a/hw/xfree86/dixmods/extmod/xf86misc.c +++ b/hw/xfree86/dixmods/extmod/xf86misc.c @@ -41,8 +41,7 @@ #endif static int miscErrorBase; -static int MiscGeneration = 0; -static int MiscClientPrivateIndex; +static DevPrivateKey MiscClientPrivateKey = &MiscClientPrivateKey; /* This holds the client's version information */ typedef struct { @@ -50,7 +49,10 @@ typedef struct { int minor; } MiscPrivRec, *MiscPrivPtr; -#define MPRIV(c) ((c)->devPrivates[MiscClientPrivateIndex].ptr) +#define M_GETPRIV(c) ((MiscPrivPtr) \ + dixLookupPrivate(&(c)->devPrivates, MiscClientPrivateKey)) +#define M_SETPRIV(c,p) \ + dixSetPrivate(&(c)->devPrivates, MiscClientPrivateKey, p) static void XF86MiscResetProc( ExtensionEntry* /* extEntry */ @@ -61,7 +63,7 @@ ClientVersion(ClientPtr client, int *major, int *minor) { MiscPrivPtr pPriv; - pPriv = MPRIV(client); + pPriv = M_GETPRIV(client); if (!pPriv) { if (major) *major = 0; if (minor) *minor = 0; @@ -106,9 +108,9 @@ static unsigned char XF86MiscReqCode = 0; #endif #ifdef DEBUG -# define DEBUG_P(x) ErrorF(x"\n"); +# define DEBUG_P(x) ErrorF x; #else -# define DEBUG_P(x) /**/ +# define DEBUG_P(x) do {} while (0) #endif #define MISCERR(x) (miscErrorBase + x) @@ -118,29 +120,9 @@ XFree86MiscExtensionInit(void) { ExtensionEntry* extEntry; - DEBUG_P("XFree86MiscExtensionInit"); - if (!xf86GetModInDevEnabled()) return; - /* - * Allocate a client private index to hold the client's version - * information. - */ - if (MiscGeneration != serverGeneration) { - MiscClientPrivateIndex = AllocateClientPrivateIndex(); - /* - * Allocate 0 length, and use the private to hold a pointer to our - * MiscPrivRec. - */ - if (!AllocateClientPrivate(MiscClientPrivateIndex, 0)) { - ErrorF("XFree86MiscExtensionInit: " - "AllocateClientPrivate failed\n"); - return; - } - MiscGeneration = serverGeneration; - } - if ( (extEntry = AddExtension(XF86MISCNAME, XF86MiscNumberEvents, @@ -170,8 +152,6 @@ ProcXF86MiscQueryVersion(client) xXF86MiscQueryVersionReply rep; register int n; - DEBUG_P("XF86MiscQueryVersion"); - REQUEST_SIZE_MATCH(xXF86MiscQueryVersionReq); rep.type = X_Reply; rep.length = 0; @@ -205,7 +185,9 @@ ProcXF86MiscSetSaver(client) if (stuff->screen > screenInfo.numScreens) return BadValue; - vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; + vptr = (ScrnInfoPtr) + dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates, + xf86ScreenKey); REQUEST_SIZE_MATCH(xXF86MiscSetSaverReq); @@ -233,7 +215,9 @@ ProcXF86MiscGetSaver(client) if (stuff->screen > screenInfo.numScreens) return BadValue; - vptr = (ScrnInfoPtr) screenInfo.screens[stuff->screen]->devPrivates[xf86ScreenIndex].ptr; + vptr = (ScrnInfoPtr) + dixLookupPrivate(&screenInfo.screens[stuff->screen]->devPrivates, + xf86ScreenKey); REQUEST_SIZE_MATCH(xXF86MiscGetSaverReq); rep.type = X_Reply; @@ -262,8 +246,7 @@ ProcXF86MiscGetMouseSettings(client) char *devname; pointer mouse; register int n; - - DEBUG_P("XF86MiscGetMouseSettings"); + int devnamelen; REQUEST_SIZE_MATCH(xXF86MiscGetMouseSettingsReq); rep.type = X_Reply; @@ -281,7 +264,7 @@ ProcXF86MiscGetMouseSettings(client) rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT); rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE); rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS); - rep.devnamelen = (devname? strlen(devname): 0); + devnamelen = rep.devnamelen = (devname? strlen(devname): 0); rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) - sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2; @@ -301,8 +284,8 @@ ProcXF86MiscGetMouseSettings(client) WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep); MiscExtDestroyStruct(mouse, MISC_POINTER); - if (rep.devnamelen) - WriteToClient(client, rep.devnamelen, devname); + if (devnamelen) + WriteToClient(client, devnamelen, devname); return (client->noClientException); } @@ -314,8 +297,6 @@ ProcXF86MiscGetKbdSettings(client) pointer kbd; register int n; - DEBUG_P("XF86MiscGetKbdSettings"); - REQUEST_SIZE_MATCH(xXF86MiscGetKbdSettingsReq); rep.type = X_Reply; rep.length = 0; @@ -349,19 +330,17 @@ ProcXF86MiscSetMouseSettings(client) REQUEST(xXF86MiscSetMouseSettingsReq); - DEBUG_P("XF86MiscSetMouseSettings"); - REQUEST_AT_LEAST_SIZE(xXF86MiscSetMouseSettingsReq); ClientVersion(client, &major, &minor); if (xf86GetVerbosity() > 1) { - ErrorF("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n", + DEBUG_P(("SetMouseSettings - type: %d brate: %d srate: %d chdmid: %d\n", (int)stuff->mousetype, (int)stuff->baudrate, - (int)stuff->samplerate, stuff->chordmiddle); - ErrorF(" em3but: %d em3tim: %d res: %d flags: %ld\n", + (int)stuff->samplerate, stuff->chordmiddle)); + DEBUG_P((" em3but: %d em3tim: %d res: %d flags: %ld\n", stuff->emulate3buttons, (int)stuff->emulate3timeout, - (int)stuff->resolution, (unsigned long)stuff->flags); + (int)stuff->resolution, (unsigned long)stuff->flags)); } if ((mouse = MiscExtCreateStruct(MISC_POINTER)) == (pointer) 0) @@ -387,7 +366,7 @@ ProcXF86MiscSetMouseSettings(client) return BadAlloc; strncpy(devname,(char*)(&stuff[1]),stuff->devnamelen); if (xf86GetVerbosity() > 1) - ErrorF("SetMouseSettings - device: %s\n",devname); + DEBUG_P(("SetMouseSettings - device: %s\n",devname)); MiscExtSetMouseDevice(mouse, devname); } } @@ -406,12 +385,12 @@ ProcXF86MiscSetMouseSettings(client) case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo); case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule); default: - ErrorF("Unexpected return from MiscExtApply(POINTER) = %d\n", ret); + DEBUG_P(("Unexpected return from MiscExtApply(POINTER) = %d\n", ret)); return BadImplementation; } if (xf86GetVerbosity() > 1) - ErrorF("SetMouseSettings - Succeeded\n"); + DEBUG_P(("SetMouseSettings - Succeeded\n")); return (client->noClientException); } @@ -423,14 +402,12 @@ ProcXF86MiscSetKbdSettings(client) pointer kbd; REQUEST(xXF86MiscSetKbdSettingsReq); - DEBUG_P("XF86MiscSetKbdSettings"); - REQUEST_SIZE_MATCH(xXF86MiscSetKbdSettingsReq); if (xf86GetVerbosity() > 1) - ErrorF("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n", + DEBUG_P(("SetKbdSettings - type: %d rate: %d delay: %d snumlk: %d\n", (int)stuff->kbdtype, (int)stuff->rate, - (int)stuff->delay, stuff->servnumlock); + (int)stuff->delay, stuff->servnumlock)); if ((kbd = MiscExtCreateStruct(MISC_KEYBOARD)) == (pointer) 0) return BadAlloc; @@ -445,12 +422,12 @@ ProcXF86MiscSetKbdSettings(client) case MISC_RET_BADVAL: return BadValue; case MISC_RET_BADKBDTYPE: return MISCERR(XF86MiscBadKbdType); default: - ErrorF("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret); + DEBUG_P(("Unexpected return from MiscExtApply(KEYBOARD) = %d\n", ret)); return BadImplementation; } if (xf86GetVerbosity() > 1) - ErrorF("SetKbdSettings - Succeeded\n"); + DEBUG_P(("SetKbdSettings - Succeeded\n")); return (client->noClientException); } @@ -462,14 +439,12 @@ ProcXF86MiscSetGrabKeysState(client) xXF86MiscSetGrabKeysStateReply rep; REQUEST(xXF86MiscSetGrabKeysStateReq); - DEBUG_P("XF86MiscSetGrabKeysState"); - REQUEST_SIZE_MATCH(xXF86MiscSetGrabKeysStateReq); if ((status = MiscExtSetGrabKeysState(client, stuff->enable)) == 0) { if (xf86GetVerbosity() > 1) - ErrorF("SetGrabKeysState - %s\n", - stuff->enable ? "enabled" : "disabled"); + DEBUG_P(("SetGrabKeysState - %s\n", + stuff->enable ? "enabled" : "disabled")); } rep.type = X_Reply; @@ -493,18 +468,16 @@ ProcXF86MiscSetClientVersion(ClientPtr client) MiscPrivPtr pPriv; - DEBUG_P("XF86MiscSetClientVersion"); - REQUEST_SIZE_MATCH(xXF86MiscSetClientVersionReq); - if ((pPriv = MPRIV(client)) == NULL) { + if ((pPriv = M_GETPRIV(client)) == NULL) { pPriv = xalloc(sizeof(MiscPrivRec)); if (!pPriv) return BadAlloc; - MPRIV(client) = pPriv; + M_SETPRIV(client, pPriv); } if (xf86GetVerbosity() > 1) - ErrorF("SetClientVersion: %i %i\n",stuff->major,stuff->minor); + DEBUG_P(("SetClientVersion: %i %i\n",stuff->major,stuff->minor)); pPriv->major = stuff->major; pPriv->minor = stuff->minor; @@ -520,8 +493,7 @@ ProcXF86MiscGetFilePaths(client) const char *modulepath; const char *logfile; register int n; - - DEBUG_P("XF86MiscGetFilePaths"); + int configlen, modulelen, loglen; REQUEST_SIZE_MATCH(xXF86MiscGetFilePathsReq); rep.type = X_Reply; @@ -530,9 +502,9 @@ ProcXF86MiscGetFilePaths(client) if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile)) return BadValue; - rep.configlen = (configfile? strlen(configfile): 0); - rep.modulelen = (modulepath? strlen(modulepath): 0); - rep.loglen = (logfile? strlen(logfile): 0); + configlen = rep.configlen = (configfile? strlen(configfile): 0); + modulelen = rep.modulelen = (modulepath? strlen(modulepath): 0); + loglen = rep.loglen = (logfile? strlen(logfile): 0); rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) + ((rep.configlen + 3) & ~3) + ((rep.modulelen + 3) & ~3) + @@ -547,12 +519,12 @@ ProcXF86MiscGetFilePaths(client) } WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep); - if (rep.configlen) - WriteToClient(client, rep.configlen, (char *)configfile); - if (rep.modulelen) - WriteToClient(client, rep.modulelen, (char *)modulepath); - if (rep.loglen) - WriteToClient(client, rep.loglen, (char *)logfile); + if (configlen) + WriteToClient(client, configlen, (char *)configfile); + if (modulelen) + WriteToClient(client, modulelen, (char *)modulepath); + if (loglen) + WriteToClient(client, loglen, (char *)logfile); return (client->noClientException); } @@ -565,11 +537,10 @@ ProcXF86MiscPassMessage(client) char *msgtype, *msgval, *retstr; int retval, size; register int n; + int mesglen; REQUEST(xXF86MiscPassMessageReq); - DEBUG_P("XF86MiscPassMessage"); - REQUEST_AT_LEAST_SIZE(xXF86MiscPassMessageReq); size = (sizeof(xXF86MiscPassMessageReq) + 3) >> 2; size+= (stuff->typelen + 3) >> 2; @@ -601,7 +572,7 @@ ProcXF86MiscPassMessage(client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.mesglen = (retstr? strlen(retstr): 0); + mesglen = rep.mesglen = (retstr? strlen(retstr): 0); rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) + ((rep.mesglen + 3) & ~3)) >> 2; rep.status = 0; @@ -613,8 +584,8 @@ ProcXF86MiscPassMessage(client) } WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep); - if (rep.mesglen) - WriteToClient(client, rep.mesglen, (char *)retstr); + if (mesglen) + WriteToClient(client, mesglen, (char *)retstr); xfree(msgtype); xfree(msgval); diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c index 3b054a829..718d40fbd 100644 --- a/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -52,8 +52,7 @@ from Kaleb S. KEITHLEY #define DEFAULT_XF86VIDMODE_VERBOSITY 3 static int VidModeErrorBase; -static int VidModeGeneration = 0; -static int VidModeClientPrivateIndex; +static DevPrivateKey VidModeClientPrivateKey = &VidModeClientPrivateKey; /* This holds the client's version information */ typedef struct { @@ -61,7 +60,10 @@ typedef struct { int minor; } VidModePrivRec, *VidModePrivPtr; -#define VMPRIV(c) ((c)->devPrivates[VidModeClientPrivateIndex].ptr) +#define VM_GETPRIV(c) ((VidModePrivPtr) \ + dixLookupPrivate(&(c)->devPrivates, VidModeClientPrivateKey)) +#define VM_SETPRIV(c,p) \ + dixSetPrivate(&(c)->devPrivates, VidModeClientPrivateKey, p) static void XF86VidModeResetProc( ExtensionEntry* /* extEntry */ @@ -145,10 +147,12 @@ typedef struct _XF86VidModeScreenPrivate { Bool hasWindow; } XF86VidModeScreenPrivateRec, *XF86VidModeScreenPrivatePtr; -static int ScreenPrivateIndex; +static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey; -#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr) -#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v); +#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \ + dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey)) +#define SetScreenPrivate(s,v) \ + dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v) #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = GetScreenPrivate(s) #define New(t) (xalloc (sizeof (t))) @@ -172,7 +176,6 @@ XFree86VidModeExtensionInit(void) #ifdef XF86VIDMODE_EVENTS EventType = CreateNewResourceType(XF86VidModeFreeEvents); - ScreenPrivateIndex = AllocateScreenPrivateIndex (); #endif for(i = 0; i < screenInfo.numScreens; i++) { @@ -187,27 +190,9 @@ XFree86VidModeExtensionInit(void) if (!enabled) return; - /* - * Allocate a client private index to hold the client's version - * information. - */ - if (VidModeGeneration != serverGeneration) { - VidModeClientPrivateIndex = AllocateClientPrivateIndex(); - /* - * Allocate 0 length, and use the private to hold a pointer to our - * VidModePrivRec. - */ - if (!AllocateClientPrivate(VidModeClientPrivateIndex, 0)) { - ErrorF("XFree86VidModeExtensionInit: " - "AllocateClientPrivate failed\n"); - return; - } - VidModeGeneration = serverGeneration; - } - if ( #ifdef XF86VIDMODE_EVENTS - EventType && ScreenPrivateIndex != -1 && + EventType && #endif (extEntry = AddExtension(XF86VIDMODENAME, XF86VidModeNumberEvents, @@ -239,7 +224,7 @@ ClientMajorVersion(ClientPtr client) { VidModePrivPtr pPriv; - pPriv = VMPRIV(client); + pPriv = VM_GETPRIV(client); if (!pPriv) return 0; else @@ -1682,11 +1667,11 @@ ProcXF86VidModeSetClientVersion(ClientPtr client) REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq); - if ((pPriv = VMPRIV(client)) == NULL) { + if ((pPriv = VM_GETPRIV(client)) == NULL) { pPriv = xalloc(sizeof(VidModePrivRec)); if (!pPriv) return BadAlloc; - VMPRIV(client) = pPriv; + VM_SETPRIV(client, pPriv); } pPriv->major = stuff->major; pPriv->minor = stuff->minor; diff --git a/hw/xfree86/dixmods/extmod/xvmod.c b/hw/xfree86/dixmods/extmod/xvmod.c index 7c1450c7a..6b3f1149a 100644 --- a/hw/xfree86/dixmods/extmod/xvmod.c +++ b/hw/xfree86/dixmods/extmod/xvmod.c @@ -16,7 +16,7 @@ void XvRegister() { XvScreenInitProc = XvScreenInit; - XvGetScreenIndexProc = XvGetScreenIndex; + XvGetScreenKeyProc = XvGetScreenKey; XvGetRTPortProc = XvGetRTPort; XvMCScreenInitProc = XvMCScreenInit; } diff --git a/hw/xfree86/dixmods/extmod/xvmodproc.h b/hw/xfree86/dixmods/extmod/xvmodproc.h index 81356a149..b39c915b4 100644 --- a/hw/xfree86/dixmods/extmod/xvmodproc.h +++ b/hw/xfree86/dixmods/extmod/xvmodproc.h @@ -5,7 +5,7 @@ #include "xvmcext.h" -extern int (*XvGetScreenIndexProc)(void); +extern DevPrivateKey (*XvGetScreenKeyProc)(void); extern unsigned long (*XvGetRTPortProc)(void); extern int (*XvScreenInitProc)(ScreenPtr); extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr); diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c index 0ff867de0..a1a088629 100644 --- a/hw/xfree86/dixmods/glxmodule.c +++ b/hw/xfree86/dixmods/glxmodule.c @@ -125,6 +125,9 @@ glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) provider = LoaderSymbol("__glXDRIProvider"); if (provider) GlxPushProvider(provider); + provider = LoaderSymbol("__glXDRI2Provider"); + if (provider) + GlxPushProvider(provider); } switch (xf86Info.glxVisuals) { diff --git a/hw/xfree86/dixmods/xkbKillSrv.c b/hw/xfree86/dixmods/xkbKillSrv.c index b3399db4a..9074fd390 100644 --- a/hw/xfree86/dixmods/xkbKillSrv.c +++ b/hw/xfree86/dixmods/xkbKillSrv.c @@ -48,6 +48,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. int XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act) { - xf86ProcessActionEvent(ACTION_TERMINATE, NULL); + if (dev != inputInfo.keyboard) + xf86ProcessActionEvent(ACTION_TERMINATE, NULL); + return 0; } diff --git a/hw/xfree86/doc/devel/Registry b/hw/xfree86/doc/devel/Registry index d76622157..1fec230e8 100644 --- a/hw/xfree86/doc/devel/Registry +++ b/hw/xfree86/doc/devel/Registry @@ -75,7 +75,6 @@ rendition s3 s3virge savage -scanpci shadow shadowfb siliconmotion diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre index c950e326b..405efda55 100644 --- a/hw/xfree86/doc/man/Xorg.man.pre +++ b/hw/xfree86/doc/man/Xorg.man.pre @@ -378,13 +378,6 @@ and .B \-ggamma options. .TP 8 -.B \-scanpci -When this option is specified, the -.B __xservername__ -server scans the PCI bus, and prints out some information about each -device that was detected. See also scanpci(__appmansuffix__) -and pcitweak(__appmansuffix__). -.TP 8 .BI \-screen " screen-name" Use the __xconfigfile__(__filemansuffix__) file .B Screen diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index 3c657d0f0..9f3980879 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -493,7 +493,7 @@ extension) to connect from another host. Default: off. .TP 7 .BI "Option \*qDisableModInDev\*q \*q" boolean \*q -This disables the parts of the __xservername__\-Misc extension that can be used to +This disables the parts of the XFree86\-Misc extension that can be used to modify the input device settings dynamically. Default: that functionality is enabled. .TP 7 @@ -507,17 +507,6 @@ This allows the server to start up even if the mouse device can't be opened/initialised. Default: false. .TP 7 -.BI "Option \*qVTInit\*q \*q" command \*q -Runs -.I command -after the VT used by the server has been opened. -The command string is passed to \*q/bin/sh \-c\*q, and is run with the real -user's id with stdin and stdout set to the VT. -The purpose of this option is to allow system dependent VT initialisation -commands to be run. -This option should rarely be needed. -Default: not set. -.TP 7 .BI "Option \*qVTSysReq\*q \*q" boolean \*q enables the SYSV\-style VT switch sequence for non\-SYSV systems which support VT switching. @@ -704,6 +693,20 @@ default. .BI "Option \*qIgnoreABI\*q \*q" boolean \*q Allow modules built for a different, potentially incompatible version of the X server to load. Disabled by default. +.TP 7 +.BI "Option \*qAllowEmptyInput\*q \*q" boolean \*q +If enabled, don't add the standard keyboard and mouse drivers, if there are no +input devices in the config file. Disabled by default. +.TP 7 +.BI "Option \*qAutoAddDevices\*q \*q" boolean \*q +If this option is disabled, then no devices will be added from HAL events. +Enabled by default. +.TP 7 +.BI "Option \*qAutoEnableDevices\*q \*q" boolean \*q +If this option is disabled, then the devices will be added (and the +DevicePresenceNotify event sent), but not enabled, thus leaving policy up +to the client. +Enabled by default. .SH "MODULE SECTION" The .B Module @@ -991,10 +994,8 @@ In multi-head configurations, or when using a secondary graphics card in a single-head configuration, this entry is mandatory. Its main purpose is to make an unambiguous connection between the device section and the hardware it is representing. -This information can usually be found by running the __xservername__ server -with the -.B \-scanpci -command line option. +This information can usually be found by running the pciaccess tool +scanpci. .TP 7 .BI "Screen " number This option is mandatory for cards where a single PCI entity can drive more @@ -1418,24 +1419,24 @@ This optional entry specifies the position of the monitor within the X screen. (RandR 1.2-supporting drivers only) .TP 7 -.BI "Option " "\*qLeftOf\*q " \*qmonitor\*q +.BI "Option " "\*qLeftOf\*q " \*qoutput\*q This optional entry specifies that the monitor should be positioned to the -left of the monitor of the given name. +left of the output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 -.BI "Option " "\*qRightOf\*q " \*qmonitor\*q +.BI "Option " "\*qRightOf\*q " \*qoutput\*q This optional entry specifies that the monitor should be positioned to the -right of the monitor of the given name. +right of the output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 -.BI "Option " "\*qAbove\*q " \*qmonitor\*q +.BI "Option " "\*qAbove\*q " \*qoutput\*q This optional entry specifies that the monitor should be positioned above the -monitor of the given name. +output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 -.BI "Option " "\*qBelow\*q " \*qmonitor\*q +.BI "Option " "\*qBelow\*q " \*qoutput\*q This optional entry specifies that the monitor should be positioned below the -monitor of the given name. +output (not monitor) of the given name. (RandR 1.2-supporting drivers only) .TP 7 .BI "Option " "\*qEnable\*q " \*qbool\*q @@ -2015,7 +2016,7 @@ These both specify that the upper left corner's coordinates are The .B Absolute keyword is optional. -Some older versions of __xservername__ (4.2 and earlier) don't recognise the +Some older versions of XFree86 (4.2 and earlier) don't recognise the .B Absolute keyword, so it's safest to just specify the coordinates without it. .TP 4 @@ -2144,7 +2145,9 @@ The data therein is not used in this release. General: .BR X (__miscmansuffix__), .BR Xserver (__appmansuffix__), -.BR __xservername__ (__appmansuffix__). +.BR __xservername__ (__appmansuffix__), +.BR cvt (__appmansuffix__), +.BR gtf (__appmansuffix__). .PP .B Not all modules or interfaces are available on all platforms. .PP diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index ce75af5bb..9ec48c9b3 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -78,9 +78,9 @@ extern Bool noPanoramiXExtension; #endif static int DRIEntPrivIndex = -1; -static int DRIScreenPrivIndex = -1; -static int DRIWindowPrivIndex = -1; -static int DRIPixmapPrivIndex = -1; +static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey; +static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey; +static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKey; static unsigned long DRIGeneration = 0; static unsigned int DRIDrawableValidationStamp = 0; @@ -343,20 +343,18 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIEntPriv = DRI_ENT_PRIV(pScrn); - if (DRIGeneration != serverGeneration) { - if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; + DRIScreenPrivKey = &DRIScreenPrivKey; + if (DRIGeneration != serverGeneration) DRIGeneration = serverGeneration; - } pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec)); if (!pDRIPriv) { - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - DRIScreenPrivIndex = -1; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); + DRIScreenPrivKey = NULL; return FALSE; } - pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv); pDRIPriv->drmFD = pDRIEntPriv->drmFD; pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->pDriverInfo = pDRIInfo; @@ -381,7 +379,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) &pDRIPriv->hSAREA) < 0) { pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmAddMap failed\n"); @@ -398,7 +396,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) { pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmMap failed\n"); @@ -428,7 +426,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) &pDRIPriv->pDriverInfo->hFrameBuffer) < 0) { pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, @@ -744,8 +742,8 @@ DRICloseScreen(ScreenPtr pScreen) } xfree(pDRIPriv); - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - DRIScreenPrivIndex = -1; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); + DRIScreenPrivKey = NULL; } } @@ -772,38 +770,13 @@ drmServerInfo DRIDRMServerInfo = { Bool DRIExtensionInit(void) { - int i; - ScreenPtr pScreen; - - if (DRIScreenPrivIndex < 0 || DRIGeneration != serverGeneration) { + if (!DRIScreenPrivKey || DRIGeneration != serverGeneration) { return FALSE; } - /* Allocate a window private index with a zero sized private area for - * each window, then should a window become a DRI window, we'll hang - * a DRIWindowPrivateRec off of this private index. - */ - if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) - return FALSE; - /* Allocate a pixmap private index with a zero sized private area for - * each pixmap, then should a pixmap become a DRI pixmap, we'll hang - * a DRIPixmapPrivateRec off of this private index. - */ - if ((DRIPixmapPrivIndex = AllocatePixmapPrivateIndex()) < 0) - return FALSE; - DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete); DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete); - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0)) - return FALSE; - if (!AllocatePixmapPrivate(pScreen, DRIPixmapPrivIndex, 0)) - return FALSE; - } - RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL); return TRUE; @@ -1278,9 +1251,8 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable, pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList); /* save private off of preallocated index */ - pWin->devPrivates[DRIWindowPrivIndex].ptr = - (pointer)pDRIDrawablePriv; - + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, + pDRIDrawablePriv); pDRIPriv->nrWindows++; if (pDRIDrawablePriv->nrects) @@ -1377,7 +1349,7 @@ DRIDrawablePrivDestroy(WindowPtr pWin) drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable); xfree(pDRIDrawablePriv); - pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL; + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } static Bool diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h index f81d17c92..bf1332c4e 100644 --- a/hw/xfree86/dri/dristruct.h +++ b/hw/xfree86/dri/dristruct.h @@ -37,15 +37,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86drm.h" -#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \ - ((DRIWindowPrivIndex < 0) ? \ - NULL : \ - ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr))) - -#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \ - ((DRIPixmapPrivIndex < 0) ? \ - NULL : \ - ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIPixmapPrivIndex].ptr))) +#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey)) +#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \ + dixLookupPrivate(&(pPix)->devPrivates, DRIPixmapPrivKey)) typedef struct _DRIDrawablePrivRec { @@ -65,13 +60,12 @@ struct _DRIContextPrivRec void** pContextStore; }; -#define DRI_SCREEN_PRIV(pScreen) \ - ((DRIScreenPrivIndex < 0) ? \ - NULL : \ - ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr))) +#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey)) #define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ - (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr)) + dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \ + DRIScreenPrivKey)) #define DRI_ENT_PRIV(pScrn) \ ((DRIEntPrivIndex < 0) ? \ diff --git a/hw/xfree86/dri2/Makefile.am b/hw/xfree86/dri2/Makefile.am new file mode 100644 index 000000000..be3cea48f --- /dev/null +++ b/hw/xfree86/dri2/Makefile.am @@ -0,0 +1,15 @@ +libdri2_la_LTLIBRARIES = libdri2.la +libdri2_la_CFLAGS = \ + -DHAVE_XORG_CONFIG_H \ + -I@MESA_SOURCE@/include \ + @DIX_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/common \ + -I$(top_srcdir)/hw/xfree86/os-support/bus + +libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ +libdri2_ladir = $(moduledir)/extensions +libdri2_la_SOURCES = \ + dri2.c \ + dri2.h + +sdk_HEADERS = dri2.h diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c new file mode 100644 index 000000000..3bc533ede --- /dev/null +++ b/hw/xfree86/dri2/dri2.c @@ -0,0 +1,456 @@ +/* + * Copyright © 2007 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above copyright + * notice(s) and this permission notice appear in all copies of the Soft- + * ware and that both the above copyright notice(s) and this permission + * notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- + * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY + * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN + * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- + * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- + * MANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization of + * the copyright holder. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <xf86drm.h> +#include "xf86Module.h" +#include "scrnintstr.h" +#include "windowstr.h" +#include "dri2.h" +#include <GL/internal/dri_sarea.h> + +#include "xf86.h" + +static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKey; +static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey; +static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey; + +typedef struct _DRI2DrawablePriv { + drm_drawable_t drawable; + unsigned int handle; +} DRI2DrawablePrivRec, *DRI2DrawablePrivPtr; + +typedef struct _DRI2Screen { + int fd; + drmBO sareaBO; + void *sarea; + unsigned int sareaSize; + const char *driverName; + int ddxVersionMajor; + int ddxVersionMinor; + int ddxVersionPatch; + + __DRIEventBuffer *buffer; + int locked; + + DRI2GetPixmapHandleProcPtr getPixmapHandle; + DRI2BeginClipNotifyProcPtr beginClipNotify; + DRI2EndClipNotifyProcPtr endClipNotify; + + ClipNotifyProcPtr ClipNotify; + HandleExposuresProcPtr HandleExposures; +} DRI2ScreenRec, *DRI2ScreenPtr; + +static DRI2ScreenPtr +DRI2GetScreen(ScreenPtr pScreen) +{ + return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey); +} + +static void * +DRI2ScreenAllocEvent(DRI2ScreenPtr ds, size_t size) +{ + unsigned int *pad, mask = ds->buffer->size - 1; + size_t pad_size; + void *p; + + if ((ds->buffer->head & mask) + size > ds->buffer->size) { + /* The requested event size would wrap the buffer, so pad to + * the end and allocate the event from the start. */ + pad_size = ds->buffer->size - (ds->buffer->head & mask); + pad = (unsigned int *) + (ds->buffer->data + (ds->buffer->prealloc & mask)); + *pad = DRI2_EVENT_HEADER(DRI2_EVENT_PAD, pad_size); + ds->buffer->prealloc += pad_size; + } + + p = ds->buffer->data + (ds->buffer->prealloc & mask); + ds->buffer->prealloc += size; + + return p; +} + +static void +DRI2ScreenCommitEvents(DRI2ScreenPtr ds) +{ + ds->buffer->head = ds->buffer->prealloc; +} + +static void +DRI2PostDrawableConfig(DrawablePtr pDraw) +{ + ScreenPtr pScreen = pDraw->pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + DRI2DrawablePrivPtr pPriv; + WindowPtr pWin; + PixmapPtr pPixmap; + BoxPtr pBox; + BoxRec pixmapBox; + int nBox; + int i; + __DRIDrawableConfigEvent *e; + size_t size; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); + + nBox = REGION_NUM_RECTS(&pWin->clipList); + pBox = REGION_RECTS(&pWin->clipList); + + pPixmap = pScreen->GetWindowPixmap(pWin); + } else { + pPixmap = (PixmapPtr) pDraw; + pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey); + + pixmapBox.x1 = 0; + pixmapBox.y1 = 0; + pixmapBox.x2 = pDraw->width; + pixmapBox.y2 = pDraw->height; + nBox = 1; + pBox = &pixmapBox; + } + + if (!pPriv) + return; + + size = sizeof *e + nBox * sizeof e->rects[0]; + + e = DRI2ScreenAllocEvent(ds, size); + e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size); + e->drawable = pPriv->drawable; + e->x = pDraw->x - pPixmap->screen_x; + e->y = pDraw->y - pPixmap->screen_y; + e->width = pDraw->width; + e->height = pDraw->height; + + e->num_rects = nBox; + for (i = 0; i < nBox; i++) { + e->rects[i].x1 = pBox->x1 - pPixmap->screen_x; + e->rects[i].y1 = pBox->y1 - pPixmap->screen_y; + e->rects[i].x2 = pBox->x2 - pPixmap->screen_x; + e->rects[i].y2 = pBox->y2 - pPixmap->screen_y; + pBox++; + } +} + +static void +DRI2PostBufferAttach(DrawablePtr pDraw) +{ + ScreenPtr pScreen = pDraw->pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + DRI2DrawablePrivPtr pPriv; + WindowPtr pWin; + PixmapPtr pPixmap; + __DRIBufferAttachEvent *e; + size_t size; + unsigned int handle, flags; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + pPixmap = pScreen->GetWindowPixmap(pWin); + pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); + } else { + pPixmap = (PixmapPtr) pDraw; + pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey); + } + + if (!pPriv) + return; + + size = sizeof *e; + + handle = ds->getPixmapHandle(pPixmap, &flags); + if (handle == 0 || handle == pPriv->handle) + return; + + e = DRI2ScreenAllocEvent(ds, size); + e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size); + e->drawable = pPriv->drawable; + e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT; + e->buffer.handle = handle; + e->buffer.pitch = pPixmap->devKind; + e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8; + e->buffer.flags = flags; + + pPriv->handle = handle; +} + +static void +DRI2ClipNotify(WindowPtr pWin, int dx, int dy) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (!ds->locked) { + ds->beginClipNotify(pScreen); + ds->locked = 1; + } + + if (ds->ClipNotify) { + pScreen->ClipNotify = ds->ClipNotify; + pScreen->ClipNotify(pWin, dx, dy); + pScreen->ClipNotify = DRI2ClipNotify; + } + + DRI2PostDrawableConfig(&pWin->drawable); + DRI2PostBufferAttach(&pWin->drawable); +} + +static void +DRI2HandleExposures(WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (ds->HandleExposures) { + pScreen->HandleExposures = ds->HandleExposures; + pScreen->HandleExposures(pWin); + pScreen->HandleExposures = DRI2HandleExposures; + } + + DRI2ScreenCommitEvents(ds); + + if (ds->locked) { + ds->endClipNotify(pScreen); + ds->locked = 0; + } +} + +void +DRI2CloseScreen(ScreenPtr pScreen) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + pScreen->ClipNotify = ds->ClipNotify; + pScreen->HandleExposures = ds->HandleExposures; + + drmBOUnmap(ds->fd, &ds->sareaBO); + drmBOUnreference(ds->fd, &ds->sareaBO); + + xfree(ds); + dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL); +} + +Bool +DRI2CreateDrawable(ScreenPtr pScreen, + DrawablePtr pDraw, drm_drawable_t *pDrmDrawable) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + WindowPtr pWin; + PixmapPtr pPixmap; + DRI2DrawablePrivPtr pPriv; + DevPrivateKey key; + PrivateRec **devPrivates; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + devPrivates = &pWin->devPrivates; + key = dri2WindowPrivateKey; + } else { + pPixmap = (PixmapPtr) pDraw; + devPrivates = &pPixmap->devPrivates; + key = dri2PixmapPrivateKey; + } + + pPriv = dixLookupPrivate(devPrivates, key); + if (pPriv == NULL) { + pPriv = xalloc(sizeof *pPriv); + if (drmCreateDrawable(ds->fd, &pPriv->drawable)) + return FALSE; + + dixSetPrivate(devPrivates, key, pPriv); + } + + *pDrmDrawable = pPriv->drawable; + + DRI2PostDrawableConfig(pDraw); + DRI2PostBufferAttach(pDraw); + DRI2ScreenCommitEvents(ds); + + return TRUE; +} + +void +DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + PixmapPtr pPixmap; + WindowPtr pWin; + DRI2DrawablePrivPtr pPriv; + + if (pDraw->type == DRAWABLE_WINDOW) { + pWin = (WindowPtr) pDraw; + pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey); + dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL); + } else { + pPixmap = (PixmapPtr) pDraw; + pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey); + dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL); + } + + if (pPriv == NULL) + return; + + drmDestroyDrawable(ds->fd, pPriv->drawable); + xfree(pPriv); +} + +Bool +DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName, + int *ddxMajor, int *ddxMinor, int *ddxPatch, + unsigned int *sareaHandle) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + + if (ds == NULL) + return FALSE; + + *fd = ds->fd; + *driverName = ds->driverName; + *ddxMajor = ds->ddxVersionMajor; + *ddxMinor = ds->ddxVersionMinor; + *ddxPatch = ds->ddxVersionPatch; + *sareaHandle = ds->sareaBO.handle; + + return TRUE; +} + +unsigned int +DRI2GetPixmapHandle(PixmapPtr pPixmap, unsigned int *flags) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pPixmap->drawable.pScreen); + + return ds->getPixmapHandle(pPixmap, flags); +} + +static void * +DRI2SetupSAREA(ScreenPtr pScreen, size_t driverSareaSize) +{ + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + unsigned long mask; + const size_t event_buffer_size = 32 * 1024; + + ds->sareaSize = + sizeof(*ds->buffer) + event_buffer_size + + driverSareaSize + + sizeof (unsigned int); + + mask = DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE | + DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_SHAREABLE; + + if (drmBOCreate(ds->fd, ds->sareaSize, 1, NULL, mask, 0, &ds->sareaBO)) + return NULL; + + if (drmBOMap(ds->fd, &ds->sareaBO, + DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, &ds->sarea)) { + drmBOUnreference(ds->fd, &ds->sareaBO); + return NULL; + } + + xf86DrvMsg(pScreen->myNum, X_INFO, + "[DRI2] Allocated %d byte SAREA, BO handle 0x%08x\n", + ds->sareaSize, ds->sareaBO.handle); + memset(ds->sarea, 0, ds->sareaSize); + + ds->buffer = ds->sarea; + ds->buffer->block_header = + DRI2_SAREA_BLOCK_HEADER(DRI2_SAREA_BLOCK_EVENT_BUFFER, + sizeof *ds->buffer + event_buffer_size); + ds->buffer->size = event_buffer_size; + + return DRI2_SAREA_BLOCK_NEXT(ds->buffer); +} + +void * +DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) +{ + DRI2ScreenPtr ds; + void *p; + + ds = xalloc(sizeof *ds); + if (!ds) + return NULL; + + ds->fd = info->fd; + ds->driverName = info->driverName; + ds->ddxVersionMajor = info->ddxVersionMajor; + ds->ddxVersionMinor = info->ddxVersionMinor; + ds->ddxVersionPatch = info->ddxVersionPatch; + + ds->getPixmapHandle = info->getPixmapHandle; + ds->beginClipNotify = info->beginClipNotify; + ds->endClipNotify = info->endClipNotify; + + ds->ClipNotify = pScreen->ClipNotify; + pScreen->ClipNotify = DRI2ClipNotify; + ds->HandleExposures = pScreen->HandleExposures; + pScreen->HandleExposures = DRI2HandleExposures; + + dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds); + + p = DRI2SetupSAREA(pScreen, info->driverSareaSize); + if (p == NULL) { + xfree(ds); + return NULL; + } + + xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n"); + + return p; +} + +static pointer +DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + return (pointer) 1; +} + +static XF86ModuleVersionInfo DRI2VersRec = +{ + "dri2", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_EXTENSION, + ABI_EXTENSION_VERSION, + MOD_CLASS_NONE, + { 0, 0, 0, 0 } +}; + +_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL }; + diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h new file mode 100644 index 000000000..c687a93f6 --- /dev/null +++ b/hw/xfree86/dri2/dri2.h @@ -0,0 +1,80 @@ +/* + * Copyright © 2007 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Soft- + * ware"), to deal in the Software without restriction, including without + * limitation the rights to use, copy, modify, merge, publish, distribute, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, provided that the above copyright + * notice(s) and this permission notice appear in all copies of the Soft- + * ware and that both the above copyright notice(s) and this permission + * notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- + * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY + * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN + * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- + * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- + * MANCE OF THIS SOFTWARE. + * + * Except as contained in this notice, the name of a copyright holder shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization of + * the copyright holder. + * + * Authors: + * Kristian Høgsberg (krh@redhat.com) + */ + +#ifndef _DRI2_H_ +#define _DRI2_H_ + +typedef unsigned int (*DRI2GetPixmapHandleProcPtr)(PixmapPtr p, + unsigned int *flags); +typedef void (*DRI2BeginClipNotifyProcPtr)(ScreenPtr pScreen); +typedef void (*DRI2EndClipNotifyProcPtr)(ScreenPtr pScreen); + +typedef struct { + unsigned int version; /* Version of this struct */ + int fd; + size_t driverSareaSize; + const char *driverName; + int ddxVersionMajor, ddxVersionMinor, ddxVersionPatch; + DRI2GetPixmapHandleProcPtr getPixmapHandle; + DRI2BeginClipNotifyProcPtr beginClipNotify; + DRI2EndClipNotifyProcPtr endClipNotify; +} DRI2InfoRec, *DRI2InfoPtr; + +void *DRI2ScreenInit(ScreenPtr pScreen, + DRI2InfoPtr info); + +void DRI2CloseScreen(ScreenPtr pScreen); + +Bool DRI2Connect(ScreenPtr pScreen, + int *fd, + const char **driverName, + int *ddxMajor, + int *ddxMinor, + int *ddxPatch, + unsigned int *sareaHandle); + +unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap, + unsigned int *flags); + +void DRI2Lock(ScreenPtr pScreen); +void DRI2Unlock(ScreenPtr pScreen); + +Bool DRI2CreateDrawable(ScreenPtr pScreen, + DrawablePtr pDraw, + drm_drawable_t *pDrmDrawable); + +void DRI2DestroyDrawable(ScreenPtr pScreen, + DrawablePtr pDraw); + +void DRI2ExtensionInit(void); + +#endif diff --git a/hw/xfree86/dummylib/Makefile.am b/hw/xfree86/dummylib/Makefile.am index 3e70d25fe..85a1d03dd 100644 --- a/hw/xfree86/dummylib/Makefile.am +++ b/hw/xfree86/dummylib/Makefile.am @@ -1,6 +1,6 @@ # libdummy.a contains just those bits used in the server itself # libdummy-nonserver.a contains additional routines normally found in the -# server for use in building the utilities like scanpci & the config tools +# server for use in building the utilities like config tools noinst_LIBRARIES = libdummy-nonserver.a @@ -13,6 +13,7 @@ STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c endif libdummy_nonserver_a_SOURCES = \ + dixprivates.c \ fatalerror.c \ logvwrite.c \ $(STRL_SRCS) \ @@ -24,7 +25,6 @@ libdummy_nonserver_a_SOURCES = \ xf86drvmsgverb.c \ xf86errorf.c \ xf86errorfverb.c \ - xf86getpagesize.c \ xf86getverb.c \ xf86info.c \ xf86msg.c \ diff --git a/hw/xfree86/dummylib/xf86getpagesize.c b/hw/xfree86/dummylib/dixprivates.c index 8859c7673..40c173a20 100644 --- a/hw/xfree86/dummylib/xf86getpagesize.c +++ b/hw/xfree86/dummylib/dixprivates.c @@ -11,11 +11,9 @@ * Utility functions required by libxf86_os. */ -int xf86getpagesize(void); - -_X_EXPORT int -xf86getpagesize(void) +_X_EXPORT pointer * +dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key) { - return 4096; /* not used */ + return NULL; /* not used */ } diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c index ceead8219..086639cc5 100644 --- a/hw/xfree86/exa/examodule.c +++ b/hw/xfree86/exa/examodule.c @@ -42,8 +42,7 @@ typedef struct _ExaXorgScreenPrivRec { OptionInfoPtr options; } ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr; -static int exaXorgServerGeneration; -static int exaXorgScreenPrivateIndex; +static DevPrivateKey exaXorgScreenPrivateKey = &exaXorgScreenPrivateKey; typedef enum { EXAOPT_MIGRATION_HEURISTIC, @@ -72,8 +71,8 @@ static Bool exaXorgCloseScreen (int i, ScreenPtr pScreen) { ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); - ExaXorgScreenPrivPtr pScreenPriv = - pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr; + ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); pScreen->CloseScreen = pScreenPriv->SavedCloseScreen; @@ -89,8 +88,8 @@ static void exaXorgEnableDisableFBAccess (int index, Bool enable) { ScreenPtr pScreen = screenInfo.screens[index]; - ExaXorgScreenPrivPtr pScreenPriv = - pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr; + ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey); if (!enable) exaEnableDisableFBAccess (index, enable); @@ -114,11 +113,6 @@ exaDDXDriverInit(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ExaXorgScreenPrivPtr pScreenPriv; - if (exaXorgServerGeneration != serverGeneration) { - exaXorgScreenPrivateIndex = AllocateScreenPrivateIndex(); - exaXorgServerGeneration = serverGeneration; - } - pScreenPriv = xcalloc (1, sizeof(ExaXorgScreenPrivRec)); if (pScreenPriv == NULL) return; @@ -174,7 +168,7 @@ exaDDXDriverInit(ScreenPtr pScreen) pExaScr->info->DownloadFromScreen = NULL; } - pScreen->devPrivates[exaXorgScreenPrivateIndex].ptr = pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey, pScreenPriv); pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess; pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess; @@ -184,8 +178,6 @@ exaDDXDriverInit(ScreenPtr pScreen) } -static MODULESETUPPROTO(exaSetup); - /*ARGSUSED*/ static const OptionInfoRec * EXAAvailableOptions(void *unused) @@ -207,26 +199,4 @@ static XF86ModuleVersionInfo exaVersRec = {0,0,0,0} }; -_X_EXPORT XF86ModuleData exaModuleData = { &exaVersRec, exaSetup, NULL }; - -static ModuleInfoRec EXA = { - 1, - "EXA", - NULL, - 0, - EXAAvailableOptions, -}; - -/*ARGSUSED*/ -static pointer -exaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) -{ - static Bool Initialised = FALSE; - - if (!Initialised) { - Initialised = TRUE; - xf86AddModuleInfo(&EXA, Module); - } - - return (pointer)TRUE; -} +_X_EXPORT XF86ModuleData exaModuleData = { &exaVersRec, NULL, NULL }; diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index 5d06b05c7..49c7d271b 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -63,7 +63,9 @@ #include "globals.h" #include "os.h" #include "osdep.h" +#include "privates.h" #include "resource.h" +#include "registry.h" #include "servermd.h" #include "scrnintstr.h" #include "windowstr.h" @@ -113,6 +115,16 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(QueryColors) /* cursor.c */ SYMFUNC(FreeCursor) + /* deprecated.c */ + SYMFUNC(LookupClient) + SYMFUNC(LookupDrawable) + SYMFUNC(LookupWindow) + SYMFUNC(SecurityLookupDrawable) + SYMFUNC(SecurityLookupWindow) + SYMFUNC(LookupIDByType) + SYMFUNC(LookupIDByClass) + SYMFUNC(SecurityLookupIDByClass) + SYMFUNC(SecurityLookupIDByType) /* devices.c */ SYMFUNC(Ones) SYMFUNC(InitButtonClassDeviceStruct) @@ -128,8 +140,6 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(InitKeyboardDeviceStruct) SYMFUNC(SendMappingNotify) SYMFUNC(InitPointerDeviceStruct) - SYMFUNC(LookupKeyboardDevice) - SYMFUNC(LookupPointerDevice) /* dispatch.c */ SYMFUNC(SetInputCheck) SYMFUNC(SendErrorToClient) @@ -159,13 +169,6 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(dixLookupWindow) SYMFUNC(dixLookupClient) SYMFUNC(dixLookupGC) - /* following are deprecated */ - SYMFUNC(LookupClient) - SYMFUNC(LookupDrawable) - SYMFUNC(LookupWindow) - SYMFUNC(SecurityLookupDrawable) - SYMFUNC(SecurityLookupWindow) - /* end deprecated */ SYMFUNC(NoopDDA) SYMFUNC(QueueWorkProc) SYMFUNC(RegisterBlockAndWakeupHandlers) @@ -191,11 +194,11 @@ _X_HIDDEN void *dixLookupTab[] = { #endif /* property.c */ SYMFUNC(ChangeWindowProperty) + SYMFUNC(dixChangeWindowProperty) /* extension.c */ SYMFUNC(AddExtension) SYMFUNC(AddExtensionAlias) SYMFUNC(CheckExtension) - SYMFUNC(DeclareExtensionSecurity) SYMFUNC(MinorOpcodeOfRequest) SYMFUNC(StandardMinorOpcode) #ifdef XEVIE @@ -234,7 +237,7 @@ _X_HIDDEN void *dixLookupTab[] = { #ifdef XV /* XXX These are exported from the DDX, not DIX. */ SYMVAR(XvScreenInitProc) - SYMVAR(XvGetScreenIndexProc) + SYMVAR(XvGetScreenKeyProc) SYMVAR(XvGetRTPortProc) SYMVAR(XvMCScreenInitProc) #endif @@ -259,42 +262,38 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(GetScratchPixmapHeader) SYMFUNC(FreeScratchPixmapHeader) /* privates.c */ - SYMFUNC(AllocateExtensionPrivate) - SYMFUNC(AllocateExtensionPrivateIndex) - SYMFUNC(AllocateClientPrivate) - SYMFUNC(AllocateClientPrivateIndex) - SYMFUNC(AllocateGCPrivate) - SYMFUNC(AllocateGCPrivateIndex) - SYMFUNC(AllocateWindowPrivate) - SYMFUNC(AllocateWindowPrivateIndex) - SYMFUNC(AllocateScreenPrivateIndex) - SYMFUNC(AllocateColormapPrivateIndex) - SYMFUNC(AllocateDevicePrivateIndex) - SYMFUNC(AllocateDevicePrivate) - SYMFUNC(AllocatePixmapPrivateIndex) - SYMFUNC(AllocatePixmapPrivate) + SYMFUNC(dixRequestPrivate) + SYMFUNC(dixRegisterPrivateInitFunc) + SYMFUNC(dixRegisterPrivateDeleteFunc) + SYMFUNC(dixAllocatePrivate) + SYMFUNC(dixFreePrivates) + SYMFUNC(dixRegisterPrivateOffset) + SYMFUNC(dixLookupPrivateOffset) /* resource.c */ SYMFUNC(AddResource) SYMFUNC(ChangeResourceValue) SYMFUNC(CreateNewResourceClass) SYMFUNC(CreateNewResourceType) + SYMFUNC(dixLookupResource) SYMFUNC(FakeClientID) SYMFUNC(FreeResource) SYMFUNC(FreeResourceByType) SYMFUNC(GetXIDList) SYMFUNC(GetXIDRange) - SYMFUNC(LookupIDByType) - SYMFUNC(LookupIDByClass) SYMFUNC(LegalNewID) - SYMFUNC(SecurityLookupIDByClass) - SYMFUNC(SecurityLookupIDByType) SYMFUNC(FindClientResourcesByType) SYMFUNC(FindAllClientResources) SYMVAR(lastResourceType) SYMVAR(TypeMask) -#ifdef RES + SYMVAR(ResourceStateCallback) + /* registry.c */ +#ifdef XREGISTRY SYMFUNC(RegisterResourceName) - SYMVAR(ResourceNames) + SYMFUNC(LookupMajorName) + SYMFUNC(LookupRequestName) + SYMFUNC(LookupEventName) + SYMFUNC(LookupErrorName) + SYMFUNC(LookupResourceName) #endif /* swaprep.c */ SYMFUNC(CopySwap32Write) @@ -322,6 +321,7 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(NotClippedByChildren) SYMFUNC(ResizeChildrenWinSize) SYMFUNC(SaveScreens) + SYMFUNC(dixSaveScreens) SYMFUNC(SendVisibilityNotify) SYMFUNC(SetWinSize) SYMFUNC(SetBorderSize) @@ -512,7 +512,7 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(PictureTransformPoint3d) SYMFUNC(PictureGetSubpixelOrder) SYMFUNC(PictureSetSubpixelOrder) - SYMVAR(PictureScreenPrivateIndex) + SYMVAR(PictureScreenPrivateKey) /* mipict.c */ SYMFUNC(miPictureInit) SYMFUNC(miComputeCompositeRegion) diff --git a/hw/xfree86/loader/dlloader.c b/hw/xfree86/loader/dlloader.c index 2afdef789..4caefd071 100644 --- a/hw/xfree86/loader/dlloader.c +++ b/hw/xfree86/loader/dlloader.c @@ -71,15 +71,9 @@ #define DLSYM_PREFIX "" #endif -typedef struct { - int handle; - void *dlhandle; - int flags; -} DLModuleRec, *DLModulePtr; - /* Hooray, yet another open coded linked list! FIXME */ typedef struct DLModuleList { - DLModulePtr module; + void *module; struct DLModuleList *next; } DLModuleList; @@ -88,19 +82,22 @@ static DLModuleList *dlModuleList = NULL; static void * DLFindSymbolLocal(pointer module, const char *name) { - DLModulePtr dlfile = module; void *p; char *n; static const char symPrefix[] = DLSYM_PREFIX; - n = malloc(strlen(symPrefix) + strlen(name) + 1); - if (strlen(symPrefix)) + if (strlen(symPrefix)) { + n = malloc(strlen(symPrefix) + strlen(name) + 1); sprintf(n, "%s%s", symPrefix, name); - else - sprintf(n, "%s", name); - p = dlsym(dlfile->dlhandle, n); - free(n); + } else { + n = name; + } + + p = dlsym(module, n); + + if (strlen(symPrefix)) + free(n); return p; } @@ -127,7 +124,7 @@ DLFindSymbol(const char *name) global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL); if (global_scope) - return dlsym(global_scope, name); + return DLFindSymbolLocal(global_scope, name); return NULL; } @@ -135,23 +132,17 @@ DLFindSymbol(const char *name) void * DLLoadModule(loaderPtr modrec, int flags) { - DLModulePtr dlfile; + void * dlfile; DLModuleList *l; int dlopen_flags; - if ((dlfile = calloc(1, sizeof(DLModuleRec))) == NULL) { - ErrorF("Unable to allocate DLModuleRec\n"); - return NULL; - } - dlfile->handle = modrec->handle; if (flags & LD_FLAG_GLOBAL) dlopen_flags = DLOPEN_LAZY | DLOPEN_GLOBAL; else dlopen_flags = DLOPEN_LAZY; - dlfile->dlhandle = dlopen(modrec->name, dlopen_flags); - if (dlfile->dlhandle == NULL) { + dlfile = dlopen(modrec->name, dlopen_flags); + if (dlfile == NULL) { ErrorF("dlopen: %s\n", dlerror()); - free(dlfile); return NULL; } @@ -166,7 +157,6 @@ DLLoadModule(loaderPtr modrec, int flags) void DLUnloadModule(void *modptr) { - DLModulePtr dlfile = (DLModulePtr) modptr; DLModuleList *l, *p; /* remove it from dlModuleList. */ @@ -185,6 +175,5 @@ DLUnloadModule(void *modptr) p = l; } } - dlclose(dlfile->dlhandle); - free(modptr); + dlclose(modptr); } diff --git a/hw/xfree86/loader/extsym.c b/hw/xfree86/loader/extsym.c index e09e9c084..1bdff9482 100644 --- a/hw/xfree86/loader/extsym.c +++ b/hw/xfree86/loader/extsym.c @@ -44,7 +44,6 @@ extern RESTYPE ShmSegType, ShmPixType; extern Bool noPanoramiXExtension; extern int PanoramiXNumScreens; extern PanoramiXData *panoramiXdataPtr; -extern XID *PanoramiXVisualTable; extern unsigned long XRT_WINDOW; extern unsigned long XRT_PIXMAP; extern unsigned long XRT_GC; @@ -69,7 +68,6 @@ _X_HIDDEN void *extLookupTab[] = { SYMFUNC(XineramaDeleteResource) SYMVAR(PanoramiXNumScreens) SYMVAR(panoramiXdataPtr) - SYMVAR(PanoramiXVisualTable) SYMVAR(XRT_WINDOW) SYMVAR(XRT_PIXMAP) SYMVAR(XRT_GC) diff --git a/hw/xfree86/loader/loaderProcs.h b/hw/xfree86/loader/loaderProcs.h index b71ad4590..9c73db3a6 100644 --- a/hw/xfree86/loader/loaderProcs.h +++ b/hw/xfree86/loader/loaderProcs.h @@ -62,17 +62,11 @@ typedef struct module_desc { struct module_desc *child; struct module_desc *sib; struct module_desc *parent; - struct module_desc *demand_next; char *name; - char *filename; - char *identifier; - XID client_id; - int in_use; int handle; ModuleSetupProc SetupProc; ModuleTearDownProc TearDownProc; void *TearDownData; /* returned from SetupProc */ - const char *path; const XF86ModuleVersionInfo *VersionInfo; } ModuleDesc, *ModuleDescPtr; diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 1b5c717fd..7f3bbe49c 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -177,6 +177,7 @@ InitPathList(const char *path) } if (list) list[n] = NULL; + xfree(fullpath); return list; } @@ -786,12 +787,7 @@ NewModuleDesc(const char *name) mdp->child = NULL; mdp->sib = NULL; mdp->parent = NULL; - mdp->demand_next = NULL; mdp->name = xstrdup(name); - mdp->filename = NULL; - mdp->identifier = NULL; - mdp->client_id = 0; - mdp->in_use = 0; mdp->handle = -1; mdp->SetupProc = NULL; mdp->TearDownProc = NULL; @@ -816,15 +812,10 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent) if (LoaderHandleOpen(mod->handle) == -1) return NULL; - ret->filename = xstrdup(mod->filename); - ret->identifier = mod->identifier; - ret->client_id = mod->client_id; - ret->in_use = mod->in_use; ret->handle = mod->handle; ret->SetupProc = mod->SetupProc; ret->TearDownProc = mod->TearDownProc; ret->TearDownData = NULL; - ret->path = mod->path; ret->child = DuplicateModule(mod->child, ret); ret->sib = DuplicateModule(mod->sib, parent); ret->parent = parent; @@ -859,12 +850,12 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, char *m = NULL; const char **cim; - xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"", module); + xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"\n", module); for (cim = compiled_in_modules; *cim; cim++) if (!strcmp (module, *cim)) { - xf86MsgVerb(X_INFO, 0, "Module \"%s\" already built-in\n", module); + xf86MsgVerb(X_INFO, 3, "Module \"%s\" already built-in\n", module); return (ModuleDescPtr) 1; } @@ -943,8 +934,6 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, if (ret->handle < 0) goto LoadModule_fail; - ret->filename = xstrdup(found); - /* drop any explicit suffix from the module name */ p = strchr(name, '.'); if (p) @@ -998,7 +987,6 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, ret->SetupProc = setup; if (teardown) ret->TearDownProc = teardown; - ret->path = path; ret->VersionInfo = vers; } else { /* No initdata is OK for external modules */ @@ -1120,7 +1108,6 @@ UnloadModuleOrDriver(ModuleDescPtr mod) if (mod->sib) UnloadModuleOrDriver(mod->sib); TestFree(mod->name); - TestFree(mod->filename); xfree(mod); #ifdef __alpha__ istream_mem_barrier(); @@ -1145,7 +1132,6 @@ UnloadSubModule(ModuleDescPtr mod) UnloadModuleOrDriver(mod->child); TestFree(mod->name); - TestFree(mod->filename); xfree(mod); } @@ -1156,12 +1142,6 @@ FreeModuleDesc(ModuleDescPtr head) if (head == (ModuleDescPtr) 1) return; - /* - * only free it if it's not marked as in use. In use means that it may - * be unloaded someday, and UnloadModule will free it - */ - if (head->in_use) - return; if (head->child) FreeModuleDesc(head->child); sibs = head; diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c index 025983b09..aa712c03a 100644 --- a/hw/xfree86/loader/misym.c +++ b/hw/xfree86/loader/misym.c @@ -200,9 +200,9 @@ _X_HIDDEN void *miLookupTab[] = { SYMFUNC(miOverlaySetRootClip) SYMVAR(miEmptyBox) SYMVAR(miEmptyData) - SYMVAR(miZeroLineScreenIndex) + SYMVAR(miZeroLineScreenKey) SYMVAR(miSpritePointerFuncs) - SYMVAR(miPointerScreenIndex) + SYMVAR(miPointerScreenKey) SYMVAR(miInstalledMaps) SYMVAR(miInitVisualsProc) #ifdef DAMAGE diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 050b873fb..754e9c06b 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -479,8 +479,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86IsScreenPrimary) SYMFUNC(xf86RegisterRootWindowProperty) SYMFUNC(xf86IsUnblank) - SYMFUNC(xf86AddModuleInfo) - SYMFUNC(xf86DeleteModuleInfo) #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) /* xf86sbusBus.c */ @@ -906,8 +904,8 @@ _X_HIDDEN void *xfree86LookupTab[] = { #endif /* General variables (from xf86.h) */ - SYMVAR(xf86ScreenIndex) - SYMVAR(xf86PixmapIndex) + SYMVAR(xf86ScreenKey) + SYMVAR(xf86PixmapKey) SYMVAR(xf86Screens) SYMVAR(byte_reversed) SYMVAR(xf86inSuspend) diff --git a/hw/xfree86/modes/Makefile.am b/hw/xfree86/modes/Makefile.am index 1f82068b3..6ee85757a 100644 --- a/hw/xfree86/modes/Makefile.am +++ b/hw/xfree86/modes/Makefile.am @@ -16,7 +16,7 @@ libxf86modes_a_SOURCES = \ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \ - -I$(srcdir)/../scanpci -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ + -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \ -I$(srcdir)/../dixmods/extmod diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index fc80f5202..266e08195 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -236,6 +236,9 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int saved_x, saved_y; Rotation saved_rotation; + if (crtc->funcs->set_mode_major) + return crtc->funcs->set_mode_major(crtc, mode, rotation, x, y); + crtc->enabled = xf86CrtcInUse (crtc); if (!crtc->enabled) @@ -1362,8 +1365,8 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) if (sync_source == sync_default) sync_source = sync_edid; } - if (ranges->max_clock > max_clock) - max_clock = ranges->max_clock; + if (ranges->max_clock * 1000 > max_clock) + max_clock = ranges->max_clock * 1000; } } } @@ -1410,9 +1413,12 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) /* * Check default modes against monitor max clock */ - if (max_clock) + if (max_clock) { xf86ValidateModesClocks(scrn, default_modes, &min_clock, &max_clock, 1); + xf86ValidateModesClocks(scrn, output_modes, + &min_clock, &max_clock, 1); + } output->probed_modes = NULL; output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes); @@ -2186,14 +2192,18 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus) xf86MonPtr mon; mon = xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus); - xf86DDCApplyQuirks (scrn->scrnIndex, pDDCBus); + if (mon) + xf86DDCApplyQuirks (scrn->scrnIndex, mon); return mon; } -static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D", - "DVI-A", "Composite", "S-Video", - "Component", "LFP", "Proprietary" }; +static char *_xf86ConnectorNames[] = { + "None", "VGA", "DVI-I", "DVI-D", + "DVI-A", "Composite", "S-Video", + "Component", "LFP", "Proprietary", + "HDMI", "DisplayPort", + }; _X_EXPORT char * xf86ConnectorGetName(xf86ConnectorType connector) { diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index f312b30cb..cc045b229 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -61,7 +61,9 @@ typedef enum _xf86ConnectorType { XF86ConnectorSvideo, XF86ConnectorComponent, XF86ConnectorLFP, - XF86ConnectorProprietary + XF86ConnectorProprietary, + XF86ConnectorHDMI, + XF86ConnectorDisplayPort, } xf86ConnectorType; typedef enum _xf86OutputStatus { @@ -204,6 +206,13 @@ typedef struct _xf86CrtcFuncs { */ void (*destroy) (xf86CrtcPtr crtc); + + /** + * Less fine-grained mode setting entry point for kernel modesetting + */ + Bool + (*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode, + Rotation rotation, int x, int y); } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; struct _xf86Crtc { diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index b5101642b..5a4d0f6fa 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -226,7 +226,8 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); CursorPtr cursor = xf86_config->cursor; int c; - CARD8 *bits = cursor ? cursor->devPriv[screen->myNum] : NULL; + CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates, + screen) : NULL; /* Save ARGB versions of these colors */ xf86_config->cursor_fg = (CARD32) fg | 0xff000000; @@ -399,7 +400,7 @@ xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src) int flags = cursor_info->Flags; cursor_image = xf86_config->cursor_image; - memset(cursor_image, 0, cursor_info->MaxWidth * stride); + memset(cursor_image, 0, cursor_info->MaxHeight * stride); for (y = 0; y < cursor_info->MaxHeight; y++) for (x = 0; x < cursor_info->MaxWidth; x++) @@ -612,7 +613,7 @@ xf86_reload_cursors (ScreenPtr screen) else #endif (*cursor_info->LoadCursorImage)(cursor_info->pScrn, - cursor->devPriv[screen->myNum]); + dixLookupPrivate(&cursor->devPrivates, screen)); (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y); (*cursor_info->ShowCursor)(cursor_info->pScrn); diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c index 777ef7e44..b865727ef 100644 --- a/hw/xfree86/modes/xf86EdidModes.c +++ b/hw/xfree86/modes/xf86EdidModes.c @@ -66,6 +66,8 @@ typedef enum { DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5, /* Monitor forgot to set the first detailed is preferred bit. */ DDC_QUIRK_FIRST_DETAILED_PREFERRED = 1 << 6, + /* use +hsync +vsync for detailed mode */ + DDC_QUIRK_DETAILED_SYNC_PP = 1 << 7, } ddc_quirk_t; static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC) @@ -160,6 +162,15 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC) return FALSE; } +static Bool quirk_detailed_sync_pp(int scrnIndex, xf86MonPtr DDC) +{ + /* Bug #12439: Samsung SyncMaster 205BW */ + if (memcmp (DDC->vendor.name, "SAM", 4) == 0 && + DDC->vendor.prod_id == 541) + return TRUE; + return FALSE; +} + typedef struct { Bool (*detect) (int scrnIndex, xf86MonPtr DDC); ddc_quirk_t quirk; @@ -195,6 +206,10 @@ static const ddc_quirk_map_t ddc_quirks[] = { quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED, "First detailed timing was not marked as preferred." }, + { + quirk_detailed_sync_pp, DDC_QUIRK_DETAILED_SYNC_PP, + "Use +hsync +vsync for detailed timing." + }, { NULL, DDC_QUIRK_NONE, "No known quirks" @@ -328,6 +343,12 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width; Mode->VTotal = timing->v_active + timing->v_blanking; + /* perform basic check on the detail timing */ + if (Mode->HSyncEnd > Mode->HTotal || Mode->VSyncEnd > Mode->VTotal) { + xfree(Mode); + return NULL; + } + xf86SetModeDefaultName(Mode); /* We ignore h/v_size and h/v_border for now. */ @@ -335,19 +356,53 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing, if (timing->interlaced) Mode->Flags |= V_INTERLACE; - if (timing->misc & 0x02) - Mode->Flags |= V_PVSYNC; - else - Mode->Flags |= V_NVSYNC; - - if (timing->misc & 0x01) - Mode->Flags |= V_PHSYNC; - else - Mode->Flags |= V_NHSYNC; + if (quirks & DDC_QUIRK_DETAILED_SYNC_PP) + Mode->Flags |= V_PVSYNC | V_PHSYNC; + else { + if (timing->misc & 0x02) + Mode->Flags |= V_PVSYNC; + else + Mode->Flags |= V_NVSYNC; + + if (timing->misc & 0x01) + Mode->Flags |= V_PHSYNC; + else + Mode->Flags |= V_NHSYNC; + } return Mode; } +static DisplayModePtr +DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) +{ + DisplayModePtr modes = NULL; + int i; + + for (i = 0; i < 4; i++) { + if (t[i].height) { + if (t[i].rates & 0x10) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 50, 0, 0)); + if (t[i].rates & 0x08) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 60, 0, 0)); + if (t[i].rates & 0x04) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 75, 0, 0)); + if (t[i].rates & 0x02) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 85, 0, 0)); + if (t[i].rates & 0x01) + modes = xf86ModesAdd(modes, + xf86CVTMode(t[i].width, t[i].height, 60, 1, 0)); + } else break; + } + + return modes; +} + + /* * */ @@ -498,6 +553,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) quirks = xf86DDCDetectQuirks(scrnIndex, DDC, TRUE); preferred = PREFERRED_TIMING_MODE(DDC->features.msc); + if (DDC->ver.revision >= 4) + preferred = TRUE; if (quirks & DDC_QUIRK_FIRST_DETAILED_PREFERRED) preferred = TRUE; if (quirks & (DDC_QUIRK_PREFER_LARGE_60 | DDC_QUIRK_PREFER_LARGE_75)) @@ -521,6 +578,10 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC) quirks); Modes = xf86ModesAdd(Modes, Mode); break; + case DS_CVT: + Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt); + Modes = xf86ModesAdd(Modes, Mode); + break; default: break; } diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 3879b9103..3d222cc73 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -38,12 +38,14 @@ extern XF86ConfigPtr xf86configptr; -/** - * @file this file contains symbols from xf86Mode.c and friends that are static - * there but we still want to use. We need to come up with better API here. +/* + * This is the version number where we epoched. These files get copied + * into drivers that want to use this setup infrastructure on pre-1.3 + * servers, so when that happens they need to define these symbols + * themselves. However, _in_ the server, we basically always define them now. */ - #if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0) + /** * Calculates the horizontal sync rate of a mode. * @@ -116,6 +118,24 @@ xf86ModeHeight (DisplayModePtr mode, Rotation rotation) } } +/** Calculates the memory bandwidth (in MiB/sec) of a mode. */ +_X_EXPORT unsigned int +xf86ModeBandwidth(DisplayModePtr mode, int depth) +{ + float a_active, a_total, active_percent, pixels_per_second; + int bytes_per_pixel = (depth + 7) / 8; + + if (!mode->HTotal || !mode->VTotal || !mode->Clock) + return 0; + + a_active = mode->HDisplay * mode->VDisplay; + a_total = mode->HTotal * mode->VTotal; + active_percent = a_active / a_total; + pixels_per_second = active_percent * mode->Clock * 1000.0; + + return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024)); +} + /** Sets a default mode name of <width>x<height> on a mode. */ _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode) @@ -319,12 +339,10 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode) /** * Marks as bad any modes with unsupported flags. * - * \param modeList doubly-linked or circular list of modes. + * \param modeList doubly-linked list of modes. * \param flags flags supported by the driver. * * \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough? - * - * This is not in xf86Modes.c, but would be part of the proposed new API. */ _X_EXPORT void xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, @@ -343,9 +361,7 @@ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, /** * Marks as bad any modes extending beyond the given max X, Y, or pitch. * - * \param modeList doubly-linked or circular list of modes. - * - * This is not in xf86Modes.c, but would be part of the proposed new API. + * \param modeList doubly-linked list of modes. */ _X_EXPORT void xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, @@ -372,9 +388,7 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, * Marks as bad any modes that aren't supported by the given monitor's * hsync and vrefresh ranges. * - * \param modeList doubly-linked or circular list of modes. - * - * This is not in xf86Modes.c, but would be part of the proposed new API. + * \param modeList doubly-linked list of modes. */ _X_EXPORT void xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, @@ -416,12 +430,10 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, /** * Marks as bad any modes extending beyond outside of the given clock ranges. * - * \param modeList doubly-linked or circular list of modes. + * \param modeList doubly-linked list of modes. * \param min pointer to minimums of clock ranges * \param max pointer to maximums of clock ranges * \param n_ranges number of ranges. - * - * This is not in xf86Modes.c, but would be part of the proposed new API. */ _X_EXPORT void xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList, @@ -454,9 +466,7 @@ xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList, * * MODE_BAD is used as the rejection flag, for lack of a better flag. * - * \param modeList doubly-linked or circular list of modes. - * - * This is not in xf86Modes.c, but would be part of the proposed new API. + * \param modeList doubly-linked list of modes. */ _X_EXPORT void xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList) @@ -484,13 +494,30 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList) /** + * Marks as bad any modes exceeding the given bandwidth. + * + * \param modeList doubly-linked list of modes. + * \param bandwidth bandwidth in MHz. + * \param depth color depth. + */ +_X_EXPORT void +xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, + unsigned int bandwidth, int depth) +{ + DisplayModePtr mode; + + for (mode = modeList; mode != NULL; mode = mode->next) { + if (xf86ModeBandwidth(mode, depth) > bandwidth) + mode->status = MODE_BANDWIDTH; + } +} + +/** * Frees any modes from the list with a status other than MODE_OK. * * \param modeList pointer to a doubly-linked or circular list of modes. * \param verbose determines whether the reason for mode invalidation is * printed. - * - * This is not in xf86Modes.c, but would be part of the proposed new API. */ _X_EXPORT void xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList, diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h index 3722d25a0..9ad5ee653 100644 --- a/hw/xfree86/modes/xf86Modes.h +++ b/hw/xfree86/modes/xf86Modes.h @@ -42,6 +42,7 @@ double xf86ModeHSync(DisplayModePtr mode); double xf86ModeVRefresh(DisplayModePtr mode); +unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth); int xf86ModeWidth (DisplayModePtr mode, Rotation rotation); @@ -79,6 +80,10 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon); void +xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList, + unsigned int bandwidth, int depth); + +void xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList, Bool verbose); diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index bb7f94581..e2668fbbc 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -59,11 +59,11 @@ static Bool xf86RandR12Init12 (ScreenPtr pScreen); static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen); #endif -static int xf86RandR12Index = -1; -static int xf86RandR12Generation; +static int xf86RandR12Generation; +static DevPrivateKey xf86RandR12Key; -#define XF86RANDRINFO(p) \ - ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr) +#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \ + dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key)) static int xf86RandR12ModeRefresh (DisplayModePtr mode) @@ -340,7 +340,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen, PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen); Bool ret = FALSE; - if (xf86RandR12Index != -1) { + if (xf86RandR12Key) { if (randrp->virtualX == -1 || randrp->virtualY == -1) { randrp->virtualX = pScrn->virtualX; @@ -368,7 +368,7 @@ finish: if (pRoot && pScrn->vtSema) (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE); #if RANDR_12_INTERFACE - if ((xf86RandR12Index != -1) && WindowTable[pScreen->myNum] && ret) + if (xf86RandR12Key && WindowTable[pScreen->myNum] && ret) RRScreenSizeNotify (pScreen); #endif return ret; @@ -468,7 +468,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) mmHeight); } - if (xf86RandR12Index == -1) + if (xf86RandR12Key == NULL) return TRUE; if (randrp->virtualX == -1 || randrp->virtualY == -1) @@ -496,11 +496,11 @@ xf86RandR12Init (ScreenPtr pScreen) if (!noPanoramiXExtension) return TRUE; #endif + if (xf86RandR12Generation != serverGeneration) - { - xf86RandR12Index = AllocateScreenPrivateIndex(); xf86RandR12Generation = serverGeneration; - } + + xf86RandR12Key = &xf86RandR12Key; randrp = xalloc (sizeof (XF86RandRInfoRec)); if (!randrp) @@ -526,7 +526,7 @@ xf86RandR12Init (ScreenPtr pScreen) randrp->maxX = randrp->maxY = 0; - pScreen->devPrivates[xf86RandR12Index].ptr = randrp; + dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp); #if RANDR_12_INTERFACE if (!xf86RandR12Init12 (pScreen)) @@ -545,7 +545,7 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); #endif - if (xf86RandR12Index == -1) + if (xf86RandR12Key == NULL) return; randrp = XF86RANDRINFO(pScreen); @@ -1076,7 +1076,7 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); - if (xf86RandR12Index == -1) + if (xf86RandR12Key == NULL) return TRUE; for (c = 0; c < config->num_crtc; c++) @@ -1099,7 +1099,7 @@ xf86RandR12TellChanged (ScreenPtr pScreen) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; - if (xf86RandR12Index == -1) + if (xf86RandR12Key == NULL) return; xf86RandR12SetInfo12 (pScreen); diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 380478f7f..e2d6295b9 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -494,7 +494,8 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) { ScrnInfoPtr pScrn = crtc->scrn; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; + /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; PictTransform crtc_to_fb, fb_to_crtc; PictureTransformIdentity (&crtc_to_fb); @@ -579,9 +580,9 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation) } else { - PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, crtc->x, crtc->y); + PictureTransformTranslate (&crtc_to_fb, &fb_to_crtc, F(crtc->x), F(crtc->y)); PictureTransformIsInverse ("offset", &crtc_to_fb, &fb_to_crtc); - + /* * these are the size of the shadow pixmap, which * matches the mode, not the pre-rotated copy in the diff --git a/hw/xfree86/os-support/bsd/alpha_video.c b/hw/xfree86/os-support/bsd/alpha_video.c index a1b19d0f6..523c4488e 100644 --- a/hw/xfree86/os-support/bsd/alpha_video.c +++ b/hw/xfree86/os-support/bsd/alpha_video.c @@ -368,7 +368,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return(-1); } - psize = xf86getpagesize(); + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); diff --git a/hw/xfree86/os-support/bsd/arm_video.c b/hw/xfree86/os-support/bsd/arm_video.c index b556563d3..23948b5d6 100644 --- a/hw/xfree86/os-support/bsd/arm_video.c +++ b/hw/xfree86/os-support/bsd/arm_video.c @@ -246,7 +246,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return(-1); } - psize = xf86getpagesize(); + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); diff --git a/hw/xfree86/os-support/bsd/bsd_apm.c b/hw/xfree86/os-support/bsd/bsd_apm.c index 61779875c..43eda7421 100644 --- a/hw/xfree86/os-support/bsd/bsd_apm.c +++ b/hw/xfree86/os-support/bsd/bsd_apm.c @@ -66,7 +66,7 @@ bsdPMGetEventFromOS(int fd, pmEvent *events, int num) if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) { if (errno != EAGAIN) { xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT" - " errno = %d\n", errno); + " %s\n", strerror(errno)); } break; } diff --git a/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c index b0171e2c3..b37070c37 100644 --- a/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c +++ b/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c @@ -102,7 +102,7 @@ bsdPMGetEventFromOS(int kq, pmEvent *events, int num) break; } else if (result < 0) { xf86Msg(X_WARNING, "bsdPMGetEventFromOS: kevent returns" - " errno = %d\n", errno); + " %s\n", strerror(errno)); break; } events[i] = bsdToXF86(APM_EVENT_TYPE(ev.data)); diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c index e7db6c10e..0dcff6631 100644 --- a/hw/xfree86/os-support/bsd/i386_video.c +++ b/hw/xfree86/os-support/bsd/i386_video.c @@ -301,7 +301,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return(-1); } - psize = xf86getpagesize(); + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); @@ -602,7 +602,7 @@ cleanMTRR() #ifdef DEBUG ErrorF("Clean for (0x%lx,0x%lx)\n", (unsigned long)mrd[i].mr_base, - (unsigned long)rd[i].mr_len); + (unsigned long)mrd[i].mr_len); #endif if (mrd[i].mr_flags & MDF_FIXACTIVE) { mro.mo_arg[0] = MEMRANGE_SET_UPDATE; diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c index a34ed99d0..064533c77 100644 --- a/hw/xfree86/os-support/bus/Pci.c +++ b/hw/xfree86/os-support/bus/Pci.c @@ -1,65 +1,4 @@ /* - * Pci.c - New server PCI access functions - * - * The XFree86 server PCI access functions have been reimplemented as a - * framework that allows each supported platform/OS to have their own - * platform/OS specific pci driver. - * - * All of the public PCI access functions exported to the other parts of - * the server are declared in Pci.h and defined herein. These include: - * pciInit() - Initialize PCI access functions - * pciReadLong() - Read a 32 bit value from a device's cfg space - * pciReadWord() - Read a 16 bit value from a device's cfg space - * pciReadByte() - Read an 8 bit value from a device's cfg space - * pciWriteLong() - Write a 32 bit value to a device's cfg space - * pciWriteWord() - Write a 16 bit value to a device's cfg space - * pciWriteByte() - Write an 8 bit value to a device's cfg space - * pciSetBitsLong() - Write a 32 bit value against a mask - * pciSetBitsByte() - Write an 8 bit value against a mask - * pciTag() - Return tag for a given PCI bus, device, & - * function - * pciBusAddrToHostAddr() - Convert a PCI address to a host address - * xf86scanpci() - Return info about all PCI devices - * xf86MapDomainMemory() - Like xf86MapPciMem() but can handle - * domain/host address translation - * xf86MapLegacyIO() - Maps PCI I/O spaces - * - * The actual PCI backend driver is selected by the pciInit() function - * (see below) using either compile time definitions, run-time checks, - * or both. - * - * Certain generic functions are provided that make the implementation - * of certain well behaved platforms (e.g. those supporting PCI config - * mechanism 1 or some thing close to it) very easy. - * - * Less well behaved platforms/OS's can roll their own functions. - * - * To add support for another platform/OS, add a call to fooPciInit() within - * pciInit() below under the correct compile time definition or run-time - * conditional. - * - * The fooPciInit() procedure must do three things: - * 1) Initialize the pciBusTable[] for all primary PCI buses including - * the per domain PCI access functions (readLong, writeLong, - * addrBusToHost, and addrHostToBus). - * - * 2) Add entries to pciBusTable[] for configured secondary buses. This - * step may be skipped if a platform is using the generic findFirst/ - * findNext functions because these procedures will automatically - * discover and add secondary buses dynamically. - * - * 3) Overide default settings for global PCI access functions if - * required. These include pciFindFirstFP, pciFindNextFP, - * Of course, if you choose not to use one of the generic - * functions, you will need to provide a platform specifc replacement. - * - * Gary Barton - * Concurrent Computer Corporation - * garyb@gate.net - * - */ - -/* * Copyright 1998 by Concurrent Computer Corporation * * Permission to use, copy, modify, distribute, and sell this software @@ -197,14 +136,6 @@ #include <pciaccess.h> -#if 0 -#include <stdio.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#endif - #define PCI_MFDEV_SUPPORT 1 /* Include PCI multifunction device support */ #define PCI_BRIDGE_SUPPORT 1 /* Include support for PCI-to-PCI bridges */ @@ -217,35 +148,11 @@ _X_EXPORT int pciNumBuses = 0; /* Actual number of PCI buses */ int pciMaxBusNum = MAX_PCI_BUSES; -/* - * pciInit - choose correct platform/OS specific PCI init routine - */ -static void -pciInit(void) -{ - static int pciInitialized = 0; - - if (!pciInitialized) { - pciInitialized = 1; - - /* XXX */ -#if defined(DEBUGPCI) - if (DEBUGPCI >= xf86Verbose) { - xf86Verbose = DEBUGPCI; - } -#endif - - ARCH_PCI_INIT(); - } -} - _X_EXPORT ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { int bus = PCI_BUS_FROM_TAG(tag); - pciInit(); - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && pciBusInfo[bus]->funcs->pciAddrBusToHost) return (*pciBusInfo[bus]->funcs->pciAddrBusToHost)(tag, type, addr); @@ -268,21 +175,19 @@ pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS addr) _X_EXPORT Bool xf86scanpci(void) { - static Bool done = FALSE; - static Bool success = FALSE; + Bool success = FALSE; - /* - * if we haven't found PCI devices checking for pci_devp may - * result in an endless recursion if platform/OS specific PCI - * bus probing code calls this function from with in it. - */ - if (done) - return success; + success = (pci_system_init() == 0); - done = TRUE; + /* XXX */ +#if defined(DEBUGPCI) + if (DEBUGPCI >= xf86Verbose) { + xf86Verbose = DEBUGPCI; + } +#endif - success = (pci_system_init() == 0); - pciInit(); + /* choose correct platform/OS specific PCI init routine */ + ARCH_PCI_INIT(); return success; } diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c index c864e3385..ff257a8c7 100644 --- a/hw/xfree86/os-support/bus/Sbus.c +++ b/hw/xfree86/os-support/bus/Sbus.c @@ -559,7 +559,7 @@ _X_EXPORT pointer xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) { pointer ret; - unsigned long pagemask = xf86getpagesize() - 1; + unsigned long pagemask = getpagesize() - 1; unsigned long off = offset & ~pagemask; unsigned long len = ((offset + size + pagemask) & ~pagemask) - off; @@ -585,7 +585,7 @@ xf86MapSbusMem(sbusDevicePtr psdp, unsigned long offset, unsigned long size) _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, pointer addr, unsigned long size) { - unsigned long mask = xf86getpagesize() - 1; + unsigned long mask = getpagesize() - 1; unsigned long base = (unsigned long)addr & ~mask; unsigned long len = (((unsigned long)addr + size + mask) & ~mask) - base; diff --git a/hw/xfree86/os-support/bus/sparcPci.c b/hw/xfree86/os-support/bus/sparcPci.c index 6f7113f15..2d8039c29 100644 --- a/hw/xfree86/os-support/bus/sparcPci.c +++ b/hw/xfree86/os-support/bus/sparcPci.c @@ -270,7 +270,7 @@ sparcPciInit(void) } sparcPromInit(); - pagemask = xf86getpagesize() - 1; + pagemask = getpagesize() - 1; for (node = promGetChild(promRootNode); node; diff --git a/hw/xfree86/os-support/bus/zx1PCI.c b/hw/xfree86/os-support/bus/zx1PCI.c index 561fbd9f7..d78e0c434 100644 --- a/hw/xfree86/os-support/bus/zx1PCI.c +++ b/hw/xfree86/os-support/bus/zx1PCI.c @@ -469,7 +469,7 @@ void xf86PreScanZX1(void) { resRange range; - unsigned long mapSize = xf86getpagesize(); + unsigned long mapSize = getpagesize(); unsigned long tmp, base, ioaaddr; unsigned long flagsd, based, lastd, maskd, routed; unsigned long flags0, base0, last0, mask0, route0; diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c index 8e6ae8d36..04763ada7 100644 --- a/hw/xfree86/os-support/hurd/hurd_video.c +++ b/hw/xfree86/os-support/hurd/hurd_video.c @@ -126,7 +126,7 @@ extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on); Bool xf86EnableIO() { - if (ioperm(0, 0xffff, 1)) { + if (ioperm(0, 0x10000, 1)) { FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno)); return FALSE; } @@ -138,7 +138,7 @@ xf86EnableIO() void xf86DisableIO() { - ioperm(0,0xffff,0); + ioperm(0,0x10000,0); return; } diff --git a/hw/xfree86/os-support/linux/lnx_pci.c b/hw/xfree86/os-support/linux/lnx_pci.c index 53818f2dc..8eedfa49f 100644 --- a/hw/xfree86/os-support/linux/lnx_pci.c +++ b/hw/xfree86/os-support/linux/lnx_pci.c @@ -25,8 +25,6 @@ #define PCIADDR_FMT "%lx" #endif -int lnxPciInit(void); - struct pci_dev { unsigned int domain; unsigned int bus; @@ -139,14 +137,6 @@ static struct pci_dev *xf86OSLinuxGetPciDevs(void) { return ret; } -/* not to be confused with linuxPciInit (i.e. ARCH_PCI_INIT), found in - * os-support/bus/linuxPci.c. */ -int lnxPciInit(void) { - if (!xf86OSLinuxPCIDevs) - xf86OSLinuxPCIDevs = xf86OSLinuxGetPciDevs(); - return xf86OSLinuxNumPciDevs; -} - /* Query the kvirt address (64bit) of a BAR range from size for a given TAG */ unsigned long xf86GetOSOffsetFromPCI(PCITAG tag, int space, unsigned long base) diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c index ad2b66f74..1bd2d575f 100644 --- a/hw/xfree86/os-support/linux/lnx_video.c +++ b/hw/xfree86/os-support/linux/lnx_video.c @@ -142,17 +142,8 @@ mtrr_open(int verbosity) /* Only report absence of /proc/mtrr once. */ static Bool warned = FALSE; - char **fn; - static char *mtrr_files[] = { - "/dev/cpu/mtrr", /* Possible future name */ - "/proc/mtrr", /* Current name */ - NULL - }; - if (mtrr_fd == MTRR_FD_UNOPENED) { - /* So open it. */ - for (fn = mtrr_files; mtrr_fd < 0 && *fn; fn++) - mtrr_fd = open(*fn, O_WRONLY); + mtrr_fd = open("/proc/mtrr", O_WRONLY); if (mtrr_fd < 0) mtrr_fd = MTRR_FD_PROBLEM; diff --git a/hw/xfree86/os-support/shared/bios_mmap.c b/hw/xfree86/os-support/shared/bios_mmap.c index 51d429948..8bac87ebe 100644 --- a/hw/xfree86/os-support/shared/bios_mmap.c +++ b/hw/xfree86/os-support/shared/bios_mmap.c @@ -137,7 +137,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, return(-1); } - psize = xf86getpagesize(); + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); diff --git a/hw/xfree86/os-support/solaris/sun_apm.c b/hw/xfree86/os-support/solaris/sun_apm.c index a9657fd55..7decc900f 100644 --- a/hw/xfree86/os-support/solaris/sun_apm.c +++ b/hw/xfree86/os-support/solaris/sun_apm.c @@ -149,7 +149,7 @@ sunPMGetEventFromOS(int fd, pmEvent *events, int num) if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) { if (errno != EAGAIN) { xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT" - " errno = %d\n", errno); + " %s\n", strerror(errno)); } break; } @@ -178,7 +178,7 @@ sunPMConfirmEventToOs(int fd, pmEvent event) return PM_CONTINUE; else { xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND" - " errno = %d\n", errno); + " %s\n", strerror(errno)); return PM_FAILED; } case XF86_APM_STANDBY_RESUME: @@ -191,7 +191,7 @@ sunPMConfirmEventToOs(int fd, pmEvent event) return PM_CONTINUE; else { xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME" - " errno = %d\n", errno); + " %s\n", strerror(errno)); return PM_FAILED; } default: diff --git a/hw/xfree86/os-support/solaris/sun_bios.c b/hw/xfree86/os-support/solaris/sun_bios.c index 1fae9759c..a27a5a5a7 100644 --- a/hw/xfree86/os-support/solaris/sun_bios.c +++ b/hw/xfree86/os-support/solaris/sun_bios.c @@ -62,7 +62,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf, * * Use /dev/xsvc for everything. */ - psize = xf86getpagesize(); + psize = getpagesize(); Offset += Base & (psize - 1); Base &= ~(psize - 1); mlen = (Offset + Len + psize - 1) & ~(psize - 1); diff --git a/hw/xfree86/os-support/solaris/sun_mouse.c b/hw/xfree86/os-support/solaris/sun_mouse.c index aa509d08b..a5955ef2c 100644 --- a/hw/xfree86/os-support/solaris/sun_mouse.c +++ b/hw/xfree86/os-support/solaris/sun_mouse.c @@ -121,8 +121,11 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse); static void vuidMouseAdjustFrame(int index, int x, int y, int flags); static int vuidMouseGeneration = 0; -static int vuidMouseScreenIndex; -#define vuidMouseScreenPrivate(s) ((s)->devPrivates[vuidMouseScreenIndex].ptr) +static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey; +#define vuidMouseGetScreenPrivate(s) ( \ + dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey)) +#define vuidMouseSetScreenPrivate(s,p) \ + dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, (void *) p) #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */ static inline @@ -455,7 +458,7 @@ static void vuidMouseAdjustFrame(int index, int x, int y, int flags) ScrnInfoPtr pScrn = xf86Screens[index]; ScreenPtr pScreen = pScrn->pScreen; xf86AdjustFrameProc *wrappedAdjustFrame - = (xf86AdjustFrameProc *) vuidMouseScreenPrivate(pScreen); + = (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen); VuidMsePtr m; if(wrappedAdjustFrame) { @@ -496,15 +499,12 @@ vuidMouseProc(DeviceIntPtr pPointer, int what) case DEVICE_INIT: #ifdef HAVE_ABSOLUTE_MOUSE_SCALING if (vuidMouseGeneration != serverGeneration) { - if ((vuidMouseScreenIndex = AllocateScreenPrivateIndex()) >= 0) { for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen); - vuidMouseScreenPrivate(pScreen) - = (pointer) pScrn->AdjustFrame; + vuidMouseSetScreenPrivate(pScreen, pScrn->AdjustFrame); pScrn->AdjustFrame = vuidMouseAdjustFrame; } - } vuidMouseGeneration = serverGeneration; } #endif diff --git a/hw/xfree86/parser/xf86tokens.h b/hw/xfree86/parser/xf86tokens.h index 786dac145..6e4fdeab5 100644 --- a/hw/xfree86/parser/xf86tokens.h +++ b/hw/xfree86/parser/xf86tokens.h @@ -208,7 +208,6 @@ typedef enum { XKBVARIANT, XKBOPTIONS, /* The next two have become ServerFlags options */ - VTINIT, VTSYSREQ, /* Obsolete keyboard tokens */ SERVERNUM, diff --git a/hw/xfree86/rac/xf86RAC.c b/hw/xfree86/rac/xf86RAC.c index 0d41599b1..8985f38b0 100644 --- a/hw/xfree86/rac/xf86RAC.c +++ b/hw/xfree86/rac/xf86RAC.c @@ -39,9 +39,8 @@ pScreen->x = y;} #define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x -#define SCREEN_PROLOG(x) \ - pScreen->x = \ - ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->x +#define SCREEN_PROLOG(x) pScreen->x = ((RACScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->x #define SCREEN_EPILOG(x,y) pScreen->x = y; #define WRAP_PICT_COND(x,y,cond) if (ps)\ @@ -50,9 +49,8 @@ ps->x = y;} #define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;} -#define PICTURE_PROLOGUE(field) \ - ps->field = \ - ((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr)->field +#define PICTURE_PROLOGUE(field) ps->field = \ + ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey))->field #define PICTURE_EPILOGUE(field, wrap) \ ps->field = wrap @@ -65,9 +63,9 @@ #define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x #define SPRITE_PROLOG miPointerScreenPtr PointPriv = \ -(miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr;\ - RACScreenPtr pScreenPriv = \ -((RACScreenPtr) (pScreen)->devPrivates[RACScreenIndex].ptr);\ + (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); \ + RACScreenPtr pScreenPriv = \ + ((RACScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, RACScreenKey));\ PointPriv->spriteFuncs = pScreenPriv->miSprite; #define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\ PointPriv->spriteFuncs = &RACSpriteFuncs; @@ -82,7 +80,7 @@ (x)->ops = &RACGCOps;\ (x)->funcs = &RACGCFuncs; #define GC_UNWRAP(x)\ - RACGCPtr pGCPriv = (RACGCPtr) (x)->devPrivates[RACGCIndex].ptr;\ + RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&(x)->devPrivates, RACGCKey);\ (x)->ops = pGCPriv->wrapOps;\ (x)->funcs = pGCPriv->wrapFuncs; @@ -252,9 +250,8 @@ static miPointerSpriteFuncRec RACSpriteFuncs = { RACSpriteMoveCursor }; -static int RACScreenIndex = -1; -static int RACGCIndex = -1; -static unsigned long RACGeneration = 0; +static DevPrivateKey RACScreenKey = &RACScreenKey; +static DevPrivateKey RACGCKey = &RACGCKey; Bool @@ -268,24 +265,17 @@ xf86RACInit(ScreenPtr pScreen, unsigned int flag) #endif pScrn = xf86Screens[pScreen->myNum]; - PointPriv = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr; - + PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miPointerScreenKey); DPRINT_S("RACInit",pScreen->myNum); - if (RACGeneration != serverGeneration) { - if ( ((RACScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((RACGCIndex = AllocateGCPrivateIndex()) < 0)) - return FALSE; - - RACGeneration = serverGeneration; - } - if (!AllocateGCPrivate(pScreen, RACGCIndex, sizeof(RACGCRec))) + if (!dixRequestPrivate(RACGCKey, sizeof(RACGCRec))) return FALSE; if (!(pScreenPriv = xalloc(sizeof(RACScreenRec)))) return FALSE; - pScreen->devPrivates[RACScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, RACScreenKey, pScreenPriv); WRAP_SCREEN(CloseScreen, RACCloseScreen); WRAP_SCREEN(SaveScreen, RACSaveScreen); @@ -322,10 +312,10 @@ static Bool RACCloseScreen (int i, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RACScreenPtr pScreenPriv = - (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr; - miPointerScreenPtr PointPriv - = (miPointerScreenPtr)pScreen->devPrivates[miPointerScreenIndex].ptr; + RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, RACScreenKey); + miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, miPointerScreenKey); #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif @@ -581,8 +571,8 @@ static void RACAdjustFrame(int index, int x, int y, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - RACScreenPtr pScreenPriv = - (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr; + RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, RACScreenKey); DPRINT_S("RACAdjustFrame",index); xf86EnableAccess(xf86Screens[index]); @@ -594,8 +584,8 @@ static Bool RACSwitchMode(int index, DisplayModePtr mode, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - RACScreenPtr pScreenPriv = - (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr; + RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, RACScreenKey); DPRINT_S("RACSwitchMode",index); xf86EnableAccess(xf86Screens[index]); @@ -607,8 +597,8 @@ static Bool RACEnterVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - RACScreenPtr pScreenPriv = - (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr; + RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, RACScreenKey); DPRINT_S("RACEnterVT",index); xf86EnableAccess(xf86Screens[index]); @@ -620,8 +610,8 @@ static void RACLeaveVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - RACScreenPtr pScreenPriv = - (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr; + RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, RACScreenKey); DPRINT_S("RACLeaveVT",index); xf86EnableAccess(xf86Screens[index]); @@ -633,8 +623,8 @@ static void RACFreeScreen(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; - RACScreenPtr pScreenPriv = - (RACScreenPtr) pScreen->devPrivates[RACScreenIndex].ptr; + RACScreenPtr pScreenPriv = (RACScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, RACScreenKey); DPRINT_S("RACFreeScreen",index); xf86EnableAccess(xf86Screens[index]); @@ -646,7 +636,7 @@ static Bool RACCreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; - RACGCPtr pGCPriv = (RACGCPtr) (pGC)->devPrivates[RACGCIndex].ptr; + RACGCPtr pGCPriv = (RACGCPtr)dixLookupPrivate(&pGC->devPrivates, RACGCKey); Bool ret; DPRINT_S("RACCreateGC",pScreen->myNum); diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c index 457807698..5b1ce5e1f 100644 --- a/hw/xfree86/ramdac/xf86Cursor.c +++ b/hw/xfree86/ramdac/xf86Cursor.c @@ -8,8 +8,7 @@ #include "colormapst.h" #include "cursorstr.h" -int xf86CursorScreenIndex = -1; -static unsigned long xf86CursorGeneration = 0; +DevPrivateKey xf86CursorScreenKey = &xf86CursorScreenKey; /* sprite functions */ @@ -48,12 +47,6 @@ xf86InitCursor( xf86CursorScreenPtr ScreenPriv; miPointerScreenPtr PointPriv; - if (xf86CursorGeneration != serverGeneration) { - if ((xf86CursorScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - xf86CursorGeneration = serverGeneration; - } - if (!xf86InitHardwareCursor(pScreen, infoPtr)) return FALSE; @@ -61,7 +54,7 @@ xf86InitCursor( if (!ScreenPriv) return FALSE; - pScreen->devPrivates[xf86CursorScreenIndex].ptr = ScreenPriv; + dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, ScreenPriv); ScreenPriv->SWCursor = TRUE; ScreenPriv->isUp = FALSE; @@ -84,7 +77,7 @@ xf86InitCursor( ScreenPriv->PalettedCursor = TRUE; } - PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr; + PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); ScreenPriv->showTransparent = PointPriv->showTransparent; if (infoPtr->Flags & HARDWARE_CURSOR_SHOW_TRANSPARENT) @@ -113,10 +106,10 @@ static Bool xf86CursorCloseScreen(int i, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - miPointerScreenPtr PointPriv = - pScreen->devPrivates[miPointerScreenIndex].ptr; - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, miPointerScreenKey); + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); if (ScreenPriv->isUp && pScrn->vtSema) xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); @@ -146,8 +139,8 @@ xf86CursorQueryBestSize( unsigned short *height, ScreenPtr pScreen) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); if (class == CursorShape) { if(*width > ScreenPriv->CursorInfoPtr->MaxWidth) @@ -161,8 +154,8 @@ xf86CursorQueryBestSize( static void xf86CursorInstallColormap(ColormapPtr pMap) { - xf86CursorScreenPtr ScreenPriv = - pMap->pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pMap->pScreen->devPrivates, xf86CursorScreenKey); ScreenPriv->pInstalledMap = pMap; @@ -175,8 +168,8 @@ xf86CursorRecolorCursor( CursorPtr pCurs, Bool displayed) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); if (!displayed) return; @@ -195,8 +188,8 @@ xf86CursorEnableDisableFBAccess( Bool enable) { ScreenPtr pScreen = screenInfo.screens[index]; - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); if (!enable && ScreenPriv->CurrentCursor != NullCursor) { CursorPtr currentCursor = ScreenPriv->CurrentCursor; @@ -226,10 +219,10 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) { Bool ret; ScreenPtr pScreen = screenInfo.screens[index]; - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; - miPointerScreenPtr PointPriv = - pScreen->devPrivates[miPointerScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); + miPointerScreenPtr PointPriv = (miPointerScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, miPointerScreenKey); if (ScreenPriv->isUp) { xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y); @@ -254,11 +247,11 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) static Bool xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); if (pCurs->refcnt <= 1) - pCurs->devPriv[pScreen->myNum] = NULL; + dixSetPrivate(&pCurs->devPrivates, pScreen, NULL); return (*ScreenPriv->spriteFuncs->RealizeCursor)(pScreen, pCurs); } @@ -266,12 +259,12 @@ xf86CursorRealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) static Bool xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); if (pCurs->refcnt <= 1) { - xfree(pCurs->devPriv[pScreen->myNum]); - pCurs->devPriv[pScreen->myNum] = NULL; + xfree(dixLookupPrivate(&pCurs->devPrivates, pScreen)); + dixSetPrivate(&pCurs->devPrivates, pScreen, NULL); } return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pScreen, pCurs); @@ -280,8 +273,8 @@ xf86CursorUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCurs) static void xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; miPointerScreenPtr PointPriv; @@ -306,8 +299,8 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) ScreenPriv->HotX = pCurs->bits->xhot; ScreenPriv->HotY = pCurs->bits->yhot; - PointPriv = pScreen->devPrivates[miPointerScreenIndex].ptr; - + PointPriv = (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miPointerScreenKey); if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || (( #ifdef ARGB_CURSOR pCurs->bits->argb && infoPtr->UseHWCursorARGB && @@ -351,8 +344,8 @@ xf86CursorSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) static void xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); ScreenPriv->x = x; ScreenPriv->y = y; @@ -369,8 +362,8 @@ xf86CursorMoveCursor(ScreenPtr pScreen, int x, int y) void xf86ForceHWCursor (ScreenPtr pScreen, Bool on) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); if (on) { diff --git a/hw/xfree86/ramdac/xf86CursorPriv.h b/hw/xfree86/ramdac/xf86CursorPriv.h index 472e2b06b..f82be2edc 100644 --- a/hw/xfree86/ramdac/xf86CursorPriv.h +++ b/hw/xfree86/ramdac/xf86CursorPriv.h @@ -45,6 +45,6 @@ Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr); CARD32 xf86ReverseBitOrder(CARD32 data); -extern int xf86CursorScreenIndex; +extern DevPrivateKey xf86CursorScreenKey; #endif /* _XF86CURSORPRIV_H */ diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c index 91caea047..d10e283d7 100644 --- a/hw/xfree86/ramdac/xf86HWCurs.c +++ b/hw/xfree86/ramdac/xf86HWCurs.c @@ -113,8 +113,8 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; unsigned char *bits; @@ -123,7 +123,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) return; } - bits = pCurs->devPriv[pScreen->myNum]; + bits = (unsigned char *)dixLookupPrivate(&pCurs->devPrivates, pScreen); x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX; y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY; @@ -133,7 +133,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) #endif if (!bits) { bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs); - pCurs->devPriv[pScreen->myNum] = bits; + dixSetPrivate(&pCurs->devPrivates, pScreen, bits); } if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN)) @@ -157,8 +157,8 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y) void xf86SetTransparentCursor(ScreenPtr pScreen) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; if (!ScreenPriv->transparentData) @@ -178,8 +178,8 @@ xf86SetTransparentCursor(ScreenPtr pScreen) void xf86MoveCursor(ScreenPtr pScreen, int x, int y) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX; @@ -191,8 +191,8 @@ xf86MoveCursor(ScreenPtr pScreen, int x, int y) void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed) { - xf86CursorScreenPtr ScreenPriv = - pScreen->devPrivates[xf86CursorScreenIndex].ptr; + xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr)dixLookupPrivate( + &pScreen->devPrivates, xf86CursorScreenKey); xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr; #ifdef ARGB_CURSOR diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c index 52fdcbef6..74beefb67 100644 --- a/hw/xfree86/shadowfb/shadow.c +++ b/hw/xfree86/shadowfb/shadow.c @@ -94,14 +94,13 @@ typedef struct { } ShadowGCRec, *ShadowGCPtr; -static int ShadowScreenIndex = -1; -static int ShadowGCIndex = -1; -static unsigned long ShadowGeneration = 0; +static DevPrivateKey ShadowScreenKey = &ShadowScreenKey; +static DevPrivateKey ShadowGCKey = &ShadowGCKey; #define GET_SCREEN_PRIVATE(pScreen) \ - (ShadowScreenPtr)((pScreen)->devPrivates[ShadowScreenIndex].ptr) + (ShadowScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, ShadowScreenKey) #define GET_GC_PRIVATE(pGC) \ - (ShadowGCPtr)((pGC)->devPrivates[ShadowGCIndex].ptr) + (ShadowGCPtr)dixLookupPrivate(&(pGC)->devPrivates, ShadowGCKey); #define SHADOW_GC_FUNC_PROLOGUE(pGC)\ ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\ @@ -172,20 +171,13 @@ ShadowFBInit2 ( if(!preRefreshArea && !postRefreshArea) return FALSE; - if (ShadowGeneration != serverGeneration) { - if(((ShadowScreenIndex = AllocateScreenPrivateIndex ()) < 0) || - ((ShadowGCIndex = AllocateGCPrivateIndex()) < 0)) - return FALSE; - ShadowGeneration = serverGeneration; - } - - if(!AllocateGCPrivate(pScreen, ShadowGCIndex, sizeof(ShadowGCRec))) + if(!dixRequestPrivate(ShadowGCKey, sizeof(ShadowGCRec))) return FALSE; if(!(pPriv = (ShadowScreenPtr)xalloc(sizeof(ShadowScreenRec)))) return FALSE; - pScreen->devPrivates[ShadowScreenIndex].ptr = (pointer)pPriv; + dixSetPrivate(&pScreen->devPrivates, ShadowScreenKey, pPriv); pPriv->pScrn = pScrn; pPriv->preRefresh = preRefreshArea; diff --git a/hw/xfree86/utils/ioport/ioport.c b/hw/xfree86/utils/ioport/ioport.c index 32213642e..737043462 100644 --- a/hw/xfree86/utils/ioport/ioport.c +++ b/hw/xfree86/utils/ioport/ioport.c @@ -489,4 +489,3 @@ main(argc, argv) return (0); } -#include "xf86getpagesize.c" diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c index 06559bbd5..8af1727cc 100644 --- a/hw/xfree86/vbe/vbe.c +++ b/hw/xfree86/vbe/vbe.c @@ -1019,7 +1019,7 @@ VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock) /* Input: AX := 4F0Bh VBE Get Pixel Clock - BL := 01h Get Pixel Clock + BL := 00h Get Pixel Clock ECX := pixel clock in units of Hz DX := mode number @@ -1030,7 +1030,7 @@ VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock) pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f0b; - pVbe->pInt10->bx = 0x01; + pVbe->pInt10->bx = 0x00; pVbe->pInt10->cx = clock; pVbe->pInt10->dx = mode; xf86ExecX86int10(pVbe->pInt10); diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c index 8c6c53539..324de8ad8 100644 --- a/hw/xfree86/x86emu/ops2.c +++ b/hw/xfree86/x86emu/ops2.c @@ -328,6 +328,20 @@ static void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2)) } /**************************************************************************** +REMARKS: CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output +Handles opcode 0x0f,0xa2 +****************************************************************************/ +static void x86emuOp2_cpuid(u8 X86EMU_UNUSED(op2)) +{ + START_OF_INSTR(); + DECODE_PRINTF("CPUID\n"); + TRACE_AND_STEP(); + cpuid(); + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + +/**************************************************************************** REMARKS: Handles opcode 0x0f,0xa3 ****************************************************************************/ @@ -2734,7 +2748,7 @@ void (*x86emu_optab2[256])(u8) = /* 0xa0 */ x86emuOp2_push_FS, /* 0xa1 */ x86emuOp2_pop_FS, -/* 0xa2 */ x86emuOp2_illegal_op, +/* 0xa2 */ x86emuOp2_cpuid, /* 0xa3 */ x86emuOp2_bt_R, /* 0xa4 */ x86emuOp2_shld_IMM, /* 0xa5 */ x86emuOp2_shld_CL, diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c index b9e7257ca..b42cdc0a5 100644 --- a/hw/xfree86/x86emu/prim_ops.c +++ b/hw/xfree86/x86emu/prim_ops.c @@ -102,6 +102,12 @@ #define PRIM_OPS_NO_REDEFINE_ASM #include "x86emu/x86emui.h" +#if defined(__GNUC__) +# if defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__) +# include "x86emu/prim_x86_gcc.h" +# endif +#endif + /*------------------------- Global Variables ------------------------------*/ static u32 x86emu_parity_tab[8] = @@ -2654,3 +2660,63 @@ DB( if (CHECK_SP_ACCESS()) return res; } +/**************************************************************************** +REMARKS: +CPUID takes EAX/ECX as inputs, writes EAX/EBX/ECX/EDX as output +****************************************************************************/ +void cpuid (void) +{ + u32 feature = M.x86.R_EAX; + +#ifdef X86EMU_HAS_HW_CPUID + /* If the platform allows it, we will base our values on the real + * results from the CPUID instruction. We limit support to the + * first two features, and the results of those are sanitized. + */ + if (feature <= 1) + hw_cpuid(&M.x86.R_EAX, &M.x86.R_EBX, &M.x86.R_ECX, &M.x86.R_EDX); +#endif + + switch (feature) { + case 0: + /* Regardless if we have real data from the hardware, the emulator + * will only support upto feature 1, which we set in register EAX. + * Registers EBX:EDX:ECX contain a string identifying the CPU. + */ + M.x86.R_EAX = 1; +#ifndef X86EMU_HAS_HW_CPUID + /* EBX:EDX:ECX = "GenuineIntel" */ + M.x86.R_EBX = 0x756e6547; + M.x86.R_EDX = 0x49656e69; + M.x86.R_ECX = 0x6c65746e; +#endif + break; + case 1: +#ifndef X86EMU_HAS_HW_CPUID + /* If we don't have x86 compatible hardware, we return values from an + * Intel 486dx4; which was one of the first processors to have CPUID. + */ + M.x86.R_EAX = 0x00000480; + M.x86.R_EBX = 0x00000000; + M.x86.R_ECX = 0x00000000; + M.x86.R_EDX = 0x00000002; /* VME */ +#else + /* In the case that we have hardware CPUID instruction, we make sure + * that the features reported are limited to TSC and VME. + */ + M.x86.R_EDX &= 0x00000012; +#endif + break; + default: + /* Finally, we don't support any additional features. Most CPUs + * return all zeros when queried for invalid or unsupported feature + * numbers. + */ + M.x86.R_EAX = 0; + M.x86.R_EBX = 0; + M.x86.R_ECX = 0; + M.x86.R_EDX = 0; + break; + } +} + diff --git a/hw/xfree86/x86emu/x86emu/prim_ops.h b/hw/xfree86/x86emu/x86emu/prim_ops.h index bea8357e4..6ac2a29f6 100644 --- a/hw/xfree86/x86emu/x86emu/prim_ops.h +++ b/hw/xfree86/x86emu/x86emu/prim_ops.h @@ -133,6 +133,7 @@ void push_word (u16 w); void push_long (u32 w); u16 pop_word (void); u32 pop_long (void); +void cpuid (void); #ifdef __cplusplus } /* End of "C" linkage for C++ */ diff --git a/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h new file mode 100644 index 000000000..af61e2023 --- /dev/null +++ b/hw/xfree86/x86emu/x86emu/prim_x86_gcc.h @@ -0,0 +1,79 @@ +/**************************************************************************** +* +* Inline helpers for x86emu +* +* Copyright (C) 2008 Bart Trojanowski, Symbio Technologies, LLC +* +* ======================================================================== +* +* Permission to use, copy, modify, distribute, and sell this software and +* its documentation for any purpose is hereby granted without fee, +* provided that the above copyright notice appear in all copies and that +* both that copyright notice and this permission notice appear in +* supporting documentation, and that the name of the authors not be used +* in advertising or publicity pertaining to distribution of the software +* without specific, written prior permission. The authors makes no +* representations about the suitability of this software for any purpose. +* It is provided "as is" without express or implied warranty. +* +* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +* PERFORMANCE OF THIS SOFTWARE. +* +* ======================================================================== +* +* Language: GNU C +* Environment: GCC on i386 or x86-64 +* Developer: Bart Trojanowski +* +* Description: This file defines a few x86 macros that can be used by the +* emulator to execute native instructions. +* +* For PIC vs non-PIC code refer to: +* http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well +* +****************************************************************************/ +#ifndef __X86EMU_PRIM_X86_GCC_H +#define __X86EMU_PRIM_X86_GCC_H + +#include "x86emu/types.h" + +#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__x86_64__) || defined(__amd64__)) +#error This file is intended to be used by gcc on i386 or x86-64 system +#endif + +#if defined(__PIC__) && defined(__i386__) + +#define X86EMU_HAS_HW_CPUID 1 +static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d) +{ + __asm__ __volatile__ ("pushl %%ebx \n\t" + "cpuid \n\t" + "movl %%ebx, %1 \n\t" + "popl %%ebx \n\t" + : "=a" (*a), "=r" (*b), + "=c" (*c), "=d" (*d) + : "a" (*a), "c" (*c) + : "cc"); +} + +#else // ! (__PIC__ && __i386__) + +#define x86EMU_HAS_HW_CPUID 1 +static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d) +{ + __asm__ __volatile__ ("cpuid" + : "=a" (*a), "=b" (*b), + "=c" (*c), "=d" (*d) + : "a" (*a), "c" (*c) + : "cc"); +} + +#endif // __PIC__ && __i386__ + + +#endif // __X86EMU_PRIM_X86_GCC_H diff --git a/hw/xfree86/xaa/xaaDashLine.c b/hw/xfree86/xaa/xaaDashLine.c index 1a4732baa..63233e05d 100644 --- a/hw/xfree86/xaa/xaaDashLine.c +++ b/hw/xfree86/xaa/xaaDashLine.c @@ -35,7 +35,8 @@ XAAPolyLinesDashed( #endif ){ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates, + XAAGetGCKey()); BoxPtr pboxInit = REGION_RECTS(pGC->pCompositeClip); int nboxInit = REGION_NUM_RECTS(pGC->pCompositeClip); unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c index b3dc83ada..e6083d529 100644 --- a/hw/xfree86/xaa/xaaGC.c +++ b/hw/xfree86/xaa/xaaGC.c @@ -38,7 +38,8 @@ Bool XAACreateGC(GCPtr pGC) { ScreenPtr pScreen = pGC->pScreen; - XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr); + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates, + XAAGetGCKey()); Bool ret; XAA_SCREEN_PROLOGUE(pScreen,CreateGC); diff --git a/hw/xfree86/xaa/xaaGCmisc.c b/hw/xfree86/xaa/xaaGCmisc.c index a7a3f4081..5823cc064 100644 --- a/hw/xfree86/xaa/xaaGCmisc.c +++ b/hw/xfree86/xaa/xaaGCmisc.c @@ -305,7 +305,8 @@ XAAValidatePolylines( DrawablePtr pDraw ) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates, + XAAGetGCKey()); if(pGC->lineStyle == LineSolid) changes &= ~GCDashList; if(!changes) return; diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c index 196569278..892cbcfc3 100644 --- a/hw/xfree86/xaa/xaaInit.c +++ b/hw/xfree86/xaa/xaaInit.c @@ -39,22 +39,20 @@ static int XAASetDGAMode(int index, int num, DGADevicePtr devRet); static void XAAEnableDisableFBAccess (int index, Bool enable); static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask); -static int XAAScreenIndex = -1; -static int XAAGCIndex = -1; -static int XAAPixmapIndex = -1; +static DevPrivateKey XAAScreenKey = &XAAScreenKey; +static DevPrivateKey XAAGCKey = &XAAGCKey; +static DevPrivateKey XAAPixmapKey = &XAAPixmapKey; -static unsigned long XAAGeneration = 0; - -int XAAGetScreenIndex(void) { - return XAAScreenIndex; +DevPrivateKey XAAGetScreenKey(void) { + return XAAScreenKey; } -int XAAGetGCIndex(void) { - return XAAGCIndex; +DevPrivateKey XAAGetGCKey(void) { + return XAAGCKey; } -int XAAGetPixmapIndex(void) { - return XAAPixmapIndex; +DevPrivateKey XAAGetPixmapKey(void) { + return XAAPixmapKey; } /* temp kludge */ @@ -104,25 +102,16 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if (!infoRec) return TRUE; - if (XAAGeneration != serverGeneration) { - if ( ((XAAScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((XAAGCIndex = AllocateGCPrivateIndex()) < 0) || - ((XAAPixmapIndex = AllocatePixmapPrivateIndex()) < 0)) - return FALSE; - - XAAGeneration = serverGeneration; - } - - if (!AllocateGCPrivate(pScreen, XAAGCIndex, sizeof(XAAGCRec))) + if (!dixRequestPrivate(XAAGCKey, sizeof(XAAGCRec))) return FALSE; - if (!AllocatePixmapPrivate(pScreen, XAAPixmapIndex, sizeof(XAAPixmapRec))) + if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec))) return FALSE; if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec)))) return FALSE; - pScreen->devPrivates[XAAScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv); if(!xf86FBManagerRunning(pScreen)) infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS); @@ -219,7 +208,7 @@ XAACloseScreen (int i, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); pScrn->EnterVT = pScreenPriv->EnterVT; pScrn->LeaveVT = pScreenPriv->LeaveVT; @@ -516,7 +505,7 @@ XAAEnterVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); return((*pScreenPriv->EnterVT)(index, flags)); } @@ -526,7 +515,7 @@ XAALeaveVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec; if(infoRec->NeedToSync) { @@ -549,7 +538,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet) ScreenPtr pScreen = screenInfo.screens[index]; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); int ret; if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */ @@ -611,7 +600,7 @@ XAAEnableDisableFBAccess (int index, Bool enable) ScreenPtr pScreen = screenInfo.screens[index]; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); if(!enable) { if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps)) diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c index fe0b70a14..1b7c15487 100644 --- a/hw/xfree86/xaa/xaaInitAccel.c +++ b/hw/xfree86/xaa/xaaInitAccel.c @@ -93,8 +93,6 @@ static const OptionInfoRec XAAOptions[] = { OPTV_NONE, {0}, FALSE } }; -static MODULESETUPPROTO(xaaSetup); - static XF86ModuleVersionInfo xaaVersRec = { "xaa", @@ -109,29 +107,7 @@ static XF86ModuleVersionInfo xaaVersRec = {0,0,0,0} }; -_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, xaaSetup, NULL }; - -ModuleInfoRec XAA = { - 1, - "XAA", - NULL, - 0, - XAAAvailableOptions, -}; - -/*ARGSUSED*/ -static pointer -xaaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) -{ - static Bool Initialised = FALSE; - - if (!Initialised) { - Initialised = TRUE; - xf86AddModuleInfo(&XAA, Module); - } - - return (pointer)TRUE; -} +_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL }; /*ARGSUSED*/ static const OptionInfoRec * diff --git a/hw/xfree86/xaa/xaaLineMisc.c b/hw/xfree86/xaa/xaaLineMisc.c index 537b08b97..cefb59a8e 100644 --- a/hw/xfree86/xaa/xaaLineMisc.c +++ b/hw/xfree86/xaa/xaaLineMisc.c @@ -64,7 +64,8 @@ void XAAComputeDash(GCPtr pGC) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr; + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates, + XAAGetGCKey()); Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE; int PatternLength = 0; unsigned char* DashPtr = (unsigned char*)pGC->dash; diff --git a/hw/xfree86/xaa/xaaOverlayDF.c b/hw/xfree86/xaa/xaaOverlayDF.c index 47599d7d3..64ca998ee 100644 --- a/hw/xfree86/xaa/xaaOverlayDF.c +++ b/hw/xfree86/xaa/xaaOverlayDF.c @@ -151,11 +151,10 @@ typedef struct { int (*TiledFillChooser)(GCPtr); } XAAOverlayRec, *XAAOverlayPtr; -static int XAAOverlayIndex = -1; -static unsigned long XAAOverlayGeneration = 0; +static DevPrivateKey XAAOverlayKey = &XAAOverlayKey; #define GET_OVERLAY_PRIV(pScreen) \ - ((XAAOverlayPtr)((pScreen)->devPrivates[XAAOverlayIndex].ptr)) + (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey) #define SWITCH_DEPTH(d) \ if(pOverPriv->currentDepth != d) { \ @@ -173,18 +172,10 @@ XAAInitDualFramebufferOverlay( XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAOverlayPtr pOverPriv; - if (XAAOverlayGeneration != serverGeneration) { - if((XAAOverlayIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - - XAAOverlayGeneration = serverGeneration; - } - - if(!(pOverPriv = xalloc(sizeof(XAAOverlayRec)))) return FALSE; - pScreen->devPrivates[XAAOverlayIndex].ptr = (pointer)pOverPriv; + dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv); pOverPriv->pScrn = pScrn; pOverPriv->callback = callback; diff --git a/hw/xfree86/xaa/xaaStateChange.c b/hw/xfree86/xaa/xaaStateChange.c index 02c556b33..443bda628 100644 --- a/hw/xfree86/xaa/xaaStateChange.c +++ b/hw/xfree86/xaa/xaaStateChange.c @@ -274,18 +274,17 @@ typedef struct _XAAStateWrapRec { #endif } XAAStateWrapRec, *XAAStateWrapPtr; -static int XAAStateIndex = -1; -static unsigned long XAAStateGeneration = 0; +static DevPrivateKey XAAStateKey = &XAAStateKey; /* Wrap functions start here */ #define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\ -(XAAStateWrapPtr)(pGC->pScreen->devPrivates[XAAStateIndex].ptr) +(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey) #define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\ -(XAAStateWrapPtr)(pScreen->devPrivates[XAAStateIndex].ptr) +(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey) #define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\ -(XAAStateWrapPtr)(pScrn->pScreen->devPrivates[XAAStateIndex].ptr) +(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey) #define STATE_CHECK_SP(pStatePriv) {\ ScrnInfoPtr pScrn = pStatePriv->pScrn;\ @@ -1504,12 +1503,8 @@ XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec) XAAStateWrapPtr pStatePriv; int i = 0; - if (XAAStateGeneration != serverGeneration) { - if((XAAStateIndex = AllocateScreenPrivateIndex()) < 0) return FALSE; - XAAStateGeneration = serverGeneration; - } if(!(pStatePriv = xalloc(sizeof(XAAStateWrapRec)))) return FALSE; - pScreen->devPrivates[XAAStateIndex].ptr = (pointer)pStatePriv; + dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv); pStatePriv->RestoreAccelState = infoRec->RestoreAccelState; pStatePriv->pScrn = pScrn; diff --git a/hw/xfree86/xaa/xaaWrapper.c b/hw/xfree86/xaa/xaaWrapper.c index b0176f03f..5d6ea05cf 100644 --- a/hw/xfree86/xaa/xaaWrapper.c +++ b/hw/xfree86/xaa/xaaWrapper.c @@ -86,10 +86,8 @@ typedef struct { int depth; } xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr; -#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr)( \ - (xaaWrapperScrPrivateIndex != -1) \ - ? (s)->devPrivates[xaaWrapperScrPrivateIndex].ptr\ - : NULL)) +#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr) \ + dixLookupPrivate(&(s)->devPrivates, xaaWrapperScrPrivateKey)) #define xaaWrapperScrPriv(s) xaaWrapperScrPrivPtr pScrPriv = xaaWrapperGetScrPriv(s) #define wrap(priv,real,mem,func) {\ @@ -127,13 +125,12 @@ typedef struct _xaaWrapperGCPriv { } xaaWrapperGCPrivRec, *xaaWrapperGCPrivPtr; #define xaaWrapperGetGCPriv(pGC) ((xaaWrapperGCPrivPtr) \ - (pGC)->devPrivates[xaaWrapperGCPrivateIndex].ptr) + dixLookupPrivate(&(pGC)->devPrivates, xaaWrapperGCPrivateKey)) #define xaaWrapperGCPriv(pGC) xaaWrapperGCPrivPtr pGCPriv = xaaWrapperGetGCPriv(pGC) -static int xaaWrapperScrPrivateIndex = -1; -static int xaaWrapperGCPrivateIndex = -1; -static int xaaWrapperGeneration = -1; +static DevPrivateKey xaaWrapperScrPrivateKey = &xaaWrapperScrPrivateKey; +static DevPrivateKey xaaWrapperGCPrivateKey = &xaaWrapperGCPrivateKey; static Bool xaaWrapperCreateScreenResources(ScreenPtr pScreen) @@ -274,18 +271,8 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f #ifdef RENDER PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif - if (xaaWrapperGeneration != serverGeneration) { - xaaWrapperScrPrivateIndex = AllocateScreenPrivateIndex (); - if (xaaWrapperScrPrivateIndex == -1) - return FALSE; - xaaWrapperGCPrivateIndex = AllocateGCPrivateIndex (); - if (xaaWrapperGCPrivateIndex == -1) - return FALSE; - xaaWrapperGeneration = serverGeneration; - } - if (!AllocateGCPrivate (pScreen, xaaWrapperGCPrivateIndex, - sizeof (xaaWrapperGCPrivRec))) + if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec))) return FALSE; pScrPriv = (xaaWrapperScrPrivPtr) xalloc (sizeof (xaaWrapperScrPrivRec)); @@ -335,7 +322,7 @@ xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *f } #endif pScrPriv->depth = depth; - pScreen->devPrivates[xaaWrapperScrPrivateIndex].ptr = (pointer) pScrPriv; + dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv); *func = XAASync; @@ -486,8 +473,8 @@ xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst, void XAASync(ScreenPtr pScreen) { - XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAGetScreenIndex()].ptr; + XAAScreenPtr pScreenPriv = (XAAScreenPtr) + dixLookupPrivate(&pScreen->devPrivates, XAAGetScreenKey()); XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec; if(infoRec->NeedToSync) { diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h index 686cc876d..e25b9df52 100644 --- a/hw/xfree86/xaa/xaalocal.h +++ b/hw/xfree86/xaa/xaalocal.h @@ -1629,9 +1629,9 @@ XAAGetPixelFromRGBA ( extern GCOps XAAFallbackOps; extern GCOps *XAAGetFallbackOps(void); extern GCFuncs XAAGCFuncs; -extern int XAAGetScreenIndex(void); -extern int XAAGetGCIndex(void); -extern int XAAGetPixmapIndex(void); +extern DevPrivateKey XAAGetScreenKey(void); +extern DevPrivateKey XAAGetGCKey(void); +extern DevPrivateKey XAAGetPixmapKey(void); extern unsigned int XAAShiftMasks[32]; @@ -1640,28 +1640,28 @@ extern unsigned int byte_expand3[256], byte_reversed_expand3[256]; CARD32 XAAReverseBitOrder(CARD32 data); #define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\ - (pScreen)->devPrivates[XAAGetScreenIndex()].ptr + dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()) #define GET_XAASCREENPTR_FROM_GC(pGC)\ - (pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr + dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()) #define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\ - (pDraw)->pScreen->devPrivates[XAAGetScreenIndex()].ptr + dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()) #define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\ - ((XAAScreenPtr)((pScreen)->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec +((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec #define GET_XAAINFORECPTR_FROM_GC(pGC)\ -((XAAScreenPtr)((pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec +((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec #define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\ -((XAAScreenPtr)((pDraw)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec +((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec #define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\ -((XAAScreenPtr)((pScrn)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec +((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec #define XAA_GET_PIXMAP_PRIVATE(pix)\ - (XAAPixmapPtr)((pix)->devPrivates[XAAGetPixmapIndex()].ptr) + (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey()) #define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff)) diff --git a/hw/xfree86/xaa/xaawrap.h b/hw/xfree86/xaa/xaawrap.h index 32c17a60c..38c97d70b 100644 --- a/hw/xfree86/xaa/xaawrap.h +++ b/hw/xfree86/xaa/xaawrap.h @@ -1,14 +1,14 @@ #define XAA_SCREEN_PROLOGUE(pScreen, field)\ ((pScreen)->field = \ - ((XAAScreenPtr) (pScreen)->devPrivates[XAAGetScreenIndex()].ptr)->field) + ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field) #define XAA_SCREEN_EPILOGUE(pScreen, field, wrapper)\ ((pScreen)->field = wrapper) #define XAA_GC_FUNC_PROLOGUE(pGC)\ - XAAGCPtr pGCPriv = (XAAGCPtr) (pGC)->devPrivates[XAAGetGCIndex()].ptr;\ + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ (pGC)->funcs = pGCPriv->wrapFuncs;\ if(pGCPriv->flags)\ (pGC)->ops = pGCPriv->wrapOps @@ -24,13 +24,13 @@ #define XAA_GC_OP_PROLOGUE(pGC)\ - XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\ + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ GCFuncs *oldFuncs = pGC->funcs;\ pGC->funcs = pGCPriv->wrapFuncs;\ pGC->ops = pGCPriv->wrapOps #define XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC)\ - XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\ + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ GCFuncs *oldFuncs = pGC->funcs;\ if(!REGION_NUM_RECTS(pGC->pCompositeClip)) return; \ pGC->funcs = pGCPriv->wrapFuncs;\ @@ -44,7 +44,7 @@ #define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\ - XAAGCPtr pGCPriv = (XAAGCPtr)(pGC->devPrivates[XAAGetGCIndex()].ptr);\ + XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\ GCFuncs *oldFuncs = pGC->funcs;\ pGC->funcs = pGCPriv->wrapFuncs;\ @@ -64,7 +64,7 @@ #ifdef RENDER #define XAA_RENDER_PROLOGUE(pScreen,field)\ (GetPictureScreen(pScreen)->field = \ - ((XAAScreenPtr) (pScreen)->devPrivates[XAAGetScreenIndex()].ptr)->field) + ((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->field) #define XAA_RENDER_EPILOGUE(pScreen, field, wrapper)\ (GetPictureScreen(pScreen)->field = wrapper) @@ -74,7 +74,7 @@ #define SYNC_CHECK(pGC) {\ XAAInfoRecPtr infoRec =\ -((XAAScreenPtr)((pGC)->pScreen->devPrivates[XAAGetScreenIndex()].ptr))->AccelInfoRec;\ +((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec; \ if(infoRec->NeedToSync) {\ (*infoRec->Sync)(infoRec->pScrn);\ infoRec->NeedToSync = FALSE;\ diff --git a/hw/xfree86/xf4bpp/mfbfillarc.c b/hw/xfree86/xf4bpp/mfbfillarc.c index d5b5372f5..89aeadd2b 100644 --- a/hw/xfree86/xf4bpp/mfbfillarc.c +++ b/hw/xfree86/xf4bpp/mfbfillarc.c @@ -253,7 +253,8 @@ xf4bppPolyFillArcSolid mfbPrivGC *priv; int rop; - priv = (mfbPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr; + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); rop = priv->rop; if ((rop == RROP_NOP) || !(pGC->planemask & 1)) #else diff --git a/hw/xfree86/xf4bpp/mfbimggblt.c b/hw/xfree86/xf4bpp/mfbimggblt.c index 73e7ce064..4f9561161 100644 --- a/hw/xfree86/xf4bpp/mfbimggblt.c +++ b/hw/xfree86/xf4bpp/mfbimggblt.c @@ -149,7 +149,8 @@ xf4bppImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) backrect.height = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); - pPrivGC = pGC->devPrivates[mfbGetGCPrivateIndex()].ptr; + pPrivGC = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); oldfillStyle = pPrivGC->colorRrop.fillStyle; /* GJA */ oldfg = pPrivGC->colorRrop.fgPixel; /* GJA */ oldalu = pPrivGC->colorRrop.alu; /* GJA */ diff --git a/hw/xfree86/xf4bpp/mfbzerarc.c b/hw/xfree86/xf4bpp/mfbzerarc.c index c7a8c4d56..61fc7b184 100644 --- a/hw/xfree86/xf4bpp/mfbzerarc.c +++ b/hw/xfree86/xf4bpp/mfbzerarc.c @@ -108,7 +108,8 @@ v16ZeroArcSS int pmask; register int *paddr; - if (((mfbPrivGC *)(pGC->devPrivates[mfbGetGCPrivateIndex()].ptr))->rop == + if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop == RROP_BLACK) pixel = 0; else diff --git a/hw/xfree86/xf4bpp/ppcArea.c b/hw/xfree86/xf4bpp/ppcArea.c index e95696260..df7856a35 100644 --- a/hw/xfree86/xf4bpp/ppcArea.c +++ b/hw/xfree86/xf4bpp/ppcArea.c @@ -49,7 +49,7 @@ int alu ; unsigned long int fg, bg, pm ; int xSrc, ySrc ; PixmapPtr pPixmap ; -ppcPrivGC *pPrivGC = pGC->devPrivates[mfbGetGCPrivateIndex()].ptr; +ppcPrivGC *pPrivGC = dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); TRACE( ( "xf4bppFillArea(0x%x,%d,0x%x,0x%x)\n", pWin, nboxes, pBox, pGC ) ) ; diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c index 674a38b78..7ef312d39 100644 --- a/hw/xfree86/xf4bpp/ppcGC.c +++ b/hw/xfree86/xf4bpp/ppcGC.c @@ -182,7 +182,7 @@ register GCPtr pGC ; * a pointer to a ppcPrivGC in its slot. */ *pPriv = vgaPrototypeGCPriv; - (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr) = (pointer) pPriv; + dixSetPrivate(&pGC->devPrivates, mfbGetGCPrivateKey(), pPriv); /* Set the vgaGCOps */ *pOps = vgaGCOps; @@ -202,7 +202,7 @@ xf4bppDestroyGC( pGC ) if ( pGC->freeCompClip && pGC->pCompositeClip ) REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip); if(pGC->ops->devPrivate.val) xfree( pGC->ops ); - xfree( pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ; + xfree(dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey())); return ; } @@ -213,7 +213,7 @@ ppcChangePixmapGC register Mask changes ) { -register ppcPrivGCPtr devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ; +register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); register unsigned long int idx ; /* used for stepping through bitfields */ #define LOWBIT( x ) ( x & - x ) /* Two's complement */ @@ -291,8 +291,8 @@ xf4bppValidateGC( pGC, changes, pDrawable ) register ppcPrivGCPtr devPriv ; WindowPtr pWin ; - devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ; - + devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); if ( pDrawable->type != devPriv->lastDrawableType ) { devPriv->lastDrawableType = pDrawable->type ; xf4bppChangeGCtype( pGC, devPriv ) ; diff --git a/hw/xfree86/xf4bpp/ppcPixFS.c b/hw/xfree86/xf4bpp/ppcPixFS.c index dfc648660..9fd29efce 100644 --- a/hw/xfree86/xf4bpp/ppcPixFS.c +++ b/hw/xfree86/xf4bpp/ppcPixFS.c @@ -124,7 +124,7 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) return ; } - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()))->colorRrop.alu ) == GXnoop ) return ; n = nInit * miFindMaxBand(pGC->pCompositeClip) ; @@ -142,8 +142,8 @@ xf4bppSolidPixmapFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted ) ; - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; - fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ; for ( ; n-- ; ppt++, pwidth++ ) { @@ -258,14 +258,14 @@ int fSorted ; return ; } - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) return ; SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, pptFree, pwidth, ppt, fSorted ) ; - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; - fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; pTile = pGC->stipple ; tlwidth = pTile->devKind ; @@ -356,15 +356,15 @@ int fSorted ; return ; } - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) return ; SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, pptFree, pwidth, ppt, fSorted ) ; - fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ; - bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.bgPixel ; - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ; pTile = pGC->stipple ; @@ -459,14 +459,14 @@ int fSorted ; return ; } - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) return ; SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, pptFree, pwidth, ppt, fSorted ) ; /* the following code is for 8 bits per pixel addressable memory only */ - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; npm = ( ~ pm ) & ( ( 1 << pDrawable->depth ) - 1 ) ; pTile = pGC->tile.pixmap ; tileWidth = pTile->drawable.width ; diff --git a/hw/xfree86/xf4bpp/ppcPixmap.c b/hw/xfree86/xf4bpp/ppcPixmap.c index 73524c3fc..d04aacf82 100644 --- a/hw/xfree86/xf4bpp/ppcPixmap.c +++ b/hw/xfree86/xf4bpp/ppcPixmap.c @@ -139,6 +139,7 @@ xf4bppCopyPixmap(pSrc) pDst = xalloc(sizeof(PixmapRec) + size); if (!pDst) return NullPixmap; + pDst->devPrivates = NULL; pDst->drawable = pSrc->drawable; pDst->drawable.id = 0; pDst->drawable.serialNumber = NEXT_SERIAL_NUMBER; diff --git a/hw/xfree86/xf4bpp/ppcPolyPnt.c b/hw/xfree86/xf4bpp/ppcPolyPnt.c index 1d6905563..c61fd6d26 100644 --- a/hw/xfree86/xf4bpp/ppcPolyPnt.c +++ b/hw/xfree86/xf4bpp/ppcPolyPnt.c @@ -102,7 +102,7 @@ if ( pDrawable->type == DRAWABLE_PIXMAP ) { return ; } -devPriv = (ppcPrivGC *) ( pGC->devPrivates[mfbGetGCPrivateIndex()].ptr ) ; +devPriv = (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); if ( ( alu = devPriv->colorRrop.alu ) == GXnoop ) return ; diff --git a/hw/xfree86/xf4bpp/ppcWinFS.c b/hw/xfree86/xf4bpp/ppcWinFS.c index 78001d793..1522afd9e 100644 --- a/hw/xfree86/xf4bpp/ppcWinFS.c +++ b/hw/xfree86/xf4bpp/ppcWinFS.c @@ -96,7 +96,7 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) return ; } - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) return ; n = nInit * miFindMaxBand( pGC->pCompositeClip ) ; @@ -114,8 +114,8 @@ xf4bppSolidWindowFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) n = miClipSpans( pGC->pCompositeClip, pptInit, pwidthInit, nInit, ppt, pwidth, fSorted ) ; - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; - fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; for ( ; n-- ; ppt++, pwidth++ ) if ( *pwidth ) @@ -163,14 +163,14 @@ int fSorted ; return ; } - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) return ; SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, pptFree, pwidth, ppt, fSorted ) ; - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; - fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; xSrc = pGC->patOrg.x + pDrawable->x ; ySrc = pGC->patOrg.y + pDrawable->y ; @@ -215,15 +215,15 @@ int fSorted ; return ; } - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) return ; SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, pptFree, pwidth, ppt, fSorted ) ; - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; - fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.fgPixel ; - bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.bgPixel ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; + fg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.fgPixel ; + bg = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.bgPixel ; xSrc = pGC->patOrg.x + pDrawable->x ; ySrc = pGC->patOrg.y + pDrawable->y ; @@ -260,7 +260,7 @@ int fSorted ; TRACE( ( "xf4bppTileWindowFS(pDrawable=0x%x,pGC=0x%x,nInit=%d,pptInit=0x%x,pwidthInit=0x%x,fSorted=%d)\n", pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; - if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.alu ) == GXnoop ) + if ( ( alu = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.alu ) == GXnoop ) return ; SETSPANPTRS( nInit, n, pwidthInit, pwidthFree, pptInit, @@ -268,7 +268,7 @@ int fSorted ; xSrc = pGC->patOrg.x + pDrawable->x ; ySrc = pGC->patOrg.y + pDrawable->y ; - pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGetGCPrivateIndex()].ptr )->colorRrop.planemask ; + pm = ( (ppcPrivGC *)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()) )->colorRrop.planemask ; for ( ; n-- ; ppt++, pwidth++ ) xf4bppTileRect( (WindowPtr)pDrawable, pGC->tile.pixmap, alu, pm, diff --git a/hw/xfree86/xf4bpp/vgaGC.c b/hw/xfree86/xf4bpp/vgaGC.c index 5a8604090..6495e5638 100644 --- a/hw/xfree86/xf4bpp/vgaGC.c +++ b/hw/xfree86/xf4bpp/vgaGC.c @@ -107,7 +107,7 @@ xf4bppChangeWindowGC( pGC, changes ) register GC *pGC ; register Mask changes ; { -register ppcPrivGCPtr devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGetGCPrivateIndex()].ptr) ; +register ppcPrivGCPtr devPriv = (ppcPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, mfbGetGCPrivateKey()); register unsigned long int idx ; /* used for stepping through bitfields */ #define LOWBIT( x ) ( x & - x ) /* Two's complement */ diff --git a/hw/xfree86/xf8_32bpp/cfb8_32.h b/hw/xfree86/xf8_32bpp/cfb8_32.h index e14096568..6e985da20 100644 --- a/hw/xfree86/xf8_32bpp/cfb8_32.h +++ b/hw/xfree86/xf8_32bpp/cfb8_32.h @@ -22,10 +22,8 @@ typedef struct { } cfb8_32ScreenRec, *cfb8_32ScreenPtr; -extern int cfb8_32GCPrivateIndex; /* XXX */ -extern int cfb8_32GetGCPrivateIndex(void); -extern int cfb8_32ScreenPrivateIndex; /* XXX */ -extern int cfb8_32GetScreenPrivateIndex(void); +extern DevPrivateKey cfb8_32GetGCPrivateKey(void); +extern DevPrivateKey cfb8_32GetScreenPrivateKey(void); RegionPtr cfb8_32CopyArea( @@ -182,11 +180,11 @@ cfb8_32ChangeWindowAttributes( ); -#define CFB8_32_GET_GC_PRIVATE(pGC)\ - (cfb8_32GCPtr)((pGC)->devPrivates[cfb8_32GetGCPrivateIndex()].ptr) +#define CFB8_32_GET_GC_PRIVATE(pGC) ((cfb8_32GCPtr) \ + dixLookupPrivate(&(pGC)->devPrivates, cfb8_32GetGCPrivateKey())) -#define CFB8_32_GET_SCREEN_PRIVATE(pScreen)\ - (cfb8_32ScreenPtr)((pScreen)->devPrivates[cfb8_32GetScreenPrivateIndex()].ptr) +#define CFB8_32_GET_SCREEN_PRIVATE(pScreen) ((cfb8_32ScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, cfb8_32GetScreenPrivateKey())) Bool xf86Overlay8Plus32Init (ScreenPtr pScreen); diff --git a/hw/xfree86/xf8_32bpp/cfbscrinit.c b/hw/xfree86/xf8_32bpp/cfbscrinit.c index 5e2657f2b..c3432b803 100644 --- a/hw/xfree86/xf8_32bpp/cfbscrinit.c +++ b/hw/xfree86/xf8_32bpp/cfbscrinit.c @@ -31,38 +31,37 @@ /* CAUTION: We require that cfb8 and cfb32 were NOT compiled with CFB_NEED_SCREEN_PRIVATE */ -int cfb8_32GCPrivateIndex; -int cfb8_32GetGCPrivateIndex(void) { return cfb8_32GCPrivateIndex; } -int cfb8_32ScreenPrivateIndex; -int cfb8_32GetScreenPrivateIndex(void) { return cfb8_32ScreenPrivateIndex; } -static unsigned long cfb8_32Generation = 0; +static DevPrivateKey cfb8_32GCPrivateKey = &cfb8_32GCPrivateKey; +DevPrivateKey cfb8_32GetGCPrivateKey(void) +{ + return cfb8_32GCPrivateKey; +} + +static DevPrivateKey cfb8_32ScreenPrivateKey = &cfb8_32ScreenPrivateKey; +DevPrivateKey cfb8_32GetScreenPrivateKey(void) +{ + return cfb8_32ScreenPrivateKey; +} static Bool cfb8_32AllocatePrivates(ScreenPtr pScreen) { cfb8_32ScreenPtr pScreenPriv; - if(cfb8_32Generation != serverGeneration) { - if(((cfb8_32GCPrivateIndex = AllocateGCPrivateIndex()) < 0) || - ((cfb8_32ScreenPrivateIndex = AllocateScreenPrivateIndex()) < 0)) - return FALSE; - cfb8_32Generation = serverGeneration; - } - if (!(pScreenPriv = xalloc(sizeof(cfb8_32ScreenRec)))) return FALSE; - pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, pScreenPriv); /* All cfb will have the same GC and Window private indicies */ - if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateIndex)) + if(!mfbAllocatePrivates(pScreen, &cfbGCPrivateKey)) return FALSE; - if(!AllocateGCPrivate(pScreen, cfbGCPrivateIndex, sizeof(cfbPrivGC))) + if(!dixRequestPrivate(cfbGCPrivateKey, sizeof(cfbPrivGC))) return FALSE; - if(!AllocateGCPrivate(pScreen, cfb8_32GCPrivateIndex, sizeof(cfb8_32GCRec))) + if(!dixRequestPrivate(cfb8_32GCPrivateKey, sizeof(cfb8_32GCRec))) return FALSE; return TRUE; @@ -160,7 +159,7 @@ cfb8_32CloseScreen (int i, ScreenPtr pScreen) xfree(pScreenPriv->visualData); xfree((pointer) pScreenPriv); - pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, cfb8_32ScreenPrivateKey, NULL); return(cfb32CloseScreen(i, pScreen)); } diff --git a/hw/xfree86/xf8_32bpp/xf86overlay.c b/hw/xfree86/xf8_32bpp/xf86overlay.c index 47b2b52db..c63b3cfd1 100644 --- a/hw/xfree86/xf8_32bpp/xf86overlay.c +++ b/hw/xfree86/xf8_32bpp/xf86overlay.c @@ -177,23 +177,22 @@ typedef struct { } OverlayPixmapRec, *OverlayPixmapPtr; -static int OverlayScreenIndex = -1; -static int OverlayGCIndex = -1; -static int OverlayPixmapIndex = -1; -static unsigned long OverlayGeneration = 0; +static DevPrivateKey OverlayScreenKey = &OverlayScreenKey; +static DevPrivateKey OverlayGCKey = &OverlayGCKey; +static DevPrivateKey OverlayPixmapKey = &OverlayPixmapKey; /** Macros **/ #define TILE_EXISTS(pGC) (!(pGC)->tileIsPixel && (pGC)->tile.pixmap) -#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) \ - (OverlayPixmapPtr)((pPix)->devPrivates[OverlayPixmapIndex].ptr) +#define OVERLAY_GET_PIXMAP_PRIVATE(pPix) ((OverlayPixmapPtr) \ + dixLookupPrivate(&(pPix)->devPrivates, OverlayPixmapKey)) -#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) \ - (OverlayScreenPtr)((pScreen)->devPrivates[OverlayScreenIndex].ptr) +#define OVERLAY_GET_SCREEN_PRIVATE(pScreen) ((OverlayScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, OverlayScreenKey)) -#define OVERLAY_GET_GC_PRIVATE(pGC) \ - (OverlayGCPtr)((pGC)->devPrivates[OverlayGCIndex].ptr) +#define OVERLAY_GET_GC_PRIVATE(pGC) ((OverlayGCPtr) \ + dixLookupPrivate(&(pGC)->devPrivates, OverlayGCKey)) #define OVERLAY_GC_FUNC_PROLOGUE(pGC)\ OverlayGCPtr pGCPriv = OVERLAY_GET_GC_PRIVATE(pGC);\ @@ -255,26 +254,16 @@ xf86Overlay8Plus32Init (ScreenPtr pScreen) { OverlayScreenPtr pScreenPriv; - if(OverlayGeneration != serverGeneration) { - if(((OverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((OverlayGCIndex = AllocateGCPrivateIndex()) < 0) || - ((OverlayPixmapIndex = AllocatePixmapPrivateIndex()) < 0)) - return FALSE; - - OverlayGeneration = serverGeneration; - } - - if (!AllocateGCPrivate(pScreen, OverlayGCIndex, sizeof(OverlayGCRec))) + if (!dixRequestPrivate(OverlayGCKey, sizeof(OverlayGCRec))) return FALSE; - if (!AllocatePixmapPrivate(pScreen, OverlayPixmapIndex, - sizeof(OverlayPixmapRec))) + if (!dixRequestPrivate(OverlayPixmapKey, sizeof(OverlayPixmapRec))) return FALSE; if (!(pScreenPriv = xalloc(sizeof(OverlayScreenRec)))) return FALSE; - pScreen->devPrivates[OverlayScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, OverlayScreenKey, pScreenPriv); pScreenPriv->CreateGC = pScreen->CreateGC; pScreenPriv->CloseScreen = pScreen->CloseScreen; diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c index 981cffcfa..774e00eb5 100644 --- a/hw/xgl/egl/kinput.c +++ b/hw/xgl/egl/kinput.c @@ -439,7 +439,7 @@ KdKeybdProc(DeviceIntPtr pDevice, int onoff) switch (onoff) { case DEVICE_INIT: - if (pDev != LookupKeyboardDevice()) + if (pDev != (DevicePtr)inputInfo.keyboard) { return !Success; } diff --git a/hw/xgl/egl/xegl.c b/hw/xgl/egl/xegl.c index c671dbe7c..1cf615bb6 100644 --- a/hw/xgl/egl/xegl.c +++ b/hw/xgl/egl/xegl.c @@ -42,14 +42,13 @@ #define XEGL_DEFAULT_SCREEN_WIDTH 800 #define XEGL_DEFAULT_SCREEN_HEIGHT 600 -int xeglScreenGeneration = -1; -int xeglScreenPrivateIndex; +DevPrivateKey xeglScreenPrivateKey = &xeglScreenPrivateKey; -#define XEGL_GET_SCREEN_PRIV(pScreen) \ - ((xeglScreenPtr) (pScreen)->devPrivates[xeglScreenPrivateIndex].ptr) +#define XEGL_GET_SCREEN_PRIV(pScreen) ((xeglScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey)) -#define XEGL_SET_SCREEN_PRIV(pScreen, v) \ - ((pScreen)->devPrivates[xeglScreenPrivateIndex].ptr = (pointer) v) +#define XEGL_SET_SCREEN_PRIV(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey, v) #define XEGL_SCREEN_PRIV(pScreen) \ xeglScreenPtr pScreenPriv = XEGL_GET_SCREEN_PRIV (pScreen) @@ -66,15 +65,6 @@ xeglAllocatePrivates (ScreenPtr pScreen) { xeglScreenPtr pScreenPriv; - if (xeglScreenGeneration != serverGeneration) - { - xeglScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (xeglScreenPrivateIndex < 0) - return FALSE; - - xeglScreenGeneration = serverGeneration; - } - pScreenPriv = xalloc (sizeof (xeglScreenRec)); if (!pScreenPriv) return FALSE; diff --git a/hw/xgl/egl/xegl.h b/hw/xgl/egl/xegl.h index be9b48c9c..0a07397bf 100644 --- a/hw/xgl/egl/xegl.h +++ b/hw/xgl/egl/xegl.h @@ -109,7 +109,7 @@ extern KdMouseInfo *kdMouseInfo; extern KdOsFuncs *kdOsFuncs; extern Bool kdDontZap; extern Bool kdDisableZaphod; -extern int xeglScreenPrivateIndex; +extern DevPrivateKey xeglScreenPrivateKey; extern KdMouseFuncs LinuxEvdevMouseFuncs; extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs; @@ -117,8 +117,8 @@ extern KdKeyboardFuncs LinuxEvdevKeyboardFuncs; (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270) #define RR_Reflect_All (RR_Reflect_X | RR_Reflect_Y) -#define KdGetScreenPriv(pScreen) \ - ((xeglScreenPtr) ((pScreen)->devPrivates[xeglScreenPrivateIndex].ptr)) +#define KdGetScreenPriv(pScreen) ((xeglScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xeglScreenPrivateKey)) #define KdScreenPriv(pScreen) \ xeglScreenPtr pScreenPriv = KdGetScreenPriv (pScreen) diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c index 73cc699c4..2833e577b 100644 --- a/hw/xgl/glx/xglx.c +++ b/hw/xgl/glx/xglx.c @@ -105,14 +105,13 @@ typedef struct _xglxScreen { CloseScreenProcPtr CloseScreen; } xglxScreenRec, *xglxScreenPtr; -int xglxScreenGeneration = -1; -int xglxScreenPrivateIndex; +DevPrivateKey xglxScreenPrivateKey = &xglxScreenPrivateKey; -#define XGLX_GET_SCREEN_PRIV(pScreen) \ - ((xglxScreenPtr) (pScreen)->devPrivates[xglxScreenPrivateIndex].ptr) +#define XGLX_GET_SCREEN_PRIV(pScreen) ((xglxScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey)) -#define XGLX_SET_SCREEN_PRIV(pScreen, v) \ - ((pScreen)->devPrivates[xglxScreenPrivateIndex].ptr = (pointer) v) +#define XGLX_SET_SCREEN_PRIV(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, xglxScreenPrivateKey, v) #define XGLX_SCREEN_PRIV(pScreen) \ xglxScreenPtr pScreenPriv = XGLX_GET_SCREEN_PRIV (pScreen) @@ -122,10 +121,10 @@ typedef struct _xglxCursor { } xglxCursorRec, *xglxCursorPtr; #define XGLX_GET_CURSOR_PRIV(pCursor, pScreen) \ - ((xglxCursorPtr) (pCursor)->devPriv[(pScreen)->myNum]) + ((xglxCursorPtr)dixLookupPrivate(&(pCursor)->devPrivates, pScreen)) #define XGLX_SET_CURSOR_PRIV(pCursor, pScreen, v) \ - ((pCursor)->devPriv[(pScreen)->myNum] = (pointer) v) + dixSetPrivate(&(pCursor)->devPrivates, pScreen, v) #define XGLX_CURSOR_PRIV(pCursor, pScreen) \ xglxCursorPtr pCursorPriv = XGLX_GET_CURSOR_PRIV (pCursor, pScreen) @@ -148,15 +147,6 @@ xglxAllocatePrivates (ScreenPtr pScreen) { xglxScreenPtr pScreenPriv; - if (xglxScreenGeneration != serverGeneration) - { - xglxScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (xglxScreenPrivateIndex < 0) - return FALSE; - - xglxScreenGeneration = serverGeneration; - } - pScreenPriv = xalloc (sizeof (xglxScreenRec)); if (!pScreenPriv) return FALSE; @@ -1119,6 +1109,9 @@ xglxKeybdProc (DeviceIntPtr pDev, int xkbOp, xkbEvent, xkbError, xkbMajor, xkbMinor; #endif + if (pDev != (DevicePtr)inputInfo.keyboard) + return !Success; + xmodMap = XGetModifierMapping (xdisplay); XDisplayKeycodes (xdisplay, &minKeyCode, &maxKeyCode); diff --git a/hw/xgl/glx/xglxorg.c b/hw/xgl/glx/xglxorg.c index 984c50ee2..1d6fc9a30 100644 --- a/hw/xgl/glx/xglxorg.c +++ b/hw/xgl/glx/xglxorg.c @@ -253,8 +253,6 @@ xglxArgRec xorgUidArgs[] = { xglxArgRec xorgArgs[] = { ARG (xglxProcessXorgWaitExitArgument, "-probeonly", " probe for devices, then exit"), - ARG (xglxProcessXorgWaitExitArgument, "-scanpci", - " execute the scanpci module and exit"), XORG_UARG ("-verbose", " [n] verbose startup messages", 2), XORG_UARG ("-logverbose", " [n] verbose log messages", 2), XORG_UARG ("-quiet", " minimal startup messages", 1), diff --git a/hw/xgl/xglinput.c b/hw/xgl/xglinput.c index a08fd10f6..e9278a48f 100644 --- a/hw/xgl/xglinput.c +++ b/hw/xgl/xglinput.c @@ -229,7 +229,7 @@ xglKeybdProc (DeviceIntPtr pDevice, switch (onoff) { case DEVICE_INIT: - if (pDev != LookupKeyboardDevice ()) + if (pDev != (DevicePtr)inputInfo.keyboard) return !Success; ret = InitKeyboardDeviceStruct (pDev, diff --git a/hw/xgl/xglscreen.c b/hw/xgl/xglscreen.c index c2b35d642..94307f0de 100644 --- a/hw/xgl/xglscreen.c +++ b/hw/xgl/xglscreen.c @@ -474,3 +474,51 @@ xglCloseScreen (int index, return (*pScreen->CloseScreen) (index, pScreen); } + +#ifdef RENDER +void +xglCreateSolidAlphaPicture (ScreenPtr pScreen) +{ + static xRenderColor solidWhite = { 0xffff, 0xffff, 0xffff, 0xffff }; + static xRectangle one = { 0, 0, 1, 1 }; + PixmapPtr pPixmap; + PictFormatPtr pFormat; + int error; + Pixel pixel; + GCPtr pGC; + XID tmpval[2]; + + XGL_SCREEN_PRIV (pScreen); + + pFormat = PictureMatchFormat (pScreen, 32, PICT_a8r8g8b8); + if (!pFormat) + return; + + pGC = GetScratchGC (pFormat->depth, pScreen); + if (!pGC) + return; + + pPixmap = (*pScreen->CreatePixmap) (pScreen, 1, 1, pFormat->depth, 0); + if (!pPixmap) + return; + + miRenderColorToPixel (pFormat, &solidWhite, &pixel); + + tmpval[0] = GXcopy; + tmpval[1] = pixel; + + ChangeGC (pGC, GCFunction | GCForeground, tmpval); + ValidateGC (&pPixmap->drawable, pGC); + (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one); + FreeScratchGC (pGC); + + tmpval[0] = xTrue; + pScreenPriv->pSolidAlpha = CreatePicture (0, &pPixmap->drawable, pFormat, + CPRepeat, tmpval, + serverClient, &error); + (*pScreen->DestroyPixmap) (pPixmap); + + if (pScreenPriv->pSolidAlpha) + ValidatePicture (pScreenPriv->pSolidAlpha); +} +#endif diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c index 134276e7b..138698068 100644 --- a/hw/xnest/Cursor.c +++ b/hw/xnest/Cursor.c @@ -104,8 +104,8 @@ xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) bg_color.green = pCursor->backGreen; bg_color.blue = pCursor->backBlue; - pCursor->devPriv[pScreen->myNum] = (pointer)xalloc(sizeof(xnestPrivCursor)); - xnestCursorPriv(pCursor, pScreen)->cursor = + xnestSetCursorPriv(pCursor, pScreen, xalloc(sizeof(xnestPrivCursor))); + xnestCursor(pCursor, pScreen) = XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color, pCursor->bits->xhot, pCursor->bits->yhot); @@ -119,7 +119,7 @@ Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { XFreeCursor(xnestDisplay, xnestCursor(pCursor, pScreen)); - xfree(xnestCursorPriv(pCursor, pScreen)); + xfree(xnestGetCursorPriv(pCursor, pScreen)); return True; } diff --git a/hw/xnest/Font.c b/hw/xnest/Font.c index 72edcee9a..9f30085b1 100644 --- a/hw/xnest/Font.c +++ b/hw/xnest/Font.c @@ -44,8 +44,10 @@ xnestRealizeFont(ScreenPtr pScreen, FontPtr pFont) FontSetPrivate(pFont, xnestFontPrivateIndex, NULL); +#ifdef XPRINT if (requestingClient && XpClientIsPrintClient(requestingClient, NULL)) return True; +#endif name_atom = MakeAtom("FONT", 4, True); value_atom = 0L; diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c index a52ce1f35..06e6e0205 100644 --- a/hw/xnest/GC.c +++ b/hw/xnest/GC.c @@ -35,7 +35,7 @@ is" without express or implied warranty. #include "XNFont.h" #include "Color.h" -int xnestGCPrivateIndex; +DevPrivateKey xnestGCPrivateKey = &xnestGCPrivateKey; static GCFuncs xnestFuncs = { xnestValidateGC, diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c index 4699111b9..7b344e25f 100644 --- a/hw/xnest/Init.c +++ b/hw/xnest/Init.c @@ -74,8 +74,6 @@ InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) break; } - xnestWindowPrivateIndex = AllocateWindowPrivateIndex(); - xnestGCPrivateIndex = AllocateGCPrivateIndex(); xnestFontPrivateIndex = AllocateFontPrivateIndex(); if (!xnestNumScreens) xnestNumScreens = 1; @@ -124,7 +122,7 @@ void ddxGiveUp() AbortDDX(); } -#ifdef __DARWIN__ +#ifdef __APPLE__ void DarwinHandleGUI(int argc, char *argv[]) { diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c index 922975262..04311966d 100644 --- a/hw/xnest/Pixmap.c +++ b/hw/xnest/Pixmap.c @@ -24,6 +24,7 @@ is" without express or implied warranty. #include "regionstr.h" #include "gc.h" #include "servermd.h" +#include "privates.h" #include "mi.h" #include "Xnest.h" @@ -32,7 +33,7 @@ is" without express or implied warranty. #include "Screen.h" #include "XNPixmap.h" -int xnestPixmapPrivateIndex; +DevPrivateKey xnestPixmapPrivateKey = &xnestPixmapPrivateKey; PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, @@ -56,9 +57,9 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pPixmap->refcnt = 1; pPixmap->devKind = PixmapBytePad(width, depth); - pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr = - (pointer)((char *)pPixmap + pScreen->totalPixmapSize); pPixmap->usage_hint = usage_hint; + dixSetPrivate(&pPixmap->devPrivates, xnestPixmapPrivateKey, + (char *)pPixmap + pScreen->totalPixmapSize); if (width && height) xnestPixmapPriv(pPixmap)->pixmap = XCreatePixmap(xnestDisplay, @@ -76,6 +77,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap) if(--pPixmap->refcnt) return TRUE; XFreePixmap(xnestDisplay, xnestPixmap(pPixmap)); + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index 02e82d193..61a325f3c 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -45,8 +45,6 @@ is" without express or implied warranty. Window xnestDefaultWindows[MAXSCREENS]; Window xnestScreenSaverWindows[MAXSCREENS]; -static int xnestScreenGeneration = -1; - ScreenPtr xnestScreen(Window window) { @@ -142,21 +140,13 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) VisualID defaultVisual; int rootDepth; - if (!(AllocateWindowPrivate(pScreen, xnestWindowPrivateIndex, - sizeof(xnestPrivWin)) && - AllocateGCPrivate(pScreen, xnestGCPrivateIndex, - sizeof(xnestPrivGC)))) + if (!dixRequestPrivate(xnestWindowPrivateKey, sizeof(xnestPrivWin))) + return False; + if (!dixRequestPrivate(xnestGCPrivateKey, sizeof(xnestPrivGC))) return False; - - if (xnestScreenGeneration != serverGeneration) { - if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0) - return False; - xnestScreenGeneration = serverGeneration; - } - - if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex, - sizeof (xnestPrivPixmap))) + if (!dixRequestPrivate(xnestPixmapPrivateKey, sizeof (xnestPrivPixmap))) return False; + visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec)); numVisuals = 0; diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c index e83fb90d5..bc9d8bed2 100644 --- a/hw/xnest/Window.c +++ b/hw/xnest/Window.c @@ -39,7 +39,7 @@ is" without express or implied warranty. #include "Events.h" #include "Args.h" -int xnestWindowPrivateIndex; +DevPrivateKey xnestWindowPrivateKey = &xnestWindowPrivateKey; static int xnestFindWindowMatch(WindowPtr pWin, pointer ptr) diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h index ffec9eb0a..9705f6bea 100644 --- a/hw/xnest/XNCursor.h +++ b/hw/xnest/XNCursor.h @@ -19,11 +19,14 @@ typedef struct { Cursor cursor; } xnestPrivCursor; -#define xnestCursorPriv(pCursor, pScreen) \ - ((xnestPrivCursor *)((pCursor)->devPriv[pScreen->myNum])) +#define xnestGetCursorPriv(pCursor, pScreen) \ + ((xnestPrivCursor *)dixLookupPrivate(&(pCursor)->devPrivates, pScreen)) + +#define xnestSetCursorPriv(pCursor, pScreen, v) \ + dixSetPrivate(&(pCursor)->devPrivates, pScreen, v) #define xnestCursor(pCursor, pScreen) \ - (xnestCursorPriv(pCursor, pScreen)->cursor) + (xnestGetCursorPriv(pCursor, pScreen)->cursor) Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h index d3ac3df0b..19535fe3a 100644 --- a/hw/xnest/XNGC.h +++ b/hw/xnest/XNGC.h @@ -22,10 +22,10 @@ typedef struct { int nClipRects; } xnestPrivGC; -extern int xnestGCPrivateIndex; +extern DevPrivateKey xnestGCPrivateKey; -#define xnestGCPriv(pGC) \ - ((xnestPrivGC *)((pGC)->devPrivates[xnestGCPrivateIndex].ptr)) +#define xnestGCPriv(pGC) ((xnestPrivGC *) \ + dixLookupPrivate(&(pGC)->devPrivates, xnestGCPrivateKey)) #define xnestGC(pGC) (xnestGCPriv(pGC)->gc) diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h index 9eb2a3c70..614827587 100644 --- a/hw/xnest/XNPixmap.h +++ b/hw/xnest/XNPixmap.h @@ -15,14 +15,14 @@ is" without express or implied warranty. #ifndef XNESTPIXMAP_H #define XNESTPIXMAP_H -extern int xnestPixmapPrivateIndex; +extern DevPrivateKey xnestPixmapPrivateKey; typedef struct { Pixmap pixmap; } xnestPrivPixmap; -#define xnestPixmapPriv(pPixmap) \ - ((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr)) +#define xnestPixmapPriv(pPixmap) ((xnestPrivPixmap *) \ + dixLookupPrivate(&(pPixmap)->devPrivates, xnestPixmapPrivateKey)) #define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap) diff --git a/hw/xnest/XNWindow.h b/hw/xnest/XNWindow.h index 6c63f1f76..4cb66c8ce 100644 --- a/hw/xnest/XNWindow.h +++ b/hw/xnest/XNWindow.h @@ -35,10 +35,10 @@ typedef struct { Window window; } xnestWindowMatch; -extern int xnestWindowPrivateIndex; +extern DevPrivateKey xnestWindowPrivateKey; -#define xnestWindowPriv(pWin) \ - ((xnestPrivWin *)((pWin)->devPrivates[xnestWindowPrivateIndex].ptr)) +#define xnestWindowPriv(pWin) ((xnestPrivWin *) \ + dixLookupPrivate(&(pWin)->devPrivates, xnestWindowPrivateKey)) #define xnestWindow(pWin) (xnestWindowPriv(pWin)->window) diff --git a/hw/xprint/Makefile.am b/hw/xprint/Makefile.am index c440473a0..1b8004841 100644 --- a/hw/xprint/Makefile.am +++ b/hw/xprint/Makefile.am @@ -53,3 +53,5 @@ Xprt_SOURCES = \ $(top_srcdir)/fb/fbcmap_mi.c EXTRA_DIST = ValTree.c + +CLEANFILES = miinitext-wrapper.c dpmsstubs-wrapper.c diff --git a/hw/xprint/attributes.c b/hw/xprint/attributes.c index d8ee5adf8..e79360496 100644 --- a/hw/xprint/attributes.c +++ b/hw/xprint/attributes.c @@ -124,7 +124,7 @@ SysAttrs systemAttributes; * attrCtxtPrivIndex hold the attribute store's context private index. * This index is allocated at the time the attribute store is initialized. */ -static int attrCtxtPrivIndex; +static DevPrivateKey attrCtxtPrivKey = &attrCtxtPrivKey; /* * The ContextAttrs structure descibes the context private space reserved @@ -521,8 +521,7 @@ XpBuildAttributeStore( { if(attrList != (PrAttrPtr)NULL) FreeAttrList(); - attrCtxtPrivIndex = XpAllocateContextPrivateIndex(); - XpAllocateContextPrivate(attrCtxtPrivIndex, sizeof(ContextAttrs)); + dixRequestPrivate(attrCtxtPrivKey, sizeof(ContextAttrs)); BuildSystemAttributes(); attrGeneration = serverGeneration; @@ -592,7 +591,8 @@ XpInitAttributes(XpContextPtr pContext) PrAttrPtr pPrAttr = attrList; /* Initialize all the pointers to NULL */ - pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr; + pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, + attrCtxtPrivKey); (void)memset((void *)pCtxtAttrs, 0, (size_t) sizeof(ContextAttrs)); for(pPrAttr = attrList; pPrAttr != (PrAttrPtr)NULL; pPrAttr = pPrAttr->next) @@ -612,8 +612,8 @@ XpDestroyAttributes( { ContextAttrPtr pCtxtAttrs; - pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr; - + pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, + attrCtxtPrivKey); if(pCtxtAttrs->printerAttrs != (XrmDatabase)NULL) XrmDestroyDatabase(pCtxtAttrs->printerAttrs); if(pCtxtAttrs->docAttrs != (XrmDatabase)NULL) @@ -661,7 +661,8 @@ XpGetOneAttribute( } else { - pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr; + pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, + attrCtxtPrivKey); switch(class) { case XPPrinterAttr: @@ -714,7 +715,8 @@ XpPutOneAttribute( XrmBinding bindings[1]; XrmQuark quarks[2]; - pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr; + pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, + attrCtxtPrivKey); switch(class) { case XPPrinterAttr: @@ -900,7 +902,8 @@ XpGetAttributes( db = systemAttributes.server; else { - pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr; + pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, + attrCtxtPrivKey); switch(class) { case XPServerAttr: @@ -952,7 +955,8 @@ XpAugmentAttributes( db = XrmGetStringDatabase(attributes); if(db == (XrmDatabase)NULL) return BadAlloc; - pCtxtAttrs = (ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr; + pCtxtAttrs = (ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, + attrCtxtPrivKey); switch(class) { case XPPrinterAttr: @@ -988,7 +992,8 @@ XpSetAttributes( db = XrmGetStringDatabase(attributes); if(db == (XrmDatabase)NULL) return BadAlloc; - pCtxtAttrs=(ContextAttrPtr)pContext->devPrivates[attrCtxtPrivIndex].ptr; + pCtxtAttrs=(ContextAttrPtr)dixLookupPrivate(&pContext->devPrivates, + attrCtxtPrivKey); switch(class) { case XPPrinterAttr: @@ -1378,7 +1383,7 @@ ReplaceAllKeywords( defined(ISC) || \ defined(Lynx) || \ defined(__QNX__) || \ - defined(__DARWIN__) + defined(__APPLE__) #define iswspace(c) (isascii(c) && isspace(toascii(c))) #endif diff --git a/hw/xprint/ddxInit.c b/hw/xprint/ddxInit.c index 1e7652e60..d744121aa 100644 --- a/hw/xprint/ddxInit.c +++ b/hw/xprint/ddxInit.c @@ -205,7 +205,7 @@ ProcessInputEvents(void) { } -#ifdef __DARWIN__ +#ifdef __APPLE__ #include "micmap.h" void GlxExtensionInit(void); diff --git a/hw/xprint/pcl/Pcl.h b/hw/xprint/pcl/Pcl.h index 0c50ed241..d46a03401 100644 --- a/hw/xprint/pcl/Pcl.h +++ b/hw/xprint/pcl/Pcl.h @@ -83,10 +83,10 @@ typedef char *XPointer; /****** * externally visible variables from PclInit.c ******/ -extern int PclScreenPrivateIndex, PclWindowPrivateIndex; -extern int PclContextPrivateIndex; -extern int PclPixmapPrivateIndex; -extern int PclGCPrivateIndex; +extern DevPrivateKey PclScreenPrivateKey, PclWindowPrivateKey; +extern DevPrivateKey PclContextPrivateKey; +extern DevPrivateKey PclPixmapPrivateKey; +extern DevPrivateKey PclGCPrivateKey; /****** * externally visible variables from PclAttVal.c diff --git a/hw/xprint/pcl/PclArc.c b/hw/xprint/pcl/PclArc.c index 0d8289e33..20d3f723d 100644 --- a/hw/xprint/pcl/PclArc.c +++ b/hw/xprint/pcl/PclArc.c @@ -85,7 +85,7 @@ PclDoArc( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); XpGetReproductionArea( pCon, &repro ); /* diff --git a/hw/xprint/pcl/PclColor.c b/hw/xprint/pcl/PclColor.c index 8b05da056..5e8ffa63c 100644 --- a/hw/xprint/pcl/PclColor.c +++ b/hw/xprint/pcl/PclColor.c @@ -129,8 +129,8 @@ PclCreateColormap(ColormapPtr pColor) PclCmapToContexts *new; PclScreenPrivPtr sPriv; - sPriv = (PclScreenPrivPtr)pColor->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); /* * Use existing code to initialize the values in the colormap @@ -175,8 +175,8 @@ PclDestroyColormap(ColormapPtr pColor) /* * Find the colormap <-> contexts mapping */ - sPriv = (PclScreenPrivPtr)pColor->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); pCmap = sPriv->colormaps; while( pCmap ) { @@ -195,8 +195,8 @@ PclDestroyColormap(ColormapPtr pColor) con = pCmap->contexts; while( con ) { - cPriv = con->context->devPrivates[PclContextPrivateIndex].ptr; - + cPriv = dixLookupPrivate(&con->context->devPrivates, + PclContextPrivateKey); pPal = cPriv->palettes; while( pPal ) { @@ -259,8 +259,8 @@ PclStoreColors(ColormapPtr pColor, char t[80]; int i; - sPriv = (PclScreenPrivPtr)pColor->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey); p = sPriv->colormaps; while( p ) { @@ -278,8 +278,8 @@ PclStoreColors(ColormapPtr pColor, * For each context, get the palette ID and update the * appropriate palette. */ - cPriv = con->context - ->devPrivates[PclContextPrivateIndex].ptr; + cPriv = dixLookupPrivate(&con->context->devPrivates, + PclContextPrivateKey); pMap = PclFindPaletteMap( cPriv, pColor, NULL ); /* @@ -407,7 +407,8 @@ PclUpdateColormap(DrawablePtr pDrawable, unsigned short r, g, b, rr, gg, bb; int i; - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); c = wColormap( win ); cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP ); @@ -436,8 +437,9 @@ PclUpdateColormap(DrawablePtr pDrawable, /* * Add the colormap to the screen-level colormap<->context mapping. */ - sPriv = (PclScreenPrivPtr)cmap->pScreen - ->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&cmap->pScreen->devPrivates, + PclScreenPrivateKey); pCmap = sPriv->colormaps; while( pCmap && ( pCmap->colormapId != cmap->mid ) ) pCmap = pCmap->next; diff --git a/hw/xprint/pcl/PclGC.c b/hw/xprint/pcl/PclGC.c index b47f2833a..fbadf5d5d 100644 --- a/hw/xprint/pcl/PclGC.c +++ b/hw/xprint/pcl/PclGC.c @@ -144,7 +144,8 @@ PclGetDrawablePrivateStuff( return FALSE; else { - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); *gc = cPriv->lastGC; *valid = cPriv->validGC; *file = cPriv->pPageFile; @@ -171,7 +172,8 @@ PclSetDrawablePrivateGC( { case DRAWABLE_PIXMAP: pix = (PixmapPtr)pDrawable; - pixPriv = pix->devPrivates[PclPixmapPrivateIndex].ptr; + pixPriv = (PclPixmapPrivPtr) + dixLookupPrivate(&pix->devPrivates, PclPixmapPrivateKey); pixPriv->lastGC = gc; pixPriv->validGC = 1; @@ -179,8 +181,8 @@ PclSetDrawablePrivateGC( case DRAWABLE_WINDOW: pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - pPriv = ((PclContextPrivPtr) - (pCon->devPrivates[PclContextPrivateIndex].ptr)); + pPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pPriv->validGC = 1; pPriv->lastGC = gc; @@ -316,13 +318,14 @@ PclUpdateDrawableGC( XpContextPtr pCon; PclContextPrivPtr cPriv; PclGCPrivPtr gcPriv = (PclGCPrivPtr) - (pGC->devPrivates[PclGCPrivateIndex].ptr); + dixLookupPrivate(&pGC->devPrivates, PclGCPrivateKey); if( !PclGetDrawablePrivateStuff( pDrawable, &dGC, &valid, outFile ) ) return FALSE; pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Here's where we update the colormap. Since there can be diff --git a/hw/xprint/pcl/PclInit.c b/hw/xprint/pcl/PclInit.c index 574b481d2..e738e3e54 100644 --- a/hw/xprint/pcl/PclInit.c +++ b/hw/xprint/pcl/PclInit.c @@ -67,11 +67,11 @@ static void AllocatePclPrivates(ScreenPtr pScreen); static int PclInitContext(XpContextPtr pCon); static Bool PclDestroyContext(XpContextPtr pCon); -int PclScreenPrivateIndex; -int PclContextPrivateIndex; -int PclPixmapPrivateIndex; -int PclWindowPrivateIndex; -int PclGCPrivateIndex; +DevPrivateKey PclScreenPrivateKey = &PclScreenPrivateKey; +DevPrivateKey PclContextPrivateKey = &PclContextPrivateKey; +DevPrivateKey PclPixmapPrivateKey = &PclPixmapPrivateKey; +DevPrivateKey PclWindowPrivateKey = &PclWindowPrivateKey; +DevPrivateKey PclGCPrivateKey = &PclGCPrivateKey; #ifdef XP_PCL_COLOR /* @@ -119,7 +119,8 @@ Bool PclCloseScreen(int index, ScreenPtr pScreen) { - PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr; + PclScreenPrivPtr pPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); pScreen->CloseScreen = pPriv->CloseScreen; xfree( pPriv ); @@ -157,8 +158,8 @@ InitializePclDriver( */ AllocatePclPrivates(pScreen); - pPriv = - (PclScreenPrivPtr)pScreen->devPrivates[PclScreenPrivateIndex].ptr; + pPriv = (PclScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); maxDim = MAX( pScreen->height, pScreen->width ); xRes = pScreen->width / ( pScreen->mmWidth / 25.4 ); @@ -258,33 +259,13 @@ InitializePclDriver( static void AllocatePclPrivates(ScreenPtr pScreen) { - static unsigned long PclGeneration = 0; + dixRequestPrivate(PclWindowPrivateKey, sizeof( PclWindowPrivRec ) ); + dixRequestPrivate(PclContextPrivateKey, sizeof( PclContextPrivRec ) ); + dixRequestPrivate(PclGCPrivateKey, sizeof( PclGCPrivRec ) ); + dixRequestPrivate(PclPixmapPrivateKey, sizeof( PclPixmapPrivRec ) ); - if((unsigned long) PclGeneration != serverGeneration) - { - PclScreenPrivateIndex = AllocateScreenPrivateIndex(); - - PclWindowPrivateIndex = AllocateWindowPrivateIndex(); - AllocateWindowPrivate( pScreen, PclWindowPrivateIndex, - sizeof( PclWindowPrivRec ) ); - - PclContextPrivateIndex = XpAllocateContextPrivateIndex(); - XpAllocateContextPrivate( PclContextPrivateIndex, - sizeof( PclContextPrivRec ) ); - - PclGCPrivateIndex = AllocateGCPrivateIndex(); - AllocateGCPrivate( pScreen, PclGCPrivateIndex, - sizeof( PclGCPrivRec ) ); - - PclPixmapPrivateIndex = AllocatePixmapPrivateIndex(); - AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex, - sizeof( PclPixmapPrivRec ) ); - - PclGeneration = serverGeneration; - } - - pScreen->devPrivates[PclScreenPrivateIndex].ptr = (pointer)xalloc( - sizeof(PclScreenPrivRec)); + dixSetPrivate(&pScreen->devPrivates, PclScreenPrivateKey, + xalloc(sizeof(PclScreenPrivRec))); } /* @@ -347,8 +328,8 @@ PclInitContext(XpContextPtr pCon) /* * Set up the context privates */ - pConPriv = - (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr; + pConPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pConPriv->jobFileName = (char *)NULL; pConPriv->pageFileName = (char *)NULL; @@ -481,7 +462,7 @@ static Bool PclDestroyContext(XpContextPtr pCon) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); PclPaletteMapPtr p, t; PclCmapToContexts *pCmap; ScreenPtr screen; @@ -539,7 +520,8 @@ PclDestroyContext(XpContextPtr pCon) * Remove the context from the screen-level colormap<->contexts mappings */ screen = screenInfo.screens[pCon->screenNum]; - sPriv = (PclScreenPrivPtr)screen->devPrivates[PclScreenPrivateIndex].ptr; + sPriv = (PclScreenPrivPtr) + dixLookupPrivate(&screen->devPrivates, PclScreenPrivateKey); pCmap = sPriv->colormaps; while( pCmap ) { @@ -581,8 +563,8 @@ PclGetContextFromWindow(WindowPtr win) while( win ) { - pPriv = - (PclWindowPrivPtr)win->devPrivates[PclWindowPrivateIndex].ptr; + pPriv = (PclWindowPrivPtr) + dixLookupPrivate(&win->devPrivates, PclWindowPrivateKey); if( pPriv->validContext ) return pPriv->context; diff --git a/hw/xprint/pcl/PclLine.c b/hw/xprint/pcl/PclLine.c index 52a586d17..68d55a525 100644 --- a/hw/xprint/pcl/PclLine.c +++ b/hw/xprint/pcl/PclLine.c @@ -107,7 +107,7 @@ PclPolyLine( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage required to deal with the clipping @@ -223,7 +223,7 @@ PclPolySegment( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage for the temporary regions. diff --git a/hw/xprint/pcl/PclPixel.c b/hw/xprint/pcl/PclPixel.c index f41af272f..d219838f0 100644 --- a/hw/xprint/pcl/PclPixel.c +++ b/hw/xprint/pcl/PclPixel.c @@ -125,13 +125,15 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints ) if( pDrawable->type == DRAWABLE_WINDOW ) { pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); - cPriv = pCon->devPrivates[PclContextPrivateIndex].ptr; + cPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); cPriv->changeMask = GCLineWidth | GCLineStyle; } else { - pPriv = - ((PixmapPtr)pDrawable)->devPrivates[PclPixmapPrivateIndex].ptr; + pPriv = (PclPixmapPrivPtr) + dixLookupPrivate(&((PixmapPtr)pDrawable)->devPrivates, + PclPixmapPrivateKey); pPriv->changeMask = GCLineWidth | GCLineStyle; } #endif diff --git a/hw/xprint/pcl/PclPolygon.c b/hw/xprint/pcl/PclPolygon.c index 9867758bb..7d95d6484 100644 --- a/hw/xprint/pcl/PclPolygon.c +++ b/hw/xprint/pcl/PclPolygon.c @@ -76,7 +76,7 @@ PclPolyRectangle( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage required to deal with the clipping @@ -170,7 +170,7 @@ PclFillPolygon( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Generate the PCL code to draw the filled polygon, by defining @@ -283,7 +283,7 @@ PclPolyFillRect( pCon = PclGetContextFromWindow( (WindowPtr) pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); /* * Allocate the storage required to deal with the clipping diff --git a/hw/xprint/pcl/PclPrint.c b/hw/xprint/pcl/PclPrint.c index 176a0025a..ac8ea1537 100644 --- a/hw/xprint/pcl/PclPrint.c +++ b/hw/xprint/pcl/PclPrint.c @@ -72,8 +72,8 @@ PclStartJob( Bool sendClientData, ClientPtr client) { - PclContextPrivPtr pConPriv = - (PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr; + PclContextPrivPtr pConPriv = (PclContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); PclPaletteMap *pal; /* @@ -130,7 +130,7 @@ PclEndJob( Bool cancel) { PclContextPrivPtr priv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); #ifdef CCP_DEBUG FILE *xpoutput; @@ -250,9 +250,9 @@ PclStartPage( WindowPtr pWin) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; - PclWindowPrivPtr pWinPriv = - (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); + PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr) + dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); xRectangle repro; char t[80]; XpOid orient, plex, tray, medium; @@ -488,7 +488,7 @@ PclEndPage( WindowPtr pWin) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); struct stat statBuf; @@ -532,7 +532,7 @@ PclStartDoc(XpContextPtr pCon, XPDocumentType type) { PclContextPrivPtr pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); #ifndef XP_PCL_LJ3 /* @@ -592,7 +592,7 @@ PclDocumentData( { int type = 0; PclContextPrivPtr pPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); XpOidDocFmtList *formats; XpOidDocFmt *f; char t[80]; @@ -700,7 +700,7 @@ PclGetDocumentData( int maxBufferSize) { PclContextPrivPtr pPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pPriv->getDocClient = client; pPriv->getDocBufSize = maxBufferSize; diff --git a/hw/xprint/pcl/PclText.c b/hw/xprint/pcl/PclText.c index 246c0195b..324de3014 100644 --- a/hw/xprint/pcl/PclText.c +++ b/hw/xprint/pcl/PclText.c @@ -123,7 +123,7 @@ char font_type; pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pSoftFontInfo = pConPriv->pSoftFontInfo; font_type = isInternal(pGC->font); if ( font_type == DOWNLOAD_FONT ) { @@ -293,7 +293,7 @@ char font_type; pCon = PclGetContextFromWindow( (WindowPtr)pDrawable ); pConPriv = (PclContextPrivPtr) - pCon->devPrivates[PclContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey); pSoftFontInfo = pConPriv->pSoftFontInfo; font_type = isInternal(pGC->font); diff --git a/hw/xprint/pcl/PclWindow.c b/hw/xprint/pcl/PclWindow.c index f34ad7feb..a87dc0e7a 100644 --- a/hw/xprint/pcl/PclWindow.c +++ b/hw/xprint/pcl/PclWindow.c @@ -97,9 +97,9 @@ PclCreateWindow( Bool status = Success; ScreenPtr pScreen = pWin->drawable.pScreen; PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr) - pScreen->devPrivates[PclScreenPrivateIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey); PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr) - pWin->devPrivates[PclWindowPrivateIndex].ptr; + dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); /* * Initialize this window's private struct. @@ -142,7 +142,8 @@ PclCreateWindow( /* * Invalidate the window's private print context. */ - pPriv = (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr; + pPriv = (PclWindowPrivPtr) + dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey); pPriv->validContext = 0; return TRUE; diff --git a/hw/xprint/pcl/Pclmap.h b/hw/xprint/pcl/Pclmap.h index 3990ab294..18ac31d90 100644 --- a/hw/xprint/pcl/Pclmap.h +++ b/hw/xprint/pcl/Pclmap.h @@ -82,11 +82,11 @@ copyright holders. #define InitializePclDriver CATNAME(Initialize, PclDriver) #define PclCloseScreen PCLNAME(CloseScreen) #define PclGetContextFromWindow PCLNAME(GetContextFromWindow) -#define PclScreenPrivateIndex PCLNAME(ScreenPrivateIndex) -#define PclWindowPrivateIndex PCLNAME(WindowPrivateIndex) -#define PclContextPrivateIndex PCLNAME(ContextPrivateIndex) -#define PclPixmapPrivateIndex PCLNAME(PixmapPrivateIndex) -#define PclGCPrivateIndex PCLNAME(GCPrivateIndex) +#define PclScreenPrivateKey PCLNAME(ScreenPrivateKey) +#define PclWindowPrivateKey PCLNAME(WindowPrivateKey) +#define PclContextPrivateKey PCLNAME(ContextPrivateKey) +#define PclPixmapPrivateKey PCLNAME(PixmapPrivateKey) +#define PclGCPrivateKey PCLNAME(GCPrivateKey) /* PclPrint.c */ #define PclStartJob PCLNAME(StartJob) diff --git a/hw/xprint/ps/Ps.h b/hw/xprint/ps/Ps.h index 5e77d9a0a..a25e9891a 100644 --- a/hw/xprint/ps/Ps.h +++ b/hw/xprint/ps/Ps.h @@ -121,10 +121,10 @@ typedef char *XPointer; * Public index variables from PsInit.c */ -extern int PsScreenPrivateIndex; -extern int PsWindowPrivateIndex; -extern int PsContextPrivateIndex; -extern int PsPixmapPrivateIndex; +extern DevPrivateKey PsScreenPrivateKey; +extern DevPrivateKey PsWindowPrivateKey; +extern DevPrivateKey PsContextPrivateKey; +extern DevPrivateKey PsPixmapPrivateKey; extern XpValidatePoolsRec PsValidatePoolsRec; /* diff --git a/hw/xprint/ps/PsGC.c b/hw/xprint/ps/PsGC.c index 3ec07a77a..19898c90e 100644 --- a/hw/xprint/ps/PsGC.c +++ b/hw/xprint/ps/PsGC.c @@ -162,9 +162,11 @@ PsGetDrawablePrivateStuff( c = wColormap((WindowPtr)pDrawable); cmap = (ColormapPtr)LookupIDByType(c, RT_COLORMAP); - cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr; + cPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); sPriv = (PsScreenPrivPtr) - pDrawable->pScreen->devPrivates[PsScreenPrivateIndex].ptr; + dixLookupPrivate(&pDrawable->pScreen->devPrivates, + PsScreenPrivateKey); *gc = cPriv->lastGC; *valid = cPriv->validGC; *psOut = cPriv->pPsOut; @@ -189,7 +191,8 @@ PsGetPsContextPriv( DrawablePtr pDrawable ) pCon = PsGetContextFromWindow((WindowPtr)pDrawable); if (pCon != NULL) { - return pCon->devPrivates[PsContextPrivateIndex].ptr; + return (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); } } return NULL; @@ -257,8 +260,9 @@ PsUpdateDrawableGC( PsOut_Offset(*psOut, pDrawable->x, pDrawable->y); PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip); } - cPriv = ( PsGetContextFromWindow( (WindowPtr)pDrawable ) ) - ->devPrivates[PsContextPrivateIndex].ptr; + cPriv = (PsContextPrivPtr)dixLookupPrivate( + &PsGetContextFromWindow((WindowPtr)pDrawable)->devPrivates, + PsContextPrivateKey); break; } return TRUE; diff --git a/hw/xprint/ps/PsInit.c b/hw/xprint/ps/PsInit.c index 6d4bd06f3..72bd7bd7c 100644 --- a/hw/xprint/ps/PsInit.c +++ b/hw/xprint/ps/PsInit.c @@ -97,10 +97,10 @@ static void AllocatePsPrivates(ScreenPtr pScreen); static int PsInitContext(XpContextPtr pCon); static int PsDestroyContext(XpContextPtr pCon); -int PsScreenPrivateIndex; -int PsContextPrivateIndex; -int PsPixmapPrivateIndex; -int PsWindowPrivateIndex; +DevPrivateKey PsScreenPrivateKey = &PsScreenPrivateKey; +DevPrivateKey PsContextPrivateKey = &PsContextPrivateKey; +DevPrivateKey PsPixmapPrivateKey = &PsPixmapPrivateKey; +DevPrivateKey PsWindowPrivateKey = &PsWindowPrivateKey; #ifdef GLXEXT extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); @@ -152,7 +152,8 @@ InitializePsDriver(ndx, pScreen, argc, argv) AllocatePsPrivates(pScreen); #if 0 - pPriv = (PsScreenPrivPtr)pScreen->devPrivates[PsScreenPrivateIndex].ptr; + pPriv = (PsScreenPrivPtr) + dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey); pPriv->resDB = rmdb; #endif @@ -474,28 +475,12 @@ InitializePsDriver(ndx, pScreen, argc, argv) static void AllocatePsPrivates(ScreenPtr pScreen) { - static unsigned long PsGeneration = 0; + dixRequestPrivate(PsWindowPrivateKey, sizeof(PsWindowPrivRec)); + dixRequestPrivate(PsContextPrivateKey, sizeof(PsContextPrivRec)); + dixRequestPrivate(PsPixmapPrivateKey, sizeof(PsPixmapPrivRec)); - if((unsigned long)PsGeneration != serverGeneration) - { - PsScreenPrivateIndex = AllocateScreenPrivateIndex(); - - PsWindowPrivateIndex = AllocateWindowPrivateIndex(); - AllocateWindowPrivate(pScreen, PsWindowPrivateIndex, - sizeof(PsWindowPrivRec)); - - PsContextPrivateIndex = XpAllocateContextPrivateIndex(); - XpAllocateContextPrivate(PsContextPrivateIndex, - sizeof(PsContextPrivRec)); - - PsPixmapPrivateIndex = AllocatePixmapPrivateIndex(); - AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex, - sizeof(PsPixmapPrivRec)); - - PsGeneration = serverGeneration; - } - pScreen->devPrivates[PsScreenPrivateIndex].ptr = - (pointer)xalloc(sizeof(PsScreenPrivRec)); + dixSetPrivate(&pScreen->devPrivates, PsScreenPrivateKey, + xalloc(sizeof(PsScreenPrivRec))); } /* @@ -550,8 +535,8 @@ PsInitContext(pCon) /* * Set up the context privates */ - pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); memset(pConPriv, 0, sizeof(PsContextPrivRec)); pConPriv->jobFileName = (char *)NULL; @@ -620,8 +605,8 @@ static Bool PsDestroyContext(pCon) XpContextPtr pCon; { - PsContextPrivPtr pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + PsContextPrivPtr pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); if( pConPriv->pJobFile!=(FILE *)NULL ) { @@ -653,7 +638,8 @@ PsGetContextFromWindow(win) while( win ) { - pPriv = (PsWindowPrivPtr)win->devPrivates[PsWindowPrivateIndex].ptr; + pPriv = (PsWindowPrivPtr) + dixLookupPrivate(&win->devPrivates, PsWindowPrivateKey); if( pPriv->validContext ) return pPriv->context; win = win->parent; } diff --git a/hw/xprint/ps/PsPixmap.c b/hw/xprint/ps/PsPixmap.c index d3ab198f8..a588f4276 100644 --- a/hw/xprint/ps/PsPixmap.c +++ b/hw/xprint/ps/PsPixmap.c @@ -79,6 +79,7 @@ in this Software without prior written authorization from The Open Group. #include "windowstr.h" #include "gcstruct.h" +#include "privates.h" #include "Ps.h" @@ -111,6 +112,7 @@ PsCreatePixmap( pPixmap->drawable.height = height; pPixmap->devKind = 0; pPixmap->refcnt = 1; + pPixmap->devPrivates = NULL; pPixmap->devPrivate.ptr = (PsPixmapPrivPtr)xcalloc(1, sizeof(PsPixmapPrivRec)); if( !pPixmap->devPrivate.ptr ) @@ -197,6 +199,7 @@ PsDestroyPixmap(PixmapPtr pPixmap) PsScrubPixmap(pPixmap); xfree(priv); + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/hw/xprint/ps/PsPrint.c b/hw/xprint/ps/PsPrint.c index 4571c07d7..386646858 100644 --- a/hw/xprint/ps/PsPrint.c +++ b/hw/xprint/ps/PsPrint.c @@ -165,8 +165,8 @@ PsStartJob( Bool sendClientData, ClientPtr client) { - PsContextPrivPtr pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + PsContextPrivPtr pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); /* * Create a temporary file to store the printer output. @@ -191,8 +191,8 @@ PsEndJob( struct stat buffer; int error; - PsContextPrivPtr priv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + PsContextPrivPtr priv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); if (cancel == True) { if (priv->getDocClient != (ClientPtr) NULL) { @@ -291,10 +291,10 @@ PsStartPage( { int iorient, iplex, icount, ires; unsigned short iwd, iht; - PsContextPrivPtr pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; - PsWindowPrivPtr pWinPriv = - (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr; + PsContextPrivPtr pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); + PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr) + dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); /* * Put a pointer to the context in the window private structure @@ -337,10 +337,10 @@ PsEndPage( XpContextPtr pCon, WindowPtr pWin) { - PsWindowPrivPtr pWinPriv = - (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr; - PsContextPrivPtr pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr) + dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); + PsContextPrivPtr pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); PsOut_EndPage(pConPriv->pPsOut); @@ -366,8 +366,8 @@ PsStartDoc(XpContextPtr pCon, XPDocumentType type) int iorient, iplex, icount, ires; unsigned short iwd, iht; char *title; - PsContextPrivPtr pConPriv = - (PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr; + PsContextPrivPtr pConPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); /* get job level attributes */ title = XpGetOneAttribute(pCon, XPJobAttr, "job-name"); @@ -420,7 +420,8 @@ PsDocumentData( len_opt) return BadValue; - cPriv = pCon->devPrivates[PsContextPrivateIndex].ptr; + cPriv = (PsContextPrivPtr) + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); psOut = cPriv->pPsOut; if (pDraw) @@ -448,7 +449,7 @@ PsGetDocumentData( int maxBufferSize) { PsContextPrivPtr pPriv = (PsContextPrivPtr) - pCon->devPrivates[PsContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, PsContextPrivateKey); pPriv->getDocClient = client; pPriv->getDocBufSize = maxBufferSize; diff --git a/hw/xprint/ps/PsWindow.c b/hw/xprint/ps/PsWindow.c index ded7dd638..d17cf8ce0 100644 --- a/hw/xprint/ps/PsWindow.c +++ b/hw/xprint/ps/PsWindow.c @@ -123,9 +123,9 @@ PsCreateWindow(WindowPtr pWin) Bool status = Success; ScreenPtr pScreen = pWin->drawable.pScreen; PsScreenPrivPtr pScreenPriv = (PsScreenPrivPtr) - pScreen->devPrivates[PsScreenPrivateIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, PsScreenPrivateKey); PsWindowPrivPtr pWinPriv = (PsWindowPrivPtr) - pWin->devPrivates[PsWindowPrivateIndex].ptr; + dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); /* * Initialize this window's private struct. @@ -165,7 +165,8 @@ PsCreateWindow(WindowPtr pWin) return status; #endif - pPriv = (PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr; + pPriv = (PsWindowPrivPtr) + dixLookupPrivate(&pWin->devPrivates, PsWindowPrivateKey); pPriv->validContext = 0; return TRUE; diff --git a/hw/xprint/ps/psout_ftpstype1.c b/hw/xprint/ps/psout_ftpstype1.c index 2d40c186a..572e13601 100644 --- a/hw/xprint/ps/psout_ftpstype1.c +++ b/hw/xprint/ps/psout_ftpstype1.c @@ -124,7 +124,7 @@ int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont switch(childpid) { case -1: - FatalError("PS DDX internal error: Cannot fork() converter child process, errno=%d\n", (int)errno); + FatalError("PS DDX internal error: Cannot fork() converter child process, %s\n", strerror(errno)); break; case 0: /* child */ fclose(self->Fp); diff --git a/hw/xprint/raster/Raster.c b/hw/xprint/raster/Raster.c index 0286a18fa..dccef613c 100644 --- a/hw/xprint/raster/Raster.c +++ b/hw/xprint/raster/Raster.c @@ -151,8 +151,8 @@ static int RasterReproducibleArea(XpContextPtr pCon, #define DOC_PCL 1 #define DOC_RASTER 2 -static int RasterScreenPrivateIndex, RasterContextPrivateIndex; -static int RasterGeneration = 0; +static DevPrivateKey RasterScreenPrivateKey = &RasterScreenPrivateKey; +static DevPrivateKey RasterContextPrivateKey = &RasterContextPrivateKey; static char RASTER_DRIV_NAME[] = "XP-RASTER"; static int doc_type = DOC_RASTER; @@ -205,7 +205,7 @@ InitializeRasterDriver( AllocateRasterPrivates(pScreen); pPriv = (RasterScreenPrivPtr) - pScreen->devPrivates[RasterScreenPrivateIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey); maxDim = MAX( pScreen->height, pScreen->width ); numBytes = maxDim + BITMAP_SCANLINE_PAD - 1; /* pixels per row */ @@ -252,7 +252,7 @@ GetPropString( char *propName) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); char *type; XrmValue val; struct stat status; @@ -371,7 +371,7 @@ StartJob( ClientPtr client) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); SetDocumentType( pCon ); @@ -488,7 +488,7 @@ EndJob( Bool cancel) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); if( cancel == True ) { @@ -549,7 +549,7 @@ StartPage( WindowPtr pWin) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); if(pConPriv->pPageFile != (FILE *)NULL) { @@ -830,7 +830,7 @@ SendPage( XpContextPtr pCon ) { struct stat statBuf; RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); if(stat(pConPriv->pageFileName, &statBuf) < 0) return BadAlloc; @@ -872,7 +872,7 @@ EndPage( WindowPtr pWin) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); struct stat statBuf; char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL; FILE *pRasterFile = (FILE *)NULL; @@ -1068,7 +1068,7 @@ DocumentData( ClientPtr client) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); char *preRasterStr = PRE_RASTER, *postRasterStr = POST_RASTER, *noRasterStr = NO_RASTER; @@ -1135,7 +1135,7 @@ GetDocumentData( int maxBufferSize) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pContext->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pContext->devPrivates, RasterContextPrivateKey); pConPriv->getDocClient = client; pConPriv->getDocBufSize = maxBufferSize; @@ -1146,17 +1146,9 @@ static void AllocateRasterPrivates( ScreenPtr pScreen) { - if(RasterGeneration != serverGeneration) - { - RasterScreenPrivateIndex = AllocateScreenPrivateIndex(); - RasterContextPrivateIndex = XpAllocateContextPrivateIndex(); - XpAllocateContextPrivate( RasterContextPrivateIndex, - sizeof( RasterContextPrivRec ) ); - - RasterGeneration = serverGeneration; - } - pScreen->devPrivates[RasterScreenPrivateIndex].ptr = (pointer)Xalloc( - sizeof(RasterScreenPrivRec)); + dixRequestPrivate(RasterContextPrivateKey, sizeof( RasterContextPrivRec ) ); + dixSetPrivate(&pScreen->devPrivates, RasterScreenPrivateKey, + Xalloc(sizeof(RasterScreenPrivRec))); } /* @@ -1171,7 +1163,7 @@ RasterChangeWindowAttributes( Bool status = Success; ScreenPtr pScreen = pWin->drawable.pScreen; RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr) - pScreen->devPrivates[RasterScreenPrivateIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey); if(pWin->backingStore == NotUseful) { @@ -1270,7 +1262,7 @@ RasterInitContext( * Set up the context privates */ pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); pConPriv->jobFileName = (char *)NULL; pConPriv->pageFileName = (char *)NULL; @@ -1355,7 +1347,7 @@ RasterDestroyContext( XpContextPtr pCon) { RasterContextPrivPtr pConPriv = (RasterContextPrivPtr) - pCon->devPrivates[RasterContextPrivateIndex].ptr; + dixLookupPrivate(&pCon->devPrivates, RasterContextPrivateKey); /* * Clean up the temporary files @@ -1477,7 +1469,7 @@ RasterCloseScreen( { Bool status = Success; RasterScreenPrivPtr pScreenPriv = (RasterScreenPrivPtr) - pScreen->devPrivates[RasterScreenPrivateIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, RasterScreenPrivateKey); /* * Call any wrapped CloseScreen proc. diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am new file mode 100644 index 000000000..99d23eb1f --- /dev/null +++ b/hw/xquartz/Makefile.am @@ -0,0 +1,57 @@ +noinst_LTLIBRARIES = libXquartz.la +AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) +AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) +AM_CPPFLAGS = \ + -DBUILD_DATE=\"$(BUILD_DATE)\" \ + -DXSERVER_VERSION=\"$(VERSION)\" \ + -DINXQUARTZ \ + -DUSE_NEW_CLUT \ + -DXFree86Server \ + -I$(top_srcdir)/miext/rootless + +if X11APP +X11APP_SUBDIRS = bundle +endif + +SUBDIRS = . xpr $(X11APP_SUBDIRS) +DIST_SUBDIRS = xpr bundle + +libXquartz_la_SOURCES = \ + $(top_srcdir)/fb/fbcmap_mi.c \ + $(top_srcdir)/mi/miinitext.c \ + $(top_srcdir)/Xext/dpmsstubs.c \ + X11Application.m \ + X11Controller.m \ + applewm.c \ + darwin.c \ + darwinEvents.c \ + darwinKeyboard.c \ + darwinXinput.c \ + keysym2ucs.c \ + pseudoramiX.c \ + quartz.c \ + quartzAudio.c \ + quartzCocoa.m \ + quartzForeground.c \ + quartzKeyboard.c \ + quartzPasteboard.c \ + quartzStartup.c + +EXTRA_DIST = \ + X11Application.h \ + X11Controller.h \ + applewmExt.h \ + darwinClut8.h \ + darwin.h \ + darwinEvents.h \ + darwinKeyboard.h \ + keysym2ucs.h \ + pseudoramiX.h \ + quartz.h \ + quartzAudio.h \ + quartzCommon.h \ + quartzCursor.c \ + quartzCursor.h \ + quartzForeground.h \ + quartzKeyboard.h \ + quartzPasteboard.h diff --git a/hw/darwin/quartz/X11Application.h b/hw/xquartz/X11Application.h index 861565798..86da67f2e 100644 --- a/hw/darwin/quartz/X11Application.h +++ b/hw/xquartz/X11Application.h @@ -64,40 +64,40 @@ extern X11Application *X11App; #endif /* __OBJC__ */ -extern void X11ApplicationSetWindowMenu (int nitems, const char **items, +void X11ApplicationSetWindowMenu (int nitems, const char **items, const char *shortcuts); -extern void X11ApplicationSetWindowMenuCheck (int idx); -extern void X11ApplicationSetFrontProcess (void); -extern void X11ApplicationSetCanQuit (int state); -extern void X11ApplicationServerReady (void); -extern void X11ApplicationShowHideMenubar (int state); +void X11ApplicationSetWindowMenuCheck (int idx); +void X11ApplicationSetFrontProcess (void); +void X11ApplicationSetCanQuit (int state); +void X11ApplicationServerReady (void); +void X11ApplicationShowHideMenubar (int state); -extern void X11ApplicationMain (int argc, const char *argv[], - void (*server_thread) (void *), - void *server_arg); +void X11ApplicationMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg); extern int X11EnableKeyEquivalents; extern int quartzHasRoot, quartzEnableRootless; #define APP_PREFS "org.x.X11" -#define PREFS_APPSMENU "apps_menu" -#define PREFS_FAKEBUTTONS "enable_fake_buttons" -#define PREFS_SYSBEEP "enable_system_beep" -#define PREFS_KEYEQUIVS "enable_key_equivalents" -#define PREFS_KEYMAP_FILE "keymap_file" -#define PREFS_SYNC_KEYMAP "sync_keymap" -#define PREFS_DEPTH "depth" -#define PREFS_NO_AUTH "no_auth" -#define PREFS_NO_TCP "nolisten_tcp" -#define PREFS_DONE_XINIT_CHECK "done_xinit_check" -#define PREFS_NO_QUIT_ALERT "no_quit_alert" -#define PREFS_FAKE_BUTTON2 "fake_button2" -#define PREFS_FAKE_BUTTON3 "fake_button3" -#define PREFS_ROOTLESS "rootless" -#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys" -#define PREFS_SWAP_ALT_META "swap_alt_meta" -#define PREFS_XP_OPTIONS "xp_options" -#define PREFS_ENABLE_STEREO "enable_stereo" +#define PREFS_APPSMENU "apps_menu" +#define PREFS_FAKEBUTTONS "enable_fake_buttons" +#define PREFS_SYSBEEP "enable_system_beep" +#define PREFS_KEYEQUIVS "enable_key_equivalents" +#define PREFS_KEYMAP_FILE "keymap_file" +#define PREFS_SYNC_KEYMAP "sync_keymap" +#define PREFS_DEPTH "depth" +#define PREFS_NO_AUTH "no_auth" +#define PREFS_NO_TCP "nolisten_tcp" +#define PREFS_DONE_XINIT_CHECK "done_xinit_check" +#define PREFS_NO_QUIT_ALERT "no_quit_alert" +#define PREFS_FAKE_BUTTON2 "fake_button2" +#define PREFS_FAKE_BUTTON3 "fake_button3" +#define PREFS_ROOTLESS "rootless" +#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys" +#define PREFS_SWAP_ALT_META "swap_alt_meta" +#define PREFS_XP_OPTIONS "xp_options" +#define PREFS_ENABLE_STEREO "enable_stereo" +#define PREFS_LOGIN_SHELL "login_shell" +#define PREFS_QUARTZ_WM_CLICK_THROUGH "wm_click_through" #endif /* X11APPLICATION_H */ diff --git a/hw/darwin/quartz/X11Application.m b/hw/xquartz/X11Application.m index aef06990d..be5511d30 100644 --- a/hw/darwin/quartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -32,6 +32,7 @@ #endif #include "quartzCommon.h" +#include "quartzForeground.h" #import "X11Application.h" #include <Carbon/Carbon.h> @@ -39,6 +40,7 @@ /* ouch! */ #define BOOL X_BOOL # include "darwin.h" +# include "darwinEvents.h" # include "quartz.h" # define _APPLEWM_SERVER_ # include "X11/extensions/applewm.h" @@ -59,8 +61,7 @@ int X11EnableKeyEquivalents = TRUE; int quartzHasRoot = FALSE, quartzEnableRootless = TRUE; extern int darwinFakeButtons, input_check_flag; -// extern Bool enable_stereo; -Bool enable_stereo; //<-- this needs to go back to being an extern once glxCGL is fixed +extern Bool enable_stereo; extern xEvent *darwinEvents; @@ -82,8 +83,8 @@ static mach_port_t _port; static void send_nsevent (NSEventType type, NSEvent *e); /* Quartz mode initialization routine. This is often dynamically loaded - but is statically linked into this X server. */ -extern Bool QuartzModeBundleInit(void); + but is statically linked into this X server. */ +Bool QuartzModeBundleInit(void); static void init_ports (void) { kern_return_t r; @@ -152,7 +153,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { tem = [infoDict objectForKey:@"CFBundleShortVersionString"]; - [dict setObject:[NSString stringWithFormat:@"X11.app %@ - X.org X11R7.3", tem] + [dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION] forKey:@"ApplicationVersion"]; [self orderFrontStandardAboutPanelWithOptions: dict]; @@ -163,7 +164,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) { have it activated while X is active (unless using the old keymapping files) */ static TSMDocumentID x11_document; - + DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) if (state) { QuartzMessageServerThread (kXDarwinActivate, 0); @@ -313,6 +314,11 @@ static void message_kit_thread (SEL selector, NSObject *arg) { } - (void) set_front_process:unused { + /* Hackery needed due to argv[0] hackery */ + // [self activateX:YES]; + ProcessSerialNumber psn = { 0, kCurrentProcess }; + SetFrontProcess(&psn); + QuartzMessageServerThread(kXDarwinBringAllToFront, 0); } @@ -789,44 +795,43 @@ environment?", @"Startup xinitrc dialog"); [X11App prefs_synchronize]; } -void X11ApplicationMain (int argc, const char *argv[], - void (*server_thread) (void *), void *server_arg) { - NSAutoreleasePool *pool; - +void X11ApplicationMain (int argc, const char **argv, void (*server_thread) (void *), void *server_arg) { + NSAutoreleasePool *pool; + #ifdef DEBUG - while (access ("/tmp/x11-block", F_OK) == 0) sleep (1); + while (access ("/tmp/x11-block", F_OK) == 0) sleep (1); #endif - pool = [[NSAutoreleasePool alloc] init]; - X11App = (X11Application *) [X11Application sharedApplication]; - init_ports (); - [NSApp read_defaults]; - [NSBundle loadNibNamed:@"main" owner:NSApp]; - [[NSNotificationCenter defaultCenter] addObserver:NSApp + pool = [[NSAutoreleasePool alloc] init]; + X11App = (X11Application *) [X11Application sharedApplication]; + init_ports (); + [NSApp read_defaults]; + [NSBundle loadNibNamed:@"main" owner:NSApp]; + [[NSNotificationCenter defaultCenter] addObserver:NSApp selector:@selector (became_key:) name:NSWindowDidBecomeKeyNotification object:nil]; - check_xinitrc (); - - /* - * The xpr Quartz mode is statically linked into this server. - * Initialize all the Quartz functions. - */ - QuartzModeBundleInit(); - - /* Calculate the height of the menubar so we can avoid it. */ - aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) - + check_xinitrc (); + + /* + * The xpr Quartz mode is statically linked into this server. + * Initialize all the Quartz functions. + */ + QuartzModeBundleInit(); + + /* Calculate the height of the menubar so we can avoid it. */ + aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) - NSMaxY([[NSScreen mainScreen] visibleFrame]); - if (!create_thread (server_thread, server_arg)) { - ErrorF("can't create secondary thread\n"); - exit (1); - } - - [NSApp run]; - - /* not reached */ -} + if (!create_thread (server_thread, server_arg)) { + ErrorF("can't create secondary thread\n"); + exit (1); + } + + QuartzMoveToForeground(); + [NSApp run]; + /* not reached */ +} /* event conversion */ @@ -855,7 +860,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) { NSWindow *window; int pointer_x, pointer_y, ev_button, ev_type; // int num_events=0, i=0, state; - xEvent xe; + // xEvent xe; /* convert location to global top-left coordinates */ location = [e locationInWindow]; diff --git a/hw/darwin/quartz/X11Controller.h b/hw/xquartz/X11Controller.h index f1399dc49..64d5cd1ce 100644 --- a/hw/darwin/quartz/X11Controller.h +++ b/hw/xquartz/X11Controller.h @@ -37,29 +37,30 @@ @interface X11Controller : NSObject { - NSPanel *prefs_panel; - - NSButton *fake_buttons; - NSButton *enable_fullscreen; - NSButton *use_sysbeep; - NSButton *enable_keyequivs; - NSButton *sync_keymap; - NSButton *enable_auth; - NSButton *enable_tcp; - NSPopUpButton *depth; - - NSMenuItem *x11_about_item; - NSMenuItem *window_separator; - NSMenuItem *dock_window_separator; - NSMenuItem *apps_separator; - NSMenuItem *toggle_fullscreen_item; - NSMenu *dock_apps_menu; - NSTableView *apps_table; + IBOutlet NSPanel *prefs_panel; + + IBOutlet NSButton *fake_buttons; + IBOutlet NSButton *enable_fullscreen; + IBOutlet NSButton *use_sysbeep; + IBOutlet NSButton *enable_keyequivs; + IBOutlet NSButton *sync_keymap; + IBOutlet NSButton *click_through; + IBOutlet NSButton *enable_auth; + IBOutlet NSButton *enable_tcp; + IBOutlet NSPopUpButton *depth; + + IBOutlet NSMenuItem *x11_about_item; + IBOutlet NSMenuItem *window_separator; + IBOutlet NSMenuItem *dock_window_separator; + IBOutlet NSMenuItem *apps_separator; + IBOutlet NSMenuItem *toggle_fullscreen_item; + IBOutlet NSMenu *dock_apps_menu; + IBOutlet NSTableView *apps_table; NSArray *apps; NSMutableArray *table_apps; - NSMenu *dock_menu; + IBOutlet NSMenu *dock_menu; int checked_window_item; x_list *pending_apps; @@ -74,12 +75,29 @@ - (void) set_can_quit:(BOOL)state; - (void) server_ready; +- (IBAction) apps_table_show:(id)sender; +- (IBAction) apps_table_cancel:(id)sender; +- (IBAction) apps_table_done:(id)sender; +- (IBAction) apps_table_new:(id)sender; +- (IBAction) apps_table_duplicate:(id)sender; +- (IBAction) apps_table_delete:(id)sender; +- (IBAction) bring_to_front:(id)sender; +- (IBAction) close_window:(id)sender; +- (IBAction) minimize_window:(id)sender; +- (IBAction) zoom_window:(id)sender; +- (IBAction) next_window:(id)sender; +- (IBAction) previous_window:(id)sender; +- (IBAction) enable_fullscreen_changed:(id)sender; +- (IBAction) toggle_fullscreen:(id)sender; +- (IBAction) prefs_changed:(id)sender; +- (IBAction) prefs_show:(id)sender; +- (IBAction) quit:(id)sender; +- (IBAction) x11_help:(id)sender; + @end #endif /* __OBJC__ */ -extern void X11ControllerMain (int argc, const char *argv[], - void (*server_thread) (void *), - void *server_arg); +void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg); #endif /* X11CONTROLLER_H */ diff --git a/hw/darwin/quartz/X11Controller.m b/hw/xquartz/X11Controller.m index 0f64e4571..5111eafc3 100644 --- a/hw/darwin/quartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -302,7 +302,7 @@ argv[0] = "/usr/bin/login"; argv[1] = "-fp"; argv[2] = getlogin(); - argv[3] = "/bin/sh"; + argv[3] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"]; argv[4] = "-c"; argv[5] = command; argv[6] = NULL; @@ -337,7 +337,7 @@ /* Setup environment */ temp = getenv("DISPLAY"); if (temp == NULL || temp[0] == 0) { - snprintf(buf, sizeof(buf), ":%s", display); + snprintf(buf, sizeof(buf), ":%s", display); setenv("DISPLAY", buf, TRUE); } @@ -613,7 +613,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row quartzUseSysBeep = [use_sysbeep intValue]; X11EnableKeyEquivalents = [enable_keyequivs intValue]; darwinSyncKeymap = [sync_keymap intValue]; - + /* after adding prefs here, also add to [X11Application read_defaults] and below */ @@ -621,6 +621,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep]; [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents]; [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap]; + [NSApp prefs_set_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH value:[click_through intValue]]; [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]]; [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]]; [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]]; @@ -635,6 +636,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row [enable_keyequivs setIntValue:X11EnableKeyEquivalents]; [sync_keymap setIntValue:darwinSyncKeymap]; [sync_keymap setEnabled:darwinKeymapFile == NULL]; + [click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_QUARTZ_WM_CLICK_THROUGH default:NO]]; [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]]; [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]]; @@ -742,8 +744,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row @end -void X11ControllerMain (int argc, const char *argv[], - void (*server_thread) (void *), void *server_arg) -{ - X11ApplicationMain (argc, argv, server_thread, server_arg); +void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg) { + X11ApplicationMain (argc, argv, server_thread, server_arg); } diff --git a/hw/darwin/quartz/applewm.c b/hw/xquartz/applewm.c index 72dca28e7..c460ec6ae 100644 --- a/hw/darwin/quartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -264,8 +264,7 @@ WMFreeEvents (data, id) } static int -ProcAppleWMSelectInput (client) - register ClientPtr client; +ProcAppleWMSelectInput (register ClientPtr client) { REQUEST(xAppleWMSelectInputReq); WMEventPtr pEvent, pNewEvent, *pHead; @@ -479,13 +478,11 @@ ProcAppleWMSetFrontProcess( } static int -ProcAppleWMSetWindowLevel( - register ClientPtr client -) +ProcAppleWMSetWindowLevel(register ClientPtr client) { REQUEST(xAppleWMSetWindowLevelReq); WindowPtr pWin; - int errno; + int err; REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq); @@ -497,9 +494,9 @@ ProcAppleWMSetWindowLevel( return BadValue; } - errno = appleWMProcs->SetWindowLevel(pWin, stuff->level); - if (errno != Success) { - return errno; + err = appleWMProcs->SetWindowLevel(pWin, stuff->level); + if (err != Success) { + return err; } return (client->noClientException); diff --git a/hw/darwin/quartz/applewmExt.h b/hw/xquartz/applewmExt.h index 60d49ef59..60d49ef59 100644 --- a/hw/darwin/quartz/applewmExt.h +++ b/hw/xquartz/applewmExt.h diff --git a/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings b/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..8f978d63f --- /dev/null +++ b/hw/xquartz/bundle/Dutch.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Dutch.lproj/Localizable.strings b/hw/xquartz/bundle/Dutch.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..1ff39fe67 --- /dev/null +++ b/hw/xquartz/bundle/Dutch.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..95c26d7b3 --- /dev/null +++ b/hw/xquartz/bundle/Dutch.lproj/main.nib/keyedobjects.nib diff --git a/hw/darwin/apple/English.lproj/InfoPlist.strings b/hw/xquartz/bundle/English.lproj/InfoPlist.strings Binary files differindex 88e1f04ac..88e1f04ac 100644 --- a/hw/darwin/apple/English.lproj/InfoPlist.strings +++ b/hw/xquartz/bundle/English.lproj/InfoPlist.strings diff --git a/hw/darwin/apple/English.lproj/Localizable.strings b/hw/xquartz/bundle/English.lproj/Localizable.strings Binary files differindex c83b08536..c83b08536 100644 --- a/hw/darwin/apple/English.lproj/Localizable.strings +++ b/hw/xquartz/bundle/English.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib new file mode 100644 index 000000000..ea3a0daa8 --- /dev/null +++ b/hw/xquartz/bundle/English.lproj/main.nib/designable.nib @@ -0,0 +1,3482 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02"> + <data> + <int key="IBDocument.SystemTarget">1050</int> + <string key="IBDocument.SystemVersion">9C31</string> + <string key="IBDocument.InterfaceBuilderVersion">639</string> + <string key="IBDocument.AppKitVersion">949.26</string> + <string key="IBDocument.HIToolboxVersion">352.00</string> + <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> + <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="57"/> + <integer value="285"/> + </object> + <object class="NSArray" key="IBDocument.PluginDependencies"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + </object> + <object class="NSMutableArray" key="IBDocument.RootObjects" id="904585544"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSCustomObject" id="815810918"> + <object class="NSMutableString" key="NSClassName"> + <characters key="NS.bytes">NSApplication</characters> + </object> + </object> + <object class="NSCustomObject" id="941939442"> + <string key="NSClassName">FirstResponder</string> + </object> + <object class="NSCustomObject" id="951368722"> + <string key="NSClassName">NSApplication</string> + </object> + <object class="NSMenu" id="524015605"> + <string key="NSTitle">MainMenu</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="365880285"> + <reference key="NSMenu" ref="524015605"/> + <string key="NSTitle">X11</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <object class="NSCustomResource" key="NSOnImage" id="531645050"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuCheckmark</string> + </object> + <object class="NSCustomResource" key="NSMixedImage" id="351811234"> + <string key="NSClassName">NSImage</string> + <string key="NSResourceName">NSMenuMixedState</string> + </object> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="576521955"> + <string key="NSTitle">X11</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="139290918"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">About X11</string> + <string key="NSKeyEquiv"/> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="386173216"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Preferences...</string> + <string key="NSKeyEquiv">,</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="272876017"> + <reference key="NSMenu" ref="576521955"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="32285361"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Services</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="821388474"> + <object class="NSMutableString" key="NSTitle"> + <characters key="NS.bytes">Services</characters> + </object> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <string key="NSName">_NSServicesMenu</string> + </object> + </object> + <object class="NSMenuItem" id="431301145"> + <reference key="NSMenu" ref="576521955"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="6876565"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Toggle Full Screen</string> + <string key="NSKeyEquiv">a</string> + <int key="NSKeyEquivModMask">1572864</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="479677589"> + <reference key="NSMenu" ref="576521955"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="301008465"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Hide X11</string> + <string key="NSKeyEquiv">h</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <int key="NSTag">42</int> + </object> + <object class="NSMenuItem" id="206802571"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Hide Others</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="1023546148"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Show All</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <int key="NSTag">42</int> + </object> + <object class="NSMenuItem" id="848095279"> + <reference key="NSMenu" ref="576521955"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="274138642"> + <reference key="NSMenu" ref="576521955"/> + <string key="NSTitle">Quit X11</string> + <string key="NSKeyEquiv">q</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + </object> + <string key="NSName">_NSAppleMenu</string> + </object> + </object> + <object class="NSMenuItem" id="868031522"> + <reference key="NSMenu" ref="524015605"/> + <string key="NSTitle">Applications</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="981161348"> + <string key="NSTitle">Applications</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="390088328"> + <reference key="NSMenu" ref="981161348"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="1065386165"> + <reference key="NSMenu" ref="981161348"/> + <string key="NSTitle">Customize...</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="200491363"> + <reference key="NSMenu" ref="524015605"/> + <string key="NSTitle">Edit</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="526778998"> + <string key="NSTitle">Edit</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="1010221707"> + <reference key="NSMenu" ref="526778998"/> + <string key="NSTitle">Undo</string> + <string key="NSKeyEquiv">z</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="535038564"> + <reference key="NSMenu" ref="526778998"/> + <string key="NSTitle">Redo</string> + <string key="NSKeyEquiv">Z</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="839739619"> + <reference key="NSMenu" ref="526778998"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="581727829"> + <reference key="NSMenu" ref="526778998"/> + <string key="NSTitle">Cut</string> + <string key="NSKeyEquiv">x</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="185296989"> + <reference key="NSMenu" ref="526778998"/> + <string key="NSTitle">Copy</string> + <string key="NSKeyEquiv">c</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="924678073"> + <reference key="NSMenu" ref="526778998"/> + <string key="NSTitle">Paste</string> + <string key="NSKeyEquiv">v</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="994817848"> + <reference key="NSMenu" ref="526778998"/> + <string key="NSTitle">Delete</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="322866464"> + <reference key="NSMenu" ref="526778998"/> + <string key="NSTitle">Select All</string> + <string key="NSKeyEquiv">a</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + </object> + </object> + </object> + <object class="NSMenuItem" id="931553638"> + <reference key="NSMenu" ref="524015605"/> + <string key="NSTitle">Window</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="96874957"> + <object class="NSMutableString" key="NSTitle"> + <characters key="NS.bytes">Window</characters> + </object> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="677652931"> + <reference key="NSMenu" ref="96874957"/> + <string key="NSTitle">Minimize</string> + <string key="NSKeyEquiv">m</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="1066447520"> + <reference key="NSMenu" ref="96874957"/> + <string key="NSTitle">Zoom</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="1036389925"> + <reference key="NSMenu" ref="96874957"/> + <string key="NSTitle">Cycle Through Windows</string> + <string key="NSKeyEquiv">`</string> + <int key="NSKeyEquivModMask">1048840</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="369641893"> + <reference key="NSMenu" ref="96874957"/> + <string key="NSTitle">Reverse Cycle Through Windows</string> + <string key="NSKeyEquiv">~</string> + <int key="NSKeyEquivModMask">1179914</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="280172320"> + <reference key="NSMenu" ref="96874957"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="984461797"> + <reference key="NSMenu" ref="96874957"/> + <string key="NSTitle">Close</string> + <string key="NSKeyEquiv">w</string> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="155085383"> + <reference key="NSMenu" ref="96874957"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="276216762"> + <reference key="NSMenu" ref="96874957"/> + <string key="NSTitle">Bring All to Front</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="444952046"> + <reference key="NSMenu" ref="96874957"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + </object> + <string key="NSName">_NSWindowsMenu</string> + </object> + </object> + <object class="NSMenuItem" id="551174276"> + <reference key="NSMenu" ref="524015605"/> + <string key="NSTitle">Help</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="511848303"> + <string key="NSTitle">Help</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="504984881"> + <reference key="NSMenu" ref="511848303"/> + <string key="NSTitle">X11 Help</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + </object> + </object> + </object> + </object> + <string key="NSName">_NSMainMenu</string> + </object> + <object class="NSCustomObject" id="485884620"> + <string key="NSClassName">X11Controller</string> + </object> + <object class="NSWindowTemplate" id="124913468"> + <int key="NSWindowStyleMask">3</int> + <int key="NSWindowBacking">2</int> + <string key="NSWindowRect">{{319, 294}, {481, 345}}</string> + <int key="NSWTFlags">1350041600</int> + <string key="NSWindowTitle">X11 Preferences</string> + <string key="NSWindowClass">NSPanel</string> + <object class="NSMutableString" key="NSViewClass"> + <characters key="NS.bytes">View</characters> + </object> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> + <string key="NSWindowContentMinSize">{213, 107}</string> + <object class="NSView" key="NSWindowView" id="941366957"> + <nil key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTabView" id="448510093"> + <reference key="NSNextResponder" ref="941366957"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{10, 10}, {458, 325}}</string> + <reference key="NSSuperview" ref="941366957"/> + <object class="NSMutableArray" key="NSTabViewItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTabViewItem" id="287591690"> + <object class="NSMutableString" key="NSIdentifier"> + <characters key="NS.bytes">1</characters> + </object> + <object class="NSView" key="NSView" id="596750588"> + <reference key="NSNextResponder" ref="448510093"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="119157981"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 243}, {402, 18}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="990762273"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Emulate three button mouse</string> + <object class="NSFont" key="NSSupport" id="463863101"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.300000e+01</double> + <int key="NSfFlags">1044</int> + </object> + <reference key="NSControlView" ref="119157981"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <object class="NSButtonImageSource" key="NSAlternateImage" id="391434389"> + <string key="NSImageName">NSSwitch</string> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="443008216"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 93}, {385, 31}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="391919450"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">When enabled, menu bar key equivalents may interfere with X11 applications that use the Meta modifier.</string> + <object class="NSFont" key="NSSupport" id="26"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.100000e+01</double> + <int key="NSfFlags">3100</int> + </object> + <reference key="NSControlView" ref="443008216"/> + <object class="NSColor" key="NSBackgroundColor" id="57160303"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlColor</string> + <object class="NSColor" key="NSColor" id="590688762"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> + </object> + </object> + <object class="NSColor" key="NSTextColor" id="930815747"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlTextColor</string> + <object class="NSColor" key="NSColor" id="214098874"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + </object> + </object> + <object class="NSTextField" id="282885445"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 208}, {385, 29}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="649334366"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string type="base64-UTF8" key="NSContents">SG9sZCBPcHRpb24gYW5kIENvbW1hbmQgd2hpbGUgY2xpY2tpbmcgdG8gYWN0aXZhdGUgdGhlIG1pZGRs +ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="282885445"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSButton" id="842100515"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 130}, {402, 18}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="940564599"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Enable key equivalents under X11</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="842100515"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="31160162"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 159}, {385, 14}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="666057093"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">Allows input menu changes to overwrite the current X11 keymap.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="31160162"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSButton" id="179949713"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 179}, {402, 18}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="967619578"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Follow system keyboard layout</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="179949713"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="915448994"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 69}, {402, 18}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="117056849"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Click-through Inactive Windows</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="915448994"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="707276799"> + <reference key="NSNextResponder" ref="596750588"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{33, 32}, {385, 31}}</string> + <reference key="NSSuperview" ref="596750588"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="318286890"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">When enabled, clicking on an inactive window will cause that mouse click to pass through to that window in addition to activating it.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="707276799"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + </object> + <string key="NSFrame">{{10, 33}, {438, 279}}</string> + <reference key="NSSuperview" ref="448510093"/> + </object> + <string key="NSLabel">Input</string> + <reference key="NSColor" ref="57160303"/> + <reference key="NSTabView" ref="448510093"/> + </object> + <object class="NSTabViewItem" id="960678392"> + <object class="NSMutableString" key="NSIdentifier"> + <characters key="NS.bytes">2</characters> + </object> + <object class="NSView" key="NSView" id="515308735"> + <nil key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="418227126"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 116}, {402, 18}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="1016069354"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Use system alert effect</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="418227126"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="1039016593"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 82}, {385, 28}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="624655599"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">X11 beeps will use the standard system alert, as defined in the Sound Effects system preferences panel.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="1039016593"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSPopUpButton" id="709074847"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{74, 235}, {128, 26}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSPopUpButtonCell" key="NSCell" id="633115429"> + <int key="NSCellFlags">-2076049856</int> + <int key="NSCellFlags2">1024</int> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="709074847"/> + <int key="NSButtonFlags">109199615</int> + <int key="NSButtonFlags2">1</int> + <object class="NSFont" key="NSAlternateImage"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.300000e+01</double> + <int key="NSfFlags">16</int> + </object> + <object class="NSMutableString" key="NSAlternateContents"> + <characters key="NS.bytes"/> + </object> + <object class="NSMutableString" key="NSKeyEquivalent"> + <characters key="NS.bytes"/> + </object> + <int key="NSPeriodicDelay">400</int> + <int key="NSPeriodicInterval">75</int> + <object class="NSMenuItem" key="NSMenuItem" id="616492372"> + <reference key="NSMenu" ref="341113515"/> + <string key="NSTitle">From Display</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <int key="NSState">1</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">_popUpItemAction:</string> + <int key="NSTag">-1</int> + <reference key="NSTarget" ref="633115429"/> + </object> + <bool key="NSMenuItemRespectAlignment">YES</bool> + <object class="NSMenu" key="NSMenu" id="341113515"> + <object class="NSMutableString" key="NSTitle"> + <characters key="NS.bytes">OtherViews</characters> + </object> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="616492372"/> + <object class="NSMenuItem" id="759499526"> + <reference key="NSMenu" ref="341113515"/> + <string key="NSTitle">256 Colors</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">_popUpItemAction:</string> + <int key="NSTag">8</int> + <reference key="NSTarget" ref="633115429"/> + </object> + <object class="NSMenuItem" id="543935434"> + <reference key="NSMenu" ref="341113515"/> + <string key="NSTitle">Thousands</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">_popUpItemAction:</string> + <int key="NSTag">15</int> + <reference key="NSTarget" ref="633115429"/> + </object> + <object class="NSMenuItem" id="836673018"> + <reference key="NSMenu" ref="341113515"/> + <string key="NSTitle">Millions</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">_popUpItemAction:</string> + <int key="NSTag">24</int> + <reference key="NSTarget" ref="633115429"/> + </object> + </object> + </object> + <int key="NSPreferredEdge">3</int> + <bool key="NSUsesItemFromMenu">YES</bool> + <bool key="NSAltersState">YES</bool> + <int key="NSArrowPosition">1</int> + </object> + </object> + <object class="NSTextField" id="201731424"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{17, 238}, {55, 20}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="930265681"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string type="base64-UTF8" key="NSContents">Q29sb3JzOgo</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="201731424"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSTextField" id="86150604"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 216}, {392, 14}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="311969422"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">This option takes effect when X11 is launched again.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="86150604"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSButton" id="477203622"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 182}, {409, 23}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="631531164"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Full screen mode</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="477203622"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="298603383"> + <reference key="NSNextResponder" ref="515308735"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 145}, {385, 31}}</string> + <reference key="NSSuperview" ref="515308735"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="761107402"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">Enables the X11 root window. Use the Command-Option-A keystroke to enter and leave full screen mode.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="298603383"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + </object> + <string key="NSFrame">{{10, 33}, {438, 279}}</string> + </object> + <string key="NSLabel">Output</string> + <reference key="NSColor" ref="57160303"/> + <reference key="NSTabView" ref="448510093"/> + </object> + <object class="NSTabViewItem" id="348328898"> + <object class="NSView" key="NSView" id="300811574"> + <nil key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="989050925"> + <reference key="NSNextResponder" ref="300811574"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 243}, {402, 18}}</string> + <reference key="NSSuperview" ref="300811574"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="189594322"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Authenticate connections</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="989050925"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="700826966"> + <reference key="NSNextResponder" ref="300811574"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{18, 166}, {402, 18}}</string> + <reference key="NSSuperview" ref="300811574"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="489340979"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Allow connections from network clients</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="700826966"/> + <int key="NSButtonFlags">1211912703</int> + <int key="NSButtonFlags2">2</int> + <reference key="NSAlternateImage" ref="391434389"/> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSTextField" id="168436707"> + <reference key="NSNextResponder" ref="300811574"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 195}, {385, 42}}</string> + <reference key="NSSuperview" ref="300811574"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="53243865"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string type="base64-UTF8" key="NSContents">TGF1bmNoaW5nIFgxMSB3aWxsIGNyZWF0ZSBYYXV0aG9yaXR5IGFjY2Vzcy1jb250cm9sIGtleXMuIElm +IHRoZSBzeXN0ZW0ncyBJUCBhZGRyZXNzIGNoYW5nZXMsIHRoZXNlIGtleXMgYmVjb21lIGludmFsaWQg +d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="168436707"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSTextField" id="363817195"> + <reference key="NSNextResponder" ref="300811574"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{36, 118}, {385, 42}}</string> + <reference key="NSSuperview" ref="300811574"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="390084685"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">If enabled, Authenticate connections must also be enabled to ensure system security. When disabled, connections from remote applications are not allowed.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="363817195"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + <object class="NSTextField" id="223835729"> + <reference key="NSNextResponder" ref="300811574"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{20, 17}, {404, 14}}</string> + <reference key="NSSuperview" ref="300811574"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="283628678"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4194304</int> + <string key="NSContents">These options take effect when X11 is next launched.</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="223835729"/> + <reference key="NSBackgroundColor" ref="57160303"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + </object> + </object> + <string key="NSFrame">{{10, 33}, {438, 279}}</string> + </object> + <string key="NSLabel">Security</string> + <reference key="NSColor" ref="57160303"/> + <reference key="NSTabView" ref="448510093"/> + </object> + </object> + <reference key="NSSelectedTabViewItem" ref="287591690"/> + <reference key="NSFont" ref="463863101"/> + <int key="NSTvFlags">0</int> + <bool key="NSAllowTruncatedLabels">YES</bool> + <bool key="NSDrawsBackground">YES</bool> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="596750588"/> + </object> + </object> + </object> + <string key="NSFrameSize">{481, 345}</string> + </object> + <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> + <string key="NSMinSize">{213, 129}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> + <string key="NSFrameAutosaveName">x11_prefs</string> + </object> + <object class="NSWindowTemplate" id="604417141"> + <int key="NSWindowStyleMask">11</int> + <int key="NSWindowBacking">2</int> + <string key="NSWindowRect">{{361, 362}, {454, 311}}</string> + <int key="NSWTFlags">1350041600</int> + <string key="NSWindowTitle">X11 Application Menu</string> + <string key="NSWindowClass">NSPanel</string> + <object class="NSMutableString" key="NSViewClass"> + <characters key="NS.bytes">View</characters> + </object> + <string key="NSWindowContentMaxSize">{10000, 10000}</string> + <string key="NSWindowContentMinSize">{320, 240}</string> + <object class="NSView" key="NSWindowView" id="85544634"> + <reference key="NSNextResponder"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="671954382"> + <reference key="NSNextResponder" ref="85544634"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{340, 231}, {100, 32}}</string> + <reference key="NSSuperview" ref="85544634"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="143554520"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">137887744</int> + <string key="NSContents">Duplicate</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="671954382"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">1</int> + <object class="NSFont" key="NSAlternateImage" id="549406736"> + <string key="NSName">Helvetica</string> + <double key="NSSize">1.300000e+01</double> + <int key="NSfFlags">16</int> + </object> + <object class="NSMutableString" key="NSAlternateContents"> + <characters key="NS.bytes"/> + </object> + <object class="NSMutableString" key="NSKeyEquivalent"> + <characters key="NS.bytes"/> + </object> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="492358940"> + <reference key="NSNextResponder" ref="85544634"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{340, 199}, {100, 32}}</string> + <reference key="NSSuperview" ref="85544634"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="8201128"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">137887744</int> + <string key="NSContents">Remove</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="492358940"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">1</int> + <reference key="NSAlternateImage" ref="549406736"/> + <object class="NSMutableString" key="NSAlternateContents"> + <characters key="NS.bytes"/> + </object> + <object class="NSMutableString" key="NSKeyEquivalent"> + <characters key="NS.bytes"/> + </object> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSScrollView" id="1063387772"> + <reference key="NSNextResponder" ref="85544634"/> + <int key="NSvFlags">274</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSClipView" id="580565898"> + <reference key="NSNextResponder" ref="1063387772"/> + <int key="NSvFlags">2304</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTableView" id="905092943"> + <reference key="NSNextResponder" ref="580565898"/> + <int key="NSvFlags">256</int> + <string key="NSFrameSize">{301, 198}</string> + <reference key="NSSuperview" ref="580565898"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTableHeaderView" key="NSHeaderView" id="792419186"> + <reference key="NSNextResponder" ref="672307654"/> + <int key="NSvFlags">256</int> + <string key="NSFrameSize">{301, 17}</string> + <reference key="NSSuperview" ref="672307654"/> + <reference key="NSTableView" ref="905092943"/> + </object> + <object class="_NSCornerView" key="NSCornerView" id="898633680"> + <reference key="NSNextResponder" ref="1063387772"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{302, 0}, {16, 17}}</string> + <reference key="NSSuperview" ref="1063387772"/> + </object> + <object class="NSMutableArray" key="NSTableColumns"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTableColumn" id="84282687"> + <double key="NSWidth">9.900000e+01</double> + <double key="NSMinWidth">4.000000e+01</double> + <double key="NSMaxWidth">1.000000e+03</double> + <object class="NSTableHeaderCell" key="NSHeaderCell"> + <int key="NSCellFlags">75628032</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Name</string> + <reference key="NSSupport" ref="26"/> + <object class="NSColor" key="NSBackgroundColor" id="113872566"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC4zMzMzMzI5OQA</bytes> + </object> + <object class="NSColor" key="NSTextColor" id="249576247"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">headerTextColor</string> + <reference key="NSColor" ref="214098874"/> + </object> + </object> + <object class="NSTextFieldCell" key="NSDataCell" id="432610585"> + <int key="NSCellFlags">338820672</int> + <int key="NSCellFlags2">1024</int> + <string key="NSContents">Text Cell</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="905092943"/> + <object class="NSColor" key="NSBackgroundColor" id="822946413"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + <reference key="NSTextColor" ref="930815747"/> + </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> + <bool key="NSIsEditable">YES</bool> + <reference key="NSTableView" ref="905092943"/> + </object> + <object class="NSTableColumn" id="938444323"> + <double key="NSWidth">1.217310e+02</double> + <double key="NSMinWidth">6.273100e+01</double> + <double key="NSMaxWidth">1.000000e+03</double> + <object class="NSTableHeaderCell" key="NSHeaderCell"> + <int key="NSCellFlags">75628032</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Command</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSBackgroundColor" ref="113872566"/> + <reference key="NSTextColor" ref="249576247"/> + </object> + <object class="NSTextFieldCell" key="NSDataCell" id="825378892"> + <int key="NSCellFlags">338820672</int> + <int key="NSCellFlags2">1024</int> + <string key="NSContents">Text Cell</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="905092943"/> + <reference key="NSBackgroundColor" ref="822946413"/> + <reference key="NSTextColor" ref="930815747"/> + </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> + <bool key="NSIsEditable">YES</bool> + <reference key="NSTableView" ref="905092943"/> + </object> + <object class="NSTableColumn" id="242608782"> + <double key="NSWidth">7.100000e+01</double> + <double key="NSMinWidth">1.000000e+01</double> + <double key="NSMaxWidth">1.000000e+03</double> + <object class="NSTableHeaderCell" key="NSHeaderCell"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Shortcut</string> + <reference key="NSSupport" ref="26"/> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">headerColor</string> + <reference key="NSColor" ref="822946413"/> + </object> + <reference key="NSTextColor" ref="249576247"/> + </object> + <object class="NSTextFieldCell" key="NSDataCell" id="34714764"> + <int key="NSCellFlags">338820672</int> + <int key="NSCellFlags2">1024</int> + <string key="NSContents">Text Cell</string> + <object class="NSFont" key="NSSupport"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.200000e+01</double> + <int key="NSfFlags">16</int> + </object> + <reference key="NSControlView" ref="905092943"/> + <bool key="NSDrawsBackground">YES</bool> + <object class="NSColor" key="NSBackgroundColor" id="812484075"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">controlBackgroundColor</string> + <reference key="NSColor" ref="590688762"/> + </object> + <reference key="NSTextColor" ref="930815747"/> + </object> + <int key="NSResizingMask">3</int> + <bool key="NSIsResizeable">YES</bool> + <bool key="NSIsEditable">YES</bool> + <reference key="NSTableView" ref="905092943"/> + </object> + </object> + <double key="NSIntercellSpacingWidth">3.000000e+00</double> + <double key="NSIntercellSpacingHeight">2.000000e+00</double> + <reference key="NSBackgroundColor" ref="822946413"/> + <object class="NSColor" key="NSGridColor"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">gridColor</string> + <object class="NSColor" key="NSColor"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC41AA</bytes> + </object> + </object> + <double key="NSRowHeight">1.700000e+01</double> + <int key="NSTvFlags">1379958784</int> + <int key="NSColumnAutoresizingStyle">1</int> + <int key="NSDraggingSourceMaskForLocal">-1</int> + <int key="NSDraggingSourceMaskForNonLocal">0</int> + <bool key="NSAllowsTypeSelect">YES</bool> + </object> + </object> + <string key="NSFrame">{{1, 17}, {301, 198}}</string> + <reference key="NSSuperview" ref="1063387772"/> + <reference key="NSNextKeyView" ref="905092943"/> + <reference key="NSDocView" ref="905092943"/> + <reference key="NSBGColor" ref="812484075"/> + <int key="NScvFlags">4</int> + </object> + <object class="NSScroller" id="842897584"> + <reference key="NSNextResponder" ref="1063387772"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{302, 17}, {15, 198}}</string> + <reference key="NSSuperview" ref="1063387772"/> + <reference key="NSTarget" ref="1063387772"/> + <string key="NSAction">_doScroller:</string> + <double key="NSPercent">9.949238e-01</double> + </object> + <object class="NSScroller" id="17278747"> + <reference key="NSNextResponder" ref="1063387772"/> + <int key="NSvFlags">256</int> + <string key="NSFrame">{{1, 215}, {301, 15}}</string> + <reference key="NSSuperview" ref="1063387772"/> + <int key="NSsFlags">1</int> + <reference key="NSTarget" ref="1063387772"/> + <string key="NSAction">_doScroller:</string> + <double key="NSPercent">6.885246e-01</double> + </object> + <object class="NSClipView" id="672307654"> + <reference key="NSNextResponder" ref="1063387772"/> + <int key="NSvFlags">2304</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="792419186"/> + </object> + <string key="NSFrame">{{1, 0}, {301, 17}}</string> + <reference key="NSSuperview" ref="1063387772"/> + <reference key="NSNextKeyView" ref="792419186"/> + <reference key="NSDocView" ref="792419186"/> + <reference key="NSBGColor" ref="812484075"/> + <int key="NScvFlags">4</int> + </object> + <reference ref="898633680"/> + </object> + <string key="NSFrame">{{20, 60}, {318, 231}}</string> + <reference key="NSSuperview" ref="85544634"/> + <reference key="NSNextKeyView" ref="580565898"/> + <int key="NSsFlags">50</int> + <reference key="NSVScroller" ref="842897584"/> + <reference key="NSHScroller" ref="17278747"/> + <reference key="NSContentView" ref="580565898"/> + <reference key="NSHeaderClipView" ref="672307654"/> + <reference key="NSCornerView" ref="898633680"/> + <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes> + </object> + <object class="NSButton" id="758204686"> + <reference key="NSNextResponder" ref="85544634"/> + <int key="NSvFlags">265</int> + <string key="NSFrame">{{340, 263}, {100, 32}}</string> + <reference key="NSSuperview" ref="85544634"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="1025474039"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">137887744</int> + <string key="NSContents">Add Item</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="758204686"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">1</int> + <reference key="NSAlternateImage" ref="549406736"/> + <object class="NSMutableString" key="NSAlternateContents"> + <characters key="NS.bytes"/> + </object> + <object class="NSMutableString" key="NSKeyEquivalent"> + <characters key="NS.bytes"/> + </object> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="125703429"> + <reference key="NSNextResponder" ref="85544634"/> + <int key="NSvFlags">257</int> + <string key="NSFrame">{{356, 12}, {84, 32}}</string> + <reference key="NSSuperview" ref="85544634"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="892296813"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">137887744</int> + <string key="NSContents">Cancel</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="125703429"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">1</int> + <reference key="NSAlternateImage" ref="549406736"/> + <object class="NSMutableString" key="NSAlternateContents"> + <characters key="NS.bytes"/> + </object> + <object class="NSMutableString" key="NSKeyEquivalent"> + <characters key="NS.bytes"/> + </object> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + <object class="NSButton" id="724002248"> + <reference key="NSNextResponder" ref="85544634"/> + <int key="NSvFlags">257</int> + <string key="NSFrame">{{272, 12}, {84, 32}}</string> + <reference key="NSSuperview" ref="85544634"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="809610613"> + <int key="NSCellFlags">-2080244224</int> + <int key="NSCellFlags2">137887744</int> + <string key="NSContents">Done</string> + <reference key="NSSupport" ref="463863101"/> + <reference key="NSControlView" ref="724002248"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">1</int> + <reference key="NSAlternateImage" ref="549406736"/> + <string key="NSAlternateContents"/> + <object class="NSMutableString" key="NSKeyEquivalent"> + <characters key="NS.bytes"/> + </object> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + </object> + <string key="NSFrameSize">{454, 311}</string> + <reference key="NSSuperview"/> + </object> + <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> + <string key="NSMinSize">{320, 262}</string> + <string key="NSFrameAutosaveName">x11_apps</string> + </object> + <object class="NSMenu" id="294137138"> + <string key="NSTitle">Menu</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="318286212"> + <reference key="NSMenu" ref="294137138"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="511651072"> + <reference key="NSMenu" ref="294137138"/> + <string key="NSTitle">Applications</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + <string key="NSAction">submenuAction:</string> + <object class="NSMenu" key="NSSubmenu" id="48278059"> + <string key="NSTitle">Applications</string> + <object class="NSMutableArray" key="NSMenuItems"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMenuItem" id="563798000"> + <reference key="NSMenu" ref="48278059"/> + <bool key="NSIsDisabled">YES</bool> + <bool key="NSIsSeparator">YES</bool> + <string key="NSTitle"/> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + <object class="NSMenuItem" id="1032342329"> + <reference key="NSMenu" ref="48278059"/> + <string type="base64-UTF8" key="NSTitle">Q3VzdG9taXpl4oCmA</string> + <string key="NSKeyEquiv"/> + <int key="NSKeyEquivModMask">1048576</int> + <int key="NSMnemonicLoc">2147483647</int> + <reference key="NSOnImage" ref="531645050"/> + <reference key="NSMixedImage" ref="351811234"/> + </object> + </object> + </object> + </object> + </object> + <string key="NSName"/> + </object> + </object> + <object class="IBObjectContainer" key="IBDocument.Objects"> + <object class="NSMutableArray" key="connectionRecords"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">cut:</string> + <reference key="source" ref="941939442"/> + <reference key="destination" ref="581727829"/> + </object> + <int key="connectionID">175</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">paste:</string> + <reference key="source" ref="941939442"/> + <reference key="destination" ref="924678073"/> + </object> + <int key="connectionID">176</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">redo:</string> + <reference key="source" ref="941939442"/> + <reference key="destination" ref="535038564"/> + </object> + <int key="connectionID">178</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">selectAll:</string> + <reference key="source" ref="941939442"/> + <reference key="destination" ref="322866464"/> + </object> + <int key="connectionID">179</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">undo:</string> + <reference key="source" ref="941939442"/> + <reference key="destination" ref="1010221707"/> + </object> + <int key="connectionID">180</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">copy:</string> + <reference key="source" ref="941939442"/> + <reference key="destination" ref="185296989"/> + </object> + <int key="connectionID">181</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">delete:</string> + <reference key="source" ref="941939442"/> + <reference key="destination" ref="994817848"/> + </object> + <int key="connectionID">195</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">minimize_window:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="677652931"/> + </object> + <int key="connectionID">202</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">close_window:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="984461797"/> + </object> + <int key="connectionID">205</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">zoom_window:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="1066447520"/> + </object> + <int key="connectionID">206</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">bring_to_front:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="276216762"/> + </object> + <int key="connectionID">207</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">hideOtherApplications:</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="206802571"/> + </object> + <int key="connectionID">263</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">apps_separator</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="390088328"/> + </object> + <int key="connectionID">273</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">apps_table</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="905092943"/> + </object> + <int key="connectionID">301</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">apps_table_done:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="724002248"/> + </object> + <int key="connectionID">302</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">apps_table_delete:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="492358940"/> + </object> + <int key="connectionID">303</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">apps_table_duplicate:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="671954382"/> + </object> + <int key="connectionID">304</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">apps_table_show:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="1065386165"/> + </object> + <int key="connectionID">308</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">apps_table_cancel:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="125703429"/> + </object> + <int key="connectionID">309</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">apps_table_new:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="758204686"/> + </object> + <int key="connectionID">311</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_show:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="386173216"/> + </object> + <int key="connectionID">318</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">x11_about_item</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="139290918"/> + </object> + <int key="connectionID">321</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">enable_auth</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="989050925"/> + </object> + <int key="connectionID">387</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">enable_tcp</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="700826966"/> + </object> + <int key="connectionID">388</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">depth</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="709074847"/> + </object> + <int key="connectionID">389</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">use_sysbeep</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="418227126"/> + </object> + <int key="connectionID">390</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">fake_buttons</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="119157981"/> + </object> + <int key="connectionID">391</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">sync_keymap</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="179949713"/> + </object> + <int key="connectionID">392</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">enable_keyequivs</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="842100515"/> + </object> + <int key="connectionID">393</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="119157981"/> + </object> + <int key="connectionID">394</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="179949713"/> + </object> + <int key="connectionID">395</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="842100515"/> + </object> + <int key="connectionID">396</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="418227126"/> + </object> + <int key="connectionID">397</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="709074847"/> + </object> + <int key="connectionID">398</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="989050925"/> + </object> + <int key="connectionID">399</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="700826966"/> + </object> + <int key="connectionID">401</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">prefs_panel</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="124913468"/> + </object> + <int key="connectionID">402</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">x11_help:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="504984881"/> + </object> + <int key="connectionID">422</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">dockMenu</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="294137138"/> + </object> + <int key="connectionID">426</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">dock_menu</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="294137138"/> + </object> + <int key="connectionID">428</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">delegate</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="485884620"/> + </object> + <int key="connectionID">429</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">hide:</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="301008465"/> + </object> + <int key="connectionID">430</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">unhideAllApplications:</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="1023546148"/> + </object> + <int key="connectionID">431</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">orderFrontStandardAboutPanel:</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="139290918"/> + </object> + <int key="connectionID">433</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">dock_apps_menu</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="48278059"/> + </object> + <int key="connectionID">530</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">dock_window_separator</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="318286212"/> + </object> + <int key="connectionID">531</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">apps_table_show:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="1032342329"/> + </object> + <int key="connectionID">534</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">next_window:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="1036389925"/> + </object> + <int key="connectionID">539</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">previous_window:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="369641893"/> + </object> + <int key="connectionID">540</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">enable_fullscreen</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="477203622"/> + </object> + <int key="connectionID">546</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">enable_fullscreen_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="477203622"/> + </object> + <int key="connectionID">547</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">toggle_fullscreen:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="6876565"/> + </object> + <int key="connectionID">548</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">toggle_fullscreen_item</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="6876565"/> + </object> + <int key="connectionID">549</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">prefs_changed:</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="915448994"/> + </object> + <int key="connectionID">300300</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">window_separator</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="444952046"/> + </object> + <int key="connectionID">300331</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">click_through</string> + <reference key="source" ref="485884620"/> + <reference key="destination" ref="915448994"/> + </object> + <int key="connectionID">300332</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">menu</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="524015605"/> + </object> + <int key="connectionID">300334</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">terminate:</string> + <reference key="source" ref="815810918"/> + <reference key="destination" ref="274138642"/> + </object> + <int key="connectionID">300336</int> + </object> + </object> + <object class="IBMutableOrderedSet" key="objectRecords"> + <object class="NSArray" key="orderedObjects"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBObjectRecord"> + <int key="objectID">0</int> + <object class="NSArray" key="object" id="330408435"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <reference key="children" ref="904585544"/> + <nil key="parent"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-2</int> + <reference key="object" ref="815810918"/> + <reference key="parent" ref="330408435"/> + <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-1</int> + <reference key="object" ref="941939442"/> + <reference key="parent" ref="330408435"/> + <string key="objectName">First Responder</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">-3</int> + <reference key="object" ref="951368722"/> + <reference key="parent" ref="330408435"/> + <string key="objectName">Application</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">29</int> + <reference key="object" ref="524015605"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="931553638"/> + <reference ref="365880285"/> + <reference ref="200491363"/> + <reference ref="868031522"/> + <reference ref="551174276"/> + </object> + <reference key="parent" ref="330408435"/> + <string key="objectName">MainMenu</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">19</int> + <reference key="object" ref="931553638"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="96874957"/> + </object> + <reference key="parent" ref="524015605"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">24</int> + <reference key="object" ref="96874957"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="677652931"/> + <reference ref="276216762"/> + <reference ref="1066447520"/> + <reference ref="1036389925"/> + <reference ref="280172320"/> + <reference ref="369641893"/> + <reference ref="984461797"/> + <reference ref="155085383"/> + <reference ref="444952046"/> + </object> + <reference key="parent" ref="931553638"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">5</int> + <reference key="object" ref="276216762"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">23</int> + <reference key="object" ref="677652931"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">92</int> + <reference key="object" ref="280172320"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">203</int> + <reference key="object" ref="984461797"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">204</int> + <reference key="object" ref="1066447520"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">536</int> + <reference key="object" ref="155085383"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">537</int> + <reference key="object" ref="1036389925"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">538</int> + <reference key="object" ref="369641893"/> + <reference key="parent" ref="96874957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">56</int> + <reference key="object" ref="365880285"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="576521955"/> + </object> + <reference key="parent" ref="524015605"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">57</int> + <reference key="object" ref="576521955"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="139290918"/> + <reference ref="386173216"/> + <reference ref="32285361"/> + <reference ref="301008465"/> + <reference ref="274138642"/> + <reference ref="272876017"/> + <reference ref="431301145"/> + <reference ref="206802571"/> + <reference ref="848095279"/> + <reference ref="1023546148"/> + <reference ref="6876565"/> + <reference ref="479677589"/> + </object> + <reference key="parent" ref="365880285"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">58</int> + <reference key="object" ref="139290918"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">129</int> + <reference key="object" ref="386173216"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">131</int> + <reference key="object" ref="32285361"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="821388474"/> + </object> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">130</int> + <reference key="object" ref="821388474"/> + <reference key="parent" ref="32285361"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">134</int> + <reference key="object" ref="301008465"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">136</int> + <reference key="object" ref="274138642"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">143</int> + <reference key="object" ref="272876017"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">144</int> + <reference key="object" ref="431301145"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">145</int> + <reference key="object" ref="206802571"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">149</int> + <reference key="object" ref="848095279"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">150</int> + <reference key="object" ref="1023546148"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">544</int> + <reference key="object" ref="6876565"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">545</int> + <reference key="object" ref="479677589"/> + <reference key="parent" ref="576521955"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">163</int> + <reference key="object" ref="200491363"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="526778998"/> + </object> + <reference key="parent" ref="524015605"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">169</int> + <reference key="object" ref="526778998"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="839739619"/> + <reference ref="185296989"/> + <reference ref="1010221707"/> + <reference ref="581727829"/> + <reference ref="994817848"/> + <reference ref="924678073"/> + <reference ref="322866464"/> + <reference ref="535038564"/> + </object> + <reference key="parent" ref="200491363"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">156</int> + <reference key="object" ref="839739619"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">157</int> + <reference key="object" ref="185296989"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">158</int> + <reference key="object" ref="1010221707"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">160</int> + <reference key="object" ref="581727829"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">164</int> + <reference key="object" ref="994817848"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">171</int> + <reference key="object" ref="924678073"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">172</int> + <reference key="object" ref="322866464"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">173</int> + <reference key="object" ref="535038564"/> + <reference key="parent" ref="526778998"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">269</int> + <reference key="object" ref="868031522"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="981161348"/> + </object> + <reference key="parent" ref="524015605"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">270</int> + <reference key="object" ref="981161348"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="390088328"/> + <reference ref="1065386165"/> + </object> + <reference key="parent" ref="868031522"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">272</int> + <reference key="object" ref="390088328"/> + <reference key="parent" ref="981161348"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">305</int> + <reference key="object" ref="1065386165"/> + <reference key="parent" ref="981161348"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">419</int> + <reference key="object" ref="551174276"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="511848303"/> + </object> + <reference key="parent" ref="524015605"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">420</int> + <reference key="object" ref="511848303"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="504984881"/> + </object> + <reference key="parent" ref="551174276"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">421</int> + <reference key="object" ref="504984881"/> + <reference key="parent" ref="511848303"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">196</int> + <reference key="object" ref="485884620"/> + <reference key="parent" ref="330408435"/> + <string key="objectName">X11Controller</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">244</int> + <reference key="object" ref="124913468"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="941366957"/> + </object> + <reference key="parent" ref="330408435"/> + <string key="objectName">PrefsPanel</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">245</int> + <reference key="object" ref="941366957"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="448510093"/> + </object> + <reference key="parent" ref="124913468"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">348</int> + <reference key="object" ref="448510093"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="287591690"/> + <reference ref="960678392"/> + <reference ref="348328898"/> + </object> + <reference key="parent" ref="941366957"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">349</int> + <reference key="object" ref="287591690"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="596750588"/> + </object> + <reference key="parent" ref="448510093"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">351</int> + <reference key="object" ref="596750588"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="119157981"/> + <reference ref="443008216"/> + <reference ref="282885445"/> + <reference ref="842100515"/> + <reference ref="31160162"/> + <reference ref="179949713"/> + <reference ref="915448994"/> + <reference ref="707276799"/> + </object> + <reference key="parent" ref="287591690"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">363</int> + <reference key="object" ref="119157981"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="990762273"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">364</int> + <reference key="object" ref="443008216"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="391919450"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">365</int> + <reference key="object" ref="282885445"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="649334366"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">368</int> + <reference key="object" ref="842100515"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="940564599"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">369</int> + <reference key="object" ref="31160162"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="666057093"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">370</int> + <reference key="object" ref="179949713"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="967619578"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">352</int> + <reference key="object" ref="960678392"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="515308735"/> + </object> + <reference key="parent" ref="448510093"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">350</int> + <reference key="object" ref="515308735"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="418227126"/> + <reference ref="1039016593"/> + <reference ref="709074847"/> + <reference ref="201731424"/> + <reference ref="86150604"/> + <reference ref="477203622"/> + <reference ref="298603383"/> + </object> + <reference key="parent" ref="960678392"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">371</int> + <reference key="object" ref="418227126"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1016069354"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">372</int> + <reference key="object" ref="1039016593"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="624655599"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">382</int> + <reference key="object" ref="709074847"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="633115429"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">385</int> + <reference key="object" ref="201731424"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="930265681"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">386</int> + <reference key="object" ref="86150604"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="311969422"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">541</int> + <reference key="object" ref="477203622"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="631531164"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">543</int> + <reference key="object" ref="298603383"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="761107402"/> + </object> + <reference key="parent" ref="515308735"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">353</int> + <reference key="object" ref="348328898"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="300811574"/> + </object> + <reference key="parent" ref="448510093"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">354</int> + <reference key="object" ref="300811574"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="989050925"/> + <reference ref="700826966"/> + <reference ref="168436707"/> + <reference ref="363817195"/> + <reference ref="223835729"/> + </object> + <reference key="parent" ref="348328898"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">374</int> + <reference key="object" ref="989050925"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="189594322"/> + </object> + <reference key="parent" ref="300811574"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">375</int> + <reference key="object" ref="700826966"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="489340979"/> + </object> + <reference key="parent" ref="300811574"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">376</int> + <reference key="object" ref="168436707"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="53243865"/> + </object> + <reference key="parent" ref="300811574"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">377</int> + <reference key="object" ref="363817195"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="390084685"/> + </object> + <reference key="parent" ref="300811574"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">379</int> + <reference key="object" ref="223835729"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="283628678"/> + </object> + <reference key="parent" ref="300811574"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">285</int> + <reference key="object" ref="604417141"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="85544634"/> + </object> + <reference key="parent" ref="330408435"/> + <string key="objectName">EditPrograms</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">286</int> + <reference key="object" ref="85544634"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1063387772"/> + <reference ref="758204686"/> + <reference ref="671954382"/> + <reference ref="492358940"/> + <reference ref="125703429"/> + <reference ref="724002248"/> + </object> + <reference key="parent" ref="604417141"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">423</int> + <reference key="object" ref="294137138"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="318286212"/> + <reference ref="511651072"/> + </object> + <reference key="parent" ref="330408435"/> + <string key="objectName">DockMenu</string> + </object> + <object class="IBObjectRecord"> + <int key="objectID">524</int> + <reference key="object" ref="318286212"/> + <reference key="parent" ref="294137138"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">526</int> + <reference key="object" ref="511651072"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="48278059"/> + </object> + <reference key="parent" ref="294137138"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">527</int> + <reference key="object" ref="48278059"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1032342329"/> + <reference ref="563798000"/> + </object> + <reference key="parent" ref="511651072"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">532</int> + <reference key="object" ref="1032342329"/> + <reference key="parent" ref="48278059"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">533</int> + <reference key="object" ref="563798000"/> + <reference key="parent" ref="48278059"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100363</int> + <reference key="object" ref="990762273"/> + <reference key="parent" ref="119157981"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100364</int> + <reference key="object" ref="391919450"/> + <reference key="parent" ref="443008216"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100365</int> + <reference key="object" ref="649334366"/> + <reference key="parent" ref="282885445"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100368</int> + <reference key="object" ref="940564599"/> + <reference key="parent" ref="842100515"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100369</int> + <reference key="object" ref="666057093"/> + <reference key="parent" ref="31160162"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100370</int> + <reference key="object" ref="967619578"/> + <reference key="parent" ref="179949713"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100371</int> + <reference key="object" ref="1016069354"/> + <reference key="parent" ref="418227126"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100372</int> + <reference key="object" ref="624655599"/> + <reference key="parent" ref="1039016593"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100382</int> + <reference key="object" ref="633115429"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="341113515"/> + </object> + <reference key="parent" ref="709074847"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100385</int> + <reference key="object" ref="930265681"/> + <reference key="parent" ref="201731424"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100386</int> + <reference key="object" ref="311969422"/> + <reference key="parent" ref="86150604"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100541</int> + <reference key="object" ref="631531164"/> + <reference key="parent" ref="477203622"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100543</int> + <reference key="object" ref="761107402"/> + <reference key="parent" ref="298603383"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100374</int> + <reference key="object" ref="189594322"/> + <reference key="parent" ref="989050925"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100375</int> + <reference key="object" ref="489340979"/> + <reference key="parent" ref="700826966"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100376</int> + <reference key="object" ref="53243865"/> + <reference key="parent" ref="168436707"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100377</int> + <reference key="object" ref="390084685"/> + <reference key="parent" ref="363817195"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100379</int> + <reference key="object" ref="283628678"/> + <reference key="parent" ref="223835729"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">380</int> + <reference key="object" ref="341113515"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="759499526"/> + <reference ref="616492372"/> + <reference ref="543935434"/> + <reference ref="836673018"/> + </object> + <reference key="parent" ref="633115429"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">435</int> + <reference key="object" ref="759499526"/> + <reference key="parent" ref="341113515"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">384</int> + <reference key="object" ref="616492372"/> + <reference key="parent" ref="341113515"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">383</int> + <reference key="object" ref="543935434"/> + <reference key="parent" ref="341113515"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">381</int> + <reference key="object" ref="836673018"/> + <reference key="parent" ref="341113515"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300296</int> + <reference key="object" ref="915448994"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="117056849"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300297</int> + <reference key="object" ref="117056849"/> + <reference key="parent" ref="915448994"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300298</int> + <reference key="object" ref="707276799"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="318286890"/> + </object> + <reference key="parent" ref="596750588"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300299</int> + <reference key="object" ref="318286890"/> + <reference key="parent" ref="707276799"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">295</int> + <reference key="object" ref="1063387772"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="792419186"/> + <reference ref="17278747"/> + <reference ref="842897584"/> + <reference ref="905092943"/> + </object> + <reference key="parent" ref="85544634"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300295</int> + <reference key="object" ref="792419186"/> + <reference key="parent" ref="1063387772"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">200295</int> + <reference key="object" ref="17278747"/> + <reference key="parent" ref="1063387772"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100295</int> + <reference key="object" ref="842897584"/> + <reference key="parent" ref="1063387772"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">296</int> + <reference key="object" ref="905092943"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="242608782"/> + <reference ref="938444323"/> + <reference ref="84282687"/> + </object> + <reference key="parent" ref="1063387772"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">535</int> + <reference key="object" ref="242608782"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="34714764"/> + </object> + <reference key="parent" ref="905092943"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">575</int> + <reference key="object" ref="34714764"/> + <reference key="parent" ref="242608782"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">298</int> + <reference key="object" ref="938444323"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="825378892"/> + </object> + <reference key="parent" ref="905092943"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">573</int> + <reference key="object" ref="825378892"/> + <reference key="parent" ref="938444323"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">297</int> + <reference key="object" ref="84282687"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="432610585"/> + </object> + <reference key="parent" ref="905092943"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">574</int> + <reference key="object" ref="432610585"/> + <reference key="parent" ref="84282687"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">310</int> + <reference key="object" ref="758204686"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="1025474039"/> + </object> + <reference key="parent" ref="85544634"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100310</int> + <reference key="object" ref="1025474039"/> + <reference key="parent" ref="758204686"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">292</int> + <reference key="object" ref="671954382"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="143554520"/> + </object> + <reference key="parent" ref="85544634"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100292</int> + <reference key="object" ref="143554520"/> + <reference key="parent" ref="671954382"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">293</int> + <reference key="object" ref="492358940"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="8201128"/> + </object> + <reference key="parent" ref="85544634"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100293</int> + <reference key="object" ref="8201128"/> + <reference key="parent" ref="492358940"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">299</int> + <reference key="object" ref="125703429"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="892296813"/> + </object> + <reference key="parent" ref="85544634"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100299</int> + <reference key="object" ref="892296813"/> + <reference key="parent" ref="125703429"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">291</int> + <reference key="object" ref="724002248"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="809610613"/> + </object> + <reference key="parent" ref="85544634"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">100291</int> + <reference key="object" ref="809610613"/> + <reference key="parent" ref="724002248"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">300330</int> + <reference key="object" ref="444952046"/> + <reference key="parent" ref="96874957"/> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="flattenedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>-1.IBPluginDependency</string> + <string>-2.IBPluginDependency</string> + <string>-3.IBPluginDependency</string> + <string>-3.ImportedFromIB2</string> + <string>100295.IBShouldRemoveOnLegacySave</string> + <string>129.IBPluginDependency</string> + <string>129.ImportedFromIB2</string> + <string>130.IBPluginDependency</string> + <string>130.ImportedFromIB2</string> + <string>131.IBPluginDependency</string> + <string>131.ImportedFromIB2</string> + <string>134.IBPluginDependency</string> + <string>134.ImportedFromIB2</string> + <string>136.IBPluginDependency</string> + <string>136.ImportedFromIB2</string> + <string>143.IBPluginDependency</string> + <string>143.ImportedFromIB2</string> + <string>144.IBPluginDependency</string> + <string>144.ImportedFromIB2</string> + <string>145.IBPluginDependency</string> + <string>145.ImportedFromIB2</string> + <string>149.IBPluginDependency</string> + <string>149.ImportedFromIB2</string> + <string>150.IBPluginDependency</string> + <string>150.ImportedFromIB2</string> + <string>156.IBPluginDependency</string> + <string>156.ImportedFromIB2</string> + <string>157.IBPluginDependency</string> + <string>157.ImportedFromIB2</string> + <string>158.IBPluginDependency</string> + <string>158.ImportedFromIB2</string> + <string>160.IBPluginDependency</string> + <string>160.ImportedFromIB2</string> + <string>163.IBPluginDependency</string> + <string>163.ImportedFromIB2</string> + <string>164.IBPluginDependency</string> + <string>164.ImportedFromIB2</string> + <string>169.IBPluginDependency</string> + <string>169.ImportedFromIB2</string> + <string>169.editorWindowContentRectSynchronizationRect</string> + <string>171.IBPluginDependency</string> + <string>171.ImportedFromIB2</string> + <string>172.IBPluginDependency</string> + <string>172.ImportedFromIB2</string> + <string>173.IBPluginDependency</string> + <string>173.ImportedFromIB2</string> + <string>19.IBPluginDependency</string> + <string>19.ImportedFromIB2</string> + <string>196.IBPluginDependency</string> + <string>196.ImportedFromIB2</string> + <string>200295.IBShouldRemoveOnLegacySave</string> + <string>203.IBPluginDependency</string> + <string>203.ImportedFromIB2</string> + <string>204.IBPluginDependency</string> + <string>204.ImportedFromIB2</string> + <string>23.IBPluginDependency</string> + <string>23.ImportedFromIB2</string> + <string>24.IBPluginDependency</string> + <string>24.ImportedFromIB2</string> + <string>24.editorWindowContentRectSynchronizationRect</string> + <string>244.IBPluginDependency</string> + <string>244.IBWindowTemplateEditedContentRect</string> + <string>244.ImportedFromIB2</string> + <string>244.editorWindowContentRectSynchronizationRect</string> + <string>244.windowTemplate.hasMaxSize</string> + <string>244.windowTemplate.hasMinSize</string> + <string>244.windowTemplate.maxSize</string> + <string>244.windowTemplate.minSize</string> + <string>245.IBPluginDependency</string> + <string>245.ImportedFromIB2</string> + <string>269.IBPluginDependency</string> + <string>269.ImportedFromIB2</string> + <string>270.IBPluginDependency</string> + <string>270.ImportedFromIB2</string> + <string>270.editorWindowContentRectSynchronizationRect</string> + <string>272.IBPluginDependency</string> + <string>272.ImportedFromIB2</string> + <string>285.IBEditorWindowLastContentRect</string> + <string>285.IBPluginDependency</string> + <string>285.IBViewEditorWindowController.showingBoundsRectangles</string> + <string>285.IBViewEditorWindowController.showingLayoutRectangles</string> + <string>285.IBWindowTemplateEditedContentRect</string> + <string>285.ImportedFromIB2</string> + <string>285.editorWindowContentRectSynchronizationRect</string> + <string>285.lastResizeAction</string> + <string>285.windowTemplate.hasMaxSize</string> + <string>285.windowTemplate.hasMinSize</string> + <string>285.windowTemplate.maxSize</string> + <string>285.windowTemplate.minSize</string> + <string>286.IBPluginDependency</string> + <string>286.ImportedFromIB2</string> + <string>29.IBEditorWindowLastContentRect</string> + <string>29.IBPluginDependency</string> + <string>29.ImportedFromIB2</string> + <string>29.editorWindowContentRectSynchronizationRect</string> + <string>291.IBPluginDependency</string> + <string>291.ImportedFromIB2</string> + <string>292.IBPluginDependency</string> + <string>292.ImportedFromIB2</string> + <string>293.IBPluginDependency</string> + <string>293.ImportedFromIB2</string> + <string>295.IBPluginDependency</string> + <string>295.ImportedFromIB2</string> + <string>296.IBPluginDependency</string> + <string>296.ImportedFromIB2</string> + <string>297.IBPluginDependency</string> + <string>297.ImportedFromIB2</string> + <string>298.IBPluginDependency</string> + <string>298.ImportedFromIB2</string> + <string>299.IBPluginDependency</string> + <string>299.ImportedFromIB2</string> + <string>300295.IBShouldRemoveOnLegacySave</string> + <string>300296.IBPluginDependency</string> + <string>300296.ImportedFromIB2</string> + <string>300298.IBPluginDependency</string> + <string>300298.ImportedFromIB2</string> + <string>300330.IBPluginDependency</string> + <string>300330.ImportedFromIB2</string> + <string>305.IBPluginDependency</string> + <string>305.ImportedFromIB2</string> + <string>310.IBPluginDependency</string> + <string>310.ImportedFromIB2</string> + <string>348.IBPluginDependency</string> + <string>348.ImportedFromIB2</string> + <string>349.IBPluginDependency</string> + <string>349.ImportedFromIB2</string> + <string>350.IBPluginDependency</string> + <string>350.ImportedFromIB2</string> + <string>351.IBPluginDependency</string> + <string>351.ImportedFromIB2</string> + <string>352.IBPluginDependency</string> + <string>352.ImportedFromIB2</string> + <string>353.IBPluginDependency</string> + <string>353.ImportedFromIB2</string> + <string>354.IBPluginDependency</string> + <string>354.ImportedFromIB2</string> + <string>363.IBPluginDependency</string> + <string>363.ImportedFromIB2</string> + <string>364.IBPluginDependency</string> + <string>364.ImportedFromIB2</string> + <string>365.IBPluginDependency</string> + <string>365.ImportedFromIB2</string> + <string>368.IBPluginDependency</string> + <string>368.ImportedFromIB2</string> + <string>369.IBPluginDependency</string> + <string>369.ImportedFromIB2</string> + <string>370.IBPluginDependency</string> + <string>370.ImportedFromIB2</string> + <string>371.IBPluginDependency</string> + <string>371.ImportedFromIB2</string> + <string>372.IBPluginDependency</string> + <string>372.ImportedFromIB2</string> + <string>374.IBPluginDependency</string> + <string>374.ImportedFromIB2</string> + <string>375.IBPluginDependency</string> + <string>375.ImportedFromIB2</string> + <string>376.IBPluginDependency</string> + <string>376.ImportedFromIB2</string> + <string>377.IBPluginDependency</string> + <string>377.ImportedFromIB2</string> + <string>379.IBPluginDependency</string> + <string>379.ImportedFromIB2</string> + <string>380.IBPluginDependency</string> + <string>380.ImportedFromIB2</string> + <string>381.IBPluginDependency</string> + <string>381.ImportedFromIB2</string> + <string>382.IBPluginDependency</string> + <string>382.ImportedFromIB2</string> + <string>383.IBPluginDependency</string> + <string>383.ImportedFromIB2</string> + <string>384.IBPluginDependency</string> + <string>384.ImportedFromIB2</string> + <string>385.IBPluginDependency</string> + <string>385.ImportedFromIB2</string> + <string>386.IBPluginDependency</string> + <string>386.ImportedFromIB2</string> + <string>419.IBPluginDependency</string> + <string>419.ImportedFromIB2</string> + <string>420.IBPluginDependency</string> + <string>420.ImportedFromIB2</string> + <string>421.IBPluginDependency</string> + <string>421.ImportedFromIB2</string> + <string>423.IBPluginDependency</string> + <string>423.ImportedFromIB2</string> + <string>435.IBPluginDependency</string> + <string>435.ImportedFromIB2</string> + <string>5.IBPluginDependency</string> + <string>5.ImportedFromIB2</string> + <string>524.IBPluginDependency</string> + <string>524.ImportedFromIB2</string> + <string>526.IBPluginDependency</string> + <string>526.ImportedFromIB2</string> + <string>527.IBPluginDependency</string> + <string>527.ImportedFromIB2</string> + <string>532.IBPluginDependency</string> + <string>532.ImportedFromIB2</string> + <string>533.IBPluginDependency</string> + <string>533.ImportedFromIB2</string> + <string>535.IBPluginDependency</string> + <string>535.ImportedFromIB2</string> + <string>536.IBPluginDependency</string> + <string>536.ImportedFromIB2</string> + <string>537.IBPluginDependency</string> + <string>537.ImportedFromIB2</string> + <string>538.IBPluginDependency</string> + <string>538.ImportedFromIB2</string> + <string>541.IBPluginDependency</string> + <string>541.ImportedFromIB2</string> + <string>543.IBPluginDependency</string> + <string>543.ImportedFromIB2</string> + <string>544.IBPluginDependency</string> + <string>544.ImportedFromIB2</string> + <string>545.IBPluginDependency</string> + <string>545.ImportedFromIB2</string> + <string>56.IBPluginDependency</string> + <string>56.ImportedFromIB2</string> + <string>57.IBEditorWindowLastContentRect</string> + <string>57.IBPluginDependency</string> + <string>57.ImportedFromIB2</string> + <string>57.editorWindowContentRectSynchronizationRect</string> + <string>573.IBPluginDependency</string> + <string>573.ImportedFromIB2</string> + <string>574.IBPluginDependency</string> + <string>574.ImportedFromIB2</string> + <string>575.IBPluginDependency</string> + <string>575.ImportedFromIB2</string> + <string>58.IBPluginDependency</string> + <string>58.ImportedFromIB2</string> + <string>92.IBPluginDependency</string> + <string>92.ImportedFromIB2</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1" id="9"/> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{202, 626}, {154, 153}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{271, 666}, {301, 153}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>{{184, 290}, {481, 345}}</string> + <reference ref="9"/> + <string>{{184, 290}, {481, 345}}</string> + <reference ref="9"/> + <reference ref="9"/> + <string>{3.40282e+38, 3.40282e+38}</string> + <string>{213, 107}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{100, 746}, {155, 33}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{537, 545}, {454, 311}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <reference ref="9"/> + <string>{{537, 545}, {454, 311}}</string> + <reference ref="9"/> + <string>{{433, 406}, {486, 327}}</string> + <object class="NSDictionary"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>IBResizeActionFinalFrame</string> + <string>IBResizeActionInitialFrame</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>{{537, 554}, {454, 311}}</string> + <string>{{537, 576}, {471, 289}}</string> + </object> + </object> + <integer value="0"/> + <reference ref="9"/> + <string>{3.40282e+38, 3.40282e+38}</string> + <string>{320, 240}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{0, 836}, {336, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{67, 819}, {336, 20}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{12, 633}, {218, 203}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>{{79, 616}, {218, 203}}</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <reference ref="9"/> + </object> + </object> + <object class="NSMutableDictionary" key="unlocalizedProperties"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="activeLocalization"/> + <object class="NSMutableDictionary" key="localizations"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + <nil key="sourceID"/> + <int key="maxID">300336</int> + </object> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">FirstResponder</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">NSFormatter</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">X11Controller</string> + <string key="superclassName">NSObject</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>apps_table_cancel:</string> + <string>apps_table_delete:</string> + <string>apps_table_done:</string> + <string>apps_table_duplicate:</string> + <string>apps_table_new:</string> + <string>apps_table_show:</string> + <string>bring_to_front:</string> + <string>close_window:</string> + <string>enable_fullscreen_changed:</string> + <string>minimize_window:</string> + <string>next_window:</string> + <string>prefs_changed:</string> + <string>prefs_show:</string> + <string>previous_window:</string> + <string>quit:</string> + <string>toggle_fullscreen:</string> + <string>x11_help:</string> + <string>zoom_window:</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSMutableArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>apps_separator</string> + <string>apps_table</string> + <string>click_through</string> + <string>depth</string> + <string>dock_apps_menu</string> + <string>dock_menu</string> + <string>dock_window_separator</string> + <string>enable_auth</string> + <string>enable_fullscreen</string> + <string>enable_keyequivs</string> + <string>enable_tcp</string> + <string>fake_buttons</string> + <string>prefs_panel</string> + <string>sync_keymap</string> + <string>toggle_fullscreen_item</string> + <string>use_sysbeep</string> + <string>window_separator</string> + <string>x11_about_item</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>NSMenuItem</string> + <string>NSTableView</string> + <string>NSButton</string> + <string>NSPopUpButton</string> + <string>NSMenu</string> + <string>NSMenu</string> + <string>NSMenuItem</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSButton</string> + <string>NSPanel</string> + <string>NSButton</string> + <string>NSMenuItem</string> + <string>NSButton</string> + <string>NSMenuItem</string> + <string>NSMenuItem</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBUserSource</string> + <string key="minorKey"/> + </object> + </object> + </object> + </object> + <int key="IBDocument.localizationMode">0</int> + <nil key="IBDocument.LastKnownRelativeProjectPath"/> + <int key="IBDocument.defaultPropertyAccessControl">3</int> + </data> +</archive> diff --git a/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..f60dcbacb --- /dev/null +++ b/hw/xquartz/bundle/English.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/French.lproj/InfoPlist.strings b/hw/xquartz/bundle/French.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..88e1f04ac --- /dev/null +++ b/hw/xquartz/bundle/French.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/French.lproj/Localizable.strings b/hw/xquartz/bundle/French.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..2770dfb8c --- /dev/null +++ b/hw/xquartz/bundle/French.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..9f9a7da67 --- /dev/null +++ b/hw/xquartz/bundle/French.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/German.lproj/InfoPlist.strings b/hw/xquartz/bundle/German.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..aa37e7555 --- /dev/null +++ b/hw/xquartz/bundle/German.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/German.lproj/Localizable.strings b/hw/xquartz/bundle/German.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..a5489ab5c --- /dev/null +++ b/hw/xquartz/bundle/German.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..19532a9c2 --- /dev/null +++ b/hw/xquartz/bundle/German.lproj/main.nib/keyedobjects.nib diff --git a/hw/darwin/apple/Info.plist b/hw/xquartz/bundle/Info.plist index 66f1f6be1..6ba02dda2 100644 --- a/hw/darwin/apple/Info.plist +++ b/hw/xquartz/bundle/Info.plist @@ -3,33 +3,37 @@ <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> - <string>English</string> + <string>English</string> <key>CFBundleExecutable</key> - <string>X11</string> + <string>X11</string> <key>CFBundleGetInfoString</key> - <string>X11</string> + <string>X11</string> <key>CFBundleIconFile</key> - <string>X11.icns</string> + <string>X11.icns</string> <key>CFBundleIdentifier</key> - <string>org.x.X11</string> + <string>org.x.X11</string> <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> + <string>6.0</string> <key>CFBundleName</key> - <string>X11</string> + <string>X11</string> <key>CFBundlePackageType</key> - <string>APPL</string> + <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>2.0</string> + <string>2.2.0</string> <key>CFBundleSignature</key> - <string>x11a</string> + <string>x11a</string> <key>CSResourcesFileMapped</key> - <true/> + <true/> <key>NSHumanReadableCopyright</key> - <string>Copyright © 2003-2007, Apple Inc. -Copyright © 2003, XFree86 Project, Inc.</string> + <string>Copyright © 2003-2008, Apple Inc. +Copyright © 2003, XFree86 Project, Inc. +Copyright © 2003-2008, X.org Foundation, Inc. +</string> <key>NSMainNibFile</key> - <string>main</string> + <string>main</string> <key>NSPrincipalClass</key> - <string>X11Application</string> + <string>X11Application</string> + <key>LSBackgroundOnly</key> + <true/> </dict> </plist> diff --git a/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings b/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..412169880 --- /dev/null +++ b/hw/xquartz/bundle/Italian.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Italian.lproj/Localizable.strings b/hw/xquartz/bundle/Italian.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..d05d73d44 --- /dev/null +++ b/hw/xquartz/bundle/Italian.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b6e2e1bb1 --- /dev/null +++ b/hw/xquartz/bundle/Italian.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings b/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..2d6330fa7 --- /dev/null +++ b/hw/xquartz/bundle/Japanese.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Japanese.lproj/Localizable.strings b/hw/xquartz/bundle/Japanese.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..99821ea1f --- /dev/null +++ b/hw/xquartz/bundle/Japanese.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..523fd0856 --- /dev/null +++ b/hw/xquartz/bundle/Japanese.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Makefile.am b/hw/xquartz/bundle/Makefile.am new file mode 100644 index 000000000..801fdc7d8 --- /dev/null +++ b/hw/xquartz/bundle/Makefile.am @@ -0,0 +1,77 @@ +bin_SCRIPTS = x11app + +.PHONY: x11app + +x11app: + xcodebuild CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ARCHS="$(X11APP_ARCHS)" + +install-data-hook: + xcodebuild install DSTROOT="/$(DESTDIR)" INSTALL_PATH="$(APPLE_APPLICATIONS_DIR)" DEPLOYMENT_LOCATION=YES SKIP_INSTALL=NO ARCHS="$(X11APP_ARCHS)" + +clean-local: + rm -rf build + +resourcedir=$(libdir)/X11/xserver +resource_DATA = Xquartz.plist + +EXTRA_DIST = \ + $(resource_DATA) \ + Info.plist \ + X11.icns \ + bundle-main.c \ + X11.xcodeproj/project.pbxproj \ + Dutch.lproj/InfoPlist.strings \ + Dutch.lproj/Localizable.strings \ + Dutch.lproj/main.nib/keyedobjects.nib \ + English.lproj/InfoPlist.strings \ + English.lproj/Localizable.strings \ + English.lproj/main.nib/designable.nib \ + English.lproj/main.nib/keyedobjects.nib \ + French.lproj/InfoPlist.strings \ + French.lproj/Localizable.strings \ + French.lproj/main.nib/keyedobjects.nib \ + German.lproj/InfoPlist.strings \ + German.lproj/Localizable.strings \ + German.lproj/main.nib/keyedobjects.nib \ + Italian.lproj/InfoPlist.strings \ + Italian.lproj/Localizable.strings \ + Italian.lproj/main.nib/keyedobjects.nib \ + Japanese.lproj/InfoPlist.strings \ + Japanese.lproj/Localizable.strings \ + Japanese.lproj/main.nib/keyedobjects.nib \ + Spanish.lproj/InfoPlist.strings \ + Spanish.lproj/Localizable.strings \ + Spanish.lproj/main.nib/keyedobjects.nib \ + da.lproj/InfoPlist.strings \ + da.lproj/Localizable.strings \ + da.lproj/main.nib/keyedobjects.nib \ + fi.lproj/InfoPlist.strings \ + fi.lproj/Localizable.strings \ + fi.lproj/main.nib/keyedobjects.nib \ + ko.lproj/InfoPlist.strings \ + ko.lproj/Localizable.strings \ + ko.lproj/main.nib/keyedobjects.nib \ + no.lproj/InfoPlist.strings \ + no.lproj/Localizable.strings \ + no.lproj/main.nib/keyedobjects.nib \ + pl.lproj/InfoPlist.strings \ + pl.lproj/Localizable.strings \ + pl.lproj/main.nib/keyedobjects.nib \ + pt.lproj/InfoPlist.strings \ + pt.lproj/Localizable.strings \ + pt.lproj/main.nib/keyedobjects.nib \ + pt_PT.lproj/InfoPlist.strings \ + pt_PT.lproj/Localizable.strings \ + pt_PT.lproj/main.nib/keyedobjects.nib \ + ru.lproj/InfoPlist.strings \ + ru.lproj/Localizable.strings \ + ru.lproj/main.nib/keyedobjects.nib \ + sv.lproj/InfoPlist.strings \ + sv.lproj/Localizable.strings \ + sv.lproj/main.nib/keyedobjects.nib \ + zh_CN.lproj/InfoPlist.strings \ + zh_CN.lproj/Localizable.strings \ + zh_CN.lproj/main.nib/keyedobjects.nib \ + zh_TW.lproj/InfoPlist.strings \ + zh_TW.lproj/Localizable.strings \ + zh_TW.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings b/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..0e4287d14 --- /dev/null +++ b/hw/xquartz/bundle/Spanish.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/Spanish.lproj/Localizable.strings b/hw/xquartz/bundle/Spanish.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..652f432a5 --- /dev/null +++ b/hw/xquartz/bundle/Spanish.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..029349dd0 --- /dev/null +++ b/hw/xquartz/bundle/Spanish.lproj/main.nib/keyedobjects.nib diff --git a/hw/darwin/apple/X11.icns b/hw/xquartz/bundle/X11.icns Binary files differindex d770e617d..d770e617d 100644 --- a/hw/darwin/apple/X11.icns +++ b/hw/xquartz/bundle/X11.icns diff --git a/hw/darwin/apple/X11.xcodeproj/project.pbxproj b/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj index 217f07e52..ae8ec07e6 100644 --- a/hw/darwin/apple/X11.xcodeproj/project.pbxproj +++ b/hw/xquartz/bundle/X11.xcodeproj/project.pbxproj @@ -20,6 +20,57 @@ /* Begin PBXFileReference section */ 0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E460D1B6C05005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E470D1B6C05005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E480D1B6C05005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E490D1B6C05005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E4A0D1B6C05005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E4B0D1B6C05005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E4C0D1B6C05005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E4D0D1B6C05005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E4E0D1B6C05005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E4F0D1B6C05005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E500D1B6C05005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E510D1B6C05005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E520D1B6C05005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E530D1B6C05005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E540D1B6C05005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E550D1B6C05005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E560D1B6C05005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/Localizable.strings; sourceTree = "<group>"; }; + 3FB03E570D1B6C17005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E580D1B6C17005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E590D1B6C17005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E5A0D1B6C17005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E5B0D1B6C17005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = German.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E5C0D1B6C17005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Italian; path = Italian.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E5D0D1B6C17005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E5E0D1B6C17005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E5F0D1B6C17005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = no; path = no.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E600D1B6C17005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E610D1B6C17005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E620D1B6C17005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E630D1B6C17005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E640D1B6C17005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E650D1B6C17005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E660D1B6C17005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E670D1B6C17005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + 3FB03E680D1B6C34005958A5 /* da */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = da; path = da.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E690D1B6C34005958A5 /* Dutch */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Dutch; path = Dutch.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E6A0D1B6C34005958A5 /* fi */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = fi; path = fi.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E6B0D1B6C34005958A5 /* French */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = French; path = French.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E6C0D1B6C34005958A5 /* German */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = German; path = German.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E6D0D1B6C34005958A5 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = Italian.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E6E0D1B6C34005958A5 /* Japanese */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E6F0D1B6C34005958A5 /* ko */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ko; path = ko.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E700D1B6C34005958A5 /* no */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = no; path = no.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E710D1B6C34005958A5 /* pl */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pl; path = pl.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E720D1B6C34005958A5 /* pt */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt; path = pt.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E730D1B6C34005958A5 /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = pt_PT; path = pt_PT.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E740D1B6C34005958A5 /* ru */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = ru; path = ru.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E750D1B6C34005958A5 /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = Spanish.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E760D1B6C34005958A5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = sv; path = sv.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E770D1B6C34005958A5 /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_CN; path = zh_CN.lproj/main.nib; sourceTree = "<group>"; }; + 3FB03E780D1B6C34005958A5 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = zh_TW; path = zh_TW.lproj/main.nib; sourceTree = "<group>"; }; 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; }; 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; }; 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; }; @@ -130,10 +181,29 @@ buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */; compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + da, + Dutch, + fi, + Italian, + ko, + no, + pl, + pt, + pt_PT, + ru, + Spanish, + sv, + zh_CN, + zh_TW, + ); mainGroup = 20286C29FDCF999611CA2CEA /* X11 */; projectDirPath = ""; projectRoot = ""; - shouldCheckCompatibility = 1; targets = ( 527F24160B5D938C007840A7 /* X11 */, ); @@ -181,6 +251,23 @@ isa = PBXVariantGroup; children = ( 1870340FFE93FCAF11CA0CD7 /* English */, + 3FB03E680D1B6C34005958A5 /* da */, + 3FB03E690D1B6C34005958A5 /* Dutch */, + 3FB03E6A0D1B6C34005958A5 /* fi */, + 3FB03E6B0D1B6C34005958A5 /* French */, + 3FB03E6C0D1B6C34005958A5 /* German */, + 3FB03E6D0D1B6C34005958A5 /* Italian */, + 3FB03E6E0D1B6C34005958A5 /* Japanese */, + 3FB03E6F0D1B6C34005958A5 /* ko */, + 3FB03E700D1B6C34005958A5 /* no */, + 3FB03E710D1B6C34005958A5 /* pl */, + 3FB03E720D1B6C34005958A5 /* pt */, + 3FB03E730D1B6C34005958A5 /* pt_PT */, + 3FB03E740D1B6C34005958A5 /* ru */, + 3FB03E750D1B6C34005958A5 /* Spanish */, + 3FB03E760D1B6C34005958A5 /* sv */, + 3FB03E770D1B6C34005958A5 /* zh_CN */, + 3FB03E780D1B6C34005958A5 /* zh_TW */, ); name = main.nib; sourceTree = "<group>"; @@ -189,6 +276,23 @@ isa = PBXVariantGroup; children = ( 0867D6ABFE840B52C02AAC07 /* English */, + 3FB03E570D1B6C17005958A5 /* da */, + 3FB03E580D1B6C17005958A5 /* Dutch */, + 3FB03E590D1B6C17005958A5 /* fi */, + 3FB03E5A0D1B6C17005958A5 /* French */, + 3FB03E5B0D1B6C17005958A5 /* German */, + 3FB03E5C0D1B6C17005958A5 /* Italian */, + 3FB03E5D0D1B6C17005958A5 /* Japanese */, + 3FB03E5E0D1B6C17005958A5 /* ko */, + 3FB03E5F0D1B6C17005958A5 /* no */, + 3FB03E600D1B6C17005958A5 /* pl */, + 3FB03E610D1B6C17005958A5 /* pt */, + 3FB03E620D1B6C17005958A5 /* pt_PT */, + 3FB03E630D1B6C17005958A5 /* ru */, + 3FB03E640D1B6C17005958A5 /* Spanish */, + 3FB03E650D1B6C17005958A5 /* sv */, + 3FB03E660D1B6C17005958A5 /* zh_CN */, + 3FB03E670D1B6C17005958A5 /* zh_TW */, ); name = InfoPlist.strings; sourceTree = "<group>"; @@ -197,6 +301,23 @@ isa = PBXVariantGroup; children = ( 52D9C0EC0BCDDF6B00CD2AFC /* English */, + 3FB03E460D1B6C05005958A5 /* da */, + 3FB03E470D1B6C05005958A5 /* Dutch */, + 3FB03E480D1B6C05005958A5 /* fi */, + 3FB03E490D1B6C05005958A5 /* French */, + 3FB03E4A0D1B6C05005958A5 /* German */, + 3FB03E4B0D1B6C05005958A5 /* Italian */, + 3FB03E4C0D1B6C05005958A5 /* Japanese */, + 3FB03E4D0D1B6C05005958A5 /* ko */, + 3FB03E4E0D1B6C05005958A5 /* no */, + 3FB03E4F0D1B6C05005958A5 /* pl */, + 3FB03E500D1B6C05005958A5 /* pt */, + 3FB03E510D1B6C05005958A5 /* pt_PT */, + 3FB03E520D1B6C05005958A5 /* ru */, + 3FB03E530D1B6C05005958A5 /* Spanish */, + 3FB03E540D1B6C05005958A5 /* sv */, + 3FB03E550D1B6C05005958A5 /* zh_CN */, + 3FB03E560D1B6C05005958A5 /* zh_TW */, ); name = Localizable.strings; sourceTree = "<group>"; diff --git a/hw/xquartz/bundle/Xquartz.plist b/hw/xquartz/bundle/Xquartz.plist new file mode 100644 index 000000000..e15704516 --- /dev/null +++ b/hw/xquartz/bundle/Xquartz.plist @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> + +<!-- This file contains system-wide defaults for the Apple X11 server --> + +<plist version="1.0"> +<dict> + <key>apps_menu</key> + <array> + <array> + <string>Terminal</string> + <string>xterm</string> + <string>n</string> + </array> + <array> + <string>xman</string> + <string>xman</string> + <string></string> + </array> + <array> + <string>xlogo</string> + <string>xlogo</string> + <string></string> + </array> + </array> +</dict> +</plist> diff --git a/hw/xquartz/bundle/bundle-main.c b/hw/xquartz/bundle/bundle-main.c new file mode 100644 index 000000000..e97770a55 --- /dev/null +++ b/hw/xquartz/bundle/bundle-main.c @@ -0,0 +1,136 @@ +/* main.c -- X application launcher + + Copyright (c) 2007 Jeremy Huddleston + Copyright (c) 2007 Apple Inc + + 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 and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. */ + +#include <X11/Xlib.h> +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#include <CoreFoundation/CoreFoundation.h> + +#define DEFAULT_CLIENT "/usr/X11/bin/xterm" +#define DEFAULT_STARTX "/usr/X11/bin/startx" +#define DEFAULT_SHELL "/bin/sh" + +static int execute(const char *command); +static char *command_from_prefs(const char *key, const char *default_value); + +int main(int argc, char **argv) { + Display *display; + const char *s; + + size_t i; + fprintf(stderr, "X11.app: main(): argc=%d\n", argc); + for(i=0; i < argc; i++) { + fprintf(stderr, "\targv[%u] = %s\n", (unsigned)i, argv[i]); + } + + /* If we have a process serial number and it's our only arg, act as if + * the user double clicked the app bundle: launch app_to_run if possible + */ + if(argc == 1 || (argc == 2 && !strncmp(argv[1], "-psn_", 5))) { + /* Now, try to open a display, if so, run the launcher */ + display = XOpenDisplay(NULL); + if(display) { + fprintf(stderr, "X11.app: Closing the display and sleeping for 2s to allow the X server to start up.\n"); + /* Could open the display, start the launcher */ + XCloseDisplay(display); + + /* Give 2 seconds for the server to start... + * TODO: *Really* fix this race condition + */ + usleep(2000); + return execute(command_from_prefs("app_to_run", DEFAULT_CLIENT)); + } + } + + /* Start the server */ + if(s = getenv("DISPLAY")) { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY=\"%s\", unsetting). Starting X server.\n", s); + unsetenv("DISPLAY"); + } else { + fprintf(stderr, "X11.app: Could not connect to server (DISPLAY is not set). Starting X server.\n"); + } + return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); +} + +static int execute(const char *command) { + const char *newargv[7]; + const char **s; + + newargv[0] = "/usr/bin/login"; + newargv[1] = "-fp"; + newargv[2] = getlogin(); + newargv[3] = command_from_prefs("login_shell", DEFAULT_SHELL); + newargv[4] = "-c"; + newargv[5] = command; + newargv[6] = NULL; + + fprintf(stderr, "X11.app: Launching %s:\n", command); + for(s=newargv; *s; s++) { + fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s); + } + + execvp (newargv[0], (char * const *) newargv); + perror ("X11.app: Couldn't exec."); + return(1); +} + +static char *command_from_prefs(const char *key, const char *default_value) { + char *command = NULL; + + CFStringRef cfKey = CFStringCreateWithCString(NULL, key, kCFStringEncodingASCII); + CFPropertyListRef PlistRef = CFPreferencesCopyAppValue(cfKey, kCFPreferencesCurrentApplication); + + if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { + CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); + + CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); + CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); + + int len = strlen(default_value) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + strcpy(command, default_value); + } else { + int len = CFStringGetLength((CFStringRef)PlistRef) + 1; + command = (char *)malloc(len * sizeof(char)); + if(!command) + return NULL; + CFStringGetCString((CFStringRef)PlistRef, command, len, kCFStringEncodingASCII); + } + + if (PlistRef) + CFRelease(PlistRef); + + return command; +} diff --git a/hw/xquartz/bundle/da.lproj/InfoPlist.strings b/hw/xquartz/bundle/da.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..88e1f04ac --- /dev/null +++ b/hw/xquartz/bundle/da.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/da.lproj/Localizable.strings b/hw/xquartz/bundle/da.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..9608a2e6b --- /dev/null +++ b/hw/xquartz/bundle/da.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..4a2bd4bde --- /dev/null +++ b/hw/xquartz/bundle/da.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/fi.lproj/InfoPlist.strings b/hw/xquartz/bundle/fi.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..8e4f6474f --- /dev/null +++ b/hw/xquartz/bundle/fi.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/fi.lproj/Localizable.strings b/hw/xquartz/bundle/fi.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..e8420fbaa --- /dev/null +++ b/hw/xquartz/bundle/fi.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..b5039fd44 --- /dev/null +++ b/hw/xquartz/bundle/fi.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/ko.lproj/InfoPlist.strings b/hw/xquartz/bundle/ko.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..4c738f8b2 --- /dev/null +++ b/hw/xquartz/bundle/ko.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/ko.lproj/Localizable.strings b/hw/xquartz/bundle/ko.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..56a335859 --- /dev/null +++ b/hw/xquartz/bundle/ko.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..925945c4d --- /dev/null +++ b/hw/xquartz/bundle/ko.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/no.lproj/InfoPlist.strings b/hw/xquartz/bundle/no.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..eb1cfb002 --- /dev/null +++ b/hw/xquartz/bundle/no.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/no.lproj/Localizable.strings b/hw/xquartz/bundle/no.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..5157a67de --- /dev/null +++ b/hw/xquartz/bundle/no.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..ca25327f5 --- /dev/null +++ b/hw/xquartz/bundle/no.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/pl.lproj/InfoPlist.strings b/hw/xquartz/bundle/pl.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..b9c950214 --- /dev/null +++ b/hw/xquartz/bundle/pl.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/pl.lproj/Localizable.strings b/hw/xquartz/bundle/pl.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..4ae12d77f --- /dev/null +++ b/hw/xquartz/bundle/pl.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..e9ca5404b --- /dev/null +++ b/hw/xquartz/bundle/pl.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/pt.lproj/InfoPlist.strings b/hw/xquartz/bundle/pt.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..33c637448 --- /dev/null +++ b/hw/xquartz/bundle/pt.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/pt.lproj/Localizable.strings b/hw/xquartz/bundle/pt.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..23ea96847 --- /dev/null +++ b/hw/xquartz/bundle/pt.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..e88cccdba --- /dev/null +++ b/hw/xquartz/bundle/pt.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings b/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..33c637448 --- /dev/null +++ b/hw/xquartz/bundle/pt_PT.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings b/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..71c33ad14 --- /dev/null +++ b/hw/xquartz/bundle/pt_PT.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..a61933475 --- /dev/null +++ b/hw/xquartz/bundle/pt_PT.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/ru.lproj/InfoPlist.strings b/hw/xquartz/bundle/ru.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..7f722e4b6 --- /dev/null +++ b/hw/xquartz/bundle/ru.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/ru.lproj/Localizable.strings b/hw/xquartz/bundle/ru.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..3b3811234 --- /dev/null +++ b/hw/xquartz/bundle/ru.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..9354e0264 --- /dev/null +++ b/hw/xquartz/bundle/ru.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/sv.lproj/InfoPlist.strings b/hw/xquartz/bundle/sv.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..655d5ff63 --- /dev/null +++ b/hw/xquartz/bundle/sv.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/sv.lproj/Localizable.strings b/hw/xquartz/bundle/sv.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..796f06c21 --- /dev/null +++ b/hw/xquartz/bundle/sv.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..bd01c2dac --- /dev/null +++ b/hw/xquartz/bundle/sv.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings b/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..b5df36885 --- /dev/null +++ b/hw/xquartz/bundle/zh_CN.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings b/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..f88a6da4b --- /dev/null +++ b/hw/xquartz/bundle/zh_CN.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..e36c15fb6 --- /dev/null +++ b/hw/xquartz/bundle/zh_CN.lproj/main.nib/keyedobjects.nib diff --git a/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings b/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..92d5473b0 --- /dev/null +++ b/hw/xquartz/bundle/zh_TW.lproj/InfoPlist.strings diff --git a/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings b/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings Binary files differnew file mode 100644 index 000000000..f009302c2 --- /dev/null +++ b/hw/xquartz/bundle/zh_TW.lproj/Localizable.strings diff --git a/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib Binary files differnew file mode 100644 index 000000000..36602c53e --- /dev/null +++ b/hw/xquartz/bundle/zh_TW.lproj/main.nib/keyedobjects.nib diff --git a/hw/darwin/darwin.c b/hw/xquartz/darwin.c index b46b7687e..20bcee592 100644 --- a/hw/darwin/darwin.c +++ b/hw/xquartz/darwin.c @@ -75,7 +75,10 @@ #endif #include "darwin.h" -#include "darwinClut8.h" +#include "darwinEvents.h" +#include "darwinKeyboard.h" +#include "quartz.h" +//#include "darwinClut8.h" #ifdef ENABLE_DEBUG_LOG FILE *debug_log_fp = NULL; @@ -85,7 +88,7 @@ FILE *debug_log_fp = NULL; * X server shared global variables */ int darwinScreensFound = 0; -int darwinScreenIndex = 0; +DevPrivateKey darwinScreenKey = &darwinScreenKey; io_connect_t darwinParamConnect = 0; int darwinEventReadFD = -1; int darwinEventWriteFD = -1; @@ -147,8 +150,9 @@ void DarwinPrintBanner(void) { // this should change depending on which specific server we are building - ErrorF("X11.app starting:\n"); - ErrorF("Xquartz server based on X.org %s, built on %s\n", XORG_RELEASE, BUILD_DATE ); + ErrorF("XQuartz starting:\n"); + ErrorF("X.org Release 7.2\n"); // This is here to help fink until they fix their packages. + ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE ); } @@ -172,17 +176,10 @@ static Bool DarwinSaveScreen(ScreenPtr pScreen, int on) * This is a callback from dix during AddScreen() from InitOutput(). * Initialize the screen and communicate information about it back to dix. */ -static Bool DarwinAddScreen( - int index, - ScreenPtr pScreen, - int argc, - char **argv ) -{ - int bitsPerRGB, i, dpi; +static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv) { + int dpi; static int foundIndex = 0; Bool ret; - VisualPtr visual; - ColormapPtr pmap; DarwinFramebufferPtr dfb; // reset index of found screens for each server generation @@ -192,36 +189,21 @@ static Bool DarwinAddScreen( dfb = xalloc(sizeof(DarwinFramebufferRec)); // SCREEN_PRIV(pScreen) = dfb; - pScreen->devPrivates[darwinScreenIndex].ptr = dfb; + dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb); // setup hardware/mode specific details - ret = DarwinModeAddScreen(foundIndex, pScreen); + ret = QuartzAddScreen(foundIndex, pScreen); foundIndex++; if (! ret) return FALSE; - bitsPerRGB = dfb->bitsPerComponent; - // reset the visual list miClearVisualTypes(); // setup a single visual appropriate for our pixel type - if (dfb->colorType == TrueColor) { - if (!miSetVisualTypes( dfb->colorBitsPerPixel, TrueColorMask, - bitsPerRGB, TrueColor )) { - return FALSE; - } - } else if (dfb->colorType == PseudoColor) { - if (!miSetVisualTypes( dfb->colorBitsPerPixel, PseudoColorMask, - bitsPerRGB, PseudoColor )) { - return FALSE; - } - } else if (dfb->colorType == StaticColor) { - if (!miSetVisualTypes( dfb->colorBitsPerPixel, StaticColorMask, - bitsPerRGB, StaticColor )) { - return FALSE; - } - } else { + if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB, + dfb->preferredCVC, dfb->redMask, + dfb->greenMask, dfb->blueMask)) { return FALSE; } @@ -245,20 +227,28 @@ static Bool DarwinAddScreen( return FALSE; } +// ErrorF("Screen type: %d, %d=%d, %d=%d, %d=%d, %x=%x=%x, %x=%x=%x, %x=%x=%x\n", pScreen->visuals->class, +// pScreen->visuals->offsetRed, dfb->bitsPerRGB * 2, +// pScreen->visuals->offsetGreen, dfb->bitsPerRGB, +// pScreen->visuals->offsetBlue, 0, +// pScreen->visuals->redMask, dfb->redMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetRed, +// pScreen->visuals->greenMask, dfb->greenMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetGreen, +// pScreen->visuals->blueMask, dfb->blueMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetBlue); + // set the RGB order correctly for TrueColor - if (dfb->bitsPerPixel > 8) { - for (i = 0, visual = pScreen->visuals; // someday we may have more than 1 - i < pScreen->numVisuals; i++, visual++) { - if (visual->class == TrueColor) { - visual->offsetRed = bitsPerRGB * 2; - visual->offsetGreen = bitsPerRGB; - visual->offsetBlue = 0; - visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed; - visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen; - visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue; - } - } - } +// if (dfb->bitsPerPixel > 8) { +// for (i = 0, visual = pScreen->visuals; // someday we may have more than 1 +// i < pScreen->numVisuals; i++, visual++) { +// if (visual->class == TrueColor) { +// visual->offsetRed = bitsPerRGB * 2; +// visual->offsetGreen = bitsPerRGB; +// visual->offsetBlue = 0; +// visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed; +// visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen; +// visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue; +// } +// } +// } #ifdef RENDER if (! fbPictureInit(pScreen, 0, 0)) { @@ -274,7 +264,7 @@ static Bool DarwinAddScreen( pScreen->SaveScreen = DarwinSaveScreen; // finish mode dependent screen setup including cursor support - if (!DarwinModeSetupScreen(index, pScreen)) { + if (!QuartzSetupScreen(index, pScreen)) { return FALSE; } @@ -288,17 +278,16 @@ static Bool DarwinAddScreen( * mode and we're using a fixed color map. Essentially this translates * to Darwin/x86 in 8-bit mode. */ - if( (dfb->colorBitsPerPixel == 8) && - (dfb->colorType == StaticColor) ) - { - pmap = miInstalledMaps[pScreen->myNum]; - visual = pmap->pVisual; - for( i = 0; i < visual->ColormapEntries; i++ ) { - pmap->red[i].co.local.red = darwinClut8[i].red; - pmap->red[i].co.local.green = darwinClut8[i].green; - pmap->red[i].co.local.blue = darwinClut8[i].blue; - } - } +// if(dfb->depth == 8) { +// ColormapPtr map = RootlessGetColormap (pScreen); +// for( i = 0; i < map->pVisual->ColormapEntries; i++ ) { +// Entry *ent = map->red + i; +// ErrorF("Setting lo %d -> r: %04x g: %04x b: %04x\n", i, darwinClut8[i].red, darwinClut8[i].green, darwinClut8[i].blue); +// ent->co.local.red = darwinClut8[i].red; +// ent->co.local.green = darwinClut8[i].green; +// ent->co.local.blue = darwinClut8[i].blue; +// } +// } dixScreenOrigins[index].x = dfb->x; dixScreenOrigins[index].y = dfb->y; @@ -539,7 +528,7 @@ void InitInput( int argc, char **argv ) DarwinEQInit( (DevicePtr)darwinKeyboard, (DevicePtr)darwinPointer ); - DarwinModeInitInput(argc, argv); + QuartzInitInput(argc, argv); } @@ -610,7 +599,6 @@ DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo) void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv ) { int i; - static unsigned long generation = 0; pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; @@ -622,14 +610,8 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv ) for (i = 0; i < NUMFORMATS; i++) pScreenInfo->formats[i] = formats[i]; - // Allocate private storage for each screen's Darwin specific info - if (generation != serverGeneration) { - darwinScreenIndex = AllocateScreenPrivateIndex(); - generation = serverGeneration; - } - // Discover screens and do mode specific initialization - DarwinModeInitOutput(argc, argv); + QuartzInitOutput(argc, argv); // Add screens for (i = 0; i < darwinScreensFound; i++) { @@ -704,25 +686,15 @@ void ddxInitGlobals(void) */ int ddxProcessArgument( int argc, char *argv[], int i ) { - if ( !strcmp( argv[i], "-fullscreen" ) ) { - ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" ); - return 1; - } +// if ( !strcmp( argv[i], "-fullscreen" ) ) { +// ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" ); +// return 1; +// } - if ( !strcmp( argv[i], "-rootless" ) ) { - ErrorF( "Running rootless inside Mac OS X window server.\n" ); - return 1; - } - - if ( !strcmp( argv[i], "-quartz" ) ) { - ErrorF( "Running in parallel with Mac OS X Quartz window server.\n" ); - return 1; - } - - // The Mac OS X front end uses this argument, which we just ignore here. - if ( !strcmp( argv[i], "-nostartx" ) ) { - return 1; - } +// if ( !strcmp( argv[i], "-rootless" ) ) { +// ErrorF( "Running rootless inside Mac OS X window server.\n" ); +// return 1; +// } // This command line arg is passed when launched from the Aqua GUI. if ( !strncmp( argv[i], "-psn_", 5 ) ) { @@ -806,24 +778,21 @@ int ddxProcessArgument( int argc, char *argv[], int i ) } if ( !strcmp( argv[i], "-depth" ) ) { - int bitDepth; - if ( i == argc-1 ) { FatalError( "-depth must be followed by a number\n" ); } #ifdef OLD_POWERBOOK_G3 ErrorF( "Ignoring unsupported -depth option on old PowerBook G3\n"); #else - bitDepth = atoi( argv[i+1] ); - if (bitDepth == 8) - darwinDesiredDepth = 0; - else if (bitDepth == 15) - darwinDesiredDepth = 1; - else if (bitDepth == 24) - darwinDesiredDepth = 2; - else + darwinDesiredDepth = atoi( argv[i+1] ); + if(darwinDesiredDepth != -1 && + darwinDesiredDepth != 8 && + darwinDesiredDepth != 15 && + darwinDesiredDepth != 24) { FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" ); - ErrorF( "Attempting to use pixel depth of %i\n", bitDepth ); + } + + ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth ); #endif return 2; } @@ -846,12 +815,6 @@ int ddxProcessArgument( int argc, char *argv[], int i ) exit(0); } - // XDarwinStartup uses this argument to indicate the IOKit X server - // should be started. Ignore it here. - if ( !strcmp( argv[i], "-iokit" ) ) { - return 1; - } - return 0; } @@ -875,9 +838,9 @@ void ddxUseMsg( void ) ErrorF("-keymap <file> : read the keymapping from a file instead of the kernel.\n"); ErrorF("-version : show the server version.\n"); ErrorF("\n"); - ErrorF("Quartz modes (Experimental / In Development):\n"); - ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n"); - ErrorF("-rootless : run rootless inside Mac OS X window server.\n"); +// ErrorF("Quartz modes (Experimental / In Development):\n"); +// ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n"); +// ErrorF("-rootless : run rootless inside Mac OS X window server.\n"); ErrorF("\n"); ErrorF("Options ignored in rootless mode:\n"); ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n"); @@ -895,7 +858,8 @@ void ddxGiveUp( void ) { ErrorF( "Quitting XQuartz...\n" ); - DarwinModeGiveUp(); + //if (!quartzRootless) + // quartzProcs->ReleaseScreens(); } @@ -915,24 +879,6 @@ void AbortDDX( void ) ddxGiveUp(); } - -/* - * DPMS extension stubs - */ -Bool DPMSSupported(void) -{ - return FALSE; -} - -void DPMSSet(int level) -{ -} - -int DPMSGet(int *level) -{ - return -1; -} - #include "mivalidate.h" // for union _Validate used by windowstr.h #include "windowstr.h" // for struct _Window #include "scrnintstr.h" // for struct _Screen diff --git a/hw/darwin/darwin.h b/hw/xquartz/darwin.h index d7d2af44f..c5e2ed80d 100644 --- a/hw/darwin/darwin.h +++ b/hw/xquartz/darwin.h @@ -40,64 +40,29 @@ typedef struct { int width; int height; int pitch; - int colorType; + int depth; + int visuals; + int bitsPerRGB; int bitsPerPixel; - int colorBitsPerPixel; - int bitsPerComponent; + int preferredCVC; + Pixel redMask; + Pixel greenMask; + Pixel blueMask; } DarwinFramebufferRec, *DarwinFramebufferPtr; - // From darwin.c void DarwinPrintBanner(void); int DarwinParseModifierList(const char *constmodifiers); void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo); void xf86SetRootClip (ScreenPtr pScreen, BOOL enable); -// From darwinEvents.c -Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr); -void DarwinEQEnqueue(const xEvent *e); -void DarwinEQPointerPost(xEvent *e); -void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); -void DarwinPokeEQ(void); -void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y); -void DarwinSendKeyboardEvents(int ev_type, int keycode); -void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y); - -// From darwinKeyboard.c -int DarwinModifierNXKeyToNXKeycode(int key, int side); -void DarwinKeyboardInit(DeviceIntPtr pDev); -int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); -int DarwinModifierNXKeyToNXMask(int key); -int DarwinModifierNXMaskToNXKey(int mask); -int DarwinModifierStringToNXKey(const char *string); - -// Mode specific functions -Bool DarwinModeAddScreen(int index, ScreenPtr pScreen); -Bool DarwinModeSetupScreen(int index, ScreenPtr pScreen); -void DarwinModeInitOutput(int argc,char **argv); -void DarwinModeInitInput(int argc, char **argv); -void DarwinModeProcessEvent(xEvent *xe); -void DarwinModeGiveUp(void); -void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class); - - -#undef assert -#define assert(x) { if ((x) == 0) \ - FatalError("assert failed on line %d of %s!\n", __LINE__, __FILE__); } -#define kern_assert(x) { if ((x) != KERN_SUCCESS) \ - FatalError("assert failed on line %d of %s with kernel return 0x%x!\n", \ - __LINE__, __FILE__, x); } -#define SCREEN_PRIV(pScreen) \ - ((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr) - - -#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0... - +#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \ + dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey)) /* * Global variables from darwin.c */ -extern int darwinScreenIndex; // index into pScreen.devPrivates +extern DevPrivateKey darwinScreenKey; // index into pScreen.devPrivates extern int darwinScreensFound; extern io_connect_t darwinParamConnect; extern int darwinEventReadFD; @@ -159,7 +124,7 @@ enum { #ifdef ENABLE_DEBUG_LOG extern FILE *debug_log_fp; #define DEBUG_LOG_NAME "x11-debug.txt" -#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%d: " msg, __FUNCTION__, __LINE__, ##args ) +#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp); #else #define DEBUG_LOG(msg, args...) #endif diff --git a/hw/darwin/darwinClut8.h b/hw/xquartz/darwinClut8.h index 8e914f3fd..8e914f3fd 100644 --- a/hw/darwin/darwinClut8.h +++ b/hw/xquartz/darwinClut8.h diff --git a/hw/darwin/darwinEvents.c b/hw/xquartz/darwinEvents.c index 629fb2c9d..827fd81b8 100644 --- a/hw/darwin/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -43,7 +43,9 @@ in this Software without prior written authorization from The Open Group. #include "mipointer.h" #include "darwin.h" +#include "quartz.h" #include "darwinKeyboard.h" +#include "darwinEvents.h" #include <sys/types.h> #include <sys/uio.h> @@ -212,9 +214,8 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) { * * This should be deprecated in favor of miEQEnqueue -- BB */ -void DarwinEQEnqueue(const xEvent *e) { +void DarwinEQEnqueue(const xEventPtr e) { HWEventQueueType oldtail, newtail; - char byte = 0; oldtail = darwinEventQueue.tail; @@ -252,7 +253,7 @@ void DarwinEQEnqueue(const xEvent *e) { * DarwinEQPointerPost * Post a pointer event. Used by the mipointer.c routines. */ -void DarwinEQPointerPost(xEvent *e) { +void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) { (*darwinEventQueue.pPtr->processInputProc) (e, (DeviceIntPtr)darwinEventQueue.pPtr, 1); } @@ -273,7 +274,6 @@ void ProcessInputEvents(void) { EventRec *e; int x, y; xEvent xe; - static int old_flags = 0; // last known modifier state // button number and modifier mask of currently pressed fake button input_check_flag=0; @@ -288,7 +288,7 @@ void ProcessInputEvents(void) { while (darwinEventQueue.head != darwinEventQueue.tail) { if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); + dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); e = &darwinEventQueue.events[darwinEventQueue.head]; xe = e->event; @@ -361,7 +361,7 @@ void ProcessInputEvents(void) { // fall through default: // Check for mode specific event - DarwinModeProcessEvent(&xe); + QuartzProcessEvent(&xe); } } } @@ -423,7 +423,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) { static unsigned int last_seed; unsigned int this_seed; - this_seed = DarwinModeSystemKeymapSeed(); + this_seed = QuartzSystemKeymapSeed(); if (this_seed != last_seed) { last_seed = this_seed; DarwinKeyboardReload(darwinKeyboard); diff --git a/hw/darwin/quartz/quartzCursor.h b/hw/xquartz/darwinEvents.h index 56a02098d..82cc26bc0 100644 --- a/hw/darwin/quartz/quartzCursor.h +++ b/hw/xquartz/darwinEvents.h @@ -1,10 +1,5 @@ /* - * quartzCursor.h - * - * External interface for Quartz hardware cursor - * - * Copyright (c) 2001 Torrey T. Lyons and Greg Parker. - * All Rights Reserved. + * Copyright (c) 2001-2004 Torrey T. Lyons. 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"), @@ -29,14 +24,17 @@ * use or other dealings in this Software without prior written authorization. */ -#ifndef QUARTZCURSOR_H -#define QUARTZCURSOR_H - -#include "screenint.h" +#ifndef _DARWIN_EVENTS_H +#define _DARWIN_EVENTS_H -Bool QuartzInitCursor(ScreenPtr pScreen); -void QuartzReallySetCursor(void); -void QuartzSuspendXCursor(ScreenPtr pScreen); -void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y); +Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr); +void DarwinEQEnqueue(const xEventPtr e); +void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e); +void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); +void DarwinPokeEQ(void); +void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y); +void DarwinSendKeyboardEvents(int ev_type, int keycode); +void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y); +void DarwinUpdateModKeys(int flags); -#endif +#endif /* _DARWIN_EVENTS_H */ diff --git a/hw/darwin/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c index 851a10f11..8d1ee8ec9 100644 --- a/hw/darwin/darwinKeyboard.c +++ b/hw/xquartz/darwinKeyboard.c @@ -73,6 +73,8 @@ #include <architecture/byte_order.h> // For the NXSwap* #include "darwin.h" #include "darwinKeyboard.h" +#include "quartzKeyboard.h" +#include "quartzAudio.h" #ifdef NDEBUG #undef NDEBUG @@ -179,7 +181,7 @@ static KeySym const next_to_x[256] = { static KeySym const symbol_to_x[] = { XK_Left, XK_Up, XK_Right, XK_Down }; -int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]); +static int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]); #define MIN_FUNCKEY 0x20 static KeySym const funckey_to_x[] = { @@ -190,7 +192,7 @@ static KeySym const funckey_to_x[] = { XK_Page_Up, XK_Page_Down, XK_F13, XK_F14, XK_F15 }; -int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]); +static int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]); typedef struct { KeySym normalSym; @@ -216,7 +218,7 @@ static darwinKeyPad_t const normal_to_keypad[] = { { XK_period, XK_KP_Decimal }, { XK_slash, XK_KP_Divide } }; -int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]); +static int const NUM_KEYPAD = sizeof(normal_to_keypad) / sizeof(normal_to_keypad[0]); static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl ) { @@ -232,35 +234,32 @@ static char *inBuffer = NULL; // Can be configured to treat embedded "numbers" as being composed of // either 1, 2, or 4 bytes, apiece. //----------------------------------------------------------------------------- -typedef struct _DataStream -{ +typedef struct _DataStream { unsigned char const *data; unsigned char const *data_end; short number_size; // Size in bytes of a "number" in the stream. } DataStream; -static DataStream* new_data_stream( unsigned char const* data, int size ) -{ +static DataStream* new_data_stream(unsigned char const* data, int size) { DataStream* s = (DataStream*)xalloc( sizeof(DataStream) ); - s->data = data; - s->data_end = data + size; - s->number_size = 1; // Default to byte-sized numbers. + if(s) { + s->data = data; + s->data_end = data + size; + s->number_size = 1; // Default to byte-sized numbers. + } return s; } -static void destroy_data_stream( DataStream* s ) -{ +static void destroy_data_stream(DataStream* s) { xfree(s); } -static unsigned char get_byte( DataStream* s ) -{ +static unsigned char get_byte(DataStream* s) { assert(s->data + 1 <= s->data_end); return *s->data++; } -static short get_word( DataStream* s ) -{ +static short get_word(DataStream* s) { short hi, lo; assert(s->data + 2 <= s->data_end); hi = *s->data++; @@ -268,8 +267,7 @@ static short get_word( DataStream* s ) return ((hi << 8) | lo); } -static int get_dword( DataStream* s ) -{ +static int get_dword(DataStream* s) { int b1, b2, b3, b4; assert(s->data + 4 <= s->data_end); b4 = *s->data++; @@ -279,8 +277,7 @@ static int get_dword( DataStream* s ) return ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1); } -static int get_number( DataStream* s ) -{ +static int get_number(DataStream* s) { switch (s->number_size) { case 4: return get_dword(s); case 2: return get_word(s); @@ -296,8 +293,7 @@ static int get_number( DataStream* s ) * bits_set * Calculate number of bits set in the modifier mask. */ -static short bits_set( short mask ) -{ +static short bits_set(short mask) { short n = 0; for ( ; mask != 0; mask >>= 1) @@ -311,10 +307,7 @@ static short bits_set( short mask ) * Read the next character code from the Darwin keymapping * and write it to the X keymap. */ -static void parse_next_char_code( - DataStream *s, - KeySym *k ) -{ +static void parse_next_char_code(DataStream *s, KeySym *k) { const short charSet = get_number(s); const short charCode = get_number(s); @@ -337,9 +330,7 @@ static void parse_next_char_code( * DarwinReadKeymapFile * Read the appropriate keymapping from a keymapping file. */ -Bool DarwinReadKeymapFile( - NXKeyMapping *keyMap) -{ +static Bool DarwinReadKeymapFile(NXKeyMapping *keyMap) { struct stat st; NXEventSystemDevice info[20]; int interface = 0, handler_id = 0; @@ -353,13 +344,13 @@ Bool DarwinReadKeymapFile( fref = fopen( darwinKeymapFile, "rb" ); if (fref == NULL) { - ErrorF("Unable to open keymapping file '%s' (errno %d).\n", - darwinKeymapFile, errno); + ErrorF("Unable to open keymapping file '%s' (%s).\n", + darwinKeymapFile, strerror(errno)); return FALSE; } if (fstat(fileno(fref), &st) == -1) { - ErrorF("Could not stat keymapping file '%s' (errno %d).\n", - darwinKeymapFile, errno); + ErrorF("Could not stat keymapping file '%s' (%s).\n", + darwinKeymapFile, strerror(errno)); return FALSE; } @@ -373,8 +364,8 @@ Bool DarwinReadKeymapFile( inBuffer = (char*) xalloc( st.st_size ); bufferEnd = (int *) (inBuffer + st.st_size); if (fread(inBuffer, st.st_size, 1, fref) != 1) { - ErrorF("Could not read %qd bytes from keymapping file '%s' (errno %d).\n", - st.st_size, darwinKeymapFile, errno); + ErrorF("Could not read %qd bytes from keymapping file '%s' (%s).\n", + st.st_size, darwinKeymapFile, strerror(errno)); return FALSE; } @@ -448,9 +439,7 @@ Bool DarwinReadKeymapFile( /* * DarwinParseNXKeyMapping */ -Bool DarwinParseNXKeyMapping( - darwinKeyboardInfo *info) -{ +static Bool DarwinParseNXKeyMapping(darwinKeyboardInfo *info) { KeySym *k; int i; short numMods, numKeys, numPadKeys = 0; @@ -518,8 +507,9 @@ Bool DarwinParseNXKeyMapping( (left ? XK_Control_L : XK_Control_R); break; case NX_MODIFIERKEY_ALTERNATE: - info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch; - // (left ? XK_Alt_L : XK_Alt_R); + // info->keyMap[keyCode * GLYPHS_PER_KEY] = XK_Mode_switch; + info->keyMap[keyCode * GLYPHS_PER_KEY] = + (left ? XK_Alt_L : XK_Alt_R); break; case NX_MODIFIERKEY_COMMAND: info->keyMap[keyCode * GLYPHS_PER_KEY] = @@ -649,8 +639,7 @@ Bool DarwinParseNXKeyMapping( * Use the keyMap field of keyboard info structure to populate * the modMap and modifierKeycodes fields. */ -static void -DarwinBuildModifierMaps(darwinKeyboardInfo *info) { +static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) { int i; KeySym *k; @@ -697,6 +686,7 @@ DarwinBuildModifierMaps(darwinKeyboardInfo *info) { case XK_Alt_L: info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; info->modMap[MIN_KEYCODE + i] = Mod1Mask; + *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. break; case XK_Alt_R: @@ -705,15 +695,11 @@ DarwinBuildModifierMaps(darwinKeyboardInfo *info) { #else info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; #endif + *k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. info->modMap[MIN_KEYCODE + i] = Mod1Mask; break; case XK_Mode_switch: - // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor. -#ifdef NX_MODIFIERKEY_RALTERNATE - info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i; -#endif - info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; info->modMap[MIN_KEYCODE + i] = Mod1Mask; break; @@ -743,21 +729,16 @@ DarwinBuildModifierMaps(darwinKeyboardInfo *info) { * Load the keyboard map from a file or system and convert * it to an equivalent X keyboard map and modifier map. */ -static void -DarwinLoadKeyboardMapping(KeySymsRec *keySyms) -{ - int i; - KeySym *k; - +static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) { memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap)); /* TODO: Clean this up - * DarwinModeReadSystemKeymap is in quartz/quartzKeyboard.c + * QuartzReadSystemKeymap is in quartz/quartzKeyboard.c * DarwinParseNXKeyMapping is here */ if (!DarwinParseNXKeyMapping(&keyInfo)) { - DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running DarwinModeReadSystemKeymap().\n"); - if (!DarwinModeReadSystemKeymap(&keyInfo)) { + DEBUG_LOG("DarwinParseNXKeyMapping returned 0... running QuartzReadSystemKeymap().\n"); + if (!QuartzReadSystemKeymap(&keyInfo)) { FatalError("Could not build a valid keymap."); } } @@ -765,6 +746,8 @@ DarwinLoadKeyboardMapping(KeySymsRec *keySyms) DarwinBuildModifierMaps(&keyInfo); #ifdef DUMP_DARWIN_KEYMAP + int i; + KeySym *k; DEBUG_LOG("Darwin -> X converted keyboard map\n"); for (i = 0, k = keyInfo.keyMap; i < NX_NUMKEYCODES; i++, k += GLYPHS_PER_KEY) @@ -793,9 +776,7 @@ DarwinLoadKeyboardMapping(KeySymsRec *keySyms) * X keyboard map and modifier map. Set the new keyboard * device structure. */ -void DarwinKeyboardInit( - DeviceIntPtr pDev ) -{ +void DarwinKeyboardInit(DeviceIntPtr pDev) { KeySymsRec keySyms; // Open a shared connection to the HID System. @@ -807,18 +788,16 @@ void DarwinKeyboardInit( // DarwinKeyboardReload(pDev); /* Initialize the seed, so we don't reload the keymap unnecessarily (and possibly overwrite xinitrc changes) */ - DarwinModeSystemKeymapSeed(); + QuartzSystemKeymapSeed(); assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms, - keyInfo.modMap, DarwinModeBell, + keyInfo.modMap, QuartzBell, DarwinChangeKeyboardControl )); } /* Borrowed from dix/devices.c */ -static Bool -InitModMap(register KeyClassPtr keyc) -{ +static Bool InitModMap(register KeyClassPtr keyc) { int i, j; CARD8 keysPerModifier[8]; CARD8 mask; @@ -863,9 +842,7 @@ InitModMap(register KeyClassPtr keyc) } -void -DarwinKeyboardReload(DeviceIntPtr pDev) -{ +void DarwinKeyboardReload(DeviceIntPtr pDev) { KeySymsRec keySyms; DarwinLoadKeyboardMapping(&keySyms); @@ -898,8 +875,7 @@ DarwinKeyboardReload(DeviceIntPtr pDev) * side = 0 for left or 1 for right. * Returns 0 if key+side is not a known modifier. */ -int DarwinModifierNXKeyToNXKeycode(int key, int side) -{ +int DarwinModifierNXKeyToNXKeycode(int key, int side) { return keyInfo.modifierKeycodes[key][side]; } @@ -908,8 +884,7 @@ int DarwinModifierNXKeyToNXKeycode(int key, int side) * Returns -1 if keycode+side is not a modifier key * outSide may be NULL, else it gets 0 for left and 1 for right. */ -int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) -{ +int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) { int key, side; keycode += MIN_KEYCODE; @@ -928,8 +903,7 @@ int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide) * DarwinModifierNXMaskToNXKey * Returns -1 if mask is not a known modifier mask. */ -int DarwinModifierNXMaskToNXKey(int mask) -{ +int DarwinModifierNXMaskToNXKey(int mask) { switch (mask) { case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK; case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT; @@ -959,8 +933,7 @@ int DarwinModifierNXMaskToNXKey(int mask) return -1; } -const char *DarwinModifierNXMaskTostring(int mask) -{ +static const char *DarwinModifierNXMaskTostring(int mask) { switch (mask) { case NX_ALPHASHIFTMASK: return "NX_ALPHASHIFTMASK"; case NX_SHIFTMASK: return "NX_SHIFTMASK"; @@ -986,8 +959,7 @@ const char *DarwinModifierNXMaskTostring(int mask) * DarwinModifierNXKeyToNXMask * Returns 0 if key is not a known modifier key. */ -int DarwinModifierNXKeyToNXMask(int key) -{ +int DarwinModifierNXKeyToNXMask(int key) { switch (key) { case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK; case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK; @@ -1017,8 +989,7 @@ int DarwinModifierNXKeyToNXMask(int key) * DarwinModifierStringToNXKey * Returns -1 if string is not a known modifier. */ -int DarwinModifierStringToNXKey(const char *str) -{ +int DarwinModifierStringToNXKey(const char *str) { if (!strcasecmp(str, "shift")) return NX_MODIFIERKEY_SHIFT; else if (!strcasecmp(str, "control")) return NX_MODIFIERKEY_CONTROL; else if (!strcasecmp(str, "option")) return NX_MODIFIERKEY_ALTERNATE; diff --git a/hw/darwin/quartz/cr/XView.h b/hw/xquartz/darwinKeyboard.h index 26f789da2..5cf64c7d1 100644 --- a/hw/darwin/quartz/cr/XView.h +++ b/hw/xquartz/darwinKeyboard.h @@ -1,7 +1,5 @@ /* - * NSView subclass for Mac OS X rootless X server - * - * Copyright (c) 2001 Greg Parker. All Rights Reserved. + * Copyright (c) 2003-2004 Torrey T. Lyons. 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"), @@ -26,16 +24,22 @@ * use or other dealings in this Software without prior written authorization. */ -#import <Cocoa/Cocoa.h> +#ifndef DARWIN_KEYBOARD_H +#define DARWIN_KEYBOARD_H 1 -@interface XView : NSQuickDrawView +#include "quartzKeyboard.h" -- (BOOL)isFlipped; -- (BOOL)isOpaque; -- (BOOL)acceptsFirstResponder; -- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; -- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent; +/* Provided for darwinEvents.c */ +extern darwinKeyboardInfo keyInfo; +void DarwinKeyboardReload(DeviceIntPtr pDev); +void DarwinKeyboardInit(DeviceIntPtr pDev); +int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide); +int DarwinModifierNXKeyToNXKeycode(int key, int side); +int DarwinModifierNXKeyToNXMask(int key); +int DarwinModifierNXMaskToNXKey(int mask); +int DarwinModifierStringToNXKey(const char *string); -- (void)mouseDown:(NSEvent *)anEvent; +/* Provided for darwin.c */ +void DarwinKeyboardInit(DeviceIntPtr pDev); -@end +#endif /* DARWIN_KEYBOARD_H */ diff --git a/hw/darwin/darwinXinput.c b/hw/xquartz/darwinXinput.c index ee456a43a..e62ec0ab6 100644 --- a/hw/darwin/darwinXinput.c +++ b/hw/xquartz/darwinXinput.c @@ -63,6 +63,7 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" +#include "chgkbd.h" /*********************************************************************** * @@ -88,16 +89,12 @@ SOFTWARE. * */ -int -ChangeKeyboardDevice (old_dev, new_dev) - DeviceIntPtr old_dev; - DeviceIntPtr new_dev; - { +int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) { /*********************************************************************** DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * **********************************************************************/ return BadMatch; - } +} /*********************************************************************** diff --git a/hw/darwin/quartz/keysym2ucs.c b/hw/xquartz/keysym2ucs.c index 8626ebc4e..8626ebc4e 100644 --- a/hw/darwin/quartz/keysym2ucs.c +++ b/hw/xquartz/keysym2ucs.c diff --git a/hw/darwin/quartz/keysym2ucs.h b/hw/xquartz/keysym2ucs.h index f5b7a18f2..f5b7a18f2 100644 --- a/hw/darwin/quartz/keysym2ucs.h +++ b/hw/xquartz/keysym2ucs.h diff --git a/hw/darwin/quartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c index b19c6050f..4a9d8e1f1 100644 --- a/hw/darwin/quartz/pseudoramiX.c +++ b/hw/xquartz/pseudoramiX.c @@ -44,7 +44,7 @@ Equipment Corporation. #include <X11/extensions/panoramiXproto.h> #include "globals.h" -extern int noPseudoramiXExtension; +Bool noPseudoramiXExtension = FALSE; extern int noPanoramiXExtension; extern int ProcPanoramiXQueryVersion (ClientPtr client); diff --git a/hw/darwin/quartz/pseudoramiX.h b/hw/xquartz/pseudoramiX.h index df5010d1d..df5010d1d 100644 --- a/hw/darwin/quartz/pseudoramiX.h +++ b/hw/xquartz/pseudoramiX.h diff --git a/hw/darwin/quartz/quartz.c b/hw/xquartz/quartz.c index 2483d12d7..6f42c538f 100644 --- a/hw/darwin/quartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -35,14 +35,17 @@ #include "quartzCommon.h" #include "quartz.h" #include "darwin.h" +#include "darwinEvents.h" #include "quartzAudio.h" #include "pseudoramiX.h" #define _APPLEWM_SERVER_ -#include "X11/extensions/applewm.h" #include "applewmExt.h" #include "X11Application.h" +#include <X11/extensions/applewm.h> +#include <X11/extensions/randr.h> + // X headers #include "scrnintstr.h" #include "windowstr.h" @@ -60,39 +63,37 @@ // Shared global variables for Quartz modes int quartzEventWriteFD = -1; -int quartzStartClients = 1; int quartzRootless = -1; int quartzUseSysBeep = 0; int quartzUseAGL = 1; int quartzEnableKeyEquivalents = 1; int quartzServerVisible = TRUE; int quartzServerQuitting = FALSE; -int quartzScreenIndex = 0; +DevPrivateKey quartzScreenKey = &quartzScreenKey; int aquaMenuBarHeight = 0; -int noPseudoramiXExtension = FALSE; QuartzModeProcsPtr quartzProcs = NULL; const char *quartzOpenGLBundle = NULL; #if defined(RANDR) && !defined(FAKE_RANDR) -Bool DarwinModeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) { +Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) { return FALSE; } -Bool DarwinModeRandRSetConfig (ScreenPtr pScreen, +Bool QuartzRandRSetConfig (ScreenPtr pScreen, Rotation randr, int rate, RRScreenSizePtr pSize) { return FALSE; } -Bool DarwinModeRandRInit (ScreenPtr pScreen) { +Bool QuartzRandRInit (ScreenPtr pScreen) { rrScrPrivPtr pScrPriv; if (!RRScreenInit (pScreen)) return FALSE; pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = DarwinModeRandRGetInfo; - pScrPriv->rrSetConfig = DarwinModeRandRSetConfig; + pScrPriv->rrGetInfo = QuartzRandRGetInfo; + pScrPriv->rrSetConfig = QuartzRandRSetConfig; return TRUE; } #endif @@ -106,10 +107,10 @@ Bool DarwinModeRandRInit (ScreenPtr pScreen) { */ /* - * DarwinModeAddScreen + * QuartzAddScreen * Do mode dependent initialization of each screen for Quartz. */ -Bool DarwinModeAddScreen( +Bool QuartzAddScreen( int index, ScreenPtr pScreen) { @@ -117,7 +118,7 @@ Bool DarwinModeAddScreen( QuartzScreenPtr displayInfo = xcalloc(sizeof(QuartzScreenRec), 1); // QUARTZ_PRIV(pScreen) = displayInfo; - pScreen->devPrivates[quartzScreenIndex].ptr = displayInfo; + dixSetPrivate(&pScreen->devPrivates, quartzScreenKey, displayInfo); // do Quartz mode specific initialization return quartzProcs->AddScreen(index, pScreen); @@ -125,10 +126,10 @@ Bool DarwinModeAddScreen( /* - * DarwinModeSetupScreen + * QuartzSetupScreen * Finalize mode specific setup of each screen. */ -Bool DarwinModeSetupScreen( +Bool QuartzSetupScreen( int index, ScreenPtr pScreen) { @@ -145,21 +146,13 @@ Bool DarwinModeSetupScreen( /* - * DarwinModeInitOutput + * QuartzInitOutput * Quartz display initialization. */ -void DarwinModeInitOutput( +void QuartzInitOutput( int argc, char **argv ) { - static unsigned long generation = 0; - - // Allocate private storage for each screen's Quartz specific info - if (generation != serverGeneration) { - quartzScreenIndex = AllocateScreenPrivateIndex(); - generation = serverGeneration; - } - if (serverGeneration == 0) { QuartzAudioInit(); } @@ -173,21 +166,14 @@ void DarwinModeInitOutput( // Do display mode specific initialization quartzProcs->DisplayInit(); - - // Init PseudoramiX implementation of Xinerama. - // This should be in InitExtensions, but that causes link errors - // for servers that don't link in pseudoramiX.c. - if (!noPseudoramiXExtension) { - PseudoramiXExtensionInit(argc, argv); - } } /* - * DarwinModeInitInput + * QuartzInitInput * Inform the main thread the X server is ready to handle events. */ -void DarwinModeInitInput( +void QuartzInitInput( int argc, char **argv ) { @@ -279,7 +265,7 @@ static void QuartzUpdateScreens(void) pScreen->height = height; #ifndef FAKE_RANDR - if(!DarwinModeRandRInit(pScreen)) + if(!QuartzRandRInit(pScreen)) FatalError("Failed to init RandR extension.\n"); #endif @@ -412,15 +398,13 @@ QuartzMessageServerThread( /* - * DarwinModeProcessEvent + * QuartzProcessEvent * Process Quartz specific events. */ -void DarwinModeProcessEvent( - xEvent *xe) -{ +void QuartzProcessEvent(xEvent *xe) { switch (xe->u.u.type) { case kXDarwinControllerNotify: - DEBUG_LOG("kXDarwinControllerNotify\n"); + DEBUG_LOG("kXDarwinControllerNotify\n"); AppleWMSendEvent(AppleWMControllerNotify, AppleWMControllerNotifyMask, xe->u.clientMessage.u.l.longs0, @@ -428,7 +412,7 @@ void DarwinModeProcessEvent( break; case kXDarwinPasteboardNotify: - DEBUG_LOG("kXDarwinPasteboardNotify\n"); + DEBUG_LOG("kXDarwinPasteboardNotify\n"); AppleWMSendEvent(AppleWMPasteboardNotify, AppleWMPasteboardNotifyMask, xe->u.clientMessage.u.l.longs0, @@ -436,7 +420,7 @@ void DarwinModeProcessEvent( break; case kXDarwinActivate: - DEBUG_LOG("kXDarwinActivate\n"); + DEBUG_LOG("kXDarwinActivate\n"); QuartzShow(xe->u.keyButtonPointer.rootX, xe->u.keyButtonPointer.rootY); AppleWMSendEvent(AppleWMActivationNotify, @@ -445,7 +429,7 @@ void DarwinModeProcessEvent( break; case kXDarwinDeactivate: - DEBUG_LOG("kXDarwinDeactivate\n"); + DEBUG_LOG("kXDarwinDeactivate\n"); AppleWMSendEvent(AppleWMActivationNotify, AppleWMActivationNotifyMask, AppleWMIsInactive, 0); @@ -453,23 +437,23 @@ void DarwinModeProcessEvent( break; case kXDarwinDisplayChanged: - DEBUG_LOG("kXDarwinDisplayChanged\n"); + DEBUG_LOG("kXDarwinDisplayChanged\n"); QuartzUpdateScreens(); break; case kXDarwinWindowState: - DEBUG_LOG("kXDarwinWindowState\n"); + DEBUG_LOG("kXDarwinWindowState\n"); RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0, xe->u.clientMessage.u.l.longs1); break; case kXDarwinWindowMoved: - DEBUG_LOG("kXDarwinWindowMoved\n"); - RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0); + DEBUG_LOG("kXDarwinWindowMoved\n"); + RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0); break; case kXDarwinToggleFullscreen: - DEBUG_LOG("kXDarwinToggleFullscreen\n"); + DEBUG_LOG("kXDarwinToggleFullscreen\n"); #ifdef DARWIN_DDX_MISSING if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot); else if (quartzHasRoot) QuartzHide(); @@ -480,6 +464,7 @@ void DarwinModeProcessEvent( break; case kXDarwinSetRootless: + DEBUG_LOG("kXDarwinSetRootless\n"); #ifdef DARWIN_DDX_MISSING QuartzSetRootless(xe->u.clientMessage.u.l.longs0); if (!quartzEnableRootless && !quartzHasRoot) QuartzHide(); @@ -505,34 +490,11 @@ void DarwinModeProcessEvent( break; case kXDarwinBringAllToFront: - DEBUG_LOG("kXDarwinBringAllToFront\n"); - RootlessOrderAllWindows(); + DEBUG_LOG("kXDarwinBringAllToFront\n"); + RootlessOrderAllWindows(); break; default: ErrorF("Unknown application defined event type %d.\n", xe->u.u.type); } } - - -/* - * DarwinModeGiveUp - * Cleanup before X server shutdown - * Release the screen and restore the Aqua cursor. - */ -void DarwinModeGiveUp(void) -{ -#if 0 -// Trying to switch cursors when quitting causes deadlock - int i; - - for (i = 0; i < screenInfo.numScreens; i++) { - if (screenInfo.screens[i]) { - QuartzSuspendXCursor(screenInfo.screens[i]); - } - } -#endif - - if (!quartzRootless) - quartzProcs->ReleaseScreens(); -} diff --git a/hw/darwin/quartz/quartz.h b/hw/xquartz/quartz.h index e74a1082b..fbe308a92 100644 --- a/hw/darwin/quartz/quartz.h +++ b/hw/xquartz/quartz.h @@ -124,4 +124,11 @@ typedef struct _QuartzModeProcs { extern QuartzModeProcsPtr quartzProcs; extern int quartzHasRoot, quartzEnableRootless; +Bool QuartzAddScreen(int index, ScreenPtr pScreen); +Bool QuartzSetupScreen(int index, ScreenPtr pScreen); +void QuartzInitOutput(int argc,char **argv); +void QuartzInitInput(int argc, char **argv); +void QuartzGiveUp(void); +void QuartzProcessEvent(xEvent *xe); + #endif diff --git a/hw/darwin/quartz/quartzAudio.c b/hw/xquartz/quartzAudio.c index 1eb099ba6..5dee32f54 100644 --- a/hw/darwin/quartz/quartzAudio.c +++ b/hw/xquartz/quartzAudio.c @@ -50,7 +50,7 @@ #include <X11/extensions/XI.h> #include <assert.h> -void NSBeep(); +void NSBeep(void); typedef struct QuartzAudioRec { double frequency; @@ -246,10 +246,10 @@ static void QuartzCoreAudioBell( /* - * DarwinModeBell + * QuartzBell * Ring the bell */ -void DarwinModeBell( +void QuartzBell( int volume, // volume in percent of max DeviceIntPtr pDevice, pointer ctrl, diff --git a/hw/darwin/quartz/quartzAudio.h b/hw/xquartz/quartzAudio.h index c406bbc2a..c406bbc2a 100644 --- a/hw/darwin/quartz/quartzAudio.h +++ b/hw/xquartz/quartzAudio.h diff --git a/hw/darwin/quartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m index 0086c5ca4..53e3f0897 100644 --- a/hw/darwin/quartz/quartzCocoa.m +++ b/hw/xquartz/quartzCocoa.m @@ -37,6 +37,7 @@ #endif #include "quartzCommon.h" +#include "quartzPasteboard.h" #define BOOL xBOOL #include "darwin.h" diff --git a/hw/darwin/quartz/quartzCommon.h b/hw/xquartz/quartzCommon.h index f0d5a7a08..a0d467389 100644 --- a/hw/darwin/quartz/quartzCommon.h +++ b/hw/xquartz/quartzCommon.h @@ -47,6 +47,7 @@ #undef WindowPtr #undef Picture #include <X11/Xdefs.h> +#include "privates.h" // Quartz specific per screen storage structure typedef struct { @@ -59,11 +60,10 @@ typedef struct { } QuartzScreenRec, *QuartzScreenPtr; #define QUARTZ_PRIV(pScreen) \ - ((QuartzScreenPtr)pScreen->devPrivates[quartzScreenIndex].ptr) + ((QuartzScreenPtr)dixLookupPrivate(&pScreen->devPrivates, quartzScreenKey)) // Data stored at startup for Cocoa front end extern int quartzEventWriteFD; -extern int quartzStartClients; // User preferences used by Quartz modes extern int quartzRootless; @@ -74,7 +74,7 @@ extern int quartzEnableKeyEquivalents; // Other shared data extern int quartzServerVisible; extern int quartzServerQuitting; -extern int quartzScreenIndex; +extern DevPrivateKey quartzScreenKey; extern int aquaMenuBarHeight; // Name of GLX bundle for native OpenGL diff --git a/hw/darwin/quartz/quartzCursor.c b/hw/xquartz/quartzCursor.c index 6e86acbc4..f82ccd380 100644 --- a/hw/darwin/quartz/quartzCursor.c +++ b/hw/xquartz/quartzCursor.c @@ -56,8 +56,7 @@ typedef struct { miPointerSpriteFuncPtr spriteFuncs; } QuartzCursorScreenRec, *QuartzCursorScreenPtr; -static int darwinCursorScreenIndex = -1; -static unsigned long darwinCursorGeneration = 0; +static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey; static CursorPtr quartzLatentCursor = NULL; static QD_Cursor gQDArrow; // QuickDraw arrow cursor @@ -66,8 +65,8 @@ static CCrsrHandle currentCursor = NULL; static pthread_mutex_t cursorMutex; static pthread_cond_t cursorCondition; -#define CURSOR_PRIV(pScreen) \ - ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr) +#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ + dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey)) #define HIDE_QD_CURSOR(pScreen, visible) \ if (visible) { \ @@ -319,7 +318,7 @@ QuartzRealizeCursor( if (!qdCursor) return FALSE; // save the result - pCursor->devPriv[pScreen->myNum] = (pointer) qdCursor; + dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor); return TRUE; } @@ -346,13 +345,13 @@ QuartzUnrealizeCursor( (pScreen, pCursor); } } else { - CCrsrHandle oldCursor = (CCrsrHandle) pCursor->devPriv[pScreen->myNum]; - + CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates, + pScreen); if (currentCursor != oldCursor) { // This should only fail when quitting, in which case we just leak. FreeQDCursor(oldCursor); } - pCursor->devPriv[pScreen->myNum] = NULL; + dixSetPrivate(&pCursor->devPrivates, pScreen, NULL); return TRUE; } } @@ -392,7 +391,7 @@ QuartzSetCursor( (*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y); ScreenPriv->qdCursorMode = TRUE; - CHANGE_QD_CURSOR(pCursor->devPriv[pScreen->myNum]); + CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen)); SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible); } else if (quartzRootless) { @@ -592,13 +591,6 @@ QuartzInitCursor( return FALSE; } - // allocate private storage for this screen's QuickDraw cursor info - if (darwinCursorGeneration != serverGeneration) { - if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - darwinCursorGeneration = serverGeneration; - } - ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) ); if (!ScreenPriv) return FALSE; @@ -611,7 +603,7 @@ QuartzInitCursor( // initialize QuickDraw cursor handling GetQDGlobalsArrow(&gQDArrow); PointPriv = (miPointerScreenPtr) - pScreen->devPrivates[miPointerScreenIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; PointPriv->spriteFuncs = &quartzSpriteFuncsRec; diff --git a/hw/darwin/quartz/fullscreen/quartzCursor.h b/hw/xquartz/quartzCursor.h index 56a02098d..56a02098d 100644 --- a/hw/darwin/quartz/fullscreen/quartzCursor.h +++ b/hw/xquartz/quartzCursor.h diff --git a/hw/xquartz/quartzForeground.c b/hw/xquartz/quartzForeground.c new file mode 100644 index 000000000..0e724de76 --- /dev/null +++ b/hw/xquartz/quartzForeground.c @@ -0,0 +1,47 @@ +/* foreground.c - Push the current process into the foreground. + + This is in a separate file because of Quartz/X type conflicts. + + Copyright (c) 2007 Jeremy Huddleston + + 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 and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. */ + +#include <ApplicationServices/ApplicationServices.h> +#include <stdio.h> + +#include "quartzForeground.h" + +int QuartzMoveToForeground() { + ProcessSerialNumber psn = { 0, kCurrentProcess }; + OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication); + if( returnCode == 0) { + fprintf(stderr, "TransformProcessType: Success\n"); + SetFrontProcess(&psn); + } else { + fprintf(stderr, "TransformProcessType: Failure\n"); + } + return (int)returnCode; +} diff --git a/hw/xquartz/quartzForeground.h b/hw/xquartz/quartzForeground.h new file mode 100644 index 000000000..b5422ff9c --- /dev/null +++ b/hw/xquartz/quartzForeground.h @@ -0,0 +1,37 @@ +/* foreground.h - Push the current process into the foreground. + + This is in a separate file because of Quartz/X type conflicts. + + Copyright (c) 2007 Jeremy Huddleston + + 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 and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT + HOLDER(S) 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(s) of the above + copyright holders shall not be used in advertising or otherwise to + promote the sale, use or other dealings in this Software without + prior written authorization. */ + +#ifndef _QUARTZ_FOREGROUND_H_ +#define _QUARTZ_FOREGROUND_H_ + +int QuartzMoveToForeground(void); + +#endif /* _QUARTZ_FOREGROUND_H_ */ diff --git a/hw/darwin/quartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c index ee485b8c5..9b899ca67 100644 --- a/hw/darwin/quartz/quartzKeyboard.c +++ b/hw/xquartz/quartzKeyboard.c @@ -40,7 +40,7 @@ #include <CoreServices/CoreServices.h> #include <Carbon/Carbon.h> -#include "darwinKeyboard.h" +#include "quartzKeyboard.h" #include "X11/keysym.h" #include "keysym2ucs.h" @@ -66,11 +66,11 @@ const static struct { {55, XK_Meta_L}, {56, XK_Shift_L}, {57, XK_Caps_Lock}, - {58, XK_Mode_switch}, + {58, XK_Alt_L}, {59, XK_Control_L}, {60, XK_Shift_R}, - {61, XK_Mode_switch}, + {61, XK_Alt_R}, {62, XK_Control_R}, {63, XK_Meta_R}, @@ -146,9 +146,7 @@ const static struct { {UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */ }; -unsigned int -DarwinModeSystemKeymapSeed (void) -{ +unsigned int QuartzSystemKeymapSeed(void) { static unsigned int seed; static KeyboardLayoutRef last_key_layout; KeyboardLayoutRef key_layout; @@ -160,9 +158,7 @@ DarwinModeSystemKeymapSeed (void) return seed; } -static inline UniChar -macroman2ucs (unsigned char c) -{ +static inline UniChar macroman2ucs(unsigned char c) { /* Precalculated table mapping MacRoman-128 to Unicode. Generated by creating single element CFStringRefs then extracting the first character. */ @@ -190,9 +186,7 @@ macroman2ucs (unsigned char c) else return table[c - 128]; } -static KeySym -make_dead_key (KeySym in) -{ +static KeySym make_dead_key(KeySym in) { int i; for (i = 0; i < sizeof (dead_keys) / sizeof (dead_keys[0]); i++) @@ -201,9 +195,7 @@ make_dead_key (KeySym in) return in; } -Bool -DarwinModeReadSystemKeymap (darwinKeyboardInfo *info) -{ +Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) { KeyboardLayoutRef key_layout; const void *chr_data = NULL; int num_keycodes = NUM_KEYCODES; diff --git a/hw/darwin/darwinKeyboard.h b/hw/xquartz/quartzKeyboard.h index 368aee954..0c7e70e48 100644 --- a/hw/darwin/darwinKeyboard.h +++ b/hw/xquartz/quartzKeyboard.h @@ -24,8 +24,8 @@ * use or other dealings in this Software without prior written authorization. */ -#ifndef DARWIN_KEYBOARD_H -#define DARWIN_KEYBOARD_H 1 +#ifndef QUARTZ_KEYBOARD_H +#define QUARTZ_KEYBOARD_H 1 #define XK_TECHNICAL // needed to get XK_Escape #define XK_PUBLISHING @@ -36,6 +36,7 @@ // unshifted, shifted, modeswitch unshifted, modeswitch shifted #define GLYPHS_PER_KEY 4 #define NUM_KEYCODES 248 // NX_NUMKEYCODES might be better +#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0... #define MAX_KEYCODE NUM_KEYCODES + MIN_KEYCODE - 1 typedef struct darwinKeyboardInfo_struct { @@ -44,8 +45,9 @@ typedef struct darwinKeyboardInfo_struct { unsigned char modifierKeycodes[32][2]; } darwinKeyboardInfo; +/* These functions need to be implemented by XQuartz, XDarwin, etc. */ void DarwinKeyboardReload(DeviceIntPtr pDev); -unsigned int DarwinModeSystemKeymapSeed(void); -Bool DarwinModeReadSystemKeymap(darwinKeyboardInfo *info); +Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info); +unsigned int QuartzSystemKeymapSeed(void); -#endif /* DARWIN_KEYBOARD_H */ +#endif /* QUARTZ_KEYBOARD_H */ diff --git a/hw/darwin/quartz/quartzPasteboard.c b/hw/xquartz/quartzPasteboard.c index 0cecff54a..0cecff54a 100644 --- a/hw/darwin/quartz/quartzPasteboard.c +++ b/hw/xquartz/quartzPasteboard.c diff --git a/hw/darwin/quartz/quartzPasteboard.h b/hw/xquartz/quartzPasteboard.h index afcb6e587..d6a8ee815 100644 --- a/hw/darwin/quartz/quartzPasteboard.h +++ b/hw/xquartz/quartzPasteboard.h @@ -34,11 +34,11 @@ #define _QUARTZPASTEBOARD_H // Aqua->X -void QuartzReadPasteboard(); +void QuartzReadPasteboard(void); char * QuartzReadCocoaPasteboard(void); // caller must free string // X->Aqua -void QuartzWritePasteboard(); +void QuartzWritePasteboard(void); void QuartzWriteCocoaPasteboard(char *text); #endif /* _QUARTZPASTEBOARD_H */ diff --git a/hw/darwin/quartz/quartzStartup.c b/hw/xquartz/quartzStartup.c index e20c16b7a..e25e15583 100644 --- a/hw/darwin/quartz/quartzStartup.c +++ b/hw/xquartz/quartzStartup.c @@ -35,6 +35,7 @@ #include <unistd.h> #include <CoreFoundation/CoreFoundation.h> #include "quartzCommon.h" +#include "X11Controller.h" #include "darwin.h" #include "quartz.h" #include "opaque.h" @@ -51,11 +52,11 @@ char **envpGlobal; // argcGlobal and argvGlobal // are from dix/globals.c - -void X11ControllerMain(int argc, char *argv[], void (*server_thread) (void *), void *server_arg); +int main(int argc, char **argv, char **envp); +void _InitHLTB(void); +void DarwinHandleGUI(int argc, char **argv, char **envp); static void server_thread (void *arg) { - extern int main(int argc, char **argv, char **envp); exit (main (argcGlobal, argvGlobal, envpGlobal)); } @@ -67,11 +68,7 @@ static void server_thread (void *arg) { * server. On the second call this function loads the user * preferences set by the Mac OS X front end. */ -void DarwinHandleGUI( - int argc, - char *argv[], - char *envp[] ) -{ +void DarwinHandleGUI(int argc, char **argv, char **envp) { static Bool been_here = FALSE; int i; int fd[2]; @@ -80,7 +77,7 @@ void DarwinHandleGUI( return; } been_here = TRUE; - + // Make a pipe to pass events assert( pipe(fd) == 0 ); darwinEventReadFD = fd[0]; @@ -92,26 +89,14 @@ void DarwinHandleGUI( argvGlobal = argv; envpGlobal = envp; - quartzStartClients = 1; for (i = 1; i < argc; i++) { // Display version info without starting Mac OS X UI if requested if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) { DarwinPrintBanner(); exit(0); } - - // Determine if we need to start X clients - // and what display mode to use - if (!strcmp(argv[i], "-nostartx")) { - quartzStartClients = 0; - } else if (!strcmp( argv[i], "-fullscreen")) { - quartzRootless = 0; - } else if (!strcmp( argv[i], "-rootless")) { - quartzRootless = 1; - } } - /* Initially I ran the X server on the main thread, and received events on the second thread. But now we may be using Carbon, that needs to run on the main thread. (Otherwise, when it's @@ -121,9 +106,7 @@ void DarwinHandleGUI( before the main thread when we're _not_ prebound, things fail, so initialize by hand. */ - extern void _InitHLTB(void); - _InitHLTB(); - X11ControllerMain(argc, argv, server_thread, NULL); + X11ControllerMain(argc, (const char **)argv, server_thread, NULL); exit(0); } diff --git a/hw/darwin/Makefile.am b/hw/xquartz/xpr/Makefile.am index 1faedcbef..ae1b19297 100644 --- a/hw/darwin/Makefile.am +++ b/hw/xquartz/xpr/Makefile.am @@ -1,36 +1,27 @@ -AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) -AM_CPPFLAGS = \ - -DINXQUARTZ \ - -DUSE_NEW_CLUT \ - -DXFree86Server \ - -I$(top_srcdir)/miext/rootless - -if X11APP -X11APP_SUBDIRS = apple launcher -endif - -SUBDIRS = quartz utils $(X11APP_SUBDIRS) -DIST_SUBDIRS = quartz utils apple launcher - bin_PROGRAMS = Xquartz -man1_MANS = Xquartz.man -Xquartz_SOURCES = \ - darwin.c \ - darwinEvents.c \ - darwinKeyboard.c \ - darwinXinput.c \ - $(top_srcdir)/fb/fbcmap_mi.c \ - $(top_srcdir)/mi/miinitext.c +AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS) +AM_CPPFLAGS = \ + -I$(srcdir) -I$(srcdir)/.. \ + -I$(top_srcdir)/miext \ + -I$(top_srcdir)/miext/rootless \ + -I$(top_srcdir)/miext/rootless/safeAlpha -# We should probably add these once they're working, or are these obsolete and to be removed? -# ./quartz/cr/libcr.a -# ./quartz/fullscreen/libfullscreen.a +Xquartz_SOURCES = \ + appledri.c \ + dri.c \ + xprAppleWM.c \ + xprCursor.c \ + xprFrame.c \ + xprScreen.c \ + x-hash.c \ + x-hook.c \ + x-list.c Xquartz_LDADD = \ - ./quartz/libXquartz.a \ - ./quartz/xpr/libxpr.a \ + $(top_builddir)/hw/xquartz/libXquartz.la \ $(top_builddir)/dix/dixfonts.lo \ + $(top_builddir)/config/libconfig.a \ $(top_builddir)/dix/libdix.la \ $(top_builddir)/os/libos.la \ $(top_builddir)/dix/libxpstubs.la \ @@ -64,8 +55,24 @@ Xquartz_LDFLAGS = \ -Wl,-framework,CoreAudio \ -Wl,-framework,IOKit +appmandir = $(APP_MAN_DIR) +appman_PRE = Xquartz.man.pre +appman_PROCESSED = $(appman_PRE:man.pre=man) +appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) + +CLEANFILES = $(appman_PROCESSED) $(appman_DATA) + +include $(top_srcdir)/cpprules.in + +.man.$(APP_MAN_SUFFIX): + cp $< $@ + EXTRA_DIST = \ - Xquartz.man \ - darwinClut8.h \ - darwin.h \ - darwinKeyboard.h + dri.h \ + dristruct.h \ + appledri.h \ + appledristr.h \ + x-hash.h \ + x-hook.h \ + x-list.h \ + xpr.h diff --git a/hw/darwin/Xquartz.man b/hw/xquartz/xpr/Xquartz.man.pre index 37a7f1a26..315db1ca4 100644 --- a/hw/darwin/Xquartz.man +++ b/hw/xquartz/xpr/Xquartz.man.pre @@ -65,48 +65,48 @@ of the main display. .SH CUSTOMIZATION \fIXquartz\fP can also be customized using the defaults(1) command. The available options are: .TP 8 -.B defaults write com.apple.x11 enable_fake_buttons -boolean true +.B defaults write org.x.X11 enable_fake_buttons -boolean true Equivalent to the \fB-fakebuttons\fP command line option. .TP 8 -.B defaults write com.apple.x11 fake_button2 \fImodifiers\fP +.B defaults write org.x.X11 fake_button2 \fImodifiers\fP Equivalent to the \fB-fakemouse2\fP option. .TP 8 -.B defaults write com.apple.x11 fake_button3 \fImodifiers\fP +.B defaults write org.x.X11 fake_button3 \fImodifiers\fP Equivalent to the \fB-fakemouse3\fP option. .TP 8 -.B defaults write com.apple.x11 swap_alt_meta -boolean true +.B defaults write org.x.X11 swap_alt_meta -boolean true Equivalent to the \fB-swapAltMeta\fP option. .TP 8 -.B defaults write com.apple.x11 keymap_file \fIfilename\fP +.B defaults write org.x.X11 keymap_file \fIfilename\fP Equivalent to the \fB-keymap\fP option. .TP 8 -.B defaults write com.apple.x11 no_quit_alert -boolean true +.B defaults write org.x.X11 no_quit_alert -boolean true Disables the alert dialog displayed when attempting to quit X11. .TP 8 -.B defaults write com.apple.x11 no_auth -boolean true +.B defaults write org.x.X11 no_auth -boolean true Stops the X server requiring that clients authenticate themselves when connecting. See Xsecurity(__miscmansuffix__). .TP 8 -.B defaults write com.apple.x11 nolisten_tcp -boolean true +.B defaults write org.x.X11 nolisten_tcp -boolean true Prevents the X server accepting remote connections. .TP 8 -.B defaults write com.apple.x11 xinit_kills_server -boolean false +.B defaults write org.x.X11 xinit_kills_server -boolean false Stops the X server exiting when the xinitrc script terminates. .TP 8 -.B defaults write com.apple.x11 fullscreen_hotkeys -boolean false +.B defaults write org.x.X11 fullscreen_hotkeys -boolean false Allows system hotkeys to be handled while in X11 fullscreen mode. .TP 8 -.B defaults write com.apple.x11 enable_system_beep -boolean false +.B defaults write org.x.X11 enable_system_beep -boolean false Don't use the standard system beep effect for X11 alerts. .TP 8 -.B defaults write com.apple.x11 enable_key_equivalents -boolean false +.B defaults write org.x.X11 enable_key_equivalents -boolean false Disable menu keyboard equivalents while X11 windows are focused. .TP 8 -.B defaults write com.apple.x11 depth \fIdepth\fP +.B defaults write org.x.X11 depth \fIdepth\fP Equivalent to the \fB-depth\fP option. .SH "SEE ALSO" .PP -X(__miscmansuffix__), XFree86(1), Xserver(1), xdm(1), xinit(1) +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1) .PP .SH AUTHORS XFree86 was originally ported to Mac OS X Server by John Carmack. Dave diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c index 95a443976..b4a4725e2 100644 --- a/hw/darwin/quartz/xpr/appledri.c +++ b/hw/xquartz/xpr/appledri.c @@ -55,6 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "swaprep.h" #include "dri.h" #include "dristruct.h" +#include "xpr.h" static int DRIErrorBase = 0; diff --git a/hw/darwin/quartz/xpr/appledri.h b/hw/xquartz/xpr/appledri.h index c4e43be12..c4e43be12 100644 --- a/hw/darwin/quartz/xpr/appledri.h +++ b/hw/xquartz/xpr/appledri.h diff --git a/hw/darwin/quartz/xpr/appledristr.h b/hw/xquartz/xpr/appledristr.h index 8649fd329..8649fd329 100644 --- a/hw/darwin/quartz/xpr/appledristr.h +++ b/hw/xquartz/xpr/appledristr.h diff --git a/hw/darwin/quartz/xpr/dri.c b/hw/xquartz/xpr/dri.c index e5591abcb..3aacb192d 100644 --- a/hw/darwin/quartz/xpr/dri.c +++ b/hw/xquartz/xpr/dri.c @@ -71,9 +71,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <AvailabilityMacros.h> -static int DRIScreenPrivIndex = -1; -static int DRIWindowPrivIndex = -1; -static int DRIPixmapPrivIndex = -1; +static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey; +static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey; +static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKey; static RESTYPE DRIDrawablePrivResType; @@ -185,11 +185,11 @@ DRIScreenInit(ScreenPtr pScreen) pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec)); if (!pDRIPriv) { - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); return FALSE; } - pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv); pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->nrWindows = 0; @@ -220,13 +220,6 @@ DRIFinishScreenInit(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - /* Allocate zero sized private area for each window. Should a window - * become a DRI window, we'll hang a DRIWindowPrivateRec off of this - * private index. - */ - if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0)) - return FALSE; - /* Wrap DRI support */ pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree; pScreen->ValidateTree = DRIValidateTree; @@ -255,31 +248,13 @@ DRICloseScreen(ScreenPtr pScreen) if (pDRIPriv && pDRIPriv->directRenderingSupport) { xfree(pDRIPriv); - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); } } Bool DRIExtensionInit(void) { - static unsigned long DRIGeneration = 0; - - if (DRIGeneration != serverGeneration) { - if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - DRIGeneration = serverGeneration; - } - - /* - * Allocate a window private index with a zero sized private area for - * each window, then should a window become a DRI window, we'll hang - * a DRIWindowPrivateRec off of this private index. Do same for pixmaps. - */ - if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) - return FALSE; - if ((DRIPixmapPrivIndex = AllocatePixmapPrivateIndex()) < 0) - return FALSE; - DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete); return TRUE; @@ -423,7 +398,8 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, } /* save private off of preallocated index */ - pWin->devPrivates[DRIWindowPrivIndex].ptr = (pointer)pDRIDrawablePriv; + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, + pDRIDrawablePriv); } } @@ -456,7 +432,8 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, } /* save private off of preallocated index */ - pPix->devPrivates[DRIPixmapPrivIndex].ptr = (pointer)pDRIDrawablePriv; + dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, + pDRIDrawablePriv); } } #endif @@ -583,9 +560,9 @@ DRIDrawablePrivDelete(pointer pResource, XID id) xfree(pDRIDrawablePriv); if (pDrawable->type == DRAWABLE_WINDOW) { - pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL; + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } else if (pDrawable->type == DRAWABLE_PIXMAP) { - pPix->devPrivates[DRIPixmapPrivIndex].ptr = NULL; + dixSetPrivate(&pPix->devPrivates, DRIPixmapPrivKey, NULL); } --pDRIPriv->nrWindows; diff --git a/hw/darwin/quartz/xpr/dri.h b/hw/xquartz/xpr/dri.h index cf2638a9f..cf2638a9f 100644 --- a/hw/darwin/quartz/xpr/dri.h +++ b/hw/xquartz/xpr/dri.h diff --git a/hw/darwin/quartz/xpr/dristruct.h b/hw/xquartz/xpr/dristruct.h index 9a3d01c9b..19d78a973 100644 --- a/hw/darwin/quartz/xpr/dristruct.h +++ b/hw/xquartz/xpr/dristruct.h @@ -40,15 +40,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define DRI_MAX_DRAWABLES 256 -#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) \ - ((DRIWindowPrivIndex < 0) ? \ - NULL : \ - ((DRIDrawablePrivPtr)((pWin)->devPrivates[DRIWindowPrivIndex].ptr))) +#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey)) -#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) \ - ((DRIPixmapPrivIndex < 0) ? \ - NULL : \ - ((DRIDrawablePrivPtr)((pPix)->devPrivates[DRIPixmapPrivIndex].ptr))) +#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \ + dixLookupPrivate(&(pPix)->devPrivates, DRIPixmapPrivKey)) typedef struct _DRIDrawablePrivRec { @@ -61,13 +57,12 @@ typedef struct _DRIDrawablePrivRec x_list *notifiers; /* list of (FUN . DATA) */ } DRIDrawablePrivRec, *DRIDrawablePrivPtr; -#define DRI_SCREEN_PRIV(pScreen) \ - ((DRIScreenPrivIndex < 0) ? \ - NULL : \ - ((DRIScreenPrivPtr)((pScreen)->devPrivates[DRIScreenPrivIndex].ptr))) +#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey)) #define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \ - (screenInfo.screens[screenIndex]->devPrivates[DRIScreenPrivIndex].ptr)) + dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \ + DRIScreenPrivKey)) typedef struct _DRIScreenPrivRec diff --git a/hw/darwin/quartz/xpr/x-hash.c b/hw/xquartz/xpr/x-hash.c index 55d28bacd..55d28bacd 100644 --- a/hw/darwin/quartz/xpr/x-hash.c +++ b/hw/xquartz/xpr/x-hash.c diff --git a/hw/darwin/quartz/xpr/x-hash.h b/hw/xquartz/xpr/x-hash.h index 3456dbedf..3456dbedf 100644 --- a/hw/darwin/quartz/xpr/x-hash.h +++ b/hw/xquartz/xpr/x-hash.h diff --git a/hw/darwin/quartz/xpr/x-hook.c b/hw/xquartz/xpr/x-hook.c index bb873bbfb..bb873bbfb 100644 --- a/hw/darwin/quartz/xpr/x-hook.c +++ b/hw/xquartz/xpr/x-hook.c diff --git a/hw/darwin/quartz/xpr/x-hook.h b/hw/xquartz/xpr/x-hook.h index 392352d50..392352d50 100644 --- a/hw/darwin/quartz/xpr/x-hook.h +++ b/hw/xquartz/xpr/x-hook.h diff --git a/hw/darwin/quartz/xpr/x-list.c b/hw/xquartz/xpr/x-list.c index 3596dd355..3596dd355 100644 --- a/hw/darwin/quartz/xpr/x-list.c +++ b/hw/xquartz/xpr/x-list.c diff --git a/hw/darwin/quartz/xpr/x-list.h b/hw/xquartz/xpr/x-list.h index 04af024a2..04af024a2 100644 --- a/hw/darwin/quartz/xpr/x-list.h +++ b/hw/xquartz/xpr/x-list.h diff --git a/hw/darwin/quartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h index ddc6d0cb1..b8c69df0d 100644 --- a/hw/darwin/quartz/xpr/xpr.h +++ b/hw/xquartz/xpr/xpr.h @@ -31,7 +31,7 @@ #include "screenint.h" -extern Bool QuartzModeBundleInit(void); +Bool QuartzModeBundleInit(void); void AppleDRIExtensionInit(void); void xprAppleWMInit(void); diff --git a/hw/darwin/quartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c index 5539c51cc..bd82df03c 100644 --- a/hw/darwin/quartz/xpr/xprAppleWM.c +++ b/hw/xquartz/xpr/xprAppleWM.c @@ -32,7 +32,7 @@ #endif #include "xpr.h" -#include "quartz/applewmExt.h" +#include "applewmExt.h" #include "rootless.h" #include "Xplugin.h" #include <X11/X.h> diff --git a/hw/darwin/quartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c index 160b5d908..e084ef90e 100644 --- a/hw/darwin/quartz/xpr/xprCursor.c +++ b/hw/xquartz/xpr/xprCursor.c @@ -33,9 +33,10 @@ #include <dix-config.h> #endif -#include "quartz/quartzCommon.h" +#include "quartzCommon.h" #include "xpr.h" #include "darwin.h" +#include "darwinEvents.h" #include "Xplugin.h" #include "mi.h" @@ -53,11 +54,10 @@ typedef struct { miPointerSpriteFuncPtr spriteFuncs; } QuartzCursorScreenRec, *QuartzCursorScreenPtr; -static int darwinCursorScreenIndex = -1; -static unsigned long darwinCursorGeneration = 0; +static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey; -#define CURSOR_PRIV(pScreen) \ - ((QuartzCursorScreenPtr)pScreen->devPrivates[darwinCursorScreenIndex].ptr) +#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \ + dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey)) static Bool @@ -369,27 +369,18 @@ QuartzInitCursor(ScreenPtr pScreen) if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) return FALSE; - /* allocate private storage for this screen's QuickDraw cursor info */ - if (darwinCursorGeneration != serverGeneration) - { - if ((darwinCursorScreenIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - - darwinCursorGeneration = serverGeneration; - } - ScreenPriv = xcalloc(1, sizeof(QuartzCursorScreenRec)); if (ScreenPriv == NULL) return FALSE; /* CURSOR_PRIV(pScreen) = ScreenPriv; */ - pScreen->devPrivates[darwinCursorScreenIndex].ptr = ScreenPriv; + dixSetPrivate(&pScreen->devPrivates, darwinCursorScreenKey, ScreenPriv); /* override some screen procedures */ ScreenPriv->QueryBestSize = pScreen->QueryBestSize; pScreen->QueryBestSize = QuartzCursorQueryBestSize; - PointPriv = (miPointerScreenPtr) pScreen->devPrivates[miPointerScreenIndex].ptr; + PointPriv = dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); ScreenPriv->spriteFuncs = PointPriv->spriteFuncs; PointPriv->spriteFuncs = &quartzSpriteFuncsRec; diff --git a/hw/darwin/quartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c index 1b0ba9102..b9a33de90 100644 --- a/hw/darwin/quartz/xpr/xprFrame.c +++ b/hw/xquartz/xpr/xprFrame.c @@ -36,7 +36,7 @@ #include "Xplugin.h" #include "x-hash.h" #include "x-list.h" -#include "quartz/applewmExt.h" +#include "applewmExt.h" #include "propertyst.h" #include "dix.h" @@ -339,7 +339,7 @@ xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects, void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin) { - DeleteProperty(oldWin, xa_native_window_id()); + DeleteProperty(serverClient, oldWin, xa_native_window_id()); xprSetNativeProperty(pFrame); } diff --git a/hw/darwin/quartz/xpr/xprScreen.c b/hw/xquartz/xpr/xprScreen.c index 28ed159fe..e4e1fda7e 100644 --- a/hw/darwin/quartz/xpr/xprScreen.c +++ b/hw/xquartz/xpr/xprScreen.c @@ -31,17 +31,18 @@ #include <dix-config.h> #endif -#include "quartz/quartzCommon.h" -#include "quartz/quartz.h" +#include "quartzCommon.h" +#include "quartz.h" #include "xpr.h" -#include "quartz/pseudoramiX.h" +#include "pseudoramiX.h" #include "darwin.h" #include "rootless.h" #include "safeAlpha/safeAlpha.h" #include "dri.h" #include "globals.h" #include "Xplugin.h" -#include "quartz/applewmExt.h" +#include "applewmExt.h" +#include "micmap.h" // From xprFrame.c WindowPtr xprGetXWindow(xp_window_id wid); @@ -61,53 +62,52 @@ static const char *xprOpenGLBundle = "glxCGL.bundle"; * eventHandler * Callback handler for Xplugin events. */ -static void -eventHandler(unsigned int type, const void *arg, - unsigned int arg_size, void *data) -{ +static void eventHandler(unsigned int type, const void *arg, + unsigned int arg_size, void *data) { switch (type) { - case XP_EVENT_DISPLAY_CHANGED: - DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); - QuartzMessageServerThread(kXDarwinDisplayChanged, 0); - break; - - case XP_EVENT_WINDOW_STATE_CHANGED: - DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED\n"); - if (arg_size >= sizeof(xp_window_state_event)) { - const xp_window_state_event *ws_arg = arg; - - QuartzMessageServerThread(kXDarwinWindowState, 2, - ws_arg->id, ws_arg->state); - } - break; - - case XP_EVENT_WINDOW_MOVED: - DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); - if (arg_size == sizeof(xp_window_id)) { - xp_window_id id = * (xp_window_id *) arg; - WindowPtr pWin = xprGetXWindow(id); - QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin); - } - break; - - case XP_EVENT_SURFACE_DESTROYED: - DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n"); - case XP_EVENT_SURFACE_CHANGED: - DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n"); - if (arg_size == sizeof(xp_surface_id)) { - int kind; - - if (type == XP_EVENT_SURFACE_DESTROYED) - kind = AppleDRISurfaceNotifyDestroyed; - else - kind = AppleDRISurfaceNotifyChanged; - - DRISurfaceNotify(*(xp_surface_id *) arg, kind); - } - break; - default: - ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", - type); + case XP_EVENT_DISPLAY_CHANGED: + DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n"); + QuartzMessageServerThread(kXDarwinDisplayChanged, 0); + break; + + case XP_EVENT_WINDOW_STATE_CHANGED: + if (arg_size >= sizeof(xp_window_state_event)) { + const xp_window_state_event *ws_arg = arg; + + DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state); + QuartzMessageServerThread(kXDarwinWindowState, 2, + ws_arg->id, ws_arg->state); + } else { + DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n"); + } + break; + + case XP_EVENT_WINDOW_MOVED: + DEBUG_LOG("XP_EVENT_WINDOW_MOVED\n"); + if (arg_size == sizeof(xp_window_id)) { + xp_window_id id = * (xp_window_id *) arg; + WindowPtr pWin = xprGetXWindow(id); + QuartzMessageServerThread(kXDarwinWindowMoved, 1, pWin); + } + break; + + case XP_EVENT_SURFACE_DESTROYED: + DEBUG_LOG("XP_EVENT_SURFACE_DESTROYED\n"); + case XP_EVENT_SURFACE_CHANGED: + DEBUG_LOG("XP_EVENT_SURFACE_CHANGED\n"); + if (arg_size == sizeof(xp_surface_id)) { + int kind; + + if (type == XP_EVENT_SURFACE_DESTROYED) + kind = AppleDRISurfaceNotifyDestroyed; + else + kind = AppleDRISurfaceNotifyChanged; + + DRISurfaceNotify(*(xp_surface_id *) arg, kind); + } + break; + default: + ErrorF("Unknown XP_EVENT type (%d) in xprScreen:eventHandler\n", type); } } @@ -249,35 +249,59 @@ static Bool xprAddScreen(int index, ScreenPtr pScreen) { DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - - /* If no specific depth chosen, look for the depth of the main display. - Else if 16bpp specified, use that. Else use 32bpp. */ - - dfb->colorType = TrueColor; - dfb->bitsPerComponent = 8; - dfb->bitsPerPixel = 32; - dfb->colorBitsPerPixel = 24; - - if (darwinDesiredDepth == -1) - { - dfb->bitsPerComponent = CGDisplayBitsPerSample(kCGDirectMainDisplay); - dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay); - dfb->colorBitsPerPixel = - CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * - dfb->bitsPerComponent; - } - else if (darwinDesiredDepth == 15) - { - dfb->bitsPerComponent = 5; - dfb->bitsPerPixel = 16; - dfb->colorBitsPerPixel = 15; + int depth = darwinDesiredDepth; + + if(depth == -1) { + depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay); + //dfb->depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay); + //dfb->bitsPerRGB = CGDisplayBitsPerSample(kCGDirectMainDisplay); + //dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay); } - else if (darwinDesiredDepth == 8) - { - dfb->colorType = PseudoColor; - dfb->bitsPerComponent = 8; - dfb->bitsPerPixel = 8; - dfb->colorBitsPerPixel = 8; + + switch(depth) { + case -8: // broken + FatalError("Unsupported color depth %d\n", darwinDesiredDepth); + dfb->visuals = (1 << StaticGray) | (1 << GrayScale); + dfb->preferredCVC = GrayScale; + dfb->depth = 8; + dfb->bitsPerRGB = 8; + dfb->bitsPerPixel = 8; + dfb->redMask = 0; + dfb->greenMask = 0; + dfb->blueMask = 0; + break; + case 8: // broken + dfb->visuals = PseudoColorMask; + dfb->preferredCVC = PseudoColor; + dfb->depth = 8; + dfb->bitsPerRGB = 8; + dfb->bitsPerPixel = 8; + dfb->redMask = 0; + dfb->greenMask = 0; + dfb->blueMask = 0; + break; + case 15: + dfb->visuals = LARGE_VISUALS; + dfb->preferredCVC = TrueColor; + dfb->depth = 15; + dfb->bitsPerRGB = 5; + dfb->bitsPerPixel = 16; + dfb->redMask = 0x7c00; + dfb->greenMask = 0x03e0; + dfb->blueMask = 0x001f; + break; + case 24: + dfb->visuals = LARGE_VISUALS; + dfb->preferredCVC = TrueColor; + dfb->depth = 24; + dfb->bitsPerRGB = 8; + dfb->bitsPerPixel = 32; + dfb->redMask = 0x00ff0000; + dfb->greenMask = 0x0000ff00; + dfb->blueMask = 0x000000ff; + break; + default: + FatalError("Unsupported color depth %d\n", darwinDesiredDepth); } if (noPseudoramiXExtension) diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 754666090..3ab324931 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -629,11 +629,11 @@ extern DWORD g_dwEvents; #ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; #endif -extern int g_iScreenPrivateIndex; -extern int g_iCmapPrivateIndex; -extern int g_iGCPrivateIndex; -extern int g_iPixmapPrivateIndex; -extern int g_iWindowPrivateIndex; +extern DevPrivateKey g_iScreenPrivateKey; +extern DevPrivateKey g_iCmapPrivateKey; +extern DevPrivateKey g_iGCPrivateKey; +extern DevPrivateKey g_iPixmapPrivateKey; +extern DevPrivateKey g_iWindowPrivateKey; extern unsigned long g_ulServerGeneration; extern CARD32 g_c32LastInputEventTime; extern DWORD g_dwEnginesSupported; @@ -659,11 +659,11 @@ extern FARPROC g_fpTrackMouseEvent; * Screen privates macros */ -#define winGetScreenPriv(pScreen) \ - ((winPrivScreenPtr) (pScreen)->devPrivates[g_iScreenPrivateIndex].ptr) +#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey)) #define winSetScreenPriv(pScreen,v) \ - ((pScreen)->devPrivates[g_iScreenPrivateIndex].ptr = (pointer) v) + dixSetPrivate(&(pScreen)->devPrivates, g_iScreenPrivateKey, v) #define winScreenPriv(pScreen) \ winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) @@ -673,11 +673,11 @@ extern FARPROC g_fpTrackMouseEvent; * Colormap privates macros */ -#define winGetCmapPriv(pCmap) \ - ((winPrivCmapPtr) (pCmap)->devPrivates[g_iCmapPrivateIndex].ptr) +#define winGetCmapPriv(pCmap) ((winPrivCmapPtr) \ + dixLookupPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey)) #define winSetCmapPriv(pCmap,v) \ - ((pCmap)->devPrivates[g_iCmapPrivateIndex].ptr = (pointer) v) + dixSetPrivate(&(pCmap)->devPrivates, g_iCmapPrivateKey, v) #define winCmapPriv(pCmap) \ winPrivCmapPtr pCmapPriv = winGetCmapPriv(pCmap) @@ -687,11 +687,11 @@ extern FARPROC g_fpTrackMouseEvent; * GC privates macros */ -#define winGetGCPriv(pGC) \ - ((winPrivGCPtr) (pGC)->devPrivates[g_iGCPrivateIndex].ptr) +#define winGetGCPriv(pGC) ((winPrivGCPtr) \ + dixLookupPrivate(&(pGC)->devPrivates, g_iGCPrivateKey)) #define winSetGCPriv(pGC,v) \ - ((pGC)->devPrivates[g_iGCPrivateIndex].ptr = (pointer) v) + dixSetPrivate(&(pGC)->devPrivates, g_iGCPrivateKey, v) #define winGCPriv(pGC) \ winPrivGCPtr pGCPriv = winGetGCPriv(pGC) @@ -701,11 +701,11 @@ extern FARPROC g_fpTrackMouseEvent; * Pixmap privates macros */ -#define winGetPixmapPriv(pPixmap) \ - ((winPrivPixmapPtr) (pPixmap)->devPrivates[g_iPixmapPrivateIndex].ptr) +#define winGetPixmapPriv(pPixmap) ((winPrivPixmapPtr) \ + dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey)) #define winSetPixmapPriv(pPixmap,v) \ - ((pPixmap)->devPrivates[g_iPixmapPrivateIndex].ptr = (pointer) v) + dixLookupPrivate(&(pPixmap)->devPrivates, g_iPixmapPrivateKey, v) #define winPixmapPriv(pPixmap) \ winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap) @@ -715,11 +715,11 @@ extern FARPROC g_fpTrackMouseEvent; * Window privates macros */ -#define winGetWindowPriv(pWin) \ - ((winPrivWinPtr) (pWin)->devPrivates[g_iWindowPrivateIndex].ptr) +#define winGetWindowPriv(pWin) ((winPrivWinPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey)) #define winSetWindowPriv(pWin,v) \ - ((pWin)->devPrivates[g_iWindowPrivateIndex].ptr = (pointer) v) + dixLookupPrivate(&(pWin)->devPrivates, g_iWindowPrivateKey, v) #define winWindowPriv(pWin) \ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin) diff --git a/hw/xwin/winallpriv.c b/hw/xwin/winallpriv.c index f4decfb59..21ccd9b3b 100644 --- a/hw/xwin/winallpriv.c +++ b/hw/xwin/winallpriv.c @@ -57,12 +57,6 @@ winAllocatePrivates (ScreenPtr pScreen) /* We need a new slot for our privates if the screen gen has changed */ if (g_ulServerGeneration != serverGeneration) { - /* Get an index that we can store our privates at */ - g_iScreenPrivateIndex = AllocateScreenPrivateIndex (); - g_iGCPrivateIndex = AllocateGCPrivateIndex (); - g_iPixmapPrivateIndex = AllocatePixmapPrivateIndex (); - g_iWindowPrivateIndex = AllocateWindowPrivateIndex (); - g_ulServerGeneration = serverGeneration; } @@ -84,24 +78,21 @@ winAllocatePrivates (ScreenPtr pScreen) winSetScreenPriv (pScreen, pScreenPriv); /* Reserve GC memory for our privates */ - if (!AllocateGCPrivate (pScreen, g_iGCPrivateIndex, - sizeof (winPrivGCRec))) + if (!dixRequestPrivate(g_iGCPrivateKey, sizeof (winPrivGCRec))) { ErrorF ("winAllocatePrivates - AllocateGCPrivate () failed\n"); return FALSE; } /* Reserve Pixmap memory for our privates */ - if (!AllocatePixmapPrivate (pScreen, g_iPixmapPrivateIndex, - sizeof (winPrivPixmapRec))) + if (!dixRequestPrivate(g_iPixmapPrivateKey, sizeof (winPrivPixmapRec))) { ErrorF ("winAllocatePrivates - AllocatePixmapPrivates () failed\n"); return FALSE; } /* Reserve Window memory for our privates */ - if (!AllocateWindowPrivate (pScreen, g_iWindowPrivateIndex, - sizeof (winPrivWinRec))) + if (!dixRequestPrivate(g_iWindowPrivateKey, sizeof (winPrivWinRec))) { ErrorF ("winAllocatePrivates () - AllocateWindowPrivates () failed\n"); return FALSE; @@ -155,9 +146,6 @@ winAllocateCmapPrivates (ColormapPtr pCmap) /* Get a new privates index when the server generation changes */ if (s_ulPrivateGeneration != serverGeneration) { - /* Get an index that we can store our privates at */ - g_iCmapPrivateIndex = AllocateColormapPrivateIndex (winInitCmapPrivates); - /* Save the new server generation */ s_ulPrivateGeneration = serverGeneration; } diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c index 825d3dc70..2cfe0ffce 100755 --- a/hw/xwin/winclipboardwrappers.c +++ b/hw/xwin/winclipboardwrappers.c @@ -431,7 +431,6 @@ winProcSetSelectionOwner (ClientPtr client) * and we currently own the Win32 clipboard. */ if (None == stuff->window - && g_iClipboardWindow != client->lastDrawableID && (None == s_iOwners[CLIP_OWN_PRIMARY] || g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY]) && (None == s_iOwners[CLIP_OWN_CLIPBOARD] diff --git a/hw/xwin/wincursor.c b/hw/xwin/wincursor.c index c1e619bf8..021b8b82c 100644 --- a/hw/xwin/wincursor.c +++ b/hw/xwin/wincursor.c @@ -598,7 +598,8 @@ winInitCursor (ScreenPtr pScreen) pScreenPriv->cursor.QueryBestSize = pScreen->QueryBestSize; pScreen->QueryBestSize = winCursorQueryBestSize; - pPointPriv = (miPointerScreenPtr) pScreen->devPrivates[miPointerScreenIndex].ptr; + pPointPriv = (miPointerScreenPtr) + dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey); pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs; pPointPriv->spriteFuncs = &winSpriteFuncsRec; diff --git a/hw/xwin/winfillsp.c b/hw/xwin/winfillsp.c index 7e3966965..702f34f96 100644 --- a/hw/xwin/winfillsp.c +++ b/hw/xwin/winfillsp.c @@ -35,15 +35,6 @@ #include "win.h" -/* - * References to external symbols - */ - -extern int g_iPixmapPrivateIndex; -extern int g_iGCPrivateIndex; -extern int g_copyROP[]; - - extern void ROP16(HDC hdc, int rop); #define TRANSLATE_COLOR(color) \ diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index af8190d3f..fddada39e 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -44,11 +44,11 @@ int g_iLastScreen = -1; #ifdef HAS_DEVWINDOWS int g_fdMessageQueue = WIN_FD_INVALID; #endif -int g_iScreenPrivateIndex = -1; -int g_iCmapPrivateIndex = -1; -int g_iGCPrivateIndex = -1; -int g_iPixmapPrivateIndex = -1; -int g_iWindowPrivateIndex = -1; +DevPrivateKey g_iScreenPrivateKey = &g_iScreenPrivateKey; +DevPrivateKey g_iCmapPrivateKey = &g_iCmapPrivateKey; +DevPrivateKey g_iGCPrivateKey = &g_iGCPrivateKey; +DevPrivateKey g_iPixmapPrivateKey = &g_iPixmapPrivateKey; +DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKey; unsigned long g_ulServerGeneration = 0; Bool g_fInitializedDefaultScreens = FALSE; DWORD g_dwEnginesSupported = 0; diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 0a7579b61..20ff9f7db 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -365,7 +365,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message, ErrorF ("\thenght %08X\n", pWin->drawable.height); ErrorF ("\tpScreen %08X\n", pWin->drawable.pScreen); ErrorF ("\tserialNumber %08X\n", pWin->drawable.serialNumber); - ErrorF ("g_iWindowPrivateIndex %d\n", g_iWindowPrivateIndex); + ErrorF ("g_iWindowPrivateKey %p\n", g_iWindowPrivateKey); ErrorF ("pWinPriv %08X\n", pWinPriv); ErrorF ("s_pScreenPriv %08X\n", s_pScreenPriv); ErrorF ("s_pScreenInfo %08X\n", s_pScreenInfo); diff --git a/hw/xwin/winpixmap.c b/hw/xwin/winpixmap.c index 07020eee0..050c71a7f 100644 --- a/hw/xwin/winpixmap.c +++ b/hw/xwin/winpixmap.c @@ -36,13 +36,6 @@ /* - * References to external symbols - */ - -extern int g_iPixmapPrivateIndex; - - -/* * Local prototypes */ diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index a49f68f7e..9dc4c3da5 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -73,9 +73,6 @@ winMWExtWMProcs = { * References to external symbols */ -extern winScreenInfo g_ScreenInfo[]; -extern miPointerScreenFuncRec g_winPointerCursorFuncs; -extern int g_iScreenPrivateIndex; extern Bool g_fSoftwareCursor; diff --git a/hw/xwin/winsetsp.c b/hw/xwin/winsetsp.c index 8a3faee93..f894d6cda 100644 --- a/hw/xwin/winsetsp.c +++ b/hw/xwin/winsetsp.c @@ -35,15 +35,6 @@ #include "win.h" -/* - * References to external symbols - */ - -extern int g_iPixmapPrivateIndex; -extern int g_iGCPrivateIndex; -extern int g_copyROP[]; - - /* See Porting Layer Definition - p. 55 */ void winSetSpansNativeGDI (DrawablePtr pDrawable, diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c index 832e36d44..4b4cd3ded 100755 --- a/hw/xwin/winwin32rootless.c +++ b/hw/xwin/winwin32rootless.c @@ -971,7 +971,7 @@ winMWExtWMRootlessSwitchWindow (RootlessWindowPtr pFrame, WindowPtr oldWin) SetWindowLongPtr (pRLWinPriv->hWnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN); - DeleteProperty (oldWin, AtmWindowsWmNativeHwnd ()); + DeleteProperty (serverClient, oldWin, AtmWindowsWmNativeHwnd ()); winMWExtWMSetNativeProperty (pFrame); #if CYGMULTIWINDOW_DEBUG #if 0 diff --git a/include/Makefile.am b/include/Makefile.am index 96d98b526..0654b5788 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -11,6 +11,7 @@ sdk_HEADERS = \ cursor.h \ cursorstr.h \ dix.h \ + dixaccess.h \ dixevents.h \ dixfont.h \ dixfontstr.h \ @@ -31,10 +32,12 @@ sdk_HEADERS = \ os.h \ pixmap.h \ pixmapstr.h \ + privates.h \ property.h \ propertyst.h \ region.h \ regionstr.h \ + registry.h \ resource.h \ rgb.h \ screenint.h \ diff --git a/include/colormapst.h b/include/colormapst.h index c9d9514ad..f1fc8ebef 100644 --- a/include/colormapst.h +++ b/include/colormapst.h @@ -52,6 +52,7 @@ SOFTWARE. #include "colormap.h" #include "screenint.h" +#include "privates.h" /* Shared color -- the color is used by AllocColorPlanes */ typedef struct @@ -126,7 +127,7 @@ typedef struct _ColormapRec Entry *green; Entry *blue; pointer devPriv; - DevUnion *devPrivates; /* dynamic devPrivates added after devPriv + PrivateRec *devPrivates; /* dynamic devPrivates added after devPriv already existed - must keep devPriv */ } ColormapRec; diff --git a/include/cursor.h b/include/cursor.h index bdf4fd301..8635cf1a2 100644 --- a/include/cursor.h +++ b/include/cursor.h @@ -68,23 +68,7 @@ extern int FreeCursor( pointer /*pCurs*/, XID /*cid*/); -/* Quartz support on Mac OS X pulls in the QuickDraw - framework whose AllocCursor function conflicts here. */ -#ifdef __DARWIN__ -#define AllocCursor Darwin_X_AllocCursor -#endif -extern CursorPtr AllocCursor( - unsigned char* /*psrcbits*/, - unsigned char* /*pmaskbits*/, - CursorMetricPtr /*cm*/, - unsigned /*foreRed*/, - unsigned /*foreGreen*/, - unsigned /*foreBlue*/, - unsigned /*backRed*/, - unsigned /*backGreen*/, - unsigned /*backBlue*/); - -extern CursorPtr AllocCursorARGB( +extern int AllocARGBCursor( unsigned char* /*psrcbits*/, unsigned char* /*pmaskbits*/, CARD32* /*argb*/, @@ -94,7 +78,10 @@ extern CursorPtr AllocCursorARGB( unsigned /*foreBlue*/, unsigned /*backRed*/, unsigned /*backGreen*/, - unsigned /*backBlue*/); + unsigned /*backBlue*/, + CursorPtr* /*ppCurs*/, + ClientPtr /*client*/, + XID /*cid*/); extern int AllocGlyphCursor( Font /*source*/, @@ -108,7 +95,8 @@ extern int AllocGlyphCursor( unsigned /*backGreen*/, unsigned /*backBlue*/, CursorPtr* /*ppCurs*/, - ClientPtr /*client*/); + ClientPtr /*client*/, + XID /*cid*/); extern CursorPtr CreateRootCursor( char* /*pfilename*/, diff --git a/include/cursorstr.h b/include/cursorstr.h index b7beaa0c5..bca35969b 100644 --- a/include/cursorstr.h +++ b/include/cursorstr.h @@ -49,6 +49,7 @@ SOFTWARE. #define CURSORSTRUCT_H #include "cursor.h" +#include "privates.h" /* * device-independent cursor storage */ @@ -63,7 +64,7 @@ typedef struct _CursorBits { Bool emptyMask; /* all zeros mask */ unsigned short width, height, xhot, yhot; /* metrics */ int refcnt; /* can be shared */ - pointer devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/ + PrivateRec *devPrivates; /* set by pScr->RealizeCursor*/ #ifdef ARGB_CURSOR CARD32 *argb; /* full-color alpha blended */ #endif @@ -74,7 +75,8 @@ typedef struct _Cursor { unsigned short foreRed, foreGreen, foreBlue; /* device-independent color */ unsigned short backRed, backGreen, backBlue; /* device-independent color */ int refcnt; - pointer devPriv[MAXSCREENS]; /* set by pScr->RealizeCursor*/ + PrivateRec *devPrivates; /* set by pScr->RealizeCursor*/ + XID id; #ifdef XFIXES CARD32 serialNumber; Atom name; diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 6a3af4445..38639d684 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -21,6 +21,9 @@ /* Default font path */ #undef COMPILEDDEFAULTFONTPATH +/* Miscellaneous server configuration files path */ +#undef SERVER_MISC_CONFIG_PATH + /* Support Composite Extension */ #undef COMPOSITE @@ -273,9 +276,6 @@ /* Internal define for Xinerama */ #undef PANORAMIX -/* Support pixmap privates */ -#undef PIXPRIV - /* Overall prefix */ #undef PROJECTROOT @@ -338,9 +338,15 @@ /* unaligned word accesses behave as expected */ #undef WORKING_UNALIGNED_INT +/* Build X string registry */ +#undef XREGISTRY + /* Build X-ACE extension */ #undef XACE +/* Build SELinux extension */ +#undef XSELINUX + /* Support XCMisc extension */ #undef XCMISC @@ -430,6 +436,9 @@ #undef XEPHYR_DRI +/* Build DRI2 extension */ +#undef DRI2 + /* Build DBE support */ #undef DBE @@ -497,9 +506,6 @@ /* Define to 1 if the DTrace Xserver provider probes should be built in */ #undef XSERVER_DTRACE -/* Path to XErrorDB file */ -#undef XERRORDB_PATH - /* Define to 16-bit byteswap macro */ #undef bswap_16 diff --git a/include/dix.h b/include/dix.h index c987548bf..52212e7e7 100644 --- a/include/dix.h +++ b/include/dix.h @@ -81,29 +81,16 @@ SOFTWARE. return(BadIDChoice);\ } -#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\ - if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\ - (client->lastDrawableID != drawID))\ +#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\ {\ - int rc;\ - rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY,\ - DixWriteAccess);\ + int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\ if (rc != Success)\ return rc;\ - rc = dixLookupGC(&(pGC), stuff->gc, client, DixReadAccess);\ + rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\ if (rc != Success)\ return rc;\ if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\ return (BadMatch);\ - client->lastDrawable = pDraw;\ - client->lastDrawableID = drawID;\ - client->lastGC = pGC;\ - client->lastGCID = stuff->gc;\ - }\ - else\ - {\ - pGC = client->lastGC;\ - pDraw = client->lastDrawable;\ }\ if (pGC->serialNumber != pDraw->serialNumber)\ ValidateGC(pDraw, pGC); @@ -129,7 +116,9 @@ typedef struct _Client *ClientPtr; /* also in misc.h */ typedef struct _WorkQueue *WorkQueuePtr; +#ifdef XPRINT extern ClientPtr requestingClient; +#endif extern ClientPtr *clients; extern ClientPtr serverClient; extern int currentMaxClients; @@ -158,8 +147,6 @@ extern void UpdateCurrentTime(void); extern void UpdateCurrentTimeIf(void); -extern void FlushClientCaches(XID /*id*/); - extern int dixDestroyPixmap( pointer /*value*/, XID /*pid*/); @@ -227,17 +214,6 @@ extern int dixLookupClient( ClientPtr client, Mask access_mode); -/* - * These are deprecated compatibility functions and will be removed soon! - * Please use the new dixLookup*() functions above. - */ -extern WindowPtr SecurityLookupWindow(XID, ClientPtr, Mask); -extern WindowPtr LookupWindow(XID, ClientPtr); -extern pointer SecurityLookupDrawable(XID, ClientPtr, Mask); -extern pointer LookupDrawable(XID, ClientPtr); -extern ClientPtr LookupClient(XID, ClientPtr); -/* end deprecated functions */ - extern void NoopDDA(void); extern int AlterSaveSetForClient( @@ -510,14 +486,6 @@ void ScreenRestructured (ScreenPtr pScreen); #endif -extern void ResetClientPrivates(void); - -extern int AllocateClientPrivateIndex(void); - -extern Bool AllocateClientPrivate( - int /*index*/, - unsigned /*amount*/); - extern int ffs(int i); /* @@ -532,25 +500,6 @@ typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */ typedef void (*CallbackProcPtr) ( CallbackListPtr *, pointer, pointer); -typedef Bool (*AddCallbackProcPtr) ( - CallbackListPtr *, CallbackProcPtr, pointer); - -typedef Bool (*DeleteCallbackProcPtr) ( - CallbackListPtr *, CallbackProcPtr, pointer); - -typedef void (*CallCallbacksProcPtr) ( - CallbackListPtr *, pointer); - -typedef void (*DeleteCallbackListProcPtr) ( - CallbackListPtr *); - -typedef struct _CallbackProcs { - AddCallbackProcPtr AddCallback; - DeleteCallbackProcPtr DeleteCallback; - CallCallbacksProcPtr CallCallbacks; - DeleteCallbackListProcPtr DeleteCallbackList; -} CallbackFuncsRec, *CallbackFuncsPtr; - extern Bool AddCallback( CallbackListPtr * /*pcbl*/, CallbackProcPtr /*callback*/, @@ -615,12 +564,15 @@ extern CallbackListPtr SelectionCallback; typedef enum { SelectionSetOwner, + SelectionGetOwner, + SelectionConvertSelection, SelectionWindowDestroy, SelectionClientClose } SelectionCallbackKind; typedef struct { struct _Selection *selection; + ClientPtr client; SelectionCallbackKind kind; } SelectionInfoRec; @@ -630,4 +582,36 @@ typedef struct { extern int xstrcasecmp(char *s1, char *s2); #endif +/* + * These are deprecated compatibility functions and will be removed soon! + * Please use the noted replacements instead. + */ + +/* replaced by dixLookupWindow */ +extern WindowPtr SecurityLookupWindow( + XID id, + ClientPtr client, + Mask access_mode); + +/* replaced by dixLookupWindow */ +extern WindowPtr LookupWindow( + XID id, + ClientPtr client); + +/* replaced by dixLookupDrawable */ +extern pointer SecurityLookupDrawable( + XID id, + ClientPtr client, + Mask access_mode); + +/* replaced by dixLookupDrawable */ +extern pointer LookupDrawable( + XID id, + ClientPtr client); + +/* replaced by dixLookupClient */ +extern ClientPtr LookupClient( + XID id, + ClientPtr client); + #endif /* DIX_H */ diff --git a/include/dixaccess.h b/include/dixaccess.h new file mode 100644 index 000000000..3c62ee354 --- /dev/null +++ b/include/dixaccess.h @@ -0,0 +1,53 @@ +/*********************************************************** + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef DIX_ACCESS_H +#define DIX_ACCESS_H + +/* These are the access modes that can be passed in the last parameter + * to several of the dix lookup functions. They were originally part + * of the Security extension, now used by XACE. + * + * You can or these values together to indicate multiple modes + * simultaneously. + */ + +#define DixUnknownAccess 0 /* don't know intentions */ +#define DixReadAccess (1<<0) /* inspecting the object */ +#define DixWriteAccess (1<<1) /* changing the object */ +#define DixDestroyAccess (1<<2) /* destroying the object */ +#define DixCreateAccess (1<<3) /* creating the object */ +#define DixGetAttrAccess (1<<4) /* get object attributes */ +#define DixSetAttrAccess (1<<5) /* set object attributes */ +#define DixListPropAccess (1<<6) /* list properties of object */ +#define DixGetPropAccess (1<<7) /* get properties of object */ +#define DixSetPropAccess (1<<8) /* set properties of object */ +#define DixGetFocusAccess (1<<9) /* get focus of object */ +#define DixSetFocusAccess (1<<10) /* set focus of object */ +#define DixListAccess (1<<11) /* list objects */ +#define DixAddAccess (1<<12) /* add object */ +#define DixRemoveAccess (1<<13) /* remove object */ +#define DixHideAccess (1<<14) /* hide object */ +#define DixShowAccess (1<<15) /* show object */ +#define DixBlendAccess (1<<16) /* mix contents of objects */ +#define DixGrabAccess (1<<17) /* exclusive access to object */ +#define DixFreezeAccess (1<<18) /* freeze status of object */ +#define DixForceAccess (1<<19) /* force status of object */ +#define DixInstallAccess (1<<20) /* install object */ +#define DixUninstallAccess (1<<21) /* uninstall object */ +#define DixSendAccess (1<<22) /* send to object */ +#define DixReceiveAccess (1<<23) /* receive from object */ +#define DixUseAccess (1<<24) /* use object */ +#define DixManageAccess (1<<25) /* manage object */ +#define DixDebugAccess (1<<26) /* debug object */ +#define DixBellAccess (1<<27) /* audible sound */ + +#endif /* DIX_ACCESS_H */ diff --git a/include/dixfont.h b/include/dixfont.h index 709da6272..516d91b58 100644 --- a/include/dixfont.h +++ b/include/dixfont.h @@ -105,8 +105,10 @@ extern int SetFontPath(ClientPtr /*client*/, extern int SetDefaultFontPath(char * /*path*/); -extern unsigned char *GetFontPath(int * /*count*/, - int * /*length*/); +extern int GetFontPath(ClientPtr client, + int *count, + int *length, + unsigned char **result); extern int LoadGlyphs(ClientPtr /*client*/, FontPtr /*pfont*/, @@ -118,7 +120,7 @@ extern void DeleteClientFontStuff(ClientPtr /*client*/); /* Quartz support on Mac OS X pulls in the QuickDraw framework whose InitFonts function conflicts here. */ -#ifdef __DARWIN__ +#ifdef __APPLE__ #define InitFonts Darwin_X_InitFonts #endif extern void InitFonts(void); diff --git a/include/dixgrabs.h b/include/dixgrabs.h index 2d66d6ba1..f93e99957 100644 --- a/include/dixgrabs.h +++ b/include/dixgrabs.h @@ -50,6 +50,7 @@ extern Bool GrabMatchesSecond( GrabPtr /* pSecondGrab */); extern int AddPassiveGrabToList( + ClientPtr /* client */, GrabPtr /* pGrab */); extern Bool DeletePassiveGrabFromList( diff --git a/include/dixstruct.h b/include/dixstruct.h index bed31dc2a..d44b9cfa7 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -29,6 +29,7 @@ SOFTWARE. #include "cursor.h" #include "gc.h" #include "pixmap.h" +#include "privates.h" #include <X11/Xmd.h> /* @@ -101,10 +102,6 @@ typedef struct _Client { int clientGone; int noClientException; /* this client died or needs to be * killed */ - DrawablePtr lastDrawable; - Drawable lastDrawableID; - GCPtr lastGC; - GContext lastGCID; SaveSetElt *saveSet; int numSaved; pointer screenPrivate[MAXSCREENS]; @@ -114,7 +111,7 @@ typedef struct _Client { Bool big_requests; /* supports large requests */ int priority; ClientState clientState; - DevUnion *devPrivates; + PrivateRec *devPrivates; #ifdef XKB unsigned short xkbClientFlags; unsigned short mapNotifyMask; @@ -190,7 +187,6 @@ typedef struct _CallbackRec { } CallbackRec, *CallbackPtr; typedef struct _CallbackList { - CallbackFuncsRec funcs; int inCallback; Bool deleted; int numDeleted; diff --git a/include/extension.h b/include/extension.h index 74975c50b..6e6081740 100644 --- a/include/extension.h +++ b/include/extension.h @@ -58,14 +58,6 @@ extern Bool EnableDisableExtension(char *name, Bool enable); extern void EnableDisableExtensionError(char *name, Bool enable); -extern void ResetExtensionPrivates(void); - -extern int AllocateExtensionPrivateIndex(void); - -extern Bool AllocateExtensionPrivate( - int /*index*/, - unsigned /*amount*/); - extern void InitExtensions(int argc, char **argv); extern void InitVisualWrap(void); diff --git a/include/extinit.h b/include/extinit.h index e616b6d93..df9773caf 100644 --- a/include/extinit.h +++ b/include/extinit.h @@ -44,9 +44,4 @@ AssignTypeAndName ( char * /* name */ ); -DeviceIntPtr -LookupDeviceIntRec ( - CARD8 /* id */ - ); - #endif /* EXTINIT_H */ diff --git a/include/extnsionst.h b/include/extnsionst.h index 28ae1d539..59acd0ef4 100644 --- a/include/extnsionst.h +++ b/include/extnsionst.h @@ -53,6 +53,7 @@ SOFTWARE. #include "screenint.h" #include "extension.h" #include "gc.h" +#include "privates.h" typedef struct _ExtensionEntry { int index; @@ -69,7 +70,7 @@ typedef struct _ExtensionEntry { pointer extPrivate; unsigned short (* MinorOpcode)( /* called for errors */ ClientPtr /* client */); - DevUnion *devPrivates; + PrivateRec *devPrivates; } ExtensionEntry; /* @@ -107,9 +108,5 @@ extern Bool AddExtensionAlias( extern ExtensionEntry *CheckExtension(const char *extname); extern ExtensionEntry *GetExtensionEntry(int major); -extern void DeclareExtensionSecurity( - char * /*extname*/, - Bool /*secure*/); - #endif /* EXTENSIONSTRUCT_H */ diff --git a/include/gc.h b/include/gc.h index 3b7e38e02..bf4c268a8 100644 --- a/include/gc.h +++ b/include/gc.h @@ -115,7 +115,9 @@ extern GCPtr CreateGC( DrawablePtr /*pDrawable*/, BITS32 /*mask*/, XID* /*pval*/, - int* /*pStatus*/); + int* /*pStatus*/, + XID /*gcid*/, + ClientPtr /*client*/); extern int CopyGC( GCPtr/*pgcSrc*/, diff --git a/include/gcstruct.h b/include/gcstruct.h index 14f747836..8d9b05575 100644 --- a/include/gcstruct.h +++ b/include/gcstruct.h @@ -56,6 +56,7 @@ SOFTWARE. #include "region.h" #include "pixmap.h" #include "screenint.h" +#include "privates.h" #include <X11/Xprotostr.h> /* @@ -308,7 +309,7 @@ typedef struct _GC { unsigned long serialNumber; GCFuncs *funcs; GCOps *ops; - DevUnion *devPrivates; + PrivateRec *devPrivates; /* * The following were moved here from private storage to allow device- * independent access to them from screen wrappers. diff --git a/include/input.h b/include/input.h index b399d3ad1..ca67cfac5 100644 --- a/include/input.h +++ b/include/input.h @@ -158,10 +158,6 @@ typedef struct { unsigned char id; } LedCtrl; -extern int AllocateDevicePrivateIndex(void); -extern Bool AllocateDevicePrivate(DeviceIntPtr device, int index); -extern void ResetDevicePrivateIndex(void); - extern KeybdCtrl defaultKeyboardControl; extern PtrCtrl defaultPointerControl; @@ -201,12 +197,11 @@ extern void RegisterPointerDevice( extern void RegisterKeyboardDevice( DeviceIntPtr /*device*/); -extern DevicePtr LookupKeyboardDevice(void); - -extern DevicePtr LookupPointerDevice(void); - -extern DevicePtr LookupDevice( - int /* id */); +extern int dixLookupDevice( + DeviceIntPtr * /* dev */, + int /* id */, + ClientPtr /* client */, + Mask /* access_mode */); extern void QueryMinMaxKeyCodes( KeyCode* /*minCode*/, @@ -440,9 +435,6 @@ extern int GetMotionHistory( extern void SwitchCoreKeyboard(DeviceIntPtr pDev); extern void SwitchCorePointer(DeviceIntPtr pDev); -extern DeviceIntPtr LookupDeviceIntRec( - CARD8 deviceid); - /* Implemented by the DDX. */ extern int NewInputDeviceRequest( InputOption *options, diff --git a/include/inputstr.h b/include/inputstr.h index d0cc85811..6a1d5c9d7 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -52,6 +52,7 @@ SOFTWARE. #include "input.h" #include "window.h" #include "dixstruct.h" +#include "privates.h" #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))) @@ -62,7 +63,7 @@ SOFTWARE. #define EMASKSIZE MAX_DEVICES -extern int CoreDevicePrivatesIndex; +extern DevPrivateKey CoreDevicePrivateKey; /* Kludge: OtherClients and InputClients must be compatible, see code */ @@ -328,7 +329,7 @@ typedef struct _DeviceIntRec { void *pad0; #endif char *config_info; /* used by the hotplug layer */ - DevUnion *devPrivates; + PrivateRec *devPrivates; int nPrivates; DeviceUnwrapProc unwrapProc; } DeviceIntRec; diff --git a/include/misc.h b/include/misc.h index e6a5e9eb2..a1cbe8670 100644 --- a/include/misc.h +++ b/include/misc.h @@ -87,10 +87,7 @@ extern unsigned long serverGeneration; #define MAXSCREENS 16 #endif #define MAXCLIENTS 256 -#define MAXDITS 1 -#define MAXEXTENSIONS 128 #define MAXFORMATS 8 -#define MAXVISUALS_PER_SCREEN 50 typedef unsigned long PIXEL; typedef unsigned long ATOM; diff --git a/include/miscstruct.h b/include/miscstruct.h index d240f1b28..409b102c0 100644 --- a/include/miscstruct.h +++ b/include/miscstruct.h @@ -50,7 +50,6 @@ SOFTWARE. #include "misc.h" #include <X11/Xprotostr.h> -#include "gc.h" #include <pixman.h> typedef xPoint DDXPointRec; @@ -61,17 +60,7 @@ typedef union _DevUnion { pointer ptr; long val; unsigned long uval; - RegionPtr (*fptr)( - DrawablePtr /* pSrcDrawable */, - DrawablePtr /* pDstDrawable */, - GCPtr /* pGC */, - int /* srcx */, - int /* srcy */, - int /* width */, - int /* height */, - int /* dstx */, - int /* dsty */, - unsigned long /* bitPlane */); + pointer (*fptr)(void); } DevUnion; #endif /* MISCSTRUCT_H */ diff --git a/include/os.h b/include/os.h index c53a9ea8b..4be6b8010 100644 --- a/include/os.h +++ b/include/os.h @@ -154,7 +154,7 @@ extern void AddEnabledDevice(int /*fd*/); extern void RemoveEnabledDevice(int /*fd*/); -extern void OnlyListenToOneClient(ClientPtr /*client*/); +extern int OnlyListenToOneClient(ClientPtr /*client*/); extern void ListenToAllClients(void); diff --git a/include/pixmapstr.h b/include/pixmapstr.h index dc03cf202..cc5a8d8de 100644 --- a/include/pixmapstr.h +++ b/include/pixmapstr.h @@ -47,27 +47,17 @@ SOFTWARE. #ifndef PIXMAPSTRUCT_H #define PIXMAPSTRUCT_H -#include <X11/Xarch.h> #include "pixmap.h" #include "screenint.h" #include "regionstr.h" - -/* - * The padN members are unfortunate ABI BC. See fdo bug #6924. - */ +#include "privates.h" typedef struct _Drawable { unsigned char type; /* DRAWABLE_<type> */ unsigned char class; /* specific to type */ unsigned char depth; unsigned char bitsPerPixel; -#if defined(_XSERVER64) - XID pad0; -#endif XID id; /* resource id */ -#if defined(_XSERVER64) - XID pad1; -#endif short x; /* window: screen absolute, pixmap: 0 */ short y; /* window: screen absolute, pixmap: 0 */ unsigned short width; @@ -82,10 +72,10 @@ typedef struct _Drawable { typedef struct _Pixmap { DrawableRec drawable; + PrivateRec *devPrivates; int refcnt; int devKind; DevUnion devPrivate; - DevUnion *devPrivates; /* real devPrivates like gcs & windows */ #ifdef COMPOSITE short screen_x; short screen_y; diff --git a/include/privates.h b/include/privates.h new file mode 100644 index 000000000..8d59b728f --- /dev/null +++ b/include/privates.h @@ -0,0 +1,157 @@ +/*********************************************************** + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR 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. + +******************************************************************/ + +#ifndef PRIVATES_H +#define PRIVATES_H 1 + +#include "dix.h" +#include "resource.h" + +/***************************************************************** + * STUFF FOR PRIVATES + *****************************************************************/ + +typedef void *DevPrivateKey; + +typedef struct _Private { + DevPrivateKey key; + pointer value; + struct _Private *next; +} PrivateRec; + +/* + * Request pre-allocated private space for your driver/module. + * Calling this is not necessary if only a pointer by itself is needed. + */ +extern int +dixRequestPrivate(const DevPrivateKey key, unsigned size); + +/* + * Allocates a new private and attaches it to an existing object. + */ +extern pointer * +dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key); + +/* + * Look up a private pointer. + */ +static _X_INLINE pointer +dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key) +{ + PrivateRec *rec = *privates; + pointer *ptr; + + while (rec) { + if (rec->key == key) + return rec->value; + rec = rec->next; + } + + ptr = dixAllocatePrivate(privates, key); + return ptr ? *ptr : NULL; +} + +/* + * Look up the address of a private pointer. + */ +static _X_INLINE pointer * +dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key) +{ + PrivateRec *rec = *privates; + + while (rec) { + if (rec->key == key) + return &rec->value; + rec = rec->next; + } + + return dixAllocatePrivate(privates, key); +} + +/* + * Set a private pointer. + */ +static _X_INLINE int +dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val) +{ + PrivateRec *rec; + + top: + rec = *privates; + while (rec) { + if (rec->key == key) { + rec->value = val; + return TRUE; + } + rec = rec->next; + } + + if (!dixAllocatePrivate(privates, key)) + return FALSE; + goto top; +} + +/* + * Register callbacks to be called on private allocation/freeing. + * The calldata argument to the callbacks is a PrivateCallbackPtr. + */ +typedef struct _PrivateCallback { + DevPrivateKey key; /* private registration key */ + pointer *value; /* address of private pointer */ +} PrivateCallbackRec; + +extern int +dixRegisterPrivateInitFunc(const DevPrivateKey key, + CallbackProcPtr callback, pointer userdata); + +extern int +dixRegisterPrivateDeleteFunc(const DevPrivateKey key, + CallbackProcPtr callback, pointer userdata); + +/* + * Frees private data. + */ +extern void +dixFreePrivates(PrivateRec *privates); + +/* + * Resets the subsystem, called from the main loop. + */ +extern int +dixResetPrivates(void); + +/* + * These next two functions are necessary because the position of + * the devPrivates field varies by structure and calling code might + * only know the resource type, not the structure definition. + */ + +/* + * Looks up the offset where the devPrivates field is located. + * Returns -1 if no offset has been registered for the resource type. + */ +extern int +dixLookupPrivateOffset(RESTYPE type); + +/* + * Specifies the offset where the devPrivates field is located. + * A negative value indicates no devPrivates field is available. + */ +extern int +dixRegisterPrivateOffset(RESTYPE type, int offset); + +/* + * Convenience macro for adding an offset to an object pointer + * when making a call to one of the devPrivates functions + */ +#define DEVPRIV_AT(ptr, offset) ((PrivateRec **)((char *)ptr + offset)) + +#endif /* PRIVATES_H */ diff --git a/include/property.h b/include/property.h index 8b6dc0912..ba7d226cd 100644 --- a/include/property.h +++ b/include/property.h @@ -52,6 +52,17 @@ SOFTWARE. typedef struct _Property *PropertyPtr; +extern int dixChangeWindowProperty( + ClientPtr /*pClient*/, + WindowPtr /*pWin*/, + Atom /*property*/, + Atom /*type*/, + int /*format*/, + int /*mode*/, + unsigned long /*len*/, + pointer /*value*/, + Bool /*sendevent*/); + extern int ChangeWindowProperty( WindowPtr /*pWin*/, Atom /*property*/, @@ -63,6 +74,7 @@ extern int ChangeWindowProperty( Bool /*sendevent*/); extern int DeleteProperty( + ClientPtr /*client*/, WindowPtr /*pWin*/, Atom /*propName*/); diff --git a/include/propertyst.h b/include/propertyst.h index 6add81d9a..fd1148eb7 100644 --- a/include/propertyst.h +++ b/include/propertyst.h @@ -49,6 +49,7 @@ SOFTWARE. #define PROPERTYSTRUCT_H #include "misc.h" #include "property.h" +#include "privates.h" /* * PROPERTY -- property element */ @@ -60,6 +61,7 @@ typedef struct _Property { short format; /* format of data for swapping - 8,16,32 */ long size; /* size of data in (format/8) bytes */ pointer data; /* private to client */ + PrivateRec *devPrivates; } PropertyRec; #endif /* PROPERTYSTRUCT_H */ diff --git a/include/registry.h b/include/registry.h new file mode 100644 index 000000000..29e5fdfd3 --- /dev/null +++ b/include/registry.h @@ -0,0 +1,64 @@ +/*********************************************************** + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR 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. + +******************************************************************/ + +#ifndef DIX_REGISTRY_H +#define DIX_REGISTRY_H + +/* + * Result returned from any unsuccessful lookup + */ +#define XREGISTRY_UNKNOWN "<unknown>" + +#ifdef XREGISTRY + +#include "resource.h" +#include "extnsionst.h" + +/* Internal string registry - for auditing, debugging, security, etc. */ + +/* + * Registration functions. The name string is not copied, so it must + * not be a stack variable. + */ +void RegisterResourceName(RESTYPE type, char *name); +void RegisterExtensionNames(ExtensionEntry *ext); + +/* + * Lookup functions. The returned string must not be modified or freed. + */ +const char *LookupMajorName(int major); +const char *LookupRequestName(int major, int minor); +const char *LookupEventName(int event); +const char *LookupErrorName(int error); +const char *LookupResourceName(RESTYPE rtype); + +/* + * Setup and teardown + */ +void dixResetRegistry(void); + +#else /* XREGISTRY */ + +/* Define calls away when the registry is not being built. */ + +#define RegisterResourceName(a, b) { ; } +#define RegisterExtensionNames(a) { ; } + +#define LookupMajorName(a) XREGISTRY_UNKNOWN +#define LookupRequestName(a, b) XREGISTRY_UNKNOWN +#define LookupEventName(a) XREGISTRY_UNKNOWN +#define LookupErrorName(a) XREGISTRY_UNKNOWN +#define LookupResourceName(a) XREGISTRY_UNKNOWN + +#define dixResetRegistry() { ; } + +#endif /* XREGISTRY */ +#endif /* DIX_REGISTRY_H */ diff --git a/include/resource.h b/include/resource.h index 3231e8cd9..b8105d45a 100644 --- a/include/resource.h +++ b/include/resource.h @@ -48,6 +48,7 @@ SOFTWARE. #ifndef RESOURCE_H #define RESOURCE_H 1 #include "misc.h" +#include "dixaccess.h" /***************************************************************** * STUFF FOR RESOURCES @@ -71,9 +72,9 @@ typedef unsigned long RESTYPE; /* types for Resource routines */ -#define RT_WINDOW ((RESTYPE)1|RC_CACHED|RC_DRAWABLE) -#define RT_PIXMAP ((RESTYPE)2|RC_CACHED|RC_DRAWABLE) -#define RT_GC ((RESTYPE)3|RC_CACHED) +#define RT_WINDOW ((RESTYPE)1|RC_DRAWABLE) +#define RT_PIXMAP ((RESTYPE)2|RC_DRAWABLE) +#define RT_GC ((RESTYPE)3) #undef RT_FONT #undef RT_CURSOR #define RT_FONT ((RESTYPE)4) @@ -120,6 +121,19 @@ typedef unsigned long RESTYPE; #define BAD_RESOURCE 0xe0000000 +/* Resource state callback */ +extern CallbackListPtr ResourceStateCallback; + +typedef enum {ResourceStateAdding, + ResourceStateFreeing} ResourceState; + +typedef struct { + ResourceState state; + XID id; + RESTYPE type; + pointer value; +} ResourceStateInfoRec; + typedef int (*DeleteType)( pointer /*value*/, XID /*id*/); @@ -153,7 +167,7 @@ extern XID FakeClientID( /* Quartz support on Mac OS X uses the CarbonCore framework whose AddResource function conflicts here. */ -#ifdef __DARWIN__ +#ifdef __APPLE__ #define AddResource Darwin_X_AddResource #endif extern Bool AddResource( @@ -198,46 +212,18 @@ extern Bool LegalNewID( XID /*id*/, ClientPtr /*client*/); -extern pointer LookupIDByType( - XID /*id*/, - RESTYPE /*rtype*/); - -extern pointer LookupIDByClass( - XID /*id*/, - RESTYPE /*classes*/); - extern pointer LookupClientResourceComplex( ClientPtr client, RESTYPE type, FindComplexResType func, pointer cdata); -/* These are the access modes that can be passed in the last parameter - * to SecurityLookupIDByType/Class. The Security extension doesn't - * currently make much use of these; they're mainly provided as an - * example of what you might need for discretionary access control. - * You can or these values together to indicate multiple modes - * simultaneously. - */ - -#define DixUnknownAccess 0 /* don't know intentions */ -#define DixReadAccess (1<<0) /* inspecting the object */ -#define DixWriteAccess (1<<1) /* changing the object */ -#define DixReadWriteAccess (DixReadAccess|DixWriteAccess) -#define DixDestroyAccess (1<<2) /* destroying the object */ - -extern pointer SecurityLookupIDByType( - ClientPtr /*client*/, - XID /*id*/, - RESTYPE /*rtype*/, - Mask /*access_mode*/); - -extern pointer SecurityLookupIDByClass( - ClientPtr /*client*/, - XID /*id*/, - RESTYPE /*classes*/, - Mask /*access_mode*/); - +extern int dixLookupResource( + pointer *result, + XID id, + RESTYPE rtype, + ClientPtr client, + Mask access_mode); extern void GetXIDRange( int /*client*/, @@ -253,10 +239,34 @@ extern unsigned int GetXIDList( extern RESTYPE lastResourceType; extern RESTYPE TypeMask; -#ifdef XResExtension -extern Atom *ResourceNames; -void RegisterResourceName(RESTYPE type, char* name); -#endif +/* + * These are deprecated compatibility functions and will be removed soon! + * Please use the noted replacements instead. + */ + +/* replaced by dixLookupResource */ +extern pointer SecurityLookupIDByType( + ClientPtr client, + XID id, + RESTYPE rtype, + Mask access_mode); + +/* replaced by dixLookupResource */ +extern pointer SecurityLookupIDByClass( + ClientPtr client, + XID id, + RESTYPE classes, + Mask access_mode); + +/* replaced by dixLookupResource */ +extern pointer LookupIDByType( + XID id, + RESTYPE rtype); + +/* replaced by dixLookupResource */ +extern pointer LookupIDByClass( + XID id, + RESTYPE classes); #endif /* RESOURCE_H */ diff --git a/include/screenint.h b/include/screenint.h index 1f1434a84..6d074a375 100644 --- a/include/screenint.h +++ b/include/screenint.h @@ -55,28 +55,6 @@ typedef struct _Visual *VisualPtr; typedef struct _Depth *DepthPtr; typedef struct _Screen *ScreenPtr; -extern void ResetScreenPrivates(void); - -extern int AllocateScreenPrivateIndex(void); - -extern void ResetWindowPrivates(void); - -extern int AllocateWindowPrivateIndex(void); - -extern Bool AllocateWindowPrivate( - ScreenPtr /* pScreen */, - int /* index */, - unsigned /* amount */); - -extern void ResetGCPrivates(void); - -extern int AllocateGCPrivateIndex(void); - -extern Bool AllocateGCPrivate( - ScreenPtr /* pScreen */, - int /* index */, - unsigned /* amount */); - extern int AddScreen( Bool (* /*pfnInit*/)( int /*index*/, @@ -86,22 +64,6 @@ extern int AddScreen( int /*argc*/, char** /*argv*/); -extern void ResetPixmapPrivates(void); - -extern int AllocatePixmapPrivateIndex(void); - -extern Bool AllocatePixmapPrivate( - ScreenPtr /* pScreen */, - int /* index */, - unsigned /* amount */); - -extern void ResetColormapPrivates(void); - - typedef struct _ColormapRec *ColormapPtr; -typedef int (*InitCmapPrivFunc)(ColormapPtr, int); - -extern int AllocateColormapPrivateIndex( - InitCmapPrivFunc /* initPrivFunc */); #endif /* SCREENINT_H */ diff --git a/include/scrnintstr.h b/include/scrnintstr.h index bad0e51a9..3b2cf9f81 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -56,6 +56,7 @@ SOFTWARE. #include "validate.h" #include <X11/Xproto.h> #include "dix.h" +#include "privates.h" typedef struct _PixmapFormat { unsigned char depth; @@ -457,12 +458,6 @@ typedef struct _Screen { pointer devPrivate; short numVisuals; VisualPtr visuals; - int WindowPrivateLen; - unsigned *WindowPrivateSizes; - unsigned totalWindowSize; - int GCPrivateLen; - unsigned *GCPrivateSizes; - unsigned totalGCSize; /* Random screen procedures */ @@ -554,7 +549,7 @@ typedef struct _Screen { pointer wakeupData; /* anybody can get a piece of this array */ - DevUnion *devPrivates; + PrivateRec *devPrivates; CreateScreenResourcesProcPtr CreateScreenResources; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; @@ -566,8 +561,6 @@ typedef struct _Screen { PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ - int PixmapPrivateLen; - unsigned int *PixmapPrivateSizes; unsigned int totalPixmapSize; MarkWindowProcPtr MarkWindow; diff --git a/include/selection.h b/include/selection.h index fbe7cfca6..859b6a3b5 100644 --- a/include/selection.h +++ b/include/selection.h @@ -50,6 +50,7 @@ SOFTWARE. ******************************************************************/ #include "dixstruct.h" +#include "privates.h" /* * * Selection data structures @@ -61,6 +62,9 @@ typedef struct _Selection { Window window; WindowPtr pWin; ClientPtr client; + ClientPtr alt_client; /* support for redirection */ + Window alt_window; /* support for redirection */ + PrivateRec *devPrivates; } Selection; #endif /* SELECTION_H */ diff --git a/include/site.h b/include/site.h index 279cf2d70..fec87070b 100644 --- a/include/site.h +++ b/include/site.h @@ -52,7 +52,7 @@ SOFTWARE. * server executable. */ #ifndef VENDOR_STRING -#define VENDOR_STRING "The X.Org Group" +#define VENDOR_STRING "The X.Org Foundation" #endif /* diff --git a/include/window.h b/include/window.h index 312b75e88..52b3982e3 100644 --- a/include/window.h +++ b/include/window.h @@ -83,9 +83,6 @@ extern int WalkTree( VisitWindowProcPtr /*func*/, pointer /*data*/); -extern WindowPtr AllocateWindow( - ScreenPtr /*pScreen*/); - extern Bool CreateRootWindow( ScreenPtr /*pScreen*/); @@ -119,13 +116,13 @@ extern int DeleteWindow( pointer /*pWin*/, XID /*wid*/); -extern void DestroySubwindows( +extern int DestroySubwindows( WindowPtr /*pWin*/, ClientPtr /*client*/); /* Quartz support on Mac OS X uses the HIToolbox framework whose ChangeWindowAttributes function conflicts here. */ -#ifdef __DARWIN__ +#ifdef __APPLE__ #define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes #endif extern int ChangeWindowAttributes( @@ -136,7 +133,7 @@ extern int ChangeWindowAttributes( /* Quartz support on Mac OS X uses the HIToolbox framework whose GetWindowAttributes function conflicts here. */ -#ifdef __DARWIN__ +#ifdef __APPLE__ #define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x) extern void Darwin_X_GetWindowAttributes( #else @@ -207,9 +204,14 @@ extern RegionPtr NotClippedByChildren( extern void SendVisibilityNotify( WindowPtr /*pWin*/); -extern void SaveScreens( - int /*on*/, - int /*mode*/); +extern int dixSaveScreens( + ClientPtr client, + int on, + int mode); + +extern int SaveScreens( + int on, + int mode); extern WindowPtr FindWindowWithOptional( WindowPtr /*w*/); diff --git a/include/windowstr.h b/include/windowstr.h index 6d874ae9e..e06a2f1bd 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -55,6 +55,7 @@ SOFTWARE. #include "property.h" #include "resource.h" /* for ROOT_WINDOW_ID_BASE */ #include "dix.h" +#include "privates.h" #include "miscstruct.h" #include <X11/Xprotostr.h> #include "opaque.h" @@ -123,6 +124,7 @@ typedef struct _WindowOpt { typedef struct _Window { DrawableRec drawable; + PrivateRec *devPrivates; WindowPtr parent; /* ancestor chain */ WindowPtr nextSib; /* next lower sibling */ WindowPtr prevSib; /* next higher sibling */ @@ -156,10 +158,8 @@ typedef struct _Window { unsigned viewable:1; /* realized && InputOutput */ unsigned dontPropagate:3;/* index into DontPropagateMasks */ unsigned forcedBS:1; /* system-supplied backingStore */ -#ifdef COMPOSITE - unsigned redirectDraw:2; /* rendering is redirected from here */ -#endif - DevUnion *devPrivates; + unsigned redirectDraw:2; /* COMPOSITE rendering redirect */ + unsigned forcedBG:1; /* must have an opaque background */ } WindowRec; /* diff --git a/include/xkbfile.h b/include/xkbfile.h new file mode 100644 index 000000000..0a6cb18b9 --- /dev/null +++ b/include/xkbfile.h @@ -0,0 +1,436 @@ +/************************************************************ + Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. + + Permission to use, copy, modify, and distribute this + software and its documentation for any purpose and without + fee is hereby granted, provided that the above copyright + notice appear in all copies and that both that copyright + notice and this permission notice appear in supporting + documentation, and that the name of Silicon Graphics not be + used in advertising or publicity pertaining to distribution + of the software without specific prior written permission. + Silicon Graphics makes no representation about the suitability + of this software for any purpose. It is provided "as is" + without any express or implied warranty. + + SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL + DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH + THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ********************************************************/ + +#ifndef _XKBFILE_H_ +#define _XKBFILE_H_ 1 + +/***====================================================================***/ + +#define XkbXKMFile 0 +#define XkbCFile 1 +#define XkbXKBFile 2 +#define XkbMessage 3 + +#define XkbMapDefined (1<<0) +#define XkbStateDefined (1<<1) + +typedef void (*XkbFileAddOnFunc)( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + int /* fileSection */, + void * /* priv */ +); + +/***====================================================================***/ + +#define _XkbSuccess 0 +#define _XkbErrMissingNames 1 +#define _XkbErrMissingTypes 2 +#define _XkbErrMissingReqTypes 3 +#define _XkbErrMissingSymbols 4 +#define _XkbErrMissingVMods 5 +#define _XkbErrMissingIndicators 6 +#define _XkbErrMissingCompatMap 7 +#define _XkbErrMissingSymInterps 8 +#define _XkbErrMissingGeometry 9 +#define _XkbErrIllegalDoodad 10 +#define _XkbErrIllegalTOCType 11 +#define _XkbErrIllegalContents 12 +#define _XkbErrEmptyFile 13 +#define _XkbErrFileNotFound 14 +#define _XkbErrFileCannotOpen 15 +#define _XkbErrBadValue 16 +#define _XkbErrBadMatch 17 +#define _XkbErrBadTypeName 18 +#define _XkbErrBadTypeWidth 19 +#define _XkbErrBadFileType 20 +#define _XkbErrBadFileVersion 21 +#define _XkbErrBadFileFormat 22 +#define _XkbErrBadAlloc 23 +#define _XkbErrBadLength 24 +#define _XkbErrXReqFailure 25 +#define _XkbErrBadImplementation 26 + +extern char * _XkbErrMessages[]; +extern unsigned _XkbErrCode; +extern char * _XkbErrLocation; +extern unsigned _XkbErrData; + +/***====================================================================***/ + +_XFUNCPROTOBEGIN + +extern char * XkbIndentText( + unsigned /* size */ +); + +extern char * XkbAtomText( + Atom /* atm */, + unsigned /* format */ +); + +extern char * XkbKeysymText( + KeySym /* sym */, + unsigned /* format */ +); + +extern char * XkbStringText( + char * /* str */, + unsigned /* format */ +); + +extern char * XkbKeyNameText( + char * /* name */, + unsigned /* format */ +); + +extern char * +XkbModIndexText( + unsigned /* ndx */, + unsigned /* format */ +); + +extern char * +XkbModMaskText( + unsigned /* mask */, + unsigned /* format */ +); + +extern char * XkbVModIndexText( + XkbDescPtr /* xkb */, + unsigned /* ndx */, + unsigned /* format */ +); + +extern char * XkbVModMaskText( + XkbDescPtr /* xkb */, + unsigned /* modMask */, + unsigned /* mask */, + unsigned /* format */ +); + +extern char * XkbConfigText( + unsigned /* config */, + unsigned /* format */ +); + +extern char * XkbSIMatchText( + unsigned /* type */, + unsigned /* format */ +); + +extern char * XkbIMWhichStateMaskText( + unsigned /* use_which */, + unsigned /* format */ +); + +extern char * XkbAccessXDetailText( + unsigned /* state */, + unsigned /* format */ +); + +extern char * XkbNKNDetailMaskText( + unsigned /* detail */, + unsigned /* format */ +); + +extern char * XkbControlsMaskText( + unsigned /* ctrls */, + unsigned /* format */ +); + +extern char * XkbGeomFPText( + int /* val */, + unsigned /* format */ +); + +extern char * XkbDoodadTypeText( + unsigned /* type */, + unsigned /* format */ +); + +extern char * XkbActionTypeText( + unsigned /* type */, + unsigned /* format */ +); + +extern char * XkbActionText( + XkbDescPtr /* xkb */, + XkbAction * /* action */, + unsigned /* format */ +); + +extern char * XkbBehaviorText( + XkbDescPtr /* xkb */, + XkbBehavior * /* behavior */, + unsigned /* format */ +); + +/***====================================================================***/ + +#define _XkbKSLower (1<<0) +#define _XkbKSUpper (1<<1) + +#define XkbKSIsLower(k) (_XkbKSCheckCase(k)&_XkbKSLower) +#define XkbKSIsUpper(k) (_XkbKSCheckCase(k)&_XkbKSUpper) +#define XkbKSIsKeypad(k) (((k)>=XK_KP_Space)&&((k)<=XK_KP_Equal)) +#define XkbKSIsDeadKey(k) \ + (((k)>=XK_dead_grave)&&((k)<=XK_dead_semivoiced_sound)) + +extern unsigned _XkbKSCheckCase( + KeySym /* sym */ +); + +extern int XkbFindKeycodeByName( + XkbDescPtr /* xkb */, + char * /* name */, + Bool /* use_aliases */ +); + +extern Bool XkbLookupGroupAndLevel( + XkbDescPtr /* xkb */, + int /* key */, + int * /* mods_inout */, + int * /* grp_inout */, + int * /* lvl_rtrn */ +); + +/***====================================================================***/ + +extern Atom XkbInternAtom( + char * /* name */, + Bool /* onlyIfExists */ +); + +extern void XkbInitAtoms(void); + +/***====================================================================***/ + +#ifdef _XKBGEOM_H_ + +#define XkbDW_Unknown 0 +#define XkbDW_Doodad 1 +#define XkbDW_Section 2 +typedef struct _XkbDrawable { + int type; + int priority; + union { + XkbDoodadPtr doodad; + XkbSectionPtr section; + } u; + struct _XkbDrawable * next; +} XkbDrawableRec,*XkbDrawablePtr; + +extern XkbDrawablePtr +XkbGetOrderedDrawables( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */ +); + +extern void +XkbFreeOrderedDrawables( + XkbDrawablePtr /* draw */ +); + +#endif + +/***====================================================================***/ + +extern unsigned XkbConvertGetByNameComponents( + Bool /* toXkm */, + unsigned /* orig */ +); + +extern unsigned XkbConvertXkbComponents( + Bool /* toXkm */, + unsigned /* orig */ +); + +extern Bool XkbNameMatchesPattern( + char * /* name */, + char * /* pattern */ +); + +/***====================================================================***/ + +extern Bool XkbWriteXKBKeycodes( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBKeyTypes( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBCompatMap( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBSymbols( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBGeometry( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBSemantics( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBLayout( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBKeymap( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* topLevel */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteXKBFile( + FILE * /* file */, + XkbDescPtr /* result */, + Bool /* showImplicit */, + XkbFileAddOnFunc /* addOn */, + void * /* priv */ +); + +extern Bool XkbWriteCFile( + FILE * /* file */, + char * /* name */, + XkbDescPtr /* info */ +); + +extern Bool XkbWriteXKMFile( + FILE * /* file */, + XkbDescPtr /* result */ +); + +extern Bool XkbWriteToServer( + XkbDescPtr /* result */ +); + +extern void XkbEnsureSafeMapName( + char * /* name */ +); + +extern Bool XkbWriteXKBKeymapForNames( + FILE * /* file */, + XkbComponentNamesPtr /* names */, + XkbDescPtr /* xkb */, + unsigned /* want */, + unsigned /* need */ +); + +extern Status XkbMergeFile( + XkbDescPtr /* xkb */ +); + +/***====================================================================***/ + +extern Bool XkmProbe( + FILE * /* file */ +); + +extern unsigned XkmReadFile( + FILE * /* file */, + unsigned /* need */, + unsigned /* want */, + XkbDescPtr * /* result */ +); + +#ifdef _XKMFORMAT_H_ + +extern Bool XkmReadTOC( + FILE * /* file */, + xkmFileInfo * /* file_info */, + int /* max_toc */, + xkmSectionInfo * /* toc */ +); + +extern xkmSectionInfo *XkmFindTOCEntry( + xkmFileInfo * /* finfo */, + xkmSectionInfo * /* toc */, + unsigned /* type */ +); + +extern Bool XkmReadFileSection( + FILE * /* file */, + xkmSectionInfo * /* toc */, + XkbDescPtr /* result */, + unsigned * /* loaded_rtrn */ +); + +extern char * XkmReadFileSectionName( + FILE * /* file */, + xkmSectionInfo * /* toc */ +); + +#endif /* _XKMFORMAT_H */ + +_XFUNCPROTOEND + +#endif /* _XKBFILE_H_ */ diff --git a/include/xkbsrv.h b/include/xkbsrv.h index 167dbec59..ef99e94e7 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -27,7 +27,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XKBSRV_H_ #define _XKBSRV_H_ -#ifdef XKB_IN_SERVER #define XkbAllocClientMap SrvXkbAllocClientMap #define XkbAllocServerMap SrvXkbAllocServerMap #define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey @@ -52,10 +51,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XkbVirtualModsToReal SrvXkbVirtualModsToReal #define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange #define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges -#endif -#include <X11/extensions/XKBstr.h> #include <X11/extensions/XKBproto.h> +#include "xkbstr.h" #include "inputstr.h" typedef struct _XkbInterest { @@ -126,8 +124,6 @@ typedef struct _XkbEventCause { #define _BEEP_LED_CHANGE 14 #define _BEEP_BOUNCE_REJECT 15 -struct _XkbSrvInfo; /* definition see below */ - typedef struct _XkbFilter { CARD16 keycode; CARD8 what; @@ -258,7 +254,8 @@ typedef struct device->public.processInputProc = proc; \ oldprocs->processInputProc = \ oldprocs->realInputProc = device->public.realInputProc; \ - device->public.realInputProc = proc; \ + if (proc != device->public.enqueueInputProc) \ + device->public.realInputProc = proc; \ oldprocs->unwrapProc = device->unwrapProc; \ device->unwrapProc = unwrapproc; @@ -268,8 +265,8 @@ typedef struct device->public.realInputProc = oldprocs->realInputProc; \ device->unwrapProc = oldprocs->unwrapProc; -extern int xkbDevicePrivateIndex; -#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr) +extern DevPrivateKey xkbDevicePrivateKey; +#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr)dixLookupPrivate(&(dev)->devPrivates, xkbDevicePrivateKey)) extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); @@ -287,6 +284,7 @@ extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer); extern int XkbReqCode; extern int XkbEventBase; extern int XkbDisableLockActions; +extern int XkbKeyboardErrorCode; extern char * XkbBaseDirectory; extern char * XkbBinDirectory; extern char * XkbInitialMap; @@ -308,8 +306,7 @@ extern CARD32 xkbDebugFlags; #define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t)) #define _XkbFree(p) Xfree(p) -#define _XkbLibError(c,l,d) \ - { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); } +#define _XkbLibError(c,l,d) /* Epoch fail */ #define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff))) #define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c)) #define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d))) @@ -318,13 +315,8 @@ extern int DeviceKeyPress,DeviceKeyRelease,DeviceMotionNotify; extern int DeviceButtonPress,DeviceButtonRelease; extern int DeviceEnterNotify,DeviceLeaveNotify; -#ifdef XINPUT #define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress)) #define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease)) -#else -#define _XkbIsPressEvent(t) ((t)==KeyPress) -#define _XkbIsReleaseEvent(t) ((t)==KeyRelease) -#endif #define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\ ((k)<=(c)->curKeySyms.maxKeyCode)) @@ -336,20 +328,10 @@ extern int DeviceEnterNotify,DeviceLeaveNotify; #define IsKeypadKey(s) XkbKSIsKeypad(s) #define Status int -#define XPointer pointer -#define Display struct _XDisplay #ifndef True -#define True 1 -#define False 0 -#endif - -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif +#define True TRUE +#define False FALSE #endif _XFUNCPROTOBEGIN @@ -378,29 +360,44 @@ extern void XkbFreeNames( Bool /* freeMap */ ); -extern DeviceIntPtr _XkbLookupAnyDevice( - int /* id */, - int * /* why_rtrn */ +extern int _XkbLookupAnyDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err ); -extern DeviceIntPtr _XkbLookupKeyboard( - int /* id */, - int * /* why_rtrn */ +extern int _XkbLookupKeyboard( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err ); -extern DeviceIntPtr _XkbLookupBellDevice( - int /* id */, - int * /* why_rtrn */ +extern int _XkbLookupBellDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err ); -extern DeviceIntPtr _XkbLookupLedDevice( - int /* id */, - int * /* why_rtrn */ +extern int _XkbLookupLedDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err ); -extern DeviceIntPtr _XkbLookupButtonDevice( - int /* id */, - int * /* why_rtrn */ +extern int _XkbLookupButtonDevice( + DeviceIntPtr *pDev, + int id, + ClientPtr client, + Mask access_mode, + int *xkb_err ); extern XkbDescPtr XkbAllocKeyboard( @@ -973,10 +970,8 @@ extern void XkbSendNewKeyboardNotify( xkbNewKeyboardNotify * /* pNKN */ ); -#ifdef XKBSRV_NEED_FILE_FUNCS - +#include "xkbfile.h" #include <X11/extensions/XKMformat.h> -#include <X11/extensions/XKBfile.h> #include <X11/extensions/XKBrules.h> #define _XkbListKeymaps 0 @@ -1010,7 +1005,7 @@ extern unsigned int XkbDDXLoadKeymapByNames( XkbComponentNamesPtr /* names */, unsigned int /* want */, unsigned int /* need */, - XkbFileInfoPtr /* finfoRtrn */, + XkbDescPtr * /* finfoRtrn */, char * /* keymapNameRtrn */, int /* keymapNameRtrnLen */ ); @@ -1023,26 +1018,17 @@ extern Bool XkbDDXNamesFromRules( ); extern Bool XkbDDXApplyConfig( - XPointer /* cfg_in */, + void * /* cfg_in */, XkbSrvInfoPtr /* xkbi */ ); -extern XPointer XkbDDXPreloadConfig( - char ** /* rulesFileRtrn */, - XkbRF_VarDefsPtr /* defs */, - XkbComponentNamesPtr /* names */, - DeviceIntPtr /* dev */ -); - extern int _XkbStrCaseCmp( char * /* str1 */, char * /* str2 */ ); -#endif /* XKBSRV_NEED_FILE_FUNCS */ - _XFUNCPROTOEND -#define XkbAtomGetString(d,s) NameForAtom(s) +#define XkbAtomGetString(s) NameForAtom(s) #endif /* _XKBSRV_H_ */ diff --git a/include/xkbstr.h b/include/xkbstr.h new file mode 100644 index 000000000..214a5543c --- /dev/null +++ b/include/xkbstr.h @@ -0,0 +1,613 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBSTR_H_ +#define _XKBSTR_H_ + +#include <X11/extensions/XKB.h> + +#define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) +#define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) + +#if defined(WORD64) && defined(UNSIGNEDBITFIELDS) +#define Xkb2CharsToInt(h,l) ((h)&0x80?(int)(((h)<<8)|(l)|(~0xffff)):\ + (int)(((h)<<8)|(l)&0x7fff)) +#else +#define Xkb2CharsToInt(h,l) ((short)(((h)<<8)|(l))) +#endif + + /* + * Common data structures and access macros + */ + +typedef struct _XkbStateRec { + unsigned char group; + unsigned char locked_group; + unsigned short base_group; + unsigned short latched_group; + unsigned char mods; + unsigned char base_mods; + unsigned char latched_mods; + unsigned char locked_mods; + unsigned char compat_state; + unsigned char grab_mods; + unsigned char compat_grab_mods; + unsigned char lookup_mods; + unsigned char compat_lookup_mods; + unsigned short ptr_buttons; +} XkbStateRec,*XkbStatePtr; +#define XkbModLocks(s) ((s)->locked_mods) +#define XkbStateMods(s) ((s)->base_mods|(s)->latched_mods|XkbModLocks(s)) +#define XkbGroupLock(s) ((s)->locked_group) +#define XkbStateGroup(s) ((s)->base_group+(s)->latched_group+XkbGroupLock(s)) +#define XkbStateFieldFromRec(s) XkbBuildCoreState((s)->lookup_mods,(s)->group) +#define XkbGrabStateFromRec(s) XkbBuildCoreState((s)->grab_mods,(s)->group) + +typedef struct _XkbMods { + unsigned char mask; /* effective mods */ + unsigned char real_mods; + unsigned short vmods; +} XkbModsRec,*XkbModsPtr; + +typedef struct _XkbKTMapEntry { + Bool active; + unsigned char level; + XkbModsRec mods; +} XkbKTMapEntryRec,*XkbKTMapEntryPtr; + +typedef struct _XkbKeyType { + XkbModsRec mods; + unsigned char num_levels; + unsigned char map_count; + XkbKTMapEntryPtr map; + XkbModsPtr preserve; + Atom name; + Atom * level_names; +} XkbKeyTypeRec, *XkbKeyTypePtr; + +#define XkbNumGroups(g) ((g)&0x0f) +#define XkbOutOfRangeGroupInfo(g) ((g)&0xf0) +#define XkbOutOfRangeGroupAction(g) ((g)&0xc0) +#define XkbOutOfRangeGroupNumber(g) (((g)&0x30)>>4) +#define XkbSetGroupInfo(g,w,n) (((w)&0xc0)|(((n)&3)<<4)|((g)&0x0f)) +#define XkbSetNumGroups(g,n) (((g)&0xf0)|((n)&0x0f)) + + /* + * Structures and access macros used primarily by the server + */ + +typedef struct _XkbBehavior { + unsigned char type; + unsigned char data; +} XkbBehavior; + +#define XkbAnyActionDataSize 7 +typedef struct _XkbAnyAction { + unsigned char type; + unsigned char data[XkbAnyActionDataSize]; +} XkbAnyAction; + +typedef struct _XkbModAction { + unsigned char type; + unsigned char flags; + unsigned char mask; + unsigned char real_mods; + unsigned char vmods1; + unsigned char vmods2; +} XkbModAction; +#define XkbModActionVMods(a) \ + ((short)(((a)->vmods1<<8)|((a)->vmods2))) +#define XkbSetModActionVMods(a,v) \ + (((a)->vmods1=(((v)>>8)&0xff)),(a)->vmods2=((v)&0xff)) + +typedef struct _XkbGroupAction { + unsigned char type; + unsigned char flags; + char group_XXX; +} XkbGroupAction; +#define XkbSAGroup(a) (XkbCharToInt((a)->group_XXX)) +#define XkbSASetGroup(a,g) ((a)->group_XXX=(g)) + +typedef struct _XkbISOAction { + unsigned char type; + unsigned char flags; + unsigned char mask; + unsigned char real_mods; + char group_XXX; + unsigned char affect; + unsigned char vmods1; + unsigned char vmods2; +} XkbISOAction; + +typedef struct _XkbPtrAction { + unsigned char type; + unsigned char flags; + unsigned char high_XXX; + unsigned char low_XXX; + unsigned char high_YYY; + unsigned char low_YYY; +} XkbPtrAction; +#define XkbPtrActionX(a) (Xkb2CharsToInt((a)->high_XXX,(a)->low_XXX)) +#define XkbPtrActionY(a) (Xkb2CharsToInt((a)->high_YYY,(a)->low_YYY)) +#define XkbSetPtrActionX(a,x) (XkbIntTo2Chars(x,(a)->high_XXX,(a)->low_XXX)) +#define XkbSetPtrActionY(a,y) (XkbIntTo2Chars(y,(a)->high_YYY,(a)->low_YYY)) + +typedef struct _XkbPtrBtnAction { + unsigned char type; + unsigned char flags; + unsigned char count; + unsigned char button; +} XkbPtrBtnAction; + +typedef struct _XkbPtrDfltAction { + unsigned char type; + unsigned char flags; + unsigned char affect; + char valueXXX; +} XkbPtrDfltAction; +#define XkbSAPtrDfltValue(a) (XkbCharToInt((a)->valueXXX)) +#define XkbSASetPtrDfltValue(a,c) ((a)->valueXXX= ((c)&0xff)) + +typedef struct _XkbSwitchScreenAction { + unsigned char type; + unsigned char flags; + char screenXXX; +} XkbSwitchScreenAction; +#define XkbSAScreen(a) (XkbCharToInt((a)->screenXXX)) +#define XkbSASetScreen(a,s) ((a)->screenXXX= ((s)&0xff)) + +typedef struct _XkbCtrlsAction { + unsigned char type; + unsigned char flags; + unsigned char ctrls3; + unsigned char ctrls2; + unsigned char ctrls1; + unsigned char ctrls0; +} XkbCtrlsAction; +#define XkbActionSetCtrls(a,c) (((a)->ctrls3=(((c)>>24)&0xff)),\ + ((a)->ctrls2=(((c)>>16)&0xff)),\ + ((a)->ctrls1=(((c)>>8)&0xff)),\ + ((a)->ctrls0=((c)&0xff))) +#define XkbActionCtrls(a) ((((unsigned int)(a)->ctrls3)<<24)|\ + (((unsigned int)(a)->ctrls2)<<16)|\ + (((unsigned int)(a)->ctrls1)<<8)|\ + ((unsigned int)((a)->ctrls0))) + +typedef struct _XkbMessageAction { + unsigned char type; + unsigned char flags; + unsigned char message[6]; +} XkbMessageAction; + +typedef struct _XkbRedirectKeyAction { + unsigned char type; + unsigned char new_key; + unsigned char mods_mask; + unsigned char mods; + unsigned char vmods_mask0; + unsigned char vmods_mask1; + unsigned char vmods0; + unsigned char vmods1; +} XkbRedirectKeyAction; + +#define XkbSARedirectVMods(a) ((((unsigned int)(a)->vmods1)<<8)|\ + ((unsigned int)(a)->vmods0)) +#define XkbSARedirectSetVMods(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ + ((a)->vmods_mask0=((m)&0xff))) +#define XkbSARedirectVModsMask(a) ((((unsigned int)(a)->vmods_mask1)<<8)|\ + ((unsigned int)(a)->vmods_mask0)) +#define XkbSARedirectSetVModsMask(a,m) (((a)->vmods_mask1=(((m)>>8)&0xff)),\ + ((a)->vmods_mask0=((m)&0xff))) + +typedef struct _XkbDeviceBtnAction { + unsigned char type; + unsigned char flags; + unsigned char count; + unsigned char button; + unsigned char device; +} XkbDeviceBtnAction; + +typedef struct _XkbDeviceValuatorAction { + unsigned char type; + unsigned char device; + unsigned char v1_what; + unsigned char v1_ndx; + unsigned char v1_value; + unsigned char v2_what; + unsigned char v2_ndx; + unsigned char v2_value; +} XkbDeviceValuatorAction; + +typedef union _XkbAction { + XkbAnyAction any; + XkbModAction mods; + XkbGroupAction group; + XkbISOAction iso; + XkbPtrAction ptr; + XkbPtrBtnAction btn; + XkbPtrDfltAction dflt; + XkbSwitchScreenAction screen; + XkbCtrlsAction ctrls; + XkbMessageAction msg; + XkbRedirectKeyAction redirect; + XkbDeviceBtnAction devbtn; + XkbDeviceValuatorAction devval; + unsigned char type; +} XkbAction; + +typedef struct _XkbControls { + unsigned char mk_dflt_btn; + unsigned char num_groups; + unsigned char groups_wrap; + XkbModsRec internal; + XkbModsRec ignore_lock; + unsigned int enabled_ctrls; + unsigned short repeat_delay; + unsigned short repeat_interval; + unsigned short slow_keys_delay; + unsigned short debounce_delay; + unsigned short mk_delay; + unsigned short mk_interval; + unsigned short mk_time_to_max; + unsigned short mk_max_speed; + short mk_curve; + unsigned short ax_options; + unsigned short ax_timeout; + unsigned short axt_opts_mask; + unsigned short axt_opts_values; + unsigned int axt_ctrls_mask; + unsigned int axt_ctrls_values; + unsigned char per_key_repeat[XkbPerKeyBitArraySize]; +} XkbControlsRec, *XkbControlsPtr; + +#define XkbAX_AnyFeedback(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) +#define XkbAX_NeedOption(c,w) ((c)->ax_options&(w)) +#define XkbAX_NeedFeedback(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) + +typedef struct _XkbServerMapRec { + unsigned short num_acts; + unsigned short size_acts; + XkbAction *acts; + + XkbBehavior *behaviors; + unsigned short *key_acts; +#if defined(__cplusplus) || defined(c_plusplus) + /* explicit is a C++ reserved word */ + unsigned char *c_explicit; +#else + unsigned char *explicit; +#endif + unsigned char vmods[XkbNumVirtualMods]; + unsigned short *vmodmap; +} XkbServerMapRec, *XkbServerMapPtr; + +#define XkbSMKeyActionsPtr(m,k) (&(m)->acts[(m)->key_acts[k]]) + + /* + * Structures and access macros used primarily by clients + */ + +typedef struct _XkbSymMapRec { + unsigned char kt_index[XkbNumKbdGroups]; + unsigned char group_info; + unsigned char width; + unsigned short offset; +} XkbSymMapRec, *XkbSymMapPtr; + +typedef struct _XkbClientMapRec { + unsigned char size_types; + unsigned char num_types; + XkbKeyTypePtr types; + + unsigned short size_syms; + unsigned short num_syms; + KeySym *syms; + XkbSymMapPtr key_sym_map; + + unsigned char *modmap; +} XkbClientMapRec, *XkbClientMapPtr; + +#define XkbCMKeyGroupInfo(m,k) ((m)->key_sym_map[k].group_info) +#define XkbCMKeyNumGroups(m,k) (XkbNumGroups((m)->key_sym_map[k].group_info)) +#define XkbCMKeyGroupWidth(m,k,g) (XkbCMKeyType(m,k,g)->num_levels) +#define XkbCMKeyGroupsWidth(m,k) ((m)->key_sym_map[k].width) +#define XkbCMKeyTypeIndex(m,k,g) ((m)->key_sym_map[k].kt_index[g&0x3]) +#define XkbCMKeyType(m,k,g) (&(m)->types[XkbCMKeyTypeIndex(m,k,g)]) +#define XkbCMKeyNumSyms(m,k) (XkbCMKeyGroupsWidth(m,k)*XkbCMKeyNumGroups(m,k)) +#define XkbCMKeySymsOffset(m,k) ((m)->key_sym_map[k].offset) +#define XkbCMKeySymsPtr(m,k) (&(m)->syms[XkbCMKeySymsOffset(m,k)]) + + /* + * Compatibility structures and access macros + */ + +typedef struct _XkbSymInterpretRec { + KeySym sym; + unsigned char flags; + unsigned char match; + unsigned char mods; + unsigned char virtual_mod; + XkbAnyAction act; +} XkbSymInterpretRec,*XkbSymInterpretPtr; + +typedef struct _XkbCompatMapRec { + XkbSymInterpretPtr sym_interpret; + XkbModsRec groups[XkbNumKbdGroups]; + unsigned short num_si; + unsigned short size_si; +} XkbCompatMapRec, *XkbCompatMapPtr; + +typedef struct _XkbIndicatorMapRec { + unsigned char flags; + unsigned char which_groups; + unsigned char groups; + unsigned char which_mods; + XkbModsRec mods; + unsigned int ctrls; +} XkbIndicatorMapRec, *XkbIndicatorMapPtr; + +#define XkbIM_IsAuto(i) ((((i)->flags&XkbIM_NoAutomatic)==0)&&\ + (((i)->which_groups&&(i)->groups)||\ + ((i)->which_mods&&(i)->mods.mask)||\ + ((i)->ctrls))) +#define XkbIM_InUse(i) (((i)->flags)||((i)->which_groups)||\ + ((i)->which_mods)||((i)->ctrls)) + + +typedef struct _XkbIndicatorRec { + unsigned long phys_indicators; + XkbIndicatorMapRec maps[XkbNumIndicators]; +} XkbIndicatorRec,*XkbIndicatorPtr; + +typedef struct _XkbKeyNameRec { + char name[XkbKeyNameLength]; +} XkbKeyNameRec,*XkbKeyNamePtr; + +typedef struct _XkbKeyAliasRec { + char real[XkbKeyNameLength]; + char alias[XkbKeyNameLength]; +} XkbKeyAliasRec,*XkbKeyAliasPtr; + + /* + * Names for everything + */ +typedef struct _XkbNamesRec { + Atom keycodes; + Atom geometry; + Atom symbols; + Atom types; + Atom compat; + Atom vmods[XkbNumVirtualMods]; + Atom indicators[XkbNumIndicators]; + Atom groups[XkbNumKbdGroups]; + XkbKeyNamePtr keys; + XkbKeyAliasPtr key_aliases; + Atom *radio_groups; + Atom phys_symbols; + + unsigned char num_keys; + unsigned char num_key_aliases; + unsigned short num_rg; +} XkbNamesRec,*XkbNamesPtr; + +typedef struct _XkbGeometry *XkbGeometryPtr; + /* + * Tie it all together into one big keyboard description + */ +typedef struct _XkbDesc { + unsigned int defined; + unsigned short flags; + unsigned short device_spec; + KeyCode min_key_code; + KeyCode max_key_code; + + XkbControlsPtr ctrls; + XkbServerMapPtr server; + XkbClientMapPtr map; + XkbIndicatorPtr indicators; + XkbNamesPtr names; + XkbCompatMapPtr compat; + XkbGeometryPtr geom; +} XkbDescRec, *XkbDescPtr; +#define XkbKeyKeyTypeIndex(d,k,g) (XkbCMKeyTypeIndex((d)->map,k,g)) +#define XkbKeyKeyType(d,k,g) (XkbCMKeyType((d)->map,k,g)) +#define XkbKeyGroupWidth(d,k,g) (XkbCMKeyGroupWidth((d)->map,k,g)) +#define XkbKeyGroupsWidth(d,k) (XkbCMKeyGroupsWidth((d)->map,k)) +#define XkbKeyGroupInfo(d,k) (XkbCMKeyGroupInfo((d)->map,(k))) +#define XkbKeyNumGroups(d,k) (XkbCMKeyNumGroups((d)->map,(k))) +#define XkbKeyNumSyms(d,k) (XkbCMKeyNumSyms((d)->map,(k))) +#define XkbKeySymsPtr(d,k) (XkbCMKeySymsPtr((d)->map,(k))) +#define XkbKeySym(d,k,n) (XkbKeySymsPtr(d,k)[n]) +#define XkbKeySymEntry(d,k,sl,g) \ + (XkbKeySym(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl)))) +#define XkbKeyAction(d,k,n) \ + (XkbKeyHasActions(d,k)?&XkbKeyActionsPtr(d,k)[n]:NULL) +#define XkbKeyActionEntry(d,k,sl,g) \ + (XkbKeyHasActions(d,k)?\ + XkbKeyAction(d,k,((XkbKeyGroupsWidth(d,k)*(g))+(sl))):NULL) + +#define XkbKeyHasActions(d,k) ((d)->server->key_acts[k]!=0) +#define XkbKeyNumActions(d,k) (XkbKeyHasActions(d,k)?XkbKeyNumSyms(d,k):1) +#define XkbKeyActionsPtr(d,k) (XkbSMKeyActionsPtr((d)->server,k)) +#define XkbKeycodeInRange(d,k) (((k)>=(d)->min_key_code)&&\ + ((k)<=(d)->max_key_code)) +#define XkbNumKeys(d) ((d)->max_key_code-(d)->min_key_code+1) + + + /* + * The following structures can be used to track changes + * to a keyboard device + */ +typedef struct _XkbMapChanges { + unsigned short changed; + KeyCode min_key_code; + KeyCode max_key_code; + unsigned char first_type; + unsigned char num_types; + KeyCode first_key_sym; + unsigned char num_key_syms; + KeyCode first_key_act; + unsigned char num_key_acts; + KeyCode first_key_behavior; + unsigned char num_key_behaviors; + KeyCode first_key_explicit; + unsigned char num_key_explicit; + KeyCode first_modmap_key; + unsigned char num_modmap_keys; + KeyCode first_vmodmap_key; + unsigned char num_vmodmap_keys; + unsigned char pad; + unsigned short vmods; +} XkbMapChangesRec,*XkbMapChangesPtr; + +typedef struct _XkbControlsChanges { + unsigned int changed_ctrls; + unsigned int enabled_ctrls_changes; + Bool num_groups_changed; +} XkbControlsChangesRec,*XkbControlsChangesPtr; + +typedef struct _XkbIndicatorChanges { + unsigned int state_changes; + unsigned int map_changes; +} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; + +typedef struct _XkbNameChanges { + unsigned int changed; + unsigned char first_type; + unsigned char num_types; + unsigned char first_lvl; + unsigned char num_lvls; + unsigned char num_aliases; + unsigned char num_rg; + unsigned char first_key; + unsigned char num_keys; + unsigned short changed_vmods; + unsigned long changed_indicators; + unsigned char changed_groups; +} XkbNameChangesRec,*XkbNameChangesPtr; + +typedef struct _XkbCompatChanges { + unsigned char changed_groups; + unsigned short first_si; + unsigned short num_si; +} XkbCompatChangesRec,*XkbCompatChangesPtr; + +typedef struct _XkbChanges { + unsigned short device_spec; + unsigned short state_changes; + XkbMapChangesRec map; + XkbControlsChangesRec ctrls; + XkbIndicatorChangesRec indicators; + XkbNameChangesRec names; + XkbCompatChangesRec compat; +} XkbChangesRec, *XkbChangesPtr; + + /* + * These data structures are used to construct a keymap from + * a set of components or to list components in the server + * database. + */ +typedef struct _XkbComponentNames { + char * keymap; + char * keycodes; + char * types; + char * compat; + char * symbols; + char * geometry; +} XkbComponentNamesRec, *XkbComponentNamesPtr; + +typedef struct _XkbComponentName { + unsigned short flags; + char * name; +} XkbComponentNameRec,*XkbComponentNamePtr; + +typedef struct _XkbComponentList { + int num_keymaps; + int num_keycodes; + int num_types; + int num_compat; + int num_symbols; + int num_geometry; + XkbComponentNamePtr keymaps; + XkbComponentNamePtr keycodes; + XkbComponentNamePtr types; + XkbComponentNamePtr compat; + XkbComponentNamePtr symbols; + XkbComponentNamePtr geometry; +} XkbComponentListRec, *XkbComponentListPtr; + + /* + * The following data structures describe and track changes to a + * non-keyboard extension device + */ +typedef struct _XkbDeviceLedInfo { + unsigned short led_class; + unsigned short led_id; + unsigned int phys_indicators; + unsigned int maps_present; + unsigned int names_present; + unsigned int state; + Atom names[XkbNumIndicators]; + XkbIndicatorMapRec maps[XkbNumIndicators]; +} XkbDeviceLedInfoRec,*XkbDeviceLedInfoPtr; + +typedef struct _XkbDeviceInfo { + char * name; + Atom type; + unsigned short device_spec; + Bool has_own_state; + unsigned short supported; + unsigned short unsupported; + + unsigned short num_btns; + XkbAction * btn_acts; + + unsigned short sz_leds; + unsigned short num_leds; + unsigned short dflt_kbd_fb; + unsigned short dflt_led_fb; + XkbDeviceLedInfoPtr leds; +} XkbDeviceInfoRec,*XkbDeviceInfoPtr; + +#define XkbXI_DevHasBtnActs(d) (((d)->num_btns>0)&&((d)->btn_acts!=NULL)) +#define XkbXI_LegalDevBtn(d,b) (XkbXI_DevHasBtnActs(d)&&((b)<(d)->num_btns)) +#define XkbXI_DevHasLeds(d) (((d)->num_leds>0)&&((d)->leds!=NULL)) + +typedef struct _XkbDeviceLedChanges { + unsigned short led_class; + unsigned short led_id; + unsigned int defined; /* names or maps changed */ + struct _XkbDeviceLedChanges *next; +} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; + +typedef struct _XkbDeviceChanges { + unsigned int changed; + unsigned short first_btn; + unsigned short num_btns; + XkbDeviceLedChangesRec leds; +} XkbDeviceChangesRec,*XkbDeviceChangesPtr; + +#endif /* _XKBSTR_H_ */ diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index 8e52ae106..0603eab67 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in @@ -54,12 +54,12 @@ /* Building DRI-capable DDX. */ #undef XF86DRI +/* Build DRI2 extension */ +#undef DRI2 + /* Solaris 8 or later? */ #undef __SOL8__ -/* Whether to use pixmap privates */ -#undef PIXPRIV - /* Define to 1 if you have the `walkcontext' function (used on Solaris for xorg_backtrace in hw/xfree86/common/xf86Events.c */ #undef HAVE_WALKCONTEXT diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in index f38213117..1d41b4ce6 100644 --- a/include/xorg-server.h.in +++ b/include/xorg-server.h.in @@ -64,9 +64,6 @@ /* Internal define for Xinerama */ #undef PANORAMIX -/* Support pixmap privates */ -#undef PIXPRIV - /* Support RANDR extension */ #undef RANDR @@ -145,6 +142,9 @@ /* Build DRI extension */ #undef XF86DRI +/* Build DRI2 extension */ +#undef DRI2 + /* Build Xorg server */ #undef XORGSERVER @@ -58,6 +58,7 @@ SOFTWARE. #include "region.h" #include "gc.h" #include "colormap.h" +#include "privates.h" #include "miscstruct.h" #include "mibstore.h" @@ -698,7 +699,7 @@ extern Bool mfbCloseScreen( extern Bool mfbAllocatePrivates( ScreenPtr /*pScreen*/, - int * /*pGCIndex*/ + DevPrivateKey * /*pGCKey*/ ); extern Bool mfbScreenInit( @@ -883,12 +884,9 @@ typedef struct { typedef mfbPrivGC *mfbPrivGCPtr; #endif -/* XXX these should be static, but it breaks the ABI */ -extern int mfbGCPrivateIndex; /* index into GC private array */ -extern int mfbGetGCPrivateIndex(void); +extern DevPrivateKey mfbGetGCPrivateKey(void); #ifdef PIXMAP_PER_WINDOW -extern int frameWindowPrivateIndex; /* index into Window private array */ -extern int frameGetWindowPrivateIndex(void); +extern DevPrivateKey frameGetWindowPrivateKey(void); #endif #ifndef MFB_PROTOTYPES_ONLY diff --git a/mfb/mfbbitblt.c b/mfb/mfbbitblt.c index 153cf6ac6..344c655ee 100644 --- a/mfb/mfbbitblt.c +++ b/mfb/mfbbitblt.c @@ -397,8 +397,7 @@ int dstx, dsty; * must register a function for n-to-1 copy operations */ -static unsigned long copyPlaneGeneration; -static int copyPlaneScreenIndex = -1; +static DevPrivateKey copyPlaneScreenKey = ©PlaneScreenKey; Bool mfbRegisterCopyPlaneProc (pScreen, proc) @@ -415,14 +414,7 @@ mfbRegisterCopyPlaneProc (pScreen, proc) int /* dsty */, unsigned long /* bitPlane */); { - if (copyPlaneGeneration != serverGeneration) - { - copyPlaneScreenIndex = AllocateScreenPrivateIndex(); - if (copyPlaneScreenIndex < 0) - return FALSE; - copyPlaneGeneration = serverGeneration; - } - pScreen->devPrivates[copyPlaneScreenIndex].fptr = proc; + dixSetPrivate(&pScreen->devPrivates, copyPlaneScreenKey, proc); return TRUE; } @@ -467,10 +459,8 @@ unsigned long plane; if (pSrcDrawable->depth != 1) { - if (copyPlaneScreenIndex >= 0 && - (copyPlane = - pSrcDrawable->pScreen->devPrivates[copyPlaneScreenIndex].fptr) - ) + if ((copyPlane = dixLookupPrivate(&pSrcDrawable->pScreen->devPrivates, + copyPlaneScreenKey))) { return (*copyPlane) (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane); diff --git a/mfb/mfbfillarc.c b/mfb/mfbfillarc.c index 30ec00dc3..cbf47a0eb 100644 --- a/mfb/mfbfillarc.c +++ b/mfb/mfbfillarc.c @@ -289,7 +289,8 @@ mfbPolyFillArcSolid(pDraw, pGC, narcs, parcs) RegionPtr cclip; int rop; - priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); rop = priv->rop; if ((rop == RROP_NOP) || !(pGC->planemask & 1)) return; diff --git a/mfb/mfbfillrct.c b/mfb/mfbfillrct.c index 594c7f01b..a0b3d6716 100644 --- a/mfb/mfbfillrct.c +++ b/mfb/mfbfillrct.c @@ -96,7 +96,8 @@ mfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit) if (!(pGC->planemask & 1)) return; - priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); alu = priv->ropFillArea; pfn = priv->FillArea; ppix = pGC->pRotatedPixmap; diff --git a/mfb/mfbfillsp.c b/mfb/mfbfillsp.c index f83ca6a54..c073535df 100644 --- a/mfb/mfbfillsp.c +++ b/mfb/mfbfillsp.c @@ -624,7 +624,8 @@ mfbTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) if (pGC->fillStyle == FillTiled) rop = pGC->alu; else - rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip; + rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->ropOpStip; flip = 0; switch(rop) @@ -769,7 +770,8 @@ mfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) { pTile = pGC->stipple; tlwidth = pTile->devKind / PGSZB; - rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->ropOpStip; + rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->ropOpStip; } xSrc = pDrawable->x; @@ -926,7 +928,8 @@ mfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) ppt, pwidth, fSorted); pTile = pGC->stipple; - rop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; + rop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop; tlwidth = pTile->devKind / PGSZB; xSrc = pDrawable->x; ySrc = pDrawable->y; diff --git a/mfb/mfbgc.c b/mfb/mfbgc.c index c60e97676..7492d7c04 100644 --- a/mfb/mfbgc.c +++ b/mfb/mfbgc.c @@ -381,7 +381,8 @@ matchCommon ( FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || FONTMINBOUNDS(pGC->font,characterWidth) < 0) return 0; - priv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + priv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); for (i = 0; i < numberCommonOps; i++) { cop = &mfbCommonOps[i]; if ((pGC->fgPixel & 1) != cop->fg) @@ -420,7 +421,8 @@ mfbCreateGC(pGC) /* mfb wants to translate before scan convesion */ pGC->miTranslate = 1; - pPriv = (mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr); + pPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); pPriv->rop = mfbReduceRop(pGC->alu, pGC->fgPixel); pGC->fExpose = TRUE; pGC->pRotatedPixmap = NullPixmap; @@ -508,8 +510,8 @@ mfbValidateGC(pGC, changes, pDrawable) new_rotate = (oldOrg.x != pGC->lastWinOrg.x) || (oldOrg.y != pGC->lastWinOrg.y); - devPriv = ((mfbPrivGCPtr) (pGC->devPrivates[mfbGCPrivateIndex].ptr)); - + devPriv = (mfbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); /* if the client clip is different or moved OR the subwindowMode has changed OR diff --git a/mfb/mfbimggblt.c b/mfb/mfbimggblt.c index c21e82608..cb532cf3b 100644 --- a/mfb/mfbimggblt.c +++ b/mfb/mfbimggblt.c @@ -184,7 +184,8 @@ MFBIMAGEGLYPHBLT(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) but that is usually not a cheap thing to do. */ - pPrivGC = pGC->devPrivates[mfbGCPrivateIndex].ptr; + pPrivGC = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); oldFillArea = pPrivGC->FillArea; if (pGC->bgPixel & 1) diff --git a/mfb/mfbline.c b/mfb/mfbline.c index 863a6187b..65baa5efd 100644 --- a/mfb/mfbline.c +++ b/mfb/mfbline.c @@ -146,7 +146,8 @@ mfbLineSS (pDrawable, pGC, mode, npt, pptInit) return; cclip = pGC->pCompositeClip; - alu = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; + alu = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); @@ -525,7 +526,8 @@ mfbLineSD( pDrawable, pGC, mode, npt, pptInit) return; cclip = pGC->pCompositeClip; - fgrop = ((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop; + fgrop = ((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop; pboxInit = REGION_RECTS(cclip); nboxInit = REGION_NUM_RECTS(cclip); diff --git a/mfb/mfbpixmap.c b/mfb/mfbpixmap.c index 377398534..34bb33d89 100644 --- a/mfb/mfbpixmap.c +++ b/mfb/mfbpixmap.c @@ -115,6 +115,7 @@ mfbDestroyPixmap(pPixmap) { if(--pPixmap->refcnt) return TRUE; + dixFreePrivates(pPixmap->devPrivates); xfree(pPixmap); return TRUE; } diff --git a/mfb/mfbpolypnt.c b/mfb/mfbpolypnt.c index 1c4045126..146cfdce0 100644 --- a/mfb/mfbpolypnt.c +++ b/mfb/mfbpolypnt.c @@ -88,7 +88,8 @@ mfbPolyPoint(pDrawable, pGC, mode, npt, pptInit) if (!(pGC->planemask & 1)) return; - pGCPriv = (mfbPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr; + pGCPriv = (mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()); rop = pGCPriv->rop; mfbGetPixelWidthAndPointer(pDrawable, nlwidth, addrl); diff --git a/mfb/mfbscrinit.c b/mfb/mfbscrinit.c index 6d364b76c..8873a1ba1 100644 --- a/mfb/mfbscrinit.c +++ b/mfb/mfbscrinit.c @@ -68,11 +68,11 @@ SOFTWARE. #include "servermd.h" #ifdef PIXMAP_PER_WINDOW -int frameWindowPrivateIndex; -int frameGetWindowPrivateIndex(void) { return frameWindowPrivateIndex; } +static DevPrivateKey frameWindowPrivateKey = &frameWindowPrivateKey; +DevPrivateKey frameGetWindowPrivateKey(void) { return frameWindowPrivateKey; } #endif -int mfbGCPrivateIndex; -int mfbGetGCPrivateIndex(void) { return mfbGCPrivateIndex; } +static DevPrivateKey mfbGCPrivateKey = &mfbGCPrivateKey; +DevPrivateKey mfbGetGCPrivateKey(void) { return mfbGCPrivateKey; } static unsigned long mfbGeneration = 0; static VisualRec visual = { @@ -88,23 +88,19 @@ static DepthRec depth = { }; Bool -mfbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex) +mfbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey) { if (mfbGeneration != serverGeneration) { -#ifdef PIXMAP_PER_WINDOW - frameWindowPrivateIndex = AllocateWindowPrivateIndex(); -#endif - mfbGCPrivateIndex = miAllocateGCPrivateIndex(); visual.vid = FakeClientID(0); VID = visual.vid; mfbGeneration = serverGeneration; } - if (pGCIndex) - *pGCIndex = mfbGCPrivateIndex; + if (pGCKey) + *pGCKey = mfbGCPrivateKey; pScreen->GetWindowPixmap = mfbGetWindowPixmap; pScreen->SetWindowPixmap = mfbSetWindowPixmap; - return AllocateGCPrivate(pScreen, mfbGCPrivateIndex, sizeof(mfbPrivGC)); + return dixRequestPrivate(mfbGCPrivateKey, sizeof(mfbPrivGC)); } @@ -154,7 +150,8 @@ mfbGetWindowPixmap(pWin) WindowPtr pWin; { #ifdef PIXMAP_PER_WINDOW - return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr); + return (PixmapPtr)dixLookupPrivate(&pWin->devPrivates, + frameWindowPrivateKey); #else ScreenPtr pScreen = pWin->drawable.pScreen; @@ -168,7 +165,7 @@ mfbSetWindowPixmap(pWin, pPix) PixmapPtr pPix; { #ifdef PIXMAP_PER_WINDOW - pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix; + dixSetPrivate(&pWin->devPrivates, frameWindowPrivateKey, pPix); #else (* pWin->drawable.pScreen->SetScreenPixmap)(pPix); #endif diff --git a/mfb/mfbwindow.c b/mfb/mfbwindow.c index 30b8857b1..37125da45 100644 --- a/mfb/mfbwindow.c +++ b/mfb/mfbwindow.c @@ -55,6 +55,7 @@ SOFTWARE. #include <X11/X.h> #include "scrnintstr.h" #include "windowstr.h" +#include "privates.h" #include "mfb.h" #include "mistruct.h" #include "regionstr.h" diff --git a/mfb/mfbzerarc.c b/mfb/mfbzerarc.c index 964e2f100..624e45fee 100644 --- a/mfb/mfbzerarc.c +++ b/mfb/mfbzerarc.c @@ -92,7 +92,8 @@ mfbZeroArcSS( PixelType pmask; register PixelType *paddr; - if (((mfbPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->rop == + if (((mfbPrivGC *)dixLookupPrivate(&pGC->devPrivates, + mfbGetGCPrivateKey()))->rop == RROP_BLACK) pixel = 0; else @@ -55,6 +55,7 @@ SOFTWARE. #include <X11/fonts/font.h> #include "input.h" #include "cursor.h" +#include "privates.h" #define MiBits CARD32 @@ -412,7 +413,7 @@ extern Bool miScreenInit( VisualPtr /*visuals*/ ); -extern int miAllocateGCPrivateIndex( +extern DevPrivateKey miAllocateGCPrivateIndex( void ); diff --git a/mi/mibank.c b/mi/mibank.c index 859770cc2..ea79e9d36 100644 --- a/mi/mibank.c +++ b/mi/mibank.c @@ -175,15 +175,15 @@ typedef struct _miBankQueue #define xalloc_ARRAY(atype, ntype) \ (atype *)xalloc((ntype) * sizeof(atype)) -static int miBankScreenIndex; -static int miBankGCIndex; +static DevPrivateKey miBankScreenKey = &miBankScreenKey; +static DevPrivateKey miBankGCKey = &miBankGCKey; static unsigned long miBankGeneration = 0; -#define BANK_SCRPRIVLVAL pScreen->devPrivates[miBankScreenIndex].ptr +#define BANK_SCRPRIVLVAL dixLookupPrivate(&pScreen->devPrivates, miBankScreenKey) #define BANK_SCRPRIVATE ((miBankScreenPtr)(BANK_SCRPRIVLVAL)) -#define BANK_GCPRIVLVAL(pGC) (pGC)->devPrivates[miBankGCIndex].ptr +#define BANK_GCPRIVLVAL(pGC) dixLookupPrivate(&(pGC)->devPrivates, miBankGCKey) #define BANK_GCPRIVATE(pGC) ((miBankGCPtr)(BANK_GCPRIVLVAL(pGC))) @@ -2047,15 +2047,9 @@ miInitializeBanking( /* Private areas */ if (miBankGeneration != serverGeneration) - { - if (((miBankScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((miBankGCIndex = AllocateGCPrivateIndex()) < 0)) - return FALSE; - miBankGeneration = serverGeneration; - } - if (!AllocateGCPrivate(pScreen, miBankGCIndex, + if (!dixRequestPrivate(miBankGCKey, (nBanks * sizeof(RegionPtr)) + (sizeof(miBankGCRec) - sizeof(RegionPtr)))) return FALSE; @@ -2202,7 +2196,7 @@ miInitializeBanking( SCREEN_WRAP(CreateGC, miBankCreateGC); SCREEN_WRAP(CopyWindow, miBankCopyWindow); - BANK_SCRPRIVLVAL = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miBankScreenKey, pScreenPriv); return TRUE; } diff --git a/mi/midispcur.c b/mi/midispcur.c index 918e401a5..45e0e9abe 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -54,8 +54,7 @@ in this Software without prior written authorization from The Open Group. /* per-screen private data */ -static int miDCScreenIndex; -static unsigned long miDCGeneration = 0; +static DevPrivateKey miDCScreenKey = &miDCScreenKey; static Bool miDCCloseScreen(int index, ScreenPtr pScreen); @@ -117,13 +116,6 @@ miDCInitialize (pScreen, screenFuncs) { miDCScreenPtr pScreenPriv; - if (miDCGeneration != serverGeneration) - { - miDCScreenIndex = AllocateScreenPrivateIndex (); - if (miDCScreenIndex < 0) - return FALSE; - miDCGeneration = serverGeneration; - } pScreenPriv = (miDCScreenPtr) xalloc (sizeof (miDCScreenRec)); if (!pScreenPriv) return FALSE; @@ -149,7 +141,7 @@ miDCInitialize (pScreen, screenFuncs) pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miDCCloseScreen; - pScreen->devPrivates[miDCScreenIndex].ptr = (pointer) pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv); if (!miSpriteInitialize (pScreen, &miDCFuncs, screenFuncs)) { @@ -170,7 +162,8 @@ miDCCloseScreen (index, pScreen) { miDCScreenPtr pScreenPriv; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; tossGC (pScreenPriv->pSourceGC); tossGC (pScreenPriv->pMaskGC); @@ -194,7 +187,7 @@ miDCRealizeCursor (pScreen, pCursor) CursorPtr pCursor; { if (pCursor->bits->refcnt <= 1) - pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL); return TRUE; } @@ -295,7 +288,7 @@ miDCRealize ( xfree ((pointer) pPriv); return (miDCCursorPtr)NULL; } - pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv); return pPriv; } pPriv->pPicture = 0; @@ -313,7 +306,7 @@ miDCRealize ( xfree ((pointer) pPriv); return (miDCCursorPtr)NULL; } - pCursor->bits->devPriv[pScreen->myNum] = (pointer) pPriv; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv); /* create the two sets of bits, clipping as appropriate */ @@ -359,7 +352,8 @@ miDCUnrealizeCursor (pScreen, pCursor) { miDCCursorPtr pPriv; - pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; + pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, + pScreen); if (pPriv && (pCursor->bits->refcnt <= 1)) { if (pPriv->sourceBits) @@ -371,7 +365,7 @@ miDCUnrealizeCursor (pScreen, pCursor) FreePicture (pPriv->pPicture, 0); #endif xfree ((pointer) pPriv); - pCursor->bits->devPriv[pScreen->myNum] = (pointer)NULL; + dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL); } return TRUE; } @@ -448,7 +442,8 @@ miDCMakeGC( gcvals[0] = IncludeInferiors; gcvals[1] = FALSE; pGC = CreateGC((DrawablePtr)pWin, - GCSubwindowMode|GCGraphicsExposures, gcvals, &status); + GCSubwindowMode|GCGraphicsExposures, gcvals, &status, + (XID)0, serverClient); *ppGC = pGC; return pGC; } @@ -465,14 +460,16 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask) miDCCursorPtr pPriv; WindowPtr pWin; - pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; + pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, + pScreen); if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pWin = WindowTable[pScreen->myNum]; #ifdef ARGB_CURSOR if (pPriv->pPicture) @@ -517,7 +514,8 @@ miDCSaveUnderCursor (pScreen, x, y, w, h) WindowPtr pWin; GCPtr pGC; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) @@ -549,7 +547,8 @@ miDCRestoreUnderCursor (pScreen, x, y, w, h) WindowPtr pWin; GCPtr pGC; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; if (!pSave) @@ -575,7 +574,8 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy) GCPtr pGC; int sourcex, sourcey, destx, desty, copyw, copyh; - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pSave = pScreenPriv->pSave; pWin = WindowTable[pScreen->myNum]; /* @@ -711,14 +711,16 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) XID gcval = FALSE; PixmapPtr pTemp; - pPriv = (miDCCursorPtr) pCursor->bits->devPriv[pScreen->myNum]; + pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, + pScreen); if (!pPriv) { pPriv = miDCRealize(pScreen, pCursor); if (!pPriv) return FALSE; } - pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; + pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miDCScreenKey); pWin = WindowTable[pScreen->myNum]; pTemp = pScreenPriv->pTemp; if (!pTemp || @@ -742,7 +744,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) if (!pScreenPriv->pMoveGC) { pScreenPriv->pMoveGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); + GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); if (!pScreenPriv->pMoveGC) return FALSE; } @@ -778,14 +780,14 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) if (!pScreenPriv->pPixSourceGC) { pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); + GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); if (!pScreenPriv->pPixSourceGC) return FALSE; } if (!pScreenPriv->pPixMaskGC) { pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp, - GCGraphicsExposures, &gcval, &status); + GCGraphicsExposures, &gcval, &status, (XID)0, serverClient); if (!pScreenPriv->pPixMaskGC) return FALSE; } @@ -122,16 +122,18 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e) * motion event they need to be attached to. Sigh. */ if (e->u.u.type == DeviceValuator) { if (laste->nevents > 6) { - ErrorF("mieqEnqueue: more than six valuator events; dropping.\n"); + ErrorF("[mi] mieqEnqueue: more than six valuator events; dropping.\n"); return; } if (oldtail == miEventQueue.head || !(lastkbp->type == DeviceMotionNotify || lastkbp->type == DeviceButtonPress || - lastkbp->type == DeviceButtonRelease) || + lastkbp->type == DeviceButtonRelease || + lastkbp->type == ProximityIn || + lastkbp->type == ProximityOut) || ((lastkbp->deviceid & DEVICE_BITS) != (v->deviceid & DEVICE_BITS))) { - ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n"); + ErrorF("[mi] mieqEnequeue: out-of-order valuator event; dropping.\n"); return; } memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent)); @@ -143,12 +145,13 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e) oldtail = (oldtail - 1) % QUEUE_SIZE; } else { - newtail = (oldtail + 1) % QUEUE_SIZE; - /* Toss events which come in late. Usually this means your server's + newtail = (oldtail + 1) % QUEUE_SIZE; + /* Toss events which come in late. Usually this means your server's * stuck in an infinite loop somewhere, but SIGIO is still getting * handled. */ - if (newtail == miEventQueue.head) { - ErrorF("tossed event which came in late\n"); + if (newtail == miEventQueue.head) { + ErrorF("[mi] EQ overflowing. The server is probably stuck " + "in an infinite loop.\n"); return; } miEventQueue.tail = newtail; @@ -200,13 +203,13 @@ mieqProcessInputEvents(void) while (miEventQueue.head != miEventQueue.tail) { if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); + dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); #ifdef DPMSExtension else if (DPMSPowerLevel != DPMSModeOn) SetScreenSaverTimer(); if (DPMSPowerLevel != DPMSModeOn) - DPMSSet(DPMSModeOn); + DPMSSet(serverClient, DPMSModeOn); #endif e = &miEventQueue.events[miEventQueue.head]; diff --git a/mi/miinitext.c b/mi/miinitext.c index 497a15d2f..cc98bd8f6 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -206,6 +206,9 @@ extern Bool noXkbExtension; #ifdef PANORAMIX extern Bool noPanoramiXExtension; #endif +#ifdef INXQUARTZ +extern Bool noPseudoramiXExtension; +#endif #ifdef XINPUT extern Bool noXInputExtension; #endif @@ -241,13 +244,13 @@ typedef void (*InitExtension)(INITARGS); #define _XAG_SERVER_ #include <X11/extensions/Xagstr.h> #endif -#ifdef XACE -#include "xace.h" -#endif #ifdef XCSECURITY #include "securitysrv.h" #include <X11/extensions/securstr.h> #endif +#ifdef XSELINUX +#include "xselinux.h" +#endif #ifdef PANORAMIX #include <X11/extensions/panoramiXproto.h> #endif @@ -271,6 +274,9 @@ extern void MultibufferExtensionInit(INITARGS); #ifdef PANORAMIX extern void PanoramiXExtensionInit(INITARGS); #endif +#ifdef INXQUARTZ +extern void PseudoramiXExtensionInit(INITARGS); +#endif #ifdef XINPUT extern void XInputExtensionInit(INITARGS); #endif @@ -314,13 +320,12 @@ extern void DbeExtensionInit(INITARGS); #ifdef XAPPGROUP extern void XagExtensionInit(INITARGS); #endif -#ifdef XACE -extern void XaceExtensionInit(INITARGS); -#endif #ifdef XCSECURITY -extern void SecurityExtensionSetup(INITARGS); extern void SecurityExtensionInit(INITARGS); #endif +#ifdef XSELINUX +extern void SELinuxExtensionInit(INITARGS); +#endif #ifdef XPRINT extern void XpExtensionInit(INITARGS); #endif @@ -523,14 +528,14 @@ InitExtensions(argc, argv) int argc; char *argv[]; { -#ifdef XCSECURITY - SecurityExtensionSetup(); -#endif #ifdef PANORAMIX # if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX) if (!noPanoramiXExtension) PanoramiXExtensionInit(); # endif #endif +#ifdef INXQUARTZ + if(!noPseudoramiXExtension) PseudoramiXExtensionInit(); +#endif #ifdef SHAPE if (!noShapeExtension) ShapeExtensionInit(); #endif @@ -588,12 +593,12 @@ InitExtensions(argc, argv) #ifdef XAPPGROUP if (!noXagExtension) XagExtensionInit(); #endif -#ifdef XACE - XaceExtensionInit(); -#endif #ifdef XCSECURITY if (!noSecurityExtension) SecurityExtensionInit(); #endif +#ifdef XSELINUX + SELinuxExtensionInit(); +#endif #ifdef XPRINT XpExtensionInit(); /* server-specific extension, cannot be disabled */ #endif @@ -682,11 +687,8 @@ static ExtensionModule staticExtensions[] = { #ifdef XAPPGROUP { XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL }, #endif -#ifdef XACE - { XaceExtensionInit, XACE_EXTENSION_NAME, NULL, NULL, NULL }, -#endif #ifdef XCSECURITY - { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, SecurityExtensionSetup, NULL }, + { SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL }, #endif #ifdef XPRINT { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL }, @@ -737,16 +739,6 @@ InitExtensions(argc, argv) /* Sort the extensions according the init dependencies. */ LoaderSortExtensions(); listInitialised = TRUE; - } else { - /* Call the setup functions on subsequent server resets as well */ - for (i = 0; ExtensionModuleList[i].name != NULL; i++) { - ext = &ExtensionModuleList[i]; - if (ext->setupFunc != NULL && - (ext->disablePtr == NULL || - (ext->disablePtr != NULL && !*ext->disablePtr))) { - (ext->setupFunc)(); - } - } } for (i = 0; ExtensionModuleList[i].name != NULL; i++) { diff --git a/mi/miline.h b/mi/miline.h index b97b8cf9d..036c2b5df 100644 --- a/mi/miline.h +++ b/mi/miline.h @@ -28,6 +28,7 @@ in this Software without prior written authorization from The Open Group. #ifndef MILINE_H #include "screenint.h" +#include "privates.h" /* * Public definitions used for configuring basic pixelization aspects @@ -119,9 +120,8 @@ extern void miSetZeroLineBias( t = y1; y1 = y2; y2 = t;\ } -#define miGetZeroLineBias(_pScreen) \ - ((miZeroLineScreenIndex < 0) ? \ - 0 : ((_pScreen)->devPrivates[miZeroLineScreenIndex].uval)) +#define miGetZeroLineBias(_pScreen) ((unsigned long) \ + dixLookupPrivate(&(_pScreen)->devPrivates, miZeroLineScreenKey)) #define CalcLineDeltas(_x1,_y1,_x2,_y2,_adx,_ady,_sx,_sy,_SX,_SY,_octant) \ (_octant) = 0; \ @@ -148,7 +148,7 @@ extern void miSetZeroLineBias( #define IsXDecreasingOctant(_octant) ((_octant) & XDECREASING) #define IsYDecreasingOctant(_octant) ((_octant) & YDECREASING) -extern int miZeroLineScreenIndex; +extern DevPrivateKey miZeroLineScreenKey; extern int miZeroClipLine( int /*xmin*/, diff --git a/mi/mioverlay.c b/mi/mioverlay.c index 1dd28b85b..a0adac54d 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -10,6 +10,7 @@ #include "mi.h" #include "gcstruct.h" #include "regionstr.h" +#include "privates.h" #include "mivalidate.h" #include "mioverlay.h" #include "migc.h" @@ -53,9 +54,8 @@ typedef struct { Bool copyUnderlay; } miOverlayScreenRec, *miOverlayScreenPtr; -static unsigned long miOverlayGeneration = 0; -static int miOverlayWindowIndex = -1; -static int miOverlayScreenIndex = -1; +static DevPrivateKey miOverlayWindowKey = &miOverlayWindowKey; +static DevPrivateKey miOverlayScreenKey = &miOverlayScreenKey; static void RebuildTree(WindowPtr); static Bool HasUnderlayChildren(WindowPtr); @@ -85,10 +85,10 @@ static void miOverlaySetShape(WindowPtr); #endif static void miOverlayChangeBorderWidth(WindowPtr, unsigned int); -#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) \ - ((miOverlayScreenPtr)((pScreen)->devPrivates[miOverlayScreenIndex].ptr)) -#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) \ - ((miOverlayWindowPtr)((pWin)->devPrivates[miOverlayWindowIndex].ptr)) +#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, miOverlayScreenKey)) +#define MIOVERLAY_GET_WINDOW_PRIVATE(pWin) ((miOverlayWindowPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, miOverlayWindowKey)) #define MIOVERLAY_GET_WINDOW_TREE(pWin) \ (MIOVERLAY_GET_WINDOW_PRIVATE(pWin)->tree) @@ -112,22 +112,13 @@ miInitOverlay( if(!inOverlayFunc || !transFunc) return FALSE; - if(miOverlayGeneration != serverGeneration) { - if(((miOverlayScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((miOverlayWindowIndex = AllocateWindowPrivateIndex()) < 0)) - return FALSE; - - miOverlayGeneration = serverGeneration; - } - - if(!AllocateWindowPrivate(pScreen, miOverlayWindowIndex, - sizeof(miOverlayWindowRec))) + if(!dixRequestPrivate(miOverlayWindowKey, sizeof(miOverlayWindowRec))) return FALSE; if(!(pScreenPriv = xalloc(sizeof(miOverlayScreenRec)))) return FALSE; - pScreen->devPrivates[miOverlayScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv); pScreenPriv->InOverlay = inOverlayFunc; pScreenPriv->MakeTransparent = transFunc; diff --git a/mi/mipointer.c b/mi/mipointer.c index 24ff4cc53..b55e68bf0 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -41,10 +41,10 @@ in this Software without prior written authorization from The Open Group. # include "dixstruct.h" # include "inputstr.h" -_X_EXPORT int miPointerScreenIndex; -static unsigned long miPointerGeneration = 0; +_X_EXPORT DevPrivateKey miPointerScreenKey = &miPointerScreenKey; -#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr)) +#define GetScreenPrivate(s) ((miPointerScreenPtr) \ + dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey)) #define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s) /* @@ -76,13 +76,6 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) { miPointerScreenPtr pScreenPriv; - if (miPointerGeneration != serverGeneration) - { - miPointerScreenIndex = AllocateScreenPrivateIndex(); - if (miPointerScreenIndex < 0) - return FALSE; - miPointerGeneration = serverGeneration; - } pScreenPriv = (miPointerScreenPtr) xalloc (sizeof (miPointerScreenRec)); if (!pScreenPriv) return FALSE; @@ -99,7 +92,7 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate) pScreenPriv->showTransparent = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = miPointerCloseScreen; - pScreen->devPrivates[miPointerScreenIndex].ptr = (pointer) pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv); /* * set up screen cursor method table */ @@ -238,10 +231,14 @@ miPointerWarpCursor (pScreen, x, y) ScreenPtr pScreen; int x, y; { + BOOL changedScreen = FALSE; SetupScreen (pScreen); if (miPointer.pScreen != pScreen) + { (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, TRUE); + changedScreen = TRUE; + } if (GenerateEvent) { @@ -262,7 +259,9 @@ miPointerWarpCursor (pScreen, x, y) miPointer.y = y; miPointer.pScreen = pScreen; } - UpdateSpriteForScreen (pScreen) ; + + if (changedScreen) + UpdateSpriteForScreen (pScreen) ; } /* diff --git a/mi/mipointer.h b/mi/mipointer.h index 1bce42c26..e864fddf4 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -28,6 +28,7 @@ in this Software without prior written authorization from The Open Group. #include "cursor.h" #include "input.h" +#include "privates.h" typedef struct _miPointerSpriteFuncRec { Bool (*RealizeCursor)( @@ -166,6 +167,6 @@ extern void miPointerSetPosition( extern void miPointerUpdateSprite( DeviceIntPtr pDev); -extern int miPointerScreenIndex; +extern DevPrivateKey miPointerScreenKey; #endif /* MIPOINTER_H */ diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 7a9014aa8..7ca5f5df1 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -293,35 +293,22 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, return miScreenDevPrivateInit(pScreen, width, pbits); } -_X_EXPORT int +static DevPrivateKey privateKey = &privateKey; + +_X_EXPORT DevPrivateKey miAllocateGCPrivateIndex() { - static int privateIndex = -1; - static unsigned long miGeneration = 0; - - if (miGeneration != serverGeneration) - { - privateIndex = AllocateGCPrivateIndex(); - miGeneration = serverGeneration; - } - return privateIndex; + return privateKey; } -_X_EXPORT int miZeroLineScreenIndex; -static unsigned int miZeroLineGeneration = 0; +_X_EXPORT DevPrivateKey miZeroLineScreenKey = &miZeroLineScreenKey; _X_EXPORT void miSetZeroLineBias(pScreen, bias) ScreenPtr pScreen; unsigned int bias; { - if (miZeroLineGeneration != serverGeneration) - { - miZeroLineScreenIndex = AllocateScreenPrivateIndex(); - miZeroLineGeneration = serverGeneration; - } - if (miZeroLineScreenIndex >= 0) - pScreen->devPrivates[miZeroLineScreenIndex].uval = bias; + dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey, (pointer)bias); } _X_EXPORT PixmapPtr diff --git a/mi/misprite.c b/mi/misprite.c index 0b402fa59..0af3368b6 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -67,8 +67,7 @@ in this Software without prior written authorization from The Open Group. * screen wrappers */ -static int miSpriteScreenIndex; -static unsigned long miSpriteGeneration = 0; +static DevPrivateKey miSpriteScreenKey = &miSpriteScreenKey; static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen); static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, @@ -91,10 +90,9 @@ static void miSpriteStoreColors(ColormapPtr pMap, int ndef, static void miSpriteComputeSaved(ScreenPtr pScreen); -#define SCREEN_PROLOGUE(pScreen, field)\ - ((pScreen)->field = \ - ((miSpriteScreenPtr) (pScreen)->devPrivates[miSpriteScreenIndex].ptr)->field) - +#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \ + ((miSpriteScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ + miSpriteScreenKey))->field) #define SCREEN_EPILOGUE(pScreen, field)\ ((pScreen)->field = miSprite##field) @@ -128,8 +126,8 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) ScreenPtr pScreen = closure; miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); if (pScreenPriv->isUp && RECT_IN_REGION (pScreen, pRegion, &pScreenPriv->saved) != rgnOUT) { @@ -156,14 +154,6 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs) if (!DamageSetup (pScreen)) return FALSE; - if (miSpriteGeneration != serverGeneration) - { - miSpriteScreenIndex = AllocateScreenPrivateIndex (); - if (miSpriteScreenIndex < 0) - return FALSE; - miSpriteGeneration = serverGeneration; - } - pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec)); if (!pScreenPriv) return FALSE; @@ -214,7 +204,7 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs) pScreenPriv->colors[MASK_COLOR].red = 0; pScreenPriv->colors[MASK_COLOR].green = 0; pScreenPriv->colors[MASK_COLOR].blue = 0; - pScreen->devPrivates[miSpriteScreenIndex].ptr = (pointer) pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv); pScreen->CloseScreen = miSpriteCloseScreen; pScreen->GetImage = miSpriteGetImage; @@ -247,8 +237,8 @@ miSpriteCloseScreen (i, pScreen) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; @@ -278,8 +268,8 @@ miSpriteGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine) SCREEN_PROLOGUE (pScreen, GetImage); - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp && ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, sx, sy, w, h)) @@ -308,8 +298,8 @@ miSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart) SCREEN_PROLOGUE (pScreen, GetSpans); - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp) { DDXPointPtr pts; @@ -350,8 +340,8 @@ miSpriteSourceValidate (pDrawable, x, y, width, height) SCREEN_PROLOGUE (pScreen, SourceValidate); - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp && ORG_OVERLAP(&pScreenPriv->saved, pDrawable->x, pDrawable->y, x, y, width, height)) @@ -374,7 +364,8 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) SCREEN_PROLOGUE (pScreen, CopyWindow); - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); /* * Damage will take care of destination check */ @@ -399,8 +390,8 @@ miSpriteBlockHandler (i, blockData, pTimeout, pReadmask) ScreenPtr pScreen = screenInfo.screens[i]; miSpriteScreenPtr pPriv; - pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, BlockHandler); (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); @@ -421,8 +412,8 @@ miSpriteInstallColormap (pMap) ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv; - pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, InstallColormap); (*pScreen->InstallColormap) (pMap); @@ -450,8 +441,8 @@ miSpriteStoreColors (pMap, ndef, pdef) int updated; VisualPtr pVisual; - pPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; - + pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, StoreColors); (*pScreen->StoreColors) (pMap, ndef, pdef); @@ -518,7 +509,7 @@ static void miSpriteFindColors (ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr) - pScreen->devPrivates[miSpriteScreenIndex].ptr; + dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); CursorPtr pCursor; xColorItem *sourceColor, *maskColor; @@ -562,7 +553,8 @@ miSpriteRealizeCursor (pScreen, pCursor) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); if (pCursor == pScreenPriv->pCursor) pScreenPriv->checkPixels = TRUE; return (*pScreenPriv->funcs->RealizeCursor) (pScreen, pCursor); @@ -575,7 +567,8 @@ miSpriteUnrealizeCursor (pScreen, pCursor) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); return (*pScreenPriv->funcs->UnrealizeCursor) (pScreen, pCursor); } @@ -588,7 +581,8 @@ miSpriteSetCursor (pScreen, pCursor, x, y) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); if (!pCursor) { pScreenPriv->shouldBeUp = FALSE; @@ -688,7 +682,8 @@ miSpriteMoveCursor (pScreen, x, y) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); miSpriteSetCursor (pScreen, pScreenPriv->pCursor, x, y); } @@ -703,7 +698,8 @@ miSpriteRemoveCursor (pScreen) miSpriteScreenPtr pScreenPriv; DamageDrawInternal (pScreen, TRUE); - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); miSpriteIsUpFALSE (pScreen, pScreenPriv); pScreenPriv->pCacheWin = NullWindow; if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pScreen, @@ -732,7 +728,8 @@ miSpriteRestoreCursor (pScreen) DamageDrawInternal (pScreen, TRUE); miSpriteComputeSaved (pScreen); - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); pCursor = pScreenPriv->pCursor; x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; @@ -767,7 +764,8 @@ miSpriteComputeSaved (pScreen) int wpad, hpad; CursorPtr pCursor; - pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr; + pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); pCursor = pScreenPriv->pCursor; x = pScreenPriv->x - (int)pCursor->bits->xhot; y = pScreenPriv->y - (int)pCursor->bits->yhot; diff --git a/miext/cw/cw.c b/miext/cw/cw.c index bd49f3f0d..efb046948 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -43,13 +43,12 @@ #define CW_ASSERT(x) do {} while (0) #endif -int cwGCIndex; -int cwScreenIndex; -int cwWindowIndex; +DevPrivateKey cwGCKey = &cwGCKey; +DevPrivateKey cwScreenKey = &cwScreenKey; +DevPrivateKey cwWindowKey = &cwWindowKey; #ifdef RENDER -int cwPictureIndex; +DevPrivateKey cwPictureKey = &cwPictureKey; #endif -static unsigned long cwGeneration = 0; extern GCOps cwGCOps; static Bool @@ -123,7 +122,7 @@ cwCreateBackingGC(GCPtr pGC, DrawablePtr pDrawable) pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off); pPriv->pBackingGC = CreateGC(pBackingDrawable, GCGraphicsExposures, - &noexpose, &status); + &noexpose, &status, (XID)0, serverClient); if (status != Success) return FALSE; @@ -237,7 +236,7 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable) static void cwChangeGC(GCPtr pGC, unsigned long mask) { - cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; + cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey); FUNC_PROLOGUE(pGC, pPriv); @@ -249,7 +248,7 @@ cwChangeGC(GCPtr pGC, unsigned long mask) static void cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) { - cwGCPtr pPriv = (cwGCPtr)(pGCDst)->devPrivates[cwGCIndex].ptr; + cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGCDst->devPrivates, cwGCKey); FUNC_PROLOGUE(pGCDst, pPriv); @@ -261,7 +260,7 @@ cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) static void cwDestroyGC(GCPtr pGC) { - cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; + cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey); FUNC_PROLOGUE(pGC, pPriv); @@ -275,7 +274,7 @@ cwDestroyGC(GCPtr pGC) static void cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) { - cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; + cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey); FUNC_PROLOGUE(pGC, pPriv); @@ -287,7 +286,7 @@ cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) static void cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc) { - cwGCPtr pPriv = (cwGCPtr)(pgcDst)->devPrivates[cwGCIndex].ptr; + cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pgcDst->devPrivates, cwGCKey); FUNC_PROLOGUE(pgcDst, pPriv); @@ -299,7 +298,7 @@ cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc) static void cwDestroyClip(GCPtr pGC) { - cwGCPtr pPriv = (cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr; + cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey); FUNC_PROLOGUE(pGC, pPriv); @@ -478,34 +477,14 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) Bool has_render = GetPictureScreenIfSet(pScreen) != NULL; #endif - if (cwGeneration != serverGeneration) - { - cwScreenIndex = AllocateScreenPrivateIndex(); - if (cwScreenIndex < 0) - return; - cwGCIndex = AllocateGCPrivateIndex(); - cwWindowIndex = AllocateWindowPrivateIndex(); -#ifdef RENDER - if (has_render) - cwPictureIndex = AllocatePicturePrivateIndex(); -#endif - cwGeneration = serverGeneration; - } - if (!AllocateGCPrivate(pScreen, cwGCIndex, sizeof(cwGCRec))) - return; - if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0)) + if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec))) return; -#ifdef RENDER - if (has_render) { - if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0)) - return; - } -#endif + pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec)); if (!pScreenPriv) return; - pScreen->devPrivates[cwScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, cwScreenKey, pScreenPriv); SCREEN_EPILOGUE(pScreen, CloseScreen, cwCloseScreen); SCREEN_EPILOGUE(pScreen, GetImage, cwGetImage); @@ -530,8 +509,8 @@ cwCloseScreen (int i, ScreenPtr pScreen) PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif - pScreenPriv = (cwScreenPtr)pScreen->devPrivates[cwScreenIndex].ptr; - + pScreenPriv = (cwScreenPtr)dixLookupPrivate(&pScreen->devPrivates, + cwScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; diff --git a/miext/cw/cw.h b/miext/cw/cw.h index a83949dc9..145f3492c 100644 --- a/miext/cw/cw.h +++ b/miext/cw/cw.h @@ -26,6 +26,7 @@ #include "gcstruct.h" #include "picturestr.h" +#include "privates.h" /* * One of these structures is allocated per GC that gets used with a window with @@ -43,10 +44,10 @@ typedef struct { GCFuncs *wrapFuncs; /* wrapped funcs */ } cwGCRec, *cwGCPtr; -extern int cwGCIndex; +extern DevPrivateKey cwGCKey; -#define getCwGC(pGC) ((cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr) -#define setCwGC(pGC,p) ((pGC)->devPrivates[cwGCIndex].ptr = (pointer) (p)) +#define getCwGC(pGC) ((cwGCPtr)dixLookupPrivate(&(pGC)->devPrivates, cwGCKey)) +#define setCwGC(pGC,p) dixSetPrivate(&(pGC)->devPrivates, cwGCKey, p) /* * One of these structures is allocated per Picture that gets used with a @@ -59,17 +60,17 @@ typedef struct { unsigned long stateChanges; } cwPictureRec, *cwPicturePtr; -#define getCwPicture(pPicture) \ - (pPicture->pDrawable ? (cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr : 0) -#define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (pointer) (p)) +#define getCwPicture(pPicture) (pPicture->pDrawable ? \ + (cwPicturePtr)dixLookupPrivate(&(pPicture)->devPrivates, cwPictureKey) : 0) +#define setCwPicture(pPicture,p) dixSetPrivate(&(pPicture)->devPrivates, cwPictureKey, p) -extern int cwPictureIndex; +extern DevPrivateKey cwPictureKey; +extern DevPrivateKey cwWindowKey; -extern int cwWindowIndex; - -#define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr) +#define cwWindowPrivate(pWin) dixLookupPrivate(&(pWin)->devPrivates, cwWindowKey) #define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow)) -#define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (pointer) (pPixmap)) +#define setCwPixmap(pWindow,pPixmap) \ + dixSetPrivate(&(pWindow)->devPrivates, cwWindowKey, pPixmap) #define cwDrawableIsRedirWindow(pDraw) \ ((pDraw)->type == DRAWABLE_WINDOW && \ @@ -109,10 +110,10 @@ typedef struct { #endif } cwScreenRec, *cwScreenPtr; -extern int cwScreenIndex; +extern DevPrivateKey cwScreenKey; -#define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr) -#define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p)) +#define getCwScreen(pScreen) ((cwScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, cwScreenKey)) +#define setCwScreen(pScreen,p) dixSetPrivate(&(pScreen)->devPrivates, cwScreenKey, p) #define CW_OFFSET_XYPOINTS(ppt, npt) do { \ DDXPointPtr _ppt = (DDXPointPtr)(ppt); \ diff --git a/miext/damage/damage.c b/miext/damage/damage.c index 8f1e3b741..56864c56d 100755 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -65,16 +65,15 @@ #define DAMAGE_DEBUG(x) #endif -#define getPixmapDamageRef(pPixmap) \ - ((DamagePtr *) &(pPixmap->devPrivates[damagePixPrivateIndex].ptr)) +#define getPixmapDamageRef(pPixmap) ((DamagePtr *) \ + dixLookupPrivateAddr(&(pPixmap)->devPrivates, damagePixPrivateKey)) #define pixmapDamage(pPixmap) damagePixPriv(pPixmap) -static int damageScrPrivateIndex; -static int damagePixPrivateIndex; -static int damageGCPrivateIndex; -static int damageWinPrivateIndex; -static int damageGeneration; +static DevPrivateKey damageScrPrivateKey = &damageScrPrivateKey; +static DevPrivateKey damagePixPrivateKey = &damagePixPrivateKey; +static DevPrivateKey damageGCPrivateKey = &damageGCPrivateKey; +static DevPrivateKey damageWinPrivateKey = &damageWinPrivateKey; static DamagePtr * getDrawableDamageRef (DrawablePtr pDrawable) @@ -115,7 +114,7 @@ getDrawableDamageRef (DrawablePtr pDrawable) #define winDamageRef(pWindow) \ DamagePtr *pPrev = (DamagePtr *) \ - &(pWindow->devPrivates[damageWinPrivateIndex].ptr) + dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey) static void DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion) @@ -1745,30 +1744,10 @@ DamageSetup (ScreenPtr pScreen) PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif - if (damageGeneration != serverGeneration) - { - damageScrPrivateIndex = AllocateScreenPrivateIndex (); - if (damageScrPrivateIndex == -1) - return FALSE; - damageGCPrivateIndex = AllocateGCPrivateIndex (); - if (damageGCPrivateIndex == -1) - return FALSE; - damagePixPrivateIndex = AllocatePixmapPrivateIndex (); - if (damagePixPrivateIndex == -1) - return FALSE; - damageWinPrivateIndex = AllocateWindowPrivateIndex (); - if (damageWinPrivateIndex == -1) - return FALSE; - damageGeneration = serverGeneration; - } - if (pScreen->devPrivates[damageScrPrivateIndex].ptr) + if (dixLookupPrivate(&pScreen->devPrivates, damageScrPrivateKey)) return TRUE; - if (!AllocateGCPrivate (pScreen, damageGCPrivateIndex, sizeof (DamageGCPrivRec))) - return FALSE; - if (!AllocatePixmapPrivate (pScreen, damagePixPrivateIndex, 0)) - return FALSE; - if (!AllocateWindowPrivate (pScreen, damageWinPrivateIndex, 0)) + if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec))) return FALSE; pScrPriv = (DamageScrPrivPtr) xalloc (sizeof (DamageScrPrivRec)); @@ -1791,7 +1770,7 @@ DamageSetup (ScreenPtr pScreen) } #endif - pScreen->devPrivates[damageScrPrivateIndex].ptr = (pointer) pScrPriv; + dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, pScrPriv); return TRUE; } diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h index e603f02a4..2f6d53844 100755 --- a/miext/damage/damagestr.h +++ b/miext/damage/damagestr.h @@ -29,6 +29,7 @@ #include "damage.h" #include "gcstruct.h" +#include "privates.h" #ifdef RENDER # include "picturestr.h" #endif @@ -78,31 +79,31 @@ typedef struct _damageGCPriv { } DamageGCPrivRec, *DamageGCPrivPtr; /* XXX should move these into damage.c, damageScrPrivateIndex is static */ -#define damageGetScrPriv(pScr) \ - ((DamageScrPrivPtr) (pScr)->devPrivates[damageScrPrivateIndex].ptr) +#define damageGetScrPriv(pScr) ((DamageScrPrivPtr) \ + dixLookupPrivate(&(pScr)->devPrivates, damageScrPrivateKey)) #define damageScrPriv(pScr) \ DamageScrPrivPtr pScrPriv = damageGetScrPriv(pScr) #define damageGetPixPriv(pPix) \ - ((DamagePtr) (pPix)->devPrivates[damagePixPrivateIndex].ptr) + dixLookupPrivate(&(pPix)->devPrivates, damagePixPrivateKey) #define damgeSetPixPriv(pPix,v) \ - ((pPix)->devPrivates[damagePixPrivateIndex].ptr = (pointer ) (v)) + dixSetPrivate(&(pPix)->devPrivates, damagePixPrivateKey, v) #define damagePixPriv(pPix) \ DamagePtr pDamage = damageGetPixPriv(pPix) #define damageGetGCPriv(pGC) \ - ((DamageGCPrivPtr) (pGC)->devPrivates[damageGCPrivateIndex].ptr) + dixLookupPrivate(&(pGC)->devPrivates, damageGCPrivateKey) #define damageGCPriv(pGC) \ DamageGCPrivPtr pGCPriv = damageGetGCPriv(pGC) #define damageGetWinPriv(pWin) \ - ((DamagePtr) (pWin)->devPrivates[damageWinPrivateIndex].ptr) + ((DamagePtr)dixLookupPrivate(&(pWin)->devPrivates, damageWinPrivateKey)) #define damageSetWinPriv(pWin,d) \ - ((pWin)->devPrivates[damageWinPrivateIndex].ptr = (d)) + dixSetPrivate(&(pWin)->devPrivates, damageWinPrivateKey, d) #endif /* _DAMAGESTR_H_ */ diff --git a/miext/rootless/accel/rlAccel.c b/miext/rootless/accel/rlAccel.c index d62bee740..f3cb21569 100644 --- a/miext/rootless/accel/rlAccel.c +++ b/miext/rootless/accel/rlAccel.c @@ -46,10 +46,13 @@ typedef struct _rlAccelScreenRec { CloseScreenProcPtr CloseScreen; } rlAccelScreenRec, *rlAccelScreenPtr; -static int rlAccelScreenPrivateIndex = -1; +static DevPrivateKey rlAccelScreenPrivateKey = &rlAccelScreenPrivateKey; -#define RLACCELREC(pScreen) \ - ((rlAccelScreenRec *)(pScreen)->devPrivates[rlAccelScreenPrivateIndex].ptr) +#define RLACCELREC(pScreen) ((rlAccelScreenRec *) \ + dixLookupPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey)) + +#define SETRLACCELREC(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, rlAccelScreenPrivateKey, v) /* This is mostly identical to fbGCOps. */ static GCOps rlAccelOps = { @@ -128,18 +131,11 @@ rlCloseScreen (int iScreen, ScreenPtr pScreen) Bool RootlessAccelInit(ScreenPtr pScreen) { - static unsigned long rlAccelGeneration = 0; rlAccelScreenRec *s; - if (rlAccelGeneration != serverGeneration) { - rlAccelScreenPrivateIndex = AllocateScreenPrivateIndex(); - if (rlAccelScreenPrivateIndex == -1) return FALSE; - rlAccelGeneration = serverGeneration; - } - s = xalloc(sizeof(rlAccelScreenRec)); if (!s) return FALSE; - RLACCELREC(pScreen) = s; + SETRLACCELREC(pScreen, s); // Wrap the screen functions we need s->CreateGC = pScreen->CreateGC; diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c index 562f65577..97c92d309 100644 --- a/miext/rootless/rootlessCommon.c +++ b/miext/rootless/rootlessCommon.c @@ -179,7 +179,7 @@ void RootlessStartDrawing(WindowPtr pWindow) } else { - PixmapPtr oldPixmap = pWindow->devPrivates[rootlessWindowOldPixmapPrivateIndex].ptr; + PixmapPtr oldPixmap = dixLookupPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey); if (oldPixmap != NULL) { if (oldPixmap == curPixmap) @@ -187,7 +187,7 @@ void RootlessStartDrawing(WindowPtr pWindow) else RL_DEBUG_MSG("Window %p's existing oldPixmap %p being lost!\n", pWindow, oldPixmap); } - pWindow->devPrivates[rootlessWindowOldPixmapPrivateIndex].ptr = curPixmap; + dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, curPixmap); pScreen->SetWindowPixmap(pWindow, winRec->pixmap); } } @@ -203,7 +203,7 @@ static int RestorePreDrawingPixmapVisitor(WindowPtr pWindow, pointer data) RootlessWindowRec *winRec = (RootlessWindowRec*)data; ScreenPtr pScreen = pWindow->drawable.pScreen; PixmapPtr exPixmap = pScreen->GetWindowPixmap(pWindow); - PixmapPtr oldPixmap = pWindow->devPrivates[rootlessWindowOldPixmapPrivateIndex].ptr; + PixmapPtr oldPixmap = dixLookupPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey); if (oldPixmap == NULL) { if (exPixmap == winRec->pixmap) @@ -216,7 +216,7 @@ static int RestorePreDrawingPixmapVisitor(WindowPtr pWindow, pointer data) if (oldPixmap == winRec->pixmap) RL_DEBUG_MSG("Window %p's oldPixmap %p is winRec->pixmap, which has just been freed!\n", pWindow, oldPixmap); pScreen->SetWindowPixmap(pWindow, oldPixmap); - pWindow->devPrivates[rootlessWindowOldPixmapPrivateIndex].ptr = NULL; + dixSetPrivate(&pWindow->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL); } return WT_WALKCHILDREN; } diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h index fd8725a0c..9e4a14a04 100644 --- a/miext/rootless/rootlessCommon.h +++ b/miext/rootless/rootlessCommon.h @@ -57,10 +57,10 @@ // Global variables -extern int rootlessGCPrivateIndex; -extern int rootlessScreenPrivateIndex; -extern int rootlessWindowPrivateIndex; -extern int rootlessWindowOldPixmapPrivateIndex; +extern DevPrivateKey rootlessGCPrivateKey; +extern DevPrivateKey rootlessScreenPrivateKey; +extern DevPrivateKey rootlessWindowPrivateKey; +extern DevPrivateKey rootlessWindowOldPixmapPrivateKey; // RootlessGCRec: private per-gc data @@ -144,12 +144,17 @@ typedef struct _RootlessScreenRec { // Accessors for screen and window privates -#define SCREENREC(pScreen) \ - ((RootlessScreenRec *)(pScreen)->devPrivates[rootlessScreenPrivateIndex].ptr) +#define SCREENREC(pScreen) ((RootlessScreenRec *) \ + dixLookupPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey)) -#define WINREC(pWin) \ - ((RootlessWindowRec *)(pWin)->devPrivates[rootlessWindowPrivateIndex].ptr) +#define SETSCREENREC(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey, v) +#define WINREC(pWin) ((RootlessWindowRec *) \ + dixLookupPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey)) + +#define SETWINREC(pWin, v) \ + dixSetPrivate(&(pWin)->devPrivates, rootlessWindowPrivateKey, v) // Call a rootless implementation function. // Many rootless implementation functions are allowed to be NULL. diff --git a/miext/rootless/rootlessConfig.h b/miext/rootless/rootlessConfig.h index 3e326bf06..ab0187e83 100644 --- a/miext/rootless/rootlessConfig.h +++ b/miext/rootless/rootlessConfig.h @@ -34,7 +34,7 @@ #ifndef _ROOTLESSCONFIG_H #define _ROOTLESSCONFIG_H -#ifdef __DARWIN__ +#ifdef __APPLE__ # define ROOTLESS_ACCEL TRUE # define ROOTLESS_GLOBAL_COORDS TRUE @@ -48,7 +48,7 @@ alpha for 16bpp. */ # define RootlessAlphaMask(bpp) ((bpp) == 32 ? 0xFF000000 : 0) -#endif /* __DARWIN__ */ +#endif /* __APPLE__ */ #if defined(__CYGWIN__) || defined(WIN32) diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c index 7e0778e17..c80b11f1d 100644 --- a/miext/rootless/rootlessGC.c +++ b/miext/rootless/rootlessGC.c @@ -276,11 +276,11 @@ RootlessCreateGC(GCPtr pGC) Bool result; SCREEN_UNWRAP(pGC->pScreen, CreateGC); - s = (RootlessScreenRec *) pGC->pScreen-> - devPrivates[rootlessScreenPrivateIndex].ptr; + s = SCREENREC(pGC->pScreen); result = s->CreateGC(pGC); - gcrec = (RootlessGCRec *) pGC->devPrivates[rootlessGCPrivateIndex].ptr; + gcrec = (RootlessGCRec *) + dixLookupPrivate(&pGC->devPrivates, rootlessGCPrivateKey); gcrec->originalOps = NULL; // don't wrap ops yet gcrec->originalFuncs = pGC->funcs; pGC->funcs = &rootlessGCFuncs; @@ -302,7 +302,7 @@ RootlessCreateGC(GCPtr pGC) // does not assume ops have been wrapped #define GCFUNC_UNWRAP(pGC) \ RootlessGCRec *gcrec = (RootlessGCRec *) \ - (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \ + dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \ (pGC)->funcs = gcrec->originalFuncs; \ if (gcrec->originalOps) { \ (pGC)->ops = gcrec->originalOps; \ @@ -399,7 +399,7 @@ static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc) // assumes both funcs and ops are wrapped #define GCOP_UNWRAP(pGC) \ RootlessGCRec *gcrec = (RootlessGCRec *) \ - (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \ + dixLookupPrivate(&(pGC)->devPrivates, rootlessGCPrivateKey); \ GCFuncs *saveFuncs = pGC->funcs; \ (pGC)->funcs = gcrec->originalFuncs; \ (pGC)->ops = gcrec->originalOps; diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 538b698c8..5031858dd 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -62,10 +62,10 @@ extern int RootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild, extern Bool RootlessCreateGC(GCPtr pGC); // Initialize globals -int rootlessGCPrivateIndex = -1; -int rootlessScreenPrivateIndex = -1; -int rootlessWindowPrivateIndex = -1; -int rootlessWindowOldPixmapPrivateIndex = -1; +DevPrivateKey rootlessGCPrivateKey = &rootlessGCPrivateKey; +DevPrivateKey rootlessScreenPrivateKey = &rootlessScreenPrivateKey; +DevPrivateKey rootlessWindowPrivateKey = &rootlessWindowPrivateKey; +DevPrivateKey rootlessWindowOldPixmapPrivateKey = &rootlessWindowOldPixmapPrivateKey; /* @@ -610,32 +610,14 @@ static Bool RootlessAllocatePrivates(ScreenPtr pScreen) { RootlessScreenRec *s; - static unsigned long rootlessGeneration = 0; - - if (rootlessGeneration != serverGeneration) { - rootlessScreenPrivateIndex = AllocateScreenPrivateIndex(); - if (rootlessScreenPrivateIndex == -1) return FALSE; - rootlessGCPrivateIndex = AllocateGCPrivateIndex(); - if (rootlessGCPrivateIndex == -1) return FALSE; - rootlessWindowPrivateIndex = AllocateWindowPrivateIndex(); - if (rootlessWindowPrivateIndex == -1) return FALSE; - rootlessWindowOldPixmapPrivateIndex = AllocateWindowPrivateIndex(); - if (rootlessWindowOldPixmapPrivateIndex == -1) return FALSE; - rootlessGeneration = serverGeneration; - } // no allocation needed for screen privates - if (!AllocateGCPrivate(pScreen, rootlessGCPrivateIndex, - sizeof(RootlessGCRec))) - return FALSE; - if (!AllocateWindowPrivate(pScreen, rootlessWindowPrivateIndex, 0)) - return FALSE; - if (!AllocateWindowPrivate(pScreen, rootlessWindowOldPixmapPrivateIndex, 0)) + if (!dixRequestPrivate(rootlessGCPrivateKey, sizeof(RootlessGCRec))) return FALSE; s = xalloc(sizeof(RootlessScreenRec)); if (! s) return FALSE; - SCREENREC(pScreen) = s; + SETSCREENREC(pScreen, s); s->pixmap_data = NULL; s->pixmap_data_size = 0; @@ -650,8 +632,7 @@ RootlessAllocatePrivates(ScreenPtr pScreen) static void RootlessWrap(ScreenPtr pScreen) { - RootlessScreenRec *s = (RootlessScreenRec*) - pScreen->devPrivates[rootlessScreenPrivateIndex].ptr; + RootlessScreenRec *s = SCREENREC(pScreen); #define WRAP(a) \ if (pScreen->a) { \ @@ -718,10 +699,11 @@ Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcsPtr procs) if (!RootlessAllocatePrivates(pScreen)) return FALSE; - s = (RootlessScreenRec*) - pScreen->devPrivates[rootlessScreenPrivateIndex].ptr; + s = SCREENREC(pScreen); s->imp = procs; + s->colormap = NULL; + s->redisplay_expired = FALSE; RootlessWrap(pScreen); diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index bb5ba4828..7285f959d 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -197,8 +197,8 @@ RootlessCreateWindow(WindowPtr pWin) Bool result; RegionRec saveRoot; - WINREC(pWin) = NULL; - pWin->devPrivates[rootlessWindowOldPixmapPrivateIndex].ptr = NULL; + SETWINREC(pWin, NULL); + dixSetPrivate(&pWin->devPrivates, rootlessWindowOldPixmapPrivateKey, NULL); SCREEN_UNWRAP(pWin->drawable.pScreen, CreateWindow); @@ -239,7 +239,7 @@ RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec) #endif xfree(winRec); - WINREC(pWin) = NULL; + SETWINREC(pWin, NULL); } @@ -471,7 +471,7 @@ RootlessEnsureFrame(WindowPtr pWin) if (WINREC(pWin) != NULL) return WINREC(pWin); - if (!IsTopLevel(pWin)) + if (!IsTopLevel(pWin) && !IsRoot(pWin)) return NULL; if (pWin->drawable.class != InputOutput) @@ -489,7 +489,7 @@ RootlessEnsureFrame(WindowPtr pWin) winRec->pixmap = NULL; winRec->wid = NULL; - WINREC(pWin) = winRec; + SETWINREC(pWin, winRec); #ifdef SHAPE // Set the frame's shape if the window is shaped @@ -506,7 +506,7 @@ RootlessEnsureFrame(WindowPtr pWin) { RL_DEBUG_MSG("implementation failed to create frame!\n"); xfree(winRec); - WINREC(pWin) = NULL; + SETWINREC(pWin, NULL); return NULL; } @@ -1437,8 +1437,8 @@ RootlessReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) /* Switch the frame record from one to the other. */ - WINREC(pWin) = NULL; - WINREC(pTopWin) = winRec; + SETWINREC(pWin, NULL); + SETWINREC(pTopWin, winRec); RootlessInitializeFrame(pTopWin, winRec); RootlessReshapeFrame(pTopWin); diff --git a/miext/shadow/shadow.c b/miext/shadow/shadow.c index 8aa192f62..ef0df4091 100644 --- a/miext/shadow/shadow.c +++ b/miext/shadow/shadow.c @@ -36,8 +36,7 @@ #include "gcstruct.h" #include "shadow.h" -int shadowScrPrivateIndex; -int shadowGeneration; +DevPrivateKey shadowScrPrivateKey = &shadowScrPrivateKey; #define wrap(priv, real, mem) {\ priv->mem = real->mem; \ @@ -116,7 +115,8 @@ static void shadowReportFunc(DamagePtr pDamage, RegionPtr pRegion, void *closure) { ScreenPtr pScreen = closure; - shadowBufPtr pBuf = pScreen->devPrivates[shadowScrPrivateIndex].ptr; + shadowBufPtr pBuf = (shadowBufPtr) + dixLookupPrivate(&pScreen->devPrivates, shadowScrPrivateKey); /* Register the damaged region, use DamageReportNone below when we * want to break BC below... */ @@ -138,13 +138,6 @@ shadowSetup(ScreenPtr pScreen) if (!DamageSetup(pScreen)) return FALSE; - if (shadowGeneration != serverGeneration) { - shadowScrPrivateIndex = AllocateScreenPrivateIndex(); - if (shadowScrPrivateIndex == -1) - return FALSE; - shadowGeneration = serverGeneration; - } - pBuf = (shadowBufPtr) xalloc(sizeof(shadowBufRec)); if (!pBuf) return FALSE; @@ -175,7 +168,7 @@ shadowSetup(ScreenPtr pScreen) REGION_NULL(pScreen, &pBuf->damage); /* bc */ #endif - pScreen->devPrivates[shadowScrPrivateIndex].ptr = (pointer) pBuf; + dixSetPrivate(&pScreen->devPrivates, shadowScrPrivateKey, pBuf); return TRUE; } diff --git a/miext/shadow/shadow.h b/miext/shadow/shadow.h index 8986809f4..2e45df2b5 100644 --- a/miext/shadow/shadow.h +++ b/miext/shadow/shadow.h @@ -74,9 +74,10 @@ typedef struct _shadowBuf { #define SHADOW_REFLECT_Y 32 #define SHADOW_REFLECT_ALL (SHADOW_REFLECT_X|SHADOW_REFLECT_Y) -extern int shadowScrPrivateIndex; +extern DevPrivateKey shadowScrPrivateKey; -#define shadowGetBuf(pScr) ((shadowBufPtr) (pScr)->devPrivates[shadowScrPrivateIndex].ptr) +#define shadowGetBuf(pScr) ((shadowBufPtr) \ + dixLookupPrivate(&(pScr)->devPrivates, shadowScrPrivateKey)) #define shadowBuf(pScr) shadowBufPtr pBuf = shadowGetBuf(pScr) #define shadowDamage(pBuf) DamageRegion(pBuf->pDamage) diff --git a/os/Makefile.am b/os/Makefile.am index 16070f5b8..ce6058538 100644 --- a/os/Makefile.am +++ b/os/Makefile.am @@ -3,7 +3,6 @@ noinst_LTLIBRARIES = libos.la AM_CFLAGS = $(DIX_CFLAGS) SECURERPC_SRCS = rpcauth.c -XCSECURITY_SRCS = secauth.c XDMCP_SRCS = xdmcp.c STRLCAT_SRCS = strlcat.c strlcpy.c XORG_SRCS = log.c @@ -29,10 +28,6 @@ if SECURE_RPC libos_la_SOURCES += $(SECURERPC_SRCS) endif -if XCSECURITY -libos_la_SOURCES += $(XCSECURITY_SRCS) -endif - if XDMCP libos_la_SOURCES += $(XDMCP_SRCS) endif @@ -42,7 +37,7 @@ libos_la_SOURCES += $(STRLCAT_SRCS) endif EXTRA_DIST = $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \ - $(XCSECURITY_SRCS) $(XDMCP_SRCS) $(STRLCAT_SRCS) + $(XDMCP_SRCS) $(STRLCAT_SRCS) if XSERVER_DTRACE # Generate dtrace object code for probes in libos & libdix diff --git a/os/WaitFor.c b/os/WaitFor.c index 71ca53438..36e01ca38 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -254,13 +254,13 @@ WaitForSomething(int *pClientsReady) } else if (selecterr == EINVAL) { - FatalError("WaitForSomething(): select: errno=%d\n", - selecterr); + FatalError("WaitForSomething(): select: %s\n", + strerror(selecterr)); } - else if (selecterr != EINTR) + else if (selecterr != EINTR && selecterr != EAGAIN) { - ErrorF("WaitForSomething(): select: errno=%d\n", - selecterr); + ErrorF("WaitForSomething(): select: %s\n", + strerror(selecterr)); } } #ifdef SMART_SCHEDULE @@ -563,7 +563,7 @@ TimerInit(void) #define DPMS_CHECK_MODE(mode,time)\ if (time > 0 && DPMSPowerLevel < mode && timeout >= time)\ - DPMSSet(mode); + DPMSSet(serverClient, mode); #define DPMS_CHECK_TIMEOUT(time)\ if (time > 0 && (time - timeout) > 0)\ @@ -632,7 +632,7 @@ ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg) } ResetOsBuffers(); /* not ideal, but better than nothing */ - SaveScreens(SCREEN_SAVER_ON, ScreenSaverActive); + dixSaveScreens(serverClient, SCREEN_SAVER_ON, ScreenSaverActive); if (ScreenSaverInterval > 0) { diff --git a/os/access.c b/os/access.c index b0f63edc2..e91dd37e4 100644 --- a/os/access.c +++ b/os/access.c @@ -1521,17 +1521,20 @@ FreeLocalClientCreds(LocalClientCredRec *lcc) } } -static Bool +static int AuthorizedClient(ClientPtr client) { + int rc; + if (!client || defeatAccessControl) - return TRUE; + return Success; /* untrusted clients can't change host access */ - if (!XaceHook(XACE_HOSTLIST_ACCESS, client, DixWriteAccess)) - return FALSE; + rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess); + if (rc != Success) + return rc; - return LocalClient(client); + return LocalClient(client) ? Success : BadAccess; } /* Add a host to the access control list. This is the external interface @@ -1543,10 +1546,11 @@ AddHost (ClientPtr client, unsigned length, /* of bytes in pAddr */ pointer pAddr) { - int len; + int rc, len; - if (!AuthorizedClient(client)) - return(BadAccess); + rc = AuthorizedClient(client); + if (rc != Success) + return rc; switch (family) { case FamilyLocalHost: len = length; @@ -1640,11 +1644,12 @@ RemoveHost ( unsigned length, /* of bytes in pAddr */ pointer pAddr) { - int len; + int rc, len; register HOST *host, **prev; - if (!AuthorizedClient(client)) - return(BadAccess); + rc = AuthorizedClient(client); + if (rc != Success) + return rc; switch (family) { case FamilyLocalHost: len = length; @@ -1901,8 +1906,9 @@ ChangeAccessControl( ClientPtr client, int fEnabled) { - if (!AuthorizedClient(client)) - return BadAccess; + int rc = AuthorizedClient(client); + if (rc != Success) + return rc; AccessEnabled = fEnabled; return Success; } @@ -42,9 +42,6 @@ from The Open Group. # include "dixstruct.h" # include <sys/types.h> # include <sys/stat.h> -#ifdef XCSECURITY -# include "securitysrv.h" -#endif #ifdef WIN32 #include <X11/Xw32defs.h> #endif @@ -89,14 +86,6 @@ static struct protocol protocols[] = { #endif }, #endif -#ifdef XCSECURITY -{ (unsigned short) XSecurityAuthorizationNameLen, - XSecurityAuthorizationName, - NULL, AuthSecurityCheck, NULL, - NULL, NULL, NULL, - NULL -}, -#endif }; # define NUM_AUTHORIZATION (sizeof (protocols) /\ diff --git a/os/connection.c b/os/connection.c index 860404f6c..8b6541ce6 100644 --- a/os/connection.c +++ b/os/connection.c @@ -143,9 +143,6 @@ SOFTWARE. #include "appgroup.h" #endif #include "xace.h" -#ifdef XCSECURITY -#include "securitysrv.h" -#endif #ifdef X_NOT_POSIX #define Pid_t int @@ -356,7 +353,8 @@ InitConnectionLimits(void) #endif #if !defined(WIN32) - ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1)); + if (!ConnectionTranslation) + ConnectionTranslation = (int *)xnfalloc(sizeof(int)*(lastfdesc + 1)); #else InitConnectionTranslation(); #endif @@ -719,13 +717,7 @@ ClientAuthorized(ClientPtr client, if (auth_id == (XID) ~0L) { - if ( -#ifdef XCSECURITY - (proto_n == 0 || - strncmp (auth_proto, XSecurityAuthorizationName, proto_n) != 0) && -#endif - _XSERVTransGetPeerAddr (trans_conn, - &family, &fromlen, &from) != -1) + if (_XSERVTransGetPeerAddr(trans_conn, &family, &fromlen, &from) != -1) { if (InvalidHost ((struct sockaddr *) from, fromlen, client)) AuthAudit(client, FALSE, (struct sockaddr *) from, @@ -1057,9 +1049,12 @@ CheckConnections(void) curclient = curoff + (i * (sizeof(fd_mask)*8)); FD_ZERO(&tmask); FD_SET(curclient, &tmask); - r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); + do { + r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); + } while (r < 0 && (errno == EINTR || errno == EAGAIN)); if (r < 0) - CloseDownClient(clients[ConnectionTranslation[curclient]]); + if (ConnectionTranslation[curclient] > 0) + CloseDownClient(clients[ConnectionTranslation[curclient]]); mask &= ~((fd_mask)1 << curoff); } } @@ -1070,9 +1065,12 @@ CheckConnections(void) curclient = XFD_FD(&savedAllClients, i); FD_ZERO(&tmask); FD_SET(curclient, &tmask); - r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); - if (r < 0 && GetConnectionTranslation(curclient) > 0) - CloseDownClient(clients[GetConnectionTranslation(curclient)]); + do { + r = Select (curclient + 1, &tmask, NULL, NULL, ¬ime); + } while (r < 0 && (errno == EINTR || errno == EAGAIN)); + if (r < 0) + if (GetConnectionTranslation(curclient) > 0) + CloseDownClient(clients[GetConnectionTranslation(curclient)]); } #endif } @@ -1141,11 +1139,15 @@ RemoveEnabledDevice(int fd) * This routine is "undone" by ListenToAllClients() *****************/ -void +int OnlyListenToOneClient(ClientPtr client) { OsCommPtr oc = (OsCommPtr)client->osPrivate; - int connection = oc->fd; + int rc, connection = oc->fd; + + rc = XaceHook(XACE_SERVER_ACCESS, client, DixGrabAccess); + if (rc != Success) + return rc; if (! GrabInProgress) { @@ -1166,6 +1168,7 @@ OnlyListenToOneClient(ClientPtr client) XFD_ORSET(&AllSockets, &AllSockets, &AllClients); GrabInProgress = client->index; } + return rc; } /**************** @@ -1196,7 +1196,7 @@ AllocateOutputBuffer(void) oco = (ConnectionOutputPtr)xalloc(sizeof(ConnectionOutput)); if (!oco) return (ConnectionOutputPtr)NULL; - oco->buf = (unsigned char *) xalloc(BUFSIZE); + oco->buf = (unsigned char *) xcalloc(1, BUFSIZE); if (!oco->buf) { xfree(oco); diff --git a/os/osdep.h b/os/osdep.h index 2d455aa67..b6894c146 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -257,9 +257,6 @@ extern int SecureRPCRemove (AuthRemCArgs); extern int SecureRPCReset (AuthRstCArgs); #endif -/* in secauth.c */ -extern XID AuthSecurityCheck (AuthCheckArgs); - /* in xdmcp.c */ extern void XdmcpUseMsg (void); extern int XdmcpOptions(int argc, char **argv, int i); diff --git a/os/secauth.c b/os/secauth.c deleted file mode 100644 index d01879bfd..000000000 --- a/os/secauth.c +++ /dev/null @@ -1,202 +0,0 @@ -/* -Copyright 1996, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> -#include "os.h" -#include "osdep.h" -#include "dixstruct.h" -#include "swaprep.h" - -#ifdef XCSECURITY -#include "securitysrv.h" -#endif - -static char InvalidPolicyReason[] = "invalid policy specification"; -static char PolicyViolationReason[] = "policy violation"; - -static Bool -AuthCheckSitePolicy( - unsigned short *data_lengthP, - char **dataP, - ClientPtr client, - char **reason) -{ - CARD8 *policy = *(CARD8 **)dataP; - int length; - Bool permit; - int nPolicies; - char **sitePolicies; - int nSitePolicies; - Bool found = FALSE; - - if ((length = *data_lengthP) < 2) { - *reason = InvalidPolicyReason; - return FALSE; - } - - permit = (*policy++ == 0); - nPolicies = (CARD8) *policy++; - - length -= 2; - - sitePolicies = SecurityGetSitePolicyStrings(&nSitePolicies); - - while (nPolicies) { - int strLen, sitePolicy; - - if (length == 0) { - *reason = InvalidPolicyReason; - return FALSE; - } - - strLen = (CARD8) *policy++; - if (--length < strLen) { - *reason = InvalidPolicyReason; - return FALSE; - } - - if (!found) - { - for (sitePolicy = 0; sitePolicy < nSitePolicies; sitePolicy++) - { - char *testPolicy = sitePolicies[sitePolicy]; - if ((strLen == strlen(testPolicy)) && - (strncmp((char *)policy, testPolicy, strLen) == 0)) - { - found = TRUE; /* need to continue parsing the policy... */ - break; - } - } - } - - policy += strLen; - length -= strLen; - nPolicies--; - } - - if (found != permit) - { - *reason = PolicyViolationReason; - return FALSE; - } - - *data_lengthP = length; - *dataP = (char *)policy; - return TRUE; -} - -XID -AuthSecurityCheck ( - unsigned short data_length, - char *data, - ClientPtr client, - char **reason) -{ -#ifdef XCSECURITY - xConnSetupPrefix csp; - xReq freq; - - if (client->clientState == ClientStateCheckedSecurity) - { - *reason = "repeated security check not permitted"; - return (XID) -1; - } - else if (data_length > 0) - { - char policy_mask = *data++; - - if (--data_length == 1) { - *reason = InvalidPolicyReason; - return (XID) -1; - } - - if (policy_mask & 0x01) /* Extensions policy */ - { - /* AuthCheckExtensionPolicy(&data_length, &data, client, reason) */ - *reason = "security policy not implemented"; - return (XID) -1; - } - - if (policy_mask & 0x02) /* Site policy */ - { - if (!AuthCheckSitePolicy(&data_length, &data, client, reason)) - return (XID) -1; - } - - if (data_length > 0) { /* did we consume the whole policy? */ - *reason = InvalidPolicyReason; - return (XID) -1; - } - - } - else if (!GetAccessControl()) - { - /* - * The client - possibly the X FireWall Proxy - gave - * no auth data and host-based authorization is turned - * off. In this case, the client should be denied - * access to the X server. - */ - *reason = "server host access control is disabled"; - return (XID) -1; - } - - client->clientState = ClientStateCheckingSecurity; - - csp.success = 2 /* Authenticate */; - csp.lengthReason = 0; - csp.length = 0; - csp.majorVersion = X_PROTOCOL; - csp.minorVersion = X_PROTOCOL_REVISION; - if (client->swapped) - WriteSConnSetupPrefix(client, &csp); - else - (void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp); - - /* - * Next time the client sends the real auth data, we want - * ProcEstablishConnection to be called. - */ - - freq.reqType = 1; - freq.length = (sz_xReq + sz_xConnClientPrefix) >> 2; - client->swapped = FALSE; - if (!InsertFakeRequest(client, (char *)&freq, sz_xReq)) - { - *reason = "internal error"; - return (XID) -1; - } - - return (XID) 0; -#else - *reason = "method not supported"; - return (XID) -1; -#endif -} diff --git a/os/utils.c b/os/utils.c index d46a756f2..4041028a3 100644 --- a/os/utils.c +++ b/os/utils.c @@ -123,9 +123,6 @@ OR PERFORMANCE OF THIS SOFTWARE. #ifdef XKB #include <xkbsrv.h> #endif -#ifdef XCSECURITY -#include "securitysrv.h" -#endif #ifdef RENDER #include "picture.h" @@ -621,9 +618,6 @@ void UseMsg(void) ErrorF("-render [default|mono|gray|color] set render color alloc policy\n"); #endif ErrorF("-s # screen-saver timeout (minutes)\n"); -#ifdef XCSECURITY - ErrorF("-sp file security policy file\n"); -#endif #ifdef XPRINT PrinterUseMsg(); #endif @@ -1044,12 +1038,6 @@ ProcessCommandLine(int argc, char *argv[]) i = skip - 1; } #endif -#ifdef XCSECURITY - else if ((skip = XSecurityOptions(argc, argv, i)) != i) - { - i = skip - 1; - } -#endif #ifdef AIXV3 else if ( strcmp( argv[i], "-timeout") == 0) { @@ -2014,18 +2002,6 @@ enum BadCode { #define BUGADDRESS "xorg@freedesktop.org" #endif -#define ARGMSG \ - "\nIf the arguments used are valid, and have been rejected incorrectly\n" \ - "please send details of the arguments and why they are valid to\n" \ - "%s. In the meantime, you can start the Xserver as\n" \ - "the \"super user\" (root).\n" - -#define ENVMSG \ - "\nIf the environment is valid, and have been rejected incorrectly\n" \ - "please send details of the environment and why it is valid to\n" \ - "%s. In the meantime, you can start the Xserver as\n" \ - "the \"super user\" (root).\n" - void CheckUserParameters(int argc, char **argv, char **envp) { @@ -2072,10 +2048,6 @@ CheckUserParameters(int argc, char **argv, char **envp) /* Check for bad environment variables and values */ #if REMOVE_ENV_LD while (envp[i] && (strncmp(envp[i], "LD", 2) == 0)) { -#ifdef ENVDEBUG - ErrorF("CheckUserParameters: removing %s from the " - "environment\n", strtok(envp[i], "=")); -#endif for (j = i; envp[j]; j++) { envp[j] = envp[j+1]; } @@ -2083,10 +2055,6 @@ CheckUserParameters(int argc, char **argv, char **envp) #endif if (envp[i] && (strlen(envp[i]) > MAX_ENV_LENGTH)) { #if REMOVE_LONG_ENV -#ifdef ENVDEBUG - ErrorF("CheckUserParameters: removing %s from the " - "environment\n", strtok(envp[i], "=")); -#endif for (j = i; envp[j]; j++) { envp[j] = envp[j+1]; } @@ -2139,20 +2107,16 @@ CheckUserParameters(int argc, char **argv, char **envp) return; case UnsafeArg: ErrorF("Command line argument number %d is unsafe\n", i); - ErrorF(ARGMSG, BUGADDRESS); break; case ArgTooLong: ErrorF("Command line argument number %d is too long\n", i); - ErrorF(ARGMSG, BUGADDRESS); break; case UnprintableArg: ErrorF("Command line argument number %d contains unprintable" " characters\n", i); - ErrorF(ARGMSG, BUGADDRESS); break; case EnvTooLong: ErrorF("Environment variable `%s' is too long\n", e); - ErrorF(ENVMSG, BUGADDRESS); break; case OutputIsPipe: ErrorF("Stdout and/or stderr is a pipe\n"); @@ -2162,8 +2126,6 @@ CheckUserParameters(int argc, char **argv, char **envp) break; default: ErrorF("Unknown error\n"); - ErrorF(ARGMSG, BUGADDRESS); - ErrorF(ENVMSG, BUGADDRESS); break; } FatalError("X server aborted because of unsafe environment\n"); diff --git a/randr/randr.c b/randr/randr.c index 958f9c192..bc2b995d2 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -56,9 +56,9 @@ static int SProcRRDispatch (ClientPtr pClient); int RREventBase; int RRErrorBase; RESTYPE RRClientType, RREventType; /* resource types for event masks */ -int RRClientPrivateIndex; +DevPrivateKey RRClientPrivateKey = &RRClientPrivateKey; -int rrPrivIndex = -1; +DevPrivateKey rrPrivKey = &rrPrivKey; static void RRClientCallback (CallbackListPtr *list, @@ -214,8 +214,6 @@ Bool RRInit (void) return TRUE; } -static int RRScreenGeneration; - Bool RRScreenInit(ScreenPtr pScreen) { rrScrPrivPtr pScrPriv; @@ -223,13 +221,6 @@ Bool RRScreenInit(ScreenPtr pScreen) if (!RRInit ()) return FALSE; - if (RRScreenGeneration != serverGeneration) - { - if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; - RRScreenGeneration = serverGeneration; - } - pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec)); if (!pScrPriv) return FALSE; @@ -333,8 +324,7 @@ RRExtensionInit (void) if (RRNScreens == 0) return; - RRClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (RRClientPrivateIndex, + if (!dixRequestPrivate(RRClientPrivateKey, sizeof (RRClientRec) + screenInfo.numScreens * sizeof (RRTimesRec))) return; diff --git a/randr/randrstr.h b/randr/randrstr.h index a852c3a2a..9ae05da68 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -264,11 +264,11 @@ typedef struct _rrScrPriv { #endif } rrScrPrivRec, *rrScrPrivPtr; -extern int rrPrivIndex; +extern DevPrivateKey rrPrivKey; -#define rrGetScrPriv(pScr) ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr) +#define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey)) #define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr) -#define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p)) +#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p) /* * each window has a list of clients requesting @@ -300,7 +300,7 @@ typedef struct _RRClient { } RRClientRec, *RRClientPtr; extern RESTYPE RRClientType, RREventType; /* resource types for event masks */ -extern int RRClientPrivateIndex; +extern DevPrivateKey RRClientPrivateKey; extern RESTYPE RRCrtcType, RRModeType, RROutputType; #define LookupOutput(client,id,a) ((RROutputPtr) \ @@ -313,7 +313,7 @@ extern RESTYPE RRCrtcType, RRModeType, RROutputType; (SecurityLookupIDByType (client, id, \ RRModeType, a))) -#define GetRRClient(pClient) ((RRClientPtr) (pClient)->devPrivates[RRClientPrivateIndex].ptr) +#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey)) #define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient) /* Initialize the extension */ diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 4a7275bbf..7c22437a9 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -22,6 +22,7 @@ #include "randrstr.h" #include "swaprep.h" +#include "registry.h" RESTYPE RRCrtcType; @@ -501,9 +502,7 @@ RRCrtcInit (void) RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource); if (!RRCrtcType) return FALSE; -#ifdef XResExtension - RegisterResourceName (RRCrtcType, "CRTC"); -#endif + RegisterResourceName (RRCrtcType, "CRTC"); return TRUE; } diff --git a/randr/rrmode.c b/randr/rrmode.c index f060d2294..d5072084a 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -21,6 +21,7 @@ */ #include "randrstr.h" +#include "registry.h" RESTYPE RRModeType; @@ -268,9 +269,7 @@ RRModeInit (void) RRModeType = CreateNewResourceType (RRModeDestroyResource); if (!RRModeType) return FALSE; -#ifdef XResExtension RegisterResourceName (RRModeType, "MODE"); -#endif return TRUE; } diff --git a/randr/rroutput.c b/randr/rroutput.c index c1e971ddc..1ecde31a2 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -21,6 +21,7 @@ */ #include "randrstr.h" +#include "registry.h" RESTYPE RROutputType; @@ -420,9 +421,7 @@ RROutputInit (void) RROutputType = CreateNewResourceType (RROutputDestroyResource); if (!RROutputType) return FALSE; -#ifdef XResExtension - RegisterResourceName (RROutputType, "OUTPUT"); -#endif + RegisterResourceName (RROutputType, "OUTPUT"); return TRUE; } diff --git a/record/record.c b/record/record.c index f580f643e..debe3c472 100644 --- a/record/record.c +++ b/record/record.c @@ -164,13 +164,13 @@ typedef struct { ProcFunctionPtr recordVector[256]; } RecordClientPrivateRec, *RecordClientPrivatePtr; -static int RecordClientPrivateIndex; +static DevPrivateKey RecordClientPrivateKey = &RecordClientPrivateKey; /* RecordClientPrivatePtr RecordClientPrivate(ClientPtr) * gets the client private of the given client. Syntactic sugar. */ #define RecordClientPrivate(_pClient) (RecordClientPrivatePtr) \ - ((_pClient)->devPrivates[RecordClientPrivateIndex].ptr) + dixLookupPrivate(&(_pClient)->devPrivates, RecordClientPrivateKey) /***************************************************************************/ @@ -982,8 +982,8 @@ RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient) memcpy(pClientPriv->recordVector, pClient->requestVector, sizeof (pClientPriv->recordVector)); pClientPriv->originalVector = pClient->requestVector; - pClient->devPrivates[RecordClientPrivateIndex].ptr = - (pointer)pClientPriv; + dixSetPrivate(&pClient->devPrivates, + RecordClientPrivateKey, pClientPriv); pClient->requestVector = pClientPriv->recordVector; } while ((pIter = RecordIterateSet(pRCAP->pRequestMajorOpSet, @@ -1096,7 +1096,8 @@ RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient) if (!otherRCAPwantsProcVector) { /* nobody needs it, so free it */ pClient->requestVector = pClientPriv->originalVector; - pClient->devPrivates[RecordClientPrivateIndex].ptr = NULL; + dixSetPrivate(&pClient->devPrivates, + RecordClientPrivateKey, NULL); xfree(pClientPriv); } } /* end if this RCAP specifies any requests */ @@ -2948,10 +2949,6 @@ RecordExtensionInit(void) if (!RTContext) return; - RecordClientPrivateIndex = AllocateClientPrivateIndex(); - if (!AllocateClientPrivate(RecordClientPrivateIndex, 0)) - return; - ppAllContexts = NULL; numContexts = numEnabledContexts = numEnabledRCAPs = 0; diff --git a/render/animcur.c b/render/animcur.c index 1f25e79d0..125928931 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -44,6 +44,7 @@ #include "dixfontstr.h" #include "opaque.h" #include "picturestr.h" +#include "xace.h" typedef struct _AnimCurElt { CursorPtr pCursor; /* cursor to show */ @@ -87,14 +88,14 @@ static CursorBits animCursorBits = { empty, empty, 2, 1, 1, 0, 0, 1 }; -static int AnimCurScreenPrivateIndex = -1; static int AnimCurGeneration; +static DevPrivateKey AnimCurScreenPrivateKey = &AnimCurScreenPrivateKey; #define IsAnimCur(c) ((c)->bits == &animCursorBits) #define GetAnimCur(c) ((AnimCurPtr) ((c) + 1)) -#define GetAnimCurScreen(s) ((AnimCurScreenPtr) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr)) -#define GetAnimCurScreenIfSet(s) ((AnimCurScreenPrivateIndex != -1) ? GetAnimCurScreen(s) : NULL) -#define SetAnimCurScreen(s,p) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr = (pointer) (p)) +#define GetAnimCurScreen(s) ((AnimCurScreenPtr)dixLookupPrivate(&(s)->devPrivates, AnimCurScreenPrivateKey)) +#define GetAnimCurScreenIfSet(s) GetAnimCurScreen(s) +#define SetAnimCurScreen(s,p) dixSetPrivate(&(s)->devPrivates, AnimCurScreenPrivateKey, p) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) @@ -128,8 +129,6 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen) SetAnimCurScreen(pScreen,0); ret = (*pScreen->CloseScreen) (index, pScreen); xfree (as); - if (index == 0) - AnimCurScreenPrivateIndex = -1; return ret; } @@ -324,9 +323,6 @@ AnimCurInit (ScreenPtr pScreen) if (AnimCurGeneration != serverGeneration) { - AnimCurScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (AnimCurScreenPrivateIndex < 0) - return FALSE; AnimCurGeneration = serverGeneration; animCurState.pCursor = 0; animCurState.pScreen = 0; @@ -351,10 +347,10 @@ AnimCurInit (ScreenPtr pScreen) } int -AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor) +AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid) { CursorPtr pCursor; - int i; + int rc, i; AnimCurPtr ac; for (i = 0; i < screenInfo.numScreens; i++) @@ -371,7 +367,6 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp if (!pCursor) return BadAlloc; pCursor->bits = &animCursorBits; - animCursorBits.refcnt++; pCursor->refcnt = 1; pCursor->foreRed = cursors[0]->foreRed; @@ -382,9 +377,22 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp pCursor->backGreen = cursors[0]->backGreen; pCursor->backBlue = cursors[0]->backBlue; + pCursor->id = cid; + pCursor->devPrivates = NULL; + + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor, + RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + dixFreePrivates(pCursor->devPrivates); + xfree(pCursor); + return rc; + } + /* * Fill in the AnimCurRec */ + animCursorBits.refcnt++; ac = GetAnimCur (pCursor); ac->nelt = ncursor; ac->elts = (AnimCurElt *) (ac + 1); diff --git a/render/glyph.c b/render/glyph.c index e1dc0bc99..286e39d63 100644 --- a/render/glyph.c +++ b/render/glyph.c @@ -85,220 +85,19 @@ static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 }; static GlyphHashRec globalGlyphs[GlyphFormatNum]; -static int globalTotalGlyphPrivateSize = 0; - -static int glyphPrivateCount = 0; - -void -ResetGlyphPrivates (void) -{ - glyphPrivateCount = 0; -} - -int -AllocateGlyphPrivateIndex (void) -{ - return glyphPrivateCount++; -} - -Bool -AllocateGlyphPrivate (ScreenPtr pScreen, - int index2, - unsigned amount) -{ - PictureScreenPtr ps; - unsigned oldamount; - - ps = GetPictureScreenIfSet (pScreen); - if (!ps) - return FALSE; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof (DevUnion) - 1)) / sizeof (DevUnion)) * - sizeof (DevUnion); - - if (index2 >= ps->glyphPrivateLen) - { - unsigned *nsizes; - nsizes = (unsigned *) xrealloc (ps->glyphPrivateSizes, - (index2 + 1) * sizeof (unsigned)); - if (!nsizes) - return FALSE; - - while (ps->glyphPrivateLen <= index2) - { - nsizes[ps->glyphPrivateLen++] = 0; - ps->totalGlyphPrivateSize += sizeof (DevUnion); - } - ps->glyphPrivateSizes = nsizes; - } - oldamount = ps->glyphPrivateSizes[index2]; - if (amount > oldamount) - { - ps->glyphPrivateSizes[index2] = amount; - ps->totalGlyphPrivateSize += (amount - oldamount); - } - ps->totalGlyphPrivateSize = BitmapBytePad (ps->totalGlyphPrivateSize * 8); - - return TRUE; -} - static void -SetGlyphScreenPrivateOffsets (void) +FreeGlyphPrivates (GlyphPtr glyph) { - PictureScreenPtr ps; - int offset = 0; - int i; + ScreenPtr pScreen; + int i; - for (i = 0; i < screenInfo.numScreens; i++) - { - ps = GetPictureScreenIfSet (screenInfo.screens[i]); - if (ps && ps->totalGlyphPrivateSize) - { - ps->glyphPrivateOffset = offset; - offset += ps->totalGlyphPrivateSize / sizeof (DevUnion); - } + for (i = 0; i < screenInfo.numScreens; i++) { + pScreen = screenInfo.screens[i]; + dixFreePrivates(*GetGlyphPrivatesForScreen(glyph, pScreen)); } -} -static void -SetGlyphPrivatePointers (GlyphPtr glyph) -{ - PictureScreenPtr ps; - int i; - char *ptr; - DevUnion *ppriv; - unsigned *sizes; - unsigned size; - int len; - - for (i = 0; i < screenInfo.numScreens; i++) - { - ps = GetPictureScreenIfSet (screenInfo.screens[i]); - if (ps && ps->totalGlyphPrivateSize) - { - ppriv = glyph->devPrivates + ps->glyphPrivateOffset; - sizes = ps->glyphPrivateSizes; - ptr = (char *) (ppriv + ps->glyphPrivateLen); - for (len = ps->glyphPrivateLen; --len >= 0; ppriv++, sizes++) - { - if ((size = *sizes) != 0) - { - ppriv->ptr = (pointer) ptr; - ptr += size; - } - else - ppriv->ptr = (pointer) 0; - } - } - } -} - -static Bool -ReallocGlobalGlyphPrivate (GlyphPtr glyph) -{ - PictureScreenPtr ps; - DevUnion *devPrivates; - char *ptr; - int i; - - devPrivates = xalloc (globalTotalGlyphPrivateSize); - if (!devPrivates) - return FALSE; - - ptr = (char *) devPrivates; - for (i = 0; i < screenInfo.numScreens; i++) - { - ps = GetPictureScreenIfSet (screenInfo.screens[i]); - if (ps && ps->totalGlyphPrivateSize) - { - if (ps->glyphPrivateOffset != -1) - { - memcpy (ptr, glyph->devPrivates + ps->glyphPrivateOffset, - ps->totalGlyphPrivateSize); - } - else if (ps->totalGlyphPrivateSize) - { - memset (ptr, 0, ps->totalGlyphPrivateSize); - } - - ptr += ps->totalGlyphPrivateSize; - } - } - - if (glyph->devPrivates) - xfree (glyph->devPrivates); - - glyph->devPrivates = devPrivates; - - return TRUE; -} - -Bool -GlyphInit (ScreenPtr pScreen) -{ - PictureScreenPtr ps = GetPictureScreen (pScreen); - - ps->totalGlyphPrivateSize = 0; - ps->glyphPrivateSizes = 0; - ps->glyphPrivateLen = 0; - ps->glyphPrivateOffset = -1; - - return TRUE; -} - -Bool -GlyphFinishInit (ScreenPtr pScreen) -{ - PictureScreenPtr ps = GetPictureScreen (pScreen); - - if (ps->totalGlyphPrivateSize) - { - GlyphPtr glyph; - int fdepth, i; - - globalTotalGlyphPrivateSize += ps->totalGlyphPrivateSize; - - for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) - { - if (!globalGlyphs[fdepth].hashSet) - continue; - - for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) - { - glyph = globalGlyphs[fdepth].table[i].glyph; - if (glyph && glyph != DeletedGlyph) - { - if (!ReallocGlobalGlyphPrivate (glyph)) - return FALSE; - } - } - } - - SetGlyphScreenPrivateOffsets (); - - for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) - { - if (!globalGlyphs[fdepth].hashSet) - continue; - - for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) - { - glyph = globalGlyphs[fdepth].table[i].glyph; - if (glyph && glyph != DeletedGlyph) - { - SetGlyphPrivatePointers (glyph); - - if (!(*ps->RealizeGlyph) (pScreen, glyph)) - return FALSE; - } - } - } - } - else - ps->glyphPrivateOffset = 0; - - return TRUE; + dixFreePrivates(glyph->devPrivates); + glyph->devPrivates = NULL; } void @@ -308,8 +107,6 @@ GlyphUninit (ScreenPtr pScreen) GlyphPtr glyph; int fdepth, i; - globalTotalGlyphPrivateSize -= ps->totalGlyphPrivateSize; - for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) { if (!globalGlyphs[fdepth].hashSet) @@ -321,43 +118,19 @@ GlyphUninit (ScreenPtr pScreen) if (glyph && glyph != DeletedGlyph) { (*ps->UnrealizeGlyph) (pScreen, glyph); - - if (globalTotalGlyphPrivateSize) - { - if (!ReallocGlobalGlyphPrivate (glyph)) - return; - } - else - { - if (glyph->devPrivates) - xfree (glyph->devPrivates); - glyph->devPrivates = NULL; - } + FreeGlyphPrivates(glyph); } } } - if (globalTotalGlyphPrivateSize) - SetGlyphScreenPrivateOffsets (); - for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++) { if (!globalGlyphs[fdepth].hashSet) continue; for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++) - { glyph = globalGlyphs[fdepth].table[i].glyph; - if (glyph && glyph != DeletedGlyph) - { - if (globalTotalGlyphPrivateSize) - SetGlyphPrivatePointers (glyph); - } - } } - - if (ps->glyphPrivateSizes) - xfree (ps->glyphPrivateSizes); } GlyphHashSetPtr @@ -371,50 +144,6 @@ FindGlyphHashSet (CARD32 filled) return 0; } -static int _GlyphSetPrivateAllocateIndex = 0; - -int -AllocateGlyphSetPrivateIndex (void) -{ - return _GlyphSetPrivateAllocateIndex++; -} - -void -ResetGlyphSetPrivateIndex (void) -{ - _GlyphSetPrivateAllocateIndex = 0; -} - -Bool -_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr) -{ - pointer *new; - - if (n > glyphSet->maxPrivate) { - if (glyphSet->devPrivates && - glyphSet->devPrivates != (pointer)(&glyphSet[1])) { - new = (pointer *) xrealloc (glyphSet->devPrivates, - (n + 1) * sizeof (pointer)); - if (!new) - return FALSE; - } else { - new = (pointer *) xalloc ((n + 1) * sizeof (pointer)); - if (!new) - return FALSE; - if (glyphSet->devPrivates) - memcpy (new, - glyphSet->devPrivates, - (glyphSet->maxPrivate + 1) * sizeof (pointer)); - } - glyphSet->devPrivates = new; - /* Zero out new, uninitialize privates */ - while (++glyphSet->maxPrivate < n) - glyphSet->devPrivates[glyphSet->maxPrivate] = (pointer)0; - } - glyphSet->devPrivates[n] = ptr; - return TRUE; -} - GlyphRefPtr FindGlyphRef (GlyphHashPtr hash, CARD32 signature, @@ -582,8 +311,7 @@ FreeGlyph (GlyphPtr glyph, int format) (*ps->UnrealizeGlyph) (pScreen, glyph); } - if (glyph->devPrivates) - xfree (glyph->devPrivates); + FreeGlyphPrivates(glyph); xfree (glyph); } } @@ -610,8 +338,7 @@ AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) if (ps) (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph); } - if (glyph->devPrivates) - xfree (glyph->devPrivates); + FreeGlyphPrivates(glyph); xfree (glyph); glyph = gr->glyph; } @@ -678,16 +405,7 @@ AllocateGlyph (xGlyphInfo *gi, int fdepth) glyph->refcnt = 0; glyph->size = size + sizeof (xGlyphInfo); glyph->info = *gi; - - if (globalTotalGlyphPrivateSize) - { - glyph->devPrivates = xalloc (globalTotalGlyphPrivateSize); - if (!glyph->devPrivates) - return 0; - - SetGlyphPrivatePointers (glyph); - } else - glyph->devPrivates = NULL; + glyph->devPrivates = NULL; for (i = 0; i < screenInfo.numScreens; i++) { @@ -709,9 +427,8 @@ bail: if (ps) (*ps->UnrealizeGlyph) (screenInfo.screens[i], glyph); } - - if (glyph->devPrivates) - xfree (glyph->devPrivates); + + FreeGlyphPrivates(glyph); xfree (glyph); return 0; } @@ -790,15 +507,11 @@ AllocateGlyphSet (int fdepth, PictFormatPtr format) return FALSE; } - size = (sizeof (GlyphSetRec) + - (sizeof (pointer) * _GlyphSetPrivateAllocateIndex)); + size = sizeof (GlyphSetRec); glyphSet = xalloc (size); if (!glyphSet) return FALSE; bzero((char *)glyphSet, size); - glyphSet->maxPrivate = _GlyphSetPrivateAllocateIndex - 1; - if (_GlyphSetPrivateAllocateIndex) - glyphSet->devPrivates = (pointer)(&glyphSet[1]); if (!AllocateGlyphHash (&glyphSet->hash, &glyphHashSets[0])) { @@ -838,11 +551,7 @@ FreeGlyphSet (pointer value, else ResizeGlyphHash (&globalGlyphs[glyphSet->fdepth], 0, TRUE); xfree (table); - - if (glyphSet->devPrivates && - glyphSet->devPrivates != (pointer)(&glyphSet[1])) - xfree(glyphSet->devPrivates); - + dixFreePrivates(glyphSet->devPrivates); xfree (glyphSet); } return Success; diff --git a/render/glyphstr.h b/render/glyphstr.h index c6ab5aa11..67b21fe63 100644 --- a/render/glyphstr.h +++ b/render/glyphstr.h @@ -30,6 +30,7 @@ #include "screenint.h" #include "regionstr.h" #include "miscstruct.h" +#include "privates.h" #define GlyphFormat1 0 #define GlyphFormat4 1 @@ -40,7 +41,7 @@ typedef struct _Glyph { CARD32 refcnt; - DevUnion *devPrivates; + PrivateRec *devPrivates; unsigned char sha1[20]; CARD32 size; /* info + bitmap */ xGlyphInfo info; @@ -74,18 +75,14 @@ typedef struct _GlyphSet { int fdepth; GlyphHashRec hash; int maxPrivate; - pointer *devPrivates; + PrivateRec *devPrivates; } GlyphSetRec, *GlyphSetPtr; -#define GlyphSetGetPrivate(pGlyphSet,n) \ - ((n) > (pGlyphSet)->maxPrivate ? \ - (pointer) 0 : \ - (pGlyphSet)->devPrivates[n]) +#define GlyphSetGetPrivate(pGlyphSet,k) \ + dixLookupPrivate(&(pGlyphSet)->devPrivates, k) -#define GlyphSetSetPrivate(pGlyphSet,n,ptr) \ - ((n) > (pGlyphSet)->maxPrivate ? \ - _GlyphSetSetNewPrivate(pGlyphSet, n, ptr) : \ - ((((pGlyphSet)->devPrivates[n] = (ptr)) != 0) || TRUE)) +#define GlyphSetSetPrivate(pGlyphSet,k,ptr) \ + dixSetPrivate(&(pGlyphSet)->devPrivates, k, ptr) typedef struct _GlyphList { INT16 xOff; @@ -97,32 +94,6 @@ typedef struct _GlyphList { GlyphHashSetPtr FindGlyphHashSet (CARD32 filled); -int -AllocateGlyphSetPrivateIndex (void); - -void -ResetGlyphSetPrivateIndex (void); - -Bool -_GlyphSetSetNewPrivate (GlyphSetPtr glyphSet, int n, pointer ptr); - -void -ResetGlyphPrivates (void); - -int -AllocateGlyphPrivateIndex (void); - -Bool -AllocateGlyphPrivate (ScreenPtr pScreen, - int index2, - unsigned amount); - -Bool -GlyphInit (ScreenPtr pScreen); - -Bool -GlyphFinishInit (ScreenPtr pScreen); - void GlyphUninit (ScreenPtr pScreen); diff --git a/render/mirect.c b/render/mirect.c index 464df51c1..38f4faf67 100644 --- a/render/mirect.c +++ b/render/mirect.c @@ -158,7 +158,7 @@ miCompositeRects (CARD8 op, tmpval[0] = xTrue; pSrc = CreatePicture (0, &pPixmap->drawable, rgbaFormat, - CPRepeat, tmpval, 0, &error); + CPRepeat, tmpval, serverClient, &error); if (!pSrc) goto bail4; diff --git a/render/picture.c b/render/picture.c index 8a4ac4714..e1a7f1da6 100644 --- a/render/picture.c +++ b/render/picture.c @@ -40,66 +40,17 @@ #include "gcstruct.h" #include "servermd.h" #include "picturestr.h" +#include "xace.h" +#include "registry.h" -_X_EXPORT int PictureScreenPrivateIndex = -1; -int PictureWindowPrivateIndex; +_X_EXPORT DevPrivateKey PictureScreenPrivateKey = &PictureScreenPrivateKey; +DevPrivateKey PictureWindowPrivateKey = &PictureWindowPrivateKey; static int PictureGeneration; RESTYPE PictureType; RESTYPE PictFormatType; RESTYPE GlyphSetType; int PictureCmapPolicy = PictureCmapPolicyDefault; -/* Picture Private machinery */ - -static int picturePrivateCount; - -void -ResetPicturePrivateIndex (void) -{ - picturePrivateCount = 0; -} - -int -AllocatePicturePrivateIndex (void) -{ - return picturePrivateCount++; -} - -Bool -AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount) -{ - PictureScreenPtr ps = GetPictureScreen(pScreen); - unsigned int oldamount; - - /* Round up sizes for proper alignment */ - amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long); - - if (index2 >= ps->PicturePrivateLen) - { - unsigned int *nsizes; - - nsizes = (unsigned int *)xrealloc(ps->PicturePrivateSizes, - (index2 + 1) * sizeof(unsigned int)); - if (!nsizes) - return FALSE; - while (ps->PicturePrivateLen <= index2) - { - nsizes[ps->PicturePrivateLen++] = 0; - ps->totalPictureSize += sizeof(DevUnion); - } - ps->PicturePrivateSizes = nsizes; - } - oldamount = ps->PicturePrivateSizes[index2]; - if (amount > oldamount) - { - ps->PicturePrivateSizes[index2] = amount; - ps->totalPictureSize += (amount - oldamount); - } - - return TRUE; -} - - Bool PictureDestroyWindow (WindowPtr pWindow) { @@ -137,8 +88,6 @@ PictureCloseScreen (int index, ScreenPtr pScreen) (*ps->CloseIndexed) (pScreen, &ps->formats[n]); GlyphUninit (pScreen); SetPictureScreen(pScreen, 0); - if (ps->PicturePrivateSizes) - xfree (ps->PicturePrivateSizes); xfree (ps->formats); xfree (ps); return ret; @@ -493,8 +442,6 @@ PictureFinishInit (void) for (s = 0; s < screenInfo.numScreens; s++) { - if (!GlyphFinishInit (screenInfo.screens[s])) - return FALSE; if (!PictureInitIndexedFormats (screenInfo.screens[s])) return FALSE; (void) AnimCurInit (screenInfo.screens[s]); @@ -633,20 +580,11 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) GlyphSetType = CreateNewResourceType (FreeGlyphSet); if (!GlyphSetType) return FALSE; - PictureScreenPrivateIndex = AllocateScreenPrivateIndex(); - if (PictureScreenPrivateIndex < 0) - return FALSE; - PictureWindowPrivateIndex = AllocateWindowPrivateIndex(); PictureGeneration = serverGeneration; -#ifdef XResExtension RegisterResourceName (PictureType, "PICTURE"); RegisterResourceName (PictFormatType, "PICTFORMAT"); RegisterResourceName (GlyphSetType, "GLYPHSET"); -#endif } - if (!AllocateWindowPrivate (pScreen, PictureWindowPrivateIndex, 0)) - return FALSE; - if (!formats) { formats = PictureCreateDefaultFormats (pScreen, &nformats); @@ -697,17 +635,6 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) return FALSE; } SetPictureScreen(pScreen, ps); - if (!GlyphInit (pScreen)) - { - SetPictureScreen(pScreen, 0); - xfree (formats); - xfree (ps); - return FALSE; - } - - ps->totalPictureSize = sizeof (PictureRec); - ps->PicturePrivateSizes = 0; - ps->PicturePrivateLen = 0; ps->formats = formats; ps->fallback = formats; @@ -774,37 +701,6 @@ SetPictureToDefaults (PicturePtr pPicture) } PicturePtr -AllocatePicture (ScreenPtr pScreen) -{ - PictureScreenPtr ps = GetPictureScreen(pScreen); - PicturePtr pPicture; - char *ptr; - DevUnion *ppriv; - unsigned int *sizes; - unsigned int size; - int i; - - pPicture = (PicturePtr) xalloc (ps->totalPictureSize); - if (!pPicture) - return 0; - ppriv = (DevUnion *)(pPicture + 1); - pPicture->devPrivates = ppriv; - sizes = ps->PicturePrivateSizes; - ptr = (char *)(ppriv + ps->PicturePrivateLen); - for (i = ps->PicturePrivateLen; --i >= 0; ppriv++, sizes++) - { - if ( (size = *sizes) ) - { - ppriv->ptr = (pointer)ptr; - ptr += size; - } - else - ppriv->ptr = (pointer)NULL; - } - return pPicture; -} - -PicturePtr CreatePicture (Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, @@ -816,7 +712,7 @@ CreatePicture (Picture pid, PicturePtr pPicture; PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen); - pPicture = AllocatePicture (pDrawable->pScreen); + pPicture = (PicturePtr)xalloc(sizeof(PictureRec)); if (!pPicture) { *error = BadAlloc; @@ -827,6 +723,14 @@ CreatePicture (Picture pid, pPicture->pDrawable = pDrawable; pPicture->pFormat = pFormat; pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24); + pPicture->devPrivates = NULL; + + /* security creation/labeling check */ + *error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture, + RT_PIXMAP, pDrawable, DixCreateAccess|DixSetAttrAccess); + if (*error != Success) + goto out; + if (pDrawable->type == DRAWABLE_PIXMAP) { ++((PixmapPtr)pDrawable)->refcnt; @@ -846,6 +750,7 @@ CreatePicture (Picture pid, *error = Success; if (*error == Success) *error = (*ps->CreatePicture) (pPicture); +out: if (*error != Success) { FreePicture (pPicture, (XID) 0); @@ -1193,14 +1098,13 @@ ChangePicture (PicturePtr pPicture, pAlpha = 0; else { - pAlpha = (PicturePtr) SecurityLookupIDByType(client, - pid, - PictureType, - DixWriteAccess|DixReadAccess); - if (!pAlpha) + error = dixLookupResource((pointer *)&pAlpha, pid, + PictureType, client, + DixReadAccess); + if (error != Success) { client->errorValue = pid; - error = BadPixmap; + error = (error == BadValue) ? BadPixmap : error; break; } if (pAlpha->pDrawable == NULL || @@ -1255,14 +1159,13 @@ ChangePicture (PicturePtr pPicture, else { clipType = CT_PIXMAP; - pPixmap = (PixmapPtr)SecurityLookupIDByType(client, - pid, - RT_PIXMAP, - DixReadAccess); - if (!pPixmap) + error = dixLookupResource((pointer *)&pPixmap, pid, + RT_PIXMAP, client, + DixReadAccess); + if (error != Success) { client->errorValue = pid; - error = BadPixmap; + error = (error == BadValue) ? BadPixmap : error; break; } } @@ -1617,7 +1520,8 @@ FreePicture (pointer value, WindowPtr pWindow = (WindowPtr) pPicture->pDrawable; PicturePtr *pPrev; - for (pPrev = (PicturePtr *) &((pWindow)->devPrivates[PictureWindowPrivateIndex].ptr); + for (pPrev = (PicturePtr *)dixLookupPrivateAddr + (&pWindow->devPrivates, PictureWindowPrivateKey); *pPrev; pPrev = &(*pPrev)->pNext) { @@ -1633,20 +1537,7 @@ FreePicture (pointer value, (*pScreen->DestroyPixmap) ((PixmapPtr)pPicture->pDrawable); } } - - if (pPicture->pSourcePict) - { - if (pPicture->pSourcePict->type != SourcePictTypeSolidFill && - pPicture->pSourcePict->type != SourcePictTypeOther - ) - xfree(pPicture->pSourcePict->linear.stops); - - if (pPicture->pSourcePict->source.Destroy) - (*pPicture->pSourcePict->source.Destroy) (pPicture); - - xfree(pPicture->pSourcePict); - } - + dixFreePrivates(pPicture->devPrivates); xfree (pPicture); } return Success; diff --git a/render/picture.h b/render/picture.h index 8de8dfeec..501d49475 100644 --- a/render/picture.h +++ b/render/picture.h @@ -169,8 +169,8 @@ extern int PictureCmapPolicy; int PictureParseCmapPolicy (const char *name); -extern int RenderErrBase; -extern int RenderClientPrivateIndex; +extern int RenderErrBase; +extern DevPrivateKey RenderClientPrivateKey; /* Fixed point updates from Carl Worth, USC, Information Sciences Institute */ diff --git a/render/picturestr.h b/render/picturestr.h index 481de0316..e99fb2902 100644 --- a/render/picturestr.h +++ b/render/picturestr.h @@ -27,6 +27,7 @@ #include "scrnintstr.h" #include "glyphstr.h" #include "resource.h" +#include "privates.h" #define PictTypeOther 0xff @@ -196,7 +197,7 @@ typedef struct _Picture { RegionPtr pCompositeClip; - DevUnion *devPrivates; + PrivateRec *devPrivates; PictTransform *transform; @@ -351,10 +352,6 @@ typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen, GlyphPtr glyph); typedef struct _PictureScreen { - int totalPictureSize; - unsigned int *PicturePrivateSizes; - int PicturePrivateLen; - PictFormatPtr formats; PictFormatPtr fallback; int nformats; @@ -412,30 +409,25 @@ typedef struct _PictureScreen { AddTrapsProcPtr AddTraps; - int totalGlyphPrivateSize; - unsigned int *glyphPrivateSizes; - int glyphPrivateLen; - int glyphPrivateOffset; - RealizeGlyphProcPtr RealizeGlyph; UnrealizeGlyphProcPtr UnrealizeGlyph; } PictureScreenRec, *PictureScreenPtr; -extern int PictureScreenPrivateIndex; -extern int PictureWindowPrivateIndex; +extern DevPrivateKey PictureScreenPrivateKey; +extern DevPrivateKey PictureWindowPrivateKey; extern RESTYPE PictureType; extern RESTYPE PictFormatType; extern RESTYPE GlyphSetType; -#define GetPictureScreen(s) ((PictureScreenPtr) ((s)->devPrivates[PictureScreenPrivateIndex].ptr)) -#define GetPictureScreenIfSet(s) ((PictureScreenPrivateIndex != -1) ? GetPictureScreen(s) : NULL) -#define SetPictureScreen(s,p) ((s)->devPrivates[PictureScreenPrivateIndex].ptr = (pointer) (p)) -#define GetPictureWindow(w) ((PicturePtr) ((w)->devPrivates[PictureWindowPrivateIndex].ptr)) -#define SetPictureWindow(w,p) ((w)->devPrivates[PictureWindowPrivateIndex].ptr = (pointer) (p)) +#define GetPictureScreen(s) ((PictureScreenPtr)dixLookupPrivate(&(s)->devPrivates, PictureScreenPrivateKey)) +#define GetPictureScreenIfSet(s) GetPictureScreen(s) +#define SetPictureScreen(s,p) dixSetPrivate(&(s)->devPrivates, PictureScreenPrivateKey, p) +#define GetPictureWindow(w) ((PicturePtr)dixLookupPrivate(&(w)->devPrivates, PictureWindowPrivateKey)) +#define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p) -#define GetGlyphPrivatesForScreen(glyph, s) \ - ((glyph)->devPrivates + (GetPictureScreen (s))->glyphPrivateOffset) +#define GetGlyphPrivatesForScreen(glyph, s) \ + ((PrivateRec **)dixLookupPrivateAddr(&(glyph)->devPrivates, s)) #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\ pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\ @@ -453,15 +445,6 @@ extern RESTYPE GlyphSetType; } \ } \ -void -ResetPicturePrivateIndex (void); - -int -AllocatePicturePrivateIndex (void); - -Bool -AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount); - Bool PictureDestroyWindow (WindowPtr pWindow); @@ -525,9 +508,6 @@ void SetPictureToDefaults (PicturePtr pPicture); PicturePtr -AllocatePicture (ScreenPtr pScreen); - -PicturePtr CreatePicture (Picture pid, DrawablePtr pDrawable, PictFormatPtr pFormat, @@ -667,7 +647,7 @@ Bool AnimCurInit (ScreenPtr pScreen); int -AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor); +AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid); void AddTraps (PicturePtr pPicture, diff --git a/render/render.c b/render/render.c index c1ced5bf6..b6d551083 100644 --- a/render/render.c +++ b/render/render.c @@ -46,6 +46,7 @@ #include "glyphstr.h" #include <X11/Xfuncproto.h> #include "cursorstr.h" +#include "xace.h" #if HAVE_STDINT_H #include <stdint.h> @@ -213,14 +214,14 @@ static void RenderResetProc (ExtensionEntry *extEntry); int RenderErrBase; -int RenderClientPrivateIndex; +DevPrivateKey RenderClientPrivateKey; typedef struct _RenderClient { int major_version; int minor_version; } RenderClientRec, *RenderClientPtr; -#define GetRenderClient(pClient) ((RenderClientPtr) (pClient)->devPrivates[RenderClientPrivateIndex].ptr) +#define GetRenderClient(pClient) ((RenderClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RenderClientPrivateKey)) static void RenderClientCallback (CallbackListPtr *list, @@ -244,9 +245,7 @@ RenderExtensionInit (void) return; if (!PictureFinishInit ()) return; - RenderClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (RenderClientPrivateIndex, - sizeof (RenderClientRec))) + if (!dixRequestPrivate(RenderClientPrivateKey, sizeof(RenderClientRec))) return; if (!AddCallback (&ClientStateCallback, RenderClientCallback, 0)) return; @@ -262,8 +261,6 @@ RenderExtensionInit (void) static void RenderResetProc (ExtensionEntry *extEntry) { - ResetPicturePrivateIndex(); - ResetGlyphSetPrivateIndex(); } static int @@ -612,7 +609,7 @@ ProcRenderCreatePicture (ClientPtr client) LEGAL_NEW_RESOURCE(stuff->pid, client); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixWriteAccess); + DixReadAccess|DixAddAccess); if (rc != Success) return rc; @@ -653,7 +650,7 @@ ProcRenderChangePicture (ClientPtr client) int len; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2); @@ -673,7 +670,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) int result; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; @@ -972,7 +969,7 @@ ProcRenderCreateGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; PictFormatPtr format; - int f; + int rc, f; REQUEST(xRenderCreateGlyphSetReq); REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); @@ -1011,6 +1008,11 @@ ProcRenderCreateGlyphSet (ClientPtr client) glyphSet = AllocateGlyphSet (f, format); if (!glyphSet) return BadAlloc; + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->gsid, GlyphSetType, + glyphSet, RT_NONE, NULL, DixCreateAccess); + if (rc != Success) + return rc; if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet)) return BadAlloc; return Success; @@ -1020,20 +1022,19 @@ static int ProcRenderReferenceGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; + int rc; REQUEST(xRenderReferenceGlyphSetReq); REQUEST_SIZE_MATCH(xRenderReferenceGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - stuff->existing, - GlyphSetType, - DixWriteAccess); - if (!glyphSet) + rc = dixLookupResource((pointer *)&glyphSet, stuff->existing, GlyphSetType, + client, DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->existing; - return RenderErrBase + BadGlyphSet; + return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; } glyphSet->refcnt++; if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet)) @@ -1048,17 +1049,16 @@ static int ProcRenderFreeGlyphSet (ClientPtr client) { GlyphSetPtr glyphSet; + int rc; REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - stuff->glyphset, - GlyphSetType, - DixDestroyAccess); - if (!glyphSet) + rc = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType, + client, DixDestroyAccess); + if (rc != Success) { client->errorValue = stuff->glyphset; - return RenderErrBase + BadGlyphSet; + return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; } FreeResource (stuff->glyphset, RT_NONE); return client->noClientException; @@ -1085,23 +1085,22 @@ ProcRenderAddGlyphs (ClientPtr client) xGlyphInfo *gi; CARD8 *bits; int size; - int err = BadAlloc; + int err; int i, screen; PicturePtr pSrc = NULL, pDst = NULL; PixmapPtr pSrcPix = NULL, pDstPix = NULL; CARD32 component_alpha; REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq); - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - stuff->glyphset, - GlyphSetType, - DixWriteAccess); - if (!glyphSet) + err = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType, + client, DixAddAccess); + if (err != Success) { client->errorValue = stuff->glyphset; - return RenderErrBase + BadGlyphSet; + return (err == BadValue) ? RenderErrBase + BadGlyphSet : err; } + err = BadAlloc; nglyphs = stuff->nglyphs; if (nglyphs > UINT32_MAX / sizeof(GlyphNewRec)) return BadAlloc; @@ -1271,19 +1270,17 @@ ProcRenderFreeGlyphs (ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); GlyphSetPtr glyphSet; - int nglyph; + int rc, nglyph; CARD32 *gids; CARD32 glyph; REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - stuff->glyphset, - GlyphSetType, - DixWriteAccess); - if (!glyphSet) + rc = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType, + client, DixRemoveAccess); + if (rc != Success) { client->errorValue = stuff->glyphset; - return RenderErrBase + BadGlyphSet; + return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; } nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2; gids = (CARD32 *) (stuff + 1); @@ -1360,7 +1357,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - DixReadAccess); + DixUseAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1422,7 +1419,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, gs, GlyphSetType, - DixReadAccess); + DixUseAccess); if (!glyphSet) { client->errorValue = gs; @@ -1564,7 +1561,7 @@ ProcRenderCreateCursor (ClientPtr client) CursorMetricRec cm; CursorPtr pCursor; CARD32 twocolor[3]; - int ncolor; + int rc, ncolor; REQUEST_SIZE_MATCH (xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); @@ -1732,16 +1729,20 @@ ProcRenderCreateCursor (ClientPtr client) cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; - pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm, - GetColor(twocolor[0], 16), - GetColor(twocolor[0], 8), - GetColor(twocolor[0], 0), - GetColor(twocolor[1], 16), - GetColor(twocolor[1], 8), - GetColor(twocolor[1], 0)); - if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) - return (client->noClientException); - return BadAlloc; + rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm, + GetColor(twocolor[0], 16), + GetColor(twocolor[0], 8), + GetColor(twocolor[0], 0), + GetColor(twocolor[1], 16), + GetColor(twocolor[1], 8), + GetColor(twocolor[1], 0), + &pCursor, client, stuff->cid); + if (rc != Success) + return rc; + if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor)) + return BadAlloc; + + return client->noClientException; } static int @@ -1752,7 +1753,7 @@ ProcRenderSetPictureTransform (ClientPtr client) int result; REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); if (client->noClientException != Success) @@ -1777,7 +1778,7 @@ ProcRenderQueryFilters (ClientPtr client) REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixReadAccess); + DixGetAttrAccess); if (rc != Success) return rc; @@ -1882,7 +1883,7 @@ ProcRenderSetPictureFilter (ClientPtr client) char *name; REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); name = (char *) (stuff + 1); params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); @@ -1926,7 +1927,8 @@ ProcRenderCreateAnimCursor (ClientPtr client) deltas[i] = elt->delay; elt++; } - ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor); + ret = AnimCursorCreate (cursors, deltas, ncursor, &pCursor, client, + stuff->cid); xfree (cursors); if (ret != Success) return ret; @@ -1972,6 +1974,11 @@ static int ProcRenderCreateSolidFill(ClientPtr client) pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error); if (!pPicture) return error; + /* security creation/labeling check */ + error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, + pPicture, RT_NONE, NULL, DixCreateAccess); + if (error != Success) + return error; if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) return BadAlloc; return Success; @@ -2001,6 +2008,11 @@ static int ProcRenderCreateLinearGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; + /* security creation/labeling check */ + error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, + pPicture, RT_NONE, NULL, DixCreateAccess); + if (error != Success) + return error; if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) return BadAlloc; return Success; @@ -2031,6 +2043,11 @@ static int ProcRenderCreateRadialGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; + /* security creation/labeling check */ + error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, + pPicture, RT_NONE, NULL, DixCreateAccess); + if (error != Success) + return error; if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) return BadAlloc; return Success; @@ -2060,6 +2077,11 @@ static int ProcRenderCreateConicalGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; + /* security creation/labeling check */ + error = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, PictureType, + pPicture, RT_NONE, NULL, DixCreateAccess); + if (error != Success) + return error; if (!AddResource (stuff->pid, PictureType, (pointer)pPicture)) return BadAlloc; return Success; diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 401c403c8..d51251f19 100755 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -51,12 +51,12 @@ #include "servermd.h" #include "inputstr.h" #include "windowstr.h" +#include "xace.h" static RESTYPE CursorClientType; static RESTYPE CursorHideCountType; static RESTYPE CursorWindowType; -static int CursorScreenPrivateIndex = -1; -static int CursorGeneration; +static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKey; static CursorPtr CursorCurrent; static CursorPtr pInvisibleCursor = NULL; @@ -113,9 +113,9 @@ typedef struct _CursorScreen { CursorHideCountPtr pCursorHideCounts; } CursorScreenRec, *CursorScreenPtr; -#define GetCursorScreen(s) ((CursorScreenPtr) ((s)->devPrivates[CursorScreenPrivateIndex].ptr)) -#define GetCursorScreenIfSet(s) ((CursorScreenPrivateIndex != -1) ? GetCursorScreen(s) : NULL) -#define SetCursorScreen(s,p) ((s)->devPrivates[CursorScreenPrivateIndex].ptr = (pointer) (p)) +#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey)) +#define GetCursorScreenIfSet(s) GetCursorScreen(s) +#define SetCursorScreen(s,p) dixSetPrivate(&(s)->devPrivates, CursorScreenPrivateKey, p) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) @@ -171,8 +171,6 @@ CursorCloseScreen (int index, ScreenPtr pScreen) deleteCursorHideCountsForScreen(pScreen); ret = (*pScreen->CloseScreen) (index, pScreen); xfree (cs); - if (index == 0) - CursorScreenPrivateIndex = -1; return ret; } @@ -241,7 +239,7 @@ ProcXFixesSelectCursorInput (ClientPtr client) int rc; REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (stuff->eventMask & ~CursorAllEvents) @@ -346,14 +344,16 @@ ProcXFixesGetCursorImage (ClientPtr client) xXFixesGetCursorImageReply *rep; CursorPtr pCursor; CARD32 *image; - int npixels; - int width, height; - int x, y; + int npixels, width, height, rc, x, y; REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq); pCursor = CursorCurrent; if (!pCursor) return BadCursor; + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, + pCursor, RT_NONE, NULL, DixReadAccess); + if (rc != Success) + return rc; GetSpritePosition (&x, &y); width = pCursor->bits->width; height = pCursor->bits->height; @@ -414,7 +414,7 @@ ProcXFixesSetCursorName (ClientPtr client) Atom atom; REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); - VERIFY_CURSOR(pCursor, stuff->cursor, client, DixWriteAccess); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess); tchar = (char *) &stuff[1]; atom = MakeAtom (tchar, stuff->nbytes, TRUE); if (atom == BAD_RESOURCE) @@ -447,7 +447,7 @@ ProcXFixesGetCursorName (ClientPtr client) int len; REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); - VERIFY_CURSOR(pCursor, stuff->cursor, client, DixReadAccess); + VERIFY_CURSOR(pCursor, stuff->cursor, client, DixGetAttrAccess); if (pCursor->name) str = NameForAtom (pCursor->name); else @@ -496,12 +496,16 @@ ProcXFixesGetCursorImageAndName (ClientPtr client) char *name; int nbytes, nbytesRound; int width, height; - int x, y; + int rc, x, y; REQUEST_SIZE_MATCH(xXFixesGetCursorImageAndNameReq); pCursor = CursorCurrent; if (!pCursor) return BadCursor; + rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR, + pCursor, RT_NONE, NULL, DixReadAccess|DixGetAttrAccess); + if (rc != Success) + return rc; GetSpritePosition (&x, &y); width = pCursor->bits->width; height = pCursor->bits->height; @@ -678,8 +682,10 @@ ProcXFixesChangeCursor (ClientPtr client) REQUEST(xXFixesChangeCursorReq); REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); - VERIFY_CURSOR (pSource, stuff->source, client, DixReadAccess); - VERIFY_CURSOR (pDestination, stuff->destination, client, DixWriteAccess); + VERIFY_CURSOR (pSource, stuff->source, client, + DixReadAccess|DixGetAttrAccess); + VERIFY_CURSOR (pDestination, stuff->destination, client, + DixWriteAccess|DixSetAttrAccess); ReplaceCursor (pSource, TestForCursor, (pointer) pDestination); return (client->noClientException); @@ -701,7 +707,8 @@ SProcXFixesChangeCursor (ClientPtr client) static Bool TestForCursorName (CursorPtr pCursor, pointer closure) { - return (pCursor->name == (Atom) closure); + Atom *pName = closure; + return (pCursor->name == *pName); } int @@ -713,11 +720,12 @@ ProcXFixesChangeCursorByName (ClientPtr client) REQUEST(xXFixesChangeCursorByNameReq); REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes); - VERIFY_CURSOR(pSource, stuff->source, client, DixReadAccess); + VERIFY_CURSOR(pSource, stuff->source, client, + DixReadAccess|DixGetAttrAccess); tchar = (char *) &stuff[1]; name = MakeAtom (tchar, stuff->nbytes, FALSE); if (name) - ReplaceCursor (pSource, TestForCursorName, (pointer) name); + ReplaceCursor (pSource, TestForCursorName, &name); return (client->noClientException); } @@ -841,10 +849,11 @@ ProcXFixesHideCursor (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesHideCursorReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) { + ret = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (ret != Success) { client->errorValue = stuff->window; - return BadWindow; + return (ret == BadValue) ? BadWindow : ret; } /* @@ -862,6 +871,11 @@ ProcXFixesHideCursor (ClientPtr client) * This is the first time this client has hid the cursor * for this screen. */ + ret = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixHideAccess); + if (ret != Success) + return ret; + ret = createCursorHideCount(client, pWin->drawable.pScreen); if (ret == Success) { @@ -888,14 +902,16 @@ ProcXFixesShowCursor (ClientPtr client) { WindowPtr pWin; CursorHideCountPtr pChc; + int rc; REQUEST(xXFixesShowCursorReq); REQUEST_SIZE_MATCH (xXFixesShowCursorReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) { + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } /* @@ -907,6 +923,11 @@ ProcXFixesShowCursor (ClientPtr client) return BadMatch; } + rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen, + DixShowAccess); + if (rc != Success) + return rc; + pChc->hideCount--; if (pChc->hideCount <= 0) { FreeResource(pChc->resource, 0); @@ -980,6 +1001,7 @@ createInvisibleCursor (void) CursorPtr pCursor; static unsigned int *psrcbits, *pmaskbits; CursorMetricRec cm; + int rc; psrcbits = (unsigned int *) xalloc(4); pmaskbits = (unsigned int *) xalloc(4); @@ -994,12 +1016,13 @@ createInvisibleCursor (void) cm.xhot = 0; cm.yhot = 0; - pCursor = AllocCursor( + rc = AllocARGBCursor( (unsigned char *)psrcbits, (unsigned char *)pmaskbits, - &cm, + NULL, &cm, + 0, 0, 0, 0, 0, 0, - 0, 0, 0); + &pCursor, serverClient, (XID)0); return pCursor; } @@ -1009,13 +1032,6 @@ XFixesCursorInit (void) { int i; - if (CursorGeneration != serverGeneration) - { - CursorScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (CursorScreenPrivateIndex < 0) - return FALSE; - CursorGeneration = serverGeneration; - } for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; diff --git a/xfixes/region.c b/xfixes/region.c index d4316be78..d90b1e0ff 100755 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -109,18 +109,18 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client) { RegionPtr pRegion; PixmapPtr pPixmap; + int rc; REQUEST (xXFixesCreateRegionFromBitmapReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq); LEGAL_NEW_RESOURCE (stuff->region, client); - pPixmap = (PixmapPtr) SecurityLookupIDByType (client, stuff->bitmap, - RT_PIXMAP, - DixReadAccess); - if (!pPixmap) + rc = dixLookupResource((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP, + client, DixReadAccess); + if (rc != Success) { client->errorValue = stuff->bitmap; - return BadPixmap; + return (rc == BadValue) ? BadPixmap : rc; } if (pPixmap->drawable.depth != 1) return BadMatch; @@ -155,15 +155,17 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client) RegionPtr pRegion; Bool copy = TRUE; WindowPtr pWin; + int rc; REQUEST (xXFixesCreateRegionFromWindowReq); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq); LEGAL_NEW_RESOURCE (stuff->region, client); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, + client, DixGetAttrAccess); + if (rc != Success) { client->errorValue = stuff->window; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } switch (stuff->kind) { case WindowRegionBounding: @@ -224,7 +226,7 @@ ProcXFixesCreateRegionFromGC (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); LEGAL_NEW_RESOURCE (stuff->region, client); - rc = dixLookupGC(&pGC, stuff->gc, client, DixReadAccess); + rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess); if (rc != Success) return rc; @@ -274,7 +276,7 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client) REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq); LEGAL_NEW_RESOURCE (stuff->region, client); - VERIFY_PICTURE(pPicture, stuff->picture, client, DixReadAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess, RenderErrBase + BadPicture); switch (pPicture->clientClipType) { @@ -635,7 +637,7 @@ ProcXFixesSetGCClipRegion (ClientPtr client) REQUEST(xXFixesSetGCClipRegionReq); REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); - rc = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess); + rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess); if (rc != Success) return rc; @@ -681,14 +683,16 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) ScreenPtr pScreen; RegionPtr pRegion; RegionPtr *pDestRegion; + int rc; REQUEST(xXFixesSetWindowShapeRegionReq); REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); - pWin = (WindowPtr) LookupIDByType (stuff->dest, RT_WINDOW); - if (!pWin) + rc = dixLookupResource((pointer *)&pWin, stuff->dest, RT_WINDOW, + client, DixSetAttrAccess); + if (rc != Success) { client->errorValue = stuff->dest; - return BadWindow; + return (rc == BadValue) ? BadWindow : rc; } VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess); pScreen = pWin->drawable.pScreen; @@ -780,7 +784,7 @@ ProcXFixesSetPictureClipRegion (ClientPtr client) REQUEST(xXFixesSetPictureClipRegionReq); REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); - VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess, + VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess, RenderErrBase + BadPicture); pScreen = pPicture->pDrawable->pScreen; ps = GetPictureScreen (pScreen); diff --git a/xfixes/saveset.c b/xfixes/saveset.c index 8d66843d9..31664ab65 100755 --- a/xfixes/saveset.c +++ b/xfixes/saveset.c @@ -35,7 +35,7 @@ ProcXFixesChangeSaveSet(ClientPtr client) REQUEST(xXFixesChangeSaveSetReq); REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); - result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); if (result != Success) return result; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) @@ -72,5 +72,5 @@ SProcXFixesChangeSaveSet(ClientPtr client) swaps(&stuff->length, n); swapl(&stuff->window, n); - return ProcXFixesChangeSaveSet(client); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); } diff --git a/xfixes/select.c b/xfixes/select.c index c0076801d..12a165fd0 100755 --- a/xfixes/select.c +++ b/xfixes/select.c @@ -25,6 +25,7 @@ #endif #include "xfixesint.h" +#include "xace.h" static RESTYPE SelectionClientType, SelectionWindowType; static Bool SelectionCallbackRegistered = FALSE; @@ -131,8 +132,13 @@ XFixesSelectSelectionInput (ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask) { + int rc; SelectionEventPtr *prev, e; + rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess); + if (rc != Success) + return rc; + for (prev = &selectionEvents; (e = *prev); prev = &e->next) { if (e->selection == selection && @@ -196,7 +202,7 @@ ProcXFixesSelectSelectionInput (ClientPtr client) int rc; REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); - rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (stuff->eventMask & ~SelectionAllEvents) @@ -218,7 +224,7 @@ SProcXFixesSelectSelectionInput (ClientPtr client) swapl(&stuff->window, n); swapl(&stuff->selection, n); swapl(&stuff->eventMask, n); - return ProcXFixesSelectSelectionInput(client); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); } void diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c index 32dee8a18..0db49895e 100755 --- a/xfixes/xfixes.c +++ b/xfixes/xfixes.c @@ -56,7 +56,7 @@ static unsigned char XFixesReqCode; int XFixesEventBase; int XFixesErrorBase; -static int XFixesClientPrivateIndex; +static DevPrivateKey XFixesClientPrivateKey = &XFixesClientPrivateKey; static int ProcXFixesQueryVersion(ClientPtr client) @@ -239,9 +239,7 @@ XFixesExtensionInit(void) { ExtensionEntry *extEntry; - XFixesClientPrivateIndex = AllocateClientPrivateIndex (); - if (!AllocateClientPrivate (XFixesClientPrivateIndex, - sizeof (XFixesClientRec))) + if (!dixRequestPrivate(XFixesClientPrivateKey, sizeof (XFixesClientRec))) return; if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0)) return; diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h index 48927ae0f..33a3205ed 100755 --- a/xfixes/xfixesint.h +++ b/xfixes/xfixesint.h @@ -66,7 +66,7 @@ typedef struct _XFixesClient { CARD32 minor_version; } XFixesClientRec, *XFixesClientPtr; -#define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr) +#define GetXFixesClient(pClient) ((XFixesClientPtr)dixLookupPrivate(&(pClient)->devPrivates, XFixesClientPrivateKey)) extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr); @@ -232,10 +232,11 @@ typedef struct _xglGlyph { xglAreaPtr pArea; } xglGlyphRec, *xglGlyphPtr; -extern int xglGlyphPrivateIndex; +extern DevPrivateKey xglGlyphPrivateKey; #define XGL_GET_GLYPH_PRIV(pScreen, pGlyph) ((xglGlyphPtr) \ - (GetGlyphPrivatesForScreen (pGlyph, pScreen))[xglGlyphPrivateIndex].ptr) + dixLookupPrivate(GetGlyphPrivatesForScreen (pGlyph, pScreen), \ + xglGlyphPrivateKey)) #define XGL_GLYPH_PRIV(pScreen, pGlyph) \ xglGlyphPtr pGlyphPriv = XGL_GET_GLYPH_PRIV (pScreen, pGlyph) @@ -303,13 +304,13 @@ typedef struct _xglScreen { #endif } xglScreenRec, *xglScreenPtr; -extern int xglScreenPrivateIndex; +extern DevPrivateKey xglScreenPrivateKey; -#define XGL_GET_SCREEN_PRIV(pScreen) \ - ((xglScreenPtr) (pScreen)->devPrivates[xglScreenPrivateIndex].ptr) +#define XGL_GET_SCREEN_PRIV(pScreen) ((xglScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey)) -#define XGL_SET_SCREEN_PRIV(pScreen, v) \ - ((pScreen)->devPrivates[xglScreenPrivateIndex].ptr = (pointer) v) +#define XGL_SET_SCREEN_PRIV(pScreen, v) \ + dixSetPrivate(&(pScreen)->devPrivates, xglScreenPrivateKey, v) #define XGL_SCREEN_PRIV(pScreen) \ xglScreenPtr pScreenPriv = XGL_GET_SCREEN_PRIV (pScreen) @@ -344,10 +345,10 @@ typedef struct _xglGC { GCOpsPtr ops; } xglGCRec, *xglGCPtr; -extern int xglGCPrivateIndex; +extern DevPrivateKey xglGCPrivateKey; -#define XGL_GET_GC_PRIV(pGC) \ - ((xglGCPtr) (pGC)->devPrivates[xglGCPrivateIndex].ptr) +#define XGL_GET_GC_PRIV(pGC) ((xglGCPtr) \ + dixLookupPrivate(&(pGC)->devPrivates, xglGCPrivateKey)) #define XGL_GC_PRIV(pGC) \ xglGCPtr pGCPriv = XGL_GET_GC_PRIV (pGC) @@ -405,10 +406,10 @@ typedef struct _xglPixmap { } xglPixmapRec, *xglPixmapPtr; -extern int xglPixmapPrivateIndex; +extern DevPrivateKey xglPixmapPrivateKey; -#define XGL_GET_PIXMAP_PRIV(pPixmap) \ - ((xglPixmapPtr) (pPixmap)->devPrivates[xglPixmapPrivateIndex].ptr) +#define XGL_GET_PIXMAP_PRIV(pPixmap) ((xglPixmapPtr) \ + dixLookupPrivate(&(pPixmap)->devPrivates, xglPixmapPrivateKey)) #define XGL_PIXMAP_PRIV(pPixmap) \ xglPixmapPtr pPixmapPriv = XGL_GET_PIXMAP_PRIV (pPixmap) @@ -420,10 +421,10 @@ typedef struct _xglWin { PixmapPtr pPixmap; } xglWinRec, *xglWinPtr; -extern int xglWinPrivateIndex; +extern DevPrivateKey xglWinPrivateKey; -#define XGL_GET_WINDOW_PRIV(pWin) \ - ((xglWinPtr) (pWin)->devPrivates[xglWinPrivateIndex].ptr) +#define XGL_GET_WINDOW_PRIV(pWin) ((xglWinPtr) \ + dixLookupPrivate(&(pWin)->devPrivates, xglWinPrivateKey)) #define XGL_WINDOW_PRIV(pWin) \ xglWinPtr pWinPriv = XGL_GET_WINDOW_PRIV (pWin) diff --git a/xgl/xglpixmap.c b/xgl/xglpixmap.c index 8cb9ba56a..b994db636 100644 --- a/xgl/xglpixmap.c +++ b/xgl/xglpixmap.c @@ -316,6 +316,7 @@ xglDestroyPixmap (PixmapPtr pPixmap) xglFiniPixmap (pPixmap); + dixFreePrivates(pPixmap->devPrivates); xfree (pPixmap); return TRUE; diff --git a/xgl/xglxv.c b/xgl/xglxv.c index eaec59a21..4e46afcb1 100644 --- a/xgl/xglxv.c +++ b/xgl/xglxv.c @@ -35,11 +35,11 @@ #include <X11/extensions/Xv.h> #include <X11/extensions/Xvproto.h> -static unsigned int xglXvScreenIndex = 0; +static DevPrivateKey xglXvScreenKey; static unsigned long portResource = 0; -#define XGL_GET_XV_SCREEN(pScreen) \ - ((XvScreenPtr) ((pScreen)->devPrivates[xglXvScreenIndex].ptr)) +#define XGL_GET_XV_SCREEN(pScreen) ((XvScreenPtr) \ + dixLookupPrivate(&(pScreen)->devPrivates, xglXvScreenKey)) #define XGL_XV_SCREEN(pScreen) \ XvScreenPtr pXvScreen = XGL_GET_XV_SCREEN (pScreen) @@ -679,7 +679,7 @@ xglXvScreenInit (ScreenPtr pScreen) if (status != Success) return FALSE; - xglXvScreenIndex = XvGetScreenIndex (); + xglXvScreenKey = XvGetScreenKey (); portResource = XvGetRTPort (); pXvScreen = XGL_GET_XV_SCREEN (pScreen); diff --git a/xkb/Makefile.am b/xkb/Makefile.am index 78cdf7196..e750d6098 100644 --- a/xkb/Makefile.am +++ b/xkb/Makefile.am @@ -32,7 +32,6 @@ XKBFILE_SRCS = \ xkmread.c \ xkbtext.c \ xkbfmisc.c \ - xkberrs.c \ xkbout.c X11_SRCS = \ diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c index f0a1f890e..790aede92 100644 --- a/xkb/XKBAlloc.c +++ b/xkb/XKBAlloc.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "misc.h" #include "inputstr.h" #include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> +#include "xkbgeom.h" /***===================================================================***/ diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index 815cc95f5..c37f49a55 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -37,13 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "misc.h" #include "inputstr.h" #include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> - -#ifdef X_NOT_POSIX -#define Size_t unsigned int -#else -#define Size_t size_t -#endif +#include "xkbgeom.h" /***====================================================================***/ @@ -461,11 +455,11 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap) /***====================================================================***/ static Status -_XkbGeomAlloc( XPointer * old, +_XkbGeomAlloc( void ** old, unsigned short * num, unsigned short * total, int num_new, - Size_t sz_elem) + size_t sz_elem) { if (num_new<1) return Success; @@ -477,8 +471,8 @@ _XkbGeomAlloc( XPointer * old, *total= (*num)+num_new; if ((*old)!=NULL) - (*old)= (XPointer)_XkbRealloc((*old),(*total)*sz_elem); - else (*old)= (XPointer)_XkbCalloc((*total),sz_elem); + (*old)= _XkbRealloc((*old),(*total)*sz_elem); + else (*old)= _XkbCalloc((*total),sz_elem); if ((*old)==NULL) { *total= *num= 0; return BadAlloc; @@ -491,44 +485,44 @@ _XkbGeomAlloc( XPointer * old, return Success; } -#define _XkbAllocProps(g,n) _XkbGeomAlloc((XPointer *)&(g)->properties,\ +#define _XkbAllocProps(g,n) _XkbGeomAlloc((void *)&(g)->properties,\ &(g)->num_properties,&(g)->sz_properties,\ (n),sizeof(XkbPropertyRec)) -#define _XkbAllocColors(g,n) _XkbGeomAlloc((XPointer *)&(g)->colors,\ +#define _XkbAllocColors(g,n) _XkbGeomAlloc((void *)&(g)->colors,\ &(g)->num_colors,&(g)->sz_colors,\ (n),sizeof(XkbColorRec)) -#define _XkbAllocShapes(g,n) _XkbGeomAlloc((XPointer *)&(g)->shapes,\ +#define _XkbAllocShapes(g,n) _XkbGeomAlloc((void *)&(g)->shapes,\ &(g)->num_shapes,&(g)->sz_shapes,\ (n),sizeof(XkbShapeRec)) -#define _XkbAllocSections(g,n) _XkbGeomAlloc((XPointer *)&(g)->sections,\ +#define _XkbAllocSections(g,n) _XkbGeomAlloc((void *)&(g)->sections,\ &(g)->num_sections,&(g)->sz_sections,\ (n),sizeof(XkbSectionRec)) -#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((XPointer *)&(g)->doodads,\ +#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((void *)&(g)->doodads,\ &(g)->num_doodads,&(g)->sz_doodads,\ (n),sizeof(XkbDoodadRec)) -#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases,\ +#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((void *)&(g)->key_aliases,\ &(g)->num_key_aliases,&(g)->sz_key_aliases,\ (n),sizeof(XkbKeyAliasRec)) -#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((XPointer *)&(s)->outlines,\ +#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((void *)&(s)->outlines,\ &(s)->num_outlines,&(s)->sz_outlines,\ (n),sizeof(XkbOutlineRec)) -#define _XkbAllocRows(s,n) _XkbGeomAlloc((XPointer *)&(s)->rows,\ +#define _XkbAllocRows(s,n) _XkbGeomAlloc((void *)&(s)->rows,\ &(s)->num_rows,&(s)->sz_rows,\ (n),sizeof(XkbRowRec)) -#define _XkbAllocPoints(o,n) _XkbGeomAlloc((XPointer *)&(o)->points,\ +#define _XkbAllocPoints(o,n) _XkbGeomAlloc((void *)&(o)->points,\ &(o)->num_points,&(o)->sz_points,\ (n),sizeof(XkbPointRec)) -#define _XkbAllocKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\ +#define _XkbAllocKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\ &(r)->num_keys,&(r)->sz_keys,\ (n),sizeof(XkbKeyRec)) -#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((XPointer *)&(s)->overlays,\ +#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((void *)&(s)->overlays,\ &(s)->num_overlays,&(s)->sz_overlays,\ (n),sizeof(XkbOverlayRec)) -#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((XPointer *)&(o)->rows,\ +#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((void *)&(o)->rows,\ &(o)->num_rows,&(o)->sz_rows,\ (n),sizeof(XkbOverlayRowRec)) -#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\ +#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\ &(r)->num_keys,&(r)->sz_keys,\ (n),sizeof(XkbOverlayKeyRec)) diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c index 9feaf8e93..178b5b89a 100644 --- a/xkb/XKBMAlloc.c +++ b/xkb/XKBMAlloc.c @@ -55,10 +55,8 @@ XkbClientMapPtr map; ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_code<xkb->min_key_code))) { -#ifdef DEBUG -fprintf(stderr,"bad keycode (%d,%d) in XkbAllocClientMap\n", + DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n", xkb->min_key_code,xkb->max_key_code); -#endif return BadValue; } diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index 0404108a2..85415a4c9 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -416,10 +416,7 @@ unsigned changed,tmp; if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; old= xkb->ctrls->per_key_repeat[key/8]; -#ifdef RETURN_SHOULD_REPEAT - if (*XkbKeySymsPtr(xkb,key) != XK_Return) -#endif - xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); + xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; } diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c index 331357ded..2faed5818 100644 --- a/xkb/ddxBeep.c +++ b/xkb/ddxBeep.c @@ -139,10 +139,6 @@ Atom name; next= 0; pitch= oldPitch= ctrl->bell_pitch; duration= oldDuration= ctrl->bell_duration; -#ifdef DEBUG - if (xkbDebugFlags>1) - ErrorF("beep: %d (count= %d)\n",xkbInfo->beepType,xkbInfo->beepCount); -#endif name= None; switch (xkbInfo->beepType) { default: diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c index 0f7f9187f..34ea0bd3f 100644 --- a/xkb/ddxCtrls.c +++ b/xkb/ddxCtrls.c @@ -47,12 +47,6 @@ int realRepeat; realRepeat= ctrl->autoRepeat; if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev))) ctrl->autoRepeat= 0; -#ifdef DEBUG -if (xkbDebugFlags&0x4) { - ErrorF("XkbDDXKeybdCtrlProc: setting repeat to %d (real repeat is %d)\n", - ctrl->autoRepeat,realRepeat); -} -#endif if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc) (*dev->key->xkbInfo->kbdProc)(dev,ctrl); ctrl->autoRepeat= realRepeat; @@ -93,23 +87,6 @@ unsigned changed, i; unsigned char *rep_old, *rep_new, *rep_fb; changed= new->enabled_ctrls^old->enabled_ctrls; -#ifdef NOTDEF - if (changed&XkbRepeatKeysMask) { - if (dev->kbdfeed) { - int realRepeat; - - if (new->enabled_ctrls&XkbRepeatKeysMask) - dev->kbdfeed->ctrl.autoRepeat= realRepeat= 1; - else dev->kbdfeed->ctrl.autoRepeat= realRepeat= 0; - - if (XkbDDXUsesSoftRepeat(dev)) - dev->kbdfeed->ctrl.autoRepeat= FALSE; - if (dev->kbdfeed->CtrlProc) - (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); - dev->kbdfeed->ctrl.autoRepeat= realRepeat; - } - } -#endif for (rep_old = old->per_key_repeat, rep_new = new->per_key_repeat, rep_fb = dev->kbdfeed->ctrl.autoRepeats, diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c index 7e27c5189..5313a1ec5 100644 --- a/xkb/ddxDevBtn.c +++ b/xkb/ddxDevBtn.c @@ -53,7 +53,7 @@ deviceValuator * val; int x,y; int nAxes, i, count; - if ((dev==(DeviceIntPtr)LookupPointerDevice())||(!dev->public.on)) + if (dev == inputInfo.pointer || !dev->public.on) return; nAxes = (dev->valuator?dev->valuator->numAxes:0); diff --git a/xkb/ddxFakeBtn.c b/xkb/ddxFakeBtn.c index 8144fd2c5..2dad54fea 100644 --- a/xkb/ddxFakeBtn.c +++ b/xkb/ddxFakeBtn.c @@ -46,7 +46,7 @@ xEvent ev; int x,y; DevicePtr ptr; - if ((ptr = LookupPointerDevice())==NULL) + if ((ptr = (DevicePtr)inputInfo.pointer)==NULL) return; GetSpritePosition(&x,&y); ev.u.u.type = event; diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c index 1060afe99..320e0ca33 100644 --- a/xkb/ddxFakeMtn.c +++ b/xkb/ddxFakeMtn.c @@ -107,7 +107,7 @@ ScreenPtr pScreen, oldScreen; oldY= y; else oldY+= y; -#define GetScreenPrivate(s) ((miPointerScreenPtr) ((s)->devPrivates[miPointerScreenIndex].ptr)) +#define GetScreenPrivate(s) ((miPointerScreenPtr)dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey)) (*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen) (&pScreen, &oldX, &oldY); } diff --git a/xkb/ddxKeyClick.c b/xkb/ddxKeyClick.c index f48296dbc..51d78f56d 100644 --- a/xkb/ddxKeyClick.c +++ b/xkb/ddxKeyClick.c @@ -42,9 +42,5 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. void XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic) { -#ifdef DEBUG - if (xkbDebugFlags) - ErrorF("Click.\n"); -#endif return; } diff --git a/xkb/ddxKillSrv.c b/xkb/ddxKillSrv.c index a573ecbd8..3b5fd5353 100644 --- a/xkb/ddxKillSrv.c +++ b/xkb/ddxKillSrv.c @@ -41,6 +41,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. int XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act) { - GiveUp(1); + if (dev != inputInfo.keyboard) + GiveUp(1); + return 0; } diff --git a/xkb/ddxList.c b/xkb/ddxList.c index a91a9badf..80e050524 100644 --- a/xkb/ddxList.c +++ b/xkb/ddxList.c @@ -43,14 +43,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <xkbsrv.h> #include <X11/extensions/XI.h> -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - #ifdef WIN32 /* from ddxLoad.c */ extern const char* Win32TempDir(); @@ -199,9 +191,8 @@ char tmpname[PATH_MAX]; #ifndef WIN32 in= Popen(buf,"r"); #else -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",buf); -#endif + if (xkbDebugFlags) + DebugF("xkbList executes: %s\n",buf); if (System(buf) < 0) ErrorF("Could not invoke keymap compiler\n"); else diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index d79ae7a7b..d80ce62b8 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -52,14 +52,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <paths.h> #endif -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - /* * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is * relative to the top-level XKB configuration directory. @@ -161,44 +153,19 @@ Win32System(const char *cmdline) #define System(x) Win32System(x) #endif -#ifdef MAKE_XKM_OUTPUT_DIR -/* Borrow trans_mkdir from Xtransutil.c to more safely make directories */ -# undef X11_t -# define TRANS_SERVER -# define PRMSG(lvl,x,a,b,c) \ - if (lvl <= 1) { LogMessage(X_ERROR,x,a,b,c); } else ((void)0) -# include <X11/Xtrans/Xtransutil.c> -# ifndef XKM_OUTPUT_DIR_MODE -# define XKM_OUTPUT_DIR_MODE 0755 -# endif -#endif - static void OutputDirectory( char* outdir, size_t size) { #ifndef WIN32 - if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size) -#ifdef MAKE_XKM_OUTPUT_DIR - && (trans_mkdir(XKM_OUTPUT_DIR, XKM_OUTPUT_DIR_MODE) == 0) -#endif - ) + if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)) { /* if server running as root it *may* be able to write */ /* FIXME: check whether directory is writable at all */ (void) strcpy (outdir, XKM_OUTPUT_DIR); } else -#endif -#ifdef _PATH_VARTMP - if ((strlen(_PATH_VARTMP) + 1) < size) - { - (void) strcpy (outdir, _PATH_VARTMP); - if (outdir[strlen(outdir) - 1] != '/') /* Hi IBM, Digital */ - (void) strcat (outdir, "/"); - } else -#endif -#ifdef WIN32 +#else if (strlen(Win32TempDir()) + 1 < size) { (void) strcpy(outdir, Win32TempDir()); @@ -211,81 +178,6 @@ OutputDirectory( } } -static Bool -XkbDDXCompileNamedKeymap( XkbDescPtr xkb, - XkbComponentNamesPtr names, - char * nameRtrn, - int nameRtrnLen) -{ -char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; - - if (names->keymap==NULL) - return False; - strncpy(file,names->keymap,PATH_MAX); file[PATH_MAX-1]= '\0'; - if ((map= strrchr(file,'('))!=NULL) { - char *tmp; - if ((tmp= strrchr(map,')'))!=NULL) { - *map++= '\0'; - *tmp= '\0'; - } - else { - map= NULL; - } - } - if ((outFile= strrchr(file,'/'))!=NULL) - outFile= _XkbDupString(&outFile[1]); - else outFile= _XkbDupString(file); - XkbEnsureSafeMapName(outFile); - OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir)); - - if (XkbBaseDirectory!=NULL) { - char *xkbbasedir = XkbBaseDirectory; - char *xkbbindir = XkbBinDirectory; - - cmd = Xprintf("\"%s" PATHSEPARATOR "xkbcomp\" -w %d \"-R%s\" -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"", - xkbbindir, - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - xkbbasedir,(map?"-m ":""),(map?map:""), - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file, - xkm_output_dir,outFile); - } - else { - cmd = Xprintf("xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s \"%s%s.xkm\"", - ((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:(int)xkbDebugFlags)), - (map?"-m ":""),(map?map:""), - PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file, - xkm_output_dir,outFile); - } -#ifdef DEBUG - if (xkbDebugFlags) { - ErrorF("XkbDDXCompileNamedKeymap compiling keymap using:\n"); - ErrorF(" \"cmd\"\n"); - } -#endif -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",cmd); -#endif - if (System(cmd)==0) { - if (nameRtrn) { - strncpy(nameRtrn,outFile,nameRtrnLen); - nameRtrn[nameRtrnLen-1]= '\0'; - } - if (outFile!=NULL) - _XkbFree(outFile); - if (cmd!=NULL) - xfree(cmd); - return True; - } -#ifdef DEBUG - ErrorF("Error compiling keymap (%s)\n",names->keymap); -#endif - if (outFile!=NULL) - _XkbFree(outFile); - if (cmd!=NULL) - xfree(cmd); - return False; -} - static Bool XkbDDXCompileKeymapByNames( XkbDescPtr xkb, XkbComponentNamesPtr names, @@ -361,22 +253,18 @@ char tmpname[PATH_MAX]; #ifdef DEBUG if (xkbDebugFlags) { ErrorF("XkbDDXCompileKeymapByNames compiling keymap:\n"); - XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need); + XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need); } #endif - XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need); + XkbWriteXKBKeymapForNames(out,names,xkb,want,need); #ifndef WIN32 if (Pclose(out)==0) #else if (fclose(out)==0 && System(buf) >= 0) #endif { -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",buf); - ErrorF("xkbcomp input:\n"); - XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need); - ErrorF("end xkbcomp input\n"); -#endif + if (xkbDebugFlags) + DebugF("xkb executes: %s\n",buf); if (nameRtrn) { strncpy(nameRtrn,keymap,nameRtrnLen); nameRtrn[nameRtrnLen-1]= '\0'; @@ -385,24 +273,20 @@ char tmpname[PATH_MAX]; xfree (buf); return True; } -#ifdef DEBUG else - ErrorF("Error compiling keymap (%s)\n",keymap); -#endif + DebugF("Error compiling keymap (%s)\n",keymap); #ifdef WIN32 /* remove the temporary file */ unlink(tmpname); #endif } -#ifdef DEBUG else { #ifndef WIN32 - ErrorF("Could not invoke keymap compiler\n"); + DebugF("Could not invoke keymap compiler\n"); #else - ErrorF("Could not open file %s\n", tmpname); + DebugF("Could not open file %s\n", tmpname); #endif } -#endif if (nameRtrn) nameRtrn[0]= '\0'; if (buf != NULL) @@ -450,44 +334,27 @@ XkbDDXLoadKeymapByNames( DeviceIntPtr keybd, XkbComponentNamesPtr names, unsigned want, unsigned need, - XkbFileInfo * finfoRtrn, + XkbDescPtr * xkbRtrn, char * nameRtrn, int nameRtrnLen) { -XkbDescPtr xkb; +XkbDescPtr xkb; FILE * file; char fileName[PATH_MAX]; unsigned missing; - bzero(finfoRtrn,sizeof(XkbFileInfo)); + *xkbRtrn = NULL; if ((keybd==NULL)||(keybd->key==NULL)||(keybd->key->xkbInfo==NULL)) xkb= NULL; else xkb= keybd->key->xkbInfo->desc; if ((names->keycodes==NULL)&&(names->types==NULL)&& (names->compat==NULL)&&(names->symbols==NULL)&& (names->geometry==NULL)) { - if (names->keymap==NULL) { - bzero(finfoRtrn,sizeof(XkbFileInfo)); - if (xkb && XkbDetermineFileType(finfoRtrn,XkbXKMFile,NULL) && - ((finfoRtrn->defined&need)==need) ) { - finfoRtrn->xkb= xkb; - nameRtrn[0]= '\0'; - return finfoRtrn->defined; - } - return 0; - } - else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) { -#ifdef NOISY - ErrorF("Couldn't compile keymap file\n"); -#endif - return 0; - } + return 0; } else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need, - nameRtrn,nameRtrnLen)){ -#ifdef NOISY - ErrorF("Couldn't compile keymap file\n"); -#endif + nameRtrn,nameRtrnLen)){ + DebugF("Couldn't compile keymap file\n"); return 0; } file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX); @@ -495,18 +362,16 @@ unsigned missing; LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",fileName); return 0; } - missing= XkmReadFile(file,need,want,finfoRtrn); - if (finfoRtrn->xkb==NULL) { + missing= XkmReadFile(file,need,want,xkbRtrn); + if (*xkbRtrn==NULL) { LogMessage(X_ERROR, "Error loading keymap %s\n",fileName); fclose(file); (void) unlink (fileName); return 0; } -#ifdef DEBUG else if (xkbDebugFlags) { - ErrorF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined); + DebugF("Loaded XKB keymap %s, defined=0x%x\n",fileName,(*xkbRtrn)->defined); } -#endif fclose(file); (void) unlink (fileName); return (need|want)&(~missing); diff --git a/xkb/maprules.c b/xkb/maprules.c index 0fa356ee5..4c947f004 100644 --- a/xkb/maprules.c +++ b/xkb/maprules.c @@ -46,20 +46,10 @@ #include "misc.h" #include "inputstr.h" #include "dix.h" -#include <X11/extensions/XKBstr.h> +#include "xkbstr.h" #define XKBSRV_NEED_FILE_FUNCS #include <xkbsrv.h> -#ifdef DEBUG -#define PR_DEBUG(s) fprintf(stderr,s) -#define PR_DEBUG1(s,a) fprintf(stderr,s,a) -#define PR_DEBUG2(s,a,b) fprintf(stderr,s,a,b) -#else -#define PR_DEBUG(s) -#define PR_DEBUG1(s,a) -#define PR_DEBUG2(s,a,b) -#endif - /***====================================================================***/ #define DFLT_LINE_SIZE 128 @@ -171,8 +161,8 @@ Bool endOfFile,spacePending,slashPending,inComment; } if (checkbang && ch=='!') { if (line->num_line!=0) { - PR_DEBUG("The '!' legal only at start of line\n"); - PR_DEBUG("Line containing '!' ignored\n"); + DebugF("The '!' legal only at start of line\n"); + DebugF("Line containing '!' ignored\n"); line->num_line= 0; inComment= 0; break; @@ -273,9 +263,7 @@ unsigned present, l_ndx_present, v_ndx_present; register int i; int len, ndx; _Xstrtokparams strtok_buf; -#ifdef DEBUG Bool found; -#endif l_ndx_present = v_ndx_present = present= 0; @@ -284,9 +272,7 @@ Bool found; bzero((char *)remap,sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { -#ifdef DEBUG found= False; -#endif str= NULL; if (strcmp(tok,"=")==0) continue; @@ -299,22 +285,20 @@ Bool found; *end != '\0' || ndx == -1) break; if (ndx < 1 || ndx > XkbNumKbdGroups) { - PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx); - PR_DEBUG1("Index must be in range 1..%d\n", + DebugF("Illegal %s index: %d\n", cname[i], ndx); + DebugF("Index must be in range 1..%d\n", XkbNumKbdGroups); break; } } else { ndx = 0; } -#ifdef DEBUG found= True; -#endif if (present&(1<<i)) { if ((i == LAYOUT && l_ndx_present&(1<<ndx)) || (i == VARIANT && v_ndx_present&(1<<ndx)) ) { - PR_DEBUG1("Component \"%s\" listed twice\n",tok); - PR_DEBUG("Second definition ignored\n"); + DebugF("Component \"%s\" listed twice\n",tok); + DebugF("Second definition ignored\n"); break; } } @@ -328,38 +312,34 @@ Bool found; break; } } -#ifdef DEBUG if (!found) { fprintf(stderr,"Unknown component \"%s\" ignored\n",tok); } -#endif } if ((present&PART_MASK)==0) { -#ifdef DEBUG unsigned mask= PART_MASK; - fprintf(stderr,"Mapping needs at least one of "); + ErrorF("Mapping needs at least one of "); for (i=0; (i<MAX_WORDS); i++) { if ((1L<<i)&mask) { mask&= ~(1L<<i); - if (mask) fprintf(stderr,"\"%s,\" ",cname[i]); - else fprintf(stderr,"or \"%s\"\n",cname[i]); + if (mask) DebugF("\"%s,\" ",cname[i]); + else DebugF("or \"%s\"\n",cname[i]); } } - fprintf(stderr,"Illegal mapping ignored\n"); -#endif + DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if ((present&COMPONENT_MASK)==0) { - PR_DEBUG("Mapping needs at least one component\n"); - PR_DEBUG("Illegal mapping ignored\n"); + DebugF("Mapping needs at least one component\n"); + DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if (((present&COMPONENT_MASK)&(1<<KEYMAP))&& ((present&COMPONENT_MASK)!=(1<<KEYMAP))) { - PR_DEBUG("Keymap cannot appear with other components\n"); - PR_DEBUG("Illegal mapping ignored\n"); + DebugF("Keymap cannot appear with other components\n"); + DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } @@ -434,8 +414,8 @@ Bool append = False; } if (remap->num_remap==0) { - PR_DEBUG("Must have a mapping before first line of data\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Must have a mapping before first line of data\n"); + DebugF("Illegal line of data ignored\n"); return False; } bzero((char *)&tmp,sizeof(FileSpec)); @@ -447,8 +427,8 @@ Bool append = False; continue; } if (nread>remap->num_remap) { - PR_DEBUG("Too many words on a line\n"); - PR_DEBUG1("Extra word \"%s\" ignored\n",tok); + DebugF("Too many words on a line\n"); + DebugF("Extra word \"%s\" ignored\n",tok); continue; } tmp.name[remap->remap[nread].word]= tok; @@ -456,8 +436,8 @@ Bool append = False; append = True; } if (nread<remap->num_remap) { - PR_DEBUG1("Too few words on a line: %s\n", line->line); - PR_DEBUG("line ignored\n"); + DebugF("Too few words on a line: %s\n", line->line); + DebugF("line ignored\n"); return False; } @@ -479,7 +459,7 @@ Bool append = False; rule->types= _XkbDupString(tmp.name[TYPES]); rule->compat= _XkbDupString(tmp.name[COMPAT]); rule->geometry= _XkbDupString(tmp.name[GEOMETRY]); - rule->keymap= _XkbDupString(tmp.name[KEYMAP]); + rule->keymap= NULL; rule->layout_num = rule->variant_num = 0; for (i = 0; i < nread; i++) { @@ -609,7 +589,6 @@ XkbRF_ApplyRule( XkbRF_RulePtr rule, Apply(rule->types, &names->types); Apply(rule->compat, &names->compat); Apply(rule->geometry, &names->geometry); - Apply(rule->keymap, &names->keymap); } static Bool @@ -903,9 +882,7 @@ XkbRF_AddRule(XkbRF_RulesPtr rules) } if (!rules->rules) { rules->sz_rules= rules->num_rules= 0; -#ifdef DEBUG - fprintf(stderr,"Allocation failure in XkbRF_AddRule\n"); -#endif + DebugF("Allocation failure in XkbRF_AddRule\n"); return NULL; } bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec)); @@ -1022,7 +999,7 @@ XkbRF_AddVarDesc(XkbRF_DescribeVarsPtr vars) } if (!vars->desc) { vars->sz_desc= vars->num_desc= 0; - PR_DEBUG("Allocation failure in XkbRF_AddVarDesc\n"); + DebugF("Allocation failure in XkbRF_AddVarDesc\n"); return NULL; } vars->desc[vars->num_desc].name= NULL; @@ -1059,7 +1036,7 @@ XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name) XkbRF_DescribeVarsRec); } if ((!rules->extra_names)||(!rules->extra)) { - PR_DEBUG("allocation error in extra parts\n"); + DebugF("allocation error in extra parts\n"); rules->sz_extra= rules->num_extra= 0; rules->extra_names= NULL; rules->extra= NULL; @@ -1102,7 +1079,7 @@ int len,headingtype,extra_ndx = 0; } if (extra_ndx<0) { XkbRF_DescribeVarsPtr var; - PR_DEBUG1("Extra heading \"%s\" encountered\n",tok); + DebugF("Extra heading \"%s\" encountered\n",tok); var= XkbRF_AddVarToDescribe(rules,tok); if (var) extra_ndx= var-rules->extra; @@ -1113,20 +1090,20 @@ int len,headingtype,extra_ndx = 0; } if (headingtype == HEAD_NONE) { - PR_DEBUG("Must have a heading before first line of data\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Must have a heading before first line of data\n"); + DebugF("Illegal line of data ignored\n"); continue; } len = strlen(line.line); if ((tmp.name= strtok(line.line, " \t")) == NULL) { - PR_DEBUG("Huh? No token on line\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Huh? No token on line\n"); + DebugF("Illegal line of data ignored\n"); continue; } if (strlen(tmp.name) == len) { - PR_DEBUG("No description found\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("No description found\n"); + DebugF("Illegal line of data ignored\n"); continue; } @@ -1134,8 +1111,8 @@ int len,headingtype,extra_ndx = 0; while ((*tok!='\n')&&isspace(*tok)) tok++; if (*tok == '\0') { - PR_DEBUG("No description found\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("No description found\n"); + DebugF("Illegal line of data ignored\n"); continue; } tmp.desc= tok; @@ -1301,7 +1278,6 @@ XkbRF_GroupPtr group; if (rule->types) _XkbFree(rule->types); if (rule->compat) _XkbFree(rule->compat); if (rule->geometry) _XkbFree(rule->geometry); - if (rule->keymap) _XkbFree(rule->keymap); bzero((char *)rule,sizeof(XkbRF_RuleRec)); } _XkbFree(rules->rules); @@ -38,6 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XKBSRV_NEED_FILE_FUNCS #include <xkbsrv.h> #include "extnsionst.h" +#include "xace.h" #include "xkb.h" #include <X11/extensions/XI.h> @@ -45,7 +46,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. int XkbEventBase; static int XkbErrorBase; int XkbReqCode; -static int XkbKeyboardErrorCode; + int XkbKeyboardErrorCode; CARD32 xkbDebugFlags = 0; static CARD32 xkbDebugCtrls = 0; @@ -53,19 +54,23 @@ static RESTYPE RT_XKBCLIENT; /***====================================================================***/ -#define CHK_DEVICE(d,sp,lf) {\ +#define CHK_DEVICE(dev, id, client, access_mode, lf) {\ int why;\ - d = (DeviceIntPtr)lf((sp),&why);\ - if (!dev) {\ - client->errorValue = _XkbErrCode2(why,(sp));\ - return XkbKeyboardErrorCode;\ + int rc = lf(&(dev), id, client, access_mode, &why);\ + if (rc != Success) {\ + client->errorValue = _XkbErrCode2(why, id);\ + return rc;\ }\ } -#define CHK_KBD_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupKeyboard) -#define CHK_LED_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupLedDevice) -#define CHK_BELL_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupBellDevice) -#define CHK_ANY_DEVICE(d,sp) CHK_DEVICE(d,sp,_XkbLookupAnyDevice) +#define CHK_KBD_DEVICE(dev, id, client, mode) \ + CHK_DEVICE(dev, id, client, mode, _XkbLookupKeyboard) +#define CHK_LED_DEVICE(dev, id, client, mode) \ + CHK_DEVICE(dev, id, client, mode, _XkbLookupLedDevice) +#define CHK_BELL_DEVICE(dev, id, client, mode) \ + CHK_DEVICE(dev, id, client, mode, _XkbLookupBellDevice) +#define CHK_ANY_DEVICE(dev, id, client, mode) \ + CHK_DEVICE(dev, id, client, mode, _XkbLookupAnyDevice) #define CHK_ATOM_ONLY2(a,ev,er) {\ if (((a)==None)||(!ValidAtom((a)))) {\ @@ -206,7 +211,7 @@ ProcXkbSelectEvents(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_ANY_DEVICE(dev,stuff->deviceSpec); + CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixUseAccess); if (((stuff->affectWhich&XkbMapNotifyMask)!=0)&&(stuff->affectMap)) { client->mapNotifyMask&= ~stuff->affectMap; @@ -351,7 +356,7 @@ ProcXkbBell(ClientPtr client) REQUEST(xkbBellReq); DeviceIntPtr dev; WindowPtr pWin; - int base; + int rc, base; int newPercent,oldPitch,oldDuration; pointer ctrl; @@ -360,7 +365,7 @@ ProcXkbBell(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_BELL_DEVICE(dev,stuff->deviceSpec); + CHK_BELL_DEVICE(dev, stuff->deviceSpec, client, DixBellAccess); CHK_ATOM_OR_NONE(stuff->name); if ((stuff->forceSound)&&(stuff->eventOnly)) { @@ -448,10 +453,10 @@ ProcXkbBell(ClientPtr client) return BadValue; } if (stuff->window!=None) { - pWin= (WindowPtr)LookupIDByType(stuff->window,RT_WINDOW); - if (pWin==NULL) { + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) { client->errorValue= stuff->window; - return BadValue; + return rc; } } else pWin= NULL; @@ -499,7 +504,7 @@ ProcXkbGetState(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess); xkb= &dev->key->xkbInfo->state; bzero(&rep,sizeof(xkbGetStateReply)); @@ -544,7 +549,7 @@ ProcXkbLatchLockState(ClientPtr client) if (!(client->xkbClientFlags & _XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev, stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess); CHK_MASK_MATCH(0x01, stuff->affectModLocks, stuff->modLocks); CHK_MASK_MATCH(0x01, stuff->affectModLatches, stuff->modLatches); @@ -612,7 +617,7 @@ ProcXkbGetControls(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); xkb = dev->key->xkbInfo->desc->ctrls; rep.type = X_Reply; @@ -689,7 +694,7 @@ ProcXkbSetControls(ClientPtr client) if (!(client->xkbClientFlags & _XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev, stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); CHK_MASK_LEGAL(0x01, stuff->changeCtrls, XkbAllControlsMask); for (tmpd = inputInfo.keyboard; tmpd; tmpd = tmpd->next) { @@ -1370,7 +1375,7 @@ ProcXkbGetMap(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); CHK_MASK_OVERLAP(0x01,stuff->full,stuff->partial); CHK_MASK_LEGAL(0x02,stuff->full,XkbAllMapComponentsMask); CHK_MASK_LEGAL(0x03,stuff->partial,XkbAllMapComponentsMask); @@ -2299,7 +2304,7 @@ ProcXkbSetMap(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); CHK_MASK_LEGAL(0x01,stuff->present,XkbAllMapComponentsMask); XkbSetCauseXkbReq(&cause,X_kbSetMap,client); @@ -2569,7 +2574,7 @@ ProcXkbGetCompatMap(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); xkb = dev->key->xkbInfo->desc; compat= xkb->compat; @@ -2613,7 +2618,7 @@ ProcXkbSetCompatMap(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); data = (char *)&stuff[1]; xkbi = dev->key->xkbInfo; @@ -2748,7 +2753,7 @@ ProcXkbGetIndicatorState(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess); sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId, XkbXI_IndicatorStateMask); @@ -2859,7 +2864,7 @@ XkbIndicatorPtr leds; if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); xkb= dev->key->xkbInfo->desc; leds= xkb->indicators; @@ -2878,7 +2883,7 @@ int ProcXkbSetIndicatorMap(ClientPtr client) { register int i,bit; - int nIndicators,why; + int nIndicators; DeviceIntPtr dev; XkbSrvInfoPtr xkbi; xkbIndicatorMapWireDesc *from; @@ -2891,11 +2896,8 @@ ProcXkbSetIndicatorMap(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - dev = _XkbLookupKeyboard(stuff->deviceSpec,&why); - if (!dev) { - client->errorValue = _XkbErrCode2(why,stuff->deviceSpec); - return XkbKeyboardErrorCode; - } + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess); + xkbi= dev->key->xkbInfo; if (stuff->which==0) @@ -2971,7 +2973,7 @@ ProcXkbGetNamedIndicator(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_LED_DEVICE(dev,stuff->deviceSpec); + CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixReadAccess); CHK_ATOM_ONLY(stuff->indicator); sli= XkbFindSrvLedInfo(dev,stuff->ledClass,stuff->ledID,0); @@ -3057,7 +3059,7 @@ ProcXkbSetNamedIndicator(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_LED_DEVICE(dev,stuff->deviceSpec); + CHK_LED_DEVICE(dev, stuff->deviceSpec, client, DixSetAttrAccess); CHK_ATOM_ONLY(stuff->indicator); CHK_MASK_LEGAL(0x10,stuff->whichGroups,XkbIM_UseAnyGroup); CHK_MASK_LEGAL(0x11,stuff->whichMods,XkbIM_UseAnyMods); @@ -3125,7 +3127,7 @@ ProcXkbSetNamedIndicator(ClientPtr client) kbd= dev; if ((sli->flags&XkbSLI_HasOwnState)==0) - kbd= (DeviceIntPtr)LookupKeyboardDevice(); + kbd = inputInfo.keyboard; XkbFlushLedEvents(dev,kbd,sli,&ed,&changes,&cause); return client->noClientException; } @@ -3433,7 +3435,7 @@ ProcXkbGetNames(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask); xkb = dev->key->xkbInfo->desc; @@ -3543,7 +3545,7 @@ ProcXkbSetNames(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixUnknownAccess); CHK_MASK_LEGAL(0x01,stuff->which,XkbAllNamesMask); xkb = dev->key->xkbInfo->desc; @@ -3868,7 +3870,7 @@ ProcXkbSetNames(ClientPtr client) /***====================================================================***/ -#include <X11/extensions/XKBgeom.h> +#include "xkbgeom.h" #define XkbSizeCountedString(s) ((s)?((((2+strlen(s))+3)/4)*4):4) @@ -4379,7 +4381,7 @@ ProcXkbGetGeometry(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); CHK_ATOM_OR_NONE(stuff->name); geom= XkbLookupNamedGeometry(dev,stuff->name,&shouldFree); @@ -4842,7 +4844,7 @@ ProcXkbSetGeometry(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); CHK_ATOM_OR_NONE(stuff->name); xkb= dev->key->xkbInfo->desc; @@ -4897,6 +4899,7 @@ ProcXkbPerClientFlags(ClientPtr client) DeviceIntPtr dev; xkbPerClientFlagsReply rep; XkbInterestPtr interest; + Mask access_mode = DixGetAttrAccess | DixSetAttrAccess; REQUEST(xkbPerClientFlagsReq); REQUEST_SIZE_MATCH(xkbPerClientFlagsReq); @@ -4904,7 +4907,7 @@ ProcXkbPerClientFlags(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode); CHK_MASK_LEGAL(0x01,stuff->change,XkbPCF_AllFlagsMask); CHK_MASK_MATCH(0x02,stuff->change,stuff->value); @@ -5040,7 +5043,7 @@ ProcXkbListComponents(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); status= Success; str= (unsigned char *)&stuff[1]; @@ -5106,7 +5109,6 @@ ProcXkbGetKbdByName(ClientPtr client) { DeviceIntPtr dev; DeviceIntPtr tmpd; - XkbFileInfo finfo; xkbGetKbdByNameReply rep; xkbGetMapReply mrep; xkbGetCompatMapReply crep; @@ -5114,7 +5116,7 @@ ProcXkbGetKbdByName(ClientPtr client) xkbGetNamesReply nrep; xkbGetGeometryReply grep; XkbComponentNamesRec names; - XkbDescPtr xkb; + XkbDescPtr xkb, new; unsigned char * str; char mapFile[PATH_MAX]; unsigned len; @@ -5123,6 +5125,7 @@ ProcXkbGetKbdByName(ClientPtr client) Bool geom_changed; XkbSrvLedInfoPtr old_sli; XkbSrvLedInfoPtr sli; + Mask access_mode = DixGetAttrAccess | DixManageAccess; REQUEST(xkbGetKbdByNameReq); REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq); @@ -5130,7 +5133,7 @@ ProcXkbGetKbdByName(ClientPtr client) if (!(client->xkbClientFlags&_XkbClientInitialized)) return BadAccess; - CHK_KBD_DEVICE(dev,stuff->deviceSpec); + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode); xkb = dev->key->xkbInfo->desc; status= Success; @@ -5153,25 +5156,20 @@ ProcXkbGetKbdByName(ClientPtr client) if (stuff->load) fwant= XkbGBN_AllComponentsMask; else fwant= stuff->want|stuff->need; - if (!names.keymap) { - if ((!names.compat)&& - (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) { - names.compat= _XkbDupString("%"); - } - if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) { - names.types= _XkbDupString("%"); - } - if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) { - names.symbols= _XkbDupString("%"); - } - geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0)); - if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) { - names.geometry= _XkbDupString("%"); - geom_changed= False; - } + if ((!names.compat)&& + (fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) { + names.compat= _XkbDupString("%"); } - else { - geom_changed= True; + if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) { + names.types= _XkbDupString("%"); + } + if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) { + names.symbols= _XkbDupString("%"); + } + geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0)); + if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) { + names.geometry= _XkbDupString("%"); + geom_changed= False; } bzero(mapFile,PATH_MAX); @@ -5195,35 +5193,35 @@ ProcXkbGetKbdByName(ClientPtr client) } /* We pass dev in here so we can get the old names out if needed. */ - rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&finfo, + rep.found = XkbDDXLoadKeymapByNames(dev,&names,fwant,fneed,&new, mapFile,PATH_MAX); rep.newKeyboard= False; rep.pad1= rep.pad2= rep.pad3= rep.pad4= 0; stuff->want|= stuff->need; - if (finfo.xkb==NULL) + if (new==NULL) rep.reported= 0; else { if (stuff->load) rep.loaded= True; if (stuff->load || - ((rep.reported&XkbGBN_SymbolsMask) && (finfo.xkb->compat))) { + ((rep.reported&XkbGBN_SymbolsMask) && (new->compat))) { XkbChangesRec changes; bzero(&changes,sizeof(changes)); - XkbUpdateDescActions(finfo.xkb, - finfo.xkb->min_key_code,XkbNumKeys(finfo.xkb), + XkbUpdateDescActions(new, + new->min_key_code,XkbNumKeys(new), &changes); } - if (finfo.xkb->map==NULL) + if (new->map==NULL) rep.reported&= ~(XkbGBN_SymbolsMask|XkbGBN_TypesMask); else if (rep.reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) { mrep.type= X_Reply; mrep.deviceID = dev->id; mrep.sequenceNumber= client->sequence; mrep.length = ((SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply))>>2); - mrep.minKeyCode = finfo.xkb->min_key_code; - mrep.maxKeyCode = finfo.xkb->max_key_code; + mrep.minKeyCode = new->min_key_code; + mrep.maxKeyCode = new->max_key_code; mrep.present = 0; mrep.totalSyms = mrep.totalActs = mrep.totalKeyBehaviors= mrep.totalKeyExplicit= @@ -5231,7 +5229,7 @@ ProcXkbGetKbdByName(ClientPtr client) if (rep.reported&(XkbGBN_TypesMask|XkbGBN_ClientSymbolsMask)) { mrep.present|= XkbKeyTypesMask; mrep.firstType = 0; - mrep.nTypes = mrep.totalTypes= finfo.xkb->map->num_types; + mrep.nTypes = mrep.totalTypes= new->map->num_types; } else { mrep.firstType = mrep.nTypes= 0; @@ -5239,8 +5237,8 @@ ProcXkbGetKbdByName(ClientPtr client) } if (rep.reported&XkbGBN_ClientSymbolsMask) { mrep.present|= (XkbKeySymsMask|XkbModifierMapMask); - mrep.firstKeySym = mrep.firstModMapKey= finfo.xkb->min_key_code; - mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(finfo.xkb); + mrep.firstKeySym = mrep.firstModMapKey= new->min_key_code; + mrep.nKeySyms = mrep.nModMapKeys= XkbNumKeys(new); } else { mrep.firstKeySym= mrep.firstModMapKey= 0; @@ -5250,9 +5248,9 @@ ProcXkbGetKbdByName(ClientPtr client) mrep.present|= XkbAllServerInfoMask; mrep.virtualMods= ~0; mrep.firstKeyAct = mrep.firstKeyBehavior = - mrep.firstKeyExplicit = finfo.xkb->min_key_code; + mrep.firstKeyExplicit = new->min_key_code; mrep.nKeyActs = mrep.nKeyBehaviors = - mrep.nKeyExplicit = XkbNumKeys(finfo.xkb); + mrep.nKeyExplicit = XkbNumKeys(new); } else { mrep.virtualMods= 0; @@ -5260,10 +5258,10 @@ ProcXkbGetKbdByName(ClientPtr client) mrep.firstKeyExplicit = 0; mrep.nKeyActs= mrep.nKeyBehaviors= mrep.nKeyExplicit= 0; } - XkbComputeGetMapReplySize(finfo.xkb,&mrep); + XkbComputeGetMapReplySize(new,&mrep); rep.length+= SIZEOF(xGenericReply)/4+mrep.length; } - if (finfo.xkb->compat==NULL) + if (new->compat==NULL) rep.reported&= ~XkbGBN_CompatMapMask; else if (rep.reported&XkbGBN_CompatMapMask) { crep.type= X_Reply; @@ -5272,11 +5270,11 @@ ProcXkbGetKbdByName(ClientPtr client) crep.length= 0; crep.groups= XkbAllGroupsMask; crep.firstSI= 0; - crep.nSI= crep.nTotalSI= finfo.xkb->compat->num_si; - XkbComputeGetCompatMapReplySize(finfo.xkb->compat,&crep); + crep.nSI= crep.nTotalSI= new->compat->num_si; + XkbComputeGetCompatMapReplySize(new->compat,&crep); rep.length+= SIZEOF(xGenericReply)/4+crep.length; } - if (finfo.xkb->indicators==NULL) + if (new->indicators==NULL) rep.reported&= ~XkbGBN_IndicatorMapMask; else if (rep.reported&XkbGBN_IndicatorMapMask) { irep.type= X_Reply; @@ -5284,28 +5282,28 @@ ProcXkbGetKbdByName(ClientPtr client) irep.sequenceNumber= client->sequence; irep.length= 0; irep.which= XkbAllIndicatorsMask; - XkbComputeGetIndicatorMapReplySize(finfo.xkb->indicators,&irep); + XkbComputeGetIndicatorMapReplySize(new->indicators,&irep); rep.length+= SIZEOF(xGenericReply)/4+irep.length; } - if (finfo.xkb->names==NULL) + if (new->names==NULL) rep.reported&= ~(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask); else if (rep.reported&(XkbGBN_OtherNamesMask|XkbGBN_KeyNamesMask)) { nrep.type= X_Reply; nrep.deviceID= dev->id; nrep.sequenceNumber= client->sequence; nrep.length= 0; - nrep.minKeyCode= finfo.xkb->min_key_code; - nrep.maxKeyCode= finfo.xkb->max_key_code; + nrep.minKeyCode= new->min_key_code; + nrep.maxKeyCode= new->max_key_code; if (rep.reported&XkbGBN_OtherNamesMask) { nrep.which= XkbAllNamesMask; - if (finfo.xkb->map!=NULL) - nrep.nTypes= finfo.xkb->map->num_types; + if (new->map!=NULL) + nrep.nTypes= new->map->num_types; else nrep.nTypes= 0; nrep.nKTLevels= 0; nrep.groupNames= XkbAllGroupsMask; nrep.virtualMods= XkbAllVirtualModsMask; nrep.indicators= XkbAllIndicatorsMask; - nrep.nRadioGroups= finfo.xkb->names->num_rg; + nrep.nRadioGroups= new->names->num_rg; } else { nrep.which= 0; @@ -5318,9 +5316,9 @@ ProcXkbGetKbdByName(ClientPtr client) } if (rep.reported&XkbGBN_KeyNamesMask) { nrep.which|= XkbKeyNamesMask; - nrep.firstKey= finfo.xkb->min_key_code; - nrep.nKeys= XkbNumKeys(finfo.xkb); - nrep.nKeyAliases= finfo.xkb->names->num_key_aliases; + nrep.firstKey= new->min_key_code; + nrep.nKeys= XkbNumKeys(new); + nrep.nKeyAliases= new->names->num_key_aliases; if (nrep.nKeyAliases) nrep.which|= XkbKeyAliasesMask; } @@ -5329,10 +5327,10 @@ ProcXkbGetKbdByName(ClientPtr client) nrep.firstKey= nrep.nKeys= 0; nrep.nKeyAliases= 0; } - XkbComputeGetNamesReplySize(finfo.xkb,&nrep); + XkbComputeGetNamesReplySize(new,&nrep); rep.length+= SIZEOF(xGenericReply)/4+nrep.length; } - if (finfo.xkb->geom==NULL) + if (new->geom==NULL) rep.reported&= ~XkbGBN_GeometryMask; else if (rep.reported&XkbGBN_GeometryMask) { grep.type= X_Reply; @@ -5345,7 +5343,7 @@ ProcXkbGetKbdByName(ClientPtr client) grep.nProperties= grep.nColors= grep.nShapes= 0; grep.nSections= grep.nDoodads= 0; grep.baseColorNdx= grep.labelColorNdx= 0; - XkbComputeGetGeometryReplySize(finfo.xkb->geom,&grep,None); + XkbComputeGetGeometryReplySize(new->geom,&grep,None); rep.length+= SIZEOF(xGenericReply)/4+grep.length; } } @@ -5360,23 +5358,23 @@ ProcXkbGetKbdByName(ClientPtr client) } WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), (char *)&rep); if (reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) - XkbSendMap(client,finfo.xkb,&mrep); + XkbSendMap(client,new,&mrep); if (reported&XkbGBN_CompatMapMask) - XkbSendCompatMap(client,finfo.xkb->compat,&crep); + XkbSendCompatMap(client,new->compat,&crep); if (reported&XkbGBN_IndicatorMapMask) - XkbSendIndicatorMap(client,finfo.xkb->indicators,&irep); + XkbSendIndicatorMap(client,new->indicators,&irep); if (reported&(XkbGBN_KeyNamesMask|XkbGBN_OtherNamesMask)) - XkbSendNames(client,finfo.xkb,&nrep); + XkbSendNames(client,new,&nrep); if (reported&XkbGBN_GeometryMask) - XkbSendGeometry(client,finfo.xkb->geom,&grep,False); + XkbSendGeometry(client,new->geom,&grep,False); if (rep.loaded) { XkbDescPtr old_xkb; xkbNewKeyboardNotify nkn; int i,nG,nTG; old_xkb= xkb; - xkb= finfo.xkb; + xkb= new; dev->key->xkbInfo->desc= xkb; - finfo.xkb= old_xkb; /* so it'll get freed automatically */ + new= old_xkb; /* so it'll get freed automatically */ *xkb->ctrls= *old_xkb->ctrls; for (nG=nTG=0,i=xkb->min_key_code;i<=xkb->max_key_code;i++) { @@ -5420,8 +5418,8 @@ ProcXkbGetKbdByName(ClientPtr client) /* this should be either a MN or an NKN, depending on whether or not * the keycode range changed? */ nkn.deviceID= nkn.oldDeviceID= dev->id; - nkn.minKeyCode= finfo.xkb->min_key_code; - nkn.maxKeyCode= finfo.xkb->max_key_code; + nkn.minKeyCode= new->min_key_code; + nkn.maxKeyCode= new->max_key_code; nkn.oldMinKeyCode= xkb->min_key_code; nkn.oldMaxKeyCode= xkb->max_key_code; nkn.requestMajor= XkbReqCode; @@ -5431,9 +5429,9 @@ ProcXkbGetKbdByName(ClientPtr client) nkn.changed|= XkbNKN_GeometryMask; XkbSendNewKeyboardNotify(dev,&nkn); } - if ((finfo.xkb!=NULL)&&(finfo.xkb!=xkb)) { - XkbFreeKeyboard(finfo.xkb,XkbAllComponentsMask,True); - finfo.xkb= NULL; + if ((new!=NULL)&&(new!=xkb)) { + XkbFreeKeyboard(new,XkbAllComponentsMask,True); + new= NULL; } if (names.keymap) { _XkbFree(names.keymap); names.keymap= NULL; } if (names.keycodes) { _XkbFree(names.keycodes); names.keycodes= NULL; } @@ -5664,7 +5662,7 @@ char * str; wanted= stuff->wanted; - CHK_ANY_DEVICE(dev,stuff->deviceSpec); + CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess); CHK_MASK_LEGAL(0x01,wanted,XkbXI_AllDeviceFeaturesMask); if ((!dev->button)||((stuff->nBtns<1)&&(!stuff->allBtns))) @@ -5780,10 +5778,8 @@ char * str; return status; } else if (length!=0) { -#ifdef DEBUG ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n"); ErrorF(" Wrote %d fewer bytes than expected\n",length); -#endif return BadLength; } if (stuff->wanted&(~supported)) { @@ -5968,7 +5964,7 @@ DeviceIntPtr kbd; kbd= dev; if ((sli->flags&XkbSLI_HasOwnState)==0) - kbd= (DeviceIntPtr)LookupKeyboardDevice(); + kbd = inputInfo.keyboard; XkbFlushLedEvents(dev,kbd,sli,&ed,&changes,&cause); ledWire= (xkbDeviceLedsWireDesc *)mapWire; @@ -5993,7 +5989,7 @@ xkbExtensionDeviceNotify ed; change= stuff->change; - CHK_ANY_DEVICE(dev,stuff->deviceSpec); + CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); CHK_MASK_LEGAL(0x01,change,XkbXI_AllFeaturesMask); wire= (char *)&stuff[1]; @@ -6043,7 +6039,7 @@ xkbExtensionDeviceNotify ed; ed.nBtns= stuff->nBtns; if (dev->key) kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + else kbd= inputInfo.keyboard; acts= &dev->button->xkb_acts[stuff->firstBtn]; for (i=0;i<stuff->nBtns;i++,acts++) { if (acts->type!=XkbSA_NoAction) @@ -6069,10 +6065,15 @@ ProcXkbSetDebuggingFlags(ClientPtr client) { CARD32 newFlags,newCtrls,extraLength; xkbSetDebuggingFlagsReply rep; +int rc; REQUEST(xkbSetDebuggingFlagsReq); REQUEST_AT_LEAST_SIZE(xkbSetDebuggingFlagsReq); + rc = XaceHook(XACE_SERVER_ACCESS, client, DixDebugAccess); + if (rc != Success) + return rc; + newFlags= xkbDebugFlags&(~stuff->affectFlags); newFlags|= (stuff->flags&stuff->affectFlags); newCtrls= xkbDebugCtrls&(~stuff->affectCtrls); @@ -1,4 +1,5 @@ -/* #include "XKBfile.h" */ +#ifndef _XKB_H +#define _XKB_H extern int ProcXkbUseExtension(ClientPtr client); extern int ProcXkbSelectEvents(ClientPtr client); @@ -35,3 +36,5 @@ extern Bool XkbCopyKeymap( XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies); + +#endif diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index 43b82e162..75b8c5a27 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -130,11 +130,9 @@ xEvent xE; xE.u.u.type = type; xE.u.u.detail = keyCode; xE.u.keyButtonPointer.time = GetTimeInMillis(); -#ifdef DEBUG if (xkbDebugFlags&0x8) { - ErrorF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); + DebugF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); } -#endif if (_XkbIsPressEvent(type)) XkbDDXKeyClick(keybd,keyCode,TRUE); @@ -533,10 +531,8 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key); ((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))== XkbRepeatKeysMask)) { if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) { -#ifdef DEBUG if (xkbDebugFlags&0x10) - ErrorF("Starting software autorepeat...\n"); -#endif + DebugF("Starting software autorepeat...\n"); xkbi->repeatKey = key; xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer, 0, ctrls->repeat_delay, @@ -694,7 +690,7 @@ ProcessPointerEvent( register xEvent * xE, register DeviceIntPtr mouse, int count) { -DeviceIntPtr dev = (DeviceIntPtr)LookupKeyboardDevice(); +DeviceIntPtr dev = inputInfo.keyboard; XkbSrvInfoPtr xkbi = dev->key->xkbInfo; unsigned changed = 0; ProcessInputProc backupproc; diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 8ddbdba3d..890cf4250 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -42,8 +42,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <ctype.h> #define EXTENSION_EVENT_BASE 64 -static unsigned int _xkbServerGeneration; -int xkbDevicePrivateIndex = -1; +DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKey; void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, @@ -67,20 +66,12 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc) { xkbDeviceInfoPtr xkbPrivPtr; - if (serverGeneration != _xkbServerGeneration) { - if ((xkbDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1) - return; - _xkbServerGeneration = serverGeneration; - } - if (!AllocateDevicePrivate(device, xkbDevicePrivateIndex)) - return; - xkbPrivPtr = (xkbDeviceInfoPtr) xcalloc(1, sizeof(xkbDeviceInfoRec)); if (!xkbPrivPtr) return; xkbPrivPtr->unwrapProc = NULL; - device->devPrivates[xkbDevicePrivateIndex].ptr = xkbPrivPtr; + dixSetPrivate(&device->devPrivates, xkbDevicePrivateKey, xkbPrivPtr); WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, proc, xkbUnwrapProc); } @@ -561,6 +552,9 @@ _XkbFilterPointerMove( XkbSrvInfoPtr xkbi, int x,y; Bool accel; + if (xkbi->device == inputInfo.keyboard) + return 0; + if (filter->keycode==0) { /* initial press */ filter->keycode = keycode; filter->active = 1; @@ -601,6 +595,9 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi, unsigned keycode, XkbAction * pAction) { + if (xkbi->device == inputInfo.keyboard) + return 0; + if (filter->keycode==0) { /* initial press */ int button= pAction->btn.button; @@ -846,7 +843,7 @@ _XkbFilterRedirectKey( XkbSrvInfoPtr xkbi, unsigned keycode, XkbAction * pAction) { -unsigned realMods; +unsigned realMods = 0; xEvent ev; int x,y; XkbStateRec old; @@ -980,8 +977,11 @@ _XkbFilterSwitchScreen( XkbSrvInfoPtr xkbi, unsigned keycode, XkbAction * pAction) { + DeviceIntPtr dev = xkbi->device; + if (dev == inputInfo.keyboard) + return 0; + if (filter->keycode==0) { /* initial press */ - DeviceIntPtr dev = xkbi->device; filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; @@ -1003,8 +1003,11 @@ _XkbFilterXF86Private( XkbSrvInfoPtr xkbi, unsigned keycode, XkbAction * pAction) { + DeviceIntPtr dev = xkbi->device; + if (dev == inputInfo.keyboard) + return 0; + if (filter->keycode==0) { /* initial press */ - DeviceIntPtr dev = xkbi->device; filter->keycode = keycode; filter->active = 1; filter->filterOthers = 0; @@ -1029,9 +1032,13 @@ _XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi, DeviceIntPtr dev; int button; + if (dev == inputInfo.keyboard) + return 0; + if (filter->keycode==0) { /* initial press */ - dev= _XkbLookupButtonDevice(pAction->devbtn.device,NULL); - if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice())) + _XkbLookupButtonDevice(&dev, pAction->devbtn.device, serverClient, + DixUnknownAccess, &button); + if (!dev || !dev->public.on || dev == inputInfo.pointer) return 1; button= pAction->devbtn.button; @@ -1070,8 +1077,9 @@ int button; int button; filter->active= 0; - dev= _XkbLookupButtonDevice(filter->upAction.devbtn.device,NULL); - if ((!dev)||(!dev->public.on)||(&dev->public==LookupPointerDevice())) + _XkbLookupButtonDevice(&dev, filter->upAction.devbtn.device, + serverClient, DixUnknownAccess, &button); + if (!dev || !dev->public.on || dev == inputInfo.pointer) return 1; button= filter->upAction.btn.button; @@ -1137,7 +1145,7 @@ void XkbHandleActions(DeviceIntPtr dev,DeviceIntPtr kbd,xEvent *xE,int count) { int key,bit,i; -CARD8 realMods; +CARD8 realMods = 0; XkbSrvInfoPtr xkbi; KeyClassPtr keyc; int changed,sendEvent; diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index bf3e828f3..49725d065 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -808,28 +808,26 @@ Bool XkbFilterEvents(ClientPtr pClient,int nEvents,xEvent *xE) { int i, button_mask; -DeviceIntPtr pXDev = (DeviceIntPtr)LookupKeyboardDevice(); +DeviceIntPtr pXDev = inputInfo.keyboard; XkbSrvInfoPtr xkbi; xkbi= pXDev->key->xkbInfo; if ( pClient->xkbClientFlags & _XkbClientInitialized ) { -#ifdef DEBUG if ((xkbDebugFlags&0x10)&& ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)|| (xE[0].u.u.type==DeviceKeyPress)|| (xE[0].u.u.type == DeviceKeyRelease))) { - ErrorF("XKbFilterWriteEvents:\n"); - ErrorF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); - ErrorF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n", + DebugF("XKbFilterWriteEvents:\n"); + DebugF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); + DebugF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n", XkbLastRepeatEvent,xE, ((XkbLastRepeatEvent!=(pointer)xE)?"True":"False")); - ErrorF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", + DebugF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", pClient->xkbClientFlags, (_XkbWantsDetectableAutoRepeat(pClient)?"True":"False")); - ErrorF(" !IsRelease(%d) %s\n",xE[0].u.u.type, + DebugF(" !IsRelease(%d) %s\n",xE[0].u.u.type, (!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False"); } -#endif /* DEBUG */ if ( (XkbLastRepeatEvent==(pointer)xE) && (_XkbWantsDetectableAutoRepeat(pClient)) && (_XkbIsReleaseEvent(xE[0].u.u.type)) ) { @@ -866,13 +864,11 @@ XkbSrvInfoPtr xkbi; if (xE[0].u.u.type == ButtonPress && ((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG /* If the MouseKeys is pressed, and the "real" mouse is also pressed * when the mouse is released, the server does not behave properly. * Faking a release of the button here solves the problem. */ - ErrorF("Faking release of button %d\n", xE[0].u.u.detail); -#endif + DebugF("Faking release of button %d\n", xE[0].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail); } } @@ -881,21 +877,19 @@ XkbSrvInfoPtr xkbi; for (i=0;i<nEvents;i++) { type= xE[i].u.u.type; -#ifdef DEBUG if ((xkbDebugFlags&0x4)&& ((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)|| (xE[i].u.u.type==DeviceKeyPress)|| (xE[i].u.u.type == DeviceKeyRelease))) { XkbStatePtr s= &xkbi->state; - ErrorF("XKbFilterWriteEvents (non-XKB):\n"); - ErrorF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state); - ErrorF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods, + DebugF("XKbFilterWriteEvents (non-XKB):\n"); + DebugF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state); + DebugF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods, s->grab_mods); - ErrorF("compat lookup= 0x%02x, grab= 0x%02x\n", + DebugF("compat lookup= 0x%02x, grab= 0x%02x\n", s->compat_lookup_mods, s->compat_grab_mods); } -#endif if ( (type>=KeyPress)&&(type<=MotionNotify) ) { CARD16 old,new; @@ -924,16 +918,12 @@ XkbSrvInfoPtr xkbi; if (type == ButtonPress && ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG - ErrorF("Faking release of button %d\n", xE[i].u.u.detail); -#endif + DebugF("Faking release of button %d\n", xE[i].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail); } else if (type == DeviceButtonPress && ((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG - ErrorF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state); -#endif + DebugF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state); XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state); } } diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 6301a32e7..2b5f1fb68 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -48,9 +48,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "property.h" #define XKBSRV_NEED_FILE_FUNCS #include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> +#include "xkbgeom.h" #include <X11/extensions/XKMformat.h> -#include <X11/extensions/XKBfile.h> +#include "xkbfile.h" #include "xkb.h" #define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1) @@ -88,7 +88,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. typedef struct _SrvXkmInfo { DeviceIntPtr dev; FILE * file; - XkbFileInfo xkbinfo; + XkbDescPtr xkb; } SrvXkmInfo; @@ -125,7 +125,6 @@ typedef struct _SrvXkmInfo { char * XkbBaseDirectory= XKB_BASE_DIRECTORY; char * XkbBinDirectory= XKB_BIN_DIRECTORY; static int XkbWantAccessX= 0; -static XkbFileInfo * _XkbInitFileInfo= NULL; static Bool rulesDefined= False; static char * XkbRulesFile= NULL; @@ -139,6 +138,8 @@ static char * XkbLayoutUsed= NULL; static char * XkbVariantUsed= NULL; static char * XkbOptionsUsed= NULL; +static XkbDescPtr xkb_cached_map = NULL; + _X_EXPORT Bool noXkbExtension= XKB_DFLT_DISABLED; static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; @@ -280,17 +281,14 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, /***====================================================================***/ -#if defined(luna) -#define XKB_DDX_PERMANENT_LOCK 1 -#endif - #include "xkbDflts.h" static Bool -XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) +XkbInitKeyTypes(XkbDescPtr xkb) { - if (file->xkbinfo.defined&XkmTypesMask) - return True; + if (xkb->defined & XkmTypesMask) + return True; + initTypeNames(NULL); if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_dflt_types)!=Success) return False; @@ -303,7 +301,7 @@ XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) } static void -XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file) +XkbInitRadioGroups(XkbSrvInfoPtr xkbi) { xkbi->nRadioGroups = 0; xkbi->radioGroups = NULL; @@ -312,13 +310,14 @@ XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file) static Status -XkbInitCompatStructs(XkbDescPtr xkb,SrvXkmInfo *file) +XkbInitCompatStructs(XkbDescPtr xkb) { register int i; XkbCompatMapPtr compat; - if (file->xkbinfo.defined&XkmCompatMapMask) - return Success; + if (xkb->defined & XkmCompatMapMask) + return True; + if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_dfltSI)!=Success) return BadAlloc; compat = xkb->compat; @@ -339,17 +338,17 @@ XkbCompatMapPtr compat; } static void -XkbInitSemantics(XkbDescPtr xkb,SrvXkmInfo *file) +XkbInitSemantics(XkbDescPtr xkb) { - XkbInitKeyTypes(xkb,file); - XkbInitCompatStructs(xkb,file); + XkbInitKeyTypes(xkb); + XkbInitCompatStructs(xkb); return; } /***====================================================================***/ static Status -XkbInitNames(XkbSrvInfoPtr xkbi,SrvXkmInfo *file) +XkbInitNames(XkbSrvInfoPtr xkbi) { XkbDescPtr xkb; XkbNamesPtr names; @@ -367,46 +366,38 @@ Atom unknown; if (names->symbols==None) names->symbols= unknown; if (names->types==None) names->types= unknown; if (names->compat==None) names->compat= unknown; - if ((file->xkbinfo.defined&XkmVirtualModsMask)==0) { - if (names->vmods[vmod_NumLock]==None) - names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock"); - if (names->vmods[vmod_Alt]==None) - names->vmods[vmod_Alt]= CREATE_ATOM("Alt"); - if (names->vmods[vmod_AltGr]==None) - names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch"); - } - - if (((file->xkbinfo.defined&XkmIndicatorsMask)==0)|| - ((file->xkbinfo.defined&XkmGeometryMask)==0)) { - initIndicatorNames(NULL,xkb); - if (names->indicators[LED_CAPS-1]==None) - names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock"); - if (names->indicators[LED_NUM-1]==None) - names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock"); - if (names->indicators[LED_SCROLL-1]==None) - names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock"); + if (!(xkb->defined & XkmVirtualModsMask)) { + if (names->vmods[vmod_NumLock]==None) + names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock"); + if (names->vmods[vmod_Alt]==None) + names->vmods[vmod_Alt]= CREATE_ATOM("Alt"); + if (names->vmods[vmod_AltGr]==None) + names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch"); + } + + if (!(xkb->defined & XkmIndicatorsMask)) { + initIndicatorNames(NULL,xkb); + if (names->indicators[LED_CAPS-1]==None) + names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock"); + if (names->indicators[LED_NUM-1]==None) + names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock"); + if (names->indicators[LED_SCROLL-1]==None) + names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock"); #ifdef LED_COMPOSE - if (names->indicators[LED_COMPOSE-1]==None) - names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose"); + if (names->indicators[LED_COMPOSE-1]==None) + names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose"); #endif } -#ifdef DEBUG_RADIO_GROUPS - if (names->num_rg<1) { - names->radio_groups= (Atom *)_XkbCalloc(RG_COUNT, sizeof(Atom)); - if (names->radio_groups) { - names->num_rg = RG_COUNT; - names->radio_groups[RG_BOGUS_FUNCTION_GROUP]= CREATE_ATOM("BOGUS"); - } - } -#endif + if (xkb->geom!=NULL) names->geometry= xkb->geom->name; else names->geometry= unknown; + return Success; } static Status -XkbInitIndicatorMap(XkbSrvInfoPtr xkbi,SrvXkmInfo *file) +XkbInitIndicatorMap(XkbSrvInfoPtr xkbi) { XkbDescPtr xkb; XkbIndicatorPtr map; @@ -415,35 +406,36 @@ XkbSrvLedInfoPtr sli; xkb= xkbi->desc; if (XkbAllocIndicatorMaps(xkb)!=Success) return BadAlloc; - if ((file->xkbinfo.defined&XkmIndicatorsMask)==0) { - map= xkb->indicators; - map->phys_indicators = PHYS_LEDS; - map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit; - map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked; - map->maps[LED_CAPS-1].mods.mask= LockMask; - map->maps[LED_CAPS-1].mods.real_mods= LockMask; - - map->maps[LED_NUM-1].flags= XkbIM_NoExplicit; - map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked; - map->maps[LED_NUM-1].mods.mask= 0; - map->maps[LED_NUM-1].mods.real_mods= 0; - map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask; - -/* Metro Link */ - map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit; - map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked; - map->maps[LED_SCROLL-1].mods.mask= Mod3Mask; - map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask; -/* Metro Link */ + + if (!(xkb->defined & XkmIndicatorsMask)) { + map= xkb->indicators; + map->phys_indicators = PHYS_LEDS; + map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit; + map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked; + map->maps[LED_CAPS-1].mods.mask= LockMask; + map->maps[LED_CAPS-1].mods.real_mods= LockMask; + + map->maps[LED_NUM-1].flags= XkbIM_NoExplicit; + map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked; + map->maps[LED_NUM-1].mods.mask= 0; + map->maps[LED_NUM-1].mods.real_mods= 0; + map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask; + + map->maps[LED_SCROLL-1].flags= XkbIM_NoExplicit; + map->maps[LED_SCROLL-1].which_mods= XkbIM_UseLocked; + map->maps[LED_SCROLL-1].mods.mask= Mod3Mask; + map->maps[LED_SCROLL-1].mods.real_mods= Mod3Mask; } + sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0); if (sli) XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); + return Success; } static Status -XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi,SrvXkmInfo *file) +XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi) { XkbDescPtr xkb; XkbControlsPtr ctrls; @@ -453,8 +445,8 @@ XkbControlsPtr ctrls; if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success) FatalError("Couldn't allocate keyboard controls\n"); ctrls= xkb->ctrls; - if ((file->xkbinfo.defined&XkmSymbolsMask)==0) - ctrls->num_groups = 1; + if (!(xkb->defined & XkmSymbolsMask)) + ctrls->num_groups = 1; ctrls->groups_wrap = XkbSetGroupInfo(1,XkbWrapIntoRange,0); ctrls->internal.mask = 0; ctrls->internal.real_mods = 0; @@ -477,29 +469,25 @@ XkbInitDevice(DeviceIntPtr pXDev) int i; XkbSrvInfoPtr xkbi; XkbChangesRec changes; -SrvXkmInfo file; unsigned check; XkbEventCauseRec cause; - file.dev= pXDev; - file.file=NULL; - bzero(&file.xkbinfo,sizeof(XkbFileInfo)); bzero(&changes,sizeof(XkbChangesRec)); pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec); if ( xkbi ) { XkbDescPtr xkb; - if ((_XkbInitFileInfo!=NULL)&&(_XkbInitFileInfo->xkb!=NULL)) { - file.xkbinfo= *_XkbInitFileInfo; - xkbi->desc= _XkbInitFileInfo->xkb; - _XkbInitFileInfo= NULL; - } - else { - xkbi->desc= XkbAllocKeyboard(); - if (!xkbi->desc) - FatalError("Couldn't allocate keyboard description\n"); - xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode; - xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode; - } + + if (xkb_cached_map) { + xkbi->desc = xkb_cached_map; + xkb_cached_map = NULL; + } + else { + xkbi->desc= XkbAllocKeyboard(); + if (!xkbi->desc) + FatalError("Couldn't allocate keyboard description\n"); + xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode; + xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode; + } xkb= xkbi->desc; if (xkb->min_key_code == 0) xkb->min_key_code = pXDev->key->curKeySyms.minKeyCode; @@ -522,32 +510,32 @@ XkbEventCauseRec cause; xkbi->dfltPtrDelta=1; xkbi->device = pXDev; - file.xkbinfo.xkb= xkb; - XkbInitSemantics(xkb,&file); - XkbInitNames(xkbi,&file); - XkbInitRadioGroups(xkbi,&file); + XkbInitSemantics(xkb); + XkbInitNames(xkbi); + XkbInitRadioGroups(xkbi); /* 12/31/94 (ef) -- XXX! Should check if state loaded from file */ bzero(&xkbi->state,sizeof(XkbStateRec)); - XkbInitControls(pXDev,xkbi,&file); + XkbInitControls(pXDev,xkbi); - if (file.xkbinfo.defined&XkmSymbolsMask) - memcpy(pXDev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1); - else - memcpy(xkb->map->modmap,pXDev->key->modifierMap,xkb->max_key_code+1); + if (xkb->defined & XkmSymbolsMask) + memcpy(pXDev->key->modifierMap, xkb->map->modmap, + xkb->max_key_code + 1); + else + memcpy(xkb->map->modmap, pXDev->key->modifierMap, + xkb->max_key_code + 1); - XkbInitIndicatorMap(xkbi,&file); + XkbInitIndicatorMap(xkbi); XkbDDXInitDevice(pXDev); - if (!(file.xkbinfo.defined&XkmSymbolsMask)) { - XkbUpdateKeyTypesFromCore(pXDev,xkb->min_key_code,XkbNumKeys(xkb), - &changes); - } - else { - XkbUpdateCoreDescription(pXDev,True); - } + if (xkb->defined & XkmSymbolsMask) + XkbUpdateKeyTypesFromCore(pXDev, xkb->min_key_code, + XkbNumKeys(xkb), &changes); + else + XkbUpdateCoreDescription(pXDev, True); + XkbSetCauseUnknown(&cause); XkbUpdateActions(pXDev,xkb->min_key_code, XkbNumKeys(xkb),&changes, &check,&cause); @@ -559,8 +547,6 @@ XkbEventCauseRec cause; pXDev->key->curKeySyms.minKeyCode = xkb->min_key_code; pXDev->key->curKeySyms.maxKeyCode = xkb->max_key_code; } - if (file.file!=NULL) - fclose(file.file); return; } @@ -584,12 +570,12 @@ XkbInitKeyboardDeviceStruct( DeviceIntPtr /*device*/, KeybdCtrl * /*ctrl*/)) { -XkbFileInfo finfo; KeySymsRec tmpSyms,*pSyms; CARD8 tmpMods[XkbMaxLegalKeyCode+1],*pMods; char name[PATH_MAX],*rules; Bool ok=False; XkbRF_VarDefsRec defs; +XkbDescPtr xkb; if ((dev->key!=NULL)||(dev->kbdfeed!=NULL)) return False; @@ -604,7 +590,7 @@ XkbRF_VarDefsRec defs; * generation. Eventually they will be freed at the end of this * function. */ - if (names->keymap) names->keymap = _XkbDupString(names->keymap); + names->keymap = NULL; if (names->keycodes) names->keycodes = _XkbDupString(names->keycodes); if (names->types) names->types = _XkbDupString(names->types); if (names->compat) names->compat = _XkbDupString(names->compat); @@ -615,11 +601,6 @@ XkbRF_VarDefsRec defs; XkbComponentNamesRec rNames; bzero(&rNames,sizeof(XkbComponentNamesRec)); if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) { - if (rNames.keymap) { - if (!names->keymap) - names->keymap = rNames.keymap; - else _XkbFree(rNames.keymap); - } if (rNames.keycodes) { if (!names->keycodes) names->keycodes = rNames.keycodes; @@ -650,22 +631,12 @@ XkbRF_VarDefsRec defs; } } - if (names->keymap) { - XkbComponentNamesRec tmpNames; - bzero(&tmpNames,sizeof(XkbComponentNamesRec)); - tmpNames.keymap = names->keymap; - ok = (Bool) XkbDDXLoadKeymapByNames(dev,&tmpNames,XkmAllIndicesMask,0, - &finfo,name,PATH_MAX); - } - if (!(ok && (finfo.xkb!=NULL))) - ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0, - &finfo,name,PATH_MAX); + ok = (Bool) XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0, + &xkb,name,PATH_MAX); - if (ok && (finfo.xkb!=NULL)) { - XkbDescPtr xkb; + if (ok && (xkb!=NULL)) { KeyCode minKC,maxKC; - xkb= finfo.xkb; minKC= xkb->min_key_code; maxKC= xkb->max_key_code; if (XkbIsLegalKeycode(minKC)&&XkbIsLegalKeycode(maxKC)&&(minKC<=maxKC)&& @@ -695,20 +666,20 @@ XkbRF_VarDefsRec defs; pMods= tmpMods; } } - _XkbInitFileInfo= &finfo; + /* Store the map here so we can pick it back up in XkbInitDevice. + * Sigh. */ + xkb_cached_map = xkb; } else { LogMessage(X_WARNING, "Couldn't load XKB keymap, falling back to pre-XKB keymap\n"); } ok= InitKeyboardDeviceStruct((DevicePtr)dev,pSyms,pMods,bellProc,ctrlProc); - _XkbInitFileInfo= NULL; + xkb_cached_map = NULL; if ((pSyms==&tmpSyms)&&(pSyms->map!=NULL)) { _XkbFree(pSyms->map); pSyms->map= NULL; } - if (names->keymap) _XkbFree(names->keymap); - names->keymap = NULL; if (names->keycodes) _XkbFree(names->keycodes); names->keycodes = NULL; if (names->types) _XkbFree(names->types); @@ -771,9 +742,7 @@ XkbSrvLedInfoPtr sli; sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0); if (sli && xkbi) XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); -#ifdef DEBUG - else ErrorF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); -#endif + else DebugF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); return softRepeat; } diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c index d607d9066..55ce12aad 100644 --- a/xkb/xkbLEDs.c +++ b/xkb/xkbLEDs.c @@ -63,6 +63,9 @@ XkbSrvLedInfoPtr sli; sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0); + if (!sli) + return update; + if (state_changes&(XkbModifierStateMask|XkbGroupStateMask)) update|= sli->usesEffective; if (state_changes&(XkbModifierBaseMask|XkbGroupBaseMask)) @@ -239,7 +242,7 @@ unsigned oldState; if (dev->key && dev->key->xkbInfo) kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + else kbd= inputInfo.keyboard; state= &kbd->key->xkbInfo->state; ctrls= kbd->key->xkbInfo->desc->ctrls; @@ -444,7 +447,7 @@ XkbIndicatorMapPtr map; XkbDescPtr xkb; if ((sli->flags&XkbSLI_HasOwnState)==0) - dev= (DeviceIntPtr)LookupKeyboardDevice(); + dev= inputInfo.keyboard; sli->usesBase&= ~which; sli->usesLatched&= ~which; @@ -731,7 +734,7 @@ xkbExtensionDeviceNotify my_ed; return; if (dev->key && dev->key->xkbInfo) kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + else kbd= inputInfo.keyboard; if (ed==NULL) { ed= &my_ed; @@ -808,7 +811,7 @@ xkbExtensionDeviceNotify my_ed; return; if (dev->key && dev->key->xkbInfo) kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + else kbd= inputInfo.keyboard; if (ed==NULL) { ed= &my_ed; @@ -869,7 +872,7 @@ Bool kb_changed; return; if (dev->key && dev->key->xkbInfo) kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + else kbd= inputInfo.keyboard; xkbi= kbd->key->xkbInfo; if (changes==NULL) { diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c index 3fec4f5ca..69c218c8c 100644 --- a/xkb/xkbPrKeyEv.c +++ b/xkb/xkbPrKeyEv.c @@ -56,11 +56,9 @@ int xiEvent; xkbi= keyc->xkbInfo; key= xE->u.u.detail; xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE); -#ifdef DEBUG if (xkbDebugFlags&0x8) { - ErrorF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); + DebugF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); } -#endif if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) && ((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) { diff --git a/xkb/xkbPrOtherEv.c b/xkb/xkbPrOtherEv.c index a2ea0909a..8017903be 100644 --- a/xkb/xkbPrOtherEv.c +++ b/xkb/xkbPrOtherEv.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/keysym.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBsrv.h> +#include "xkbsrv.h" #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> @@ -71,7 +71,7 @@ Bool xkbCares,isBtn; if ((!isBtn)||((dev->button)&&(dev->button->xkb_acts))) { DeviceIntPtr kbd; if (dev->key) kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + else kbd= inputInfo.keyboard; XkbHandleActions(dev,kbd,xE,count); return; } diff --git a/xkb/xkbSwap.c b/xkb/xkbSwap.c index da4c9053b..50b08f46c 100644 --- a/xkb/xkbSwap.c +++ b/xkb/xkbSwap.c @@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "misc.h" #include "inputstr.h" #include <xkbsrv.h> -#include <X11/extensions/XKBstr.h> +#include "xkbstr.h" #include "extnsionst.h" #include "xkb.h" diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index c7f9a2681..b3132701d 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -42,99 +42,122 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XKBSRV_NEED_FILE_FUNCS #include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> +#include "xkbgeom.h" #include "xkb.h" int XkbDisableLockActions = 0; /***====================================================================***/ -DeviceIntPtr -_XkbLookupAnyDevice(int id,int *why_rtrn) +int +_XkbLookupAnyDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) { -DeviceIntPtr dev = NULL; + int rc = XkbKeyboardErrorCode; - dev= (DeviceIntPtr)LookupKeyboardDevice(); - if ((id==XkbUseCoreKbd)||(dev->id==id)) - return dev; - - dev= (DeviceIntPtr)LookupPointerDevice(); - if ((id==XkbUseCorePtr)||(dev->id==id)) - return dev; - - if (id&(~0xff)) - dev = NULL; - - dev= (DeviceIntPtr)LookupDevice(id); - if (dev!=NULL) - return dev; - if ((!dev)&&(why_rtrn)) - *why_rtrn= XkbErr_BadDevice; - return dev; + if (id == XkbUseCoreKbd) { + if (inputInfo.keyboard) + id = inputInfo.keyboard->id; + else + goto out; + } + if (id == XkbUseCorePtr) { + if (inputInfo.pointer) + id = inputInfo.pointer->id; + else + goto out; + } + rc = dixLookupDevice(pDev, id, client, access_mode); +out: + if (rc != Success) + *xkb_err = XkbErr_BadDevice; + return rc; } -DeviceIntPtr -_XkbLookupKeyboard(int id,int *why_rtrn) +int +_XkbLookupKeyboard(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) { -DeviceIntPtr dev = NULL; + DeviceIntPtr dev; + int rc; if (id == XkbDfltXIId) id = XkbUseCoreKbd; - if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) - return NULL; - else if ((!dev->key)||(!dev->key->xkbInfo)) { - if (why_rtrn) - *why_rtrn= XkbErr_BadClass; - return NULL; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->key || !dev->key->xkbInfo) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; } - return dev; + return Success; } -DeviceIntPtr -_XkbLookupBellDevice(int id,int *why_rtrn) +int +_XkbLookupBellDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) { -DeviceIntPtr dev = NULL; - - if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) - return NULL; - else if ((!dev->kbdfeed)&&(!dev->bell)) { - if (why_rtrn) - *why_rtrn= XkbErr_BadClass; - return NULL; + DeviceIntPtr dev; + int rc; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->kbdfeed && !dev->bell) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; } - return dev; + return Success; } -DeviceIntPtr -_XkbLookupLedDevice(int id,int *why_rtrn) +int +_XkbLookupLedDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) { -DeviceIntPtr dev = NULL; + DeviceIntPtr dev; + int rc; if (id == XkbDfltXIId) id = XkbUseCorePtr; - if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) - return NULL; - else if ((!dev->kbdfeed)&&(!dev->leds)) { - if (why_rtrn) - *why_rtrn= XkbErr_BadClass; - return NULL; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->kbdfeed && !dev->leds) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; } - return dev; + return Success; } -DeviceIntPtr -_XkbLookupButtonDevice(int id,int *why_rtrn) +int +_XkbLookupButtonDevice(DeviceIntPtr *pDev, int id, ClientPtr client, + Mask access_mode, int *xkb_err) { -DeviceIntPtr dev = NULL; - - if ((dev= _XkbLookupAnyDevice(id,why_rtrn))==NULL) - return NULL; - else if (!dev->button) { - if (why_rtrn) - *why_rtrn= XkbErr_BadClass; - return NULL; + DeviceIntPtr dev; + int rc; + + rc = _XkbLookupAnyDevice(pDev, id, client, access_mode, xkb_err); + if (rc != Success) + return rc; + + dev = *pDev; + if (!dev->button) { + *pDev = NULL; + *xkb_err= XkbErr_BadClass; + return XkbKeyboardErrorCode; } - return dev; + return Success; } void @@ -188,16 +211,6 @@ KeySym tsyms[XkbMaxSymsPerKey],*syms; XkbMapChangesPtr mc; xkb= pXDev->key->xkbInfo->desc; -#ifdef NOTYET - if (first<xkb->min_key_code) { - if (first>=XkbMinLegalKeyCode) { - xkb->min_key_code= first; - /* 1/12/95 (ef) -- XXX! should zero out the new maps */ - changes->map.changed|= XkbKeycodesMask; -/* generate a NewKeyboard notify here? */ - } - } -#endif if (first+num-1>xkb->max_key_code) { /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */ num= xkb->max_key_code-first+1; @@ -1493,10 +1506,12 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) /* properties */ if (src->geom->num_properties) { if (src->geom->num_properties != dst->geom->sz_properties) { + /* If we've got more properties in the destination than + * the source, run through and free all the excess ones + * first. */ if (src->geom->num_properties < dst->geom->sz_properties) { for (i = src->geom->num_properties, - dprop = dst->geom->properties + - src->geom->num_properties; + dprop = dst->geom->properties + i; i < dst->geom->num_properties; i++, dprop++) { xfree(dprop->name); @@ -1516,6 +1531,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) dst->geom->properties = tmp; } + /* We don't set num_properties as we need it to try and avoid + * too much reallocing. */ dst->geom->sz_properties = src->geom->num_properties; if (dst->geom->sz_properties > dst->geom->num_properties) { @@ -1551,6 +1568,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } } + /* ... which is already src->geom->num_properties. */ dst->geom->num_properties = dst->geom->sz_properties; } else { @@ -1574,8 +1592,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) if (src->geom->num_colors != dst->geom->sz_colors) { if (src->geom->num_colors < dst->geom->sz_colors) { for (i = src->geom->num_colors, - dcolor = dst->geom->colors + - src->geom->num_colors; + dcolor = dst->geom->colors + i; i < dst->geom->num_colors; i++, dcolor++) { xfree(dcolor->spec); @@ -1693,7 +1710,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } doutline->num_points = soutline->num_points; - doutline->sz_points = soutline->sz_points; + doutline->sz_points = soutline->num_points; } } @@ -1707,9 +1724,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) else { if (dst->geom->sz_shapes) { xfree(dst->geom->shapes); - dst->geom->shapes = NULL; } - + dst->geom->shapes = NULL; dst->geom->num_shapes = 0; dst->geom->sz_shapes = 0; } @@ -1758,6 +1774,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } dst->geom->num_sections = 0; + dst->geom->sections = NULL; } if (src->geom->num_sections) { @@ -1769,7 +1786,10 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) tmp = xalloc(src->geom->num_sections * sizeof(XkbSectionRec)); if (!tmp) return FALSE; + memset(tmp, 0, src->geom->num_sections * sizeof(XkbSectionRec)); dst->geom->sections = tmp; + dst->geom->num_sections = src->geom->num_sections; + dst->geom->sz_sections = src->geom->num_sections; for (i = 0, ssection = src->geom->sections, @@ -1782,6 +1802,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) return FALSE; dsection->rows = tmp; } + dsection->num_rows = ssection->num_rows; + dsection->sz_rows = ssection->num_rows; + for (j = 0, srow = ssection->rows, drow = dsection->rows; j < ssection->num_rows; j++, srow++, drow++) { @@ -1803,6 +1826,10 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) return FALSE; dsection->doodads = tmp; } + else { + dsection->doodads = NULL; + } + for (k = 0, sdoodad = ssection->doodads, ddoodad = dsection->doodads; @@ -1830,9 +1857,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) else { if (dst->geom->sz_sections) { xfree(dst->geom->sections); - dst->geom->sections = NULL; } + dst->geom->sections = NULL; dst->geom->num_sections = 0; dst->geom->sz_sections = 0; } @@ -1861,6 +1888,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) } } } + dst->geom->num_doodads = 0; + dst->geom->doodads = NULL; } if (src->geom->num_doodads) { @@ -1873,7 +1902,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) sizeof(XkbDoodadRec)); if (!tmp) return FALSE; - bzero(tmp, src->geom->num_doodads * sizeof(XkbDoodadRec)); + memset(tmp, 0, src->geom->num_doodads * sizeof(XkbDoodadRec)); dst->geom->doodads = tmp; dst->geom->sz_doodads = src->geom->num_doodads; @@ -1902,9 +1931,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) else { if (dst->geom->sz_doodads) { xfree(dst->geom->doodads); - dst->geom->doodads = NULL; } + dst->geom->doodads = NULL; dst->geom->num_doodads = 0; dst->geom->sz_doodads = 0; } @@ -1932,10 +1961,10 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) dst->geom->num_key_aliases = dst->geom->sz_key_aliases; } else { - if (dst->geom->sz_key_aliases && dst->geom->key_aliases) { + if (dst->geom->key_aliases) { xfree(dst->geom->key_aliases); - dst->geom->key_aliases = NULL; } + dst->geom->key_aliases = NULL; dst->geom->num_key_aliases = 0; dst->geom->sz_key_aliases = 0; } @@ -1966,8 +1995,8 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies) else { if (dst->geom->label_font) { xfree(dst->geom->label_font); - dst->geom->label_font = NULL; } + dst->geom->label_font = NULL; dst->geom->label_color = NULL; dst->geom->base_color = NULL; } diff --git a/xkb/xkberrs.c b/xkb/xkberrs.c deleted file mode 100644 index 3534356c6..000000000 --- a/xkb/xkberrs.c +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************ - Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. - - Permission to use, copy, modify, and distribute this - software and its documentation for any purpose and without - fee is hereby granted, provided that the above copyright - notice appear in all copies and that both that copyright - notice and this permission notice appear in supporting - documentation, and that the name of Silicon Graphics not be - used in advertising or publicity pertaining to distribution - of the software without specific prior written permission. - Silicon Graphics makes no representation about the suitability - of this software for any purpose. It is provided "as is" - without any express or implied warranty. - - SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL - DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH - THE USE OR PERFORMANCE OF THIS SOFTWARE. - - ********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> - -unsigned _XkbErrCode; -char * _XkbErrLocation= NULL; -unsigned _XkbErrData; diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 05344b475..866b4b154 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -42,10 +42,10 @@ #include "misc.h" #include "inputstr.h" #include "dix.h" -#include <X11/extensions/XKBstr.h> +#include "xkbstr.h" #define XKBSRV_NEED_FILE_FUNCS 1 #include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> +#include "xkbgeom.h" #include "xkb.h" unsigned @@ -146,7 +146,7 @@ XkbWriteSectionFromName(FILE *file,char *sectionName,char *name) /* ARGSUSED */ static void _AddIncl( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Bool topLevel, Bool showImplicit, int index, @@ -160,7 +160,6 @@ _AddIncl( FILE * file, Bool XkbWriteXKBKeymapForNames( FILE * file, XkbComponentNamesPtr names, - Display * dpy, XkbDescPtr xkb, unsigned want, unsigned need) @@ -170,9 +169,6 @@ unsigned complete; XkbNamesPtr old_names; int multi_section; unsigned wantNames,wantConfig,wantDflts; -XkbFileInfo finfo; - - bzero(&finfo,sizeof(XkbFileInfo)); complete= 0; if ((name=names->keymap)==NULL) name= "default"; @@ -188,14 +184,8 @@ XkbFileInfo finfo; if (want==0) return False; - if (xkb!=NULL) { + if (xkb!=NULL) old_names= xkb->names; - finfo.type= 0; - finfo.defined= 0; - finfo.xkb= xkb; - if (!XkbDetermineFileType(&finfo,XkbXKBFile,NULL)) - return False; - } else old_names= NULL; wantConfig= want&(~complete); @@ -233,7 +223,7 @@ XkbFileInfo finfo; if ((xkb!=NULL) && (old_names!=NULL)) { if (wantNames&XkmTypesMask) { if (old_names->types!=None) { - tmp= XkbAtomGetString(dpy,old_names->types); + tmp= XkbAtomGetString(old_names->types); names->types= _XkbDupString(tmp); } else { @@ -243,7 +233,7 @@ XkbFileInfo finfo; } if (wantNames&XkmCompatMapMask) { if (old_names->compat!=None) { - tmp= XkbAtomGetString(dpy,old_names->compat); + tmp= XkbAtomGetString(old_names->compat); names->compat= _XkbDupString(tmp); } else wantDflts|= XkmCompatMapMask; @@ -252,13 +242,13 @@ XkbFileInfo finfo; if (wantNames&XkmSymbolsMask) { if (old_names->symbols==None) return False; - tmp= XkbAtomGetString(dpy,old_names->symbols); + tmp= XkbAtomGetString(old_names->symbols); names->symbols= _XkbDupString(tmp); complete|= XkmSymbolsMask; } if (wantNames&XkmKeyNamesMask) { if (old_names->keycodes!=None) { - tmp= XkbAtomGetString(dpy,old_names->keycodes); + tmp= XkbAtomGetString(old_names->keycodes); names->keycodes= _XkbDupString(tmp); } else wantDflts|= XkmKeyNamesMask; @@ -267,7 +257,7 @@ XkbFileInfo finfo; if (wantNames&XkmGeometryMask) { if (old_names->geometry==None) return False; - tmp= XkbAtomGetString(dpy,old_names->geometry); + tmp= XkbAtomGetString(old_names->geometry); names->geometry= _XkbDupString(tmp); complete|= XkmGeometryMask; wantNames&= ~XkmGeometryMask; @@ -305,7 +295,7 @@ XkbFileInfo finfo; wantNames= complete&(~(wantConfig|wantDflts)); name= names->keycodes; if (wantConfig&XkmKeyNamesMask) - XkbWriteXKBKeycodes(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBKeycodes(file,xkb,False,False,_AddIncl,name); else if (wantDflts&XkmKeyNamesMask) fprintf(stderr,"Default symbols not implemented yet!\n"); else if (wantNames&XkmKeyNamesMask) @@ -313,7 +303,7 @@ XkbFileInfo finfo; name= names->types; if (wantConfig&XkmTypesMask) - XkbWriteXKBKeyTypes(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBKeyTypes(file,xkb,False,False,_AddIncl,name); else if (wantDflts&XkmTypesMask) fprintf(stderr,"Default types not implemented yet!\n"); else if (wantNames&XkmTypesMask) @@ -321,7 +311,7 @@ XkbFileInfo finfo; name= names->compat; if (wantConfig&XkmCompatMapMask) - XkbWriteXKBCompatMap(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBCompatMap(file,xkb,False,False,_AddIncl,name); else if (wantDflts&XkmCompatMapMask) fprintf(stderr,"Default interps not implemented yet!\n"); else if (wantNames&XkmCompatMapMask) @@ -329,13 +319,13 @@ XkbFileInfo finfo; name= names->symbols; if (wantConfig&XkmSymbolsMask) - XkbWriteXKBSymbols(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBSymbols(file,xkb,False,False,_AddIncl,name); else if (wantNames&XkmSymbolsMask) XkbWriteSectionFromName(file,"symbols",name); name= names->geometry; if (wantConfig&XkmGeometryMask) - XkbWriteXKBGeometry(file,&finfo,False,False,_AddIncl,name); + XkbWriteXKBGeometry(file,xkb,False,False,_AddIncl,name); else if (wantNames&XkmGeometryMask) XkbWriteSectionFromName(file,"geometry",name); @@ -405,81 +395,6 @@ unsigned rtrn; return rtrn; } -Bool -XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing) -{ -unsigned present; -XkbDescPtr xkb; - - if ((!finfo)||(!finfo->xkb)) - return False; - if (opts_missing) - *opts_missing= 0; - xkb= finfo->xkb; - present= 0; - if ((xkb->names)&&(xkb->names->keys)) present|= XkmKeyNamesMask; - if ((xkb->map)&&(xkb->map->types)) present|= XkmTypesMask; - if (xkb->compat) present|= XkmCompatMapMask; - if ((xkb->map)&&(xkb->map->num_syms>1)) present|= XkmSymbolsMask; - if (xkb->indicators) present|= XkmIndicatorsMask; - if (xkb->geom) present|= XkmGeometryMask; - if (!present) - return False; - else switch (present) { - case XkmKeyNamesMask: - finfo->type= XkmKeyNamesIndex; - finfo->defined= present; - return True; - case XkmTypesMask: - finfo->type= XkmTypesIndex; - finfo->defined= present; - return True; - case XkmCompatMapMask: - finfo->type= XkmCompatMapIndex; - finfo->defined= present; - return True; - case XkmSymbolsMask: - if (format!=XkbXKMFile) { - finfo->type= XkmSymbolsIndex; - finfo->defined= present; - return True; - } - break; - case XkmGeometryMask: - finfo->type= XkmGeometryIndex; - finfo->defined= present; - return True; - } - if ((present&(~XkmSemanticsLegal))==0) { - if ((XkmSemanticsRequired&present)==XkmSemanticsRequired) { - if (opts_missing) - *opts_missing= XkmSemanticsOptional&(~present); - finfo->type= XkmSemanticsFile; - finfo->defined= present; - return True; - } - } - else if ((present&(~XkmLayoutLegal))==0) { - if ((XkmLayoutRequired&present)==XkmLayoutRequired) { - if (opts_missing) - *opts_missing= XkmLayoutOptional&(~present); - finfo->type= XkmLayoutFile; - finfo->defined= present; - return True; - } - } - else if ((present&(~XkmKeymapLegal))==0) { - if ((XkmKeymapRequired&present)==XkmKeymapRequired) { - if (opts_missing) - *opts_missing= XkmKeymapOptional&(~present); - finfo->type= XkmKeymapFile; - finfo->defined= present; - return True; - } - } - return False; -} - /* all latin-1 alphanumerics, plus parens, slash, minus, underscore and */ /* wildcards */ diff --git a/xkb/xkbgeom.h b/xkb/xkbgeom.h new file mode 100644 index 000000000..173affee9 --- /dev/null +++ b/xkb/xkbgeom.h @@ -0,0 +1,635 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, provided that the above copyright +notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _XKBGEOM_H_ +#define _XKBGEOM_H_ + +#include "xkbstr.h" + +#define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias +#define XkbAddGeomColor SrvXkbAddGeomColor +#define XkbAddGeomDoodad SrvXkbAddGeomDoodad +#define XkbAddGeomKey SrvXkbAddGeomKey +#define XkbAddGeomOutline SrvXkbAddGeomOutline +#define XkbAddGeomOverlay SrvXkbAddGeomOverlay +#define XkbAddGeomOverlayRow SrvXkbAddGeomOverlayRow +#define XkbAddGeomOverlayKey SrvXkbAddGeomOverlayKey +#define XkbAddGeomProperty SrvXkbAddGeomProperty +#define XkbAddGeomRow SrvXkbAddGeomRow +#define XkbAddGeomSection SrvXkbAddGeomSection +#define XkbAddGeomShape SrvXkbAddGeomShape +#define XkbAllocGeomKeyAliases SrvXkbAllocGeomKeyAliases +#define XkbAllocGeomColors SrvXkbAllocGeomColors +#define XkbAllocGeomDoodads SrvXkbAllocGeomDoodads +#define XkbAllocGeomKeys SrvXkbAllocGeomKeys +#define XkbAllocGeomOutlines SrvXkbAllocGeomOutlines +#define XkbAllocGeomPoints SrvXkbAllocGeomPoints +#define XkbAllocGeomProps SrvXkbAllocGeomProps +#define XkbAllocGeomRows SrvXkbAllocGeomRows +#define XkbAllocGeomSectionDoodads SrvXkbAllocGeomSectionDoodads +#define XkbAllocGeomSections SrvXkbAllocGeomSections +#define XkbAllocGeomOverlays SrvXkbAllocGeomOverlays +#define XkbAllocGeomOverlayRows SrvXkbAllocGeomOverlayRows +#define XkbAllocGeomOverlayKeys SrvXkbAllocGeomOverlayKeys +#define XkbAllocGeomShapes SrvXkbAllocGeomShapes +#define XkbAllocGeometry SrvXkbAllocGeometry +#define XkbFreeGeomKeyAliases SrvXkbFreeGeomKeyAliases +#define XkbFreeGeomColors SrvXkbFreeGeomColors +#define XkbFreeGeomDoodads SrvXkbFreeGeomDoodads +#define XkbFreeGeomProperties SrvXkbFreeGeomProperties +#define XkbFreeGeomOverlayKeys SrvXkbFreeGeomOverlayKeys +#define XkbFreeGeomOverlayRows SrvXkbFreeGeomOverlayRows +#define XkbFreeGeomOverlays SrvXkbFreeGeomOverlays +#define XkbFreeGeomKeys SrvXkbFreeGeomKeys +#define XkbFreeGeomRows SrvXkbFreeGeomRows +#define XkbFreeGeomSections SrvXkbFreeGeomSections +#define XkbFreeGeomPoints SrvXkbFreeGeomPoints +#define XkbFreeGeomOutlines SrvXkbFreeGeomOutlines +#define XkbFreeGeomShapes SrvXkbFreeGeomShapes +#define XkbFreeGeometry SrvXkbFreeGeometry + +typedef struct _XkbProperty { + char *name; + char *value; +} XkbPropertyRec,*XkbPropertyPtr; + +typedef struct _XkbColor { + unsigned int pixel; + char * spec; +} XkbColorRec,*XkbColorPtr; + +typedef struct _XkbPoint { + short x; + short y; +} XkbPointRec, *XkbPointPtr; + +typedef struct _XkbBounds { + short x1,y1; + short x2,y2; +} XkbBoundsRec, *XkbBoundsPtr; +#define XkbBoundsWidth(b) (((b)->x2)-((b)->x1)) +#define XkbBoundsHeight(b) (((b)->y2)-((b)->y1)) + +typedef struct _XkbOutline { + unsigned short num_points; + unsigned short sz_points; + unsigned short corner_radius; + XkbPointPtr points; +} XkbOutlineRec, *XkbOutlinePtr; + +typedef struct _XkbShape { + Atom name; + unsigned short num_outlines; + unsigned short sz_outlines; + XkbOutlinePtr outlines; + XkbOutlinePtr approx; + XkbOutlinePtr primary; + XkbBoundsRec bounds; +} XkbShapeRec, *XkbShapePtr; +#define XkbOutlineIndex(s,o) ((int)((o)-&(s)->outlines[0])) + +typedef struct _XkbShapeDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short color_ndx; + unsigned short shape_ndx; +} XkbShapeDoodadRec, *XkbShapeDoodadPtr; +#define XkbShapeDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbShapeDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbSetShapeDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) +#define XkbSetShapeDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbTextDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + short width; + short height; + unsigned short color_ndx; + char * text; + char * font; +} XkbTextDoodadRec, *XkbTextDoodadPtr; +#define XkbTextDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbSetTextDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) + +typedef struct _XkbIndicatorDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short shape_ndx; + unsigned short on_color_ndx; + unsigned short off_color_ndx; +} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; +#define XkbIndicatorDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbIndicatorDoodadOnColor(g,d) (&(g)->colors[(d)->on_color_ndx]) +#define XkbIndicatorDoodadOffColor(g,d) (&(g)->colors[(d)->off_color_ndx]) +#define XkbSetIndicatorDoodadOnColor(g,d,c) \ + ((d)->on_color_ndx= (c)-&(g)->colors[0]) +#define XkbSetIndicatorDoodadOffColor(g,d,c) \ + ((d)->off_color_ndx= (c)-&(g)->colors[0]) +#define XkbSetIndicatorDoodadShape(g,d,s) \ + ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbLogoDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; + unsigned short color_ndx; + unsigned short shape_ndx; + char * logo_name; +} XkbLogoDoodadRec, *XkbLogoDoodadPtr; +#define XkbLogoDoodadColor(g,d) (&(g)->colors[(d)->color_ndx]) +#define XkbLogoDoodadShape(g,d) (&(g)->shapes[(d)->shape_ndx]) +#define XkbSetLogoDoodadColor(g,d,c) ((d)->color_ndx= (c)-&(g)->colors[0]) +#define XkbSetLogoDoodadShape(g,d,s) ((d)->shape_ndx= (s)-&(g)->shapes[0]) + +typedef struct _XkbAnyDoodad { + Atom name; + unsigned char type; + unsigned char priority; + short top; + short left; + short angle; +} XkbAnyDoodadRec, *XkbAnyDoodadPtr; + +typedef union _XkbDoodad { + XkbAnyDoodadRec any; + XkbShapeDoodadRec shape; + XkbTextDoodadRec text; + XkbIndicatorDoodadRec indicator; + XkbLogoDoodadRec logo; +} XkbDoodadRec, *XkbDoodadPtr; + +#define XkbUnknownDoodad 0 +#define XkbOutlineDoodad 1 +#define XkbSolidDoodad 2 +#define XkbTextDoodad 3 +#define XkbIndicatorDoodad 4 +#define XkbLogoDoodad 5 + +typedef struct _XkbKey { + XkbKeyNameRec name; + short gap; + unsigned char shape_ndx; + unsigned char color_ndx; +} XkbKeyRec, *XkbKeyPtr; +#define XkbKeyShape(g,k) (&(g)->shapes[(k)->shape_ndx]) +#define XkbKeyColor(g,k) (&(g)->colors[(k)->color_ndx]) +#define XkbSetKeyShape(g,k,s) ((k)->shape_ndx= (s)-&(g)->shapes[0]) +#define XkbSetKeyColor(g,k,c) ((k)->color_ndx= (c)-&(g)->colors[0]) + +typedef struct _XkbRow { + short top; + short left; + unsigned short num_keys; + unsigned short sz_keys; + int vertical; + XkbKeyPtr keys; + XkbBoundsRec bounds; +} XkbRowRec, *XkbRowPtr; + +typedef struct _XkbSection { + Atom name; + unsigned char priority; + short top; + short left; + unsigned short width; + unsigned short height; + short angle; + unsigned short num_rows; + unsigned short num_doodads; + unsigned short num_overlays; + unsigned short sz_rows; + unsigned short sz_doodads; + unsigned short sz_overlays; + XkbRowPtr rows; + XkbDoodadPtr doodads; + XkbBoundsRec bounds; + struct _XkbOverlay *overlays; +} XkbSectionRec, *XkbSectionPtr; + +typedef struct _XkbOverlayKey { + XkbKeyNameRec over; + XkbKeyNameRec under; +} XkbOverlayKeyRec,*XkbOverlayKeyPtr; + +typedef struct _XkbOverlayRow { + unsigned short row_under; + unsigned short num_keys; + unsigned short sz_keys; + XkbOverlayKeyPtr keys; +} XkbOverlayRowRec,*XkbOverlayRowPtr; + +typedef struct _XkbOverlay { + Atom name; + XkbSectionPtr section_under; + unsigned short num_rows; + unsigned short sz_rows; + XkbOverlayRowPtr rows; + XkbBoundsPtr bounds; +} XkbOverlayRec,*XkbOverlayPtr; + +typedef struct _XkbGeometry { + Atom name; + unsigned short width_mm; + unsigned short height_mm; + char * label_font; + XkbColorPtr label_color; + XkbColorPtr base_color; + unsigned short sz_properties; + unsigned short sz_colors; + unsigned short sz_shapes; + unsigned short sz_sections; + unsigned short sz_doodads; + unsigned short sz_key_aliases; + unsigned short num_properties; + unsigned short num_colors; + unsigned short num_shapes; + unsigned short num_sections; + unsigned short num_doodads; + unsigned short num_key_aliases; + XkbPropertyPtr properties; + XkbColorPtr colors; + XkbShapePtr shapes; + XkbSectionPtr sections; + XkbDoodadPtr doodads; + XkbKeyAliasPtr key_aliases; +} XkbGeometryRec; +#define XkbGeomColorIndex(g,c) ((int)((c)-&(g)->colors[0])) + +#define XkbGeomPropertiesMask (1<<0) +#define XkbGeomColorsMask (1<<1) +#define XkbGeomShapesMask (1<<2) +#define XkbGeomSectionsMask (1<<3) +#define XkbGeomDoodadsMask (1<<4) +#define XkbGeomKeyAliasesMask (1<<5) +#define XkbGeomAllMask (0x3f) + +typedef struct _XkbGeometrySizes { + unsigned int which; + unsigned short num_properties; + unsigned short num_colors; + unsigned short num_shapes; + unsigned short num_sections; + unsigned short num_doodads; + unsigned short num_key_aliases; +} XkbGeometrySizesRec,*XkbGeometrySizesPtr; + +_XFUNCPROTOBEGIN + +extern XkbPropertyPtr +XkbAddGeomProperty( + XkbGeometryPtr /* geom */, + char * /* name */, + char * /* value */ +); + +extern XkbKeyAliasPtr +XkbAddGeomKeyAlias( + XkbGeometryPtr /* geom */, + char * /* alias */, + char * /* real */ +); + +extern XkbColorPtr +XkbAddGeomColor( + XkbGeometryPtr /* geom */, + char * /* spec */, + unsigned int /* pixel */ +); + +extern XkbOutlinePtr +XkbAddGeomOutline( + XkbShapePtr /* shape */, + int /* sz_points */ +); + +extern XkbShapePtr +XkbAddGeomShape( + XkbGeometryPtr /* geom */, + Atom /* name */, + int /* sz_outlines */ +); + +extern XkbKeyPtr +XkbAddGeomKey( + XkbRowPtr /* row */ +); + +extern XkbRowPtr +XkbAddGeomRow( + XkbSectionPtr /* section */, + int /* sz_keys */ +); + +extern XkbSectionPtr +XkbAddGeomSection( + XkbGeometryPtr /* geom */, + Atom /* name */, + int /* sz_rows */, + int /* sz_doodads */, + int /* sz_overlays */ +); + +extern XkbOverlayPtr +XkbAddGeomOverlay( + XkbSectionPtr /* section */, + Atom /* name */, + int /* sz_rows */ +); + +extern XkbOverlayRowPtr +XkbAddGeomOverlayRow( + XkbOverlayPtr /* overlay */, + int /* row_under */, + int /* sz_keys */ +); + +extern XkbOverlayKeyPtr +XkbAddGeomOverlayKey( + XkbOverlayPtr /* overlay */, + XkbOverlayRowPtr /* row */, + char * /* over */, + char * /* under */ +); + +extern XkbDoodadPtr +XkbAddGeomDoodad( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */, + Atom /* name */ +); + + +extern void +XkbFreeGeomKeyAliases( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomColors( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomDoodads( + XkbDoodadPtr /* doodads */, + int /* nDoodads */, + Bool /* freeAll */ +); + + +extern void +XkbFreeGeomProperties( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOverlayKeys( + XkbOverlayRowPtr /* row */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOverlayRows( + XkbOverlayPtr /* overlay */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOverlays( + XkbSectionPtr /* section */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomKeys( + XkbRowPtr /* row */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomRows( + XkbSectionPtr /* section */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomSections( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + + +extern void +XkbFreeGeomPoints( + XkbOutlinePtr /* outline */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomOutlines( + XkbShapePtr /* shape */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeomShapes( + XkbGeometryPtr /* geom */, + int /* first */, + int /* count */, + Bool /* freeAll */ +); + +extern void +XkbFreeGeometry( + XkbGeometryPtr /* geom */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern Status +XkbAllocGeomProps( + XkbGeometryPtr /* geom */, + int /* nProps */ +); + +extern Status +XkbAllocGeomKeyAliases( + XkbGeometryPtr /* geom */, + int /* nAliases */ +); + +extern Status +XkbAllocGeomColors( + XkbGeometryPtr /* geom */, + int /* nColors */ +); + +extern Status +XkbAllocGeomShapes( + XkbGeometryPtr /* geom */, + int /* nShapes */ +); + +extern Status +XkbAllocGeomSections( + XkbGeometryPtr /* geom */, + int /* nSections */ +); + +extern Status +XkbAllocGeomOverlays( + XkbSectionPtr /* section */, + int /* num_needed */ +); + +extern Status +XkbAllocGeomOverlayRows( + XkbOverlayPtr /* overlay */, + int /* num_needed */ +); + +extern Status +XkbAllocGeomOverlayKeys( + XkbOverlayRowPtr /* row */, + int /* num_needed */ +); + +extern Status +XkbAllocGeomDoodads( + XkbGeometryPtr /* geom */, + int /* nDoodads */ +); + +extern Status +XkbAllocGeomSectionDoodads( + XkbSectionPtr /* section */, + int /* nDoodads */ +); + +extern Status +XkbAllocGeomOutlines( + XkbShapePtr /* shape */, + int /* nOL */ +); + +extern Status +XkbAllocGeomRows( + XkbSectionPtr /* section */, + int /* nRows */ +); + +extern Status +XkbAllocGeomPoints( + XkbOutlinePtr /* ol */, + int /* nPts */ +); + +extern Status +XkbAllocGeomKeys( + XkbRowPtr /* row */, + int /* nKeys */ +); + +extern Status +XkbAllocGeometry( + XkbDescPtr /* xkb */, + XkbGeometrySizesPtr /* sizes */ +); + +extern Bool +XkbComputeShapeTop( + XkbShapePtr /* shape */, + XkbBoundsPtr /* bounds */ +); + +extern Bool +XkbComputeShapeBounds( + XkbShapePtr /* shape */ +); + +extern Bool +XkbComputeRowBounds( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */, + XkbRowPtr /* row */ +); + +extern Bool +XkbComputeSectionBounds( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* section */ +); + +extern char * +XkbFindOverlayForKey( + XkbGeometryPtr /* geom */, + XkbSectionPtr /* wanted */, + char * /* under */ +); + +_XFUNCPROTOEND + +#endif /* _XKBGEOM_H_ */ diff --git a/xkb/xkbout.c b/xkb/xkbout.c index 8905ef4d3..229cc9258 100644 --- a/xkb/xkbout.c +++ b/xkb/xkbout.c @@ -40,19 +40,19 @@ #include "misc.h" #include "inputstr.h" #include "dix.h" -#include <X11/extensions/XKBstr.h> +#include "xkbstr.h" #define XKBSRV_NEED_FILE_FUNCS 1 #include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> -#include <X11/extensions/XKBfile.h> +#include "xkbgeom.h" +#include "xkbfile.h" #define VMOD_HIDE_VALUE 0 #define VMOD_SHOW_VALUE 1 #define VMOD_COMMENT_VALUE 2 static Bool -WriteXKBVModDecl(FILE *file,Display *dpy,XkbDescPtr xkb,int showValue) +WriteXKBVModDecl(FILE *file,XkbDescPtr xkb,int showValue) { register int i,nMods; Atom * vmodNames; @@ -67,7 +67,7 @@ Atom * vmodNames; if ((vmodNames!=NULL)&&(vmodNames[i]!=None)) { if (nMods==0) fprintf(file," virtual_modifiers "); else fprintf(file,","); - fprintf(file,"%s",XkbAtomText(dpy,vmodNames[i],XkbXKBFile)); + fprintf(file,"%s",XkbAtomText(vmodNames[i],XkbXKBFile)); if ((showValue!=VMOD_HIDE_VALUE)&& (xkb->server)&&(xkb->server->vmods[i]!=XkbNoModifierMask)) { if (showValue==VMOD_COMMENT_VALUE) { @@ -90,14 +90,9 @@ Atom * vmodNames; /***====================================================================***/ static Bool -WriteXKBAction(FILE *file,XkbFileInfo *result,XkbAnyAction *action) +WriteXKBAction(FILE *file,XkbDescPtr xkb,XkbAnyAction *action) { -XkbDescPtr xkb; -Display * dpy; - - xkb= result->xkb; - dpy= xkb->dpy; - fprintf(file,"%s",XkbActionText(dpy,xkb,(XkbAction *)action,XkbXKBFile)); + fprintf(file,"%s",XkbActionText(xkb,(XkbAction *)action,XkbXKBFile)); return True; } @@ -105,7 +100,7 @@ Display * dpy; Bool XkbWriteXKBKeycodes( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, @@ -113,12 +108,8 @@ XkbWriteXKBKeycodes( FILE * file, { Atom kcName; register unsigned i; -XkbDescPtr xkb; -Display * dpy; char * alternate; - xkb= result->xkb; - dpy= xkb->dpy; if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) { _XkbLibError(_XkbErrMissingNames,"XkbWriteXKBKeycodes",0); return False; @@ -126,7 +117,7 @@ char * alternate; kcName= xkb->names->keycodes; if (kcName!=None) fprintf(file,"xkb_keycodes \"%s\" {\n", - XkbAtomText(dpy,kcName,XkbXKBFile)); + XkbAtomText(kcName,XkbXKBFile)); else fprintf(file,"xkb_keycodes {\n"); fprintf(file," minimum = %d;\n",xkb->min_key_code); fprintf(file," maximum = %d;\n",xkb->max_key_code); @@ -148,7 +139,7 @@ char * alternate; else type= " virtual "; if (xkb->names->indicators[i]!=None) { fprintf(file,"%sindicator %d = \"%s\";\n",type,i+1, - XkbAtomText(dpy,xkb->names->indicators[i],XkbXKBFile)); + XkbAtomText(xkb->names->indicators[i],XkbXKBFile)); } } } @@ -162,27 +153,23 @@ char * alternate; } } if (addOn) - (*addOn)(file,result,topLevel,showImplicit,XkmKeyNamesIndex,priv); + (*addOn)(file,xkb,topLevel,showImplicit,XkmKeyNamesIndex,priv); fprintf(file,"};\n\n"); return True; } Bool XkbWriteXKBKeyTypes( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i,n; XkbKeyTypePtr type; XkbKTMapEntryPtr entry; -XkbDescPtr xkb; - xkb= result->xkb; - dpy= xkb->dpy; if ((!xkb)||(!xkb->map)||(!xkb->map->types)) { _XkbLibError(_XkbErrMissingTypes,"XkbWriteXKBKeyTypes",0); return False; @@ -194,27 +181,27 @@ XkbDescPtr xkb; if ((xkb->names==NULL)||(xkb->names->types==None)) fprintf(file,"xkb_types {\n\n"); else fprintf(file,"xkb_types \"%s\" {\n\n", - XkbAtomText(dpy,xkb->names->types,XkbXKBFile)); - WriteXKBVModDecl(file,dpy,xkb, + XkbAtomText(xkb->names->types,XkbXKBFile)); + WriteXKBVModDecl(file,xkb, (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE)); type= xkb->map->types; for (i=0;i<xkb->map->num_types;i++,type++) { fprintf(file," type \"%s\" {\n", - XkbAtomText(dpy,type->name,XkbXKBFile)); + XkbAtomText(type->name,XkbXKBFile)); fprintf(file," modifiers= %s;\n", - XkbVModMaskText(dpy,xkb,type->mods.real_mods,type->mods.vmods, + XkbVModMaskText(xkb,type->mods.real_mods,type->mods.vmods, XkbXKBFile)); entry= type->map; for (n=0;n<type->map_count;n++,entry++) { char *str; - str=XkbVModMaskText(dpy,xkb,entry->mods.real_mods,entry->mods.vmods, + str=XkbVModMaskText(xkb,entry->mods.real_mods,entry->mods.vmods, XkbXKBFile); fprintf(file," map[%s]= Level%d;\n",str,entry->level+1); if ((type->preserve)&&((type->preserve[n].real_mods)|| (type->preserve[n].vmods))) { fprintf(file," preserve[%s]= ",str); - fprintf(file,"%s;\n",XkbVModMaskText(dpy,xkb, + fprintf(file,"%s;\n",XkbVModMaskText(xkb, type->preserve[n].real_mods, type->preserve[n].vmods, XkbXKBFile)); @@ -226,29 +213,27 @@ XkbDescPtr xkb; if ((*name)==None) continue; fprintf(file," level_name[Level%d]= \"%s\";\n",n+1, - XkbAtomText(dpy,*name,XkbXKBFile)); + XkbAtomText(*name,XkbXKBFile)); } } fprintf(file," };\n"); } if (addOn) - (*addOn)(file,result,topLevel,showImplicit,XkmTypesIndex,priv); + (*addOn)(file,xkb,topLevel,showImplicit,XkmTypesIndex,priv); fprintf(file,"};\n\n"); return True; } static Bool WriteXKBIndicatorMap( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Atom name, XkbIndicatorMapPtr led, XkbFileAddOnFunc addOn, void * priv) { -XkbDescPtr xkb; - xkb= result->xkb; - fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(xkb->dpy,name)); + fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(name)); if (led->flags&XkbIM_NoExplicit) fprintf(file," !allowExplicit;\n"); if (led->flags&XkbIM_LEDDrivesKB) @@ -266,7 +251,7 @@ XkbDescPtr xkb; XkbIMWhichStateMaskText(led->which_mods,XkbXKBFile)); } fprintf(file," modifiers= %s;\n", - XkbVModMaskText(xkb->dpy,xkb, + XkbVModMaskText(xkb, led->mods.real_mods,led->mods.vmods, XkbXKBFile)); } @@ -275,26 +260,22 @@ XkbDescPtr xkb; XkbControlsMaskText(led->ctrls,XkbXKBFile)); } if (addOn) - (*addOn)(file,result,False,True,XkmIndicatorsIndex,priv); + (*addOn)(file,xkb,False,True,XkmIndicatorsIndex,priv); fprintf(file," };\n"); return True; } Bool XkbWriteXKBCompatMap( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i; XkbSymInterpretPtr interp; -XkbDescPtr xkb; - xkb= result->xkb; - dpy= xkb->dpy; if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) { _XkbLibError(_XkbErrMissingCompatMap,"XkbWriteXKBCompatMap",0); return False; @@ -302,8 +283,8 @@ XkbDescPtr xkb; if ((xkb->names==NULL)||(xkb->names->compat==None)) fprintf(file,"xkb_compatibility {\n\n"); else fprintf(file,"xkb_compatibility \"%s\" {\n\n", - XkbAtomText(dpy,xkb->names->compat,XkbXKBFile)); - WriteXKBVModDecl(file,dpy,xkb, + XkbAtomText(xkb->names->compat,XkbXKBFile)); + WriteXKBVModDecl(file,xkb, (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE)); fprintf(file," interpret.useModMapMods= AnyLevel;\n"); @@ -318,7 +299,7 @@ XkbDescPtr xkb; XkbModMaskText(interp->mods,XkbXKBFile)); if (interp->virtual_mod!=XkbNoModifier) { fprintf(file," virtualModifier= %s;\n", - XkbVModIndexText(dpy,xkb,interp->virtual_mod,XkbXKBFile)); + XkbVModIndexText(xkb,interp->virtual_mod,XkbXKBFile)); } if (interp->match&XkbSI_LevelOneOnly) fprintf(file," useModMapMods=level1;\n"); @@ -327,7 +308,7 @@ XkbDescPtr xkb; if (interp->flags&XkbSI_AutoRepeat) fprintf(file," repeat= True;\n"); fprintf(file," action= "); - WriteXKBAction(file,result,&interp->act); + WriteXKBAction(file,xkb,&interp->act); fprintf(file,";\n"); fprintf(file," };\n"); } @@ -337,7 +318,7 @@ XkbDescPtr xkb; gc= &xkb->compat->groups[i]; if ((gc->real_mods==0)&&(gc->vmods==0)) continue; - fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb->dpy,xkb, + fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb, gc->real_mods,gc->vmods, XkbXKBFile)); } @@ -348,36 +329,32 @@ XkbDescPtr xkb; (map->which_mods!=0)|| (map->mods.real_mods!=0)||(map->mods.vmods!=0)|| (map->ctrls!=0)) { - WriteXKBIndicatorMap(file,result,xkb->names->indicators[i],map, + WriteXKBIndicatorMap(file,xkb,xkb->names->indicators[i],map, addOn,priv); } } } if (addOn) - (*addOn)(file,result,topLevel,showImplicit,XkmCompatMapIndex,priv); + (*addOn)(file,xkb,topLevel,showImplicit,XkmCompatMapIndex,priv); fprintf(file,"};\n\n"); return True; } Bool XkbWriteXKBSymbols( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i,tmp; -XkbDescPtr xkb; XkbClientMapPtr map; XkbServerMapPtr srv; Bool showActions; - xkb= result->xkb; map= xkb->map; srv= xkb->server; - dpy= xkb->dpy; if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) { _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0); return False; @@ -389,11 +366,11 @@ Bool showActions; if ((xkb->names==NULL)||(xkb->names->symbols==None)) fprintf(file,"xkb_symbols {\n\n"); else fprintf(file,"xkb_symbols \"%s\" {\n\n", - XkbAtomText(dpy,xkb->names->symbols,XkbXKBFile)); + XkbAtomText(xkb->names->symbols,XkbXKBFile)); for (tmp=i=0;i<XkbNumKbdGroups;i++) { if (xkb->names->groups[i]!=None) { fprintf(file," name[group%d]=\"%s\";\n",i+1, - XkbAtomText(dpy,xkb->names->groups[i],XkbXKBFile)); + XkbAtomText(xkb->names->groups[i],XkbXKBFile)); tmp++; } } @@ -429,19 +406,19 @@ Bool showActions; if (srv->explicit[i]&(1<<g)) { fprintf(file,"\n%s type[group%d]= \"%s\",", comment,g+1, - XkbAtomText(dpy,map->types[typeNdx].name, + XkbAtomText(map->types[typeNdx].name, XkbXKBFile)); } else if (showImplicit) { fprintf(file,"\n// type[group%d]= \"%s\",",g+1, - XkbAtomText(dpy,map->types[typeNdx].name, + XkbAtomText(map->types[typeNdx].name, XkbXKBFile)); } } } else { fprintf(file,"\n%s type= \"%s\",",comment, - XkbAtomText(dpy,map->types[typeNdx].name, + XkbAtomText(map->types[typeNdx].name, XkbXKBFile)); } simple= False; @@ -457,13 +434,13 @@ Bool showActions; (xkb->server->vmodmap[i]!=0)) { if ((srv->explicit[i]&XkbExplicitVModMapMask)!=0) { fprintf(file,"\n virtualMods= %s,", - XkbVModMaskText(dpy,xkb,0, + XkbVModMaskText(xkb,0, xkb->server->vmodmap[i], XkbXKBFile)); } else if (showImplicit) { fprintf(file,"\n// virtualMods= %s,", - XkbVModMaskText(dpy,xkb,0, + XkbVModMaskText(xkb,0, xkb->server->vmodmap[i], XkbXKBFile)); } @@ -530,7 +507,7 @@ Bool showActions; for (s=0;s<XkbKeyGroupWidth(xkb,i,g);s++) { if (s!=0) fprintf(file,", "); - WriteXKBAction(file,result,(XkbAnyAction *)&acts[s]); + WriteXKBAction(file,xkb,(XkbAnyAction *)&acts[s]); } fprintf(file," ]"); acts+= XkbKeyGroupsWidth(xkb,i); @@ -556,7 +533,7 @@ Bool showActions; } } if (addOn) - (*addOn)(file,result,topLevel,showImplicit,XkmSymbolsIndex,priv); + (*addOn)(file,xkb,topLevel,showImplicit,XkmSymbolsIndex,priv); fprintf(file,"};\n\n"); return True; } @@ -603,7 +580,6 @@ char * iStr; static Bool WriteXKBDoodad( FILE * file, - Display * dpy, unsigned indent, XkbGeometryPtr geom, XkbDoodadPtr doodad) @@ -615,7 +591,7 @@ XkbColorPtr color; i_str= XkbIndentText(indent); fprintf(file,"%s%s \"%s\" {\n",i_str, XkbDoodadTypeText(doodad->any.type,XkbMessage), - XkbAtomText(dpy,doodad->any.name,XkbMessage)); + XkbAtomText(doodad->any.name,XkbMessage)); fprintf(file,"%s top= %s;\n",i_str, XkbGeomFPText(doodad->any.top,XkbXKBFile)); fprintf(file,"%s left= %s;\n",i_str, @@ -634,7 +610,7 @@ XkbColorPtr color; } shape= XkbShapeDoodadShape(geom,&doodad->shape); fprintf(file,"%s shape= \"%s\";\n",i_str, - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); break; case XkbTextDoodad: if (doodad->text.angle!=0) { @@ -670,7 +646,7 @@ XkbColorPtr color; fprintf(file,"%s offColor= \"%s\";\n",i_str, XkbStringText(color->spec,XkbXKBFile)); fprintf(file,"%s shape= \"%s\";\n",i_str, - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); break; case XkbLogoDoodad: fprintf(file,"%s logoName= \"%s\";\n",i_str, @@ -685,7 +661,7 @@ XkbColorPtr color; } shape= XkbLogoDoodadShape(geom,&doodad->logo); fprintf(file,"%s shape= \"%s\";\n",i_str, - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); break; } fprintf(file,"%s};\n",i_str); @@ -695,7 +671,6 @@ XkbColorPtr color; /*ARGSUSED*/ static Bool WriteXKBOverlay( FILE * file, - Display * dpy, unsigned indent, XkbGeometryPtr geom, XkbOverlayPtr ol) @@ -708,7 +683,7 @@ XkbOverlayKeyPtr key; i_str= XkbIndentText(indent); if (ol->name!=None) { fprintf(file,"%soverlay \"%s\" {\n",i_str, - XkbAtomText(dpy,ol->name,XkbMessage)); + XkbAtomText(ol->name,XkbMessage)); } else fprintf(file,"%soverlay {\n",i_str); for (nOut=r=0,row=ol->rows;r<ol->num_rows;r++,row++) { @@ -730,7 +705,6 @@ XkbOverlayKeyPtr key; static Bool WriteXKBSection( FILE * file, - Display * dpy, XkbSectionPtr s, XkbGeometryPtr geom) { @@ -739,7 +713,7 @@ XkbRowPtr row; int dfltKeyColor = 0; fprintf(file," section \"%s\" {\n", - XkbAtomText(dpy,s->name,XkbXKBFile)); + XkbAtomText(s->name,XkbXKBFile)); if (s->rows&&(s->rows->num_keys>0)) { dfltKeyColor= s->rows->keys[0].color_ndx; fprintf(file," key.color= \"%s\";\n", @@ -788,7 +762,7 @@ int dfltKeyColor = 0; shape= XkbKeyShape(geom,key); fprintf(file,"{ %6s, \"%s\", %3s", XkbKeyNameText(key->name.name,XkbXKBFile), - XkbAtomText(dpy,shape->name,XkbXKBFile), + XkbAtomText(shape->name,XkbXKBFile), XkbGeomFPText(key->gap,XkbXKBFile)); if (key->color_ndx!=dfltKeyColor) { fprintf(file,", color=\"%s\"",XkbKeyColor(geom,key)->spec); @@ -803,44 +777,40 @@ int dfltKeyColor = 0; if (s->doodads!=NULL) { XkbDoodadPtr doodad; for (i=0,doodad=s->doodads;i<s->num_doodads;i++,doodad++) { - WriteXKBDoodad(file,dpy,8,geom,doodad); + WriteXKBDoodad(file,8,geom,doodad); } } if (s->overlays!=NULL) { XkbOverlayPtr ol; for (i=0,ol=s->overlays;i<s->num_overlays;i++,ol++) { - WriteXKBOverlay(file,dpy,8,geom,ol); + WriteXKBOverlay(file,8,geom,ol); } } fprintf(file," }; // End of \"%s\" section\n\n", - XkbAtomText(dpy,s->name,XkbXKBFile)); + XkbAtomText(s->name,XkbXKBFile)); return True; } Bool XkbWriteXKBGeometry( FILE * file, - XkbFileInfo * result, + XkbDescPtr xkb, Bool topLevel, Bool showImplicit, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i,n; -XkbDescPtr xkb; XkbGeometryPtr geom; - xkb= result->xkb; if ((!xkb)||(!xkb->geom)) { _XkbLibError(_XkbErrMissingGeometry,"XkbWriteXKBGeometry",0); return False; } - dpy= xkb->dpy; geom= xkb->geom; if (geom->name==None) fprintf(file,"xkb_geometry {\n\n"); else fprintf(file,"xkb_geometry \"%s\" {\n\n", - XkbAtomText(dpy,geom->name,XkbXKBFile)); + XkbAtomText(geom->name,XkbXKBFile)); fprintf(file," width= %s;\n", XkbGeomFPText(geom->width_mm,XkbXKBFile)); fprintf(file," height= %s;\n\n", @@ -889,7 +859,7 @@ XkbGeometryPtr geom; for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) { lastR=0; fprintf(file," shape \"%s\" {", - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); outline= shape->outlines; if (shape->num_outlines>1) { for (n=0;n<shape->num_outlines;n++,outline++) { @@ -909,17 +879,17 @@ XkbGeometryPtr geom; if (geom->num_sections>0) { XkbSectionPtr section; for (section=geom->sections,i=0;i<geom->num_sections;i++,section++){ - WriteXKBSection(file,dpy,section,geom); + WriteXKBSection(file,section,geom); } } if (geom->num_doodads>0) { XkbDoodadPtr doodad; for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) { - WriteXKBDoodad(file,dpy,4,geom,doodad); + WriteXKBDoodad(file,4,geom,doodad); } } if (addOn) - (*addOn)(file,result,topLevel,showImplicit,XkmGeometryIndex,priv); + (*addOn)(file,xkb,topLevel,showImplicit,XkmGeometryIndex,priv); fprintf(file,"};\n\n"); return True; } diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index 4983e2b9e..d08c91589 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -40,10 +40,10 @@ #include "misc.h" #include "inputstr.h" #include "dix.h" -#include <X11/extensions/XKBstr.h> +#include "xkbstr.h" #define XKBSRV_NEED_FILE_FUNCS 1 #include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> +#include "xkbgeom.h" /***====================================================================***/ @@ -69,11 +69,11 @@ char *rtrn; /***====================================================================***/ char * -XkbAtomText(Display *dpy,Atom atm,unsigned format) +XkbAtomText(Atom atm,unsigned format) { char *rtrn,*tmp; - tmp= XkbAtomGetString(dpy,atm); + tmp= XkbAtomGetString(atm); if (tmp!=NULL) { int len; len= strlen(tmp)+1; @@ -101,7 +101,7 @@ char *rtrn,*tmp; /***====================================================================***/ char * -XkbVModIndexText(Display *dpy,XkbDescPtr xkb,unsigned ndx,unsigned format) +XkbVModIndexText(XkbDescPtr xkb,unsigned ndx,unsigned format) { register int len; register Atom *vmodNames; @@ -116,7 +116,7 @@ char numBuf[20]; if (ndx>=XkbNumVirtualMods) tmp= "illegal"; else if (vmodNames&&(vmodNames[ndx]!=None)) - tmp= XkbAtomGetString(dpy,vmodNames[ndx]); + tmp= XkbAtomGetString(vmodNames[ndx]); if (tmp==NULL) sprintf(tmp=numBuf,"%d",ndx); @@ -135,8 +135,7 @@ char numBuf[20]; } char * -XkbVModMaskText( Display * dpy, - XkbDescPtr xkb, +XkbVModMaskText( XkbDescPtr xkb, unsigned modMask, unsigned mask, unsigned format) @@ -163,7 +162,7 @@ char *str,buf[BUFFER_SIZE]; char *tmp; for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { if (mask&bit) { - tmp= XkbVModIndexText(dpy,xkb,i,format); + tmp= XkbVModIndexText(xkb,i,format); len= strlen(tmp)+1+(str==buf?0:1); if (format==XkbCFile) len+= 4; @@ -667,13 +666,13 @@ register int len; /*ARGSUSED*/ static Bool -CopyNoActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int*sz) +CopyNoActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int*sz) { return True; } static Bool -CopyModActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyModActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int* sz) { XkbModAction * act; @@ -686,7 +685,7 @@ unsigned tmp; TryCopyStr(buf,"modMapMods",sz); else if (act->real_mods || tmp) { TryCopyStr(buf, - XkbVModMaskText(dpy,xkb,act->real_mods,tmp,XkbXKBFile), + XkbVModMaskText(xkb,act->real_mods,tmp,XkbXKBFile), sz); } else TryCopyStr(buf,"none",sz); @@ -701,7 +700,7 @@ unsigned tmp; /*ARGSUSED*/ static Bool -CopyGroupActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyGroupActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbGroupAction * act; @@ -726,7 +725,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyMovePtrArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyMovePtrArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbPtrAction * act; int x,y; @@ -751,7 +750,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyPtrBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyPtrBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbPtrBtnAction * act; char tbuf[32]; @@ -785,7 +784,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopySetPtrDfltArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopySetPtrDfltArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbPtrDfltAction * act; @@ -803,7 +802,7 @@ char tbuf[32]; } static Bool -CopyISOLockArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyISOLockArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbISOAction * act; char tbuf[64]; @@ -831,7 +830,7 @@ char tbuf[64]; TryCopyStr(buf,"+",sz); } if (tmp) - TryCopyStr(buf,XkbVModMaskText(dpy,xkb,0,tmp,XkbXKBFile),sz); + TryCopyStr(buf,XkbVModMaskText(xkb,0,tmp,XkbXKBFile),sz); } else TryCopyStr(buf,"none",sz); } @@ -865,7 +864,7 @@ char tbuf[64]; /*ARGSUSED*/ static Bool -CopySwitchScreenArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopySwitchScreenArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbSwitchScreenAction * act; @@ -884,7 +883,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopySetLockControlsArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action, +CopySetLockControlsArgs(XkbDescPtr xkb,XkbAction *action, char *buf,int *sz) { XkbCtrlsAction * act; @@ -971,7 +970,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyActionMessageArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyActionMessageArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbMessageAction * act; @@ -998,7 +997,7 @@ char tbuf[32]; } static Bool -CopyRedirectKeyArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyRedirectKeyArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbRedirectKeyAction * act; @@ -1022,19 +1021,19 @@ unsigned vmods,vmods_mask; return True; if ((act->mods_mask==XkbAllModifiersMask)&& (vmods_mask==XkbAllVirtualModsMask)) { - tmp= XkbVModMaskText(dpy,xkb,act->mods,vmods,XkbXKBFile); + tmp= XkbVModMaskText(xkb,act->mods,vmods,XkbXKBFile); TryCopyStr(buf,",mods=",sz); TryCopyStr(buf,tmp,sz); } else { if ((act->mods_mask&act->mods)||(vmods_mask&vmods)) { - tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&act->mods, + tmp= XkbVModMaskText(xkb,act->mods_mask&act->mods, vmods_mask&vmods,XkbXKBFile); TryCopyStr(buf,",mods= ",sz); TryCopyStr(buf,tmp,sz); } if ((act->mods_mask&(~act->mods))||(vmods_mask&(~vmods))) { - tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&(~act->mods), + tmp= XkbVModMaskText(xkb,act->mods_mask&(~act->mods), vmods_mask&(~vmods),XkbXKBFile); TryCopyStr(buf,",clearMods= ",sz); TryCopyStr(buf,tmp,sz); @@ -1045,7 +1044,7 @@ unsigned vmods,vmods_mask; /*ARGSUSED*/ static Bool -CopyDeviceBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyDeviceBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbDeviceBtnAction * act; @@ -1078,7 +1077,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyOtherArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyOtherArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbAnyAction * act; char tbuf[32]; @@ -1096,7 +1095,6 @@ char tbuf[32]; } typedef Bool (*actionCopy)( - Display * /* dpy */, XkbDescPtr /* xkb */, XkbAction * /* action */, char * /* buf */, @@ -1128,7 +1126,7 @@ static actionCopy copyActionArgs[XkbSA_NumActions] = { #define ACTION_SZ 256 char * -XkbActionText(Display *dpy,XkbDescPtr xkb,XkbAction *action,unsigned format) +XkbActionText(XkbDescPtr xkb,XkbAction *action,unsigned format) { char buf[ACTION_SZ],*tmp; int sz; @@ -1145,8 +1143,8 @@ int sz; sprintf(buf,"%s(",XkbActionTypeText(action->type,XkbXKBFile)); sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */ if (action->type<(unsigned)XkbSA_NumActions) - (*copyActionArgs[action->type])(dpy,xkb,action,buf,&sz); - else CopyOtherArgs(dpy,xkb,action,buf,&sz); + (*copyActionArgs[action->type])(xkb,action,buf,&sz); + else CopyOtherArgs(xkb,action,buf,&sz); TryCopyStr(buf,")",&sz); } tmp= tbGetBuffer(strlen(buf)+1); diff --git a/xkb/xkmread.c b/xkb/xkmread.c index c6c18422d..b14a5beda 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -39,23 +39,18 @@ #include <X11/keysym.h> #include "misc.h" #include "inputstr.h" -#include <X11/extensions/XKBstr.h> -#define XKBSRV_NEED_FILE_FUNCS -#include <xkbsrv.h> -#include <X11/extensions/XKBgeom.h> +#include "xkbstr.h" +#include "xkbsrv.h" +#include "xkbgeom.h" Atom -XkbInternAtom(Display *dpy,char *str,Bool only_if_exists) +XkbInternAtom(char *str,Bool only_if_exists) { if (str==NULL) return None; return MakeAtom(str,strlen(str),!only_if_exists); } -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - char * _XkbDupString(char *str) { @@ -71,18 +66,18 @@ char *new; /***====================================================================***/ -static XPointer -XkmInsureSize(XPointer oldPtr,int oldCount,int *newCountRtrn,int elemSize) +static void * +XkmInsureSize(void *oldPtr,int oldCount,int *newCountRtrn,int elemSize) { int newCount= *newCountRtrn; if (oldPtr==NULL) { if (newCount==0) return NULL; - oldPtr= (XPointer)_XkbCalloc(newCount,elemSize); + oldPtr= _XkbCalloc(newCount,elemSize); } else if (oldCount<newCount) { - oldPtr= (XPointer)_XkbRealloc(oldPtr,newCount*elemSize); + oldPtr= _XkbRealloc(oldPtr,newCount*elemSize); if (oldPtr!=NULL) { char *tmp= (char *)oldPtr; bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize); @@ -170,14 +165,12 @@ int count,nRead=0; /***====================================================================***/ static int -ReadXkmVirtualMods(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) +ReadXkmVirtualMods(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes) { register unsigned int i,bit; unsigned int bound,named,tmp; int nRead=0; -XkbDescPtr xkb; - xkb= result->xkb; if (XkbAllocServerMap(xkb,XkbVirtualModsMask,0)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmVirtualMods",0); return -1; @@ -202,7 +195,7 @@ XkbDescPtr xkb; char name[100]; if (named&bit) { if (nRead+=XkmGetCountedString(file,name,100)) { - xkb->names->vmods[i]= XkbInternAtom(xkb->dpy,name,False); + xkb->names->vmods[i]= XkbInternAtom(name,False); if (changes) changes->names.changed_vmods|= bit; } @@ -214,16 +207,14 @@ XkbDescPtr xkb; /***====================================================================***/ static int -ReadXkmKeycodes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) +ReadXkmKeycodes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes) { register int i; unsigned minKC,maxKC,nAl; int nRead=0; char name[100]; XkbKeyNamePtr pN; -XkbDescPtr xkb; - xkb= result->xkb; name[0]= '\0'; nRead+= XkmGetCountedString(file,name,100); minKC= XkmGetCARD8(file,&nRead); @@ -249,7 +240,7 @@ XkbDescPtr xkb; return -1; } if (name[0]!='\0') { - xkb->names->keycodes= XkbInternAtom(xkb->dpy,name,False); + xkb->names->keycodes= XkbInternAtom(name,False); } for (pN=&xkb->names->keys[minKC],i=minKC;i<=(int)maxKC;i++,pN++) { @@ -281,7 +272,7 @@ XkbDescPtr xkb; /***====================================================================***/ static int -ReadXkmKeyTypes(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) +ReadXkmKeyTypes(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes) { register unsigned i,n; unsigned num_types; @@ -292,9 +283,7 @@ xkmKeyTypeDesc wire; XkbKTMapEntryPtr entry; xkmKTMapEntryDesc wire_entry; char buf[100]; -XkbDescPtr xkb; - xkb= result->xkb; if ((tmp= XkmGetCountedString(file,buf,100))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmKeyTypes",0); return -1; @@ -305,7 +294,7 @@ XkbDescPtr xkb; _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0); return -1; } - xkb->names->types= XkbInternAtom(xkb->dpy,buf,False); + xkb->names->types= XkbInternAtom(buf,False); } num_types= XkmGetCARD16(file,&nRead); nRead+= XkmSkipPadding(file,2); @@ -360,7 +349,7 @@ XkbDescPtr xkb; return -1; } if (buf[0]!='\0') { - type->name= XkbInternAtom(xkb->dpy,buf,False); + type->name= XkbInternAtom(buf,False); } else type->name= None; @@ -398,7 +387,7 @@ XkbDescPtr xkb; nRead+= tmp; if (strlen(buf)==0) type->level_names[n]= None; - else type->level_names[n]= XkbInternAtom(xkb->dpy,buf,0); + else type->level_names[n]= XkbInternAtom(buf,0); } } } @@ -419,7 +408,7 @@ XkbDescPtr xkb; /***====================================================================***/ static int -ReadXkmCompatMap(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) +ReadXkmCompatMap(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes) { register int i; unsigned num_si,groups; @@ -428,10 +417,8 @@ XkbSymInterpretPtr interp; xkmSymInterpretDesc wire; unsigned tmp; int nRead=0; -XkbDescPtr xkb; XkbCompatMapPtr compat; - xkb= result->xkb; if ((tmp= XkmGetCountedString(file,name,100))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmCompatMap",0); return -1; @@ -442,7 +429,7 @@ XkbCompatMapPtr compat; _XkbLibError(_XkbErrBadAlloc,"ReadXkmCompatMap",0); return -1; } - xkb->names->compat= XkbInternAtom(xkb->dpy,name,False); + xkb->names->compat= XkbInternAtom(name,False); } num_si= XkmGetCARD16(file,&nRead); groups= XkmGetCARD8(file,&nRead); @@ -497,16 +484,14 @@ XkbCompatMapPtr compat; } static int -ReadXkmIndicators(FILE *file,XkbFileInfo *result,XkbChangesPtr changes) +ReadXkmIndicators(FILE *file,XkbDescPtr xkb,XkbChangesPtr changes) { register unsigned nLEDs; xkmIndicatorMapDesc wire; char buf[100]; unsigned tmp; int nRead=0; -XkbDescPtr xkb; - xkb= result->xkb; if ((xkb->indicators==NULL)&&(XkbAllocIndicatorMaps(xkb)!=Success)) { _XkbLibError(_XkbErrBadAlloc,"indicator rec",0); return -1; @@ -528,7 +513,7 @@ XkbDescPtr xkb; } nRead+= tmp; if (buf[0]!='\0') - name= XkbInternAtom(xkb->dpy,buf,False); + name= XkbInternAtom(buf,False); else name= None; if ((tmp=fread(&wire,SIZEOF(xkmIndicatorMapDesc),1,file))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0); @@ -562,10 +547,8 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms) register unsigned i; for (i=0;i<xkb->map->num_types;i++) { if (xkb->map->types[i].name==name) { -#ifdef DEBUG if (xkb->map->types[i].num_levels!=width) - fprintf(stderr,"Group width mismatch between key and type\n"); -#endif + DebugF("Group width mismatch between key and type\n"); return &xkb->map->types[i]; } } @@ -582,16 +565,14 @@ FindTypeForKey(XkbDescPtr xkb,Atom name,unsigned width,KeySym *syms) } static int -ReadXkmSymbols(FILE *file,XkbFileInfo *result) +ReadXkmSymbols(FILE *file,XkbDescPtr xkb) { register int i,g,s,totalVModMaps; xkmKeySymMapDesc wireMap; char buf[100]; unsigned minKC,maxKC,groupNames,tmp; int nRead=0; -XkbDescPtr xkb; - xkb= result->xkb; if ((tmp=XkmGetCountedString(file,buf,100))<1) return -1; nRead+= tmp; @@ -607,7 +588,7 @@ XkbDescPtr xkb; } if ((buf[0]!='\0')&&(xkb->names)) { Atom name; - name= XkbInternAtom(xkb->dpy,buf,0); + name= XkbInternAtom(buf,0); xkb->names->symbols= name; xkb->names->phys_symbols= name; } @@ -618,7 +599,7 @@ XkbDescPtr xkb; nRead+= tmp; if ((buf[0]!='\0')&&(xkb->names)) { Atom name; - name= XkbInternAtom(xkb->dpy,buf,0); + name= XkbInternAtom(buf,0); xkb->names->groups[i]= name; } else xkb->names->groups[i]= None; @@ -661,7 +642,7 @@ XkbDescPtr xkb; for (g=0;g<XkbNumKbdGroups;g++) { if ((wireMap.flags&(1<<g))&& ((tmp=XkmGetCountedString(file,buf,100))>0)) { - typeName[g]= XkbInternAtom(xkb->dpy,buf,1); + typeName[g]= XkbInternAtom(buf,1); nRead+= tmp; } type[g]=FindTypeForKey(xkb,typeName[g],wireMap.width,NULL); @@ -739,7 +720,6 @@ XkbDescPtr xkb; static int ReadXkmGeomDoodad( FILE * file, - Display * dpy, XkbGeometryPtr geom, XkbSectionPtr section) { @@ -752,7 +732,7 @@ int nRead=0; nRead+= XkmGetCountedString(file,buf,100); tmp= fread(&doodadWire,SIZEOF(xkmDoodadDesc),1,file); nRead+= SIZEOF(xkmDoodadDesc)*tmp; - doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(dpy,buf,False)); + doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(buf,False)); if (!doodad) return nRead; doodad->any.type= doodadWire.any.type; @@ -797,7 +777,6 @@ int nRead=0; static int ReadXkmGeomOverlay( FILE * file, - Display * dpy, XkbGeometryPtr geom, XkbSectionPtr section) { @@ -813,7 +792,7 @@ register int r; nRead+= XkmGetCountedString(file,buf,100); tmp= fread(&olWire,SIZEOF(xkmOverlayDesc),1,file); nRead+= tmp*SIZEOF(xkmOverlayDesc); - ol= XkbAddGeomOverlay(section,XkbInternAtom(dpy,buf,False), + ol= XkbAddGeomOverlay(section,XkbInternAtom(buf,False), olWire.num_rows); if (!ol) return nRead; @@ -840,7 +819,6 @@ register int r; static int ReadXkmGeomSection( FILE * file, - Display * dpy, XkbGeometryPtr geom) { register int i; @@ -852,7 +830,7 @@ char buf[100]; Atom nameAtom; nRead+= XkmGetCountedString(file,buf,100); - nameAtom= XkbInternAtom(dpy,buf,False); + nameAtom= XkbInternAtom(buf,False); tmp= fread(§ionWire,SIZEOF(xkmSectionDesc),1,file); nRead+= SIZEOF(xkmSectionDesc)*tmp; section= XkbAddGeomSection(geom,nameAtom,sectionWire.num_rows, @@ -903,7 +881,7 @@ Atom nameAtom; } if (sectionWire.num_doodads>0) { for (i=0;i<sectionWire.num_doodads;i++) { - tmp= ReadXkmGeomDoodad(file,dpy,geom,section); + tmp= ReadXkmGeomDoodad(file,geom,section); nRead+= tmp; if (tmp<1) return nRead; @@ -911,7 +889,7 @@ Atom nameAtom; } if (sectionWire.num_overlays>0) { for (i=0;i<sectionWire.num_overlays;i++) { - tmp= ReadXkmGeomOverlay(file,dpy,geom,section); + tmp= ReadXkmGeomOverlay(file,geom,section); nRead+= tmp; if (tmp<1) return nRead; @@ -921,7 +899,7 @@ Atom nameAtom; } static int -ReadXkmGeometry(FILE *file,XkbFileInfo *result) +ReadXkmGeometry(FILE *file,XkbDescPtr xkb) { register int i; char buf[100]; @@ -941,12 +919,12 @@ XkbGeometrySizesRec sizes; sizes.num_sections= wireGeom.num_sections; sizes.num_doodads= wireGeom.num_doodads; sizes.num_key_aliases= wireGeom.num_key_aliases; - if (XkbAllocGeometry(result->xkb,&sizes)!=Success) { + if (XkbAllocGeometry(xkb,&sizes)!=Success) { _XkbLibError(_XkbErrBadAlloc,"ReadXkmGeometry",0); return nRead; } - geom= result->xkb->geom; - geom->name= XkbInternAtom(result->xkb->dpy,buf,False); + geom= xkb->geom; + geom->name= XkbInternAtom(buf,False); geom->width_mm= wireGeom.width_mm; geom->height_mm= wireGeom.height_mm; nRead+= XkmGetCountedString(file,buf,100); @@ -982,7 +960,7 @@ XkbGeometrySizesRec sizes; XkbOutlinePtr ol; xkmOutlineDesc olWire; nRead+= XkmGetCountedString(file,buf,100); - nameAtom= XkbInternAtom(result->xkb->dpy,buf,False); + nameAtom= XkbInternAtom(buf,False); tmp= fread(&shapeWire,SIZEOF(xkmShapeDesc),1,file); nRead+= tmp*SIZEOF(xkmShapeDesc); shape= XkbAddGeomShape(geom,nameAtom,shapeWire.num_outlines); @@ -1021,7 +999,7 @@ XkbGeometrySizesRec sizes; } if (wireGeom.num_sections>0) { for (i=0;i<wireGeom.num_sections;i++) { - tmp= ReadXkmGeomSection(file,result->xkb->dpy,geom); + tmp= ReadXkmGeomSection(file,geom); nRead+= tmp; if (tmp==0) return nRead; @@ -1029,7 +1007,7 @@ XkbGeometrySizesRec sizes; } if (wireGeom.num_doodads>0) { for (i=0;i<wireGeom.num_doodads;i++) { - tmp= ReadXkmGeomDoodad(file,result->xkb->dpy,geom,NULL); + tmp= ReadXkmGeomDoodad(file,geom,NULL); nRead+= tmp; if (tmp==0) return nRead; @@ -1065,7 +1043,7 @@ int nRead=0; return 1; } -Bool +static Bool XkmReadTOC(FILE *file,xkmFileInfo* file_info,int max_toc,xkmSectionInfo *toc) { unsigned hdr,tmp; @@ -1086,10 +1064,8 @@ unsigned i,size_toc; fread(file_info,SIZEOF(xkmFileInfo),1,file); size_toc= file_info->num_toc; if (size_toc>max_toc) { -#ifdef DEBUG - fprintf(stderr,"Warning! Too many TOC entries; last %d ignored\n", + DebugF("Warning! Too many TOC entries; last %d ignored\n", size_toc-max_toc); -#endif size_toc= max_toc; } for (i=0;i<size_toc;i++) { @@ -1098,117 +1074,11 @@ unsigned i,size_toc; return 1; } -Bool -XkmReadFileSection( FILE * file, - xkmSectionInfo * toc, - XkbFileInfo * result, - unsigned * loaded_rtrn) -{ -xkmSectionInfo tmpTOC; -int nRead; - - if ((!result)||(!result->xkb)) { - _XkbLibError(_XkbErrBadMatch,"XkmReadFileSection",0); - return 0; - } - fseek(file,toc->offset,SEEK_SET); - fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file); - nRead= SIZEOF(xkmSectionInfo); - if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)|| - (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) { - _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSection",0); - return 0; - } - switch (tmpTOC.type) { - case XkmVirtualModsIndex: - nRead+= ReadXkmVirtualMods(file,result,NULL); - if ((loaded_rtrn)&&(nRead>=0)) - *loaded_rtrn|= XkmVirtualModsMask; - break; - case XkmTypesIndex: - nRead+= ReadXkmKeyTypes(file,result,NULL); - if ((loaded_rtrn)&&(nRead>=0)) - *loaded_rtrn|= XkmTypesMask; - break; - case XkmCompatMapIndex: - nRead+= ReadXkmCompatMap(file,result,NULL); - if ((loaded_rtrn)&&(nRead>=0)) - *loaded_rtrn|= XkmCompatMapMask; - break; - case XkmKeyNamesIndex: - nRead+= ReadXkmKeycodes(file,result,NULL); - if ((loaded_rtrn)&&(nRead>=0)) - *loaded_rtrn|= XkmKeyNamesMask; - break; - case XkmSymbolsIndex: - nRead+= ReadXkmSymbols(file,result); - if ((loaded_rtrn)&&(nRead>=0)) - *loaded_rtrn|= XkmSymbolsMask; - break; - case XkmIndicatorsIndex: - nRead+= ReadXkmIndicators(file,result,NULL); - if ((loaded_rtrn)&&(nRead>=0)) - *loaded_rtrn|= XkmIndicatorsMask; - break; - case XkmGeometryIndex: - nRead+= ReadXkmGeometry(file,result); - if ((loaded_rtrn)&&(nRead>=0)) - *loaded_rtrn|= XkmGeometryMask; - break; - default: - _XkbLibError(_XkbErrBadImplementation, - XkbConfigText(tmpTOC.type,XkbMessage),0); - nRead= 0; - break; - } - if (nRead!=tmpTOC.size) { - _XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage), - nRead-tmpTOC.size); - return 0; - } - return (nRead>=0); -} - -char * -XkmReadFileSectionName(FILE *file,xkmSectionInfo *toc) -{ -xkmSectionInfo tmpTOC; -char name[100]; - - if ((!file)||(!toc)) - return 0; - switch (toc->type) { - case XkmVirtualModsIndex: - case XkmIndicatorsIndex: - break; - case XkmTypesIndex: - case XkmCompatMapIndex: - case XkmKeyNamesIndex: - case XkmSymbolsIndex: - case XkmGeometryIndex: - fseek(file,toc->offset,SEEK_SET); - fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file); - if ((tmpTOC.type!=toc->type)||(tmpTOC.format!=toc->format)|| - (tmpTOC.size!=toc->size)||(tmpTOC.offset!=toc->offset)) { - _XkbLibError(_XkbErrIllegalContents,"XkmReadFileSectionName",0); - return 0; - } - if (XkmGetCountedString(file,name,100)>0) - return _XkbDupString(name); - break; - default: - _XkbLibError(_XkbErrBadImplementation, - XkbConfigText(tmpTOC.type,XkbMessage),0); - break; - } - return NULL; -} - /***====================================================================***/ #define MAX_TOC 16 unsigned -XkmReadFile(FILE *file,unsigned need,unsigned want,XkbFileInfo *result) +XkmReadFile(FILE *file,unsigned need,unsigned want,XkbDescPtr *xkb) { register unsigned i; xkmSectionInfo toc[MAX_TOC],tmpTOC; @@ -1223,15 +1093,10 @@ unsigned which= need|want; need&(~fileInfo.present)); return which; } - result->type= fileInfo.type; - if (result->xkb==NULL) - result->xkb= XkbAllocKeyboard(); + if (*xkb==NULL) + *xkb= XkbAllocKeyboard(); for (i=0;i<fileInfo.num_toc;i++) { -#ifdef SEEK_SET fseek(file,toc[i].offset,SEEK_SET); -#else - fseek(file,toc[i].offset,0); -#endif tmp= fread(&tmpTOC,SIZEOF(xkmSectionInfo),1,file); nRead= tmp*SIZEOF(xkmSectionInfo); if ((tmpTOC.type!=toc[i].type)||(tmpTOC.format!=toc[i].format)|| @@ -1243,25 +1108,25 @@ unsigned which= need|want; } switch (tmpTOC.type) { case XkmVirtualModsIndex: - tmp= ReadXkmVirtualMods(file,result,NULL); + tmp= ReadXkmVirtualMods(file,*xkb,NULL); break; case XkmTypesIndex: - tmp= ReadXkmKeyTypes(file,result,NULL); + tmp= ReadXkmKeyTypes(file,*xkb,NULL); break; case XkmCompatMapIndex: - tmp= ReadXkmCompatMap(file,result,NULL); + tmp= ReadXkmCompatMap(file,*xkb,NULL); break; case XkmKeyNamesIndex: - tmp= ReadXkmKeycodes(file,result,NULL); + tmp= ReadXkmKeycodes(file,*xkb,NULL); break; case XkmIndicatorsIndex: - tmp= ReadXkmIndicators(file,result,NULL); + tmp= ReadXkmIndicators(file,*xkb,NULL); break; case XkmSymbolsIndex: - tmp= ReadXkmSymbols(file,result); + tmp= ReadXkmSymbols(file,*xkb); break; case XkmGeometryIndex: - tmp= ReadXkmGeometry(file,result); + tmp= ReadXkmGeometry(file,*xkb); break; default: _XkbLibError(_XkbErrBadImplementation, @@ -1272,7 +1137,7 @@ unsigned which= need|want; if (tmp>0) { nRead+= tmp; which&= ~(1<<toc[i].type); - result->defined|= (1<<toc[i].type); + (*xkb)->defined|= (1<<toc[i].type); } if (nRead!=tmpTOC.size) { _XkbLibError(_XkbErrBadLength,XkbConfigText(tmpTOC.type,XkbMessage), |