Merge branch 'master' into mpx

Conflicts:

	XTrap/xtrapddmi.c
	Xext/security.c
	Xext/xprint.c
	Xext/xtest.c
	Xext/xvdisp.c
	Xi/exevents.c
	Xi/grabdevb.c
	Xi/grabdevk.c
	Xi/opendev.c
	Xi/ungrdev.c
	Xi/ungrdevb.c
	Xi/ungrdevk.c
	dix/cursor.c
	dix/devices.c
	dix/dixutils.c
	dix/events.c
	dix/getevents.c
	dix/main.c
	dix/window.c
	hw/xfree86/ramdac/xf86Cursor.c
	include/dix.h
	include/input.h
	include/inputstr.h
	mi/midispcur.c
	mi/miinitext.c
	mi/misprite.c
	render/animcur.c
	xfixes/cursor.c
	xkb/xkbAccessX.c
This commit is contained in:
Peter Hutterer 2008-01-03 17:04:54 +10:30
commit 8da83836b6
718 changed files with 11611 additions and 33736 deletions

8
.gitignore vendored
View File

@ -8,6 +8,11 @@ Makefile.in
*.a
*.o
*~
.*.swp
*.pbxuser
*.mode1v3
obj*
build*
aclocal.m4
autom4te.cache
compile
@ -92,8 +97,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
@ -298,4 +301,3 @@ mfb/mfbteblack.c
mfb/mfbtewhite.c
mfb/mfbtileC.c
mfb/mfbtileG.c
.*.swp

200
COPYING
View File

@ -1,3 +1,45 @@
The following is the 'standard copyright' agreed upon by most contributors,
and is currently the canonical license, though a modification is currently
under discussion. Copyright holders of new code should use this license
statement where possible, and append their name to this list. Please sort
by surname for people, and by the full name for other entities (e.g.
Juliusz Chroboczek sorts before Intel Corporation sorts before Daniel
Stone).
Copyright © 2000-2001 Juliusz Chroboczek
Copyright © 2006-2007 Intel Corporation
Copyright © 2006 Nokia Corporation
Copyright © 1999 Keith Packard
Copyright © 2005-2007 Daniel Stone
Copyright © 2006 Luc Verhaegen
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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
The following licenses are 'legacy': usually MIT/X11 licenses with the name
of the copyright holder(s) in the license statement, but also some BSD-like
licenses.
Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
@ -1058,27 +1100,6 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
Copyright © 2003-2005 Keith Packard, Daniel Stone
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 names of Keith Packard and Daniel Stone not be
used in advertising or publicity pertaining to distribution of the software
without specific, written prior permission. Keith Packard and Daniel Stone
make no representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied warranty.
KEITH PACKARD AND DANIEL STONE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
IN NO EVENT SHALL KEITH PACKARD OR DANIEL STONE 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.
Copyright © 1999 Keith Packard
Copyright © 2000 Compaq Computer Corporation
Copyright © 2002 MontaVista Software Inc.
@ -2357,54 +2378,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
Copyright (c) 1999 by Keith Packard
Copyright © 2006 Intel Corporation
Copyright 2006 Luc Verhaegen.
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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
Copyright (c) 2000-2001 by Juliusz Chroboczek
Copyright (c) 1999 by Keith Packard
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 AUTHORS OR COPYRIGHT HOLDERS
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.
Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
Copyright 1992 by David Dawes <dawes@XFree86.org>
Copyright 1992 by Jim Tsillas <jtsilla@damon.ccs.northeastern.edu>
@ -2622,92 +2595,3 @@ 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.
Copyright © 2006 Daniel Stone
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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
Copyright © 2006-2007 Daniel Stone
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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
Copyright © 2007 Daniel Stone
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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS 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.
Copyright © 1999 Keith Packard
Copyright © 2006 Nokia Corporation
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 make no
representations about the suitability of this software for any purpose. It
is provided "as is" without express or implied warranty.
THE AUTHORS DISCLAIM 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.

View File

@ -1,7 +1,9 @@
if XDARWIN
DARWIN_SUBDIRS = apple
if XQUARTZ
XQUARTZ_SUBDIRS = apple
endif
SUBDIRS = glx mesa $(DARWIN_SUBDIRS)
SUBDIRS = glx mesa $(XQUARTZ_SUBDIRS)
DIST_SUBDIRS = glx mesa apple
WINDOWS_EXTRAS = \
windows/ChangeLog \

View File

@ -1,8 +1,12 @@
AM_CFLAGS = -I$(top_srcdir) \
-I$(top_srcdir)/hw/darwin/quartz \
-I$(top_srcdir)/GL/glx \
-I$(top_srcdir)/hw/darwin/quartz/cr \
-I$(top_srcdir)/GL/include
AM_CFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/GL/glx \
-I$(top_srcdir)/GL/include \
-I$(top_srcdir)/GL/mesa/glapi \
-I$(top_srcdir)/hw/xquartz \
-I$(top_srcdir)/hw/xquartz/xpr \
-I$(top_srcdir)/miext/damage
if HAVE_AGL_FRAMEWORK
noinst_LIBRARIES = libAGLcore.a
@ -13,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

View File

@ -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;

View File

@ -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,
@ -497,19 +498,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);
@ -548,9 +539,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);

View File

@ -5169,31 +5169,6 @@ void __glXDisp_LoadProgramNV(GLbyte * pc)
) );
}
void __glXDisp_ProgramParameter4dvNV(GLbyte * pc)
{
#ifdef __GLX_ALIGN64
if ((unsigned long)(pc) & 7) {
(void) memmove(pc-4, pc, 40);
pc -= 4;
}
#endif
CALL_ProgramParameter4dvNV( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
*(GLuint *)(pc + 4),
(const GLdouble *)(pc + 8)
) );
}
void __glXDisp_ProgramParameter4fvNV(GLbyte * pc)
{
CALL_ProgramParameter4fvNV( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
*(GLuint *)(pc + 4),
(const GLfloat *)(pc + 8)
) );
}
void __glXDisp_ProgramParameters4dvNV(GLbyte * pc)
{
const GLuint num = *(GLuint *)(pc + 8);

View File

@ -149,8 +149,6 @@ extern HIDDEN int __glXDisp_GetProgramNamedParameterfvNV(struct __GLXclientState
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_ProgramParameter4dvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ProgramParameter4dvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_TexCoord2sv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_TexCoord2sv(GLbyte * pc);
extern HIDDEN void __glXDisp_Vertex4dv(GLbyte * pc);
@ -425,8 +423,6 @@ 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_ProgramParameter4fvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ProgramParameter4fvNV(GLbyte * pc);
extern HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc);
extern HIDDEN void __glXDisp_Color4ubv(GLbyte * pc);

View File

@ -5325,31 +5325,6 @@ void __glXDispSwap_LoadProgramNV(GLbyte * pc)
) );
}
void __glXDispSwap_ProgramParameter4dvNV(GLbyte * pc)
{
#ifdef __GLX_ALIGN64
if ((unsigned long)(pc) & 7) {
(void) memmove(pc-4, pc, 40);
pc -= 4;
}
#endif
CALL_ProgramParameter4dvNV( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
(GLuint )bswap_CARD32 ( pc + 4 ),
(const GLdouble *)bswap_64_array( (uint64_t *) (pc + 8), 4 )
) );
}
void __glXDispSwap_ProgramParameter4fvNV(GLbyte * pc)
{
CALL_ProgramParameter4fvNV( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
(GLuint )bswap_CARD32 ( pc + 4 ),
(const GLfloat *)bswap_32_array( (uint32_t *) (pc + 8), 4 )
) );
}
void __glXDispSwap_ProgramParameters4dvNV(GLbyte * pc)
{
const GLuint num = (GLuint )bswap_CARD32 ( pc + 8 );

View File

@ -652,6 +652,10 @@ __glGetBooleanv_size(GLenum e)
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:*/

View File

@ -644,7 +644,7 @@ static const void *Render_function_table[400][2] = {
/* [ 301] = 4181 */ {__glXDisp_ExecuteProgramNV, __glXDispSwap_ExecuteProgramNV},
/* [ 302] = 4182 */ {__glXDisp_RequestResidentProgramsNV, __glXDispSwap_RequestResidentProgramsNV},
/* [ 303] = 4183 */ {__glXDisp_LoadProgramNV, __glXDispSwap_LoadProgramNV},
/* [ 304] = 4184 */ {__glXDisp_ProgramParameter4fvNV, __glXDispSwap_ProgramParameter4fvNV},
/* [ 304] = 4184 */ {__glXDisp_ProgramEnvParameter4fvARB, __glXDispSwap_ProgramEnvParameter4fvARB},
/* [ 305] = 4185 */ {__glXDisp_ProgramEnvParameter4dvARB, __glXDispSwap_ProgramEnvParameter4dvARB},
/* [ 306] = 4186 */ {__glXDisp_ProgramParameters4fvNV, __glXDispSwap_ProgramParameters4fvNV},
/* [ 307] = 4187 */ {__glXDisp_ProgramParameters4dvNV, __glXDispSwap_ProgramParameters4dvNV},

View File

@ -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"

View File

@ -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 */
@ -278,7 +278,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;
}
@ -303,7 +303,7 @@ Bool XETrapRedirectDevices()
#ifndef VECTORED_EVENTS
if (XETrapPtrDev == NULL)
{
if ((XETrapPtrDev = LookupPointerDevice()) == 0L)
if ((XETrapPtrDev = (DevicePtr)inputInfo.pointer) == 0L)
{
retval = False;
}

View File

@ -35,9 +35,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "EVIstruct.h"
#include "modinit.h"
#if 0
static unsigned char XEVIReqCode = 0;
#endif
static EviPrivPtr eviPriv;
static int
@ -182,19 +179,9 @@ EVIResetProc(ExtensionEntry *extEntry)
void
EVIExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(EVINAME, 0, 0,
ProcEVIDispatch,
SProcEVIDispatch,
EVIResetProc, StandardMinorOpcode))) {
XEVIReqCode = (unsigned char)extEntry->base;
#else
if (AddExtension(EVINAME, 0, 0,
ProcEVIDispatch, SProcEVIDispatch,
EVIResetProc, StandardMinorOpcode)) {
#endif
eviPriv = eviDDXInit();
}
}

View File

@ -34,9 +34,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
@ -76,13 +73,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
BUILTIN_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
@ -160,7 +161,6 @@ libXextmodule_la_SOURCES = $(MODULE_SRCS)
endif
EXTRA_DIST = \
$(SERVERCONFIG_DATA) \
$(MITSHM_SRCS) \
$(XV_SRCS) \
$(RES_SRCS) \

View File

@ -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

View File

@ -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;

View File

@ -41,10 +41,6 @@ from The Open Group.
#include "opaque.h"
#include "modinit.h"
#if 0
static unsigned char XBigReqCode;
#endif
static void BigReqResetProc(
ExtensionEntry * /* extEntry */
);
@ -54,20 +50,9 @@ static DISPATCH_PROC(ProcBigReqDispatch);
void
BigReqExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
BigReqResetProc, StandardMinorOpcode)) != 0)
XBigReqCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
BigReqResetProc, StandardMinorOpcode);
#endif
DeclareExtensionSecurity(XBigReqExtensionName, TRUE);
AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
BigReqResetProc, StandardMinorOpcode);
}
/*ARGSUSED*/

View File

@ -51,11 +51,6 @@ static int ProcDispatch(ClientPtr client);
static int SProcDispatch(ClientPtr client);
static void ResetProc(ExtensionEntry* extEntry);
#if 0
static unsigned char ReqCode = 0;
static int ErrorBase;
#endif
#if defined(WIN32) || defined(TESTWIN32)
#define HAVE_SPECIAL_DESKTOP_COLORS
#endif
@ -128,20 +123,6 @@ static xColorItem citems[] = {
void
XcupExtensionInit (INITARGS)
{
#if 0
ExtensionEntry* extEntry;
if ((extEntry = AddExtension (XCUPNAME,
0,
XcupNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase;
}
#else
(void) AddExtension (XCUPNAME,
0,
XcupNumberErrors,
@ -149,7 +130,6 @@ XcupExtensionInit (INITARGS)
SProcDispatch,
ResetProc,
StandardMinorOpcode);
#endif
/* PC servers initialize the desktop colors (citems) here! */
}
@ -224,12 +204,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;
@ -273,7 +254,7 @@ int ProcStoreColors(
return client->noClientException;
} else {
client->errorValue = stuff->cmap;
return BadColor;
return (rc == BadValue) ? BadColor : rc;
}
}

View File

@ -50,9 +50,6 @@ Equipment Corporation.
#include "dpmsproc.h"
#include "modinit.h"
#if 0
static unsigned char DPMSCode;
#endif
static DISPATCH_PROC(ProcDPMSDispatch);
static DISPATCH_PROC(SProcDPMSDispatch);
static DISPATCH_PROC(ProcDPMSGetVersion);
@ -76,18 +73,9 @@ static void DPMSResetProc(ExtensionEntry* extEntry);
void
DPMSExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSResetProc, StandardMinorOpcode)))
DPMSCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSResetProc, StandardMinorOpcode);
#endif
AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
DPMSResetProc, StandardMinorOpcode);
}
/*ARGSUSED*/
@ -218,7 +206,7 @@ ProcDPMSDisable(client)
REQUEST_SIZE_MATCH(xDPMSDisableReq);
DPMSSet(DPMSModeOn);
DPMSSet(client, DPMSModeOn);
DPMSEnabled = FALSE;
@ -253,7 +241,7 @@ ProcDPMSForceLevel(client)
return BadValue;
}
DPMSSet(stuff->level);
DPMSSet(client, stuff->level);
return(client->noClientException);
}

View File

@ -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);

View File

@ -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;
}

View File

@ -67,10 +67,6 @@ static DISPATCH_PROC(SProcFontCacheGetCacheStatistics);
static DISPATCH_PROC(SProcFontCacheQueryVersion);
static DISPATCH_PROC(SProcFontCacheChangeCacheSettings);
#if 0
static unsigned char FontCacheReqCode = 0;
#endif
void
FontCacheExtensionInit(INITARGS)
{
@ -84,9 +80,6 @@ FontCacheExtensionInit(INITARGS)
SProcFontCacheDispatch,
FontCacheResetProc,
StandardMinorOpcode))) {
#if 0
FontCacheReqCode = (unsigned char)extEntry->base;
#endif
miscErrorBase = extEntry->errorBase;
}
}

View File

@ -38,7 +38,7 @@ from the author.
int GEEventBase;
int GEErrorBase;
int GEClientPrivateIndex;
DevPrivateKey GEClientPrivateKey = &GEClientPrivateKey;
int GEEventType; /* The opcode for all GenericEvents will have. */
@ -96,7 +96,6 @@ static int ProcGEQueryVersion(ClientPtr client)
swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof(xGEQueryVersionReply), (char*)&rep);
return(client->noClientException);
}
@ -166,6 +165,12 @@ static void GEClientCallback(CallbackListPtr *list,
ClientPtr pClient = clientinfo->client;
GEClientInfoPtr pGEClient = GEGetClient(pClient);
if (pGEClient == NULL)
{
pGEClient = xcalloc(1, sizeof(GEClientInfoRec));
dixSetPrivate(&pClient->devPrivates, GEClientPrivateKey, pGEClient);
}
pGEClient->major_version = 0;
pGEClient->minor_version = 0;
}
@ -200,18 +205,11 @@ SGEGenericEvent(xEvent* from, xEvent* to)
}
/* init extension, register at server */
void
void
GEExtensionInit(void)
{
ExtensionEntry *extEntry;
GEClientPrivateIndex = AllocateClientPrivateIndex();
if (!AllocateClientPrivate(GEClientPrivateIndex,
sizeof(GenericMaskRec)))
{
FatalError("GEExtensionInit: Alloc client private failed.\n");
}
if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
{
FatalError("GEExtensionInit: register client callback failed.\n");
@ -228,7 +226,7 @@ GEExtensionInit(void)
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[X_GenericEvent] = (EventSwapPtr) SGEGenericEvent;
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
} else {
FatalError("GEInit: AddExtensions failed.\n");
}

View File

@ -45,14 +45,14 @@ from the author.
extern int GEEventType;
extern int GEEventBase;
extern int GEErrorBase;
extern int GEClientPrivateIndex;
extern DevPrivateKey GEClientPrivateKey;
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr) (pClient)->devPrivates[GEClientPrivateIndex].ptr)
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
extern int (*ProcGEVector[/*GENumRequests*/])(ClientPtr);
extern int (*SProcGEVector[/*GENumRequests*/])(ClientPtr);

View File

@ -59,9 +59,6 @@ in this Software without prior written authorization from The Open Group.
#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
#if 0
static unsigned char MultibufferReqCode;
#endif
static int MultibufferEventBase;
static int MultibufferErrorBase;
int MultibufferScreenIndex = -1;
@ -235,7 +232,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);
@ -247,9 +244,6 @@ MultibufferExtensionInit()
ProcMultibufferDispatch, SProcMultibufferDispatch,
MultibufferResetProc, StandardMinorOpcode)))
{
#if 0
MultibufferReqCode = (unsigned char)extEntry->base;
#endif
MultibufferEventBase = extEntry->eventBase;
MultibufferErrorBase = extEntry->errorBase;
EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;

View File

@ -42,10 +42,6 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/mitmiscstr.h>
#include "modinit.h"
#if 0
static unsigned char MITReqCode;
#endif
static void MITResetProc(
ExtensionEntry * /* extEntry */
);
@ -60,18 +56,9 @@ static DISPATCH_PROC(SProcMITSetBugMode);
void
MITMiscExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode)) != 0)
MITReqCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode);
#endif
AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
MITResetProc, StandardMinorOpcode);
}
/*ARGSUSED*/

View File

@ -65,9 +65,6 @@ extern VisualPtr glxMatchVisual(ScreenPtr pScreen,
ScreenPtr pMatchScreen);
#endif
#if 0
static unsigned char PanoramiXReqCode = 0;
#endif
/*
* PanoramiX data declarations
*/
@ -110,8 +107,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;
@ -140,8 +137,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)\
@ -152,8 +149,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;
@ -171,14 +168,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;
@ -284,8 +281,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)
@ -471,10 +468,6 @@ void PanoramiXExtensionInit(int argc, char *argv[])
break;
}
#if 0
PanoramiXReqCode = (unsigned char)extEntry->base;
#endif
/*
* First make sure all the basic allocations succeed. If not,
* run in non-PanoramiXeen mode.
@ -484,20 +477,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;

View File

@ -41,10 +41,6 @@ Equipment Corporation.
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
#if 0
#include <sys/workstation.h>
#include <X11/Xserver/ws.h>
#endif
#include "panoramiX.h"
#include <X11/extensions/panoramiXproto.h>
#include "panoramiXsrv.h"
@ -70,6 +66,7 @@ SProcPanoramiXGetState(ClientPtr client)
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl (&stuff->window, n);
return ProcPanoramiXGetState(client);
}
@ -81,6 +78,7 @@ SProcPanoramiXGetScreenCount(ClientPtr client)
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
swapl (&stuff->window, n);
return ProcPanoramiXGetScreenCount(client);
}
@ -92,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);
}

View File

@ -54,16 +54,6 @@ Equipment Corporation.
#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
CWDontPropagate | CWOverrideRedirect | CWCursor )
#if 0
extern void (* EventSwapVector[128]) (fsError *, fsError *);
extern void Swap32Write();
extern void SLHostsExtend();
extern void SQColorsExtend();
WriteSConnectionInfo();
extern void WriteSConnSetupPrefix();
#endif
/* Various of the DIX function interfaces were not designed to allow
* the client->errorValue to be set on BadValue and other errors.
* Rather than changing interfaces and breaking untold code we introduce
@ -1049,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);
@ -1086,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);
@ -1195,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);

View File

@ -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"
@ -61,9 +62,6 @@ in this Software without prior written authorization from the X Consortium.
#include "modinit.h"
#if 0
static unsigned char ScreenSaverReqCode = 0;
#endif
static int ScreenSaverEventBase = 0;
static DISPATCH_PROC(ProcScreenSaverQueryInfo);
@ -234,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)))
@ -260,21 +260,17 @@ 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)))
{
#if 0
ScreenSaverReqCode = (unsigned char)extEntry->base;
#endif
ScreenSaverEventBase = extEntry->eventBase;
EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent;
}
@ -454,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;
@ -788,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;
@ -857,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;
@ -893,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;
@ -1054,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))
@ -1069,7 +1080,7 @@ ScreenSaverSetAttributes (ClientPtr client)
}
else
{
ret = BadPixmap;
ret = (ret == BadValue) ? BadPixmap : ret;
client->errorValue = pixID;
goto PatchUp;
}
@ -1091,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))
@ -1106,7 +1118,7 @@ ScreenSaverSetAttributes (ClientPtr client)
}
else
{
ret = BadPixmap;
ret = (ret == BadValue) ? BadPixmap : ret;
client->errorValue = pixID;
goto PatchUp;
}
@ -1184,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;
}
@ -1207,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;
}
@ -1252,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);

File diff suppressed because it is too large Load Diff

View File

@ -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 */

View File

@ -111,9 +111,6 @@ static DISPATCH_PROC(SProcShapeSelectInput);
#include "panoramiXsrv.h"
#endif
#if 0
static unsigned char ShapeReqCode = 0;
#endif
static int ShapeEventBase = 0;
static RESTYPE ClientType, EventType; /* resource types for event masks */
@ -154,9 +151,6 @@ ShapeExtensionInit(void)
ProcShapeDispatch, SProcShapeDispatch,
ShapeResetProc, StandardMinorOpcode)))
{
#if 0
ShapeReqCode = (unsigned char)extEntry->base;
#endif
ShapeEventBase = extEntry->eventBase;
EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
}
@ -323,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) {
@ -423,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) {
@ -444,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;
@ -531,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)
@ -552,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) {
@ -651,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) {
@ -716,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;
@ -826,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,
@ -999,7 +993,7 @@ ProcShapeInputSelected (client)
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,
@ -1041,7 +1035,7 @@ ProcShapeGetRectangles (client)
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) {

View File

@ -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);
}
@ -815,7 +808,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 +848,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 +961,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);
@ -1100,7 +1093,7 @@ 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;
@ -1129,7 +1122,13 @@ CreatePmap:
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 +1136,7 @@ CreatePmap:
{
return(client->noClientException);
}
pDraw->pScreen->DestroyPixmap(pMap);
}
return (BadAlloc);
}

View File

@ -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;
}

View File

@ -22,9 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include <stdarg.h>
#include "windowstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
#include "xacestr.h"
#include "modinit.h"
@ -81,95 +79,117 @@ 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 = {
va_arg(ap, ClientPtr),
va_arg(ap, WindowPtr),
va_arg(ap, Atom),
va_arg(ap, PropertyPtr),
va_arg(ap, Mask),
XaceAllowOperation /* default allow */
Success /* default allow */
};
calldata = &rec;
prv = &rec.rval;
prv = &rec.status;
break;
}
case XACE_DRAWABLE_ACCESS: {
XaceDrawableAccessRec rec = {
case XACE_SEND_ACCESS: {
XaceSendAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, DrawablePtr),
TRUE /* default allow */
va_arg(ap, DeviceIntPtr),
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_RECEIVE_ACCESS: {
XaceReceiveAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, WindowPtr),
TRUE /* default allow */
va_arg(ap, xEventPtr),
va_arg(ap, int),
Success /* default allow */
};
calldata = &rec;
prv = &rec.rval;
prv = &rec.status;
break;
}
case XACE_CLIENT_ACCESS: {
XaceClientAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, ClientPtr),
va_arg(ap, Mask),
Success /* default allow */
};
calldata = &rec;
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 */
case XACE_SELECTION_ACCESS: {
XaceSelectionAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, Atom),
va_arg(ap, Mask),
Success /* default allow */
};
calldata = &rec;
prv = &rec.rval;
prv = &rec.status;
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 +209,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,7 +218,7 @@ int XaceHook(int hook, ...)
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[hook], calldata);
return prv ? *prv : 0;
return prv ? *prv : Success;
}
static int
@ -262,16 +274,16 @@ XaceCatchDispatchProc(ClientPtr client)
{
REQUEST(xReq);
int major = stuff->reqType;
XaceCoreDispatchRec rec = { client, TRUE /* default allow */ };
XaceCoreDispatchRec rec = { client, Success /* default allow */ };
if (!ProcVector[major])
return (BadRequest);
return BadRequest;
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
if (!rec.rval)
return (BadAccess);
if (rec.status != Success)
return rec.status;
return client->swapped ?
(* SwappedProcVector[major])(client) :
@ -284,12 +296,16 @@ XaceCatchExtProc(ClientPtr client)
REQUEST(xReq);
int major = stuff->reqType;
ExtensionEntry *ext = GetExtensionEntry(major);
XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
if (!ext || !ProcVector[major])
return (BadRequest);
return BadRequest;
if (!XaceHook(XACE_EXT_DISPATCH, client, ext))
return (BadRequest); /* pretend extension doesn't exist */
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec);
if (rec.status != Success)
return BadRequest; /* pretend extension doesn't exist */
return client->swapped ?
(* SwappedProcVector[major])(client) :

View File

@ -20,15 +20,10 @@ 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 */
@ -37,6 +32,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XaceNumberEvents 0
#define XaceNumberErrors 0
/* Default window background */
#define XaceBackgroundNoneState None
/* security hooks */
/* Constants used to identify the available security hooks
*/
@ -45,16 +43,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
@ -99,15 +97,18 @@ extern void XaceCensorImage(
#else /* XACE */
/* Default window background */
#define XaceBackgroundNoneState None
/* Define calls away when XACE is not being built. */
#ifdef __GNUC__
#define XaceHook(args...) XaceAllowOperation
#define XaceHook(args...) Success
#define XaceHookAuditEnd(args...) { ; }
#define XaceHookAuditBegin(args...) { ; }
#define XaceCensorImage(args...) { ; }
#else
#define XaceHook(...) XaceAllowOperation
#define XaceHook(...) Success
#define XaceHookAuditEnd(...) { ; }
#define XaceHookAuditBegin(...) { ; }
#define XaceCensorImage(...) { ; }

View File

@ -20,91 +20,110 @@ 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 "resource.h"
#include "extnsionst.h"
#include "gcstruct.h"
#include "windowstr.h"
#include "inputstr.h"
#include "propertyst.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_EXT_DISPATCH_ACCESS */
/* XACE_CLIENT_ACCESS */
typedef struct {
ClientPtr client;
ClientPtr target;
Mask access_mode;
int status;
} XaceClientAccessRec;
/* 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 +138,6 @@ typedef struct {
int count;
} XaceKeyAvailRec;
/* XACE_WINDOW_INIT */
typedef struct {
ClientPtr client;
WindowPtr pWin;
} XaceWindowRec;
/* XACE_AUDIT_BEGIN */
/* XACE_AUDIT_END */
typedef struct {

View File

@ -48,10 +48,6 @@ from The Open Group.
#define UINT32_MAX 0xffffffffU
#endif
#if 0
static unsigned char XCMiscCode;
#endif
static void XCMiscResetProc(
ExtensionEntry * /* extEntry */
);
@ -68,20 +64,9 @@ static DISPATCH_PROC(SProcXCMiscGetXIDRange);
void
XCMiscExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
XCMiscResetProc, StandardMinorOpcode)) != 0)
XCMiscCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
XCMiscResetProc, StandardMinorOpcode);
#endif
DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
XCMiscResetProc, StandardMinorOpcode);
}
/*ARGSUSED*/

View File

@ -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;
}

View File

@ -86,10 +86,6 @@ static DISPATCH_PROC(SProcXF86BigfontDispatch);
static DISPATCH_PROC(SProcXF86BigfontQueryVersion);
static DISPATCH_PROC(SProcXF86BigfontQueryFont);
#if 0
static unsigned char XF86BigfontReqCode;
#endif
#ifdef HAS_SHM
/* A random signature, transmitted to the clients so they can verify that the
@ -149,18 +145,6 @@ CheckForShmSyscall(void)
void
XFree86BigfontExtensionInit()
{
#if 0
ExtensionEntry* extEntry;
if ((extEntry = AddExtension(XF86BIGFONTNAME,
XF86BigfontNumberEvents,
XF86BigfontNumberErrors,
ProcXF86BigfontDispatch,
SProcXF86BigfontDispatch,
XF86BigfontResetProc,
StandardMinorOpcode))) {
XF86BigfontReqCode = (unsigned char) extEntry->base;
#else
if (AddExtension(XF86BIGFONTNAME,
XF86BigfontNumberEvents,
XF86BigfontNumberErrors,
@ -168,7 +152,6 @@ XFree86BigfontExtensionInit()
SProcXF86BigfontDispatch,
XF86BigfontResetProc,
StandardMinorOpcode)) {
#endif
#ifdef HAS_SHM
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
/*
@ -445,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 */

View File

@ -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;
static DevPrivateKey XpClientPrivateKey = &XpClientPrivateKey;
/* 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);
#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,36 +352,9 @@ 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);
}
#if 0 /* NOT USED */
static void
FreeScreenEntry(XpScreenPtr pScreenEntry)
{
XpDriverPtr pDriver;
pDriver = pScreenEntry->drivers;
while(pDriver != (XpDriverPtr)NULL)
{
XpDriverPtr tmp;
tmp = pDriver->next;
xfree(pDriver);
pDriver = tmp;
}
xfree(pScreenEntry);
}
#endif
/*
* XpRegisterInitFunc tells the print extension which screens
* are printers as opposed to displays, and what drivers are
@ -957,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)
{
@ -976,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;
@ -1042,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.
@ -1056,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;
@ -1078,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);
@ -1091,7 +1036,7 @@ ProcXpSetContext(ClientPtr client)
XpContextPtr
XpGetPrintContext(ClientPtr client)
{
return (client->devPrivates[XpClientPrivateIndex].ptr);
return XP_GETPRIV(client);
}
static int
@ -1106,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;
@ -1250,6 +1194,7 @@ XpFreeContext(pointer data, XID id)
}
xfree(pContext->printerName);
dixFreePrivates(pContext->devPrivates);
xfree(pContext);
return Success; /* ??? */
}
@ -1285,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;
@ -1373,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)
{
char *ptr;
DevUnion *ppriv;
unsigned *sizes;
unsigned size;
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)
{
@ -1502,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)
@ -1543,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))
@ -1649,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) ||
@ -1685,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) &&
@ -1838,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))
@ -1883,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))
@ -1933,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) &&
@ -2444,7 +2299,7 @@ GetAllEventMasks(XpContextPtr pContext)
XpContextPtr
XpContextOfClient(ClientPtr client)
{
return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
return XP_GETPRIV(client);
}

View File

@ -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");
}

1438
Xext/xselinux.c Normal file

File diff suppressed because it is too large Load Diff

195
Xext/xselinux.h Normal file
View File

@ -0,0 +1,195 @@
/************************************************************
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 XSELINUX_EXTENSION_NAME "SELinux"
#define XSELINUX_MAJOR_VERSION 1
#define XSELINUX_MINOR_VERSION 0
#define XSELinuxNumberEvents 0
#define XSELinuxNumberErrors 0
/* Extension protocol */
#define X_SELinuxQueryVersion 0
#define X_SELinuxSetSelectionManager 1
#define X_SELinuxGetSelectionManager 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
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;
} SELinuxSetSelectionManagerReq;
typedef struct {
CARD8 reqType;
CARD8 SELinuxReqType;
CARD16 length;
} SELinuxGetSelectionManagerReq;
typedef struct {
CARD8 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD32 window;
CARD32 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
} SELinuxGetSelectionManagerReply;
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 type;
CARD8 pad1;
CARD16 sequenceNumber;
CARD32 length;
CARD16 context_len;
CARD16 pad2;
CARD32 pad3;
CARD32 pad4;
CARD32 pad5;
CARD32 pad6;
CARD32 pad7;
} SELinuxGetContextReply;
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;
} SELinuxGetPropertyContextReply;
/* 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 */

View File

@ -49,15 +49,10 @@ 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"
#if 0
static unsigned char XTestReqCode;
#endif
#ifdef XINPUT
extern int DeviceValuator;
#endif /* XINPUT */
@ -89,18 +84,9 @@ static DISPATCH_PROC(SProcXTestGrabControl);
void
XTestExtensionInit(INITARGS)
{
#if 0
ExtensionEntry *extEntry;
if ((extEntry = AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
XTestResetProc, StandardMinorOpcode)) != 0)
XTestReqCode = (unsigned char)extEntry->base;
#else
(void) AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
XTestResetProc, StandardMinorOpcode);
#endif
AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
XTestResetProc, StandardMinorOpcode);
}
/*ARGSUSED*/
@ -140,22 +126,23 @@ ProcXTestCompareCursor(client)
WindowPtr pWin;
CursorPtr pCursor;
int n, rc;
DeviceIntPtr pointer = PickPointer(client);
DeviceIntPtr ptr = PickPointer(client);
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)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
pCursor = GetSpriteCursor(pointer);
pCursor = GetSpriteCursor(ptr);
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;
@ -287,11 +274,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)
{
@ -368,7 +356,7 @@ ProcXTestFakeInput(client)
else
{
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root, client,
DixUnknownAccess);
DixGetAttrAccess);
if (rc != Success)
return rc;
if (root->parent)
@ -461,7 +449,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;

File diff suppressed because it is too large Load Diff

View File

@ -1 +1,2 @@
extern void XineramifyXv(void);
extern void XvResetProcVector(void);

View File

@ -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);

View File

@ -102,10 +102,10 @@ SOFTWARE.
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#include "xvdisp.h"
#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,21 +311,21 @@ XvCloseScreen(
xfree(pxvs);
pScreen->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen)(ii, pScreen);
}
static void
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 */

View File

@ -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;

View File

@ -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) {

View File

@ -40,7 +40,6 @@ from the author.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -119,13 +118,12 @@ ProcXChangeWindowAccess(ClientPtr client)
/* if one of the devices cannot be accessed, we don't do anything.*/
for (i = 0; i < stuff->npermit; i++)
{
perm_devices[i] = LookupDeviceIntRec(deviceids[i]);
if (!perm_devices[i])
err = dixLookupDevice(&perm_devices[i], deviceids[i], client,
DixWriteAccess);
if (err != Success)
{
xfree(perm_devices);
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess,
deviceids[i], BadDevice);
return Success;
return err;
}
}
}
@ -146,16 +144,15 @@ ProcXChangeWindowAccess(ClientPtr client)
for (i = 0; i < stuff->ndeny; i++)
{
deny_devices[i] =
LookupDeviceIntRec(deviceids[i+stuff->npermit]);
if (!deny_devices[i])
err = dixLookupDevice(&deny_devices[i],
deviceids[i+stuff->npermit],
client,
DixWriteAccess);
if (err != Success)
{
xfree(perm_devices);
xfree(deny_devices);
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess,
deviceids[i + stuff->npermit], BadDevice);
return Success;
return err;
}
}
}

View File

@ -46,9 +46,9 @@ from the author.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
#include "input.h"
#include "chdevcur.h"
@ -79,22 +79,15 @@ int ProcXChangeDeviceCursor(ClientPtr client)
REQUEST(xChangeDeviceCursorReq);
REQUEST_SIZE_MATCH(xChangeDeviceCursorReq);
pDev = LookupDeviceIntRec(stuff->deviceid);
if (pDev == NULL) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceCursor, 0,
BadDevice);
return Success;
}
err = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
if (err != Success)
return err;
if (stuff->win != None)
{
err = dixLookupWindow(&pWin, stuff->win, client, DixReadWriteAccess);
err = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
if (err != Success)
{
SendErrorToClient(client, IReqCode, X_ChangeDeviceCursor,
stuff->win, err);
return Success;
}
return err;
}
if (stuff->cursor == None)

View File

@ -49,7 +49,6 @@ from the author.
#include <X11/extensions/XIproto.h>
#include <X11/extensions/geproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
#include "geext.h"
@ -83,6 +82,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
xAnyHierarchyChangeInfo *any;
int required_len = sizeof(xChangeDeviceHierarchyReq);
char n;
int rc;
deviceHierarchyChangedEvent ev;
REQUEST(xChangeDeviceHierarchyReq);
@ -142,9 +142,16 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
r->returnMode != Floating)
return BadValue;
ptr = LookupDeviceIntRec(r->deviceid);
if (!ptr || !ptr->isMaster)
rc = dixLookupDevice(&ptr, r->deviceid, client,
DixWriteAccess);
if (rc != Success)
return rc;
if (!ptr->isMaster)
{
client->errorValue = r->deviceid;
return BadDevice;
}
/* XXX: For now, don't allow removal of VCP, VCK */
if (ptr == inputInfo.pointer ||
@ -168,11 +175,27 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
newptr,
newkeybd;
newptr = LookupDeviceIntRec(r->returnPointer);
newkeybd = LookupDeviceIntRec(r->returnKeyboard);
if (!newptr || !newptr->isMaster ||
!newkeybd || !newkeybd->isMaster)
rc = dixLookupDevice(&newptr, r->returnPointer,
client, DixWriteAccess);
if (rc != Success)
return rc;
if (!newptr->isMaster)
{
client->errorValue = r->returnPointer;
return BadDevice;
}
rc = dixLookupDevice(&newkeybd, r->returnKeyboard,
client, DixWriteAccess);
if (rc != Success)
return rc;
if (!newkeybd->isMaster)
{
client->errorValue = r->returnKeyboard;
return BadDevice;
}
for (attached = inputInfo.devices;
attached;
@ -201,17 +224,31 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
{
xChangeAttachmentInfo* c = (xChangeAttachmentInfo*)any;
ptr = LookupDeviceIntRec(c->deviceid);
if (!ptr || ptr->isMaster)
rc = dixLookupDevice(&ptr, c->deviceid, client,
DixWriteAccess);
if (rc != Success)
return rc;
if (ptr->isMaster)
{
client->errorValue = c->deviceid;
return BadDevice;
}
if (c->changeMode == Floating)
AttachDevice(client, ptr, NULL);
else
{
DeviceIntPtr newmaster = LookupDeviceIntRec(c->newMaster);
if (!newmaster || !newmaster->isMaster)
DeviceIntPtr newmaster;
rc = dixLookupDevice(&newmaster, c->newMaster,
client, DixWriteAccess);
if (rc != Success)
return rc;
if (!newmaster->isMaster)
{
client->errorValue = c->newMaster;
return BadDevice;
}
if ((IsPointerDevice(newmaster) &&
!IsPointerDevice(ptr)) ||

View File

@ -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, DixSetAttrAccess);
if (ret != Success)
goto out;
}
rep.repType = X_Reply;
rep.RepType = X_ChangeDeviceControl;

View File

@ -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"
@ -444,14 +443,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, DixSetAttrAccess);
if (rc != Success)
return rc;
switch (stuff->feedbackid) {
case KbdFeedbackClass:

View File

@ -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"
@ -107,9 +106,9 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
REQUEST(xChangeDeviceKeyMappingReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL)
return BadDevice;
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
if (ret != Success)
return ret;
len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2);
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,

View File

@ -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"
@ -115,7 +114,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;

View File

@ -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"

View File

@ -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, DixGetAttrAccess);
if (rc != Success)
return rc;
if (d->deviceGrab.grab && SameClient(d->deviceGrab.grab, client))
(*d->deviceGrab.DeactivateGrab) (d); /* release active grab */

View File

@ -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) {

View File

@ -68,12 +68,12 @@ 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 "listdev.h" /* for CopySwapXXXClass */
#include "xace.h"
#ifdef XKB
#include <X11/extensions/XKBproto.h>
@ -144,7 +144,8 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
dk = device->key;
mk = master->key;
if (master->devPrivates[CoreDevicePrivatesIndex].ptr != device) {
if (device != dixLookupPrivate(&master->devPrivates,
CoreDevicePrivateKey)) {
memcpy(mk->modifierMap, dk->modifierMap, MAP_LENGTH);
if (dk->maxKeysPerModifier)
@ -189,7 +190,7 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
}
#endif
master->devPrivates[CoreDevicePrivatesIndex].ptr = device;
dixSetPrivate(&master->devPrivates, CoreDevicePrivateKey, device);
sendNotify = TRUE;
} else if (lastMapNotifyDevice != master)
sendNotify = TRUE;
@ -695,7 +696,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
(key == device->deviceGrab.activatingKey))
deactivateDeviceGrab = TRUE;
} else if (xE->u.u.type == DeviceButtonPress) {
xE->u.u.detail = b->map[key];
xE->u.u.detail = key;
if (xE->u.u.detail == 0)
return;
if (!grab)
@ -712,7 +713,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
}
} else if (xE->u.u.type == DeviceButtonRelease) {
xE->u.u.detail = b->map[key];
xE->u.u.detail = key;
if (xE->u.u.detail == 0)
return;
if (!b->state && device->deviceGrab.fromPassiveGrab)
@ -970,6 +971,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) &&
@ -990,25 +992,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,
@ -1016,7 +1026,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
@ -1028,6 +1038,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)
@ -1055,7 +1066,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;
@ -1065,7 +1081,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
NullWindow, NullCursor);
if (!grab)
return BadAlloc;
return AddPassiveGrabToList(grab);
return AddPassiveGrabToList(client, grab);
}
int
@ -1296,7 +1312,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(d, pWin, ev, count, mask, NullGrab, d->id));
return Success;
}
@ -1560,7 +1576,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;
@ -1584,7 +1601,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;

View File

@ -47,7 +47,6 @@ from the author.
#include <X11/extensions/XIproto.h>
#include <X11/extensions/Xge.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -127,10 +126,8 @@ ProcXExtendedGrabDevice(ClientPtr client)
goto cleanup;
}
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
errval = stuff->deviceid;
err = BadDevice;
err = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (err != Success) {
goto cleanup;
}
@ -224,9 +221,7 @@ cleanup:
}
else
{
SendErrorToClient(client, IReqCode,
X_ExtendedGrabDevice,
errval, err);
return err;
}
return Success;
}

View File

@ -71,6 +71,7 @@ SOFTWARE.
#include "extinit.h"
#include "exglobals.h"
#include "swaprep.h"
#include "registry.h"
/* modules local to Xi */
#include "allowev.h"
@ -1099,29 +1100,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
@ -1239,6 +1217,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;

View File

@ -46,7 +46,6 @@ from the author.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
#include "mi.h"
@ -80,6 +79,7 @@ ProcXFakeDeviceData(ClientPtr client)
DeviceIntPtr dev;
int nevents, i;
int* valuators = NULL;
int rc;
REQUEST(xFakeDeviceDataReq);
REQUEST_AT_LEAST_SIZE(xFakeDeviceDataReq);
@ -90,11 +90,9 @@ ProcXFakeDeviceData(ClientPtr client)
return Success;
}
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_FakeDeviceData, 0, BadDevice);
return Success;
}
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
if (rc != Success)
return rc;
if (!fake_events && !(fake_events = InitEventList(GetMaximumEventsNum())))
{

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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)

View File

@ -37,7 +37,6 @@ from the author.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -68,15 +67,17 @@ ProcXGetPairedPointer(ClientPtr client)
{
xGetPairedPointerReply rep;
DeviceIntPtr kbd, ptr;
int rc;
REQUEST(xGetPairedPointerReq);
REQUEST_SIZE_MATCH(xGetPairedPointerReq);
kbd = LookupDeviceIntRec(stuff->deviceid);
if (!kbd || !kbd->key || !kbd->isMaster) {
SendErrorToClient(client, IReqCode, X_GetPairedPointer,
stuff->deviceid, BadDevice);
return Success;
rc = dixLookupDevice(&kbd, stuff->deviceid, client, DixReadAccess);
if (rc != Success)
return rc;
else if (!kbd->key || !kbd->isMaster) {
client->errorValue = stuff->deviceid;
return BadDevice;
}
ptr = GetPairedDevice(kbd);

View File

@ -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;

View File

@ -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;

View File

@ -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"

View File

@ -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 */
@ -122,9 +121,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,
@ -171,7 +170,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;
@ -185,8 +184,10 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
if (device > 255) /* FIXME: we only use 7 bit for devices? */
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++)

View File

@ -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"
@ -117,18 +117,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
} else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
if (ret != Success)
return ret;
}
class = (XEventClass *) (&stuff[1]); /* first word of values */

View File

@ -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"
@ -115,18 +115,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
} else {
mdev = PickKeyboard(client);
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
if (ret != Success)
return ret;
}
class = (XEventClass *) (&stuff[1]); /* first word of values */

View File

@ -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;

View File

@ -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"
@ -319,7 +319,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;
@ -338,10 +338,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++;
}

View File

@ -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"
@ -103,13 +102,15 @@ ProcXOpenDevice(ClientPtr client)
REQUEST(xOpenDeviceReq);
REQUEST_SIZE_MATCH(xOpenDeviceReq);
if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */
status = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
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)

View File

@ -45,7 +45,6 @@ from the author.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -83,11 +82,14 @@ ProcXQueryDevicePointer(ClientPtr client)
REQUEST(xQueryDevicePointerReq);
REQUEST_SIZE_MATCH(xQueryDevicePointerReq);
pDev = LookupDeviceIntRec(stuff->deviceid);
if (pDev == NULL || pDev->valuator == NULL) {
SendErrorToClient(client, IReqCode, X_QueryDevicePointer,
stuff->deviceid, BadDevice);
return Success;
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
if (rc != Success)
return rc;
if (pDev->valuator == NULL)
{
client->errorValue = stuff->deviceid;
return BadDevice;
}
rc = dixLookupWindow(&pWin, stuff->win, client, DixReadAccess);

View File

@ -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)

View File

@ -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"
@ -164,7 +163,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;

View File

@ -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"
@ -131,9 +131,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. */

View File

@ -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, DixSetAttrAccess);
if (ret != Success)
return ret;
ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]);

View File

@ -48,7 +48,6 @@ from the author.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -77,8 +76,11 @@ ProcXSetClientPointer(ClientPtr client)
REQUEST_SIZE_MATCH(xSetClientPointerReq);
pDev = LookupDeviceIntRec(stuff->deviceid);
if (pDev == NULL || !IsPointerDevice(pDev) || !pDev->isMaster)
err = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
if (err != Success)
return err;
if (!IsPointerDevice(pDev) || !pDev->isMaster)
{
client->errorValue = stuff->deviceid;
return BadDevice;
@ -86,13 +88,14 @@ ProcXSetClientPointer(ClientPtr client)
if (stuff->win != None)
{
err = dixLookupWindow(&pWin, stuff->win, client, DixReadWriteAccess);
err = dixLookupWindow(&pWin, stuff->win, client, DixWriteAccess);
if (err != Success)
{
/* window could not be found. maybe the window ID given was a pure
client id? */
/* XXX: Needs to be fixed for XACE */
err = dixLookupClient(&targetClient, stuff->win,
client, DixReadWriteAccess);
client, DixWriteAccess);
if (err != Success)
{
client->errorValue = stuff->win;

View File

@ -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;

View File

@ -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,

View File

@ -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, DixSetAttrAccess);
if (ret != Success)
return ret;
rep.repType = X_Reply;
rep.RepType = X_SetDeviceModifierMapping;

View File

@ -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->deviceGrab.grab) && !SameClient(dev->deviceGrab.grab, client))

View File

@ -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);
}
/****************************************************************************

View File

@ -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->deviceGrab.grab;
time = ClientTimeToServerTime(stuff->time);

View File

@ -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 = PickKeyboard(client);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
return rc;

View File

@ -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 = PickKeyboard(client);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
if (rc != Success)
return rc;

View File

@ -46,7 +46,6 @@ from the author.
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h"
#include "exglobals.h"
@ -83,13 +82,10 @@ ProcXWarpDevicePointer(ClientPtr client)
/* FIXME: panoramix stuff is missing, look at ProcWarpPointer */
pDev = LookupDeviceIntRec(stuff->deviceid);
if (pDev == NULL) {
SendErrorToClient(client, IReqCode, X_WarpDevicePointer,
stuff->deviceid,
BadDevice);
return Success;
}
err = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
if (err != Success)
return err;
if (stuff->dst_win != None)
{

View File

@ -64,7 +64,7 @@ ProcXiSelectEvent(ClientPtr client)
REQUEST(xXiSelectEventReq);
REQUEST_SIZE_MATCH(xXiSelectEventReq);
ret = dixLookupWindow(&pWin, stuff->window, client, DixReadWriteAccess);
ret = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (ret != Success)
{
SendErrorToClient(client, IReqCode, X_XiSelectEvent, 0, ret);

View File

@ -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); \
}

Some files were not shown because too many files have changed in this diff Show More