Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver

This commit is contained in:
Jeremy C. Reed 2006-11-13 20:32:26 -06:00
commit a724b7f130
335 changed files with 14162 additions and 46680 deletions

1
.gitignore vendored
View File

@ -267,3 +267,4 @@ mfb/mfbteblack.c
mfb/mfbtewhite.c mfb/mfbtewhite.c
mfb/mfbtileC.c mfb/mfbtileC.c
mfb/mfbtileG.c mfb/mfbtileG.c
.*.swp

View File

@ -28,7 +28,11 @@ INCLUDES = \
-I$(top_srcdir)/mi -I$(top_srcdir)/mi
nodist_libglx_la_SOURCES = indirect_size.h nodist_libglx_la_SOURCES = indirect_size.h \
glapi.c \
glcontextmodes.c \
glcontextmode.h \
glthread.c
libglxdri_la_SOURCES = \ libglxdri_la_SOURCES = \
glxdri.c \ glxdri.c \
@ -37,10 +41,6 @@ libglxdri_la_SOURCES = \
libglx_la_SOURCES = \ libglx_la_SOURCES = \
g_disptab.h \ g_disptab.h \
glapi.c \
glcontextmodes.c \
glcontextmodes.h \
glthread.c \
glxcmds.c \ glxcmds.c \
glxcmdsswap.c \ glxcmdsswap.c \
glxcontext.h \ glxcontext.h \

View File

@ -359,7 +359,12 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
if (pixmap->drawable.depth >= 24) { if (pixmap->drawable.depth >= 24) {
bpp = 4; bpp = 4;
format = GL_BGRA; format = GL_BGRA;
type = GL_UNSIGNED_BYTE; type =
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
GL_UNSIGNED_BYTE;
#else
GL_UNSIGNED_INT_8_8_8_8_REV;
#endif
} else { } else {
bpp = 2; bpp = 2;
format = GL_RGB; format = GL_RGB;

View File

@ -2756,6 +2756,31 @@ int __glXDisp_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = *(GLsizei *)(pc + 0);
GLboolean retval;
GLboolean answerBuffer[200];
GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
retval = CALL_AreTexturesResident( GET_DISPATCH(), (
n,
(const GLuint *)(pc + 4),
residences
) );
__glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
error = Success;
}
return error;
}
void __glXDisp_CopyTexImage1D(GLbyte * pc) void __glXDisp_CopyTexImage1D(GLbyte * pc)
{ {
CALL_CopyTexImage1D( GET_DISPATCH(), ( CALL_CopyTexImage1D( GET_DISPATCH(), (
@ -2810,6 +2835,26 @@ void __glXDisp_CopyTexSubImage2D(GLbyte * pc)
} }
int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc) int __glXDisp_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
{
xGLXSingleReq * const req = (xGLXSingleReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_SINGLE_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = *(GLsizei *)(pc + 0);
CALL_DeleteTextures( GET_DISPATCH(), (
n,
(const GLuint *)(pc + 4)
) );
error = Success;
}
return error;
}
int __glXDisp_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error; int error;
@ -2852,6 +2897,29 @@ int __glXDisp_GenTextures(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = *(GLsizei *)(pc + 0);
GLuint answerBuffer[200];
GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
CALL_GenTextures( GET_DISPATCH(), (
n,
textures
) );
__glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
error = Success;
}
return error;
}
int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc) int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -2871,6 +2939,25 @@ int __glXDisp_IsTexture(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
GLboolean retval;
retval = CALL_IsTexture( GET_DISPATCH(), (
*(GLuint *)(pc + 0)
) );
__glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
error = Success;
}
return error;
}
void __glXDisp_PrioritizeTextures(GLbyte * pc) void __glXDisp_PrioritizeTextures(GLbyte * pc)
{ {
const GLsizei n = *(GLsizei *)(pc + 0); const GLsizei n = *(GLsizei *)(pc + 0);
@ -3039,6 +3126,35 @@ int __glXDisp_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetColorTableParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameterfv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3068,6 +3184,35 @@ int __glXDisp_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetColorTableParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameteriv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
void __glXDisp_ColorSubTable(GLbyte * pc) void __glXDisp_ColorSubTable(GLbyte * pc)
{ {
const GLvoid * const data = (const GLvoid *) (pc + 40); const GLvoid * const data = (const GLvoid *) (pc + 40);
@ -3244,6 +3389,35 @@ int __glXDisp_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3273,6 +3447,35 @@ int __glXDisp_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3302,6 +3505,35 @@ int __glXDisp_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetHistogramParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetHistogramParameterfv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3331,6 +3563,35 @@ int __glXDisp_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetHistogramParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetHistogramParameteriv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3360,6 +3621,35 @@ int __glXDisp_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3389,6 +3679,35 @@ int __glXDisp_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDisp_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
void __glXDisp_Histogram(GLbyte * pc) void __glXDisp_Histogram(GLbyte * pc)
{ {
CALL_Histogram( GET_DISPATCH(), ( CALL_Histogram( GET_DISPATCH(), (
@ -4414,131 +4733,6 @@ void __glXDisp_DrawBuffersARB(GLbyte * pc)
) ); ) );
} }
int __glXDisp_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetColorTableParameterfvSGI_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameterfvSGI( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = *(GLenum *)(pc + 4);
const GLuint compsize = __glGetColorTableParameterivSGI_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameterivSGI( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
pname,
params
) );
__glXSendReply(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDisp_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = *(GLsizei *)(pc + 0);
GLboolean retval;
GLboolean answerBuffer[200];
GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
retval = CALL_AreTexturesResidentEXT( GET_DISPATCH(), (
n,
(const GLuint *)(pc + 4),
residences
) );
__glXSendReply(cl->client, residences, n, 1, GL_TRUE, retval);
error = Success;
}
return error;
}
int __glXDisp_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = *(GLsizei *)(pc + 0);
GLuint answerBuffer[200];
GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
CALL_GenTexturesEXT( GET_DISPATCH(), (
n,
textures
) );
__glXSendReply(cl->client, textures, n, 4, GL_TRUE, 0);
error = Success;
}
return error;
}
int __glXDisp_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
GLboolean retval;
retval = CALL_IsTextureEXT( GET_DISPATCH(), (
*(GLuint *)(pc + 0)
) );
__glXSendReply(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
error = Success;
}
return error;
}
void __glXDisp_SampleMaskSGIS(GLbyte * pc) void __glXDisp_SampleMaskSGIS(GLbyte * pc)
{ {
CALL_SampleMaskSGIS( GET_DISPATCH(), ( CALL_SampleMaskSGIS( GET_DISPATCH(), (

View File

@ -61,8 +61,6 @@ extern HIDDEN void __glXDisp_ActiveTextureARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc); extern HIDDEN void __glXDispSwap_ActiveTextureARB(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc); extern HIDDEN void __glXDisp_VertexAttrib4ubvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc); extern HIDDEN void __glXDispSwap_VertexAttrib4ubvNV(GLbyte * pc);
extern HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetProgramNamedParameterdvNV(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Histogram(GLbyte * pc); extern HIDDEN void __glXDisp_Histogram(GLbyte * pc);
@ -163,6 +161,8 @@ extern HIDDEN void __glXDisp_Color3sv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Color3sv(GLbyte * pc);
extern HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetConvolutionParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc); extern HIDDEN void __glXDisp_Vertex2dv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Vertex2dv(GLbyte * pc);
extern HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetVisualConfigs(struct __GLXclientStateRec *, GLbyte *);
@ -251,6 +251,8 @@ extern HIDDEN void __glXDisp_Color3usv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Color3usv(GLbyte * pc);
extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc); extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc);
@ -319,6 +321,8 @@ extern HIDDEN int __glXDisp_CreateNewContext(struct __GLXclientStateRec *, GLbyt
extern HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_CreateNewContext(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetMinmax(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetMinmax(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMinmaxEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetVertexAttribdvNV(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Normal3fv(GLbyte * pc); extern HIDDEN void __glXDisp_Normal3fv(GLbyte * pc);
@ -409,6 +413,8 @@ extern HIDDEN void __glXDisp_VertexAttrib1dvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc); extern HIDDEN void __glXDispSwap_VertexAttrib1dvNV(GLbyte * pc);
extern HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GenTextures(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GenTextures(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc); extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc); extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc);
extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
@ -469,6 +475,8 @@ extern HIDDEN void __glXDisp_CopyTexSubImage3D(GLbyte * pc);
extern HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc); extern HIDDEN void __glXDispSwap_CopyTexSubImage3D(GLbyte * pc);
extern HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetColorTable(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetColorTable(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Indexiv(GLbyte * pc); extern HIDDEN void __glXDisp_Indexiv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Indexiv(GLbyte * pc);
extern HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_CreateContext(struct __GLXclientStateRec *, GLbyte *);
@ -477,6 +485,8 @@ extern HIDDEN void __glXDisp_CopyColorTable(GLbyte * pc);
extern HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc); extern HIDDEN void __glXDispSwap_CopyColorTable(GLbyte * pc);
extern HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetHistogramParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogramParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Frustum(GLbyte * pc); extern HIDDEN void __glXDisp_Frustum(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Frustum(GLbyte * pc); extern HIDDEN void __glXDispSwap_Frustum(GLbyte * pc);
extern HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetString(struct __GLXclientStateRec *, GLbyte *);
@ -493,6 +503,8 @@ extern HIDDEN void __glXDisp_VertexAttrib1dvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc); extern HIDDEN void __glXDispSwap_VertexAttrib1dvARB(GLbyte * pc);
extern HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_DeleteTextures(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_DeleteTextures(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_DeleteTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetTexLevelParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_ClearAccum(GLbyte * pc); extern HIDDEN void __glXDisp_ClearAccum(GLbyte * pc);
@ -587,6 +599,8 @@ extern HIDDEN void __glXDisp_Color3dv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Color3dv(GLbyte * pc);
extern HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_IsTexture(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_IsTexture(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_DeleteQueriesARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetMapdv(struct __GLXclientStateRec *, GLbyte *);
@ -617,6 +631,8 @@ extern HIDDEN int __glXDisp_GetVertexAttribdvARB(struct __GLXclientStateRec *, G
extern HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetVertexAttribdvARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetSeparableFilter(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetSeparableFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc); extern HIDDEN void __glXDisp_RequestResidentProgramsNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc); extern HIDDEN void __glXDispSwap_RequestResidentProgramsNV(GLbyte * pc);
extern HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_FeedbackBuffer(struct __GLXclientStateRec *, GLbyte *);
@ -635,8 +651,6 @@ extern HIDDEN void __glXDisp_PolygonOffset(GLbyte * pc);
extern HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc); extern HIDDEN void __glXDispSwap_PolygonOffset(GLbyte * pc);
extern HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc); extern HIDDEN void __glXDisp_ExecuteProgramNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc); extern HIDDEN void __glXDispSwap_ExecuteProgramNV(GLbyte * pc);
extern HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Normal3dv(GLbyte * pc); extern HIDDEN void __glXDisp_Normal3dv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Normal3dv(GLbyte * pc);
extern HIDDEN void __glXDisp_Lightf(GLbyte * pc); extern HIDDEN void __glXDisp_Lightf(GLbyte * pc);
@ -685,6 +699,8 @@ extern HIDDEN int __glXDisp_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte
extern HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_SwapIntervalSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetColorTableParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableParameterfvSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Bitmap(GLbyte * pc); extern HIDDEN void __glXDisp_Bitmap(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc); extern HIDDEN void __glXDispSwap_Bitmap(GLbyte * pc);
extern HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetTexLevelParameterfv(struct __GLXclientStateRec *, GLbyte *);
@ -725,6 +741,8 @@ extern HIDDEN int __glXDisp_ChangeDrawableAttributes(struct __GLXclientStateRec
extern HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_ChangeDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetMinmaxParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMinmaxParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc); extern HIDDEN void __glXDisp_PixelTransferf(GLbyte * pc);
extern HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc); extern HIDDEN void __glXDispSwap_PixelTransferf(GLbyte * pc);
extern HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc); extern HIDDEN void __glXDisp_CopyTexImage1D(GLbyte * pc);
@ -755,6 +773,8 @@ extern HIDDEN void __glXDisp_ConvolutionParameterf(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc); extern HIDDEN void __glXDispSwap_ConvolutionParameterf(GLbyte * pc);
extern HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetColorTableParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableParameterivSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_ReleaseTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_CallList(GLbyte * pc); extern HIDDEN void __glXDisp_CallList(GLbyte * pc);
@ -773,8 +793,6 @@ extern HIDDEN void __glXDisp_BindRenderbufferEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc); extern HIDDEN void __glXDispSwap_BindRenderbufferEXT(GLbyte * pc);
extern HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc); extern HIDDEN void __glXDisp_Vertex3sv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc); extern HIDDEN void __glXDispSwap_Vertex3sv(GLbyte * pc);
extern HIDDEN int __glXDisp_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetColorTableSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_BindTexImageEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc); extern HIDDEN void __glXDisp_ProgramLocalParameter4fvARB(GLbyte * pc);
@ -797,10 +815,10 @@ extern HIDDEN void __glXDisp_TexGendv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc); extern HIDDEN void __glXDispSwap_TexGendv(GLbyte * pc);
extern HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc); extern HIDDEN void __glXDisp_ResetMinmax(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc); extern HIDDEN void __glXDispSwap_ResetMinmax(GLbyte * pc);
extern HIDDEN int __glXDisp_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GenTexturesEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetConvolutionParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc); extern HIDDEN void __glXDisp_VertexAttribs4dvNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc); extern HIDDEN void __glXDispSwap_VertexAttribs4dvNV(GLbyte * pc);
extern HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetMaterialfv(struct __GLXclientStateRec *, GLbyte *);
@ -827,8 +845,12 @@ extern HIDDEN int __glXDisp_GetProgramLocalParameterdvARB(struct __GLXclientStat
extern HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetProgramLocalParameterdvARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetHistogramParameteriv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogramParameterivEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetConvolutionFilter(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetConvolutionFilterEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetProgramivARB(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc); extern HIDDEN void __glXDisp_BlendFuncSeparateEXT(GLbyte * pc);
@ -841,8 +863,6 @@ extern HIDDEN void __glXDisp_EvalPoint1(GLbyte * pc);
extern HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc); extern HIDDEN void __glXDispSwap_EvalPoint1(GLbyte * pc);
extern HIDDEN void __glXDisp_PopMatrix(GLbyte * pc); extern HIDDEN void __glXDisp_PopMatrix(GLbyte * pc);
extern HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc); extern HIDDEN void __glXDispSwap_PopMatrix(GLbyte * pc);
extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_MakeCurrentReadSGI(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetTexGeniv(struct __GLXclientStateRec *, GLbyte *);
@ -861,6 +881,8 @@ extern HIDDEN int __glXDisp_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetTexGenfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetHistogram(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetHistogram(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetHistogramEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc); extern HIDDEN void __glXDisp_ActiveStencilFaceEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc); extern HIDDEN void __glXDispSwap_ActiveStencilFaceEXT(GLbyte * pc);
extern HIDDEN void __glXDisp_Materialf(GLbyte * pc); extern HIDDEN void __glXDisp_Materialf(GLbyte * pc);
@ -921,8 +943,6 @@ extern HIDDEN void __glXDisp_VertexAttrib4uivARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc); extern HIDDEN void __glXDispSwap_VertexAttrib4uivARB(GLbyte * pc);
extern HIDDEN void __glXDisp_ClipPlane(GLbyte * pc); extern HIDDEN void __glXDisp_ClipPlane(GLbyte * pc);
extern HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc); extern HIDDEN void __glXDispSwap_ClipPlane(GLbyte * pc);
extern HIDDEN int __glXDisp_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_IsTextureEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetPixelMapuiv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_Indexfv(GLbyte * pc); extern HIDDEN void __glXDisp_Indexfv(GLbyte * pc);
@ -1005,6 +1025,8 @@ extern HIDDEN void __glXDisp_VertexAttribs4svNV(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc); extern HIDDEN void __glXDispSwap_VertexAttribs4svNV(GLbyte * pc);
extern HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDisp_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *); extern HIDDEN int __glXDispSwap_GetMinmaxParameterfv(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetMinmaxParameterfvEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc); extern HIDDEN void __glXDisp_VertexAttrib1fvARB(GLbyte * pc);
extern HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc); extern HIDDEN void __glXDispSwap_VertexAttrib1fvARB(GLbyte * pc);
extern HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc); extern HIDDEN void __glXDisp_VertexAttribs1svNV(GLbyte * pc);

View File

@ -28,7 +28,7 @@
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glxproto.h> #include <GL/glxproto.h>
#ifdef __linux__ #if defined(__linux__) || defined(__GNU__)
#include <byteswap.h> #include <byteswap.h>
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
#include <sys/endian.h> #include <sys/endian.h>
@ -2887,6 +2887,31 @@ int __glXDispSwap_AreTexturesResident(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
GLboolean retval;
GLboolean answerBuffer[200];
GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
retval = CALL_AreTexturesResident( GET_DISPATCH(), (
n,
(const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
residences
) );
__glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
error = Success;
}
return error;
}
void __glXDispSwap_CopyTexImage1D(GLbyte * pc) void __glXDispSwap_CopyTexImage1D(GLbyte * pc)
{ {
CALL_CopyTexImage1D( GET_DISPATCH(), ( CALL_CopyTexImage1D( GET_DISPATCH(), (
@ -2941,6 +2966,26 @@ void __glXDispSwap_CopyTexSubImage2D(GLbyte * pc)
} }
int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_DeleteTextures(__GLXclientState *cl, GLbyte *pc)
{
xGLXSingleReq * const req = (xGLXSingleReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_SINGLE_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
CALL_DeleteTextures( GET_DISPATCH(), (
n,
(const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 )
) );
error = Success;
}
return error;
}
int __glXDispSwap_DeleteTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc; xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error; int error;
@ -2984,6 +3029,30 @@ int __glXDispSwap_GenTextures(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
GLuint answerBuffer[200];
GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
CALL_GenTextures( GET_DISPATCH(), (
n,
textures
) );
(void) bswap_32_array( (uint32_t *) textures, n );
__glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3003,6 +3072,25 @@ int __glXDispSwap_IsTexture(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
GLboolean retval;
retval = CALL_IsTexture( GET_DISPATCH(), (
(GLuint )bswap_CARD32 ( pc + 0 )
) );
__glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
error = Success;
}
return error;
}
void __glXDispSwap_PrioritizeTextures(GLbyte * pc) void __glXDispSwap_PrioritizeTextures(GLbyte * pc)
{ {
const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 ); const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
@ -3172,6 +3260,36 @@ int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetColorTableParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameterfv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3202,6 +3320,36 @@ int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetColorTableParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameteriv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
void __glXDispSwap_ColorSubTable(GLbyte * pc) void __glXDispSwap_ColorSubTable(GLbyte * pc)
{ {
const GLvoid * const data = (const GLvoid *) (pc + 40); const GLvoid * const data = (const GLvoid *) (pc + 40);
@ -3379,6 +3527,36 @@ int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetConvolutionParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetConvolutionParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetConvolutionParameterfv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3409,6 +3587,36 @@ int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetConvolutionParameterivEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetConvolutionParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetConvolutionParameteriv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3439,6 +3647,36 @@ int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetHistogramParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetHistogramParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetHistogramParameterfv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3469,6 +3707,36 @@ int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetHistogramParameterivEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetHistogramParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetHistogramParameteriv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3499,6 +3767,36 @@ int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetMinmaxParameterfvEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetMinmaxParameterfv_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetMinmaxParameterfv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
{ {
xGLXSingleReq * const req = (xGLXSingleReq *) pc; xGLXSingleReq * const req = (xGLXSingleReq *) pc;
@ -3529,6 +3827,36 @@ int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *cl, GLbyte *pc)
return error; return error;
} }
int __glXDispSwap_GetMinmaxParameterivEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetMinmaxParameteriv_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetMinmaxParameteriv( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
void __glXDispSwap_Histogram(GLbyte * pc) void __glXDispSwap_Histogram(GLbyte * pc)
{ {
CALL_Histogram( GET_DISPATCH(), ( CALL_Histogram( GET_DISPATCH(), (
@ -4566,134 +4894,6 @@ void __glXDispSwap_DrawBuffersARB(GLbyte * pc)
) ); ) );
} }
int __glXDispSwap_GetColorTableParameterfvSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetColorTableParameterfvSGI_size(pname);
GLfloat answerBuffer[200];
GLfloat * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameterfvSGI( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_GetColorTableParameterivSGI(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLenum pname = (GLenum )bswap_ENUM ( pc + 4 );
const GLuint compsize = __glGetColorTableParameterivSGI_size(pname);
GLint answerBuffer[200];
GLint * params = __glXGetAnswerBuffer(cl, compsize * 4, answerBuffer, sizeof(answerBuffer), 4);
if (params == NULL) return BadAlloc;
__glXClearErrorOccured();
CALL_GetColorTableParameterivSGI( GET_DISPATCH(), (
(GLenum )bswap_ENUM ( pc + 0 ),
pname,
params
) );
(void) bswap_32_array( (uint32_t *) params, compsize );
__glXSendReplySwap(cl->client, params, compsize, 4, GL_FALSE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_AreTexturesResidentEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
GLboolean retval;
GLboolean answerBuffer[200];
GLboolean * residences = __glXGetAnswerBuffer(cl, n, answerBuffer, sizeof(answerBuffer), 1);
retval = CALL_AreTexturesResidentEXT( GET_DISPATCH(), (
n,
(const GLuint *)bswap_32_array( (uint32_t *) (pc + 4), 0 ),
residences
) );
__glXSendReplySwap(cl->client, residences, n, 1, GL_TRUE, retval);
error = Success;
}
return error;
}
int __glXDispSwap_GenTexturesEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
const GLsizei n = (GLsizei )bswap_CARD32 ( pc + 0 );
GLuint answerBuffer[200];
GLuint * textures = __glXGetAnswerBuffer(cl, n * 4, answerBuffer, sizeof(answerBuffer), 4);
CALL_GenTexturesEXT( GET_DISPATCH(), (
n,
textures
) );
(void) bswap_32_array( (uint32_t *) textures, n );
__glXSendReplySwap(cl->client, textures, n, 4, GL_TRUE, 0);
error = Success;
}
return error;
}
int __glXDispSwap_IsTextureEXT(__GLXclientState *cl, GLbyte *pc)
{
xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;
int error;
__GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);
pc += __GLX_VENDPRIV_HDR_SIZE;
if ( cx != NULL ) {
GLboolean retval;
retval = CALL_IsTextureEXT( GET_DISPATCH(), (
(GLuint )bswap_CARD32 ( pc + 0 )
) );
__glXSendReplySwap(cl->client, dummy_answer, 0, 0, GL_FALSE, retval);
error = Success;
}
return error;
}
void __glXDispSwap_SampleMaskSGIS(GLbyte * pc) void __glXDispSwap_SampleMaskSGIS(GLbyte * pc)
{ {
CALL_SampleMaskSGIS( GET_DISPATCH(), ( CALL_SampleMaskSGIS( GET_DISPATCH(), (

View File

@ -31,7 +31,7 @@
#include "indirect_size.h" #include "indirect_size.h"
#include "indirect_reqsize.h" #include "indirect_reqsize.h"
#if defined(linux) #if defined(__linux__) || defined(__GNU__)
# include <byteswap.h> # include <byteswap.h>
# define SWAP_32(v) do { (v) = bswap_32(v); } while(0) # define SWAP_32(v) do { (v) = bswap_32(v); } while(0)
#else #else

View File

@ -67,9 +67,9 @@
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glCallLists_size( GLenum e ) __glCallLists_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_BYTE: case GL_BYTE:
case GL_UNSIGNED_BYTE: case GL_UNSIGNED_BYTE:
return 1; return 1;
@ -84,14 +84,15 @@ __glCallLists_size( GLenum e )
case GL_FLOAT: case GL_FLOAT:
case GL_4_BYTES: case GL_4_BYTES:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glFogfv_size( GLenum e ) __glFogfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_FOG_INDEX: case GL_FOG_INDEX:
case GL_FOG_DENSITY: case GL_FOG_DENSITY:
case GL_FOG_START: case GL_FOG_START:
@ -102,14 +103,15 @@ __glFogfv_size( GLenum e )
return 1; return 1;
case GL_FOG_COLOR: case GL_FOG_COLOR:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glLightfv_size( GLenum e ) __glLightfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_SPOT_EXPONENT: case GL_SPOT_EXPONENT:
case GL_SPOT_CUTOFF: case GL_SPOT_CUTOFF:
case GL_CONSTANT_ATTENUATION: case GL_CONSTANT_ATTENUATION:
@ -123,14 +125,15 @@ __glLightfv_size( GLenum e )
case GL_SPECULAR: case GL_SPECULAR:
case GL_POSITION: case GL_POSITION:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glLightModelfv_size( GLenum e ) __glLightModelfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_LIGHT_MODEL_LOCAL_VIEWER: case GL_LIGHT_MODEL_LOCAL_VIEWER:
case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_TWO_SIDE:
case GL_LIGHT_MODEL_COLOR_CONTROL: case GL_LIGHT_MODEL_COLOR_CONTROL:
@ -138,14 +141,15 @@ __glLightModelfv_size( GLenum e )
return 1; return 1;
case GL_LIGHT_MODEL_AMBIENT: case GL_LIGHT_MODEL_AMBIENT:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glMaterialfv_size( GLenum e ) __glMaterialfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_SHININESS: case GL_SHININESS:
return 1; return 1;
case GL_COLOR_INDEXES: case GL_COLOR_INDEXES:
@ -156,14 +160,15 @@ __glMaterialfv_size( GLenum e )
case GL_EMISSION: case GL_EMISSION:
case GL_AMBIENT_AND_DIFFUSE: case GL_AMBIENT_AND_DIFFUSE:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glTexParameterfv_size( GLenum e ) __glTexParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_S:
@ -207,14 +212,15 @@ __glTexParameterfv_size( GLenum e )
case GL_POST_TEXTURE_FILTER_BIAS_SGIX: case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
case GL_POST_TEXTURE_FILTER_SCALE_SGIX: case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glTexEnvfv_size( GLenum e ) __glTexEnvfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_ALPHA_SCALE: case GL_ALPHA_SCALE:
case GL_TEXTURE_ENV_MODE: case GL_TEXTURE_ENV_MODE:
case GL_TEXTURE_LOD_BIAS: case GL_TEXTURE_LOD_BIAS:
@ -242,27 +248,29 @@ __glTexEnvfv_size( GLenum e )
return 1; return 1;
case GL_TEXTURE_ENV_COLOR: case GL_TEXTURE_ENV_COLOR:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glTexGendv_size( GLenum e ) __glTexGendv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_TEXTURE_GEN_MODE: case GL_TEXTURE_GEN_MODE:
return 1; return 1;
case GL_OBJECT_PLANE: case GL_OBJECT_PLANE:
case GL_EYE_PLANE: case GL_EYE_PLANE:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glMap1d_size( GLenum e ) __glMap1d_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_MAP1_INDEX: case GL_MAP1_INDEX:
case GL_MAP1_TEXTURE_COORD_1: case GL_MAP1_TEXTURE_COORD_1:
return 1; return 1;
@ -276,14 +284,15 @@ __glMap1d_size( GLenum e )
case GL_MAP1_TEXTURE_COORD_4: case GL_MAP1_TEXTURE_COORD_4:
case GL_MAP1_VERTEX_4: case GL_MAP1_VERTEX_4:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glMap2d_size( GLenum e ) __glMap2d_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_MAP2_INDEX: case GL_MAP2_INDEX:
case GL_MAP2_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_1:
return 1; return 1;
@ -297,14 +306,15 @@ __glMap2d_size( GLenum e )
case GL_MAP2_TEXTURE_COORD_4: case GL_MAP2_TEXTURE_COORD_4:
case GL_MAP2_VERTEX_4: case GL_MAP2_VERTEX_4:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetBooleanv_size( GLenum e ) __glGetBooleanv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_CURRENT_INDEX: case GL_CURRENT_INDEX:
case GL_CURRENT_RASTER_INDEX: case GL_CURRENT_RASTER_INDEX:
case GL_CURRENT_RASTER_POSITION_VALID: case GL_CURRENT_RASTER_POSITION_VALID:
@ -765,15 +775,16 @@ __glGetBooleanv_size( GLenum e )
return 16; return 16;
case GL_FOG_COORDINATE_SOURCE: case GL_FOG_COORDINATE_SOURCE:
case GL_COMPRESSED_TEXTURE_FORMATS: case GL_COMPRESSED_TEXTURE_FORMATS:
return __glGetBooleanv_variable_size( e ); return __glGetBooleanv_variable_size(e);
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetTexParameterfv_size( GLenum e ) __glGetTexParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_TEXTURE_MAG_FILTER: case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_MIN_FILTER: case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_S:
@ -818,14 +829,15 @@ __glGetTexParameterfv_size( GLenum e )
case GL_POST_TEXTURE_FILTER_BIAS_SGIX: case GL_POST_TEXTURE_FILTER_BIAS_SGIX:
case GL_POST_TEXTURE_FILTER_SCALE_SGIX: case GL_POST_TEXTURE_FILTER_SCALE_SGIX:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetTexLevelParameterfv_size( GLenum e ) __glGetTexLevelParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_TEXTURE_WIDTH: case GL_TEXTURE_WIDTH:
case GL_TEXTURE_HEIGHT: case GL_TEXTURE_HEIGHT:
case GL_TEXTURE_COMPONENTS: case GL_TEXTURE_COMPONENTS:
@ -851,25 +863,27 @@ __glGetTexLevelParameterfv_size( GLenum e )
case GL_TEXTURE_DEPTH_SIZE: case GL_TEXTURE_DEPTH_SIZE:
/* case GL_TEXTURE_DEPTH_SIZE_ARB:*/ /* case GL_TEXTURE_DEPTH_SIZE_ARB:*/
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glColorTableParameterfv_size( GLenum e ) __glColorTableParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_COLOR_TABLE_SCALE: case GL_COLOR_TABLE_SCALE:
case GL_COLOR_TABLE_BIAS: case GL_COLOR_TABLE_BIAS:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetColorTableParameterfv_size( GLenum e ) __glGetColorTableParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_COLOR_TABLE_FORMAT: case GL_COLOR_TABLE_FORMAT:
/* case GL_COLOR_TABLE_FORMAT_EXT:*/ /* case GL_COLOR_TABLE_FORMAT_EXT:*/
case GL_COLOR_TABLE_WIDTH: case GL_COLOR_TABLE_WIDTH:
@ -890,14 +904,15 @@ __glGetColorTableParameterfv_size( GLenum e )
case GL_COLOR_TABLE_SCALE: case GL_COLOR_TABLE_SCALE:
case GL_COLOR_TABLE_BIAS: case GL_COLOR_TABLE_BIAS:
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glConvolutionParameterfv_size( GLenum e ) __glConvolutionParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_CONVOLUTION_BORDER_MODE: case GL_CONVOLUTION_BORDER_MODE:
/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ /* case GL_CONVOLUTION_BORDER_MODE_EXT:*/
return 1; return 1;
@ -908,14 +923,15 @@ __glConvolutionParameterfv_size( GLenum e )
case GL_CONVOLUTION_BORDER_COLOR: case GL_CONVOLUTION_BORDER_COLOR:
/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ /* case GL_CONVOLUTION_BORDER_COLOR_HP:*/
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetConvolutionParameterfv_size( GLenum e ) __glGetConvolutionParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_CONVOLUTION_BORDER_MODE: case GL_CONVOLUTION_BORDER_MODE:
/* case GL_CONVOLUTION_BORDER_MODE_EXT:*/ /* case GL_CONVOLUTION_BORDER_MODE_EXT:*/
case GL_CONVOLUTION_FORMAT: case GL_CONVOLUTION_FORMAT:
@ -936,14 +952,15 @@ __glGetConvolutionParameterfv_size( GLenum e )
case GL_CONVOLUTION_BORDER_COLOR: case GL_CONVOLUTION_BORDER_COLOR:
/* case GL_CONVOLUTION_BORDER_COLOR_HP:*/ /* case GL_CONVOLUTION_BORDER_COLOR_HP:*/
return 4; return 4;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetHistogramParameterfv_size( GLenum e ) __glGetHistogramParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_HISTOGRAM_WIDTH: case GL_HISTOGRAM_WIDTH:
case GL_HISTOGRAM_FORMAT: case GL_HISTOGRAM_FORMAT:
case GL_HISTOGRAM_RED_SIZE: case GL_HISTOGRAM_RED_SIZE:
@ -953,25 +970,27 @@ __glGetHistogramParameterfv_size( GLenum e )
case GL_HISTOGRAM_LUMINANCE_SIZE: case GL_HISTOGRAM_LUMINANCE_SIZE:
case GL_HISTOGRAM_SINK: case GL_HISTOGRAM_SINK:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetMinmaxParameterfv_size( GLenum e ) __glGetMinmaxParameterfv_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_MINMAX_FORMAT: case GL_MINMAX_FORMAT:
case GL_MINMAX_SINK: case GL_MINMAX_SINK:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetProgramivARB_size( GLenum e ) __glGetProgramivARB_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_PROGRAM_LENGTH_ARB: case GL_PROGRAM_LENGTH_ARB:
case GL_PROGRAM_BINDING_ARB: case GL_PROGRAM_BINDING_ARB:
case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: case GL_PROGRAM_ALU_INSTRUCTIONS_ARB:
@ -1018,14 +1037,15 @@ __glGetProgramivARB_size( GLenum e )
case GL_MAX_PROGRAM_LOOP_DEPTH_NV: case GL_MAX_PROGRAM_LOOP_DEPTH_NV:
case GL_MAX_PROGRAM_LOOP_COUNT_NV: case GL_MAX_PROGRAM_LOOP_COUNT_NV:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetVertexAttribdvARB_size( GLenum e ) __glGetVertexAttribdvARB_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_VERTEX_PROGRAM_ARB: case GL_VERTEX_PROGRAM_ARB:
case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB: case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
@ -1033,36 +1053,39 @@ __glGetVertexAttribdvARB_size( GLenum e )
case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB: case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
case GL_CURRENT_VERTEX_ATTRIB_ARB: case GL_CURRENT_VERTEX_ATTRIB_ARB:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetQueryObjectivARB_size( GLenum e ) __glGetQueryObjectivARB_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_QUERY_RESULT_ARB: case GL_QUERY_RESULT_ARB:
case GL_QUERY_RESULT_AVAILABLE_ARB: case GL_QUERY_RESULT_AVAILABLE_ARB:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetQueryivARB_size( GLenum e ) __glGetQueryivARB_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_QUERY_COUNTER_BITS_ARB: case GL_QUERY_COUNTER_BITS_ARB:
case GL_CURRENT_QUERY_ARB: case GL_CURRENT_QUERY_ARB:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glPointParameterfvEXT_size( GLenum e ) __glPointParameterfvEXT_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_POINT_SIZE_MIN: case GL_POINT_SIZE_MIN:
/* case GL_POINT_SIZE_MIN_ARB:*/ /* case GL_POINT_SIZE_MIN_ARB:*/
/* case GL_POINT_SIZE_MIN_SGIS:*/ /* case GL_POINT_SIZE_MIN_SGIS:*/
@ -1079,88 +1102,89 @@ __glPointParameterfvEXT_size( GLenum e )
/* case GL_POINT_DISTANCE_ATTENUATION_ARB:*/ /* case GL_POINT_DISTANCE_ATTENUATION_ARB:*/
/* case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/ /* case GL_POINT_DISTANCE_ATTENUATION_SGIS:*/
return 3; return 3;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetProgramivNV_size( GLenum e ) __glGetProgramivNV_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_PROGRAM_LENGTH_NV: case GL_PROGRAM_LENGTH_NV:
case GL_PROGRAM_TARGET_NV: case GL_PROGRAM_TARGET_NV:
case GL_PROGRAM_RESIDENT_NV: case GL_PROGRAM_RESIDENT_NV:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetVertexAttribdvNV_size( GLenum e ) __glGetVertexAttribdvNV_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_ATTRIB_ARRAY_SIZE_NV: case GL_ATTRIB_ARRAY_SIZE_NV:
case GL_ATTRIB_ARRAY_STRIDE_NV: case GL_ATTRIB_ARRAY_STRIDE_NV:
case GL_ATTRIB_ARRAY_TYPE_NV: case GL_ATTRIB_ARRAY_TYPE_NV:
case GL_CURRENT_ATTRIB_NV: case GL_CURRENT_ATTRIB_NV:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
INTERNAL PURE FASTCALL GLint INTERNAL PURE FASTCALL GLint
__glGetFramebufferAttachmentParameterivEXT_size( GLenum e ) __glGetFramebufferAttachmentParameterivEXT_size(GLenum e)
{ {
switch( e ) { switch (e) {
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT:
case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT:
return 1; return 1;
default: return 0; default:
return 0;
} }
} }
ALIAS( Fogiv, Fogfv ) ALIAS(Fogiv, Fogfv)
ALIAS( Lightiv, Lightfv ) ALIAS(Lightiv, Lightfv)
ALIAS( LightModeliv, LightModelfv ) ALIAS(LightModeliv, LightModelfv)
ALIAS( Materialiv, Materialfv ) ALIAS(Materialiv, Materialfv)
ALIAS( TexParameteriv, TexParameterfv ) ALIAS(TexParameteriv, TexParameterfv)
ALIAS( TexEnviv, TexEnvfv ) ALIAS(TexEnviv, TexEnvfv)
ALIAS( TexGenfv, TexGendv ) ALIAS(TexGenfv, TexGendv)
ALIAS( TexGeniv, TexGendv ) ALIAS(TexGeniv, TexGendv)
ALIAS( Map1f, Map1d ) ALIAS(Map1f, Map1d)
ALIAS( Map2f, Map2d ) ALIAS(Map2f, Map2d)
ALIAS( GetDoublev, GetBooleanv ) ALIAS(GetDoublev, GetBooleanv)
ALIAS( GetFloatv, GetBooleanv ) ALIAS(GetFloatv, GetBooleanv)
ALIAS( GetIntegerv, GetBooleanv ) ALIAS(GetIntegerv, GetBooleanv)
ALIAS( GetLightfv, Lightfv ) ALIAS(GetLightfv, Lightfv)
ALIAS( GetLightiv, Lightfv ) ALIAS(GetLightiv, Lightfv)
ALIAS( GetMaterialfv, Materialfv ) ALIAS(GetMaterialfv, Materialfv)
ALIAS( GetMaterialiv, Materialfv ) ALIAS(GetMaterialiv, Materialfv)
ALIAS( GetTexEnvfv, TexEnvfv ) ALIAS(GetTexEnvfv, TexEnvfv)
ALIAS( GetTexEnviv, TexEnvfv ) ALIAS(GetTexEnviv, TexEnvfv)
ALIAS( GetTexGendv, TexGendv ) ALIAS(GetTexGendv, TexGendv)
ALIAS( GetTexGenfv, TexGendv ) ALIAS(GetTexGenfv, TexGendv)
ALIAS( GetTexGeniv, TexGendv ) ALIAS(GetTexGeniv, TexGendv)
ALIAS( GetTexParameteriv, GetTexParameterfv ) ALIAS(GetTexParameteriv, GetTexParameterfv)
ALIAS( GetTexLevelParameteriv, GetTexLevelParameterfv ) ALIAS(GetTexLevelParameteriv, GetTexLevelParameterfv)
ALIAS( ColorTableParameteriv, ColorTableParameterfv ) ALIAS(ColorTableParameteriv, ColorTableParameterfv)
ALIAS( GetColorTableParameteriv, GetColorTableParameterfv ) ALIAS(GetColorTableParameteriv, GetColorTableParameterfv)
ALIAS( ConvolutionParameteriv, ConvolutionParameterfv ) ALIAS(ConvolutionParameteriv, ConvolutionParameterfv)
ALIAS( GetConvolutionParameteriv, GetConvolutionParameterfv ) ALIAS(GetConvolutionParameteriv, GetConvolutionParameterfv)
ALIAS( GetHistogramParameteriv, GetHistogramParameterfv ) ALIAS(GetHistogramParameteriv, GetHistogramParameterfv)
ALIAS( GetMinmaxParameteriv, GetMinmaxParameterfv ) ALIAS(GetMinmaxParameteriv, GetMinmaxParameterfv)
ALIAS( GetVertexAttribfvARB, GetVertexAttribdvARB ) ALIAS(GetVertexAttribfvARB, GetVertexAttribdvARB)
ALIAS( GetVertexAttribivARB, GetVertexAttribdvARB ) ALIAS(GetVertexAttribivARB, GetVertexAttribdvARB)
ALIAS( GetQueryObjectuivARB, GetQueryObjectivARB ) ALIAS(GetQueryObjectuivARB, GetQueryObjectivARB)
ALIAS( GetColorTableParameterfvSGI, GetColorTableParameterfv ) ALIAS(GetVertexAttribfvNV, GetVertexAttribdvNV)
ALIAS( GetColorTableParameterivSGI, GetColorTableParameterfv ) ALIAS(GetVertexAttribivNV, GetVertexAttribdvNV)
ALIAS( GetVertexAttribfvNV, GetVertexAttribdvNV ) ALIAS(PointParameterivNV, PointParameterfvEXT)
ALIAS( GetVertexAttribivNV, GetVertexAttribdvNV )
ALIAS( PointParameterivNV, PointParameterfvEXT )
# undef PURE # undef PURE
# undef FASTCALL # undef FASTCALL
# undef INTERNAL # undef INTERNAL

View File

@ -73,8 +73,10 @@ extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetTexLevelParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetConvolutionParameterfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint
extern INTERNAL PURE FASTCALL GLint __glGetConvolutionParameteriv_size(GLenum); __glGetConvolutionParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint
__glGetConvolutionParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameterfv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetHistogramParameteriv_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetMinmaxParameterfv_size(GLenum);
@ -86,13 +88,12 @@ extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetQueryObjectuivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetQueryivARB_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterfvSGI_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetColorTableParameterivSGI_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetProgramivNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribdvNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribfvNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum); extern INTERNAL PURE FASTCALL GLint __glGetVertexAttribivNV_size(GLenum);
extern INTERNAL PURE FASTCALL GLint __glGetFramebufferAttachmentParameterivEXT_size(GLenum); extern INTERNAL PURE FASTCALL GLint
__glGetFramebufferAttachmentParameterivEXT_size(GLenum);
# undef PURE # undef PURE
# undef FASTCALL # undef FASTCALL

View File

@ -163,7 +163,7 @@ static const void *Single_function_table[112][2] = {
/* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList}, /* [ 85] = 141 */ {__glXDisp_IsList, __glXDispSwap_IsList},
/* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush}, /* [ 86] = 142 */ {__glXDisp_Flush, __glXDispSwap_Flush},
/* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident}, /* [ 87] = 143 */ {__glXDisp_AreTexturesResident, __glXDispSwap_AreTexturesResident},
/* [ 88] = 144 */ {NULL, NULL}, /* [ 88] = 144 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures},
/* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures}, /* [ 89] = 145 */ {__glXDisp_GenTextures, __glXDispSwap_GenTextures},
/* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture}, /* [ 90] = 146 */ {__glXDisp_IsTexture, __glXDispSwap_IsTexture},
/* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable}, /* [ 91] = 147 */ {__glXDisp_GetColorTable, __glXDispSwap_GetColorTable},
@ -1232,12 +1232,12 @@ const struct __glXDispatchInfo Render_dispatch_info = {
/*****************************************************************/ /*****************************************************************/
/* tree depth = 13 */ /* tree depth = 13 */
static const int_fast16_t VendorPriv_dispatch_tree[158] = { static const int_fast16_t VendorPriv_dispatch_tree[155] = {
/* [0] -> opcode range [0, 131072], node depth 1 */ /* [0] -> opcode range [0, 131072], node depth 1 */
2, 2,
5, 5,
EMPTY_LEAF, EMPTY_LEAF,
122, 119,
EMPTY_LEAF, EMPTY_LEAF,
/* [5] -> opcode range [0, 32768], node depth 2 */ /* [5] -> opcode range [0, 32768], node depth 2 */
@ -1254,14 +1254,14 @@ static const int_fast16_t VendorPriv_dispatch_tree[158] = {
2, 2,
16, 16,
EMPTY_LEAF, EMPTY_LEAF,
81, 78,
EMPTY_LEAF, EMPTY_LEAF,
/* [16] -> opcode range [0, 2048], node depth 5 */ /* [16] -> opcode range [0, 2048], node depth 5 */
2, 2,
21, 21,
EMPTY_LEAF, EMPTY_LEAF,
39, 36,
EMPTY_LEAF, EMPTY_LEAF,
/* [21] -> opcode range [0, 512], node depth 6 */ /* [21] -> opcode range [0, 512], node depth 6 */
@ -1286,298 +1286,301 @@ static const int_fast16_t VendorPriv_dispatch_tree[158] = {
/* [33] -> opcode range [0, 32], node depth 10 */ /* [33] -> opcode range [0, 32], node depth 10 */
1, 1,
36,
EMPTY_LEAF,
/* [36] -> opcode range [0, 16], node depth 11 */
1,
EMPTY_LEAF,
LEAF(0), LEAF(0),
EMPTY_LEAF,
/* [39] -> opcode range [1024, 1536], node depth 6 */ /* [36] -> opcode range [1024, 1536], node depth 6 */
2, 2,
41,
EMPTY_LEAF,
53,
67,
/* [41] -> opcode range [1024, 1152], node depth 7 */
1,
44, 44,
EMPTY_LEAF, EMPTY_LEAF,
56,
70,
/* [44] -> opcode range [1024, 1152], node depth 7 */ /* [44] -> opcode range [1024, 1088], node depth 8 */
1, 1,
47, 47,
EMPTY_LEAF, EMPTY_LEAF,
/* [47] -> opcode range [1024, 1088], node depth 8 */ /* [47] -> opcode range [1024, 1056], node depth 9 */
1, 1,
50, 50,
EMPTY_LEAF, EMPTY_LEAF,
/* [50] -> opcode range [1024, 1056], node depth 9 */ /* [50] -> opcode range [1024, 1040], node depth 10 */
1, 1,
53,
EMPTY_LEAF,
/* [53] -> opcode range [1024, 1040], node depth 10 */
1,
LEAF(8),
EMPTY_LEAF,
/* [56] -> opcode range [1280, 1408], node depth 7 */
1,
59,
EMPTY_LEAF,
/* [59] -> opcode range [1280, 1344], node depth 8 */
2,
64,
LEAF(16), LEAF(16),
EMPTY_LEAF, EMPTY_LEAF,
67,
/* [64] -> opcode range [1280, 1296], node depth 9 */ /* [53] -> opcode range [1280, 1408], node depth 7 */
1,
56,
EMPTY_LEAF,
/* [56] -> opcode range [1280, 1344], node depth 8 */
2,
61,
LEAF(24),
EMPTY_LEAF,
64,
/* [61] -> opcode range [1280, 1296], node depth 9 */
1, 1,
EMPTY_LEAF, EMPTY_LEAF,
LEAF(32),
/* [67] -> opcode range [1328, 1344], node depth 9 */
1,
LEAF(40), LEAF(40),
/* [64] -> opcode range [1328, 1344], node depth 9 */
1,
LEAF(48),
EMPTY_LEAF, EMPTY_LEAF,
/* [70] -> opcode range [1408, 1536], node depth 7 */ /* [67] -> opcode range [1408, 1536], node depth 7 */
1,
70,
EMPTY_LEAF,
/* [70] -> opcode range [1408, 1472], node depth 8 */
1, 1,
73, 73,
EMPTY_LEAF, EMPTY_LEAF,
/* [73] -> opcode range [1408, 1472], node depth 8 */ /* [73] -> opcode range [1408, 1440], node depth 9 */
1,
76,
EMPTY_LEAF,
/* [76] -> opcode range [1408, 1440], node depth 9 */
2, 2,
EMPTY_LEAF, EMPTY_LEAF,
LEAF(48),
LEAF(56), LEAF(56),
LEAF(64),
EMPTY_LEAF, EMPTY_LEAF,
/* [81] -> opcode range [4096, 6144], node depth 5 */ /* [78] -> opcode range [4096, 6144], node depth 5 */
2, 2,
83,
EMPTY_LEAF,
101,
EMPTY_LEAF,
/* [83] -> opcode range [4096, 4608], node depth 6 */
1,
86, 86,
EMPTY_LEAF, EMPTY_LEAF,
104,
EMPTY_LEAF,
/* [86] -> opcode range [4096, 4608], node depth 6 */ /* [86] -> opcode range [4096, 4352], node depth 7 */
1, 1,
89, 89,
EMPTY_LEAF, EMPTY_LEAF,
/* [89] -> opcode range [4096, 4352], node depth 7 */ /* [89] -> opcode range [4096, 4224], node depth 8 */
1, 1,
92, 92,
EMPTY_LEAF, EMPTY_LEAF,
/* [92] -> opcode range [4096, 4224], node depth 8 */ /* [92] -> opcode range [4096, 4160], node depth 9 */
1, 1,
95, 95,
EMPTY_LEAF, EMPTY_LEAF,
/* [95] -> opcode range [4096, 4160], node depth 9 */ /* [95] -> opcode range [4096, 4128], node depth 10 */
1, 1,
98, 98,
EMPTY_LEAF, EMPTY_LEAF,
/* [98] -> opcode range [4096, 4128], node depth 10 */ /* [98] -> opcode range [4096, 4112], node depth 11 */
1,
101,
EMPTY_LEAF,
/* [101] -> opcode range [4096, 4112], node depth 11 */
1,
LEAF(64),
EMPTY_LEAF,
/* [104] -> opcode range [5120, 5632], node depth 6 */
1,
107,
EMPTY_LEAF,
/* [107] -> opcode range [5120, 5376], node depth 7 */
1,
110,
EMPTY_LEAF,
/* [110] -> opcode range [5120, 5248], node depth 8 */
1,
113,
EMPTY_LEAF,
/* [113] -> opcode range [5120, 5184], node depth 9 */
1,
EMPTY_LEAF,
116,
/* [116] -> opcode range [5152, 5184], node depth 10 */
1,
119,
EMPTY_LEAF,
/* [119] -> opcode range [5152, 5168], node depth 11 */
1, 1,
LEAF(72), LEAF(72),
EMPTY_LEAF, EMPTY_LEAF,
/* [122] -> opcode range [65536, 98304], node depth 2 */ /* [101] -> opcode range [5120, 5632], node depth 6 */
1, 1,
125, 104,
EMPTY_LEAF, EMPTY_LEAF,
/* [125] -> opcode range [65536, 81920], node depth 3 */ /* [104] -> opcode range [5120, 5376], node depth 7 */
1, 1,
128, 107,
EMPTY_LEAF, EMPTY_LEAF,
/* [128] -> opcode range [65536, 73728], node depth 4 */ /* [107] -> opcode range [5120, 5248], node depth 8 */
1, 1,
131, 110,
EMPTY_LEAF, EMPTY_LEAF,
/* [131] -> opcode range [65536, 69632], node depth 5 */ /* [110] -> opcode range [5120, 5184], node depth 9 */
1, 1,
134, EMPTY_LEAF,
113,
/* [113] -> opcode range [5152, 5184], node depth 10 */
1,
116,
EMPTY_LEAF, EMPTY_LEAF,
/* [134] -> opcode range [65536, 67584], node depth 6 */ /* [116] -> opcode range [5152, 5168], node depth 11 */
1,
137,
EMPTY_LEAF,
/* [137] -> opcode range [65536, 66560], node depth 7 */
1,
140,
EMPTY_LEAF,
/* [140] -> opcode range [65536, 66048], node depth 8 */
1,
143,
EMPTY_LEAF,
/* [143] -> opcode range [65536, 65792], node depth 9 */
1,
146,
EMPTY_LEAF,
/* [146] -> opcode range [65536, 65664], node depth 10 */
1,
149,
EMPTY_LEAF,
/* [149] -> opcode range [65536, 65600], node depth 11 */
1,
152,
EMPTY_LEAF,
/* [152] -> opcode range [65536, 65568], node depth 12 */
1,
155,
EMPTY_LEAF,
/* [155] -> opcode range [65536, 65552], node depth 13 */
1, 1,
LEAF(80), LEAF(80),
EMPTY_LEAF, EMPTY_LEAF,
/* [119] -> opcode range [65536, 98304], node depth 2 */
1,
122,
EMPTY_LEAF,
/* [122] -> opcode range [65536, 81920], node depth 3 */
1,
125,
EMPTY_LEAF,
/* [125] -> opcode range [65536, 73728], node depth 4 */
1,
128,
EMPTY_LEAF,
/* [128] -> opcode range [65536, 69632], node depth 5 */
1,
131,
EMPTY_LEAF,
/* [131] -> opcode range [65536, 67584], node depth 6 */
1,
134,
EMPTY_LEAF,
/* [134] -> opcode range [65536, 66560], node depth 7 */
1,
137,
EMPTY_LEAF,
/* [137] -> opcode range [65536, 66048], node depth 8 */
1,
140,
EMPTY_LEAF,
/* [140] -> opcode range [65536, 65792], node depth 9 */
1,
143,
EMPTY_LEAF,
/* [143] -> opcode range [65536, 65664], node depth 10 */
1,
146,
EMPTY_LEAF,
/* [146] -> opcode range [65536, 65600], node depth 11 */
1,
149,
EMPTY_LEAF,
/* [149] -> opcode range [65536, 65568], node depth 12 */
1,
152,
EMPTY_LEAF,
/* [152] -> opcode range [65536, 65552], node depth 13 */
1,
LEAF(88),
EMPTY_LEAF,
}; };
static const void *VendorPriv_function_table[88][2] = { static const void *VendorPriv_function_table[96][2] = {
/* [ 0] = 8 */ {NULL, NULL}, /* [ 0] = 0 */ {NULL, NULL},
/* [ 1] = 9 */ {NULL, NULL}, /* [ 1] = 1 */ {__glXDisp_GetConvolutionFilterEXT, __glXDispSwap_GetConvolutionFilterEXT},
/* [ 2] = 10 */ {NULL, NULL}, /* [ 2] = 2 */ {__glXDisp_GetConvolutionParameterfvEXT, __glXDispSwap_GetConvolutionParameterfvEXT},
/* [ 3] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT}, /* [ 3] = 3 */ {__glXDisp_GetConvolutionParameterivEXT, __glXDispSwap_GetConvolutionParameterivEXT},
/* [ 4] = 12 */ {__glXDisp_DeleteTextures, __glXDispSwap_DeleteTextures}, /* [ 4] = 4 */ {__glXDisp_GetSeparableFilterEXT, __glXDispSwap_GetSeparableFilterEXT},
/* [ 5] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT}, /* [ 5] = 5 */ {__glXDisp_GetHistogramEXT, __glXDispSwap_GetHistogramEXT},
/* [ 6] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT}, /* [ 6] = 6 */ {__glXDisp_GetHistogramParameterfvEXT, __glXDispSwap_GetHistogramParameterfvEXT},
/* [ 7] = 15 */ {NULL, NULL}, /* [ 7] = 7 */ {__glXDisp_GetHistogramParameterivEXT, __glXDispSwap_GetHistogramParameterivEXT},
/* [ 8] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT}, /* [ 8] = 8 */ {__glXDisp_GetMinmaxEXT, __glXDispSwap_GetMinmaxEXT},
/* [ 9] = 1025 */ {NULL, NULL}, /* [ 9] = 9 */ {__glXDisp_GetMinmaxParameterfvEXT, __glXDispSwap_GetMinmaxParameterfvEXT},
/* [ 10] = 1026 */ {NULL, NULL}, /* [ 10] = 10 */ {__glXDisp_GetMinmaxParameterivEXT, __glXDispSwap_GetMinmaxParameterivEXT},
/* [ 11] = 1027 */ {NULL, NULL}, /* [ 11] = 11 */ {__glXDisp_AreTexturesResidentEXT, __glXDispSwap_AreTexturesResidentEXT},
/* [ 12] = 1028 */ {NULL, NULL}, /* [ 12] = 12 */ {__glXDisp_DeleteTexturesEXT, __glXDispSwap_DeleteTexturesEXT},
/* [ 13] = 1029 */ {NULL, NULL}, /* [ 13] = 13 */ {__glXDisp_GenTexturesEXT, __glXDispSwap_GenTexturesEXT},
/* [ 14] = 1030 */ {NULL, NULL}, /* [ 14] = 14 */ {__glXDisp_IsTextureEXT, __glXDispSwap_IsTextureEXT},
/* [ 15] = 1031 */ {NULL, NULL}, /* [ 15] = 15 */ {NULL, NULL},
/* [ 16] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB}, /* [ 16] = 1024 */ {__glXDisp_QueryContextInfoEXT, __glXDispSwap_QueryContextInfoEXT},
/* [ 17] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB}, /* [ 17] = 1025 */ {NULL, NULL},
/* [ 18] = 1298 */ {__glXDisp_GetProgramivNV, __glXDispSwap_GetProgramivNV}, /* [ 18] = 1026 */ {NULL, NULL},
/* [ 19] = 1299 */ {__glXDisp_GetProgramStringNV, __glXDispSwap_GetProgramStringNV}, /* [ 19] = 1027 */ {NULL, NULL},
/* [ 20] = 1300 */ {__glXDisp_GetTrackMatrixivNV, __glXDispSwap_GetTrackMatrixivNV}, /* [ 20] = 1028 */ {NULL, NULL},
/* [ 21] = 1301 */ {__glXDisp_GetVertexAttribdvARB, __glXDispSwap_GetVertexAttribdvARB}, /* [ 21] = 1029 */ {NULL, NULL},
/* [ 22] = 1302 */ {__glXDisp_GetVertexAttribfvNV, __glXDispSwap_GetVertexAttribfvNV}, /* [ 22] = 1030 */ {NULL, NULL},
/* [ 23] = 1303 */ {__glXDisp_GetVertexAttribivNV, __glXDispSwap_GetVertexAttribivNV}, /* [ 23] = 1031 */ {NULL, NULL},
/* [ 24] = 1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV}, /* [ 24] = 1296 */ {__glXDisp_GetProgramEnvParameterfvARB, __glXDispSwap_GetProgramEnvParameterfvARB},
/* [ 25] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB}, /* [ 25] = 1297 */ {__glXDisp_GetProgramEnvParameterdvARB, __glXDispSwap_GetProgramEnvParameterdvARB},
/* [ 26] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB}, /* [ 26] = 1298 */ {__glXDisp_GetProgramivNV, __glXDispSwap_GetProgramivNV},
/* [ 27] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB}, /* [ 27] = 1299 */ {__glXDisp_GetProgramStringNV, __glXDispSwap_GetProgramStringNV},
/* [ 28] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB}, /* [ 28] = 1300 */ {__glXDisp_GetTrackMatrixivNV, __glXDispSwap_GetTrackMatrixivNV},
/* [ 29] = 1309 */ {NULL, NULL}, /* [ 29] = 1301 */ {__glXDisp_GetVertexAttribdvARB, __glXDispSwap_GetVertexAttribdvARB},
/* [ 30] = 1310 */ {__glXDisp_GetProgramNamedParameterfvNV, __glXDispSwap_GetProgramNamedParameterfvNV}, /* [ 30] = 1302 */ {__glXDisp_GetVertexAttribfvNV, __glXDispSwap_GetVertexAttribfvNV},
/* [ 31] = 1311 */ {__glXDisp_GetProgramNamedParameterdvNV, __glXDispSwap_GetProgramNamedParameterdvNV}, /* [ 31] = 1303 */ {__glXDisp_GetVertexAttribivNV, __glXDispSwap_GetVertexAttribivNV},
/* [ 32] = 1288 */ {NULL, NULL}, /* [ 32] = 1304 */ {__glXDisp_IsProgramNV, __glXDispSwap_IsProgramNV},
/* [ 33] = 1289 */ {NULL, NULL}, /* [ 33] = 1305 */ {__glXDisp_GetProgramLocalParameterfvARB, __glXDispSwap_GetProgramLocalParameterfvARB},
/* [ 34] = 1290 */ {NULL, NULL}, /* [ 34] = 1306 */ {__glXDisp_GetProgramLocalParameterdvARB, __glXDispSwap_GetProgramLocalParameterdvARB},
/* [ 35] = 1291 */ {NULL, NULL}, /* [ 35] = 1307 */ {__glXDisp_GetProgramivARB, __glXDispSwap_GetProgramivARB},
/* [ 36] = 1292 */ {NULL, NULL}, /* [ 36] = 1308 */ {__glXDisp_GetProgramStringARB, __glXDispSwap_GetProgramStringARB},
/* [ 37] = 1293 */ {__glXDisp_AreProgramsResidentNV, __glXDispSwap_AreProgramsResidentNV}, /* [ 37] = 1309 */ {NULL, NULL},
/* [ 38] = 1294 */ {__glXDisp_DeleteProgramsNV, __glXDispSwap_DeleteProgramsNV}, /* [ 38] = 1310 */ {__glXDisp_GetProgramNamedParameterfvNV, __glXDispSwap_GetProgramNamedParameterfvNV},
/* [ 39] = 1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV}, /* [ 39] = 1311 */ {__glXDisp_GetProgramNamedParameterdvNV, __glXDispSwap_GetProgramNamedParameterdvNV},
/* [ 40] = 1328 */ {NULL, NULL}, /* [ 40] = 1288 */ {NULL, NULL},
/* [ 41] = 1329 */ {NULL, NULL}, /* [ 41] = 1289 */ {NULL, NULL},
/* [ 42] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT}, /* [ 42] = 1290 */ {NULL, NULL},
/* [ 43] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT}, /* [ 43] = 1291 */ {NULL, NULL},
/* [ 44] = 1332 */ {NULL, NULL}, /* [ 44] = 1292 */ {NULL, NULL},
/* [ 45] = 1333 */ {NULL, NULL}, /* [ 45] = 1293 */ {__glXDisp_AreProgramsResidentNV, __glXDispSwap_AreProgramsResidentNV},
/* [ 46] = 1334 */ {NULL, NULL}, /* [ 46] = 1294 */ {__glXDisp_DeleteProgramsNV, __glXDispSwap_DeleteProgramsNV},
/* [ 47] = 1335 */ {NULL, NULL}, /* [ 47] = 1295 */ {__glXDisp_GenProgramsNV, __glXDispSwap_GenProgramsNV},
/* [ 48] = 1416 */ {NULL, NULL}, /* [ 48] = 1328 */ {NULL, NULL},
/* [ 49] = 1417 */ {NULL, NULL}, /* [ 49] = 1329 */ {NULL, NULL},
/* [ 50] = 1418 */ {NULL, NULL}, /* [ 50] = 1330 */ {__glXDisp_BindTexImageEXT, __glXDispSwap_BindTexImageEXT},
/* [ 51] = 1419 */ {NULL, NULL}, /* [ 51] = 1331 */ {__glXDisp_ReleaseTexImageEXT, __glXDispSwap_ReleaseTexImageEXT},
/* [ 52] = 1420 */ {NULL, NULL}, /* [ 52] = 1332 */ {NULL, NULL},
/* [ 53] = 1421 */ {NULL, NULL}, /* [ 53] = 1333 */ {NULL, NULL},
/* [ 54] = 1422 */ {__glXDisp_IsRenderbufferEXT, __glXDispSwap_IsRenderbufferEXT}, /* [ 54] = 1334 */ {NULL, NULL},
/* [ 55] = 1423 */ {__glXDisp_GenRenderbuffersEXT, __glXDispSwap_GenRenderbuffersEXT}, /* [ 55] = 1335 */ {NULL, NULL},
/* [ 56] = 1424 */ {__glXDisp_GetRenderbufferParameterivEXT, __glXDispSwap_GetRenderbufferParameterivEXT}, /* [ 56] = 1416 */ {NULL, NULL},
/* [ 57] = 1425 */ {__glXDisp_IsFramebufferEXT, __glXDispSwap_IsFramebufferEXT}, /* [ 57] = 1417 */ {NULL, NULL},
/* [ 58] = 1426 */ {__glXDisp_GenFramebuffersEXT, __glXDispSwap_GenFramebuffersEXT}, /* [ 58] = 1418 */ {NULL, NULL},
/* [ 59] = 1427 */ {__glXDisp_CheckFramebufferStatusEXT, __glXDispSwap_CheckFramebufferStatusEXT}, /* [ 59] = 1419 */ {NULL, NULL},
/* [ 60] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT, __glXDispSwap_GetFramebufferAttachmentParameterivEXT}, /* [ 60] = 1420 */ {NULL, NULL},
/* [ 61] = 1429 */ {NULL, NULL}, /* [ 61] = 1421 */ {NULL, NULL},
/* [ 62] = 1430 */ {NULL, NULL}, /* [ 62] = 1422 */ {__glXDisp_IsRenderbufferEXT, __glXDispSwap_IsRenderbufferEXT},
/* [ 63] = 1431 */ {NULL, NULL}, /* [ 63] = 1423 */ {__glXDisp_GenRenderbuffersEXT, __glXDispSwap_GenRenderbuffersEXT},
/* [ 64] = 4096 */ {NULL, NULL}, /* [ 64] = 1424 */ {__glXDisp_GetRenderbufferParameterivEXT, __glXDispSwap_GetRenderbufferParameterivEXT},
/* [ 65] = 4097 */ {NULL, NULL}, /* [ 65] = 1425 */ {__glXDisp_IsFramebufferEXT, __glXDispSwap_IsFramebufferEXT},
/* [ 66] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI}, /* [ 66] = 1426 */ {__glXDisp_GenFramebuffersEXT, __glXDispSwap_GenFramebuffersEXT},
/* [ 67] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI}, /* [ 67] = 1427 */ {__glXDisp_CheckFramebufferStatusEXT, __glXDispSwap_CheckFramebufferStatusEXT},
/* [ 68] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI}, /* [ 68] = 1428 */ {__glXDisp_GetFramebufferAttachmentParameterivEXT, __glXDispSwap_GetFramebufferAttachmentParameterivEXT},
/* [ 69] = 4101 */ {NULL, NULL}, /* [ 69] = 1429 */ {NULL, NULL},
/* [ 70] = 4102 */ {NULL, NULL}, /* [ 70] = 1430 */ {NULL, NULL},
/* [ 71] = 4103 */ {NULL, NULL}, /* [ 71] = 1431 */ {NULL, NULL},
/* [ 72] = 5152 */ {NULL, NULL}, /* [ 72] = 4096 */ {NULL, NULL},
/* [ 73] = 5153 */ {NULL, NULL}, /* [ 73] = 4097 */ {NULL, NULL},
/* [ 74] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA}, /* [ 74] = 4098 */ {__glXDisp_GetColorTableSGI, __glXDispSwap_GetColorTableSGI},
/* [ 75] = 5155 */ {NULL, NULL}, /* [ 75] = 4099 */ {__glXDisp_GetColorTableParameterfvSGI, __glXDispSwap_GetColorTableParameterfvSGI},
/* [ 76] = 5156 */ {NULL, NULL}, /* [ 76] = 4100 */ {__glXDisp_GetColorTableParameterivSGI, __glXDispSwap_GetColorTableParameterivSGI},
/* [ 77] = 5157 */ {NULL, NULL}, /* [ 77] = 4101 */ {NULL, NULL},
/* [ 78] = 5158 */ {NULL, NULL}, /* [ 78] = 4102 */ {NULL, NULL},
/* [ 79] = 5159 */ {NULL, NULL}, /* [ 79] = 4103 */ {NULL, NULL},
/* [ 80] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI}, /* [ 80] = 5152 */ {NULL, NULL},
/* [ 81] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI}, /* [ 81] = 5153 */ {NULL, NULL},
/* [ 82] = 65538 */ {NULL, NULL}, /* [ 82] = 5154 */ {__glXDisp_CopySubBufferMESA, __glXDispSwap_CopySubBufferMESA},
/* [ 83] = 65539 */ {NULL, NULL}, /* [ 83] = 5155 */ {NULL, NULL},
/* [ 84] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX}, /* [ 84] = 5156 */ {NULL, NULL},
/* [ 85] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX}, /* [ 85] = 5157 */ {NULL, NULL},
/* [ 86] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX}, /* [ 86] = 5158 */ {NULL, NULL},
/* [ 87] = 65543 */ {NULL, NULL}, /* [ 87] = 5159 */ {NULL, NULL},
/* [ 88] = 65536 */ {__glXDisp_SwapIntervalSGI, __glXDispSwap_SwapIntervalSGI},
/* [ 89] = 65537 */ {__glXDisp_MakeCurrentReadSGI, __glXDispSwap_MakeCurrentReadSGI},
/* [ 90] = 65538 */ {NULL, NULL},
/* [ 91] = 65539 */ {NULL, NULL},
/* [ 92] = 65540 */ {__glXDisp_GetFBConfigsSGIX, __glXDispSwap_GetFBConfigsSGIX},
/* [ 93] = 65541 */ {__glXDisp_CreateContextWithConfigSGIX, __glXDispSwap_CreateContextWithConfigSGIX},
/* [ 94] = 65542 */ {__glXDisp_CreateGLXPixmapWithConfigSGIX, __glXDispSwap_CreateGLXPixmapWithConfigSGIX},
/* [ 95] = 65543 */ {NULL, NULL},
}; };
const struct __glXDispatchInfo VendorPriv_dispatch_info = { const struct __glXDispatchInfo VendorPriv_dispatch_info = {

View File

@ -28,7 +28,7 @@
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glxproto.h> #include <GL/glxproto.h>
#ifdef __linux__ #if defined(__linux__) || defined(__GNU__)
#include <byteswap.h> #include <byteswap.h>
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
#include <sys/endian.h> #include <sys/endian.h>

View File

@ -195,7 +195,7 @@ int __glXDisp_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) static int GetSeparableFilter(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize, compsize2; GLint compsize, compsize2;
GLenum format, type, target; GLenum format, type, target;
@ -206,12 +206,11 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0, height=0; GLint width=0, height=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
format = *(GLenum *)(pc + 4); format = *(GLenum *)(pc + 4);
type = *(GLenum *)(pc + 8); type = *(GLenum *)(pc + 8);
target = *(GLenum *)(pc + 0); target = *(GLenum *)(pc + 0);
@ -220,8 +219,8 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
/* target must be SEPARABLE_2D, however I guess we can let the GL /* target must be SEPARABLE_2D, however I guess we can let the GL
barf on this one.... */ barf on this one.... */
CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_WIDTH, &width) ); CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, GL_CONVOLUTION_WIDTH, &width));
CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_HEIGHT, &height) ); CALL_GetConvolutionParameteriv(GET_DISPATCH(), (target, GL_CONVOLUTION_HEIGHT, &height));
/* /*
* The two queries above might fail if we're in a state where queries * The two queries above might fail if we're in a state where queries
* are illegal, but then width and height would still be zero anyway. * are illegal, but then width and height would still be zero anyway.
@ -234,7 +233,7 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
compsize = __GLX_PAD(compsize); compsize = __GLX_PAD(compsize);
compsize2 = __GLX_PAD(compsize2); compsize2 = __GLX_PAD(compsize2);
CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) ); CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
__GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize + compsize2,1);
__glXClearErrorOccured(); __glXClearErrorOccured();
CALL_GetSeparableFilter( GET_DISPATCH(), ( CALL_GetSeparableFilter( GET_DISPATCH(), (
@ -260,7 +259,22 @@ int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDisp_GetSeparableFilterEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc,
GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -271,22 +285,23 @@ int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0, height=0; GLint width=0, height=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
format = *(GLenum *)(pc + 4); format = *(GLenum *)(pc + 4);
type = *(GLenum *)(pc + 8); type = *(GLenum *)(pc + 8);
target = *(GLenum *)(pc + 0); target = *(GLenum *)(pc + 0);
swapBytes = *(GLboolean *)(pc + 12); swapBytes = *(GLboolean *)(pc + 12);
CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_WIDTH, &width) ); CALL_GetConvolutionParameteriv(GET_DISPATCH(),
(target, GL_CONVOLUTION_WIDTH, &width));
if (target == GL_CONVOLUTION_1D) { if (target == GL_CONVOLUTION_1D) {
height = 1; height = 1;
} else { } else {
CALL_GetConvolutionParameteriv( GET_DISPATCH(), (target, GL_CONVOLUTION_HEIGHT, &height) ); CALL_GetConvolutionParameteriv(GET_DISPATCH(),
(target, GL_CONVOLUTION_HEIGHT, &height));
} }
/* /*
* The two queries above might fail if we're in a state where queries * The two queries above might fail if we're in a state where queries
@ -295,7 +310,7 @@ int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
compsize = __glGetTexImage_size(target,1,format,type,width,height,1); compsize = __glGetTexImage_size(target,1,format,type,width,height,1);
if (compsize < 0) compsize = 0; if (compsize < 0) compsize = 0;
CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) ); CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
__GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
__glXClearErrorOccured(); __glXClearErrorOccured();
CALL_GetConvolutionFilter( GET_DISPATCH(), ( CALL_GetConvolutionFilter( GET_DISPATCH(), (
@ -319,7 +334,21 @@ int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDisp_GetConvolutionFilterEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetHistogram(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -330,19 +359,19 @@ int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0; GLint width=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
format = *(GLenum *)(pc + 4); format = *(GLenum *)(pc + 4);
type = *(GLenum *)(pc + 8); type = *(GLenum *)(pc + 8);
target = *(GLenum *)(pc + 0); target = *(GLenum *)(pc + 0);
swapBytes = *(GLboolean *)(pc + 12); swapBytes = *(GLboolean *)(pc + 12);
reset = *(GLboolean *)(pc + 13); reset = *(GLboolean *)(pc + 13);
CALL_GetHistogramParameteriv( GET_DISPATCH(), (target, GL_HISTOGRAM_WIDTH, &width) ); CALL_GetHistogramParameteriv(GET_DISPATCH(),
(target, GL_HISTOGRAM_WIDTH, &width));
/* /*
* The one query above might fail if we're in a state where queries * The one query above might fail if we're in a state where queries
* are illegal, but then width would still be zero anyway. * are illegal, but then width would still be zero anyway.
@ -350,10 +379,10 @@ int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc)
compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
if (compsize < 0) compsize = 0; if (compsize < 0) compsize = 0;
CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) ); CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
__GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
__glXClearErrorOccured(); __glXClearErrorOccured();
CALL_GetHistogram( GET_DISPATCH(), (target, reset, format, type, answer) ); CALL_GetHistogram(GET_DISPATCH(), (target, reset, format, type, answer));
if (__glXErrorOccured()) { if (__glXErrorOccured()) {
__GLX_BEGIN_REPLY(0); __GLX_BEGIN_REPLY(0);
@ -368,7 +397,21 @@ int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetHistogram(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDisp_GetHistogramEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetMinmax(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -378,12 +421,11 @@ int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc)
int error; int error;
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
format = *(GLenum *)(pc + 4); format = *(GLenum *)(pc + 4);
type = *(GLenum *)(pc + 8); type = *(GLenum *)(pc + 8);
target = *(GLenum *)(pc + 0); target = *(GLenum *)(pc + 0);
@ -393,10 +435,10 @@ int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc)
compsize = __glGetTexImage_size(target,1,format,type,2,1,1); compsize = __glGetTexImage_size(target,1,format,type,2,1,1);
if (compsize < 0) compsize = 0; if (compsize < 0) compsize = 0;
CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) ); CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
__GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
__glXClearErrorOccured(); __glXClearErrorOccured();
CALL_GetMinmax( GET_DISPATCH(), (target, reset, format, type, answer) ); CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, answer));
if (__glXErrorOccured()) { if (__glXErrorOccured()) {
__GLX_BEGIN_REPLY(0); __GLX_BEGIN_REPLY(0);
@ -410,7 +452,21 @@ int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetMinmax(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDisp_GetMinmaxEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetColorTable(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -421,18 +477,18 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0; GLint width=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
target = *(GLenum *)(pc + 0); target = *(GLenum *)(pc + 0);
format = *(GLenum *)(pc + 4); format = *(GLenum *)(pc + 4);
type = *(GLenum *)(pc + 8); type = *(GLenum *)(pc + 8);
swapBytes = *(GLboolean *)(pc + 12); swapBytes = *(GLboolean *)(pc + 12);
CALL_GetColorTableParameteriv( GET_DISPATCH(), (target, GL_COLOR_TABLE_WIDTH, &width) ); CALL_GetColorTableParameteriv(GET_DISPATCH(),
(target, GL_COLOR_TABLE_WIDTH, &width));
/* /*
* The one query above might fail if we're in a state where queries * The one query above might fail if we're in a state where queries
* are illegal, but then width would still be zero anyway. * are illegal, but then width would still be zero anyway.
@ -440,7 +496,7 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc)
compsize = __glGetTexImage_size(target,1,format,type,width,1,1); compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
if (compsize < 0) compsize = 0; if (compsize < 0) compsize = 0;
CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) ); CALL_PixelStorei(GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes));
__GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1); __GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
__glXClearErrorOccured(); __glXClearErrorOccured();
CALL_GetColorTable( GET_DISPATCH(), ( CALL_GetColorTable( GET_DISPATCH(), (
@ -463,55 +519,16 @@ int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDisp_GetColorTable(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDisp_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc) int __glXDisp_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc)
{ {
GLint compsize; const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
GLenum format, type, target;
GLboolean swapBytes;
__GLXcontext *cx;
ClientPtr client = cl->client;
int error;
char *answer, answerBuffer[200];
GLint width=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
if (!cx) {
return error;
}
pc += __GLX_VENDPRIV_HDR_SIZE;
target = *(GLenum *)(pc + 0);
format = *(GLenum *)(pc + 4);
type = *(GLenum *)(pc + 8);
swapBytes = *(GLboolean *)(pc + 12);
CALL_GetColorTableParameterivSGI( GET_DISPATCH(), (target, GL_COLOR_TABLE_WIDTH, &width) );
/*
* The one query above might fail if we're in a state where queries
* are illegal, but then width would still be zero anyway.
*/
compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
if (compsize < 0) compsize = 0;
CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, swapBytes) );
__GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
__glXClearErrorOccured();
CALL_GetColorTableSGI( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
*(GLenum *)(pc + 4),
*(GLenum *)(pc + 8),
answer
) );
if (__glXErrorOccured()) {
__GLX_BEGIN_REPLY(0);
__GLX_SEND_HEADER();
} else {
__GLX_BEGIN_REPLY(compsize);
((xGLXGetColorTableReply *)&__glXReply)->width = width;
__GLX_SEND_HEADER();
__GLX_SEND_VOID_ARRAY(compsize);
}
return Success;
} }

View File

@ -219,7 +219,7 @@ int __glXDispSwap_GetPolygonStipple(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc) static int GetSeparableFilter(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize, compsize2; GLint compsize, compsize2;
GLenum format, type, target; GLenum format, type, target;
@ -231,12 +231,11 @@ int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0, height=0; GLint width=0, height=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
__GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+0);
__GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+4);
__GLX_SWAP_INT(pc+8); __GLX_SWAP_INT(pc+8);
@ -291,7 +290,21 @@ int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetSeparableFilter(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetSeparableFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDispSwap_GetSeparableFilterEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetSeparableFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -303,12 +316,11 @@ int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0, height=0; GLint width=0, height=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
__GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+0);
__GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+4);
__GLX_SWAP_INT(pc+8); __GLX_SWAP_INT(pc+8);
@ -357,7 +369,21 @@ int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetConvolutionFilter(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetConvolutionFilter(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDispSwap_GetConvolutionFilterEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetConvolutionFilter(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetHistogram(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -369,12 +395,11 @@ int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0; GLint width=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
__GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+0);
__GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+4);
__GLX_SWAP_INT(pc+8); __GLX_SWAP_INT(pc+8);
@ -412,7 +437,21 @@ int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetHistogram(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetHistogram(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDispSwap_GetHistogramEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetHistogram(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetMinmax(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -423,12 +462,11 @@ int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc)
__GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_VARIABLES;
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
__GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+0);
__GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+4);
__GLX_SWAP_INT(pc+8); __GLX_SWAP_INT(pc+8);
@ -459,7 +497,21 @@ int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetMinmax(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetMinmax(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDispSwap_GetMinmaxEXT(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
return GetMinmax(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
}
static int GetColorTable(__GLXclientState *cl, GLbyte *pc, GLXContextTag tag)
{ {
GLint compsize; GLint compsize;
GLenum format, type, target; GLenum format, type, target;
@ -471,12 +523,11 @@ int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
char *answer, answerBuffer[200]; char *answer, answerBuffer[200];
GLint width=0; GLint width=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); cx = __glXForceCurrent(cl, tag, &error);
if (!cx) { if (!cx) {
return error; return error;
} }
pc += __GLX_SINGLE_HDR_SIZE;
__GLX_SWAP_INT(pc+0); __GLX_SWAP_INT(pc+0);
__GLX_SWAP_INT(pc+4); __GLX_SWAP_INT(pc+4);
__GLX_SWAP_INT(pc+8); __GLX_SWAP_INT(pc+8);
@ -518,61 +569,16 @@ int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
return Success; return Success;
} }
int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
{
const GLXContextTag tag = __GLX_GET_SINGLE_CONTEXT_TAG(pc);
return GetColorTable(cl, pc + __GLX_SINGLE_HDR_SIZE, tag);
}
int __glXDispSwap_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetColorTableSGI(__GLXclientState *cl, GLbyte *pc)
{ {
GLint compsize; const GLXContextTag tag = __GLX_GET_VENDPRIV_CONTEXT_TAG(pc);
GLenum format, type, target;
GLboolean swapBytes;
__GLXcontext *cx;
ClientPtr client = cl->client;
int error;
__GLX_DECLARE_SWAP_VARIABLES;
char *answer, answerBuffer[200];
GLint width=0;
cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); return GetColorTable(cl, pc + __GLX_VENDPRIV_HDR_SIZE, tag);
if (!cx) {
return error;
}
pc += __GLX_VENDPRIV_HDR_SIZE;
__GLX_SWAP_INT(pc+0);
__GLX_SWAP_INT(pc+4);
__GLX_SWAP_INT(pc+8);
format = *(GLenum *)(pc + 4);
type = *(GLenum *)(pc + 8);
target = *(GLenum *)(pc + 0);
swapBytes = *(GLboolean *)(pc + 12);
CALL_GetColorTableParameterivSGI( GET_DISPATCH(), (target, GL_COLOR_TABLE_WIDTH, &width) );
/*
* The one query above might fail if we're in a state where queries
* are illegal, but then width would still be zero anyway.
*/
compsize = __glGetTexImage_size(target,1,format,type,width,1,1);
if (compsize < 0) compsize = 0;
CALL_PixelStorei( GET_DISPATCH(), (GL_PACK_SWAP_BYTES, !swapBytes) );
__GLX_GET_ANSWER_BUFFER(answer,cl,compsize,1);
__glXClearErrorOccured();
CALL_GetColorTableSGI( GET_DISPATCH(), (
*(GLenum *)(pc + 0),
*(GLenum *)(pc + 4),
*(GLenum *)(pc + 8),
answer
) );
if (__glXErrorOccured()) {
__GLX_BEGIN_REPLY(0);
__GLX_SWAP_REPLY_HEADER();
} else {
__GLX_BEGIN_REPLY(compsize);
__GLX_SWAP_REPLY_HEADER();
__GLX_SWAP_INT(&width);
((xGLXGetColorTableReply *)&__glXReply)->width = width;
__GLX_SEND_VOID_ARRAY(compsize);
}
return Success;
} }

View File

@ -60,6 +60,7 @@ nodist_libmain_la_SOURCES = accum.c \
light.c \ light.c \
lines.c \ lines.c \
matrix.c \ matrix.c \
mipmap.c \
mm.c \ mm.c \
occlude.c \ occlude.c \
pixel.c \ pixel.c \

View File

@ -289,9 +289,9 @@ action() {
} }
usage() { usage() {
echo symlink.sh src-dir dst-dir echo symlink-mesa.sh src-dir dst-dir
echo src-dir: the xc directory of the monolithic source tree echo src-dir: the Mesa source directory
echo dst-dir: the modular source tree containing proto, app, lib, ... echo dst-dir: the GL subdirectory of the Xserver modular tree
} }
# Check commandline args # Check commandline args

View File

@ -26,10 +26,6 @@ if GLX
GLX_DIR=GL GLX_DIR=GL
endif endif
if XINPUT
XINPUT_DIR=Xi
endif
if DBE if DBE
DBE_DIR=dbe DBE_DIR=dbe
endif endif
@ -45,7 +41,7 @@ SUBDIRS = \
os \ os \
randr \ randr \
render \ render \
$(XINPUT_DIR) \ Xi \
xkb \ xkb \
$(DBE_DIR) \ $(DBE_DIR) \
$(MFB_DIR) \ $(MFB_DIR) \
@ -59,6 +55,7 @@ SUBDIRS = \
$(COMPOSITE_DIR) \ $(COMPOSITE_DIR) \
$(GLX_DIR) \ $(GLX_DIR) \
exa \ exa \
config \
hw hw
aclocaldir = $(datadir)/aclocal aclocaldir = $(datadir)/aclocal
@ -94,6 +91,7 @@ DIST_SUBDIRS = \
composite \ composite \
GL \ GL \
exa \ exa \
config \
hw hw
# gross hack # gross hack

View File

@ -33,6 +33,10 @@ MODULE_SRCS = \
sync.c \ sync.c \
xcmisc.c xcmisc.c
# Extra configuration files ship with some extensions
SERVERCONFIGdir = $(libdir)/xserver
SERVERCONFIG_DATA =
# Optional sources included if extension enabled by configure.ac rules # Optional sources included if extension enabled by configure.ac rules
# MIT Shared Memory extension # MIT Shared Memory extension
@ -65,13 +69,19 @@ if XINERAMA
BUILTIN_SRCS += $(XINERAMA_SRCS) BUILTIN_SRCS += $(XINERAMA_SRCS)
endif endif
# X-ACE extension: provides hooks for building security policy extensions
# like XC-Security, X-SELinux & XTSol
XACE_SRCS = xace.c xace.h xacestr.h
if XACE
BUILTIN_SRCS += $(XACE_SRCS)
endif
# Security extension: multi-level security to protect clients from each other # Security extension: multi-level security to protect clients from each other
XCSECURITY_SRCS = security.c securitysrv.h XCSECURITY_SRCS = security.c securitysrv.h
if XCSECURITY if XCSECURITY
BUILTIN_SRCS += $(XCSECURITY_SRCS) BUILTIN_SRCS += $(XCSECURITY_SRCS)
SERVERCONFIGdir = $(libdir)/xserver SERVERCONFIG_DATA += SecurityPolicy
SERVERCONFIG_DATA = SecurityPolicy
AM_CFLAGS += -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGdir)/SecurityPolicy\" AM_CFLAGS += -DDEFAULTPOLICYFILE=\"$(SERVERCONFIGdir)/SecurityPolicy\"
endif endif
@ -150,11 +160,12 @@ libXextmodule_la_SOURCES = $(MODULE_SRCS)
endif endif
EXTRA_DIST = \ EXTRA_DIST = \
SecurityPolicy \ $(SERVERCONFIG_DATA) \
$(MITSHM_SRCS) \ $(MITSHM_SRCS) \
$(XV_SRCS) \ $(XV_SRCS) \
$(RES_SRCS) \ $(RES_SRCS) \
$(SCREENSAVER_SRCS) \ $(SCREENSAVER_SRCS) \
$(XACE_SRCS) \
$(XCSECURITY_SRCS) \ $(XCSECURITY_SRCS) \
$(XCALIBRATE_SRCS) \ $(XCALIBRATE_SRCS) \
$(XINERAMA_SRCS) \ $(XINERAMA_SRCS) \

View File

@ -41,6 +41,7 @@ from The Open Group.
#include "servermd.h" #include "servermd.h"
#define _XAG_SERVER_ #define _XAG_SERVER_
#include <X11/extensions/Xagstr.h> #include <X11/extensions/Xagstr.h>
#include "xacestr.h"
#include "securitysrv.h" #include "securitysrv.h"
#include <X11/Xfuncproto.h> #include <X11/Xfuncproto.h>
@ -121,62 +122,11 @@ void XagClientStateChange(
pointer nulldata, pointer nulldata,
pointer calldata) pointer calldata)
{ {
SecurityAuthorizationPtr pAuth;
NewClientInfoRec* pci = (NewClientInfoRec*) calldata; NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr pClient = pci->client; ClientPtr pClient = pci->client;
AppGroupPtr pAppGrp; AppGroupPtr pAppGrp = pClient->appgroup;
XID authId = 0;
int slot; int slot;
if (!pClient->appgroup) {
switch (pClient->clientState) {
case ClientStateAuthenticating:
case ClientStateRunning:
case ClientStateCheckingSecurity:
return;
case ClientStateInitial:
case ClientStateCheckedSecurity:
/*
* If the client is connecting via a firewall proxy (which
* uses XC-QUERY-SECURITY-1, then the authId is available
* during ClientStateCheckedSecurity, otherwise it's
* available during ClientStateInitial.
*
* Don't get it from pClient because can't guarantee the order
* of the callbacks and the security extension might not have
* plugged it in yet.
*/
authId = AuthorizationIDOfClient(pClient);
break;
case ClientStateGone:
case ClientStateRetained:
/*
* Don't get if from AuthorizationIDOfClient because can't
* guarantee the order of the callbacks and the security
* extension may have torn down the client's private data
*/
authId = pClient->authId;
break;
}
if (authId == None)
return;
pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(pClient,
authId, SecurityAuthorizationResType, SecurityReadAccess);
if (pAuth == NULL)
return;
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
if (pAppGrp->appgroupId == pAuth->group) break;
} else {
pAppGrp = pClient->appgroup;
}
if (!pAppGrp) if (!pAppGrp)
return; return;
@ -233,6 +183,7 @@ XagExtensionInit(INITARGS)
XagResetProc, XagResetProc,
StandardMinorOpcode)) { StandardMinorOpcode)) {
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL);
} }
} }
@ -799,12 +750,33 @@ void XagGetDeltaInfo(
} }
void XagCallClientStateChange( void XagCallClientStateChange(
ClientPtr client) CallbackListPtr *pcbl,
pointer nulldata,
pointer calldata)
{ {
if (appGrpList) { XaceAuthAvailRec* rec = (XaceAuthAvailRec*) calldata;
ClientPtr pClient = rec->client;
if (!pClient->appgroup) {
SecurityAuthorizationPtr pAuth;
XID authId = rec->authId;
/* can't use SecurityLookupIDByType here -- client
* security state hasn't been setup yet.
*/
pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
SecurityAuthorizationResType);
if (!pAuth)
return;
pClient->appgroup = (AppGroupPtr)LookupIDByType(pAuth->group,
RT_APPGROUP);
}
if (pClient->appgroup) {
NewClientInfoRec clientinfo; NewClientInfoRec clientinfo;
clientinfo.client = client; clientinfo.client = pClient;
XagClientStateChange (NULL, NULL, (pointer)&clientinfo); XagClientStateChange (NULL, NULL, (pointer)&clientinfo);
} }
} }

View File

@ -51,7 +51,9 @@ extern ClientPtr XagLeader(
); );
extern void XagCallClientStateChange( extern void XagCallClientStateChange(
ClientPtr /* client */ CallbackListPtr * /* pcbl */,
pointer /* nulldata */,
pointer /* calldata */
); );
extern Bool XagIsControlledRoot ( extern Bool XagIsControlledRoot (

View File

@ -36,6 +36,7 @@ in this Software without prior written authorization from The Open Group.
#include "gcstruct.h" #include "gcstruct.h"
#include "colormapst.h" #include "colormapst.h"
#include "propertyst.h" #include "propertyst.h"
#include "xacestr.h"
#include "securitysrv.h" #include "securitysrv.h"
#include <X11/extensions/securstr.h> #include <X11/extensions/securstr.h>
#include <assert.h> #include <assert.h>
@ -58,6 +59,23 @@ in this Software without prior written authorization from The Open Group.
static int SecurityErrorBase; /* first Security error number */ static int SecurityErrorBase; /* first Security error number */
static int SecurityEventBase; /* first Security event number */ static int SecurityEventBase; /* first Security event number */
static int securityClientPrivateIndex;
static int securityExtnsnPrivateIndex;
/* this is what we store as client security state */
typedef struct {
unsigned int trustLevel;
XID authId;
} SecurityClientStateRec;
#define STATEVAL(extnsn) \
((extnsn)->devPrivates[securityExtnsnPrivateIndex].val)
#define STATEPTR(client) \
((client)->devPrivates[securityClientPrivateIndex].ptr)
#define TRUSTLEVEL(client) \
(((SecurityClientStateRec*)STATEPTR(client))->trustLevel)
#define AUTHID(client) \
(((SecurityClientStateRec*)STATEPTR(client))->authId)
CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */ CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */
@ -65,19 +83,8 @@ RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */
static RESTYPE RTEventClient; static RESTYPE RTEventClient;
/* Proc vectors for untrusted clients, swapped and unswapped versions. #define CALLBACK(name) static void \
* These are the same as the normal proc vectors except that extensions name(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
* that haven't declared themselves secure will have ProcBadRequest plugged
* in for their major opcode dispatcher. This prevents untrusted clients
* from guessing extension major opcodes and using the extension even though
* the extension can't be listed or queried.
*/
int (*UntrustedProcVector[256])(
ClientPtr /*client*/
);
int (*SwappedUntrustedProcVector[256])(
ClientPtr /*client*/
);
/* SecurityAudit /* SecurityAudit
* *
@ -91,7 +98,7 @@ int (*SwappedUntrustedProcVector[256])(
* Writes the message to the log file if security logging is on. * Writes the message to the log file if security logging is on.
*/ */
void static void
SecurityAudit(char *format, ...) SecurityAudit(char *format, ...)
{ {
va_list args; va_list args;
@ -164,7 +171,7 @@ SecurityDeleteAuthorization(
for (i = 1; i<currentMaxClients; i++) for (i = 1; i<currentMaxClients; i++)
{ {
if (clients[i] && (clients[i]->authId == pAuth->id)) if (clients[i] && (AUTHID(clients[i]) == pAuth->id))
CloseDownClient(clients[i]); CloseDownClient(clients[i]);
} }
@ -318,7 +325,7 @@ ProcSecurityQueryVersion(
/* paranoia: this "can't happen" because this extension is hidden /* paranoia: this "can't happen" because this extension is hidden
* from untrusted clients, but just in case... * from untrusted clients, but just in case...
*/ */
if (client->trustLevel != XSecurityClientTrusted) if (TRUSTLEVEL(client) != XSecurityClientTrusted)
return BadRequest; return BadRequest;
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq); REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
@ -404,7 +411,7 @@ ProcSecurityGenerateAuthorization(
/* paranoia: this "can't happen" because this extension is hidden /* paranoia: this "can't happen" because this extension is hidden
* from untrusted clients, but just in case... * from untrusted clients, but just in case...
*/ */
if (client->trustLevel != XSecurityClientTrusted) if (TRUSTLEVEL(client) != XSecurityClientTrusted)
return BadRequest; return BadRequest;
/* check request length */ /* check request length */
@ -587,7 +594,7 @@ ProcSecurityRevokeAuthorization(
/* paranoia: this "can't happen" because this extension is hidden /* paranoia: this "can't happen" because this extension is hidden
* from untrusted clients, but just in case... * from untrusted clients, but just in case...
*/ */
if (client->trustLevel != XSecurityClientTrusted) if (TRUSTLEVEL(client) != XSecurityClientTrusted)
return BadRequest; return BadRequest;
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
@ -772,12 +779,12 @@ SecurityDetermineEventPropogationLimits(
* An audit message is generated if access is denied. * An audit message is generated if access is denied.
*/ */
Bool CALLBACK(SecurityCheckDeviceAccess)
SecurityCheckDeviceAccess(client, dev, fromRequest)
ClientPtr client;
DeviceIntPtr dev;
Bool fromRequest;
{ {
XaceDeviceAccessRec *rec = (XaceDeviceAccessRec*)calldata;
ClientPtr client = rec->client;
DeviceIntPtr dev = rec->dev;
Bool fromRequest = rec->fromRequest;
WindowPtr pWin, pStopWin; WindowPtr pWin, pStopWin;
Bool untrusted_got_event; Bool untrusted_got_event;
Bool found_event_window; Bool found_event_window;
@ -785,12 +792,12 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
int reqtype = 0; int reqtype = 0;
/* trusted clients always allowed to do anything */ /* trusted clients always allowed to do anything */
if (client->trustLevel == XSecurityClientTrusted) if (TRUSTLEVEL(client) == XSecurityClientTrusted)
return TRUE; return;
/* device security other than keyboard is not implemented yet */ /* device security other than keyboard is not implemented yet */
if (dev != inputInfo.keyboard) if (dev != inputInfo.keyboard)
return TRUE; return;
/* some untrusted client wants access */ /* some untrusted client wants access */
@ -805,7 +812,8 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
case X_SetModifierMapping: case X_SetModifierMapping:
SecurityAudit("client %d attempted request %d\n", SecurityAudit("client %d attempted request %d\n",
client->index, reqtype); client->index, reqtype);
return FALSE; rec->rval = FALSE;
return;
default: default:
break; break;
} }
@ -817,7 +825,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
if (dev->grab) if (dev->grab)
{ {
untrusted_got_event = untrusted_got_event =
((rClient(dev->grab))->trustLevel != XSecurityClientTrusted); (TRUSTLEVEL(rClient(dev->grab)) != XSecurityClientTrusted);
} }
else else
{ {
@ -832,7 +840,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
{ {
found_event_window = TRUE; found_event_window = TRUE;
client = wClient(pWin); client = wClient(pWin);
if (client->trustLevel != XSecurityClientTrusted) if (TRUSTLEVEL(client) != XSecurityClientTrusted)
{ {
untrusted_got_event = TRUE; untrusted_got_event = TRUE;
} }
@ -845,7 +853,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
if (other->mask & eventmask) if (other->mask & eventmask)
{ {
client = rClient(other); client = rClient(other);
if (client->trustLevel != XSecurityClientTrusted) if (TRUSTLEVEL(client) != XSecurityClientTrusted)
{ {
untrusted_got_event = TRUE; untrusted_got_event = TRUE;
break; break;
@ -873,8 +881,9 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
else else
SecurityAudit("client %d attempted to access device %d (%s)\n", SecurityAudit("client %d attempted to access device %d (%s)\n",
client->index, dev->id, devname); client->index, dev->id, devname);
rec->rval = FALSE;
} }
return untrusted_got_event; return;
} /* SecurityCheckDeviceAccess */ } /* SecurityCheckDeviceAccess */
@ -946,20 +955,22 @@ SecurityAuditResourceIDAccess(
* Disallowed resource accesses are audited. * Disallowed resource accesses are audited.
*/ */
static pointer CALLBACK(SecurityCheckResourceIDAccess)
SecurityCheckResourceIDAccess(
ClientPtr client,
XID id,
RESTYPE rtype,
Mask access_mode,
pointer rval)
{ {
int cid = CLIENT_ID(id); XaceResourceAccessRec *rec = (XaceResourceAccessRec*)calldata;
int reqtype = ((xReq *)client->requestBuffer)->reqType; ClientPtr client = rec->client;
XID id = rec->id;
RESTYPE rtype = rec->rtype;
Mask access_mode = rec->access_mode;
pointer rval = rec->res;
int cid, reqtype;
if (SecurityUnknownAccess == access_mode) if (TRUSTLEVEL(client) == XSecurityClientTrusted ||
return rval; /* for compatibility, we have to allow access */ SecurityUnknownAccess == access_mode)
return; /* for compatibility, we have to allow access */
cid = CLIENT_ID(id);
reqtype = ((xReq *)client->requestBuffer)->reqType;
switch (reqtype) switch (reqtype)
{ /* these are always allowed */ { /* these are always allowed */
case X_QueryTree: case X_QueryTree:
@ -971,7 +982,7 @@ SecurityCheckResourceIDAccess(
case X_DeleteProperty: case X_DeleteProperty:
case X_RotateProperties: case X_RotateProperties:
case X_ListProperties: case X_ListProperties:
return rval; return;
default: default:
break; break;
} }
@ -991,15 +1002,15 @@ SecurityCheckResourceIDAccess(
* competing alternative for grouping clients for security purposes is to * competing alternative for grouping clients for security purposes is to
* use app groups. dpw * use app groups. dpw
*/ */
if (client->trustLevel == clients[cid]->trustLevel if (TRUSTLEVEL(client) == TRUSTLEVEL(clients[cid])
#ifdef XAPPGROUP #ifdef XAPPGROUP
|| (RT_COLORMAP == rtype && || (RT_COLORMAP == rtype &&
XagDefaultColormap (client) == (Colormap) id) XagDefaultColormap (client) == (Colormap) id)
#endif #endif
) )
return rval; return;
else else
return SecurityAuditResourceIDAccess(client, id); goto deny;
} }
else /* server-owned resource - probably a default colormap or root window */ else /* server-owned resource - probably a default colormap or root window */
{ {
@ -1035,7 +1046,7 @@ SecurityCheckResourceIDAccess(
) )
) )
{ /* not an ICCCM event */ { /* not an ICCCM event */
return SecurityAuditResourceIDAccess(client, id); goto deny;
} }
break; break;
} /* case X_SendEvent on root */ } /* case X_SendEvent on root */
@ -1053,28 +1064,31 @@ SecurityCheckResourceIDAccess(
~(PropertyChangeMask|StructureNotifyMask)) == 0) ~(PropertyChangeMask|StructureNotifyMask)) == 0)
break; break;
} }
return SecurityAuditResourceIDAccess(client, id); goto deny;
} /* case X_ChangeWindowAttributes on root */ } /* case X_ChangeWindowAttributes on root */
default: default:
{ {
/* others not allowed */ /* others not allowed */
return SecurityAuditResourceIDAccess(client, id); goto deny;
} }
} }
} /* end server-owned window or drawable */ } /* end server-owned window or drawable */
else if (SecurityAuthorizationResType == rtype) else if (SecurityAuthorizationResType == rtype)
{ {
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval; SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr)rval;
if (pAuth->trustLevel != client->trustLevel) if (pAuth->trustLevel != TRUSTLEVEL(client))
return SecurityAuditResourceIDAccess(client, id); goto deny;
} }
else if (RT_COLORMAP != rtype) else if (RT_COLORMAP != rtype)
{ /* don't allow anything else besides colormaps */ { /* don't allow anything else besides colormaps */
return SecurityAuditResourceIDAccess(client, id); goto deny;
} }
} }
return rval; return;
deny:
SecurityAuditResourceIDAccess(client, id);
rec->rval = FALSE; /* deny access */
} /* SecurityCheckResourceIDAccess */ } /* SecurityCheckResourceIDAccess */
@ -1093,30 +1107,32 @@ SecurityCheckResourceIDAccess(
* If a new client is connecting, its authorization ID is copied to * If a new client is connecting, its authorization ID is copied to
* client->authID. If this is a generated authorization, its reference * client->authID. If this is a generated authorization, its reference
* count is bumped, its timer is cancelled if it was running, and its * count is bumped, its timer is cancelled if it was running, and its
* trustlevel is copied to client->trustLevel. * trustlevel is copied to TRUSTLEVEL(client).
* *
* If a client is disconnecting and the client was using a generated * If a client is disconnecting and the client was using a generated
* authorization, the authorization's reference count is decremented, and * authorization, the authorization's reference count is decremented, and
* if it is now zero, the timer for this authorization is started. * if it is now zero, the timer for this authorization is started.
*/ */
static void CALLBACK(SecurityClientStateCallback)
SecurityClientStateCallback(
CallbackListPtr *pcbl,
pointer nulldata,
pointer calldata)
{ {
NewClientInfoRec *pci = (NewClientInfoRec *)calldata; NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
ClientPtr client = pci->client; ClientPtr client = pci->client;
switch (client->clientState) switch (client->clientState)
{ {
case ClientStateInitial:
TRUSTLEVEL(client) = XSecurityClientTrusted;
AUTHID(client) = None;
break;
case ClientStateRunning: case ClientStateRunning:
{ {
XID authId = AuthorizationIDOfClient(client); XID authId = AuthorizationIDOfClient(client);
SecurityAuthorizationPtr pAuth; SecurityAuthorizationPtr pAuth;
client->authId = authId; TRUSTLEVEL(client) = XSecurityClientTrusted;
AUTHID(client) = authId;
pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId,
SecurityAuthorizationResType); SecurityAuthorizationResType);
if (pAuth) if (pAuth)
@ -1126,23 +1142,20 @@ SecurityClientStateCallback(
{ {
if (pAuth->timer) TimerCancel(pAuth->timer); if (pAuth->timer) TimerCancel(pAuth->timer);
} }
client->trustLevel = pAuth->trustLevel; TRUSTLEVEL(client) = pAuth->trustLevel;
if (client->trustLevel != XSecurityClientTrusted)
{
client->CheckAccess = SecurityCheckResourceIDAccess;
client->requestVector = client->swapped ?
SwappedUntrustedProcVector : UntrustedProcVector;
}
} }
break; break;
} }
case ClientStateGone: case ClientStateGone:
case ClientStateRetained: /* client disconnected */ case ClientStateRetained: /* client disconnected */
{ {
XID authId = client->authId;
SecurityAuthorizationPtr pAuth; SecurityAuthorizationPtr pAuth;
pAuth = (SecurityAuthorizationPtr)LookupIDByType(authId, /* client may not have any state (bad authorization) */
if (!STATEPTR(client))
break;
pAuth = (SecurityAuthorizationPtr)LookupIDByType(AUTHID(client),
SecurityAuthorizationResType); SecurityAuthorizationResType);
if (pAuth) if (pAuth)
{ /* it is a generated authorization */ { /* it is a generated authorization */
@ -1158,124 +1171,68 @@ SecurityClientStateCallback(
} }
} /* SecurityClientStateCallback */ } /* SecurityClientStateCallback */
/* SecurityCensorImage CALLBACK(SecurityCheckDrawableAccess)
*
* Called after pScreen->GetImage to prevent pieces or trusted windows from
* being returned in image data from an untrusted window.
*
* Arguments:
* client is the client doing the GetImage.
* pVisibleRegion is the visible region of the window.
* widthBytesLine is the width in bytes of one horizontal line in pBuf.
* pDraw is the source window.
* x, y, w, h is the rectangle of image data from pDraw in pBuf.
* format is the format of the image data in pBuf: ZPixmap or XYPixmap.
* pBuf is the image data.
*
* Returns: nothing.
*
* Side Effects:
* Any part of the rectangle (x, y, w, h) that is outside the visible
* region of the window will be destroyed (overwritten) in pBuf.
*/
void
SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
format, pBuf)
ClientPtr client;
RegionPtr pVisibleRegion;
long widthBytesLine;
DrawablePtr pDraw;
int x, y, w, h;
unsigned int format;
char * pBuf;
{ {
RegionRec imageRegion; /* region representing x,y,w,h */ XaceDrawableAccessRec *rec = (XaceDrawableAccessRec*)calldata;
RegionRec censorRegion; /* region to obliterate */
BoxRec imageBox;
int nRects;
imageBox.x1 = x; if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted)
imageBox.y1 = y; rec->rval = FALSE;
imageBox.x2 = x + w; }
imageBox.y2 = y + h;
REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
REGION_NULL(pScreen, &censorRegion);
/* censorRegion = imageRegion - visibleRegion */ CALLBACK(SecurityCheckMapAccess)
REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion); {
nRects = REGION_NUM_RECTS(&censorRegion); XaceMapAccessRec *rec = (XaceMapAccessRec*)calldata;
if (nRects > 0) WindowPtr pWin = rec->pWin;
{ /* we have something to censor */
GCPtr pScratchGC = NULL;
PixmapPtr pPix = NULL;
xRectangle *pRects = NULL;
Bool failed = FALSE;
int depth = 1;
int bitsPerPixel = 1;
int i;
BoxPtr pBox;
/* convert region to list-of-rectangles for PolyFillRect */ if (STATEPTR(rec->client) &&
(TRUSTLEVEL(rec->client) != XSecurityClientTrusted) &&
(pWin->drawable.class == InputOnly) &&
(TRUSTLEVEL(wClient(pWin->parent)) == XSecurityClientTrusted))
pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *)); rec->rval = FALSE;
if (!pRects) }
CALLBACK(SecurityCheckBackgrndAccess)
{
XaceMapAccessRec *rec = (XaceMapAccessRec*)calldata;
if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted)
rec->rval = FALSE;
}
CALLBACK(SecurityCheckExtAccess)
{
XaceExtAccessRec *rec = (XaceExtAccessRec*)calldata;
if ((TRUSTLEVEL(rec->client) != XSecurityClientTrusted) &&
!STATEVAL(rec->ext))
rec->rval = FALSE;
}
CALLBACK(SecurityCheckHostlistAccess)
{
XaceHostlistAccessRec *rec = (XaceHostlistAccessRec*)calldata;
if (TRUSTLEVEL(rec->client) != XSecurityClientTrusted)
{ {
failed = TRUE; rec->rval = FALSE;
goto failSafe; if (rec->access_mode == SecurityWriteAccess)
} SecurityAudit("client %d attempted to change host access\n",
for (pBox = REGION_RECTS(&censorRegion), i = 0; rec->client->index);
i < nRects; else
i++, pBox++) SecurityAudit("client %d attempted to list hosts\n",
{ rec->client->index);
pRects[i].x = pBox->x1;
pRects[i].y = pBox->y1 - imageBox.y1;
pRects[i].width = pBox->x2 - pBox->x1;
pRects[i].height = pBox->y2 - pBox->y1;
} }
}
/* use pBuf as a fake pixmap */ CALLBACK(SecurityDeclareExtSecure)
{
XaceDeclareExtSecureRec *rec = (XaceDeclareExtSecureRec*)calldata;
if (format == ZPixmap) /* security state for extensions is simply a boolean trust value */
{ STATEVAL(rec->ext) = rec->secure;
depth = pDraw->depth; }
bitsPerPixel = pDraw->bitsPerPixel;
}
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
depth, bitsPerPixel,
widthBytesLine, (pointer)pBuf);
if (!pPix)
{
failed = TRUE;
goto failSafe;
}
pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
if (!pScratchGC)
{
failed = TRUE;
goto failSafe;
}
ValidateGC(&pPix->drawable, pScratchGC);
(* pScratchGC->ops->PolyFillRect)(&pPix->drawable,
pScratchGC, nRects, pRects);
failSafe:
if (failed)
{
/* Censoring was not completed above. To be safe, wipe out
* all the image data so that nothing trusted gets out.
*/
bzero(pBuf, (int)(widthBytesLine * h));
}
if (pRects) DEALLOCATE_LOCAL(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix);
}
REGION_UNINIT(pScreen, &imageRegion);
REGION_UNINIT(pScreen, &censorRegion);
} /* SecurityCensorImage */
/**********************************************************************/ /**********************************************************************/
@ -1734,21 +1691,21 @@ SecurityMatchString(
#endif #endif
char CALLBACK(SecurityCheckPropertyAccess)
SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode)
ClientPtr client;
WindowPtr pWin;
ATOM propertyName;
Mask access_mode;
{ {
XacePropertyAccessRec *rec = (XacePropertyAccessRec*)calldata;
ClientPtr client = rec->client;
WindowPtr pWin = rec->pWin;
ATOM propertyName = rec->propertyName;
Mask access_mode = rec->access_mode;
PropertyAccessPtr pacl; PropertyAccessPtr pacl;
char action = SecurityDefaultAction; char action = SecurityDefaultAction;
/* if client trusted or window untrusted, allow operation */ /* if client trusted or window untrusted, allow operation */
if ( (client->trustLevel == XSecurityClientTrusted) || if ( (TRUSTLEVEL(client) == XSecurityClientTrusted) ||
(wClient(pWin)->trustLevel != XSecurityClientTrusted) ) (TRUSTLEVEL(wClient(pWin)) != XSecurityClientTrusted) )
return SecurityAllowOperation; return;
#ifdef PROPDEBUG #ifdef PROPDEBUG
/* For testing, it's more convenient if the property rules file gets /* For testing, it's more convenient if the property rules file gets
@ -1861,7 +1818,9 @@ SecurityCheckPropertyAccess(client, pWin, propertyName, access_mode)
client->index, reqtype, pWin->drawable.id, client->index, reqtype, pWin->drawable.id,
NameForAtom(propertyName), propertyName, cid, actionstr); NameForAtom(propertyName), propertyName, cid, actionstr);
} }
return action; /* return codes increase with strictness */
if (action > rec->rval)
rec->rval = action;
} /* SecurityCheckPropertyAccess */ } /* SecurityCheckPropertyAccess */
@ -1901,6 +1860,46 @@ XSecurityOptions(argc, argv, i)
} /* XSecurityOptions */ } /* XSecurityOptions */
/* SecurityExtensionSetup
*
* Arguments: none.
*
* Returns: nothing.
*
* Side Effects:
* Sets up the Security extension if possible.
* This function contains things that need to be done
* before any other extension init functions get called.
*/
void
SecurityExtensionSetup(INITARGS)
{
/* Allocate the client private index */
securityClientPrivateIndex = AllocateClientPrivateIndex();
if (!AllocateClientPrivate(securityClientPrivateIndex,
sizeof (SecurityClientStateRec)))
FatalError("SecurityExtensionSetup: Can't allocate client private.\n");
/* Allocate the extension private index */
securityExtnsnPrivateIndex = AllocateExtensionPrivateIndex();
if (!AllocateExtensionPrivate(securityExtnsnPrivateIndex, 0))
FatalError("SecurityExtensionSetup: Can't allocate extnsn private.\n");
/* register callbacks */
#define XaceRC XaceRegisterCallback
XaceRC(XACE_RESOURCE_ACCESS, SecurityCheckResourceIDAccess, NULL);
XaceRC(XACE_DEVICE_ACCESS, SecurityCheckDeviceAccess, NULL);
XaceRC(XACE_PROPERTY_ACCESS, SecurityCheckPropertyAccess, NULL);
XaceRC(XACE_DRAWABLE_ACCESS, SecurityCheckDrawableAccess, NULL);
XaceRC(XACE_MAP_ACCESS, SecurityCheckMapAccess, NULL);
XaceRC(XACE_BACKGRND_ACCESS, SecurityCheckBackgrndAccess, NULL);
XaceRC(XACE_EXT_DISPATCH, SecurityCheckExtAccess, NULL);
XaceRC(XACE_EXT_ACCESS, SecurityCheckExtAccess, NULL);
XaceRC(XACE_HOSTLIST_ACCESS, SecurityCheckHostlistAccess, NULL);
XaceRC(XACE_DECLARE_EXT_SECURE, SecurityDeclareExtSecure, NULL);
} /* SecurityExtensionSetup */
/* SecurityExtensionInit /* SecurityExtensionInit
* *
@ -1916,7 +1915,6 @@ void
SecurityExtensionInit(INITARGS) SecurityExtensionInit(INITARGS)
{ {
ExtensionEntry *extEntry; ExtensionEntry *extEntry;
int i;
SecurityAuthorizationResType = SecurityAuthorizationResType =
CreateNewResourceType(SecurityDeleteAuthorization); CreateNewResourceType(SecurityDeleteAuthorization);
@ -1943,25 +1941,6 @@ SecurityExtensionInit(INITARGS)
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
(EventSwapPtr)SwapSecurityAuthorizationRevokedEvent; (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
/* initialize untrusted proc vectors */
for (i = 0; i < 128; i++)
{
UntrustedProcVector[i] = ProcVector[i];
SwappedUntrustedProcVector[i] = SwappedProcVector[i];
}
/* make sure insecure extensions are not allowed */
for (i = 128; i < 256; i++)
{
if (!UntrustedProcVector[i])
{
UntrustedProcVector[i] = ProcBadRequest;
SwappedUntrustedProcVector[i] = ProcBadRequest;
}
}
SecurityLoadPropertyAccessList(); SecurityLoadPropertyAccessList();
} /* SecurityExtensionInit */ } /* SecurityExtensionInit */

View File

@ -86,46 +86,11 @@ typedef struct {
Bool valid; /* did anyone recognize it? if so, set to TRUE */ Bool valid; /* did anyone recognize it? if so, set to TRUE */
} SecurityValidateGroupInfoRec; } SecurityValidateGroupInfoRec;
/* Proc vectors for untrusted clients, swapped and unswapped versions.
* These are the same as the normal proc vectors except that extensions
* that haven't declared themselves secure will have ProcBadRequest plugged
* in for their major opcode dispatcher. This prevents untrusted clients
* from guessing extension major opcodes and using the extension even though
* the extension can't be listed or queried.
*/
extern int (*UntrustedProcVector[256])(ClientPtr client);
extern int (*SwappedUntrustedProcVector[256])(ClientPtr client);
extern Bool SecurityCheckDeviceAccess(ClientPtr client, DeviceIntPtr dev,
Bool fromRequest);
extern void SecurityAudit(char *format, ...);
extern int XSecurityOptions(int argc, char **argv, int i); extern int XSecurityOptions(int argc, char **argv, int i);
/* Give this value or higher to the -audit option to get security messages */ /* Give this value or higher to the -audit option to get security messages */
#define SECURITY_AUDIT_LEVEL 4 #define SECURITY_AUDIT_LEVEL 4
extern void SecurityCensorImage(
ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h,
unsigned int format,
char * pBuf);
#define SecurityAllowOperation 0
#define SecurityIgnoreOperation 1
#define SecurityErrorOperation 2
extern char
SecurityCheckPropertyAccess(
ClientPtr client,
WindowPtr pWin,
ATOM propertyName,
Mask access_mode);
#define SECURITY_POLICY_FILE_VERSION "version-1" #define SECURITY_POLICY_FILE_VERSION "version-1"
extern char **SecurityGetSitePolicyStrings(int *n); extern char **SecurityGetSitePolicyStrings(int *n);

498
Xext/xace.c Normal file
View File

@ -0,0 +1,498 @@
/************************************************************
Author: Eamon Walsh <ewalsh@epoch.ncsc.mil>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
this permission notice appear in supporting documentation. This permission
notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
********************************************************/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdarg.h>
#include "windowstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
#include "xacestr.h"
#include "modinit.h"
CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
/* Proc vectors for untrusted clients, swapped and unswapped versions.
* These are the same as the normal proc vectors except that extensions
* that haven't declared themselves secure will have ProcBadRequest plugged
* in for their major opcode dispatcher. This prevents untrusted clients
* from guessing extension major opcodes and using the extension even though
* the extension can't be listed or queried.
*/
int (*UntrustedProcVector[256])(
ClientPtr /*client*/
);
int (*SwappedUntrustedProcVector[256])(
ClientPtr /*client*/
);
/* Entry point for hook functions. Called by Xserver.
*/
int XaceHook(int hook, ...)
{
pointer calldata; /* data passed to callback */
int *prv = NULL; /* points to return value from callback */
va_list ap; /* argument list */
va_start(ap, hook);
/* Marshal arguments for passing to callback.
* Each callback has its own case, which sets up a structure to hold
* the arguments and integer return parameter, or in some cases just
* sets calldata directly to a single argument (with no return result)
*/
switch (hook)
{
case XACE_CORE_DISPATCH: {
XaceCoreDispatchRec rec = {
va_arg(ap, ClientPtr),
TRUE /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_RESOURCE_ACCESS: {
XaceResourceAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, XID),
va_arg(ap, RESTYPE),
va_arg(ap, Mask),
va_arg(ap, pointer),
TRUE /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_DEVICE_ACCESS: {
XaceDeviceAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, DeviceIntPtr),
va_arg(ap, Bool),
TRUE /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_PROPERTY_ACCESS: {
XacePropertyAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, WindowPtr),
va_arg(ap, Atom),
va_arg(ap, Mask),
SecurityAllowOperation /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_DRAWABLE_ACCESS: {
XaceDrawableAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, DrawablePtr),
TRUE /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_MAP_ACCESS:
case XACE_BACKGRND_ACCESS: {
XaceMapAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, WindowPtr),
TRUE /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_EXT_DISPATCH:
case XACE_EXT_ACCESS: {
XaceExtAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, ExtensionEntry*),
TRUE /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_HOSTLIST_ACCESS: {
XaceHostlistAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, Mask),
TRUE /* default allow */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_SITE_POLICY: {
XaceSitePolicyRec rec = {
va_arg(ap, char*),
va_arg(ap, int),
FALSE /* default unrecognized */
};
calldata = &rec;
prv = &rec.rval;
break;
}
case XACE_DECLARE_EXT_SECURE: {
XaceDeclareExtSecureRec rec = {
va_arg(ap, ExtensionEntry*),
va_arg(ap, Bool)
};
calldata = &rec;
break;
}
case XACE_AUTH_AVAIL: {
XaceAuthAvailRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, XID)
};
calldata = &rec;
break;
}
case XACE_KEY_AVAIL: {
XaceKeyAvailRec rec = {
va_arg(ap, xEventPtr),
va_arg(ap, DeviceIntPtr),
va_arg(ap, int)
};
calldata = &rec;
break;
}
case XACE_WINDOW_INIT: {
XaceWindowRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, WindowPtr)
};
calldata = &rec;
break;
}
case XACE_AUDIT_BEGIN: {
XaceAuditRec rec = {
va_arg(ap, ClientPtr),
0
};
calldata = &rec;
break;
}
case XACE_AUDIT_END: {
XaceAuditRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, int)
};
calldata = &rec;
break;
}
default: {
va_end(ap);
return 0; /* unimplemented hook number */
}
}
va_end(ap);
/* call callbacks and return result, if any. */
CallCallbacks(&XaceHooks[hook], calldata);
return prv ? *prv : 0;
}
static int
ProcXaceDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
default:
return BadRequest;
}
} /* ProcXaceDispatch */
static int
SProcXaceDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
default:
return BadRequest;
}
} /* SProcXaceDispatch */
/* XaceResetProc
*
* Arguments:
* extEntry is the extension information for the XACE extension.
*
* Returns: nothing.
*
* Side Effects:
* Performs any cleanup needed by XACE at server shutdown time.
*/
static void
XaceResetProc(ExtensionEntry *extEntry)
{
int i;
for (i=0; i<XACE_NUM_HOOKS; i++)
{
DeleteCallbackList(&XaceHooks[i]);
XaceHooks[i] = NULL;
}
} /* XaceResetProc */
static int
XaceCatchDispatchProc(ClientPtr client)
{
REQUEST(xReq);
int major = stuff->reqType;
if (!ProcVector[major])
return (BadRequest);
if (!XaceHook(XACE_CORE_DISPATCH, client))
return (BadAccess);
return client->swapped ?
(* SwappedProcVector[major])(client) :
(* ProcVector[major])(client);
}
static int
XaceCatchExtProc(ClientPtr client)
{
REQUEST(xReq);
int major = stuff->reqType;
ExtensionEntry *ext = GetExtensionEntry(major);
if (!ext || !ProcVector[major])
return (BadRequest);
if (!XaceHook(XACE_EXT_DISPATCH, client, ext))
return (BadRequest); /* pretend extension doesn't exist */
return client->swapped ?
(* SwappedProcVector[major])(client) :
(* ProcVector[major])(client);
}
/* SecurityClientStateCallback
*
* Arguments:
* pcbl is &ClientStateCallback.
* nullata is NULL.
* calldata is a pointer to a NewClientInfoRec (include/dixstruct.h)
* which contains information about client state changes.
*
* Returns: nothing.
*
* Side Effects:
*
* If a new client is connecting, its authorization ID is copied to
* client->authID. If this is a generated authorization, its reference
* count is bumped, its timer is cancelled if it was running, and its
* trustlevel is copied to TRUSTLEVEL(client).
*
* If a client is disconnecting and the client was using a generated
* authorization, the authorization's reference count is decremented, and
* if it is now zero, the timer for this authorization is started.
*/
static void
XaceClientStateCallback(
CallbackListPtr *pcbl,
pointer nulldata,
pointer calldata)
{
NewClientInfoRec *pci = (NewClientInfoRec *)calldata;
ClientPtr client = pci->client;
switch (client->clientState)
{
case ClientStateRunning:
{
client->requestVector = client->swapped ?
SwappedUntrustedProcVector : UntrustedProcVector;
break;
}
default: break;
}
} /* XaceClientStateCallback */
/* XaceExtensionInit
*
* Initialize the XACE Extension
*/
void XaceExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
int i;
if (!AddCallback(&ClientStateCallback, XaceClientStateCallback, NULL))
return;
extEntry = AddExtension(XACE_EXTENSION_NAME,
XaceNumberEvents, XaceNumberErrors,
ProcXaceDispatch, SProcXaceDispatch,
XaceResetProc, StandardMinorOpcode);
/* initialize dispatching intercept functions */
for (i = 0; i < 128; i++)
{
UntrustedProcVector[i] = XaceCatchDispatchProc;
SwappedUntrustedProcVector[i] = XaceCatchDispatchProc;
}
for (i = 128; i < 256; i++)
{
UntrustedProcVector[i] = XaceCatchExtProc;
SwappedUntrustedProcVector[i] = XaceCatchExtProc;
}
}
/* XaceCensorImage
*
* Called after pScreen->GetImage to prevent pieces or trusted windows from
* being returned in image data from an untrusted window.
*
* Arguments:
* client is the client doing the GetImage.
* pVisibleRegion is the visible region of the window.
* widthBytesLine is the width in bytes of one horizontal line in pBuf.
* pDraw is the source window.
* x, y, w, h is the rectangle of image data from pDraw in pBuf.
* format is the format of the image data in pBuf: ZPixmap or XYPixmap.
* pBuf is the image data.
*
* Returns: nothing.
*
* Side Effects:
* Any part of the rectangle (x, y, w, h) that is outside the visible
* region of the window will be destroyed (overwritten) in pBuf.
*/
void
XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
format, pBuf)
ClientPtr client;
RegionPtr pVisibleRegion;
long widthBytesLine;
DrawablePtr pDraw;
int x, y, w, h;
unsigned int format;
char * pBuf;
{
ScreenPtr pScreen;
RegionRec imageRegion; /* region representing x,y,w,h */
RegionRec censorRegion; /* region to obliterate */
BoxRec imageBox;
int nRects;
pScreen = pDraw->pScreen;
imageBox.x1 = x;
imageBox.y1 = y;
imageBox.x2 = x + w;
imageBox.y2 = y + h;
REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
REGION_NULL(pScreen, &censorRegion);
/* censorRegion = imageRegion - visibleRegion */
REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion);
nRects = REGION_NUM_RECTS(&censorRegion);
if (nRects > 0)
{ /* we have something to censor */
GCPtr pScratchGC = NULL;
PixmapPtr pPix = NULL;
xRectangle *pRects = NULL;
Bool failed = FALSE;
int depth = 1;
int bitsPerPixel = 1;
int i;
BoxPtr pBox;
/* convert region to list-of-rectangles for PolyFillRect */
pRects = (xRectangle *)ALLOCATE_LOCAL(nRects * sizeof(xRectangle *));
if (!pRects)
{
failed = TRUE;
goto failSafe;
}
for (pBox = REGION_RECTS(&censorRegion), i = 0;
i < nRects;
i++, pBox++)
{
pRects[i].x = pBox->x1;
pRects[i].y = pBox->y1 - imageBox.y1;
pRects[i].width = pBox->x2 - pBox->x1;
pRects[i].height = pBox->y2 - pBox->y1;
}
/* use pBuf as a fake pixmap */
if (format == ZPixmap)
{
depth = pDraw->depth;
bitsPerPixel = pDraw->bitsPerPixel;
}
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
depth, bitsPerPixel,
widthBytesLine, (pointer)pBuf);
if (!pPix)
{
failed = TRUE;
goto failSafe;
}
pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
if (!pScratchGC)
{
failed = TRUE;
goto failSafe;
}
ValidateGC(&pPix->drawable, pScratchGC);
(* pScratchGC->ops->PolyFillRect)(&pPix->drawable,
pScratchGC, nRects, pRects);
failSafe:
if (failed)
{
/* Censoring was not completed above. To be safe, wipe out
* all the image data so that nothing trusted gets out.
*/
bzero(pBuf, (int)(widthBytesLine * h));
}
if (pRects) DEALLOCATE_LOCAL(pRects);
if (pScratchGC) FreeScratchGC(pScratchGC);
if (pPix) FreeScratchPixmapHeader(pPix);
}
REGION_UNINIT(pScreen, &imageRegion);
REGION_UNINIT(pScreen, &censorRegion);
} /* XaceCensorImage */

103
Xext/xace.h Normal file
View File

@ -0,0 +1,103 @@
/************************************************************
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 _XACE_H
#define _XACE_H
#define XACE_EXTENSION_NAME "XAccessControlExtension"
#define XACE_MAJOR_VERSION 1
#define XACE_MINOR_VERSION 0
#include "pixmap.h" /* for DrawablePtr */
#include "regionstr.h" /* for RegionPtr */
#define XaceNumberEvents 0
#define XaceNumberErrors 0
/* security hooks */
/* Constants used to identify the available security hooks
*/
#define XACE_CORE_DISPATCH 0
#define XACE_EXT_DISPATCH 1
#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_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_AUDIT_BEGIN 15
#define XACE_AUDIT_END 16
#define XACE_NUM_HOOKS 17
extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
/* Entry point for hook functions. Called by Xserver.
*/
extern int XaceHook(
int /*hook*/,
... /*appropriate args for hook*/
);
/* Register a callback for a given hook.
*/
#define XaceRegisterCallback(hook,callback,data) \
AddCallback(XaceHooks+(hook), callback, data)
/* Unregister an existing callback for a given hook.
*/
#define XaceDeleteCallback(hook,callback,data) \
DeleteCallback(XaceHooks+(hook), callback, data)
/* From the original Security extension...
*/
/* Hook return codes */
#define SecurityAllowOperation 0
#define SecurityIgnoreOperation 1
#define SecurityErrorOperation 2
/* Proc vectors for untrusted clients, swapped and unswapped versions.
* These are the same as the normal proc vectors except that extensions
* that haven't declared themselves secure will have ProcBadRequest plugged
* in for their major opcode dispatcher. This prevents untrusted clients
* from guessing extension major opcodes and using the extension even though
* the extension can't be listed or queried.
*/
extern int (*UntrustedProcVector[256])(ClientPtr client);
extern int (*SwappedUntrustedProcVector[256])(ClientPtr client);
extern void XaceCensorImage(
ClientPtr client,
RegionPtr pVisibleRegion,
long widthBytesLine,
DrawablePtr pDraw,
int x, int y, int w, int h,
unsigned int format,
char * pBuf
);
#endif /* _XACE_H */

135
Xext/xacestr.h Normal file
View File

@ -0,0 +1,135 @@
/************************************************************
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 _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 "xace.h"
/* XACE_CORE_DISPATCH */
typedef struct {
ClientPtr client;
int rval;
} XaceCoreDispatchRec;
/* XACE_RESOURCE_ACCESS */
/* XACE_RESOURCE_CREATE */
typedef struct {
ClientPtr client;
XID id;
RESTYPE rtype;
Mask access_mode;
pointer res;
int rval;
} XaceResourceAccessRec;
/* XACE_DEVICE_ACCESS */
typedef struct {
ClientPtr client;
DeviceIntPtr dev;
Bool fromRequest;
int rval;
} XaceDeviceAccessRec;
/* XACE_PROPERTY_ACCESS */
typedef struct {
ClientPtr client;
WindowPtr pWin;
Atom propertyName;
Mask access_mode;
int rval;
} XacePropertyAccessRec;
/* XACE_DRAWABLE_ACCESS */
typedef struct {
ClientPtr client;
DrawablePtr pDraw;
int rval;
} XaceDrawableAccessRec;
/* XACE_MAP_ACCESS */
/* XACE_BACKGRND_ACCESS */
typedef struct {
ClientPtr client;
WindowPtr pWin;
int rval;
} XaceMapAccessRec;
/* XACE_EXT_DISPATCH_ACCESS */
/* XACE_EXT_ACCESS */
typedef struct {
ClientPtr client;
ExtensionEntry *ext;
int rval;
} XaceExtAccessRec;
/* XACE_HOSTLIST_ACCESS */
typedef struct {
ClientPtr client;
Mask access_mode;
int rval;
} XaceHostlistAccessRec;
/* XACE_SITE_POLICY */
typedef struct {
char *policyString;
int len;
int rval;
} XaceSitePolicyRec;
/* XACE_DECLARE_EXT_SECURE */
typedef struct {
ExtensionEntry *ext;
Bool secure;
} XaceDeclareExtSecureRec;
/* XACE_AUTH_AVAIL */
typedef struct {
ClientPtr client;
XID authId;
} XaceAuthAvailRec;
/* XACE_KEY_AVAIL */
typedef struct {
xEventPtr event;
DeviceIntPtr keybd;
int count;
} XaceKeyAvailRec;
/* XACE_WINDOW_INIT */
typedef struct {
ClientPtr client;
WindowPtr pWin;
} XaceWindowRec;
/* XACE_AUDIT_BEGIN */
/* XACE_AUDIT_END */
typedef struct {
ClientPtr client;
int requestResult;
} XaceAuditRec;
#endif /* _XACESTR_H */

View File

@ -66,6 +66,7 @@ SOFTWARE.
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */ #include "extinit.h" /* LookupDeviceIntRec */
#include "exglobals.h" #include "exglobals.h"
#include "exevents.h"
#include "chgdctl.h" #include "chgdctl.h"
@ -98,12 +99,17 @@ int
ProcXChangeDeviceControl(ClientPtr client) ProcXChangeDeviceControl(ClientPtr client)
{ {
unsigned len; unsigned len;
int i, status; int i, status, ret = BadValue;
DeviceIntPtr dev; DeviceIntPtr dev;
xDeviceResolutionCtl *r; xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep; xChangeDeviceControlReply rep;
AxisInfoPtr a; AxisInfoPtr a;
CARD32 *resolution; CARD32 *resolution;
xDeviceAbsCalibCtl *calib;
xDeviceAbsAreaCtl *area;
xDeviceCoreCtl *c;
xDeviceEnableCtl *e;
devicePresenceNotify dpn;
REQUEST(xChangeDeviceControlReq); REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@ -111,9 +117,8 @@ ProcXChangeDeviceControl(ClientPtr client)
len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2); len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2);
dev = LookupDeviceIntRec(stuff->deviceid); dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) { if (dev == NULL) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret = BadDevice;
BadDevice); goto out;
return Success;
} }
rep.repType = X_Reply; rep.repType = X_Reply;
@ -126,25 +131,22 @@ ProcXChangeDeviceControl(ClientPtr client)
r = (xDeviceResolutionCtl *) & stuff[1]; r = (xDeviceResolutionCtl *) & stuff[1];
if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) || if ((len < (sizeof(xDeviceResolutionCtl) >> 2)) ||
(len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) { (len != (sizeof(xDeviceResolutionCtl) >> 2) + r->num_valuators)) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, ret = BadLength;
0, BadLength); goto out;
return Success;
} }
if (!dev->valuator) { if (!dev->valuator) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret = BadMatch;
BadMatch); goto out;
return Success;
} }
if ((dev->grab) && !SameClient(dev->grab, client)) { if ((dev->grab) && !SameClient(dev->grab, client)) {
rep.status = AlreadyGrabbed; rep.status = AlreadyGrabbed;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); ret = Success;
return Success; goto out;
} }
resolution = (CARD32 *) (r + 1); resolution = (CARD32 *) (r + 1);
if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) { if (r->first_valuator + r->num_valuators > dev->valuator->numAxes) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret = BadValue;
BadValue); goto out;
return Success;
} }
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r); status = ChangeDeviceControl(client, dev, (xDeviceCtl *) r);
if (status == Success) { if (status == Success) {
@ -158,21 +160,119 @@ ProcXChangeDeviceControl(ClientPtr client)
} }
for (i = 0; i < r->num_valuators; i++) for (i = 0; i < r->num_valuators; i++)
(a++)->resolution = *resolution++; (a++)->resolution = *resolution++;
ret = Success;
} else if (status == DeviceBusy) { } else if (status == DeviceBusy) {
rep.status = DeviceBusy; rep.status = DeviceBusy;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); ret = Success;
return Success;
} else { } else {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret = BadMatch;
BadMatch);
return Success;
} }
break; break;
default: case DEVICE_ABS_CALIB:
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); calib = (xDeviceAbsCalibCtl *)&stuff[1];
return Success;
if (calib->button_threshold < 0 || calib->button_threshold > 255) {
ret = BadValue;
goto out;
} }
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) calib);
if (status == Success) {
dev->absolute->min_x = calib->min_x;
dev->absolute->max_x = calib->max_x;
dev->absolute->min_y = calib->min_y;
dev->absolute->max_y = calib->max_y;
dev->absolute->flip_x = calib->flip_x;
dev->absolute->flip_y = calib->flip_y;
dev->absolute->rotation = calib->rotation;
dev->absolute->button_threshold = calib->button_threshold;
ret = Success;
} else if (status == DeviceBusy || status == BadValue) {
rep.status = status;
ret = Success;
} else {
ret = BadMatch;
}
break;
case DEVICE_ABS_AREA:
area = (xDeviceAbsAreaCtl *)&stuff[1];
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) area);
if (status == Success) {
dev->absolute->offset_x = area->offset_x;
dev->absolute->offset_y = area->offset_y;
dev->absolute->width = area->width;
dev->absolute->height = area->height;
dev->absolute->screen = area->screen;
dev->absolute->following = area->following;
ret = Success;
} else if (status == DeviceBusy || status == BadValue) {
rep.status = status;
ret = Success;
} else {
ret = Success;
}
break;
case DEVICE_CORE:
c = (xDeviceCoreCtl *)&stuff[1];
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) c);
if (status == Success) {
dev->coreEvents = c->status;
ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
ret = Success;
} else {
ret = BadMatch;
}
break;
case DEVICE_ENABLE:
e = (xDeviceEnableCtl *)&stuff[1];
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
if (status == Success) {
if (e->enable)
EnableDevice(dev);
else
DisableDevice(dev);
ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
ret = Success;
} else {
ret = BadMatch;
}
break;
default:
ret = BadValue;
}
out:
if (ret == Success) {
dpn.type = DevicePresenceNotify;
dpn.time = currentTime.milliseconds;
dpn.devchange = 1;
dpn.deviceid = dev->id;
dpn.control = stuff->control;
SendEventToAllWindows(dev, DevicePresenceNotifyMask,
(xEvent *) &dpn, 1);
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep);
}
else {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, ret);
}
return Success; return Success;
} }

View File

@ -64,7 +64,6 @@ SOFTWARE.
#include "XIstubs.h" #include "XIstubs.h"
#include "globals.h" #include "globals.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "extinit.h" /* LookupDeviceIntRec */
#include "exevents.h" #include "exevents.h"
#include "exglobals.h" #include "exglobals.h"
@ -99,107 +98,10 @@ SProcXChangeKeyboardDevice(register ClientPtr client)
int int
ProcXChangeKeyboardDevice(register ClientPtr client) ProcXChangeKeyboardDevice(register ClientPtr client)
{ {
int i;
DeviceIntPtr xkbd = inputInfo.keyboard;
DeviceIntPtr dev;
FocusClassPtr xf = xkbd->focus;
FocusClassPtr df;
KeyClassPtr k;
xChangeKeyboardDeviceReply rep;
changeDeviceNotify ev;
REQUEST(xChangeKeyboardDeviceReq); REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq); REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
rep.repType = X_Reply;
rep.RepType = X_ChangeKeyboardDevice;
rep.length = 0;
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0, SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice); BadDevice);
return Success; return Success;
}
k = dev->key;
if (k == NULL) {
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadMatch);
return Success;
}
if (((dev->grab) && !SameClient(dev->grab, client)) ||
((xkbd->grab) && !SameClient(xkbd->grab, client)))
rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen &&
dev->sync.other && !SameClient(dev->sync.other, client)) ||
(xkbd->sync.frozen &&
xkbd->sync.other && !SameClient(xkbd->sync.other, client)))
rep.status = GrabFrozen;
else {
if (ChangeKeyboardDevice(xkbd, dev) != Success) {
SendErrorToClient(client, IReqCode, X_ChangeKeyboardDevice, 0,
BadDevice);
return Success;
}
if (!dev->focus)
InitFocusClassDeviceStruct(dev);
if (!dev->kbdfeed)
InitKbdFeedbackClassDeviceStruct(dev, (BellProcPtr) NoopDDA,
(KbdCtrlProcPtr) NoopDDA);
df = dev->focus;
df->win = xf->win;
df->revert = xf->revert;
df->time = xf->time;
df->traceGood = xf->traceGood;
if (df->traceSize != xf->traceSize) {
Must_have_memory = TRUE; /* XXX */
df->trace = (WindowPtr *) xrealloc(df->trace,
xf->traceSize *
sizeof(WindowPtr));
Must_have_memory = FALSE; /* XXX */
}
df->traceSize = xf->traceSize;
for (i = 0; i < df->traceSize; i++)
df->trace[i] = xf->trace[i];
RegisterOtherDevice(xkbd);
RegisterKeyboardDevice(dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewKeyboard;
SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
SendMappingNotify(MappingKeyboard, k->curKeySyms.minKeyCode,
k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode +
1, client);
rep.status = 0;
}
WriteReplyToClient(client, sizeof(xChangeKeyboardDeviceReply), &rep);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XChangeKeyboardDevice
* function, if the client and server have a different byte ordering.
*
*/
void
SRepXChangeKeyboardDevice(ClientPtr client, int size,
xChangeKeyboardDeviceReply * rep)
{
register char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
} }

View File

@ -36,9 +36,4 @@ int SProcXChangeKeyboardDevice(ClientPtr /* client */
int ProcXChangeKeyboardDevice(ClientPtr /* client */ int ProcXChangeKeyboardDevice(ClientPtr /* client */
); );
void SRepXChangeKeyboardDevice(ClientPtr /* client */ ,
int /* size */ ,
xChangeKeyboardDeviceReply * /* rep */
);
#endif /* CHGKBD_H */ #endif /* CHGKBD_H */

View File

@ -101,138 +101,10 @@ SProcXChangePointerDevice(register ClientPtr client)
int int
ProcXChangePointerDevice(register ClientPtr client) ProcXChangePointerDevice(register ClientPtr client)
{ {
DeviceIntPtr xptr = inputInfo.pointer;
DeviceIntPtr dev;
ValuatorClassPtr v;
xChangePointerDeviceReply rep;
changeDeviceNotify ev;
REQUEST(xChangePointerDeviceReq); REQUEST(xChangePointerDeviceReq);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq); REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
rep.repType = X_Reply;
rep.RepType = X_ChangePointerDevice;
rep.length = 0;
rep.sequenceNumber = client->sequence;
dev = LookupDeviceIntRec(stuff->deviceid);
if (dev == NULL) {
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice); BadDevice);
return Success; return Success;
}
v = dev->valuator;
if (v == NULL || v->numAxes < 2 ||
stuff->xaxis >= v->numAxes || stuff->yaxis >= v->numAxes) {
rep.status = -1;
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0, BadMatch);
return Success;
}
if (((dev->grab) && !SameClient(dev->grab, client)) ||
((xptr->grab) && !SameClient(xptr->grab, client)))
rep.status = AlreadyGrabbed;
else if ((dev->sync.frozen &&
dev->sync.other && !SameClient(dev->sync.other, client)) ||
(xptr->sync.frozen &&
xptr->sync.other && !SameClient(xptr->sync.other, client)))
rep.status = GrabFrozen;
else {
if (ChangePointerDevice(xptr, dev, stuff->xaxis, stuff->yaxis) !=
Success) {
SendErrorToClient(client, IReqCode, X_ChangePointerDevice, 0,
BadDevice);
return Success;
}
if (dev->focus)
DeleteFocusClassDeviceStruct(dev);
if (!dev->button)
InitButtonClassDeviceStruct(dev, 0, NULL);
if (!dev->ptrfeed)
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr) NoopDDA);
RegisterOtherDevice(xptr);
RegisterPointerDevice(dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewPointer;
SendEventToAllWindows(dev, ChangeDeviceNotifyMask, (xEvent *) & ev, 1);
SendMappingNotify(MappingPointer, 0, 0, client);
rep.status = 0;
}
WriteReplyToClient(client, sizeof(xChangePointerDeviceReply), &rep);
return Success;
}
void
DeleteFocusClassDeviceStruct(DeviceIntPtr dev)
{
xfree(dev->focus->trace);
xfree(dev->focus);
dev->focus = NULL;
}
/***********************************************************************
*
* Send an event to interested clients in all windows on all screens.
*
*/
void
SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
{
int i;
WindowPtr pWin, p1;
for (i = 0; i < screenInfo.numScreens; i++) {
pWin = WindowTable[i];
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
p1 = pWin->firstChild;
FindInterestedChildren(dev, p1, mask, ev, count);
}
}
/***********************************************************************
*
* Walk through the window tree, finding all clients that want to know
* about the ChangeDeviceNotify Event.
*
*/
void
FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
xEvent * ev, int count)
{
WindowPtr p2;
while (p1) {
p2 = p1->firstChild;
(void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
FindInterestedChildren(dev, p2, mask, ev, count);
p1 = p1->nextSib;
}
}
/***********************************************************************
*
* This procedure writes the reply for the XChangePointerDevice
* function, if the client and server have a different byte ordering.
*
*/
void
SRepXChangePointerDevice(ClientPtr client, int size,
xChangePointerDeviceReply * rep)
{
register char n;
swaps(&rep->sequenceNumber, n);
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
} }

View File

@ -53,9 +53,4 @@ void FindInterestedChildren( /* FIXME: could be static? */
int /* count */ int /* count */
); );
void SRepXChangePointerDevice(ClientPtr /* client */ ,
int /* size */ ,
xChangePointerDeviceReply * /* rep */
);
#endif /* CHGPTR_H */ #endif /* CHGPTR_H */

View File

@ -71,8 +71,7 @@ SOFTWARE.
#include "exglobals.h" #include "exglobals.h"
#include "dixevents.h" /* DeliverFocusedEvent */ #include "dixevents.h" /* DeliverFocusedEvent */
#include "dixgrabs.h" /* CreateGrab() */ #include "dixgrabs.h" /* CreateGrab() */
#include "scrnintstr.h"
#include "chgptr.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0) #define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \ #define AllModifiersMask ( \
@ -302,7 +301,12 @@ _X_EXPORT void
InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval, InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int resolution, int min_res, int max_res) int resolution, int min_res, int max_res)
{ {
register AxisInfoPtr ax = dev->valuator->axes + axnum; register AxisInfoPtr ax;
if (!dev || !dev->valuator)
return;
ax = dev->valuator->axes + axnum;
ax->min_value = minval; ax->min_value = minval;
ax->max_value = maxval; ax->max_value = maxval;
@ -898,7 +902,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen,
return MappingBusy; return MappingBusy;
} else { } else {
for (i = 0; i < inputMapLen; i++) { for (i = 0; i < inputMapLen; i++) {
if (inputMap[i] && !LegalModifier(inputMap[i], (DevicePtr) dev)) { if (inputMap[i] && !LegalModifier(inputMap[i], dev)) {
return MappingFailed; return MappingFailed;
} }
} }
@ -1209,3 +1213,44 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents)
else else
return FALSE; return FALSE;
} }
/***********************************************************************
*
* Walk through the window tree, finding all clients that want to know
* about the Event.
*
*/
void
FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
xEvent * ev, int count)
{
WindowPtr p2;
while (p1) {
p2 = p1->firstChild;
(void)DeliverEventsToWindow(p1, ev, count, mask, NullGrab, dev->id);
FindInterestedChildren(dev, p2, mask, ev, count);
p1 = p1->nextSib;
}
}
/***********************************************************************
*
* Send an event to interested clients in all windows on all screens.
*
*/
void
SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
{
int i;
WindowPtr pWin, p1;
for (i = 0; i < screenInfo.numScreens; i++) {
pWin = WindowTable[i];
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
p1 = pWin->firstChild;
FindInterestedChildren(dev, p1, mask, ev, count);
}
}

View File

@ -51,6 +51,7 @@ extern Mask DeviceMappingNotifyMask;
extern Mask DeviceOwnerGrabButtonMask; extern Mask DeviceOwnerGrabButtonMask;
extern Mask DeviceButtonGrabMask; extern Mask DeviceButtonGrabMask;
extern Mask DeviceButtonMotionMask; extern Mask DeviceButtonMotionMask;
extern Mask DevicePresenceNotifyMask;
extern Mask PropagateMask[]; extern Mask PropagateMask[];
extern int DeviceValuator; extern int DeviceValuator;
@ -68,12 +69,8 @@ extern int DeviceKeyStateNotify;
extern int DeviceButtonStateNotify; extern int DeviceButtonStateNotify;
extern int DeviceMappingNotify; extern int DeviceMappingNotify;
extern int ChangeDeviceNotify; extern int ChangeDeviceNotify;
extern int DevicePresenceNotify;
extern int RT_INPUTCLIENT; extern int RT_INPUTCLIENT;
#if 0
/* FIXME: in dix */
extern InputInfo inputInfo;
#endif
#endif /* EXGLOBALS_H */ #endif /* EXGLOBALS_H */

View File

@ -166,6 +166,7 @@ Mask DeviceMappingNotifyMask;
Mask DeviceOwnerGrabButtonMask; Mask DeviceOwnerGrabButtonMask;
Mask DeviceButtonGrabMask; Mask DeviceButtonGrabMask;
Mask DeviceButtonMotionMask; Mask DeviceButtonMotionMask;
Mask DevicePresenceNotifyMask;
int DeviceValuator; int DeviceValuator;
int DeviceKeyPress; int DeviceKeyPress;
@ -182,6 +183,7 @@ int DeviceKeyStateNotify;
int DeviceButtonStateNotify; int DeviceButtonStateNotify;
int DeviceMappingNotify; int DeviceMappingNotify;
int ChangeDeviceNotify; int ChangeDeviceNotify;
int DevicePresenceNotify;
int RT_INPUTCLIENT; int RT_INPUTCLIENT;
@ -202,8 +204,8 @@ Mask PropagateMask[MAX_DEVICES];
*/ */
static XExtensionVersion thisversion = { XI_Present, static XExtensionVersion thisversion = { XI_Present,
XI_Add_XChangeDeviceControl_Major, XI_Add_DevicePresenceNotify_Major,
XI_Add_XChangeDeviceControl_Minor XI_Add_DevicePresenceNotify_Minor
}; };
/********************************************************************** /**********************************************************************
@ -463,12 +465,6 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
else if (rep->RepType == X_GetDeviceMotionEvents) else if (rep->RepType == X_GetDeviceMotionEvents)
SRepXGetDeviceMotionEvents(client, len, SRepXGetDeviceMotionEvents(client, len,
(xGetDeviceMotionEventsReply *) rep); (xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_ChangeKeyboardDevice)
SRepXChangeKeyboardDevice(client, len,
(xChangeKeyboardDeviceReply *) rep);
else if (rep->RepType == X_ChangePointerDevice)
SRepXChangePointerDevice(client, len,
(xChangePointerDeviceReply *) rep);
else if (rep->RepType == X_GrabDevice) else if (rep->RepType == X_GrabDevice)
SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep); SRepXGrabDevice(client, len, (xGrabDeviceReply *) rep);
else if (rep->RepType == X_GetDeviceFocus) else if (rep->RepType == X_GetDeviceFocus)
@ -648,6 +644,17 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
swapl(&to->time, n); swapl(&to->time, n);
} }
void
SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
swapl(&to->time, n);
swaps(&to->control, n);
}
/************************************************************************ /************************************************************************
* *
* This function sets up extension event types and masks. * This function sets up extension event types and masks.
@ -674,6 +681,7 @@ FixExtensionEvents(ExtensionEntry * extEntry)
ChangeDeviceNotify = DeviceMappingNotify + 1; ChangeDeviceNotify = DeviceMappingNotify + 1;
DeviceKeyStateNotify = ChangeDeviceNotify + 1; DeviceKeyStateNotify = ChangeDeviceNotify + 1;
DeviceButtonStateNotify = DeviceKeyStateNotify + 1; DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
DevicePresenceNotify = DeviceButtonStateNotify + 1;
event_base[KeyClass] = DeviceKeyPress; event_base[KeyClass] = DeviceKeyPress;
event_base[ButtonClass] = DeviceButtonPress; event_base[ButtonClass] = DeviceButtonPress;
@ -746,6 +754,9 @@ FixExtensionEvents(ExtensionEntry * extEntry)
DeviceOwnerGrabButtonMask = GetNextExtEventMask(); DeviceOwnerGrabButtonMask = GetNextExtEventMask();
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton); SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
DevicePresenceNotifyMask = GetNextExtEventMask();
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
SetEventInfo(0, _noExtensionEvent); SetEventInfo(0, _noExtensionEvent);
} }
@ -786,6 +797,7 @@ RestoreExtensionEvents(void)
ChangeDeviceNotify = 12; ChangeDeviceNotify = 12;
DeviceKeyStateNotify = 13; DeviceKeyStateNotify = 13;
DeviceButtonStateNotify = 13; DeviceButtonStateNotify = 13;
DevicePresenceNotify = 14;
BadDevice = 0; BadDevice = 0;
BadEvent = 1; BadEvent = 1;
@ -823,6 +835,7 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DeviceButtonStateNotify] = NotImplemented; EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
EventSwapVector[DeviceMappingNotify] = NotImplemented; EventSwapVector[DeviceMappingNotify] = NotImplemented;
EventSwapVector[ChangeDeviceNotify] = NotImplemented; EventSwapVector[ChangeDeviceNotify] = NotImplemented;
EventSwapVector[DevicePresenceNotify] = NotImplemented;
RestoreExtensionEvents(); RestoreExtensionEvents();
} }
@ -857,9 +870,7 @@ MakeDeviceTypeAtoms(void)
} }
/************************************************************************** /**************************************************************************
*
* Return a DeviceIntPtr corresponding to a specified device id. * Return a DeviceIntPtr corresponding to a specified device id.
* This will not return the pointer or keyboard, or devices that are not on.
* *
*/ */
@ -869,13 +880,16 @@ LookupDeviceIntRec(CARD8 id)
DeviceIntPtr dev; DeviceIntPtr dev;
for (dev = inputInfo.devices; dev; dev = dev->next) { for (dev = inputInfo.devices; dev; dev = dev->next) {
if (dev->id == id) { if (dev->id == id)
if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id) return dev;
return (NULL);
return (dev);
} }
for (dev = inputInfo.off_devices; dev; dev = dev->next) {
if (dev->id == id)
return dev;
} }
return (NULL);
return NULL;
} }
/************************************************************************** /**************************************************************************

View File

@ -124,6 +124,30 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceResolutionState) + total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes); (3 * sizeof(int) * dev->valuator->numAxes);
break; break;
case DEVICE_ABS_CALIB:
if (!dev->absolute) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
total_length = sizeof(xDeviceAbsCalibCtl);
break;
case DEVICE_ABS_AREA:
if (!dev->absolute) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
total_length = sizeof(xDeviceAbsAreaCtl);
break;
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreCtl);
break;
case DEVICE_ENABLE:
total_length = sizeof(xDeviceEnableCtl);
break;
default: default:
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
return Success; return Success;
@ -140,6 +164,18 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_RESOLUTION: case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf, total_length); CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break; break;
case DEVICE_ABS_CALIB:
CopySwapDeviceAbsCalib(client, dev->absolute, buf);
break;
case DEVICE_ABS_AREA:
CopySwapDeviceAbsArea(client, dev->absolute, buf);
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
break;
case DEVICE_ENABLE:
CopySwapDeviceEnable(client, dev, buf);
break;
default: default:
break; break;
} }
@ -189,6 +225,98 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
} }
} }
void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
char *buf)
{
register char n;
xDeviceAbsCalibState *calib = (xDeviceAbsCalibState *) buf;
calib->control = DEVICE_ABS_CALIB;
calib->length = sizeof(calib);
calib->min_x = dts->min_x;
calib->max_x = dts->max_x;
calib->min_y = dts->min_y;
calib->max_y = dts->max_y;
calib->flip_x = dts->flip_x;
calib->flip_y = dts->flip_y;
calib->rotation = dts->rotation;
calib->button_threshold = dts->button_threshold;
if (client->swapped) {
swaps(&calib->control, n);
swaps(&calib->length, n);
swapl(&calib->min_x, n);
swapl(&calib->max_x, n);
swapl(&calib->min_y, n);
swapl(&calib->max_y, n);
swapl(&calib->flip_x, n);
swapl(&calib->flip_y, n);
swapl(&calib->rotation, n);
swapl(&calib->button_threshold, n);
}
}
void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
char *buf)
{
register char n;
xDeviceAbsAreaState *area = (xDeviceAbsAreaState *) buf;
area->control = DEVICE_ABS_AREA;
area->length = sizeof(area);
area->offset_x = dts->offset_x;
area->offset_y = dts->offset_y;
area->width = dts->width;
area->height = dts->height;
area->screen = dts->screen;
area->following = dts->following;
if (client->swapped) {
swaps(&area->control, n);
swaps(&area->length, n);
swapl(&area->offset_x, n);
swapl(&area->offset_y, n);
swapl(&area->width, n);
swapl(&area->height, n);
swapl(&area->screen, n);
swapl(&area->following, n);
}
}
void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
{
register char n;
xDeviceCoreState *c = (xDeviceCoreState *) buf;
c->control = DEVICE_CORE;
c->length = sizeof(c);
c->status = dev->coreEvents;
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
if (client->swapped) {
swaps(&c->control, n);
swaps(&c->length, n);
swaps(&c->status, n);
}
}
void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
{
register char n;
xDeviceEnableState *e = (xDeviceEnableState *) buf;
e->control = DEVICE_ENABLE;
e->length = sizeof(e);
e->enable = dev->enabled;
if (client->swapped) {
swaps(&e->control, n);
swaps(&e->length, n);
swaps(&e->enable, n);
}
}
/*********************************************************************** /***********************************************************************
* *
* This procedure writes the reply for the xGetDeviceControl function, * This procedure writes the reply for the xGetDeviceControl function,

View File

@ -42,6 +42,24 @@ void CopySwapDeviceResolution(ClientPtr /* client */ ,
int /* length */ int /* length */
); );
void CopySwapDeviceAbsCalib (ClientPtr client,
AbsoluteClassPtr dts,
char *buf);
void CopySwapDeviceAbsArea (ClientPtr client,
AbsoluteClassPtr dts,
char *buf);
void CopySwapDeviceCore(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
char * /* buf */
);
void CopySwapDeviceEnable(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
char * /* buf */
);
void SRepXGetDeviceControl(ClientPtr /* client */ , void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ , int /* size */ ,
xGetDeviceControlReply * /* rep */ xGetDeviceControlReply * /* rep */

View File

@ -96,7 +96,7 @@ int
ProcXListInputDevices(register ClientPtr client) ProcXListInputDevices(register ClientPtr client)
{ {
xListInputDevicesReply rep; xListInputDevicesReply rep;
int numdevs; int numdevs = 0;
int namesize = 1; /* need 1 extra byte for strcpy */ int namesize = 1; /* need 1 extra byte for strcpy */
int size = 0; int size = 0;
int total_length; int total_length;
@ -115,12 +115,15 @@ ProcXListInputDevices(register ClientPtr client)
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
AddOtherInputDevices(); AddOtherInputDevices();
numdevs = inputInfo.numDevices;
for (d = inputInfo.devices; d; d = d->next) for (d = inputInfo.devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size); SizeDeviceInfo(d, &namesize, &size);
for (d = inputInfo.off_devices; d; d = d->next) numdevs++;
}
for (d = inputInfo.off_devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size); SizeDeviceInfo(d, &namesize, &size);
numdevs++;
}
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *)xalloc(total_length); devbuf = (char *)xalloc(total_length);
@ -241,6 +244,10 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
dev->use = IsXKeyboard; dev->use = IsXKeyboard;
else if (d == inputInfo.pointer) else if (d == inputInfo.pointer)
dev->use = IsXPointer; dev->use = IsXPointer;
else if (d->key && d->kbdfeed)
dev->use = IsXExtensionKeyboard;
else if (d->valuator && d->button)
dev->use = IsXExtensionPointer;
else else
dev->use = IsXExtensionDevice; dev->use = IsXExtensionDevice;
if (client->swapped) { if (client->swapped) {

View File

@ -74,6 +74,53 @@ SOFTWARE.
extern Mask ExtExclusiveMasks[]; extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[]; extern Mask ExtValidMasks[];
static int
HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
XEventClass *cls, CARD16 *count)
{
int i, j;
Mask mask;
/* We use the device ID 256 to select events that aren't bound to
* any device. For now we only handle the device presence event,
* but this could be extended to other events that aren't bound to
* a device.
*
* In order not to break in CreateMaskFromList() we remove the
* entries with device ID 256 from the XEventClass array.
*/
mask = 0;
for (i = 0, j = 0; i < *count; i++) {
if (cls[i] >> 8 != 256) {
cls[j] = cls[i];
j++;
continue;
}
switch (cls[i] & 0xff) {
case _devicePresence:
mask |= DevicePresenceNotifyMask;
break;
}
}
*count = j;
if (mask == 0)
return Success;
/* We always only use mksidx = 0 for events not bound to
* devices */
if (AddExtensionClient (win, client, mask, 0) != Success)
return BadAlloc;
RecalculateDeviceDeliverableEvents(win);
return Success;
}
/*********************************************************************** /***********************************************************************
* *
* Handle requests from clients with a different byte order. * Handle requests from clients with a different byte order.
@ -131,6 +178,13 @@ ProcXSelectExtensionEvent(register ClientPtr client)
return Success; return Success;
} }
if (HandleDevicePresenceMask(client, pWin, (XEventClass *) & stuff[1],
&stuff->count) != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadAlloc);
return Success;
}
if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1], if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL, stuff->count, tmp, NULL,
X_SelectExtensionEvent)) != Success) X_SelectExtensionEvent)) != Success)

View File

@ -66,86 +66,6 @@ SOFTWARE.
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "XIstubs.h" #include "XIstubs.h"
/***********************************************************************
*
* Caller: ProcXChangeKeyboardDevice
*
* This procedure does the implementation-dependent portion of the work
* needed to change the keyboard device.
*
* The X keyboard device has a FocusRec. If the device that has been
* made into the new X keyboard did not have a FocusRec,
* ProcXChangeKeyboardDevice will allocate one for it.
*
* If you do not want clients to be able to focus the old X keyboard
* device, call DeleteFocusClassDeviceStruct to free the FocusRec.
*
* If you support input devices with keys that you do not want to be
* used as the X keyboard, you need to check for them here and return
* a BadDevice error.
*
* The default implementation is to do nothing (assume you do want
* clients to be able to focus the old X keyboard). The commented-out
* sample code shows what you might do if you don't want the default.
*
*/
int
ChangeKeyboardDevice(DeviceIntPtr old_dev, DeviceIntPtr new_dev)
{
/***********************************************************************
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
**********************************************************************/
return BadMatch;
}
/***********************************************************************
*
* Caller: ProcXChangePointerDevice
*
* This procedure does the implementation-dependent portion of the work
* needed to change the pointer device.
*
* The X pointer device does not have a FocusRec. If the device that
* has been made into the new X pointer had a FocusRec,
* ProcXChangePointerDevice will free it.
*
* If you want clients to be able to focus the old pointer device that
* has now become accessible through the input extension, you need to
* add a FocusRec to it here.
*
* The XChangePointerDevice protocol request also allows the client
* to choose which axes of the new pointer device are used to move
* the X cursor in the X- and Y- directions. If the axes are different
* than the default ones, you need to keep track of that here.
*
* If you support input devices with valuators that you do not want to be
* used as the X pointer, you need to check for them here and return a
* BadDevice error.
*
* The default implementation is to do nothing (assume you don't want
* clients to be able to focus the old X pointer). The commented-out
* sample code shows what you might do if you don't want the default.
*
*/
int
ChangePointerDevice(DeviceIntPtr old_dev,
DeviceIntPtr new_dev, unsigned char x, unsigned char y)
{
/***********************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
x_axis = x; * keep track of new x-axis*
y_axis = y; * keep track of new y-axis*
if (x_axis != 0 || y_axis != 1)
axes_changed = TRUE; * remember axes have changed*
else
axes_changed = FALSE;
*************************************************************************/
return BadMatch;
}
/*********************************************************************** /***********************************************************************
* *
* Caller: ProcXCloseDevice * Caller: ProcXCloseDevice
@ -287,7 +207,26 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
switch (control->control) { switch (control->control) {
case DEVICE_RESOLUTION: case DEVICE_RESOLUTION:
return (BadMatch); return (BadMatch);
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
return (BadMatch);
case DEVICE_CORE:
return (BadMatch);
default: default:
return (BadMatch); return (BadMatch);
} }
} }
/****************************************************************************
*
* Caller: configAddDevice (and others)
*
* Add a new device with the specified options.
*
*/
int
NewInputDeviceRequest(InputOption *options)
{
return BadValue;
}

View File

@ -301,7 +301,7 @@ typedef unsigned int *glyphPointer;
#define StorePixels(o,p) dst[o] = p #define StorePixels(o,p) dst[o] = p
#define Loop dst += widthDst; #define Loop dst += widthDst;
#else #else
#define StorePixels(o,p) *dst++ = (p) #define StorePixels(o,p) do { *dst = (p); dst++; } while (0)
#define Loop dst += widthLeft; #define Loop dst += widthLeft;
#endif #endif

10
config/Makefile.am Normal file
View File

@ -0,0 +1,10 @@
AM_CFLAGS = @DIX_CFLAGS@
dbusconfigdir = $(sysconfdir)/dbus-1/system.d
dbusconfig_DATA = xorg-server.conf
lib_LIBRARIES = libconfig.a
libconfig_a_SOURCES = config.c
EXTRA_DIST = xorg-server.conf

351
config/config.c Normal file
View File

@ -0,0 +1,351 @@
/*
* Copyright © 2006 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 name of the copyright holders and/or authors
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. The copyright holders
* and/or authors make no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* THE COPYRIGHT HOLDERS AND/OR AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef HAVE_DBUS
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus.h>
#include <string.h>
#include <X11/X.h>
#include "opaque.h" /* for 'display': there has to be a better way */
/* the above comment lies. there is no better way. */
#include "input.h"
#include "inputstr.h"
#include "config.h"
#include "os.h"
#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
#define MALFORMED_MSG "[config] malformed message, dropping"
#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \
ret = BadValue; \
goto unwind; }
#define MALFORMED_MESSAGE_ERROR() { DebugF(MALFORMED_MSG ": %s, %s", \
error->name, error->message); \
ret = BadValue; \
goto unwind; }
static DBusConnection *configConnection = NULL;
static int configfd = -1;
static char busobject[32] = { 0 };
static char busname[64] = { 0 };
void
configDispatch()
{
if (!configConnection)
return;
dbus_connection_read_write_dispatch(configConnection, 0);
}
static int
configAddDevice(DBusMessage *message, DBusMessageIter *iter, DBusError *error)
{
DBusMessageIter subiter;
InputOption *tmpo = NULL, *options = NULL;
char *tmp = NULL;
int ret = BadMatch;
DebugF("[config] adding device\n");
/* signature should be [ss][ss]... */
options = (InputOption *) xcalloc(sizeof(InputOption), 1);
if (!options) {
ErrorF("[config] couldn't allocate option\n");
return BadAlloc;
}
options->key = xstrdup("_source");
options->value = xstrdup("client/dbus");
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_ARRAY) {
tmpo = (InputOption *) xcalloc(sizeof(InputOption), 1);
if (!tmpo) {
ErrorF("[config] couldn't allocate option\n");
ret = BadAlloc;
goto unwind;
}
dbus_message_iter_recurse(iter, &subiter);
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
MALFORMED_MESSAGE();
dbus_message_iter_get_basic(&subiter, &tmp);
if (!tmp)
MALFORMED_MESSAGE();
if (tmp[0] == '_') {
ErrorF("[config] attempted subterfuge: option name %s given\n",
tmp);
MALFORMED_MESSAGE();
}
tmpo->key = xstrdup(tmp);
if (!tmpo->key) {
ErrorF("[config] couldn't duplicate key!\n");
ret = BadAlloc;
goto unwind;
}
if (!dbus_message_iter_has_next(&subiter))
MALFORMED_MESSAGE();
dbus_message_iter_next(&subiter);
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
MALFORMED_MESSAGE();
dbus_message_iter_get_basic(&subiter, &tmp);
if (!tmp)
MALFORMED_MESSAGE();
tmpo->value = xstrdup(tmp);
if (!tmpo->value) {
ErrorF("[config] couldn't duplicate option!\n");
ret = BadAlloc;
goto unwind;
}
tmpo->next = options;
options = tmpo;
dbus_message_iter_next(iter);
}
ret = NewInputDeviceRequest(options);
if (ret != Success)
DebugF("[config] NewInputDeviceRequest failed\n");
return ret;
unwind:
if (tmpo->key)
xfree(tmpo->key);
if (tmpo->value)
xfree(tmpo->value);
if (tmpo)
xfree(tmpo);
while (options) {
tmpo = options;
options = options->next;
if (tmpo->key)
xfree(tmpo->key);
if (tmpo->value)
xfree(tmpo->value);
xfree(tmpo);
}
return ret;
}
static int
configRemoveDevice(DBusMessage *message, DBusMessageIter *iter,
DBusError *error)
{
int deviceid = -1;
int ret = BadMatch;
DeviceIntPtr pDev = NULL;
if (!dbus_message_get_args(message, error, DBUS_TYPE_INT32,
&deviceid, DBUS_TYPE_INVALID)) {
MALFORMED_MESSAGE_ERROR();
}
if (deviceid < 0 || !(pDev = LookupDeviceIntRec(deviceid))) {
DebugF("[config] bogus device id %d given\n", deviceid);
ret = BadMatch;
goto unwind;
}
DebugF("[config] removing device %s (id %d)\n", pDev->name, deviceid);
/* Call PIE here so we don't try to dereference a device that's
* already been removed. */
OsBlockSignals();
ProcessInputEvents();
RemoveDevice(pDev);
OsReleaseSignals();
return Success;
unwind:
return ret;
}
static DBusHandlerResult
configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
{
DBusMessageIter iter;
DBusError error;
DBusMessage *reply;
DBusConnection *bus = closure;
int ret = BadDrawable; /* nonsensical value */
dbus_error_init(&error);
if (strcmp(dbus_message_get_interface(message),
"org.x.config.input") == 0) {
if (!dbus_message_iter_init(message, &iter)) {
ErrorF("[config] failed to init iterator\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
}
if (strcmp(dbus_message_get_member(message), "add") == 0)
ret = configAddDevice(message, &iter, &error);
else if (strcmp(dbus_message_get_member(message), "remove") == 0)
ret = configRemoveDevice(message, &iter, &error);
}
if (ret != BadDrawable && ret != BadAlloc) {
reply = dbus_message_new_method_return(message);
dbus_message_iter_init_append(reply, &iter);
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret)) {
ErrorF("[config] couldn't append to iterator\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
if (!dbus_connection_send(bus, reply, NULL))
ErrorF("[config] failed to send reply\n");
dbus_connection_flush(bus);
dbus_message_unref(reply);
}
dbus_error_free(&error);
if (ret == BadAlloc)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
else if (ret == BadDrawable)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
else
return DBUS_HANDLER_RESULT_HANDLED;
}
void
configInitialise()
{
DBusConnection *bus = NULL;
DBusError error;
DBusObjectPathVTable vtable = { .message_function = configMessage };
configConnection = NULL;
dbus_error_init(&error);
bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
if (!bus || dbus_error_is_set(&error)) {
ErrorF("[dbus] some kind of error occurred: %s (%s)\n", error.name,
error.message);
dbus_error_free(&error);
return;
}
if (!dbus_connection_get_unix_fd(bus, &configfd)) {
dbus_connection_unref(bus);
ErrorF("[dbus] couldn't get fd for bus\n");
dbus_error_free(&error);
configfd = -1;
return;
}
snprintf(busname, sizeof(busname), "org.x.config.display%d", atoi(display));
if (!dbus_bus_request_name(bus, busname, 0, &error) ||
dbus_error_is_set(&error)) {
ErrorF("[dbus] couldn't take over org.x.config: %s (%s)\n",
error.name, error.message);
dbus_error_free(&error);
dbus_connection_unref(bus);
configfd = -1;
return;
}
/* blocks until we get a reply. */
dbus_bus_add_match(bus, MATCH_RULE, &error);
if (dbus_error_is_set(&error)) {
ErrorF("[dbus] couldn't match X.Org rule: %s (%s)\n", error.name,
error.message);
dbus_error_free(&error);
dbus_bus_release_name(bus, busname, &error);
dbus_connection_unref(bus);
configfd = -1;
return;
}
snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display));
if (!dbus_connection_register_object_path(bus, busobject, &vtable, bus)) {
ErrorF("[dbus] couldn't register object path\n");
configfd = -1;
dbus_bus_release_name(bus, busname, &error);
dbus_bus_remove_match(bus, MATCH_RULE, &error);
dbus_connection_unref(bus);
dbus_error_free(&error);
return;
}
DebugF("[dbus] registered object path %s\n", busobject);
dbus_error_free(&error);
configConnection = bus;
AddGeneralSocket(configfd);
}
void
configFini()
{
DBusError error;
if (configConnection) {
dbus_error_init(&error);
dbus_connection_unregister_object_path(configConnection, busobject);
dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
dbus_bus_release_name(configConnection, busname, &error);
dbus_connection_unref(configConnection);
RemoveGeneralSocket(configfd);
configConnection = NULL;
configfd = -1;
dbus_error_free(&error);
}
}
#else /* !HAVE_DBUS */
void
configDispatch()
{
}
void
configInitialise()
{
}
void
configFini()
{
}
#endif /* HAVE_DBUS */

35
config/dbus-api Normal file
View File

@ -0,0 +1,35 @@
D-BUS Configuration API v0.1
----------------------------
The X server will register the bus name org.x.config.displayN, and the
object /org/x/config/N, where N is the display number.
Currently only hotplugging of input devices is supported.
org.x.config.input:
org.x.config.input.add:
Takes an argument of key/value option pairs in arrays, e.g.:
[ss][ss][ss][ss]
is the signature for four options. These options will be passed
to the input driver as with any others.
Option names beginning with _ are not allowed; they are reserved
for internal use.
Returns one int32, which is an X Status, as defined in X.h. If
everything is successful, Success will be returned. BadMatch will
be returned if the options given do not match any device. BadValue
is returned for a malformed message.
Notably, BadAlloc is never returned: the server internally signals
to D-BUS that the attempt failed for lack of memory.
The return does not notify the client of which devices were created
or modified as a result of this request: clients are encouraged to
listen for the XInput DevicePresenceNotify event to monitor changes
in the device list.
org.x.config.input.remove:
Takes one int32 argument, which is the device ID to remove, i.e.:
i
is the signature.
Same return values as org.x.config.input.add.

13
config/xorg-server.conf Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy context="default">
<allow own="org.x.config.display0"/>
<allow send_destination="org.x.config.display0"/>
<allow send_interface="org.x.config.display0"/>
<allow own="org.x.config.display1"/>
<allow send_destination="org.x.config.display1"/>
<allow send_interface="org.x.config.display1"/>
</policy>
</busconfig>

View File

@ -25,7 +25,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57) AC_PREREQ(2.57)
dnl This is the not the Xorg version number, it's the server version number. dnl This is the not the Xorg version number, it's the server version number.
dnl Yes, that's weird. dnl Yes, that's weird.
AC_INIT([xorg-server], 1.1.99.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) AC_INIT([xorg-server], 1.2.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign]) AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
@ -50,7 +50,6 @@ AC_CONFIG_HEADERS(include/xwin-config.h)
dnl kdrive-config.h covers the kdrive DDX dnl kdrive-config.h covers the kdrive DDX
AC_CONFIG_HEADERS(include/kdrive-config.h) AC_CONFIG_HEADERS(include/kdrive-config.h)
AC_PROG_CC AC_PROG_CC
AM_PROG_AS AM_PROG_AS
AC_PROG_INSTALL AC_PROG_INSTALL
@ -62,8 +61,29 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
AC_PROG_LEX AC_PROG_LEX
AC_PROG_YACC AC_PROG_YACC
AC_SYS_LARGEFILE
XORG_PROG_RAWCPP XORG_PROG_RAWCPP
dnl Check for dtrace program (needed to build Xserver dtrace probes)
AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
[Enable dtrace probes (default: enabled if dtrace found)]),
[WDTRACE=$withval], [WDTRACE=auto])
if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
if test "x$DTRACE" = "xnot_found" ; then
if test "x$WDTRACE" = "xyes" ; then
AC_MSG_FAILURE([dtrace requested but not found])
fi
WDTRACE="no"
fi
fi
if test "x$WDTRACE" != "xno" ; then
AC_DEFINE(XSERVER_DTRACE, 1,
[Define to 1 if the DTrace Xserver provider probes should be built in.])
fi
AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
AC_DEFINE_DIR(XERRORDB_PATH, libdir/XErrorDB, [Path to XErrorDB file])
AC_HEADER_DIRENT AC_HEADER_DIRENT
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h]) AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
@ -82,7 +102,8 @@ AC_TYPE_PID_T
dnl Checks for library functions. dnl Checks for library functions.
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
strtol getopt getopt_long vsnprintf walkcontext backtrace]) strtol getopt getopt_long vsnprintf walkcontext backtrace \
getisax])
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
dnl Old HAS_* names used in os/*.c. dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize], AC_CHECK_FUNC([getdtablesize],
@ -393,6 +414,12 @@ AC_ARG_ENABLE(install-libxf86config,
[Install libxf86config (default: disabled)]), [Install libxf86config (default: disabled)]),
[INSTALL_LIBXF86CONFIG=$enableval], [INSTALL_LIBXF86CONFIG=$enableval],
[INSTALL_LIBXF86CONFIG=no]) [INSTALL_LIBXF86CONFIG=no])
AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: use external)]),
[BUILTIN_FONTS=$enableval],
[BUILTIN_FONTS=no])
AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
[NULL_ROOT_CURSOR=$enableval],
[NULL_ROOT_CURSOR=no])
dnl Extensions. dnl Extensions.
AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes]) AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
@ -402,7 +429,7 @@ AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap ext
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes]) AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes]) AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes]) AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: enabled)]), [DGA=$enableval], [DGA=yes]) AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes]) AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto]) AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto]) AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
@ -411,13 +438,14 @@ AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerate
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]), [GLX_USE_TLS=$enableval], [GLX_USE_TLS=no]) AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]), [GLX_USE_TLS=$enableval], [GLX_USE_TLS=no])
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval]) AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes]) AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: enabled)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=yes]) AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes]) AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=yes]) AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=$XACE])
AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=$XCSECURITY])
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no]) AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no]) AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes]) AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
AC_ARG_ENABLE(appgroup, AS_HELP_STRING([--disable-appgroup], [Build XC-APPGROUP extension (default: enabled)]), [APPGROUP=$enableval], [APPGROUP=yes])
AC_ARG_ENABLE(cup, AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes]) AC_ARG_ENABLE(cup, AS_HELP_STRING([--disable-cup], [Build TOG-CUP extension (default: enabled)]), [CUP=$enableval], [CUP=yes])
AC_ARG_ENABLE(evi, AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: enabled)]), [EVI=$enableval], [EVI=yes]) AC_ARG_ENABLE(evi, AS_HELP_STRING([--disable-evi], [Build Extended-Visual-Information extension (default: enabled)]), [EVI=$enableval], [EVI=yes])
AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no]) AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
@ -425,7 +453,7 @@ AC_ARG_ENABLE(fontcache, AS_HELP_STRING([--enable-fontcache], [Build FontCa
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes]) AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: enabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=yes]) AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: enabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=yes])
AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes]) AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
AC_ARG_ENABLE(xinput, AS_HELP_STRING([--disable-xinput], [Build XInput Extension (default: enabled)]), [XINPUT=$enableval], [XINPUT=yes]) AC_ARG_ENABLE(dbus, AS_HELP_STRING([--disable-dbus], [Build D-BUS support (default: auto)]), [DBUS=$enableval], [DBUS=auto])
AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes]) AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
dnl DDXes. dnl DDXes.
@ -434,7 +462,7 @@ AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (d
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes]) AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto]) AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto]) AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: auto)]), [XPRINT=$enableval], [XPRINT=auto]) AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: no)]), [XPRINT=$enableval], [XPRINT=no])
AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no]) AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no]) AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no]) AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
@ -442,6 +470,9 @@ dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no]) AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto]) AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
AC_ARG_ENABLE(xsdl, AS_HELP_STRING([--enable-xsdl], [Build the kdrive Xsdl server (default: auto)]), [XSDL=$enableval], [XSDL=auto]) AC_ARG_ENABLE(xsdl, AS_HELP_STRING([--enable-xsdl], [Build the kdrive Xsdl server (default: auto)]), [XSDL=$enableval], [XSDL=auto])
AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
AC_ARG_ENABLE(kdrive-vesa, AS_HELP_STRING([--enable-kdrive-vesa], [Build the kdrive VESA-based servers (default: auto)]), [KDRIVEVESA=$enableval], [KDRIVEVESA=auto])
dnl xprint dnl xprint
AC_ARG_ENABLE(freetype, AS_HELP_STRING([ --enable-freetype], [Build Xprint FreeType backend (default: yes)]), [XP_USE_FREETYPE=$enableval],[XP_USE_FREETYPE=no]) AC_ARG_ENABLE(freetype, AS_HELP_STRING([ --enable-freetype], [Build Xprint FreeType backend (default: yes)]), [XP_USE_FREETYPE=$enableval],[XP_USE_FREETYPE=no])
AC_ARG_WITH(freetype-config, AS_HELP_STRING([ --with-freetype-config=PROG], [Use FreeType configuration program PROG (default: auto)]), freetype_config=$withval, freetype_config=auto) AC_ARG_WITH(freetype-config, AS_HELP_STRING([ --with-freetype-config=PROG], [Use FreeType configuration program PROG (default: auto)]), freetype_config=$withval, freetype_config=auto)
@ -513,9 +544,21 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la' XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al. dnl Core modules for most extensions, et al.
REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]" REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc" REQUIRED_LIBS="xfont xau fontenc"
if test "x$DBUS" = xauto; then
PKG_CHECK_MODULES(DBUS, dbus-1, [DBUS=yes], [DBUS=no])
fi
if test "x$DBUS" = xyes; then
PKG_CHECK_MODULES(DBUS, dbus-1)
AC_DEFINE(HAVE_DBUS, 1, [Have D-BUS support])
REQUIRED_MODULES="$REQUIRED_MODULES dbus-1"
REQUIRED_LIBS="$REQUIRED_LIBS dbus-1"
fi
CONFIG_LIB='$(top_builddir)/config/libconfig.a'
AM_CONDITIONAL(DBUS, [test "x$DBUS" = xyes])
AM_CONDITIONAL(XV, [test "x$XV" = xyes]) AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then if test "x$XV" = xyes; then
AC_DEFINE(XV, 1, [Support Xv extension]) AC_DEFINE(XV, 1, [Support Xv extension])
@ -530,10 +573,6 @@ if test "x$XVMC" = xyes; then
AC_DEFINE(XvMCExtension, 1, [Build XvMC extension]) AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
fi fi
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
if test "x$DGA" = xyes; then
AC_DEFINE(DGA, 1, [Support DGA extension])
fi
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes]) AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then if test "x$COMPOSITE" = xyes; then
@ -581,7 +620,12 @@ if test "x$GLX" = xyes && ! test "x$MESA_SOURCE" = x; then
AC_DEFINE(GLXEXT, 1, [Build GLX extension]) AC_DEFINE(GLXEXT, 1, [Build GLX extension])
GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la' GLX_LIBS='$(top_builddir)/GL/glx/libglx.la $(top_builddir)/GL/mesa/libGLcore.la'
test -d GL || mkdir GL test -d GL || mkdir GL
$srcdir/GL/symlink-mesa.sh $MESA_SOURCE GL/ case $host_os in
solaris*)
SYMLINK_MESA="/usr/bin/bash $srcdir/GL/symlink-mesa.sh" ;;
*) SYMLINK_MESA=$srcdir/GL/symlink-mesa.sh ;;
esac
$SYMLINK_MESA $MESA_SOURCE GL/
if test $? -ne 0; then if test $? -ne 0; then
AC_MSG_ERROR([Failed to link Mesa source tree. Please specify a proper path to Mesa sources, or disable GLX.]) AC_MSG_ERROR([Failed to link Mesa source tree. Please specify a proper path to Mesa sources, or disable GLX.])
fi fi
@ -608,10 +652,11 @@ AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then if test "x$DRI" = xyes; then
AC_DEFINE(XF86DRI, 1, [Build DRI extension]) AC_DEFINE(XF86DRI, 1, [Build DRI extension])
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto]) PKG_CHECK_MODULES([DRIPROTO], [xf86driproto])
PKG_CHECK_MODULES([LIBDRM], [libdrm]) PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.0])
PKG_CHECK_MODULES([GL], [glproto >= 1.4.1]) PKG_CHECK_MODULES([GL], [glproto >= 1.4.1])
AC_SUBST(DRIPROTO_CFLAGS) AC_SUBST(DRIPROTO_CFLAGS)
AC_SUBST(LIBDRM_CFLAGS) AC_SUBST(LIBDRM_CFLAGS)
AC_SUBST(LIBDRM_LIBS)
AC_SUBST(GL_CFLAGS) AC_SUBST(GL_CFLAGS)
fi fi
@ -622,8 +667,16 @@ if test "x$XINERAMA" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES xineramaproto" REQUIRED_MODULES="$REQUIRED_MODULES xineramaproto"
fi fi
AM_CONDITIONAL(XACE, [test "x$XACE" = xyes])
if test "x$XACE" = xyes; then
AC_DEFINE(XACE, 1, [Build X-ACE extension])
fi
AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes]) AM_CONDITIONAL(XCSECURITY, [test "x$XCSECURITY" = xyes])
if test "x$XCSECURITY" = xyes; then if test "x$XCSECURITY" = xyes; then
if test "x$XACE" != xyes; then
AC_MSG_ERROR([cannot build Security extension without X-ACE])
fi
AC_DEFINE(XCSECURITY, 1, [Build Security extension]) AC_DEFINE(XCSECURITY, 1, [Build Security extension])
fi fi
@ -633,12 +686,11 @@ if test "x$XEVIE" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES evieproto" REQUIRED_MODULES="$REQUIRED_MODULES evieproto"
fi fi
if test "x$APPGROUP" = xyes && test "x$XCSECURITY" != xyes; then
AC_MSG_NOTICE([Disabling APPGROUP extension])
APPGROUP=no
fi
AM_CONDITIONAL(APPGROUP, [test "x$APPGROUP" = xyes]) AM_CONDITIONAL(APPGROUP, [test "x$APPGROUP" = xyes])
if test "x$APPGROUP" = xyes; then if test "x$APPGROUP" = xyes; then
if test "x$XACE" != xyes || test "x$XCSECURITY" != xyes; then
AC_MSG_ERROR([cannot build APPGROUP extension without X-ACE and XC-SECURITY])
fi
AC_DEFINE(XAPPGROUP, 1, [Build APPGROUP extension]) AC_DEFINE(XAPPGROUP, 1, [Build APPGROUP extension])
fi fi
@ -682,14 +734,6 @@ if test "x$DPMSExtension" = xyes; then
AC_DEFINE(DPMSExtension, 1, [Support DPMS extension]) AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
fi fi
if test "x$XF86VIDMODE" = xyes; then
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
if test "x$XF86MISC" = xyes; then
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
if test "x$XPRINT" = xauto; then if test "x$XPRINT" = xauto; then
PKG_CHECK_MODULES([XPRINTPROTO], [printproto], [XPRINT=yes], [XPRINT=no]) PKG_CHECK_MODULES([XPRINTPROTO], [printproto], [XPRINT=yes], [XPRINT=no])
fi fi
@ -699,6 +743,11 @@ if test "x$XPRINT" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES printproto" REQUIRED_MODULES="$REQUIRED_MODULES printproto"
fi fi
if test "x$BUILTIN_FONTS" = xyes; then
AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
AC_DEFINE(NOFONTSERVERACCESS, 1, [Avoid using a font server])
fi
if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension]) AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto" REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
@ -729,12 +778,9 @@ if test "$COMPOSITE" = yes; then
fi fi
MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage' MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
AM_CONDITIONAL(XINPUT, [test "x$XINPUT" = xyes]) AC_DEFINE(XINPUT, 1, [Support X Input extension])
if test "x$XINPUT" = xyes; then XI_LIB='$(top_builddir)/Xi/libXi.la'
AC_DEFINE(XINPUT, 1, [Support X Input extension]) XI_INC='-I$(top_srcdir)/Xi'
XI_LIB='$(top_builddir)/Xi/libXi.la'
XI_INC='-I$(top_srcdir)/Xi'
fi
AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes) AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
@ -750,6 +796,10 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1, AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have `strcasecmp'.])) [Do not have `strcasecmp'.]))
if test "x$NULL_ROOT_CURSOR" = xyes; then
AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
fi
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"]) PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
if test "x$have_libxdmcp" = xyes; then if test "x$have_libxdmcp" = xyes; then
AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS]) AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
@ -807,6 +857,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VERSION_STRING}"
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path]) AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path]) AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path]) AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name]) AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_STRING_SHORT"], [Short vendor name]) AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_STRING_SHORT"], [Short vendor name])
@ -825,11 +876,13 @@ AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit])
AC_DEFINE(SERVER_LOCK, 1, [Use a lock to prevent multiple servers on a display]) AC_DEFINE(SERVER_LOCK, 1, [Use a lock to prevent multiple servers on a display])
AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler]) AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler])
AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper]) AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
AM_CONDITIONAL(DEBUG, test "x$DEBUGGING" = xyes)
if ! test "x$DEBUGGING" = xyes; then if test "x$DEBUGGING" = xyes; then
AC_DEFINE(DEBUG, 1, [Enable debugging code])
else
AC_DEFINE(NDEBUG, 1, [Disable some debugging code]) AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
fi fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
AC_DEFINE(USE_RGB_TXT, 1, [Use rgb.txt directly]) AC_DEFINE(USE_RGB_TXT, 1, [Use rgb.txt directly])
AC_DEFINE(MITMISC, 1, [Support MIT Misc extension]) AC_DEFINE(MITMISC, 1, [Support MIT Misc extension])
@ -839,8 +892,13 @@ AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
AC_DEFINE(BIGREQS, 1, [Support BigRequests extension]) AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
AC_DEFINE(PIXPRIV, 1, [Support pixmap privates]) AC_DEFINE(PIXPRIV, 1, [Support pixmap privates])
DIX_LIB='$(top_builddir)/dix/libdix.la' if test "x$WDTRACE" != "xno" ; then
OS_LIB='$(top_builddir)/os/libos.la' DIX_LIB='$(top_builddir)/dix/dix.O'
OS_LIB='$(top_builddir)/os/os.O'
else
DIX_LIB='$(top_builddir)/dix/libdix.la'
OS_LIB='$(top_builddir)/os/libos.la'
fi
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la' CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
MI_LIB='$(top_builddir)/mi/libmi.la' MI_LIB='$(top_builddir)/mi/libmi.la'
MINIMI_LIB='$(top_builddir)/mi/libminimi.la' MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
@ -857,10 +915,71 @@ PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS]) PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}" XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}"
XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm" XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
AC_SUBST([XSERVER_LIBS])
AC_SUBST([SYS_LIBS]) AC_SUBST([SYS_LIBS])
# The Xorg binary needs to export symbols so that they can be used from modules
# Some platforms require extra flags to do this. gcc should set these flags
# when -rdynamic is passed to it, other compilers/linkers may need to be added
# here.
if test "x$GCC" = "xyes"; then
GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
if test "x$WERROR" = "xyes"; then
GCC_WARNINGS="${GCC_WARNINGS} -Werror"
fi
XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
openbsd*)
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
;;
esac
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
[have_clock_gettime=no])])
AC_MSG_CHECKING([for a useful monotonic clock ...])
if ! test "x$have_clock_gettime" = xno; then
if ! test "x$have_clock_gettime" = xyes; then
CLOCK_LIBS="$have_clock_gettime"
else
CLOCK_LIBS=""
fi
AC_RUN_IFELSE([
#define _POSIX_C_SOURCE 199309L
#include <time.h>
int main(int argc, char *argv[]) {
struct timespec tp;
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
return 0;
else
return 1;
}
], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
[MONOTONIC_CLOCK="cross compiling"])
else
MONOTONIC_CLOCK=no
fi
AC_MSG_RESULT([$MONOTONIC_CLOCK])
if test "x$MONOTONIC_CLOCK" = xyes; then
AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()])
XSERVER_LIBS="$XSERVER_LIBS $CLOCK_LIBS"
LIBS="$LIBS $CLOCK_LIBS"
fi
dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so
dnl we need to replicate that here until those can all be fixed dnl we need to replicate that here until those can all be fixed
AC_MSG_CHECKING([if SVR4 needs to be defined]) AC_MSG_CHECKING([if SVR4 needs to be defined])
@ -875,6 +994,8 @@ AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC" XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order]) AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
AC_SUBST([XSERVER_LIBS])
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl DDX section. dnl DDX section.
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
@ -934,7 +1055,7 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes]) AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then if test "x$XVFB" = xyes; then
XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XVFB_LIBS]) AC_SUBST([XVFB_LIBS])
fi fi
@ -950,7 +1071,7 @@ AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes]) AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then if test "x$XNEST" = xyes; then
XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" XNEST_LIBS="$XSERVER_LIBS $FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XNEST_LIBS]) AC_SUBST([XNEST_LIBS])
fi fi
@ -1021,7 +1142,7 @@ if test "x$XGLX" = xyes; then
fi fi
# XORG_CORE_LIBS is needed even if you're not building the Xorg DDX # XORG_CORE_LIBS is needed even if you're not building the Xorg DDX
XORG_CORE_LIBS="$DIX_LIB" XORG_CORE_LIBS="$DIX_LIB $CONFIG_LIB"
AC_SUBST([XORG_CORE_LIBS]) AC_SUBST([XORG_CORE_LIBS])
xorg_bus_linuxpci=no xorg_bus_linuxpci=no
@ -1039,6 +1160,37 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H" XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
XORG_LIBS="$COMPOSITE_LIB $MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $OS_LIB" XORG_LIBS="$COMPOSITE_LIB $MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $OS_LIB"
if test "x$DGA" = xauto; then
PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
fi
if test "x$DGA" = xyes; then
XORG_MODULES="$XORG_MODULES xf86dgaproto"
AC_DEFINE(DGA, 1, [Support DGA extension])
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
fi
if test "x$XF86MISC" = xauto; then
PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
fi
if test "x$XF86MISC" = xyes; then
XORG_MODULES="$XORG_MODULES xf86miscproto"
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
if test "x$XF86VIDMODE" = xauto; then
PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
fi
if test "x$XF86VIDMODE" = xyes; then
XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
if test -n "$XORG_MODULES"; then
PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
fi
dnl Check to see if dlopen is in default libraries (like Solaris, which dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it. dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [], AC_CHECK_FUNC([dlopen], [],
@ -1051,7 +1203,6 @@ dnl has it in libc), or if libdl is needed to get it.
fi fi
XORG_OS="linux" XORG_OS="linux"
XORG_OS_SUBDIR="linux" XORG_OS_SUBDIR="linux"
XORG_OS_KBD="Lnx"
xorg_bus_linuxpci="yes" xorg_bus_linuxpci="yes"
linux_acpi="no" linux_acpi="no"
case $host_cpu in case $host_cpu in
@ -1070,30 +1221,10 @@ dnl has it in libc), or if libdl is needed to get it.
*) *)
;; ;;
esac esac
# check whether struct kbd_repeat has the 'period' field.
# on kernels < 2.5.42 it's called 'rate' instead.
AC_TRY_COMPILE([
#include <linux/kd.h>
#ifdef __sparc__
#include <asm/param.h>
#include <asm/kbio.h>
#endif
],[
int main () {
struct kbd_repeat k;
k.period = 0;
return 0;
}],
[period_field="period"],
[period_field="rate"])
AC_DEFINE_UNQUOTED(LNX_KBD_PERIOD_NAME, [$period_field],
[Name of the period field in struct kbd_repeat])
;; ;;
freebsd* | kfreebsd*-gnu) freebsd* | kfreebsd*-gnu)
XORG_OS="freebsd" XORG_OS="freebsd"
XORG_OS_SUBDIR="bsd" XORG_OS_SUBDIR="bsd"
XORG_OS_KBD="BSD"
case $host_cpu in case $host_cpu in
i*86) i*86)
;; ;;
@ -1105,7 +1236,6 @@ int main () {
netbsd*) netbsd*)
XORG_OS="netbsd" XORG_OS="netbsd"
XORG_OS_SUBDIR="bsd" XORG_OS_SUBDIR="bsd"
XORG_OS_KBD="BSD"
case $host_cpu in case $host_cpu in
i*86|amd64*|x86_64*|ia64*) i*86|amd64*|x86_64*|ia64*)
;; ;;
@ -1117,7 +1247,6 @@ int main () {
openbsd*) openbsd*)
XORG_OS="openbsd" XORG_OS="openbsd"
XORG_OS_SUBDIR="bsd" XORG_OS_SUBDIR="bsd"
XORG_OS_KBD="BSD"
case $host_cpu in case $host_cpu in
i*86|amd64*|x86_64*|ia64*) i*86|amd64*|x86_64*|ia64*)
;; ;;
@ -1224,7 +1353,6 @@ int main () {
AC_SUBST([XORG_INCS]) AC_SUBST([XORG_INCS])
AC_SUBST([XORG_OS]) AC_SUBST([XORG_OS])
AC_SUBST([XORG_OS_SUBDIR]) AC_SUBST([XORG_OS_SUBDIR])
AC_SUBST([XORG_OS_KBD])
dnl only used in hw/xfree86/scanpci, TTBOMK dnl only used in hw/xfree86/scanpci, TTBOMK
AC_PATH_PROG(PERL, perl, no) AC_PATH_PROG(PERL, perl, no)
@ -1234,28 +1362,7 @@ int main () {
fi fi
AC_SUBST(PERL) AC_SUBST(PERL)
# The Xorg binary needs to export symbols so that they can be used from modules
# Some platforms require extra flags to do this. gcc should set these flags
# when -rdynamic is passed to it, other compilers/linkers may need to be added
# here.
if test "x$GCC" = "xyes"; then
GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
if test "x$WERROR" = "xyes"; then
GCC_WARNINGS="${GCC_WARNINGS} -Werror"
fi
XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
openbsd*)
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
;;
esac
AC_SUBST([XORG_CFLAGS]) AC_SUBST([XORG_CFLAGS])
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
dnl these only go in xorg-config.h dnl these only go in xorg-config.h
XF86CONFIGFILE="xorg.conf" XF86CONFIGFILE="xorg.conf"
@ -1304,6 +1411,7 @@ AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
AM_CONDITIONAL(MFB, [test "x$XORG" = xyes]) AM_CONDITIONAL(MFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(CFB, [test "x$XORG" = xyes]) AM_CONDITIONAL(CFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(AFB, [test "x$XORG" = xyes]) AM_CONDITIONAL(AFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
dnl Xprint DDX dnl Xprint DDX
@ -1313,7 +1421,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau]) PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS" XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB" XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
AC_SUBST([XPRINT_CFLAGS]) AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS]) AC_SUBST([XPRINT_LIBS])
@ -1442,16 +1550,60 @@ if test "$KDRIVE" = yes; then
AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx]) AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
AC_CHECK_HEADERS([sys/vm86.h sys/io.h]) AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
if test "$ac_cv_header_sys_vm86_h" = yes; then if test "$ac_cv_header_sys_vm86_h" = yes && test "x$KDRIVEVESA" = xauto; then
KDRIVEVESA=yes
fi
if test "x$KDRIVEVESA" = xyes; then
KDRIVEFBDEVLIB=yes
AC_DEFINE(KDRIVEVESA, 1, [Build VESA-based kdrive servers]) AC_DEFINE(KDRIVEVESA, 1, [Build VESA-based kdrive servers])
fi fi
AC_CHECK_HEADERS([linux/fb.h]) AC_CHECK_HEADERS([linux/fb.h])
if test "$ac_cv_header_linux_fb_h" = yes; then if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
XFBDEV=yes
fi
if test "x$XFBDEV" = xyes; then
KDRIVEFBDEVLIB=yes
AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server]) AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
fi fi
# tslib... # tslib...
AC_CHECK_LIB(ts, ts_open, [HAVE_TSLIB="yes"])
if test "x$TSLIB" = xauto && test "x$HAVE_TSLIB" = xyes; then
TSLIB=yes
fi
if test "x$TSLIB" = xyes; then
if ! test "x$HAVE_TSLIB" = xyes; then
AC_MSG_ERROR([tslib must be installed to build the tslib input driver.])
fi
TSLIB_LIBS="-lts"
AC_DEFINE(TSLIB, 1, [Have tslib support])
fi
AC_CHECK_HEADERS([SDL/SDL.h])
if test x"$ac_cv_header_SDL_SDL_h" = xyes && test "x$XSDL" = xauto; then
XSDL=yes
fi
if test x"$XSDL" = xyes; then
# PKG_CHECK_MODULES(XSDL_EXTRA, Xfont xau $XDMCP_MODULES)
AC_DEFINE(XSDLSERVER,1,[Build Xsdl server])
XSDL_LIBS="`sdl-config --libs` $XSERVER_LIBS"
XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
fi
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
if test "x$XEPHYR" = xauto; then
XEPHYR=$xephyr
fi
# Xephyr needs nanosleep() which is in librt on Solaris
AC_CHECK_FUNC([nanosleep], [],
AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
if test "x$TSLIB" = xyes; then if test "x$TSLIB" = xyes; then
PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"]) PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
if test "x$HAVE_TSLIB" = xno; then if test "x$HAVE_TSLIB" = xno; then
@ -1473,47 +1625,44 @@ if test "$KDRIVE" = yes; then
# $MIEXT_SHADOW_LIB $XPSTUBS_LIB" # $MIEXT_SHADOW_LIB $XPSTUBS_LIB"
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB" KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a' KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
case $host_os in
*linux*)
KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a' KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
KDRIVELINUX=yes
;;
esac
KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a' KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a'
KDRIVE_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB $TSLIB_LIBS" KDRIVE_LIBS="$XSERVERLIBS_LIBS $DIX_LIB $CONFIG_LIB $KDRIVE_LIB $TSLIB_LIBS $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB"
# check if we can build Xephyr # check if we can build Xephyr
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"]) PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
# check for SDL SDK # Xephyr needs nanosleep() which is in librt on Solaris
AC_CHECK_HEADERS([SDL/SDL.h]) AC_CHECK_FUNC([nanosleep], [],
if test "x$XSDL" = xauto; then
XSDL="$ac_cv_header_SDL_SDL_h"
fi
fi
AC_SUBST(KDRIVE_INCS)
AC_SUBST(KDRIVE_PURE_INCS)
AC_SUBST(KDRIVE_CFLAGS)
AC_SUBST(KDRIVE_PURE_LIBS)
AC_SUBST(KDRIVE_LIBS)
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(H3600_TS, false)
AM_CONDITIONAL(KDRIVEVESA, [test x"$ac_cv_header_sys_vm86_h" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test x"$ac_cv_header_linux_fb_h" = xyes])
# Xephyr needs nanosleep() which is in librt on Solaris
AC_CHECK_FUNC([nanosleep], [],
AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt")) AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
AM_CONDITIONAL(XEPHYR, [test x"$xephyr" = xyes]) AC_SUBST([XEPHYR_LIBS])
XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS" AC_SUBST([XEPHYR_INCS])
AC_SUBST([XEPHYR_LIBS]) AC_SUBST([XSDL_LIBS])
AC_SUBST([XEPHYR_INCS]) AC_SUBST([XSDL_INCS])
if test x"$XSDL" = xyes; then
AC_DEFINE(XSDLSERVER,,[Build Xsdl server])
XSDL_LIBS="`sdl-config --libs` $XSERVER_LIBS"
XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
fi fi
AC_SUBST([KDRIVE_INCS])
AC_SUBST([KDRIVE_PURE_INCS])
AC_SUBST([KDRIVE_CFLAGS])
AC_SUBST([KDRIVE_PURE_LIBS])
AC_SUBST([KDRIVE_LIBS])
AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(H3600_TS, false)
AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes]) AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
AC_SUBST([XSDL_LIBS]) AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
AC_SUBST([XSDL_INCS]) AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
AM_CONDITIONAL(KDRIVEVESA, [test x"$ac_cv_header_sys_vm86_h" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test x"$ac_cv_header_linux_fb_h" = xyes])
dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers) dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules]) AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules])
@ -1521,7 +1670,6 @@ AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir]) AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir])
# Make sure XKM_OUTPUT_DIR is an absolute path # Make sure XKM_OUTPUT_DIR is an absolute path
XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1` XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
@ -1539,7 +1687,6 @@ AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
AC_SUBST(XKB_COMPILED_DIR) AC_SUBST(XKB_COMPILED_DIR)
dnl and the rest of these are generic, so they're in config.h dnl and the rest of these are generic, so they're in config.h
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
AC_DEFINE(XResExtension, 1, [Build XRes extension]) AC_DEFINE(XResExtension, 1, [Build XRes extension])
dnl CYGWIN does not define fd_set if _POSIX_SOURCE is defined dnl CYGWIN does not define fd_set if _POSIX_SOURCE is defined
@ -1560,14 +1707,16 @@ esac
AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix]) AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
dnl xorgconfig CLI configuration utility dnl xorgconfig CLI configuration utility
PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11]) if test "x$XORG" = xyes; then
AC_SUBST(XORGCONFIG_DEP_CFLAGS) PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11])
AC_SUBST(XORGCONFIG_DEP_LIBS) AC_SUBST(XORGCONFIG_DEP_CFLAGS)
AC_SUBST(XORGCONFIG_DEP_LIBS)
fi
dnl xorgcfg GUI configuration utility dnl xorgcfg GUI configuration utility
AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg], AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg],
[Build xorgcfg GUI configuration utility (default: yes)]), [Build xorgcfg GUI configuration utility (default: no)]),
[XORGCFG=$enableval],[XORGCFG=yes]) [XORGCFG=$enableval],[XORGCFG=no])
if test x$XORGCFG = xyes ; then if test x$XORGCFG = xyes ; then
PKG_CHECK_MODULES([XORGCFG_DEP], PKG_CHECK_MODULES([XORGCFG_DEP],
[xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11]) [xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11])
@ -1654,6 +1803,7 @@ XTrap/Makefile
mfb/Makefile mfb/Makefile
cfb/Makefile cfb/Makefile
cfb32/Makefile cfb32/Makefile
config/Makefile
mi/Makefile mi/Makefile
miext/Makefile miext/Makefile
miext/damage/Makefile miext/damage/Makefile
@ -1689,7 +1839,6 @@ hw/xfree86/loader/Makefile
hw/xfree86/os-support/Makefile hw/xfree86/os-support/Makefile
hw/xfree86/os-support/bsd/Makefile hw/xfree86/os-support/bsd/Makefile
hw/xfree86/os-support/bus/Makefile hw/xfree86/os-support/bus/Makefile
hw/xfree86/os-support/drm/Makefile
hw/xfree86/os-support/hurd/Makefile hw/xfree86/os-support/hurd/Makefile
hw/xfree86/os-support/misc/Makefile hw/xfree86/os-support/misc/Makefile
hw/xfree86/os-support/linux/Makefile hw/xfree86/os-support/linux/Makefile

View File

@ -17,6 +17,7 @@ libdix_la_SOURCES = \
extension.c \ extension.c \
ffs.c \ ffs.c \
gc.c \ gc.c \
getevents.c \
globals.c \ globals.c \
glyphcurs.c \ glyphcurs.c \
grabs.c \ grabs.c \
@ -37,4 +38,22 @@ libxpstubs_la_SOURCES = \
INCLUDES = -I$(top_srcdir)/Xprint INCLUDES = -I$(top_srcdir)/Xprint
EXTRA_DIST = buildatoms BuiltInAtoms CHANGES EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in
if XSERVER_DTRACE
# Generate dtrace header file for C sources to include
BUILT_SOURCES = Xserver-dtrace.h
Xserver-dtrace.h: $(srcdir)/Xserver.d
$(DTRACE) -C -h -o $@ -s $(srcdir)/Xserver.d \
|| cp Xserver-dtrace.h.in $@
# Generate dtrace object code for probes in libdix
dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o
noinst_LIBRARIES = dix.O
dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS)
ld -r -o $@ .libs/*.o
endif

100
dix/Xserver-dtrace.h.in Normal file
View File

@ -0,0 +1,100 @@
/* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR 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.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* of the copyright holder.
*/
/*
* Generated by dtrace(1M), and then modified for backwards compatibility
* with older versions of dtrace. Used if dtrace -h fails.
* (Since _ENABLED support was added after dtrace -h, this assumes if
* dtrace -h fails, _ENABLED will too.)
*/
#ifndef _XSERVER_DTRACE_H
#define _XSERVER_DTRACE_H
#include <unistd.h>
#ifdef __cplusplus
extern "C" {
#endif
#if _DTRACE_VERSION
#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
__dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
__dtrace_Xserver___client__connect(arg0, arg1)
#define XSERVER_CLIENT_DISCONNECT(arg0) \
__dtrace_Xserver___client__disconnect(arg0)
#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
__dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
__dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
__dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
__dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
__dtrace_Xserver___send__event(arg0, arg1, arg2)
extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
extern void __dtrace_Xserver___client__connect(int, int);
extern void __dtrace_Xserver___client__disconnect(int);
extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
#else
#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
#define XSERVER_CLIENT_CONNECT(arg0, arg1)
#define XSERVER_CLIENT_DISCONNECT(arg0)
#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
#endif
#define XSERVER_CLIENT_AUTH_ENABLED() (1)
#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
#define XSERVER_REQUEST_DONE_ENABLED() (1)
#define XSERVER_REQUEST_START_ENABLED() (1)
#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
#define XSERVER_RESOURCE_FREE_ENABLED() (1)
#define XSERVER_SEND_EVENT_ENABLED() (1)
#ifdef __cplusplus
}
#endif
#endif /* _XSERVER_DTRACE_H */

59
dix/Xserver.d Normal file
View File

@ -0,0 +1,59 @@
/* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR 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.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* of the copyright holder.
*/
/*
* Xserver dtrace provider definition
*/
#include <sys/types.h>
provider Xserver {
/* reqType, data, length, client id, request buffer */
probe request__start(string, uint8_t, uint16_t, int, void *);
/* reqType, data, sequence, client id, result */
probe request__done(string, uint8_t, uint32_t, int, int);
/* client id, client fd */
probe client__connect(int, int);
/* client id, client address, client pid, client zone id */
probe client__auth(int, string, pid_t, zoneid_t);
/* client id */
probe client__disconnect(int);
/* resource id, resource type, value, resource type name */
probe resource__alloc(uint32_t, uint32_t, void *, string);
/* resource id, resource type, value, resource type name */
probe resource__free(uint32_t, uint32_t, void *, string);
/* client id, event type, event* */
probe send__event(int, uint8_t, void *);
};
#pragma D attributes Unstable/Unstable/Common provider Xserver provider
#pragma D attributes Private/Private/Unknown provider Xserver module
#pragma D attributes Private/Private/Unknown provider Xserver function
#pragma D attributes Unstable/Unstable/Common provider Xserver name
#pragma D attributes Unstable/Unstable/Common provider Xserver args

File diff suppressed because it is too large Load Diff

View File

@ -74,6 +74,36 @@ Equipment Corporation.
******************************************************************/ ******************************************************************/
/* XSERVER_DTRACE additions:
* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR 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.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* of the copyright holder.
*/
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
@ -100,12 +130,13 @@ int ProcInitialConnection();
#include "dispatch.h" #include "dispatch.h"
#include "swaprep.h" #include "swaprep.h"
#include "swapreq.h" #include "swapreq.h"
#include "config.h"
#ifdef PANORAMIX #ifdef PANORAMIX
#include "panoramiX.h" #include "panoramiX.h"
#include "panoramiXsrv.h" #include "panoramiXsrv.h"
#endif #endif
#ifdef XCSECURITY #ifdef XACE
#include "securitysrv.h" #include "xace.h"
#endif #endif
#ifdef XAPPGROUP #ifdef XAPPGROUP
#include "appgroup.h" #include "appgroup.h"
@ -118,6 +149,17 @@ int ProcInitialConnection();
#include <X11/extensions/XKBsrv.h> #include <X11/extensions/XKBsrv.h>
#endif #endif
#ifdef XSERVER_DTRACE
#include <sys/types.h>
typedef const char *string;
#include "Xserver-dtrace.h"
char *RequestNames[256];
static void LoadRequestNames(void);
static void FreeRequestNames(void);
#define GetRequestName(i) (RequestNames[i])
#endif
#define mskcnt ((MAXCLIENTS + 31) / 32) #define mskcnt ((MAXCLIENTS + 31) / 32)
#define BITMASK(i) (1U << ((i) & 31)) #define BITMASK(i) (1U << ((i) & 31))
#define MASKIDX(i) ((i) >> 5) #define MASKIDX(i) ((i) >> 5)
@ -372,6 +414,10 @@ Dispatch(void)
if (!clientReady) if (!clientReady)
return; return;
#ifdef XSERVER_DTRACE
LoadRequestNames();
#endif
while (!dispatchException) while (!dispatchException)
{ {
if (*icheck[0] != *icheck[1]) if (*icheck[0] != *icheck[1])
@ -382,6 +428,9 @@ Dispatch(void)
nready = WaitForSomething(clientReady); nready = WaitForSomething(clientReady);
/* this is an enormous hack and NEEDS TO GO AWAY. */
configDispatch();
#ifdef SMART_SCHEDULE #ifdef SMART_SCHEDULE
if (nready && !SmartScheduleDisable) if (nready && !SmartScheduleDisable)
{ {
@ -447,11 +496,28 @@ Dispatch(void)
client->requestLogIndex = 0; client->requestLogIndex = 0;
client->requestLog[client->requestLogIndex] = MAJOROP; client->requestLog[client->requestLogIndex] = MAJOROP;
client->requestLogIndex++; client->requestLogIndex++;
#endif
#ifdef XSERVER_DTRACE
XSERVER_REQUEST_START(GetRequestName(MAJOROP), MAJOROP,
((xReq *)client->requestBuffer)->length,
client->index, client->requestBuffer);
#endif #endif
if (result > (maxBigRequestSize << 2)) if (result > (maxBigRequestSize << 2))
result = BadLength; result = BadLength;
else else
#ifdef XACE
{
XaceHook(XACE_AUDIT_BEGIN, client);
result = (* client->requestVector[MAJOROP])(client); result = (* client->requestVector[MAJOROP])(client);
XaceHook(XACE_AUDIT_END, client, result);
}
#else
result = (* client->requestVector[MAJOROP])(client);
#endif /* XACE */
#ifdef XSERVER_DTRACE
XSERVER_REQUEST_DONE(GetRequestName(MAJOROP), MAJOROP,
client->sequence, client->index, result);
#endif
if (result != Success) if (result != Success)
{ {
@ -483,6 +549,9 @@ Dispatch(void)
KillAllClients(); KillAllClients();
DEALLOCATE_LOCAL(clientReady); DEALLOCATE_LOCAL(clientReady);
dispatchException &= ~DE_RESET; dispatchException &= ~DE_RESET;
#ifdef XSERVER_DTRACE
FreeRequestNames();
#endif
} }
#undef MAJOROP #undef MAJOROP
@ -1099,11 +1168,10 @@ ProcConvertSelection(register ClientPtr client)
CurrentSelections[i].selection != stuff->selection) i++; CurrentSelections[i].selection != stuff->selection) i++;
if ((i < NumCurrentSelections) && if ((i < NumCurrentSelections) &&
(CurrentSelections[i].window != None) (CurrentSelections[i].window != None)
#ifdef XCSECURITY #ifdef XACE
&& (!client->CheckAccess || && XaceHook(XACE_RESOURCE_ACCESS, client,
(* client->CheckAccess)(client, CurrentSelections[i].window, CurrentSelections[i].window, RT_WINDOW,
RT_WINDOW, SecurityReadAccess, SecurityReadAccess, CurrentSelections[i].pWin)
CurrentSelections[i].pWin))
#endif #endif
) )
{ {
@ -2095,7 +2163,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
Mask plane = 0; Mask plane = 0;
char *pBuf; char *pBuf;
xGetImageReply xgi; xGetImageReply xgi;
#ifdef XCSECURITY #ifdef XACE
RegionPtr pVisibleRegion = NULL; RegionPtr pVisibleRegion = NULL;
#endif #endif
@ -2201,9 +2269,9 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
} }
#ifdef XCSECURITY #ifdef XACE
if (client->trustLevel != XSecurityClientTrusted && if (pDraw->type == DRAWABLE_WINDOW &&
pDraw->type == DRAWABLE_WINDOW) !XaceHook(XACE_DRAWABLE_ACCESS, client, pDraw))
{ {
pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw); pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw);
if (pVisibleRegion) if (pVisibleRegion)
@ -2231,9 +2299,9 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
format, format,
planemask, planemask,
(pointer) pBuf); (pointer) pBuf);
#ifdef XCSECURITY #ifdef XACE
if (pVisibleRegion) if (pVisibleRegion)
SecurityCensorImage(client, pVisibleRegion, widthBytesLine, XaceCensorImage(client, pVisibleRegion, widthBytesLine,
pDraw, x, y + linesDone, width, pDraw, x, y + linesDone, width,
nlines, format, pBuf); nlines, format, pBuf);
#endif #endif
@ -2272,9 +2340,9 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
format, format,
plane, plane,
(pointer)pBuf); (pointer)pBuf);
#ifdef XCSECURITY #ifdef XACE
if (pVisibleRegion) if (pVisibleRegion)
SecurityCensorImage(client, pVisibleRegion, XaceCensorImage(client, pVisibleRegion,
widthBytesLine, widthBytesLine,
pDraw, x, y + linesDone, width, pDraw, x, y + linesDone, width,
nlines, format, pBuf); nlines, format, pBuf);
@ -2300,7 +2368,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
} }
} }
} }
#ifdef XCSECURITY #ifdef XACE
if (pVisibleRegion) if (pVisibleRegion)
REGION_DESTROY(pDraw->pScreen, pVisibleRegion); REGION_DESTROY(pDraw->pScreen, pVisibleRegion);
#endif #endif
@ -2452,7 +2520,7 @@ ProcCreateColormap(register ClientPtr client)
return(result); return(result);
} }
client->errorValue = stuff->visual; client->errorValue = stuff->visual;
return(BadValue); return(BadMatch);
} }
int int
@ -3274,11 +3342,10 @@ ProcListHosts(register ClientPtr client)
/* REQUEST(xListHostsReq); */ /* REQUEST(xListHostsReq); */
REQUEST_SIZE_MATCH(xListHostsReq); REQUEST_SIZE_MATCH(xListHostsReq);
#ifdef XCSECURITY #ifdef XACE
/* untrusted clients can't list hosts */ /* untrusted clients can't list hosts */
if (client->trustLevel != XSecurityClientTrusted) if (!XaceHook(XACE_HOSTLIST_ACCESS, client, SecurityReadAccess))
{ {
SecurityAudit("client %d attempted to list hosts\n", client->index);
return BadAccess; return BadAccess;
} }
#endif #endif
@ -3559,6 +3626,9 @@ CloseDownClient(register ClientPtr client)
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo); CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
} }
FreeClientResources(client); FreeClientResources(client);
#ifdef XSERVER_DTRACE
XSERVER_CLIENT_DISCONNECT(client->index);
#endif
if (client->index < nextFreeClientID) if (client->index < nextFreeClientID)
nextFreeClientID = client->index; nextFreeClientID = client->index;
clients[client->index] = NullClient; clients[client->index] = NullClient;
@ -3606,6 +3676,10 @@ CloseDownRetainedResources()
} }
} }
extern int clientPrivateLen;
extern unsigned *clientPrivateSizes;
extern unsigned totalClientSize;
void InitClient(ClientPtr client, int i, pointer ospriv) void InitClient(ClientPtr client, int i, pointer ospriv)
{ {
client->index = i; client->index = i;
@ -3646,11 +3720,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
} }
#endif #endif
client->replyBytesRemaining = 0; client->replyBytesRemaining = 0;
#ifdef XCSECURITY
client->trustLevel = XSecurityClientTrusted;
client->CheckAccess = NULL;
client->authId = 0;
#endif
#ifdef XAPPGROUP #ifdef XAPPGROUP
client->appgroup = NULL; client->appgroup = NULL;
#endif #endif
@ -3663,10 +3732,6 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
#endif #endif
} }
extern int clientPrivateLen;
extern unsigned *clientPrivateSizes;
extern unsigned totalClientSize;
int int
InitClientPrivates(ClientPtr client) InitClientPrivates(ClientPtr client)
{ {
@ -3699,6 +3764,17 @@ InitClientPrivates(ClientPtr client)
else else
ppriv->ptr = (pointer)NULL; ppriv->ptr = (pointer)NULL;
} }
/* Allow registrants to initialize the serverClient devPrivates */
if (!client->index && ClientStateCallback)
{
NewClientInfoRec clientinfo;
clientinfo.client = client;
clientinfo.prefix = (xConnSetupPrefix *)NULL;
clientinfo.setup = (xConnSetup *) NULL;
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
}
return 1; return 1;
} }
@ -3978,3 +4054,60 @@ MarkClientException(ClientPtr client)
{ {
client->noClientException = -1; client->noClientException = -1;
} }
#ifdef XSERVER_DTRACE
#include <ctype.h>
/* Load table of request names for dtrace probes */
static void LoadRequestNames(void)
{
int i;
FILE *xedb;
extern void LoadExtensionNames(char **RequestNames);
bzero(RequestNames, 256 * sizeof(char *));
xedb = fopen(XERRORDB_PATH, "r");
if (xedb != NULL) {
char buf[256];
while (fgets(buf, sizeof(buf), xedb)) {
if ((strncmp("XRequest.", buf, 9) == 0) && (isdigit(buf[9]))) {
char *name;
i = strtol(buf + 9, &name, 10);
if (RequestNames[i] == 0) {
char *end = strchr(name, '\n');
if (end) { *end = '\0'; }
RequestNames[i] = strdup(name + 1);
}
}
}
fclose(xedb);
}
LoadExtensionNames(RequestNames);
for (i = 0; i < 256; i++) {
if (RequestNames[i] == 0) {
#define RN_SIZE 12 /* "Request#' + up to 3 digits + \0 */
RequestNames[i] = xalloc(RN_SIZE);
if (RequestNames[i]) {
snprintf(RequestNames[i], RN_SIZE, "Request#%d", i);
}
}
/* fprintf(stderr, "%d: %s\n", i, RequestNames[i]); */
}
}
static void FreeRequestNames(void)
{
int i;
for (i = 0; i < 256; i++) {
if (RequestNames[i] != 0) {
free(RequestNames[i]);
RequestNames[i] = 0;
}
}
}
#endif

View File

@ -155,11 +155,6 @@ QueueFontWakeup(FontPathElementPtr fpe)
for (i = 0; i < num_slept_fpes; i++) { for (i = 0; i < num_slept_fpes; i++) {
if (slept_fpes[i] == fpe) { if (slept_fpes[i] == fpe) {
#ifdef DEBUG
fprintf(stderr, "re-queueing fpe wakeup\n");
#endif
return; return;
} }
} }
@ -1886,7 +1881,7 @@ InitFonts ()
{ {
patternCache = MakeFontPatternCache(); patternCache = MakeFontPatternCache();
#ifndef KDRIVESERVER #ifndef BUILTIN_FONTS
if (screenInfo.numScreens > screenInfo.numVideoScreens) { if (screenInfo.numScreens > screenInfo.numVideoScreens) {
PrinterFontRegisterFpeFunctions(); PrinterFontRegisterFpeFunctions();
FontFileCheckRegisterFpeFunctions(); FontFileCheckRegisterFpeFunctions();
@ -1894,10 +1889,11 @@ InitFonts ()
} else } else
#endif #endif
{ {
#ifdef KDRIVESERVER #ifdef BUILTIN_FONTS
BuiltinRegisterFpeFunctions(); BuiltinRegisterFpeFunctions();
#endif #else
FontFileRegisterFpeFunctions(); FontFileRegisterFpeFunctions();
#endif
#ifndef NOFONTSERVERACCESS #ifndef NOFONTSERVERACCESS
fs_register_fpe_functions(); fs_register_fpe_functions();
#endif #endif
@ -2059,11 +2055,6 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
fs_handlers_installed = 0; fs_handlers_installed = 0;
} }
if (fs_handlers_installed == 0) { if (fs_handlers_installed == 0) {
#ifdef DEBUG
fprintf(stderr, "adding FS b & w handlers\n");
#endif
if (!RegisterBlockAndWakeupHandlers(block_handler, if (!RegisterBlockAndWakeupHandlers(block_handler,
FontWakeup, (pointer) 0)) FontWakeup, (pointer) 0))
return AllocError; return AllocError;
@ -2079,55 +2070,9 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bo
if (all) { if (all) {
/* remove the handlers if no one else is using them */ /* remove the handlers if no one else is using them */
if (--fs_handlers_installed == 0) { if (--fs_handlers_installed == 0) {
#ifdef DEBUG
fprintf(stderr, "removing FS b & w handlers\n");
#endif
RemoveBlockAndWakeupHandlers(block_handler, FontWakeup, RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
(pointer) 0); (pointer) 0);
} }
} }
RemoveFontWakeup(fpe); RemoveFontWakeup(fpe);
} }
#ifdef DEBUG
#define GLWIDTHBYTESPADDED(bits,nbytes) \
((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
:(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
:(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
:(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
: 0)
#define GLYPH_SIZE(ch, nbytes) \
GLWIDTHBYTESPADDED((ch)->metrics.rightSideBearing - \
(ch)->metrics.leftSideBearing, (nbytes))
void
dump_char_ascii(CharInfoPtr cip)
{
int r,
l;
int bpr;
int byte;
static unsigned maskTab[] = {
(1 << 7), (1 << 6), (1 << 5), (1 << 4),
(1 << 3), (1 << 2), (1 << 1), (1 << 0),
};
bpr = GLYPH_SIZE(cip, 4);
for (r = 0; r < (cip->metrics.ascent + cip->metrics.descent); r++) {
pointer row = (pointer) cip->bits + r * bpr;
byte = 0;
for (l = 0; l <= (cip->metrics.rightSideBearing -
cip->metrics.leftSideBearing); l++) {
if (maskTab[l & 7] & row[l >> 3])
putchar('X');
else
putchar('.');
}
putchar('\n');
}
}
#endif

View File

@ -95,8 +95,8 @@ Author: Adobe Systems Incorporated
#include "scrnintstr.h" #include "scrnintstr.h"
#define XK_LATIN1 #define XK_LATIN1
#include <X11/keysymdef.h> #include <X11/keysymdef.h>
#ifdef XCSECURITY #ifdef XACE
#include "securitysrv.h" #include "xace.h"
#endif #endif
/* /*
@ -196,7 +196,7 @@ CompareISOLatin1Lowered(unsigned char *s1, int s1len,
return (int) c1 - (int) c2; return (int) c1 - (int) c2;
} }
#ifdef XCSECURITY #ifdef XACE
/* SecurityLookupWindow and SecurityLookupDrawable: /* SecurityLookupWindow and SecurityLookupDrawable:
* Look up the window/drawable taking into account the client doing * Look up the window/drawable taking into account the client doing
@ -204,32 +204,16 @@ CompareISOLatin1Lowered(unsigned char *s1, int s1len,
* if it exists and the client is allowed access, else return NULL. * if it exists and the client is allowed access, else return NULL.
* Most Proc* functions should be calling these instead of * Most Proc* functions should be calling these instead of
* LookupWindow and LookupDrawable, which do no access checks. * LookupWindow and LookupDrawable, which do no access checks.
* XACE note: need to see if client->lastDrawableID can still be used here.
*/ */
_X_EXPORT WindowPtr _X_EXPORT WindowPtr
SecurityLookupWindow(XID rid, ClientPtr client, Mask access_mode) SecurityLookupWindow(XID rid, ClientPtr client, Mask access_mode)
{ {
WindowPtr pWin;
client->errorValue = rid; client->errorValue = rid;
if(rid == INVALID) if(rid == INVALID)
return NULL; return NULL;
if (client->trustLevel != XSecurityClientTrusted)
return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode); return (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode);
if (client->lastDrawableID == rid)
{
if (client->lastDrawable->type == DRAWABLE_WINDOW)
return ((WindowPtr) client->lastDrawable);
return (WindowPtr) NULL;
}
pWin = (WindowPtr)SecurityLookupIDByType(client, rid, RT_WINDOW, access_mode);
if (pWin && pWin->drawable.type == DRAWABLE_WINDOW) {
client->lastDrawable = (DrawablePtr) pWin;
client->lastDrawableID = rid;
client->lastGCID = INVALID;
client->lastGC = (GCPtr)NULL;
}
return pWin;
} }
@ -240,11 +224,6 @@ SecurityLookupDrawable(XID rid, ClientPtr client, Mask access_mode)
if(rid == INVALID) if(rid == INVALID)
return (pointer) NULL; return (pointer) NULL;
if (client->trustLevel != XSecurityClientTrusted)
return (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE,
access_mode);
if (client->lastDrawableID == rid)
return ((pointer) client->lastDrawable);
pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE, pDraw = (DrawablePtr)SecurityLookupIDByClass(client, rid, RC_DRAWABLE,
access_mode); access_mode);
if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW)) if (pDraw && (pDraw->type != UNDRAWABLE_WINDOW))
@ -268,7 +247,7 @@ LookupDrawable(XID rid, ClientPtr client)
return SecurityLookupDrawable(rid, client, SecurityUnknownAccess); return SecurityLookupDrawable(rid, client, SecurityUnknownAccess);
} }
#else /* not XCSECURITY */ #else /* not XACE */
WindowPtr WindowPtr
LookupWindow(XID rid, ClientPtr client) LookupWindow(XID rid, ClientPtr client)
@ -310,7 +289,7 @@ LookupDrawable(XID rid, ClientPtr client)
return (pointer)NULL; return (pointer)NULL;
} }
#endif /* XCSECURITY */ #endif /* XACE */
_X_EXPORT ClientPtr _X_EXPORT ClientPtr
LookupClient(XID rid, ClientPtr client) LookupClient(XID rid, ClientPtr client)

View File

@ -113,6 +113,7 @@ of the copyright holder.
#endif #endif
#include <X11/X.h> #include <X11/X.h>
#include <X11/keysym.h>
#include "misc.h" #include "misc.h"
#include "resource.h" #include "resource.h"
#define NEED_EVENTS #define NEED_EVENTS
@ -131,12 +132,19 @@ of the copyright holder.
#include "globals.h" #include "globals.h"
#ifdef XKB #ifdef XKB
#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h> #include <X11/extensions/XKBsrv.h>
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#endif #endif
#ifdef XCSECURITY #ifdef XACE
#include "securitysrv.h" #include "xace.h"
#endif
#ifdef XSERVER_DTRACE
#include <sys/types.h>
typedef const char *string;
#include "Xserver-dtrace.h"
#endif #endif
#ifdef XEVIE #ifdef XEVIE
@ -154,7 +162,9 @@ xEvent *xeviexE;
#endif #endif
#include <X11/extensions/XIproto.h> #include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h" #include "exevents.h"
#include "exglobals.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "dixevents.h" #include "dixevents.h"
@ -206,9 +216,6 @@ _X_EXPORT CallbackListPtr DeviceEventCallback;
Mask DontPropagateMasks[DNPMCOUNT]; Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT]; static int DontPropagateRefCnts[DNPMCOUNT];
#ifdef DEBUG
static debug_events = 0;
#endif
_X_EXPORT InputInfo inputInfo; _X_EXPORT InputInfo inputInfo;
static struct { static struct {
@ -319,11 +326,16 @@ static CARD8 criticalEvents[32] =
}; };
#ifdef PANORAMIX #ifdef PANORAMIX
static void ConfineToShape(RegionPtr shape, int *px, int *py); static void ConfineToShape(RegionPtr shape, int *px, int *py);
static void SyntheticMotion(int x, int y);
static void PostNewCursor(void); static void PostNewCursor(void);
#define SyntheticMotion(x, y) \
PostSyntheticMotion(x, y, noPanoramiXExtension ? 0 : \
sprite.screen->myNum, \
syncEvents.playingEvents ? \
syncEvents.time.milliseconds : \
currentTime.milliseconds);
static Bool static Bool
XineramaSetCursorPosition( XineramaSetCursorPosition(
int x, int x,
@ -666,30 +678,6 @@ SetCriticalEvent(int event)
criticalEvents[event >> 3] |= 1 << (event & 7); criticalEvents[event >> 3] |= 1 << (event & 7);
} }
static void
SyntheticMotion(int x, int y)
{
xEvent xE;
#ifdef PANORAMIX
/* Translate back to the sprite screen since processInputProc
will translate from sprite screen to screen 0 upon reentry
to the DIX layer */
if(!noPanoramiXExtension) {
x += panoramiXdataPtr[0].x - panoramiXdataPtr[sprite.screen->myNum].x;
y += panoramiXdataPtr[0].y - panoramiXdataPtr[sprite.screen->myNum].y;
}
#endif
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
if (syncEvents.playingEvents)
xE.u.keyButtonPointer.time = syncEvents.time.milliseconds;
else
xE.u.keyButtonPointer.time = currentTime.milliseconds;
xE.u.u.type = MotionNotify;
(*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
}
#ifdef SHAPE #ifdef SHAPE
static void static void
ConfineToShape(RegionPtr shape, int *px, int *py) ConfineToShape(RegionPtr shape, int *px, int *py)
@ -1531,9 +1519,8 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
int i; int i;
int type; int type;
#ifdef DEBUG #ifdef DEBUG_EVENTS
if (debug_events) ErrorF( ErrorF("Event([%d, %d], mask=0x%x), client=%d",
"Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, mask, client->index); pEvents->u.u.type, pEvents->u.u.detail, mask, client->index);
#endif #endif
if ((client) && (client != serverClient) && (!client->clientGone) && if ((client) && (client != serverClient) && (!client->clientGone) &&
@ -1549,9 +1536,9 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
if (WID(inputInfo.pointer->valuator->motionHintWindow) == if (WID(inputInfo.pointer->valuator->motionHintWindow) ==
pEvents->u.keyButtonPointer.event) pEvents->u.keyButtonPointer.event)
{ {
#ifdef DEBUG #ifdef DEBUG_EVENTS
if (debug_events) ErrorF("\n"); ErrorF("\n");
fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n"); ErrorF("motionHintWindow == keyButtonPointer.event\n");
#endif #endif
return 1; /* don't send, but pretend we did */ return 1; /* don't send, but pretend we did */
} }
@ -1589,15 +1576,15 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
} }
WriteEventsToClient(client, count, pEvents); WriteEventsToClient(client, count, pEvents);
#ifdef DEBUG #ifdef DEBUG_EVENTS
if (debug_events) ErrorF( " delivered\n"); ErrorF( " delivered\n");
#endif #endif
return 1; return 1;
} }
else else
{ {
#ifdef DEBUG #ifdef DEBUG_EVENTS
if (debug_events) ErrorF("\n"); ErrorF("\n");
#endif #endif
return 0; return 0;
} }
@ -2476,8 +2463,8 @@ CheckPassiveGrabsOnWindow(
(grab->confineTo->realized && (grab->confineTo->realized &&
BorderSizeNotEmpty(grab->confineTo)))) BorderSizeNotEmpty(grab->confineTo))))
{ {
#ifdef XCSECURITY #ifdef XACE
if (!SecurityCheckDeviceAccess(wClient(pWin), device, FALSE)) if (!XaceHook(XACE_DEVICE_ACCESS, wClient(pWin), device, FALSE))
return FALSE; return FALSE;
#endif #endif
#ifdef XKB #ifdef XKB
@ -2776,13 +2763,6 @@ drawable.id:0;
} }
#endif #endif
#ifdef DEBUG
if ((xkbDebugFlags&0x4)&&
((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
ErrorF("CoreProcessKbdEvent: Key %d %s\n",key,
(xE->u.u.type==KeyPress?"down":"up"));
}
#endif
switch (xE->u.u.type) switch (xE->u.u.type)
{ {
case KeyPress: case KeyPress:
@ -2846,6 +2826,10 @@ drawable.id:0;
DeliverFocusedEvent(keybd, xE, sprite.win, count); DeliverFocusedEvent(keybd, xE, sprite.win, count);
if (deactivateGrab) if (deactivateGrab)
(*keybd->DeactivateGrab)(keybd); (*keybd->DeactivateGrab)(keybd);
#ifdef XACE
XaceHook(XACE_KEY_AVAIL, xE, keybd, count);
#endif
} }
#ifdef XKB #ifdef XKB
@ -2863,13 +2847,12 @@ FixKeyState (register xEvent *xE, register DeviceIntPtr keybd)
key = xE->u.u.detail; key = xE->u.u.detail;
kptr = &keyc->down[key >> 3]; kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7); bit = 1 << (key & 7);
#ifdef DEBUG
if ((xkbDebugFlags&0x4)&& if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) { DebugF("FixKeyState: Key %d %s\n",key,
ErrorF("FixKeyState: Key %d %s\n",key,
(xE->u.u.type==KeyPress?"down":"up")); (xE->u.u.type==KeyPress?"down":"up"));
} }
#endif
switch (xE->u.u.type) switch (xE->u.u.type)
{ {
case KeyPress: case KeyPress:
@ -3097,12 +3080,7 @@ EventSelectForWindow(register WindowPtr pWin, register ClientPtr client, Mask ma
if (wClient (pWin) == client) if (wClient (pWin) == client)
{ {
check = pWin->eventMask; check = pWin->eventMask;
#ifdef SGIMISC
pWin->eventMask =
(mask & ~SGIMiscSpecialDestroyMask) | (pWin->eventMask & SGIMiscSpecialDestroyMask);
#else
pWin->eventMask = mask; pWin->eventMask = mask;
#endif
} }
else else
{ {
@ -3111,9 +3089,6 @@ EventSelectForWindow(register WindowPtr pWin, register ClientPtr client, Mask ma
if (SameClient(others, client)) if (SameClient(others, client))
{ {
check = others->mask; check = others->mask;
#ifdef SGIMISC
mask = (mask & ~SGIMiscSpecialDestroyMask) | (others->mask & SGIMiscSpecialDestroyMask);
#endif
if (mask == 0) if (mask == 0)
{ {
FreeResource(others->resource, RT_NONE); FreeResource(others->resource, RT_NONE);
@ -3279,10 +3254,10 @@ EnterLeaveEvent(
{ {
xKeymapEvent ke; xKeymapEvent ke;
#ifdef XCSECURITY #ifdef XACE
ClientPtr client = grab ? rClient(grab) ClientPtr client = grab ? rClient(grab)
: clients[CLIENT_ID(pWin->drawable.id)]; : clients[CLIENT_ID(pWin->drawable.id)];
if (!SecurityCheckDeviceAccess(client, keybd, FALSE)) if (!XaceHook(XACE_DEVICE_ACCESS, client, keybd, FALSE))
{ {
bzero((char *)&ke.map[0], 31); bzero((char *)&ke.map[0], 31);
} }
@ -3374,9 +3349,9 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr
((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask))
{ {
xKeymapEvent ke; xKeymapEvent ke;
#ifdef XCSECURITY #ifdef XACE
ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)]; ClientPtr client = clients[CLIENT_ID(pWin->drawable.id)];
if (!SecurityCheckDeviceAccess(client, dev, FALSE)) if (!XaceHook(XACE_DEVICE_ACCESS, client, dev, FALSE))
{ {
bzero((char *)&ke.map[0], 31); bzero((char *)&ke.map[0], 31);
} }
@ -3645,8 +3620,8 @@ ProcSetInputFocus(client)
REQUEST(xSetInputFocusReq); REQUEST(xSetInputFocusReq);
REQUEST_SIZE_MATCH(xSetInputFocusReq); REQUEST_SIZE_MATCH(xSetInputFocusReq);
#ifdef XCSECURITY #ifdef XACE
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
return Success; return Success;
#endif #endif
return SetInputFocus(client, inputInfo.keyboard, stuff->focus, return SetInputFocus(client, inputInfo.keyboard, stuff->focus,
@ -3910,8 +3885,8 @@ ProcGrabKeyboard(ClientPtr client)
int result; int result;
REQUEST_SIZE_MATCH(xGrabKeyboardReq); REQUEST_SIZE_MATCH(xGrabKeyboardReq);
#ifdef XCSECURITY #ifdef XACE
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) if (!XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, TRUE))
{ {
result = Success; result = Success;
rep.status = AlreadyGrabbed; rep.status = AlreadyGrabbed;
@ -4576,6 +4551,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
eventinfo.count = count; eventinfo.count = count;
CallCallbacks(&EventCallback, (pointer)&eventinfo); CallCallbacks(&EventCallback, (pointer)&eventinfo);
} }
#ifdef XSERVER_DTRACE
if (XSERVER_SEND_EVENT_ENABLED()) {
for (i = 0; i < count; i++)
{
XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]);
}
}
#endif
if(pClient->swapped) if(pClient->swapped)
{ {
for(i = 0; i < count; i++) for(i = 0; i < count; i++)

View File

@ -59,8 +59,8 @@ SOFTWARE.
#include "gcstruct.h" #include "gcstruct.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "dispatch.h" #include "dispatch.h"
#ifdef XCSECURITY #ifdef XACE
#include "securitysrv.h" #include "xace.h"
#endif #endif
#define EXTENSION_BASE 128 #define EXTENSION_BASE 128
@ -76,6 +76,39 @@ int lastEvent = EXTENSION_EVENT_BASE;
static int lastError = FirstExtensionError; static int lastError = FirstExtensionError;
static unsigned int NumExtensions = 0; static unsigned int NumExtensions = 0;
extern int extensionPrivateLen;
extern unsigned *extensionPrivateSizes;
extern unsigned totalExtensionSize;
static void
InitExtensionPrivates(ExtensionEntry *ext)
{
register char *ptr;
DevUnion *ppriv;
register unsigned *sizes;
register unsigned size;
register int i;
if (totalExtensionSize == sizeof(ExtensionEntry))
ppriv = (DevUnion *)NULL;
else
ppriv = (DevUnion *)(ext + 1);
ext->devPrivates = ppriv;
sizes = extensionPrivateSizes;
ptr = (char *)(ppriv + extensionPrivateLen);
for (i = extensionPrivateLen; --i >= 0; ppriv++, sizes++)
{
if ( (size = *sizes) )
{
ppriv->ptr = (pointer)ptr;
ptr += size;
}
else
ppriv->ptr = (pointer)NULL;
}
}
_X_EXPORT ExtensionEntry * _X_EXPORT ExtensionEntry *
AddExtension(char *name, int NumEvents, int NumErrors, AddExtension(char *name, int NumEvents, int NumErrors,
int (*MainProc)(ClientPtr c1), int (*MainProc)(ClientPtr c1),
@ -92,9 +125,11 @@ AddExtension(char *name, int NumEvents, int NumErrors,
(unsigned)(lastError + NumErrors > LAST_ERROR)) (unsigned)(lastError + NumErrors > LAST_ERROR))
return((ExtensionEntry *) NULL); return((ExtensionEntry *) NULL);
ext = (ExtensionEntry *) xalloc(sizeof(ExtensionEntry)); ext = (ExtensionEntry *) xalloc(totalExtensionSize);
if (!ext) if (!ext)
return((ExtensionEntry *) NULL); return((ExtensionEntry *) NULL);
bzero(ext, totalExtensionSize);
InitExtensionPrivates(ext);
ext->name = (char *)xalloc(strlen(name) + 1); ext->name = (char *)xalloc(strlen(name) + 1);
ext->num_aliases = 0; ext->num_aliases = 0;
ext->aliases = (char **)NULL; ext->aliases = (char **)NULL;
@ -144,9 +179,6 @@ AddExtension(char *name, int NumEvents, int NumErrors,
ext->errorBase = 0; ext->errorBase = 0;
ext->errorLast = 0; ext->errorLast = 0;
} }
#ifdef XCSECURITY
ext->secure = FALSE;
#endif
return(ext); return(ext);
} }
@ -207,26 +239,27 @@ CheckExtension(const char *extname)
return NULL; return NULL;
} }
/*
* Added as part of Xace.
*/
ExtensionEntry *
GetExtensionEntry(int major)
{
if (major < EXTENSION_BASE)
return NULL;
major -= EXTENSION_BASE;
if (major >= NumExtensions)
return NULL;
return extensions[major];
}
_X_EXPORT void _X_EXPORT void
DeclareExtensionSecurity(char *extname, Bool secure) DeclareExtensionSecurity(char *extname, Bool secure)
{ {
#ifdef XCSECURITY #ifdef XACE
int i = FindExtension(extname, strlen(extname)); int i = FindExtension(extname, strlen(extname));
if (i >= 0) if (i >= 0)
{ XaceHook(XACE_DECLARE_EXT_SECURE, extensions[i], secure);
int majorop = extensions[i]->base;
extensions[i]->secure = secure;
if (secure)
{
UntrustedProcVector[majorop] = ProcVector[majorop];
SwappedUntrustedProcVector[majorop] = SwappedProcVector[majorop];
}
else
{
UntrustedProcVector[majorop] = ProcBadRequest;
SwappedUntrustedProcVector[majorop] = ProcBadRequest;
}
}
#endif #endif
} }
@ -304,10 +337,9 @@ ProcQueryExtension(ClientPtr client)
{ {
i = FindExtension((char *)&stuff[1], stuff->nbytes); i = FindExtension((char *)&stuff[1], stuff->nbytes);
if (i < 0 if (i < 0
#ifdef XCSECURITY #ifdef XACE
/* don't show insecure extensions to untrusted clients */ /* call callbacks to find out whether to show extension */
|| (client->trustLevel == XSecurityClientUntrusted && || !XaceHook(XACE_EXT_ACCESS, client, extensions[i])
!extensions[i]->secure)
#endif #endif
) )
reply.present = xFalse; reply.present = xFalse;
@ -344,10 +376,9 @@ ProcListExtensions(ClientPtr client)
for (i=0; i<NumExtensions; i++) for (i=0; i<NumExtensions; i++)
{ {
#ifdef XCSECURITY #ifdef XACE
/* don't show insecure extensions to untrusted clients */ /* call callbacks to find out whether to show extension */
if (client->trustLevel == XSecurityClientUntrusted && if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i]))
!extensions[i]->secure)
continue; continue;
#endif #endif
total_length += strlen(extensions[i]->name) + 1; total_length += strlen(extensions[i]->name) + 1;
@ -362,9 +393,8 @@ ProcListExtensions(ClientPtr client)
for (i=0; i<NumExtensions; i++) for (i=0; i<NumExtensions; i++)
{ {
int len; int len;
#ifdef XCSECURITY #ifdef XACE
if (client->trustLevel == XSecurityClientUntrusted && if (!XaceHook(XACE_EXT_ACCESS, client, extensions[i]))
!extensions[i]->secure)
continue; continue;
#endif #endif
*bufptr++ = len = strlen(extensions[i]->name); *bufptr++ = len = strlen(extensions[i]->name);
@ -452,3 +482,17 @@ RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc)
} }
return TRUE; return TRUE;
} }
#ifdef XSERVER_DTRACE
void LoadExtensionNames(char **RequestNames) {
int i;
for (i=0; i<NumExtensions; i++) {
int r = extensions[i]->base;
if (RequestNames[r] == NULL) {
RequestNames[r] = strdup(extensions[i]->name);
}
}
}
#endif

View File

@ -26,10 +26,18 @@ The Open Group.
*/ */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "dix.h"
int int
ffs(int i) ffs(int i)
{ {
int j; int j;
if (i == 0)
return 0;
for (j = 1; (i & 1) == 0; j++) for (j = 1; (i & 1) == 0; j++)
i >>= 1; i >>= 1;
return j; return j;

784
dix/getevents.c Normal file
View File

@ -0,0 +1,784 @@
/*
* Copyright © 2006 Nokia Corporation
* Copyright © 2006 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 this copyright notice and this permission notice appear in
* supporting electronic documentation.
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR 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.
*
* Author: Daniel Stone <daniel@fooishbar.org>
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/keysym.h>
#define NEED_EVENTS
#define NEED_REPLIES
#include <X11/Xproto.h>
#include "misc.h"
#include "resource.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "cursorstr.h"
#include "dixstruct.h"
#include "globals.h"
#include "mipointer.h"
#ifdef XKB
#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
#ifdef XACE
#include "xace.h"
#endif
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h"
#include "exglobals.h"
#include "extnsionst.h"
/* Maximum number of valuators, divided by six, rounded up, to get number
* of events. */
#define MAX_VALUATOR_EVENTS 6
/* Number of motion history events to store. */
#define MOTION_HISTORY_SIZE 256
/**
* Pick some arbitrary size for Xi motion history.
*/
_X_EXPORT int
GetMotionHistorySize()
{
return MOTION_HISTORY_SIZE;
}
/**
* Allocate the motion history buffer.
*/
_X_EXPORT void
AllocateMotionHistory(DeviceIntPtr pDev)
{
if (pDev->valuator->motion)
xfree(pDev->valuator->motion);
if (pDev->valuator->numMotionEvents < 1)
return;
pDev->valuator->motion = xalloc(((sizeof(INT32) * pDev->valuator->numAxes) +
sizeof(Time)) *
pDev->valuator->numMotionEvents);
pDev->valuator->first_motion = 0;
pDev->valuator->last_motion = 0;
}
/**
* Dump the motion history between start and stop into the supplied buffer.
* Only records the event for a given screen in theory, but in practice, we
* sort of ignore this.
*/
_X_EXPORT int
GetMotionHistory(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
unsigned long stop, ScreenPtr pScreen)
{
char *ibuff = NULL, *obuff = (char *) buff;
int i = 0, ret = 0;
Time current;
/* The size of a single motion event. */
int size = (sizeof(INT32) * pDev->valuator->numAxes) + sizeof(Time);
if (!pDev->valuator || !pDev->valuator->numMotionEvents)
return 0;
for (i = pDev->valuator->first_motion;
i != pDev->valuator->last_motion;
i = (i + 1) % pDev->valuator->numMotionEvents) {
/* We index the input buffer by which element we're accessing, which
* is not monotonic, and the output buffer by how many events we've
* written so far. */
ibuff = (char *) pDev->valuator->motion + (i * size);
memcpy(&current, ibuff, sizeof(Time));
if (current > stop) {
return ret;
}
else if (current >= start) {
memcpy(obuff, ibuff, size);
obuff += size;
ret++;
}
}
return ret;
}
/**
* Update the motion history for a specific device, with the list of
* valuators.
*/
static void
updateMotionHistory(DeviceIntPtr pDev, CARD32 ms, int first_valuator,
int num_valuators, int *valuators)
{
char *buff = (char *) pDev->valuator->motion;
if (!pDev->valuator->numMotionEvents)
return;
buff += ((sizeof(INT32) * pDev->valuator->numAxes) + sizeof(CARD32)) *
pDev->valuator->last_motion;
memcpy(buff, &ms, sizeof(Time));
buff += sizeof(Time);
bzero(buff, sizeof(INT32) * pDev->valuator->numAxes);
buff += sizeof(INT32) * first_valuator;
memcpy(buff, valuators, sizeof(INT32) * num_valuators);
pDev->valuator->last_motion = (pDev->valuator->last_motion + 1) %
pDev->valuator->numMotionEvents;
/* If we're wrapping around, just keep the circular buffer going. */
if (pDev->valuator->first_motion == pDev->valuator->last_motion)
pDev->valuator->first_motion = (pDev->valuator->first_motion + 1) %
pDev->valuator->numMotionEvents;
return;
}
/**
* Returns the maximum number of events GetKeyboardEvents,
* GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
*
* Should be used in DIX as:
* xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
*/
_X_EXPORT int
GetMaximumEventsNum() {
/* Two base events -- core and device, plus valuator events. Multiply
* by two if we're doing key repeats. */
int ret = 2 + MAX_VALUATOR_EVENTS;
#ifdef XKB
if (noXkbExtension)
#endif
ret *= 2;
return ret;
}
/* Originally a part of xf86PostMotionEvent; modifies valuators
* in-place. */
static void
acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
int *valuators)
{
float mult = 0.0;
int dx = 0, dy = 0;
int *px = NULL, *py = NULL;
if (!num_valuators || !valuators)
return;
if (first_valuator == 0) {
dx = valuators[0];
px = &valuators[0];
}
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
dy = valuators[1 - first_valuator];
py = &valuators[1 - first_valuator];
}
if (!dx && !dy)
return;
if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
/* modeled from xf86Events.c */
if (pDev->ptrfeed->ctrl.threshold) {
if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) {
pDev->valuator->dxremaind = ((float)dx *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->valuator->dxremaind;
if (px) {
*px = (int)pDev->valuator->dxremaind;
pDev->valuator->dxremaind = pDev->valuator->dxremaind -
(float)(*px);
}
pDev->valuator->dyremaind = ((float)dy *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->valuator->dyremaind;
if (py) {
*py = (int)pDev->valuator->dyremaind;
pDev->valuator->dyremaind = pDev->valuator->dyremaind -
(float)(*py);
}
}
}
else {
mult = pow((float)(dx * dx + dy * dy),
((float)(pDev->ptrfeed->ctrl.num) /
(float)(pDev->ptrfeed->ctrl.den) - 1.0) /
2.0) / 2.0;
if (dx) {
pDev->valuator->dxremaind = mult * (float)dx +
pDev->valuator->dxremaind;
*px = (int)pDev->valuator->dxremaind;
pDev->valuator->dxremaind = pDev->valuator->dxremaind -
(float)(*px);
}
if (dy) {
pDev->valuator->dyremaind = mult * (float)dy +
pDev->valuator->dyremaind;
*py = (int)pDev->valuator->dyremaind;
pDev->valuator->dyremaind = pDev->valuator->dyremaind -
(float)(*py);
}
}
}
}
/**
* Clip an axis to its bounds, which are declared in the call to
* InitValuatorAxisClassStruct.
*/
static void
clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
AxisInfoPtr axes = pDev->valuator->axes + axisNum;
if (*val < axes->min_value)
*val = axes->min_value;
if (axes->max_value >= 0 && *val > axes->max_value)
*val = axes->max_value;
}
/**
* Clip every axis in the list of valuators to its bounds.
*/
static void
clipValuators(DeviceIntPtr pDev, int first_valuator, int num_valuators,
int *valuators)
{
AxisInfoPtr axes = pDev->valuator->axes + first_valuator;
int i;
for (i = 0; i < num_valuators; i++, axes++)
clipAxis(pDev, i + first_valuator, &(valuators[i]));
}
/**
* Fills events with valuator events for pDev, as given by the other
* parameters.
*
* FIXME: Need to fix ValuatorClassRec to store all the valuators as
* last posted, not just x and y; otherwise relative non-x/y
* valuators, though a very narrow use case, will be broken.
*/
static xEvent *
getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator,
int num_valuators, int *valuators) {
deviceValuator *xv = (deviceValuator *) events;
int i = 0, final_valuator = first_valuator + num_valuators;
for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) {
xv->type = DeviceValuator;
xv->first_valuator = i;
xv->num_valuators = num_valuators;
xv->deviceid = pDev->id;
switch (final_valuator - i) {
case 6:
xv->valuator5 = valuators[i + 5];
case 5:
xv->valuator4 = valuators[i + 4];
case 4:
xv->valuator3 = valuators[i + 3];
case 3:
xv->valuator2 = valuators[i + 2];
case 2:
xv->valuator1 = valuators[i + 1];
case 1:
xv->valuator0 = valuators[i];
}
if (i + 6 < final_valuator)
xv->deviceid |= MORE_EVENTS;
}
return events;
}
/**
* Convenience wrapper around GetKeyboardValuatorEvents, that takes no
* valuators.
*/
_X_EXPORT int
GetKeyboardEvents(xEvent *events, DeviceIntPtr pDev, int type, int key_code) {
return GetKeyboardValuatorEvents(events, pDev, type, key_code, 0, 0, NULL);
}
/**
* Returns a set of keyboard events for KeyPress/KeyRelease, optionally
* also with valuator events. Handles Xi and XKB.
*
* events is not NULL-terminated; the return value is the number of events.
* The DDX is responsible for allocating the event structure in the first
* place via GetMaximumEventsNum(), and for freeing it.
*
* This function does not change the core keymap to that of the device;
* that is done by SwitchCoreKeyboard, which is called from
* mieqProcessInputEvents. If replacing that function, take care to call
* SetCoreKeyboard before processInputProc, so keymaps are altered to suit.
*
* Note that this function recurses! If called for non-XKB, a repeating
* key press will trigger a matching KeyRelease, as well as the
* KeyPresses.
*/
_X_EXPORT int
GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
int key_code, int first_valuator,
int num_valuators, int *valuators) {
int numEvents = 0;
CARD32 ms = 0;
KeySym *map = pDev->key->curKeySyms.map;
KeySym sym = map[key_code * pDev->key->curKeySyms.mapWidth];
deviceKeyButtonPointer *kbp = NULL;
if (!events)
return 0;
if (type != KeyPress && type != KeyRelease)
return 0;
if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
(pDev->coreEvents && !inputInfo.keyboard->key))
return 0;
if (pDev->coreEvents)
numEvents = 2;
else
numEvents = 1;
if (num_valuators) {
if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS;
numEvents += (num_valuators / 6) + 1;
}
#ifdef XKB
if (noXkbExtension)
#endif
{
switch (sym) {
case XK_Num_Lock:
case XK_Caps_Lock:
case XK_Scroll_Lock:
case XK_Shift_Lock:
if (type == KeyRelease)
return 0;
else if (type == KeyPress &&
(pDev->key->down[key_code >> 3] & (key_code & 7)) & 1)
type = KeyRelease;
}
}
/* Handle core repeating, via press/release/press/release.
* FIXME: In theory, if you're repeating with two keyboards in non-XKB,
* you could get unbalanced events here. */
if (type == KeyPress &&
(((pDev->key->down[key_code >> 3] & (key_code & 7))) & 1)) {
if (!pDev->kbdfeed->ctrl.autoRepeat ||
pDev->key->modifierMap[key_code] ||
!(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3]
& (1 << (key_code & 7))))
return 0;
#ifdef XKB
if (noXkbExtension)
#endif
{
numEvents += GetKeyboardValuatorEvents(events, pDev,
KeyRelease, key_code,
first_valuator, num_valuators,
valuators);
events += numEvents;
}
}
ms = GetTimeInMillis();
kbp = (deviceKeyButtonPointer *) events;
kbp->time = ms;
kbp->deviceid = pDev->id;
if (type == KeyPress)
kbp->type = DeviceKeyPress;
else if (type == KeyRelease)
kbp->type = DeviceKeyRelease;
events++;
if (num_valuators) {
kbp->deviceid |= MORE_EVENTS;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,
num_valuators, valuators);
}
if (pDev->coreEvents) {
events->u.keyButtonPointer.time = ms;
events->u.u.type = type;
events->u.u.detail = key_code;
}
return numEvents;
}
/**
* Generate a series of xEvents (returned in xE) representing pointer
* motion, or button presses. Xi and XKB-aware.
*
* events is not NULL-terminated; the return value is the number of events.
* The DDX is responsible for allocating the event structure in the first
* place via GetMaximumEventsNum(), and for freeing it.
*/
_X_EXPORT int
GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int flags, int first_valuator, int num_valuators,
int *valuators) {
int num_events = 0, final_valuator = 0;
CARD32 ms = 0;
deviceKeyButtonPointer *kbp = NULL;
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr cp = inputInfo.pointer;
int x = 0, y = 0;
/* Sanity checks. */
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
return 0;
if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
return 0;
if (pDev->coreEvents)
num_events = 2;
else
num_events = 1;
/* Do we need to send a DeviceValuator event? */
if ((num_valuators + first_valuator) > 2 && sendValuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS * 6;
num_events += ((num_valuators - 1) / 6) + 1;
}
else if (type == MotionNotify && num_valuators <= 0) {
return 0;
}
final_valuator = num_valuators + first_valuator;
/* You fail. */
if (first_valuator < 0 || final_valuator > pDev->valuator->numAxes)
return 0;
ms = GetTimeInMillis();
kbp = (deviceKeyButtonPointer *) events;
kbp->time = ms;
kbp->deviceid = pDev->id;
/* Set x and y based on whether this is absolute or relative, and
* accelerate if we need to. */
if (flags & POINTER_ABSOLUTE) {
if (num_valuators >= 1 && first_valuator == 0) {
x = valuators[0];
}
else {
if (pDev->coreEvents)
x = cp->valuator->lastx;
else
x = pDev->valuator->lastx;
}
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
y = valuators[1 - first_valuator];
}
else {
if (pDev->coreEvents)
x = cp->valuator->lasty;
else
y = pDev->valuator->lasty;
}
}
else {
if (flags & POINTER_ACCELERATE)
acceleratePointer(pDev, first_valuator, num_valuators,
valuators);
if (pDev->coreEvents) {
if (first_valuator == 0 && num_valuators >= 1)
x = cp->valuator->lastx + valuators[0];
else
x = cp->valuator->lastx;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
y = cp->valuator->lasty + valuators[1 - first_valuator];
else
y = cp->valuator->lasty;
}
else {
if (first_valuator == 0 && num_valuators >= 1)
x = pDev->valuator->lastx + valuators[0];
else
x = pDev->valuator->lastx;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
y = pDev->valuator->lasty + valuators[1 - first_valuator];
else
y = pDev->valuator->lasty;
}
}
/* Clip both x and y to the defined limits (usually co-ord space limit). */
clipAxis(pDev, 0, &x);
clipAxis(pDev, 1, &y);
/* This takes care of crossing screens for us, as well as clipping
* to the current screen. Right now, we only have one history buffer,
* so we don't set this for both the device and core.*/
miPointerSetPosition(pDev, &x, &y, ms);
/* Drop x and y back into the valuators list, if they were originally
* present. */
if (first_valuator == 0 && num_valuators >= 1)
valuators[0] = x;
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator))
valuators[1 - first_valuator] = y;
updateMotionHistory(pDev, ms, first_valuator, num_valuators, valuators);
if (pDev->coreEvents) {
cp->valuator->lastx = x;
cp->valuator->lasty = y;
}
pDev->valuator->lastx = x;
pDev->valuator->lasty = y;
if (type == MotionNotify) {
kbp->type = DeviceMotionNotify;
}
else {
if (type == ButtonPress)
kbp->type = DeviceButtonPress;
else if (type == ButtonRelease)
kbp->type = DeviceButtonRelease;
kbp->detail = pDev->button->map[buttons];
}
kbp->root_x = x;
kbp->root_y = y;
events++;
if (final_valuator > 2 && sendValuators) {
kbp->deviceid |= MORE_EVENTS;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,
num_valuators, valuators);
}
if (pDev->coreEvents) {
events->u.u.type = type;
events->u.keyButtonPointer.time = ms;
events->u.keyButtonPointer.rootX = x;
events->u.keyButtonPointer.rootY = y;
if (type == ButtonPress || type == ButtonRelease) {
/* We hijack SetPointerMapping to work on all core-sending
* devices, so we use the device-specific map here instead of
* the core one. */
events->u.u.detail = pDev->button->map[buttons];
}
else {
events->u.u.detail = 0;
}
}
return num_events;
}
/**
* Post ProximityIn/ProximityOut events, accompanied by valuators.
*
* events is not NULL-terminated; the return value is the number of events.
* The DDX is responsible for allocating the event structure in the first
* place via GetMaximumEventsNum(), and for freeing it.
*/
_X_EXPORT int
GetProximityEvents(xEvent *events, DeviceIntPtr pDev, int type,
int first_valuator, int num_valuators, int *valuators)
{
int num_events = 0;
deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) events;
/* Sanity checks. */
if (type != ProximityIn && type != ProximityOut)
return 0;
if (!pDev->valuator)
return 0;
/* Do we need to send a DeviceValuator event? */
if ((pDev->valuator->mode & 1) == Relative)
num_valuators = 0;
if (num_valuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS * 6;
num_events += ((num_valuators - 1) / 6) + 1;
}
/* You fail. */
if (first_valuator < 0 ||
(num_valuators + first_valuator) > pDev->valuator->numAxes)
return 0;
kbp->type = type;
kbp->deviceid = pDev->id;
kbp->detail = 0;
kbp->time = GetTimeInMillis();
if (num_valuators) {
kbp->deviceid |= MORE_EVENTS;
events++;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,
num_valuators, valuators);
}
return num_events;
}
/**
* Note that pDev was the last device to send a core event. This function
* copies the complete keymap from the originating device to the core
* device, and makes sure the appropriate notifications are generated.
*
* Call this just before processInputProc.
*/
_X_EXPORT void
SwitchCoreKeyboard(DeviceIntPtr pDev)
{
KeyClassPtr ckeyc = inputInfo.keyboard->key;
if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
if (ckeyc->modifierKeyMap)
xfree(ckeyc->modifierKeyMap);
ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
(8 * pDev->key->maxKeysPerModifier));
ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
#ifdef XKB
if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) {
if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc,
True))
FatalError("Couldn't pivot keymap from device to core!\n");
}
#endif
SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
(ckeyc->curKeySyms.maxKeyCode -
ckeyc->curKeySyms.minKeyCode),
serverClient);
inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}
}
/**
* Note that pDev was the last function to send a core pointer event.
* Currently a no-op.
*
* Call this just before processInputProc.
*/
_X_EXPORT void
SwitchCorePointer(DeviceIntPtr pDev)
{
if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}
/**
* Synthesize a single motion event for the core pointer.
*
* Used in cursor functions, e.g. when cursor confinement changes, and we need
* to shift the pointer to get it inside the new bounds.
*/
void
PostSyntheticMotion(int x, int y, int screenNum, unsigned long time)
{
xEvent xE;
#ifdef PANORAMIX
/* Translate back to the sprite screen since processInputProc
will translate from sprite screen to screen 0 upon reentry
to the DIX layer. */
if (!noPanoramiXExtension) {
x += panoramiXdataPtr[0].x - panoramiXdataPtr[screenNum].x;
y += panoramiXdataPtr[0].y - panoramiXdataPtr[screenNum].y;
}
#endif
memset(&xE, 0, sizeof(xEvent));
xE.u.u.type = MotionNotify;
xE.u.keyButtonPointer.rootX = x;
xE.u.keyButtonPointer.rootY = y;
(*inputInfo.pointer->public.processInputProc)(&xE, inputInfo.pointer, 1);
}

View File

@ -105,7 +105,7 @@ int ScreenSaverAllowExposures;
# define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4 # define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4
# endif # endif
# ifndef DEFAULT_DPMS_ENABLED # ifndef DEFAULT_DPMS_ENABLED
# define DEFAULT_DPMS_ENABLED FALSE # define DEFAULT_DPMS_ENABLED TRUE
# endif # endif
CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME; CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME;
CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME; CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME;

View File

@ -98,6 +98,7 @@ Equipment Corporation.
#include <X11/fonts/font.h> #include <X11/fonts/font.h>
#include "opaque.h" #include "opaque.h"
#include "servermd.h" #include "servermd.h"
#include "config.h"
#include "site.h" #include "site.h"
#include "dixfont.h" #include "dixfont.h"
#include "extnsionst.h" #include "extnsionst.h"
@ -308,6 +309,7 @@ main(int argc, char *argv[], char *envp[])
DPMSPowerLevel = 0; DPMSPowerLevel = 0;
#endif #endif
InitBlockAndWakeupHandlers(); InitBlockAndWakeupHandlers();
configInitialise();
/* Perform any operating system dependent initializations you'd like */ /* Perform any operating system dependent initializations you'd like */
OsInit(); OsInit();
if(serverGeneration == 1) if(serverGeneration == 1)
@ -354,6 +356,7 @@ main(int argc, char *argv[], char *envp[])
InitAtoms(); InitAtoms();
InitEvents(); InitEvents();
InitGlyphCaching(); InitGlyphCaching();
ResetExtensionPrivates();
ResetClientPrivates(); ResetClientPrivates();
ResetScreenPrivates(); ResetScreenPrivates();
ResetWindowPrivates(); ResetWindowPrivates();
@ -393,23 +396,40 @@ main(int argc, char *argv[], char *envp[])
if (!CreateRootWindow(pScreen)) if (!CreateRootWindow(pScreen))
FatalError("failed to create root window"); FatalError("failed to create root window");
} }
InitCoreDevices();
InitInput(argc, argv); InitInput(argc, argv);
if (InitAndStartDevices() != Success) if (InitAndStartDevices() != Success)
FatalError("failed to initialize core devices"); FatalError("failed to initialize core devices");
InitFonts(); InitFonts();
#ifdef BUILTIN_FONTS
defaultFontPath = "built-ins";
#else
if (loadableFonts) { if (loadableFonts) {
SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error); SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error);
} else { } else
#endif
{
if (SetDefaultFontPath(defaultFontPath) != Success) if (SetDefaultFontPath(defaultFontPath) != Success)
ErrorF("failed to set default font path '%s'", ErrorF("failed to set default font path '%s'",
defaultFontPath); defaultFontPath);
} }
if (!SetDefaultFont(defaultTextFont)) if (!SetDefaultFont(defaultTextFont))
FatalError("could not open default font '%s'", defaultTextFont); FatalError("could not open default font '%s'", defaultTextFont);
#ifdef NULL_ROOT_CURSOR
cm.width = 0;
cm.height = 0;
cm.xhot = 0;
cm.yhot = 0;
if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0)))
FatalError("could not create empty root cursor");
AddResource(FakeClientID(0), RT_CURSOR, (pointer)rootCursor);
#else
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0)))
FatalError("could not open default cursor font '%s'", FatalError("could not open default cursor font '%s'",
defaultCursorFont); defaultCursorFont);
#endif
#ifdef DPMSExtension #ifdef DPMSExtension
/* check all screens, looking for DPMS Capabilities */ /* check all screens, looking for DPMS Capabilities */
DPMSCapableFlag = DPMSSupported(); DPMSCapableFlag = DPMSSupported();
@ -460,6 +480,7 @@ main(int argc, char *argv[], char *envp[])
FreeAllResources(); FreeAllResources();
#endif #endif
configFini();
CloseDownDevices(); CloseDownDevices();
for (i = screenInfo.numScreens - 1; i >= 0; i--) for (i = screenInfo.numScreens - 1; i >= 0; i--)
{ {
@ -680,9 +701,6 @@ AddScreen(
int i; int i;
int scanlinepad, format, depth, bitsPerPixel, j, k; int scanlinepad, format, depth, bitsPerPixel, j, k;
ScreenPtr pScreen; ScreenPtr pScreen;
#ifdef DEBUG
void (**jNI) ();
#endif /* DEBUG */
i = screenInfo.numScreens; i = screenInfo.numScreens;
if (i == MAXSCREENS) if (i == MAXSCREENS)
@ -716,13 +734,6 @@ AddScreen(
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */ pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0; pScreen->CreateScreenResources = 0;
#ifdef DEBUG
for (jNI = &pScreen->QueryBestSize;
jNI < (void (**) ()) &pScreen->SendGraphicsExpose;
jNI++)
*jNI = NotImplemented;
#endif /* DEBUG */
/* /*
* This loop gets run once for every Screen that gets added, * This loop gets run once for every Screen that gets added,
* but thats ok. If the ddx layer initializes the formats * but thats ok. If the ddx layer initializes the formats

View File

@ -42,6 +42,7 @@ from The Open Group.
#include "servermd.h" #include "servermd.h"
#include "site.h" #include "site.h"
#include "inputstr.h" #include "inputstr.h"
#include "extnsionst.h"
/* /*
* See the Wrappers and devPrivates section in "Definition of the * See the Wrappers and devPrivates section in "Definition of the
@ -49,6 +50,63 @@ from The Open Group.
* for information on how to use devPrivates. * for information on how to use devPrivates.
*/ */
/*
* extension private machinery
*/
static int extensionPrivateCount;
int extensionPrivateLen;
unsigned *extensionPrivateSizes;
unsigned totalExtensionSize;
void
ResetExtensionPrivates()
{
extensionPrivateCount = 0;
extensionPrivateLen = 0;
xfree(extensionPrivateSizes);
extensionPrivateSizes = (unsigned *)NULL;
totalExtensionSize =
((sizeof(ExtensionEntry) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
}
_X_EXPORT int
AllocateExtensionPrivateIndex()
{
return extensionPrivateCount++;
}
_X_EXPORT Bool
AllocateExtensionPrivate(int index2, unsigned amount)
{
unsigned oldamount;
/* Round up sizes for proper alignment */
amount = ((amount + (sizeof(long) - 1)) / sizeof(long)) * sizeof(long);
if (index2 >= extensionPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(extensionPrivateSizes,
(index2 + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
while (extensionPrivateLen <= index2)
{
nsizes[extensionPrivateLen++] = 0;
totalExtensionSize += sizeof(DevUnion);
}
extensionPrivateSizes = nsizes;
}
oldamount = extensionPrivateSizes[index2];
if (amount > oldamount)
{
extensionPrivateSizes[index2] = amount;
totalExtensionSize += (amount - oldamount);
}
return TRUE;
}
/* /*
* client private machinery * client private machinery
*/ */

View File

@ -58,8 +58,8 @@ SOFTWARE.
#include "dixstruct.h" #include "dixstruct.h"
#include "dispatch.h" #include "dispatch.h"
#include "swaprep.h" #include "swaprep.h"
#ifdef XCSECURITY #ifdef XACE
#include "securitysrv.h" #include "xace.h"
#endif #endif
/***************************************************************** /*****************************************************************
@ -118,12 +118,12 @@ ProcRotateProperties(ClientPtr client)
return(BadAlloc); return(BadAlloc);
for (i = 0; i < stuff->nAtoms; i++) for (i = 0; i < stuff->nAtoms; i++)
{ {
#ifdef XCSECURITY #ifdef XACE
char action = SecurityCheckPropertyAccess(client, pWin, atoms[i], char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i],
SecurityReadAccess|SecurityWriteAccess); SecurityReadAccess|SecurityWriteAccess);
#endif #endif
if (!ValidAtom(atoms[i]) if (!ValidAtom(atoms[i])
#ifdef XCSECURITY #ifdef XACE
|| (SecurityErrorOperation == action) || (SecurityErrorOperation == action)
#endif #endif
) )
@ -132,7 +132,7 @@ ProcRotateProperties(ClientPtr client)
client->errorValue = atoms[i]; client->errorValue = atoms[i];
return BadAtom; return BadAtom;
} }
#ifdef XCSECURITY #ifdef XACE
if (SecurityIgnoreOperation == action) if (SecurityIgnoreOperation == action)
{ {
DEALLOCATE_LOCAL(props); DEALLOCATE_LOCAL(props);
@ -233,8 +233,8 @@ ProcChangeProperty(ClientPtr client)
return(BadAtom); return(BadAtom);
} }
#ifdef XCSECURITY #ifdef XACE
switch (SecurityCheckPropertyAccess(client, pWin, stuff->property, switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
SecurityWriteAccess)) SecurityWriteAccess))
{ {
case SecurityErrorOperation: case SecurityErrorOperation:
@ -501,13 +501,13 @@ ProcGetProperty(ClientPtr client)
if (!pProp) if (!pProp)
return NullPropertyReply(client, None, 0, &reply); return NullPropertyReply(client, None, 0, &reply);
#ifdef XCSECURITY #ifdef XACE
{ {
Mask access_mode = SecurityReadAccess; Mask access_mode = SecurityReadAccess;
if (stuff->delete) if (stuff->delete)
access_mode |= SecurityDestroyAccess; access_mode |= SecurityDestroyAccess;
switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, switch(XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
access_mode)) access_mode))
{ {
case SecurityErrorOperation: case SecurityErrorOperation:
@ -663,8 +663,8 @@ ProcDeleteProperty(register ClientPtr client)
return (BadAtom); return (BadAtom);
} }
#ifdef XCSECURITY #ifdef XACE
switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, switch(XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
SecurityDestroyAccess)) SecurityDestroyAccess))
{ {
case SecurityErrorOperation: case SecurityErrorOperation:

View File

@ -72,6 +72,34 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation. Equipment Corporation.
******************************************************************/ ******************************************************************/
/* XSERVER_DTRACE additions:
* Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
* INDIRECT OR 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.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* of the copyright holder.
*/
/* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */ /* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
@ -120,8 +148,19 @@ Equipment Corporation.
#include "panoramiX.h" #include "panoramiX.h"
#include "panoramiXsrv.h" #include "panoramiXsrv.h"
#endif #endif
#ifdef XACE
#include "xace.h"
#endif
#include <assert.h> #include <assert.h>
#ifdef XSERVER_DTRACE
#include <sys/types.h>
typedef const char *string;
#include "Xserver-dtrace.h"
#define TypeNameString(t) NameForAtom(ResourceNames[t & TypeMask])
#endif
static void RebuildTable( static void RebuildTable(
int /*client*/ int /*client*/
); );
@ -426,6 +465,9 @@ AddResource(XID id, RESTYPE type, pointer value)
register ClientResourceRec *rrec; register ClientResourceRec *rrec;
register ResourcePtr res, *head; register ResourcePtr res, *head;
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
#endif
client = CLIENT_ID(id); client = CLIENT_ID(id);
rrec = &clientTable[client]; rrec = &clientTable[client];
if (!rrec->buckets) if (!rrec->buckets)
@ -525,6 +567,11 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
if (res->id == id) if (res->id == id)
{ {
RESTYPE rtype = res->type; RESTYPE rtype = res->type;
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_FREE(res->id, res->type,
res->value, TypeNameString(res->type));
#endif
*prev = res->next; *prev = res->next;
elements = --*eltptr; elements = --*eltptr;
if (rtype & RC_CACHED) if (rtype & RC_CACHED)
@ -566,6 +613,10 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
{ {
if (res->id == id && res->type == type) if (res->id == id && res->type == type)
{ {
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_FREE(res->id, res->type,
res->value, TypeNameString(res->type));
#endif
*prev = res->next; *prev = res->next;
if (type & RC_CACHED) if (type & RC_CACHED)
FlushClientCaches(res->id); FlushClientCaches(res->id);
@ -728,6 +779,10 @@ FreeClientNeverRetainResources(ClientPtr client)
RESTYPE rtype = this->type; RESTYPE rtype = this->type;
if (rtype & RC_NEVERRETAIN) if (rtype & RC_NEVERRETAIN)
{ {
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_FREE(this->id, this->type,
this->value, TypeNameString(this->type));
#endif
*prev = this->next; *prev = this->next;
if (rtype & RC_CACHED) if (rtype & RC_CACHED)
FlushClientCaches(this->id); FlushClientCaches(this->id);
@ -774,6 +829,10 @@ FreeClientResources(ClientPtr client)
for (this = *head; this; this = *head) for (this = *head; this; this = *head)
{ {
RESTYPE rtype = this->type; RESTYPE rtype = this->type;
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_FREE(this->id, this->type,
this->value, TypeNameString(this->type));
#endif
*head = this->next; *head = this->next;
if (rtype & RC_CACHED) if (rtype & RC_CACHED)
FlushClientCaches(this->id); FlushClientCaches(this->id);
@ -818,8 +877,6 @@ LegalNewID(XID id, register ClientPtr client)
!LookupIDByClass(id, RC_ANY))); !LookupIDByClass(id, RC_ANY)));
} }
#ifdef XCSECURITY
/* SecurityLookupIDByType and SecurityLookupIDByClass: /* SecurityLookupIDByType and SecurityLookupIDByClass:
* These are the heart of the resource ID security system. They take * These are the heart of the resource ID security system. They take
* two additional arguments compared to the old LookupID functions: * two additional arguments compared to the old LookupID functions:
@ -835,10 +892,6 @@ SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode)
register ResourcePtr res; register ResourcePtr res;
pointer retval = NULL; pointer retval = NULL;
assert(client == NullClient ||
(client->index <= currentMaxClients && clients[client->index] == client));
assert( (rtype & TypeMask) <= lastResourceType);
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
clientTable[cid].buckets) clientTable[cid].buckets)
{ {
@ -851,8 +904,11 @@ SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode)
break; break;
} }
} }
if (retval && client && client->CheckAccess) #ifdef XACE
retval = (* client->CheckAccess)(client, id, rtype, mode, retval); if (retval && client &&
!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, mode, retval))
retval = NULL;
#endif
return retval; return retval;
} }
@ -864,10 +920,6 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode)
register ResourcePtr res = NULL; register ResourcePtr res = NULL;
pointer retval = NULL; pointer retval = NULL;
assert(client == NullClient ||
(client->index <= currentMaxClients && clients[client->index] == client));
assert (classes >= lastResourceClass);
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
clientTable[cid].buckets) clientTable[cid].buckets)
{ {
@ -880,8 +932,11 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode)
break; break;
} }
} }
if (retval && client && client->CheckAccess) #ifdef XACE
retval = (* client->CheckAccess)(client, id, res->type, mode, retval); if (retval && client &&
!XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, mode, retval))
retval = NULL;
#endif
return retval; return retval;
} }
@ -902,50 +957,3 @@ LookupIDByClass(XID id, RESTYPE classes)
return SecurityLookupIDByClass(NullClient, id, classes, return SecurityLookupIDByClass(NullClient, id, classes,
SecurityUnknownAccess); SecurityUnknownAccess);
} }
#else /* not XCSECURITY */
/*
* LookupIDByType returns the object with the given id and type, else NULL.
*/
pointer
LookupIDByType(XID id, RESTYPE rtype)
{
int cid;
register ResourcePtr res;
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
clientTable[cid].buckets)
{
res = clientTable[cid].resources[Hash(cid, id)];
for (; res; res = res->next)
if ((res->id == id) && (res->type == rtype))
return res->value;
}
return (pointer)NULL;
}
/*
* LookupIDByClass returns the object with the given id and any one of the
* given classes, else NULL.
*/
pointer
LookupIDByClass(XID id, RESTYPE classes)
{
int cid;
register ResourcePtr res;
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
clientTable[cid].buckets)
{
res = clientTable[cid].resources[Hash(cid, id)];
for (; res; res = res->next)
if ((res->id == id) && (res->type & classes))
return res->value;
}
return (pointer)NULL;
}
#endif /* XCSECURITY */

View File

@ -126,8 +126,8 @@ Equipment Corporation.
#ifdef XAPPGROUP #ifdef XAPPGROUP
#include "appgroup.h" #include "appgroup.h"
#endif #endif
#ifdef XCSECURITY #ifdef XACE
#include "securitysrv.h" #include "xace.h"
#endif #endif
/****** /******
@ -187,7 +187,7 @@ _X_EXPORT int deltaSaveUndersViewable = 0;
* For debugging only * For debugging only
******/ ******/
int static void
PrintChildren(WindowPtr p1, int indent) PrintChildren(WindowPtr p1, int indent)
{ {
WindowPtr p2; WindowPtr p2;
@ -197,14 +197,15 @@ PrintChildren(WindowPtr p1, int indent)
{ {
p2 = p1->firstChild; p2 = p1->firstChild;
for (i=0; i<indent; i++) ErrorF( " "); for (i=0; i<indent; i++) ErrorF( " ");
ErrorF( "%x\n", p1->drawable.id); ErrorF( "%lx\n", p1->drawable.id);
miPrintRegion(&p1->clipList); miPrintRegion(&p1->clipList);
PrintChildren(p2, indent+4); PrintChildren(p2, indent+4);
p1 = p1->nextSib; p1 = p1->nextSib;
} }
} }
PrintWindowTree() static void
PrintWindowTree(void)
{ {
int i; int i;
WindowPtr pWin, p1; WindowPtr pWin, p1;
@ -530,6 +531,10 @@ InitRootWindow(WindowPtr pWin)
/* We SHOULD check for an error value here XXX */ /* We SHOULD check for an error value here XXX */
(*pScreen->ChangeWindowAttributes)(pWin, backFlag); (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
#ifdef XACE
XaceHook(XACE_WINDOW_INIT, serverClient, pWin);
#endif
MapWindow(pWin, serverClient); MapWindow(pWin, serverClient);
} }
@ -543,9 +548,11 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn,
register int x, register int y, register int x, register int y,
register int w, register int h) register int w, register int h)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr pScreen;
BoxRec box; BoxRec box;
pScreen = pWin->drawable.pScreen;
box = *(REGION_EXTENTS(pScreen, &pWin->winSize)); box = *(REGION_EXTENTS(pScreen, &pWin->winSize));
/* we do these calculations to avoid overflows */ /* we do these calculations to avoid overflows */
if (x > box.x1) if (x > box.x1)
@ -731,11 +738,11 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
} }
pWin->borderWidth = bw; pWin->borderWidth = bw;
#ifdef XCSECURITY #ifdef XACE
/* can't let untrusted clients have background None windows; /* can't let untrusted clients have background None windows;
* they make it too easy to steal window contents * they make it too easy to steal window contents
*/ */
if (client->trustLevel != XSecurityClientTrusted) if (!XaceHook(XACE_BACKGRND_ACCESS, client, pWin))
{ {
pWin->backgroundState = BackgroundPixel; pWin->backgroundState = BackgroundPixel;
pWin->background.pixel = 0; pWin->background.pixel = 0;
@ -762,6 +769,10 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
REGION_NULL(pScreen, &pWin->winSize); REGION_NULL(pScreen, &pWin->winSize);
REGION_NULL(pScreen, &pWin->borderSize); REGION_NULL(pScreen, &pWin->borderSize);
#ifdef XACE
XaceHook(XACE_WINDOW_INIT, client, pWin);
#endif
pHead = RealChildHead(pParent); pHead = RealChildHead(pParent);
if (pHead) if (pHead)
{ {
@ -1025,9 +1036,9 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
borderRelative = TRUE; borderRelative = TRUE;
if (pixID == None) if (pixID == None)
{ {
#ifdef XCSECURITY #ifdef XACE
/* can't let untrusted clients have background None windows */ /* can't let untrusted clients have background None windows */
if (client->trustLevel == XSecurityClientTrusted) if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin))
{ {
#endif #endif
if (pWin->backgroundState == BackgroundPixmap) if (pWin->backgroundState == BackgroundPixmap)
@ -1036,7 +1047,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
MakeRootTile(pWin); MakeRootTile(pWin);
else else
pWin->backgroundState = None; pWin->backgroundState = None;
#ifdef XCSECURITY #ifdef XACE
} }
else else
{ /* didn't change the background to None, so don't tell ddx */ { /* didn't change the background to None, so don't tell ddx */
@ -1655,7 +1666,8 @@ CreateUnclippedWinSize (register WindowPtr pWin)
pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1); pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1);
#ifdef SHAPE #ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) { if (wBoundingShape (pWin) || wClipShape (pWin)) {
ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x, REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x,
- pWin->drawable.y); - pWin->drawable.y);
@ -1691,7 +1703,8 @@ SetWinSize (register WindowPtr pWin)
(int)pWin->drawable.height); (int)pWin->drawable.height);
#ifdef SHAPE #ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) { if (wBoundingShape (pWin) || wClipShape (pWin)) {
ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x, REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x,
- pWin->drawable.y); - pWin->drawable.y);
@ -1733,7 +1746,8 @@ SetBorderSize (register WindowPtr pWin)
(int)(pWin->drawable.height + (bw<<1))); (int)(pWin->drawable.height + (bw<<1)));
#ifdef SHAPE #ifdef SHAPE
if (wBoundingShape (pWin)) { if (wBoundingShape (pWin)) {
ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x, REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x,
- pWin->drawable.y); - pWin->drawable.y);
@ -1944,7 +1958,8 @@ MakeBoundingRegion (
BoxPtr pBox) BoxPtr pBox)
{ {
RegionPtr pRgn; RegionPtr pRgn;
ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
pRgn = REGION_CREATE(pScreen, pBox, 1); pRgn = REGION_CREATE(pScreen, pBox, 1);
if (wBoundingShape (pWin)) { if (wBoundingShape (pWin)) {
@ -2724,13 +2739,9 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
if (pWin->mapped) if (pWin->mapped)
return(Success); return(Success);
#ifdef XCSECURITY #ifdef XACE
/* don't let an untrusted client map a child-of-trusted-window, InputOnly /* general check for permission to map window */
* window; too easy to steal device input if (!XaceHook(XACE_MAP_ACCESS, client, pWin))
*/
if ( (client->trustLevel != XSecurityClientTrusted) &&
(pWin->drawable.class == InputOnly) &&
(wClient(pWin->parent)->trustLevel == XSecurityClientTrusted) )
return Success; return Success;
#endif #endif

View File

@ -181,7 +181,7 @@ prints a usage message.
causes all remaining command line arguments to be ignored. causes all remaining command line arguments to be ignored.
.TP 8 .TP 8
.B \-maxbigreqsize \fIsize\fP .B \-maxbigreqsize \fIsize\fP
sets the maxmium big request to sets the maximum big request to
.I size .I size
MB. MB.
.TP 8 .TP 8
@ -449,7 +449,7 @@ the text after the /; it is used to distinguish between instances of
<action> ::= a | i | e <action> ::= a | i | e
<string> ::= <dbl quoted string> | <single quoted string> | <unqouted string> <string> ::= <dbl quoted string> | <single quoted string> | <unquoted string>
<dbl quoted string> ::= <space> " <not dqoute>* " <space> <dbl quoted string> ::= <space> " <not dqoute>* " <space>

32
doc/c-extensions Normal file
View File

@ -0,0 +1,32 @@
Use of extensions throughout the X server tree
----------------------------------------------
Optional extensions:
The server will still build if your toolchain does not support these
extensions, although the results may not be optimal.
* _X_SENTINEL(x): member x of the passed structure must be NULL, e.g.:
void parseOptions(Option *options _X_SENTINEL(0));
parseOptions("foo", "bar", NULL); /* this is OK */
parseOptions("foo", "bar", "baz"); /* this is not */
This definition comes from Xfuncproto.h in the core
protocol headers.
* _X_ATTRIBUTE_PRINTF(x, y): This function has printf-like semantics;
check the format string when built with
-Wformat (gcc) or similar.
* _X_EXPORT: this function should appear in symbol tables.
* _X_HIDDEN: this function should not appear in the _dynamic_ symbol
table.
* _X_INTERNAL: like _X_HIDDEN, but attempt to ensure that this function
is never called from another module.
* _X_INLINE: inline this functon if possible (generally obeyed unless
disabling optimisations).
* _X_DEPRECATED: warn on use of this function.
Mandatory extensions:
The server will not build if your toolchain does not support these extensions.
* named initialisers: explicitly initialising structure members, e.g.:
struct foo bar = { .baz = quux, .brian = "dog" };
* variadic macros: macros with a variable number of arguments, e.g.:
#define DebugF(x, ...) /**/

View File

@ -10,8 +10,10 @@ if XORG
sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h wfbrename.h sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h wfbrename.h
endif endif
libfb_la_CFLAGS = $(AM_CFLAGS)
if MMX_CAPABLE if MMX_CAPABLE
libfb_la_CFLAGS = $(AM_CFLAGS) -DUSE_MMX libfb_la_CFLAGS += -DUSE_MMX
libfbmmx_la_CFLAGS = \ libfbmmx_la_CFLAGS = \
$(DIX_CFLAGS) \ $(DIX_CFLAGS) \

View File

@ -930,9 +930,8 @@ fbComposite (CARD8 op,
case PictOpOver: case PictOpOver:
if (pMask) if (pMask)
{ {
if (srcRepeat && if (fbCanGetSolid(pSrc) &&
pSrc->pDrawable->width == 1 && !maskRepeat)
pSrc->pDrawable->height == 1)
{ {
srcRepeat = FALSE; srcRepeat = FALSE;
if (PICT_FORMAT_COLOR(pSrc->format)) { if (PICT_FORMAT_COLOR(pSrc->format)) {
@ -1044,7 +1043,7 @@ fbComposite (CARD8 op,
{ {
if (pSrc->pDrawable == pMask->pDrawable && if (pSrc->pDrawable == pMask->pDrawable &&
xSrc == xMask && ySrc == yMask && xSrc == xMask && ySrc == yMask &&
!pMask->componentAlpha) !pMask->componentAlpha && !maskRepeat)
{ {
/* source == mask: non-premultiplied data */ /* source == mask: non-premultiplied data */
switch (pSrc->format) { switch (pSrc->format) {
@ -1108,9 +1107,7 @@ fbComposite (CARD8 op,
else else
{ {
/* non-repeating source, repeating mask => translucent window */ /* non-repeating source, repeating mask => translucent window */
if (maskRepeat && if (fbCanGetSolid(pMask))
pMask->pDrawable->width == 1 &&
pMask->pDrawable->height == 1)
{ {
if (pSrc->format == PICT_x8r8g8b8 && if (pSrc->format == PICT_x8r8g8b8 &&
pDst->format == PICT_x8r8g8b8 && pDst->format == PICT_x8r8g8b8 &&
@ -1127,9 +1124,7 @@ fbComposite (CARD8 op,
} }
else /* no mask */ else /* no mask */
{ {
if (srcRepeat && if (fbCanGetSolid(pSrc))
pSrc->pDrawable->width == 1 &&
pSrc->pDrawable->height == 1)
{ {
/* no mask and repeating source */ /* no mask and repeating source */
switch (pSrc->format) { switch (pSrc->format) {
@ -1435,6 +1430,10 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
*/ */
#if !defined(__amd64__) && !defined(__x86_64__) #if !defined(__amd64__) && !defined(__x86_64__)
#ifdef HAVE_GETISAX
#include <sys/auxv.h>
#endif
enum CPUFeatures { enum CPUFeatures {
NoFeatures = 0, NoFeatures = 0,
MMX = 0x1, MMX = 0x1,
@ -1445,7 +1444,23 @@ enum CPUFeatures {
}; };
static unsigned int detectCPUFeatures(void) { static unsigned int detectCPUFeatures(void) {
unsigned int features = 0;
unsigned int result; unsigned int result;
#ifdef HAVE_GETISAX
if (getisax(&result, 1)) {
if (result & AV_386_CMOV)
features |= CMOV;
if (result & AV_386_MMX)
features |= MMX;
if (result & AV_386_AMD_MMX)
features |= MMX_Extensions;
if (result & AV_386_SSE)
features |= SSE;
if (result & AV_386_SSE2)
features |= SSE2;
}
#else
char vendor[13]; char vendor[13];
vendor[0] = 0; vendor[0] = 0;
vendor[12] = 0; vendor[12] = 0;
@ -1454,7 +1469,8 @@ static unsigned int detectCPUFeatures(void) {
* %esp here. We can't declare either one as clobbered * %esp here. We can't declare either one as clobbered
* since they are special registers (%ebx is the "PIC * since they are special registers (%ebx is the "PIC
* register" holding an offset to global data, %esp the * register" holding an offset to global data, %esp the
* stack pointer), so we need to make sure they have their+ * original values when we access the output operands. * stack pointer), so we need to make sure they have their
* original values when we access the output operands.
*/ */
__asm__ ("pushf\n" __asm__ ("pushf\n"
"pop %%eax\n" "pop %%eax\n"
@ -1490,7 +1506,6 @@ static unsigned int detectCPUFeatures(void) {
: "%eax", "%ecx", "%edx" : "%eax", "%ecx", "%edx"
); );
unsigned int features = 0;
if (result) { if (result) {
/* result now contains the standard feature bits */ /* result now contains the standard feature bits */
if (result & (1 << 15)) if (result & (1 << 15))
@ -1524,6 +1539,7 @@ static unsigned int detectCPUFeatures(void) {
features |= MMX_Extensions; features |= MMX_Extensions;
} }
} }
#endif /* HAVE_GETISAX */
return features; return features;
} }

View File

@ -30,6 +30,13 @@
#include "renderedge.h" #include "renderedge.h"
#if defined(__GNUC__)
#define INLINE __inline__
#else
#define INLINE
#endif
#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) #define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
#define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b)) #define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b))
@ -67,6 +74,40 @@
#define Green(x) (((x) >> 8) & 0xff) #define Green(x) (((x) >> 8) & 0xff)
#define Blue(x) ((x) & 0xff) #define Blue(x) ((x) & 0xff)
/**
* Returns TRUE if the fbComposeGetSolid can be used to get a single solid
* color representing every source sampling location of the picture.
*/
static INLINE Bool
fbCanGetSolid(PicturePtr pict)
{
if (pict->pDrawable == NULL ||
pict->pDrawable->width != 1 ||
pict->pDrawable->height != 1)
{
return FALSE;
}
if (pict->repeat != RepeatNormal)
return FALSE;
switch (pict->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
case PICT_r8g8b8:
case PICT_b8g8r8:
case PICT_r5g6b5:
case PICT_b5g6r5:
return TRUE;
default:
return FALSE;
}
}
#define fbCanGetSolid(pict) \
(pict->pDrawable != NULL && pict->pDrawable->width == 1 && pict->pDrawable->height == 1)
#define fbComposeGetSolid(pict, bits, fmt) { \ #define fbComposeGetSolid(pict, bits, fmt) { \
FbBits *__bits__; \ FbBits *__bits__; \
FbStride __stride__; \ FbStride __stride__; \
@ -322,12 +363,6 @@
#define FASTCALL #define FASTCALL
#endif #endif
#if defined(__GNUC__)
#define INLINE __inline__
#else
#define INLINE
#endif
typedef struct _FbComposeData { typedef struct _FbComposeData {
CARD8 op; CARD8 op;
PicturePtr src; PicturePtr src;

View File

@ -1020,7 +1020,7 @@ int DarwinModifierStringToNXKey(const char *str)
* This allows the ddx layer to prevent some keys from being remapped * This allows the ddx layer to prevent some keys from being remapped
* as modifier keys. * as modifier keys.
*/ */
Bool LegalModifier(unsigned int key, DevicePtr pDev) Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{ {
return 1; return 1;
} }

View File

@ -53,7 +53,7 @@
/** Returns TRUE if the key is a valid modifier. For PC-class /** Returns TRUE if the key is a valid modifier. For PC-class
* keyboards, all keys can be used as modifiers, so return TRUE * keyboards, all keys can be used as modifiers, so return TRUE
* always. */ * always. */
Bool LegalModifier(unsigned int key, DevicePtr pDev) Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{ {
return TRUE; return TRUE;
} }

View File

@ -3,10 +3,14 @@ VESA_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via smi via
endif endif
if KDRIVEFBDEV if BUILD_KDRIVEFBDEVLIB
FBDEV_SUBDIRS = fbdev FBDEV_SUBDIRS = fbdev
endif endif
if XFAKESERVER
XFAKE_SUBDIRS = fake
endif
if XSDLSERVER if XSDLSERVER
XSDL_SUBDIRS = sdl XSDL_SUBDIRS = sdl
endif endif
@ -15,14 +19,18 @@ if XEPHYR
XEPHYR_SUBDIRS = ephyr XEPHYR_SUBDIRS = ephyr
endif endif
if KDRIVELINUX
LINUX_SUBDIRS = linux
endif
SUBDIRS = \ SUBDIRS = \
src \ src \
linux \ $(LINUX_SUBDIRS) \
$(XSDL_SUBDIRS) \ $(XSDL_SUBDIRS) \
$(FBDEV_SUBDIRS) \ $(FBDEV_SUBDIRS) \
$(VESA_SUBDIRS) \ $(VESA_SUBDIRS) \
$(XEPHYR_SUBDIRS) \ $(XEPHYR_SUBDIRS) \
fake $(XFAKE_SUBDIRS)
DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \ DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via fbdev sdl ephyr src linux fake sis300 smi via fbdev sdl ephyr src linux fake sis300

View File

@ -62,11 +62,3 @@ Xati_LDADD = \
$(ATI_LIBS) \ $(ATI_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
Xati_DEPENDENCIES = \
libati.a \
$(FBDEV_LIBS) \
$(VESA_LIBS) \
$(DRI_LIBS)

View File

@ -53,7 +53,15 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput(int argc, char **argv) InitInput(int argc, char **argv)
{ {
KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs); KdKeyboardInfo *ki = NULL;
KdAddPointerDriver(&LinuxMouseDriver);
ki = KdNewKeyboard();
if (ki) {
ki->driver = &LinuxKeyboardDriver;
KdAddKeyboard(ki);
}
KdInitInput();
} }
void void

View File

@ -24,7 +24,3 @@ Xchips_LDADD = \
$(CHIPS_LIBS) \ $(CHIPS_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
Xchips_DEPENDENCIES = \
libchips.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a

View File

@ -48,7 +48,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput (int argc, char **argv) InitInput (int argc, char **argv)
{ {
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); KdOsAddInputDrivers ();
KdInitInput ();
} }
void void

View File

@ -28,9 +28,4 @@ Xephyr_LDADD = \
libxephyr-hostx.a \ libxephyr-hostx.a \
../../../exa/libexa.la \ ../../../exa/libexa.la \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@KDRIVE_LIBS@ \
@XEPHYR_LIBS@ @XEPHYR_LIBS@
Xephyr_DEPENDENCIES = \
libxephyr.a \
libxephyr-hostx.a

View File

@ -36,10 +36,16 @@
#include "inputstr.h" #include "inputstr.h"
extern int KdTsPhyScreen; extern int KdTsPhyScreen;
extern DeviceIntPtr pKdKeyboard; KdKeyboardInfo *ephyrKbd;
KdPointerInfo *ephyrMouse;
EphyrKeySyms ephyrKeySyms;
static int mouseState = 0; static int mouseState = 0;
typedef struct _EphyrInputPrivate {
Bool enabled;
} EphyrKbdPrivate, EphyrPointerPrivate;
Bool EphyrWantGrayScale = 0; Bool EphyrWantGrayScale = 0;
Bool Bool
@ -206,15 +212,14 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
{ {
EphyrScrPriv *scrpriv = screen->driver; EphyrScrPriv *scrpriv = screen->driver;
EphyrPriv *priv = screen->card->driver; EphyrPriv *priv = screen->card->driver;
KdMouseMatrix m; KdPointerMatrix m;
int buffer_height; int buffer_height;
EPHYR_DBG(" screen->width: %d, screen->height: %d", EPHYR_DBG(" screen->width: %d, screen->height: %d",
screen->width, screen->height); screen->width, screen->height);
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height); KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetPointerMatrix (&m);
KdSetMouseMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2; priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
@ -719,8 +724,9 @@ ephyrUpdateModifierState(unsigned int state)
kptr = &keyc->down[key >> 3]; kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7); bit = 1 << (key & 7);
if (*kptr & bit) if (*kptr & bit && ephyrKbd &&
KdEnqueueKeyboardEvent(key, TRUE); /* release */ ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */
if (--count == 0) if (--count == 0)
break; break;
@ -732,7 +738,9 @@ ephyrUpdateModifierState(unsigned int state)
for (key = 0; key < MAP_LENGTH; key++) for (key = 0; key < MAP_LENGTH; key++)
if (keyc->modifierMap[key] & mask) if (keyc->modifierMap[key] & mask)
{ {
KdEnqueueKeyboardEvent(key, FALSE); /* press */ if (keyc->modifierMap[key] & mask && ephyrKbd &&
((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */
break; break;
} }
} }
@ -748,31 +756,47 @@ ephyrPoll(void)
switch (ev.type) switch (ev.type)
{ {
case EPHYR_EV_MOUSE_MOTION: case EPHYR_EV_MOUSE_MOTION:
KdEnqueueMouseEvent(kdMouseInfo, mouseState, if (!ephyrMouse ||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
continue;
KdEnqueuePointerEvent(ephyrMouse, mouseState,
ev.data.mouse_motion.x, ev.data.mouse_motion.x,
ev.data.mouse_motion.y); ev.data.mouse_motion.y,
0);
break; break;
case EPHYR_EV_MOUSE_PRESS: case EPHYR_EV_MOUSE_PRESS:
if (!ephyrMouse ||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state); ephyrUpdateModifierState(ev.key_state);
mouseState |= ev.data.mouse_down.button_num; mouseState |= ev.data.mouse_down.button_num;
KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0); KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
break; break;
case EPHYR_EV_MOUSE_RELEASE: case EPHYR_EV_MOUSE_RELEASE:
if (!ephyrMouse ||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state); ephyrUpdateModifierState(ev.key_state);
mouseState &= ~ev.data.mouse_up.button_num; mouseState &= ~ev.data.mouse_up.button_num;
KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0); KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
break; break;
case EPHYR_EV_KEY_PRESS: case EPHYR_EV_KEY_PRESS:
if (!ephyrKbd ||
!((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state); ephyrUpdateModifierState(ev.key_state);
KdEnqueueKeyboardEvent (ev.data.key_down.scancode, FALSE); KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE);
break; break;
case EPHYR_EV_KEY_RELEASE: case EPHYR_EV_KEY_RELEASE:
if (!ephyrKbd ||
!((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state); ephyrUpdateModifierState(ev.key_state);
KdEnqueueKeyboardEvent (ev.data.key_up.scancode, TRUE); KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
break; break;
default: default:
@ -833,59 +857,112 @@ ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
/* Mouse calls */ /* Mouse calls */
static Bool static Status
MouseInit (void) MouseInit (KdPointerInfo *pi)
{ {
return TRUE; pi->driverPrivate = (EphyrPointerPrivate *)
xcalloc(sizeof(EphyrPointerPrivate), 1);
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
pi->nAxes = 3;
pi->nButtons = 32;
pi->name = KdSaveString("Xephyr virtual mouse");
ephyrMouse = pi;
return Success;
}
static Status
MouseEnable (KdPointerInfo *pi)
{
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
return Success;
} }
static void static void
MouseFini (void) MouseDisable (KdPointerInfo *pi)
{ {
; ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
return;
} }
KdMouseFuncs EphyrMouseFuncs = { static void
MouseFini (KdPointerInfo *pi)
{
ephyrMouse = NULL;
return;
}
KdPointerDriver EphyrMouseDriver = {
"ephyr",
MouseInit, MouseInit,
MouseEnable,
MouseDisable,
MouseFini, MouseFini,
NULL,
}; };
/* Keyboard */ /* Keyboard */
static void static Status
EphyrKeyboardLoad (void) EphyrKeyboardInit (KdKeyboardInfo *ki)
{ {
EPHYR_DBG("mark"); ki->driverPrivate = (EphyrKbdPrivate *)
xcalloc(sizeof(EphyrKbdPrivate), 1);
hostx_load_keymap(); hostx_load_keymap();
if (!ephyrKeySyms.map) {
ErrorF("Couldn't load keymap from host\n");
return BadAlloc;
}
ki->keySyms.minKeyCode = ephyrKeySyms.minKeyCode;
ki->keySyms.maxKeyCode = ephyrKeySyms.maxKeyCode;
ki->minScanCode = ki->keySyms.minKeyCode;
ki->maxScanCode = ki->keySyms.maxKeyCode;
ki->keySyms.mapWidth = ephyrKeySyms.mapWidth;
ki->keySyms.map = ephyrKeySyms.map;
ki->name = KdSaveString("Xephyr virtual keyboard");
ephyrKbd = ki;
return Success;
} }
static int static Status
EphyrKeyboardInit (void) EphyrKeyboardEnable (KdKeyboardInfo *ki)
{ {
return 0; ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE;
return Success;
} }
static void static void
EphyrKeyboardFini (void) EphyrKeyboardDisable (KdKeyboardInfo *ki)
{
((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE;
}
static void
EphyrKeyboardFini (KdKeyboardInfo *ki)
{
/* not xfree: we call malloc from hostx.c. */
free(ki->keySyms.map);
ephyrKbd = NULL;
return;
}
static void
EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds)
{ {
} }
static void static void
EphyrKeyboardLeds (int leds) EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{ {
} }
static void KdKeyboardDriver EphyrKeyboardDriver = {
EphyrKeyboardBell (int volume, int frequency, int duration) "ephyr",
{
}
KdKeyboardFuncs EphyrKeyboardFuncs = {
EphyrKeyboardLoad,
EphyrKeyboardInit, EphyrKeyboardInit,
EphyrKeyboardEnable,
EphyrKeyboardLeds, EphyrKeyboardLeds,
EphyrKeyboardBell, EphyrKeyboardBell,
EphyrKeyboardDisable,
EphyrKeyboardFini, EphyrKeyboardFini,
0, NULL,
}; };

View File

@ -31,7 +31,6 @@
#include "os.h" /* for OsSignal() */ #include "os.h" /* for OsSignal() */
#include "kdrive.h" #include "kdrive.h"
#include "kkeymap.h"
#include "hostx.h" #include "hostx.h"
#include "exa.h" #include "exa.h"
@ -69,6 +68,8 @@ typedef struct _ephyrScrPriv {
} EphyrScrPriv; } EphyrScrPriv;
extern KdCardFuncs ephyrFuncs; extern KdCardFuncs ephyrFuncs;
extern KdKeyboardInfo *ephyrKbd;
extern KdPointerInfo *ephyrMouse;
Bool Bool
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv); ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
@ -167,9 +168,9 @@ ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
void void
ephyrUpdateModifierState(unsigned int state); ephyrUpdateModifierState(unsigned int state);
extern KdMouseFuncs EphyrMouseFuncs; extern KdPointerDriver EphyrMouseDriver;
extern KdKeyboardFuncs EphyrKeyboardFuncs; extern KdKeyboardDriver EphyrKeyboardDriver;
extern KdOsFuncs EphyrOsFuncs; extern KdOsFuncs EphyrOsFuncs;

View File

@ -51,7 +51,24 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput (int argc, char **argv) InitInput (int argc, char **argv)
{ {
KdInitInput (&EphyrMouseFuncs, &EphyrKeyboardFuncs); KdKeyboardInfo *ki;
KdPointerInfo *pi;
ki = KdNewKeyboard();
if (!ki)
FatalError("Couldn't create Xephyr keyboard\n");
ki->driver = &EphyrKeyboardDriver;
KdAddKeyboardDriver(&EphyrKeyboardDriver);
KdAddKeyboard(ki);
pi = KdNewPointer();
if (!pi)
FatalError("Couldn't create Xephyr pointer\n");
pi->driver = &EphyrMouseDriver;
KdAddPointerDriver(&EphyrMouseDriver);
KdAddPointer(pi);
KdInitInput();
} }
void void

View File

@ -77,14 +77,8 @@ static EphyrHostXVars HostX = { "?", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static int HostXWantDamageDebug = 0; static int HostXWantDamageDebug = 0;
extern KeySym EphyrKeymap[]; extern EphyrKeySyms ephyrKeySyms;
extern KeySym kdKeymap[];
extern int kdMinScanCode;
extern int kdMaxScanCode;
extern int kdMinKeyCode;
extern int kdMaxKeyCode;
extern int kdKeymapWidth;
extern int monitorResolution; extern int monitorResolution;
static void static void
@ -403,9 +397,9 @@ hostx_get_bpp(void)
} }
void void
hostx_get_visual_masks (unsigned long *rmsk, hostx_get_visual_masks (CARD32 *rmsk,
unsigned long *gmsk, CARD32 *gmsk,
unsigned long *bmsk) CARD32 *bmsk)
{ {
if (host_depth_matches_server()) if (host_depth_matches_server())
{ {
@ -683,19 +677,21 @@ hostx_load_keymap(void)
*/ */
width = (host_width > 4) ? 4 : host_width; width = (host_width > 4) ? 4 : host_width;
ephyrKeySyms.map = (KeySym *)calloc(sizeof(KeySym),
(max_keycode - min_keycode + 1) *
width);
if (!ephyrKeySyms.map)
return;
for (i=0; i<(max_keycode - min_keycode+1); i++) for (i=0; i<(max_keycode - min_keycode+1); i++)
for (j=0; j<width; j++) for (j=0; j<width; j++)
kdKeymap[ (i*width)+j ] = keymap[ (i*host_width) + j ]; ephyrKeySyms.map[(i*width)+j] = keymap[(i*host_width) + j];
EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width); EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
/* all kdrive vars - see kkeymap.c */ ephyrKeySyms.minKeyCode = min_keycode;
ephyrKeySyms.maxKeyCode = max_keycode;
kdMinScanCode = min_keycode; ephyrKeySyms.mapWidth = width;
kdMaxScanCode = max_keycode;
kdMinKeyCode = min_keycode;
kdMaxKeyCode = max_keycode;
kdKeymapWidth = width;
XFree(keymap); XFree(keymap);
} }

View File

@ -26,6 +26,9 @@
#ifndef _XLIBS_STUFF_H_ #ifndef _XLIBS_STUFF_H_
#define _XLIBS_STUFF_H_ #define _XLIBS_STUFF_H_
#include <X11/X.h>
#include <X11/Xmd.h>
#define EPHYR_WANT_DEBUG 0 #define EPHYR_WANT_DEBUG 0
#if (EPHYR_WANT_DEBUG) #if (EPHYR_WANT_DEBUG)
@ -48,6 +51,14 @@ typedef enum EphyrHostXEventType
} }
EphyrHostXEventType; EphyrHostXEventType;
/* I can't believe it's not a KeySymsRec. */
typedef struct {
int minKeyCode;
int maxKeyCode;
int mapWidth;
KeySym *map;
} EphyrKeySyms;
struct EphyrHostXEvent struct EphyrHostXEvent
{ {
EphyrHostXEventType type; EphyrHostXEventType type;
@ -126,9 +137,9 @@ int
hostx_get_bpp(void); hostx_get_bpp(void);
void void
hostx_get_visual_masks (unsigned long *rmsk, hostx_get_visual_masks (CARD32 *rmsk,
unsigned long *gmsk, CARD32 *gmsk,
unsigned long *bmsk); CARD32 *bmsk);
void void
hostx_set_cmap_entry(unsigned char idx, hostx_set_cmap_entry(unsigned char idx,
unsigned char r, unsigned char r,

View File

@ -34,34 +34,8 @@ EphyrInit (void)
return hostx_init(); return hostx_init();
} }
static void
EphyrEnable (void)
{
EPHYR_DBG("mark");
}
static Bool
EphyrSpecialKey (KeySym sym)
{
return FALSE;
}
static void
EphyrDisable (void)
{
}
static void
EphyrFini (void)
{
}
KdOsFuncs EphyrOsFuncs = { KdOsFuncs EphyrOsFuncs = {
EphyrInit, .Init = EphyrInit,
EphyrEnable, .pollEvents = ephyrPoll,
EphyrSpecialKey,
EphyrDisable,
EphyrFini,
ephyrPoll
}; };

View File

@ -24,5 +24,3 @@ Xepson_LDADD = \
$(EPSON_LIBS) \ $(EPSON_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
Xepson_DEPENDENCIES = libepson.a

View File

@ -53,10 +53,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput (int argc, char **argv) InitInput (int argc, char **argv)
{ {
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); KdOsAddInputDrivers ();
#ifdef TOUCHSCREEN KdInitInput ();
KdAddMouseDriver (&TsFuncs);
#endif
} }
int int

View File

@ -6,10 +6,6 @@ noinst_LIBRARIES = libfake.a
bin_PROGRAMS = Xfake bin_PROGRAMS = Xfake
if TSLIB
TSLIB_FLAG = -lts
endif
libfake_a_SOURCES = \ libfake_a_SOURCES = \
fake.c \ fake.c \
kbd.c \ kbd.c \
@ -23,9 +19,4 @@ Xfake_SOURCES = \
Xfake_LDADD = \ Xfake_LDADD = \
libfake.a \ libfake.a \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@KDRIVE_LIBS@ \
$(TSLIB_FLAG) \
@XSERVER_LIBS@ @XSERVER_LIBS@
Xfake_DEPENDENCIES = \
libfake.a

View File

@ -158,7 +158,7 @@ Bool
fakeMapFramebuffer (KdScreenInfo *screen) fakeMapFramebuffer (KdScreenInfo *screen)
{ {
FakeScrPriv *scrpriv = screen->driver; FakeScrPriv *scrpriv = screen->driver;
KdMouseMatrix m; KdPointerMatrix m;
FakePriv *priv = screen->card->driver; FakePriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0) if (scrpriv->randr != RR_Rotate_0)
@ -166,9 +166,9 @@ fakeMapFramebuffer (KdScreenInfo *screen)
else else
scrpriv->shadow = FALSE; scrpriv->shadow = FALSE;
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height); KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetMouseMatrix (&m); KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2; priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
if (priv->base) if (priv->base)

View File

@ -130,9 +130,9 @@ fakeRandRInit (ScreenPtr pScreen);
#endif #endif
extern KdMouseFuncs FakeMouseFuncs; extern KdPointerDriver FakePointerDriver;
extern KdKeyboardFuncs FakeKeyboardFuncs; extern KdKeyboardDriver FakeKeyboardDriver;
extern KdOsFuncs FakeOsFuncs; extern KdOsFuncs FakeOsFuncs;

View File

@ -44,7 +44,22 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput (int argc, char **argv) InitInput (int argc, char **argv)
{ {
KdInitInput (&FakeMouseFuncs, &FakeKeyboardFuncs); KdPointerInfo *pi;
KdKeyboardInfo *ki;
pi = KdNewPointer ();
if (!pi)
return;
pi->driver = &FakePointerDriver;
KdAddPointer(pi);
ki = KdNewKeyboard ();
if (!ki)
return;
ki->driver = &FakeKeyboardDriver;
KdAddKeyboard(ki);
KdInitInput ();
} }
void void

View File

@ -27,7 +27,6 @@
#include <kdrive-config.h> #include <kdrive-config.h>
#endif #endif
#include "fake.h" #include "fake.h"
#include "kkeymap.h"
#include <X11/keysym.h> #include <X11/keysym.h>
#define FAKE_WIDTH 2 #define FAKE_WIDTH 2
@ -155,41 +154,58 @@ KeySym FakeKeymap[] = {
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */ /* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
}; };
static void static Status
FakeKeyboardLoad (void) FakeKeyboardInit (KdKeyboardInfo *ki)
{ {
kdMinScanCode = 1; ki->keySyms.minKeyCode = 1;
kdKeymapWidth = FAKE_WIDTH; ki->keySyms.maxKeyCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
kdMaxScanCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH; ki->keySyms.mapWidth = FAKE_WIDTH;
memcpy (kdKeymap, FakeKeymap, sizeof (FakeKeymap)); if (ki->keySyms.map)
xfree(ki->keySyms.map);
ki->keySyms.map = (KeySym *)xalloc(sizeof(FakeKeymap));
if (!ki->keySyms.map)
return BadAlloc;
memcpy (ki->keySyms.map, FakeKeymap, sizeof (FakeKeymap));
return Success;
} }
static int static Status
FakeKeyboardInit (void) FakeKeyboardEnable (KdKeyboardInfo *ki)
{ {
return 0; return Success;
} }
static void static void
FakeKeyboardFini (void) FakeKeyboardDisable (KdKeyboardInfo *ki)
{
return;
}
static void
FakeKeyboardFini (KdKeyboardInfo *ki)
{
xfree(ki->keySyms.map);
ki->keySyms.map = NULL;
}
static void
FakeKeyboardLeds (KdKeyboardInfo *ki, int leds)
{ {
} }
static void static void
FakeKeyboardLeds (int leds) FakeKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{ {
} }
static void KdKeyboardDriver FakeKeyboardDriver = {
FakeKeyboardBell (int volume, int frequency, int duration) "fake",
{
}
KdKeyboardFuncs FakeKeyboardFuncs = {
FakeKeyboardLoad,
FakeKeyboardInit, FakeKeyboardInit,
FakeKeyboardEnable,
FakeKeyboardLeds, FakeKeyboardLeds,
FakeKeyboardBell, FakeKeyboardBell,
FakeKeyboardDisable,
FakeKeyboardFini, FakeKeyboardFini,
0, NULL,
}; };

View File

@ -35,19 +35,35 @@
#include "scrnintstr.h" #include "scrnintstr.h"
#include "kdrive.h" #include "kdrive.h"
static Bool static Status
MouseInit (void) MouseInit (KdPointerInfo *pi)
{ {
return TRUE; return Success;
}
static Status
MouseEnable (KdPointerInfo *pi)
{
return Success;
} }
static void static void
MouseFini (void) MouseDisable (KdPointerInfo *pi)
{ {
return;
}
static void
MouseFini (KdPointerInfo *pi)
{
return;
} }
KdMouseFuncs FakeMouseFuncs = { KdPointerDriver FakePointerDriver = {
"fake",
MouseInit, MouseInit,
MouseEnable,
MouseDisable,
MouseFini, MouseFini,
}; };

View File

@ -4,12 +4,13 @@ INCLUDES = \
noinst_LIBRARIES = libfbdev.a noinst_LIBRARIES = libfbdev.a
bin_PROGRAMS = Xfbdev
libfbdev_a_SOURCES = \ libfbdev_a_SOURCES = \
fbdev.c \ fbdev.c \
fbdev.h fbdev.h
if KDRIVEFBDEV
bin_PROGRAMS = Xfbdev
Xfbdev_SOURCES = \ Xfbdev_SOURCES = \
fbinit.c fbinit.c
@ -17,6 +18,4 @@ Xfbdev_LDADD = \
libfbdev.a \ libfbdev.a \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
endif
Xfbdev_DEPENDENCIES = \
libfbdev.a

View File

@ -331,7 +331,7 @@ Bool
fbdevMapFramebuffer (KdScreenInfo *screen) fbdevMapFramebuffer (KdScreenInfo *screen)
{ {
FbdevScrPriv *scrpriv = screen->driver; FbdevScrPriv *scrpriv = screen->driver;
KdMouseMatrix m; KdPointerMatrix m;
FbdevPriv *priv = screen->card->driver; FbdevPriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0) if (scrpriv->randr != RR_Rotate_0)
@ -339,9 +339,9 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
else else
scrpriv->shadow = FALSE; scrpriv->shadow = FALSE;
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height); KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetMouseMatrix (&m); KdSetPointerMatrix (&m);
screen->width = priv->var.xres; screen->width = priv->var.xres;
screen->height = priv->var.yres; screen->height = priv->var.yres;

View File

@ -45,10 +45,18 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput (int argc, char **argv) InitInput (int argc, char **argv)
{ {
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); KdKeyboardInfo *ki;
#ifdef TOUCHSCREEN
KdAddMouseDriver (&TsFuncs); KdAddKeyboardDriver (&LinuxKeyboardDriver);
KdAddPointerDriver (&LinuxMouseDriver);
#ifdef TSLIB
KdAddPointerDriver (&TsDriver);
#endif #endif
ki = KdParseKeyboard ("keybd");
KdAddKeyboard(ki);
KdInitInput ();
} }
void void

View File

@ -27,5 +27,3 @@ Xi810_LDADD = \
$(I810_LIBS) \ $(I810_LIBS) \
@KDRIVE_LIBS@ \ @KDRIVE_LIBS@ \
@XSERVER_LIBS@ @XSERVER_LIBS@
Xi810_DEPENDENCIES = libi810.a

View File

@ -73,7 +73,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput (int argc, char **argv) InitInput (int argc, char **argv)
{ {
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); KdOsAddInputDrivers ();
KdInitInput ();
} }
void void

View File

@ -56,7 +56,8 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void void
InitInput (int argc, char **argv) InitInput (int argc, char **argv)
{ {
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); KdOsAddInputDrivers ();
KdInitInput ();
} }
void void

View File

@ -27,7 +27,6 @@
#include <kdrive-config.h> #include <kdrive-config.h>
#endif #endif
#include "itsy.h" #include "itsy.h"
#include "kkeymap.h"
#include <X11/keysym.h> #include <X11/keysym.h>
#include <linux/itsy_buttons.h> #include <linux/itsy_buttons.h>
@ -167,28 +166,44 @@ ItsyKeyboardLoad (void)
{ {
KeySym *k; KeySym *k;
itsyButtonState = 0;
kdMinScanCode = 1;
kdKeymapWidth = ITSY_WIDTH;
kdMaxScanCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH;
memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap));
} }
int static Status
ItsyKeyboardInit (void) ItsyKeyboardInit (KdKeyboardInfo *ki)
{ {
int butPort; if (!ki)
return BadImplementation;
butPort = open ("/dev/buttons", 0); ki->driverPrivate = open ("/dev/buttons", 0);
fprintf (stderr, "butPort %d\n", butPort);
return butPort; itsyButtonState = 0;
ki->keySyms.minKeyCode = 1;
ki->keySyms.maxKeyCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH;
ki->minScanCode = ki->keySyms.minKeyCode;
ki->maxScanCode = ki->keySyms.maxKeyCode;
ki->keySyms.mapWidth = ITSY_WIDTH;
if (ki->keySyms.map)
xfree(ki->keySyms.map);
ki->keySyms.map = xalloc(sizeof(ItsyKeymap));
if (!ki->keySyms.map)
return BadAlloc;
memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap));
return Success;
} }
void static void
ItsyKeyboardFini (int fd) ItsyKeyboardDisable (KdKeybdInfo *ki)
{ {
if (fd >= 0) if (fd >= 0)
close (fd); close ((int)ki->driverPrivate);
}
static void
ItsyKeyboardFini (KdKeybdInfo *ki)
{
return;
} }
void void
@ -227,11 +242,13 @@ ItsyKeyboardBell (int volume, int frequency, int duration)
} }
KdKeyboardFuncs itsyKeyboardFuncs = { KdKeyboardFuncs itsyKeyboardFuncs = {
ItsyKeyboardLoad, "itsy",
ItsyKeyboardInit, ItsyKeyboardInit,
ItsyKeyboardEnable,
ItsyKeyboardRead, ItsyKeyboardRead,
ItsyKeyboardLeds, ItsyKeyboardLeds,
ItsyKeyboardBell, ItsyKeyboardBell,
ItsyKeyboardDisable
ItsyKeyboardFini, ItsyKeyboardFini,
0, NULL,
}; };

View File

@ -63,7 +63,7 @@ itsyTsReadBytes (int fd, char *buf, int len, int min)
} }
void void
itsyTsRead (int tsPort) itsyTsRead (KdPointerInfo *pi, int tsPort)
{ {
ts_event event; ts_event event;
long buf[3]; long buf[3];
@ -89,7 +89,7 @@ itsyTsRead (int tsPort)
x = 0; x = 0;
y = 0; y = 0;
} }
KdEnqueueMouseEvent (flags, x, y); KdEnqueuePointerEvent (pi, flags, x, y, 0);
} }
} }
@ -204,7 +204,8 @@ itsyTsFini (int tsPort)
close (tsPort); close (tsPort);
} }
KdMouseFuncs itsyTsMouseFuncs = { KdPointerDriver itsyTsMouseDriver = {
"itsyts",
itsyTsInit, itsyTsInit,
itsyTsRead, itsyTsRead,
itsyTsFini itsyTsFini

View File

@ -32,16 +32,3 @@ liblinux_a_SOURCES = \
$(KDRIVE_HW_SOURCES) \ $(KDRIVE_HW_SOURCES) \
$(TSLIB_C) \ $(TSLIB_C) \
$(TS_C) $(TS_C)
liblinux_a_DEPENDENCIES = \
agp.c \
bus.c \
keyboard.c \
linux.c \
mouse.c \
evdev.c \
ms.c \
ps2.c \
$(TSLIB_C) \
$(TS_C)

View File

@ -55,7 +55,7 @@ BusRead (int adbPort, void *closure)
flags |= KD_BUTTON_2; flags |= KD_BUTTON_2;
if ((buf[0] & 1) == 0) if ((buf[0] & 1) == 0)
flags |= KD_BUTTON_3; flags |= KD_BUTTON_3;
KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy); KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
} }
} }
@ -66,36 +66,71 @@ char *BusNames[] = {
#define NUM_BUS_NAMES (sizeof (BusNames) / sizeof (BusNames[0])) #define NUM_BUS_NAMES (sizeof (BusNames) / sizeof (BusNames[0]))
int BusInputType;
static int static int
BusInit (void) BusInit (KdPointerInfo *pi)
{ {
int i; int i, fd = 0;
int busPort;
int n = 0;
if (!BusInputType)
BusInputType = KdAllocInputType ();
if (!pi->path || (strcmp(pi->path, "auto") == 0))
{
for (i = 0; i < NUM_BUS_NAMES; i++) for (i = 0; i < NUM_BUS_NAMES; i++)
{ {
busPort = open (BusNames[i], 0); if ((fd = open (BusNames[i], 0)) > 0)
{ {
KdRegisterFd (BusInputType, busPort, BusRead, 0); close(fd);
n++; if (pi->path)
xfree(pi->path);
pi->path = KdSaveString(BusNames[i]);
return Success;
} }
} }
return n; }
else
{
if ((fd = open(pi->path, 0)) > 0)
{
close(fd);
return Success;
}
}
return !Success;
}
static int
BusEnable (KdPointerInfo *pi)
{
int fd = open(pi->path, 0);
if (fd > 0)
{
KdRegisterFd(fd, BusRead, pi);
pi->driverPrivate = (void *)fd;
return Success;
}
else
{
return !Success;
}
} }
static void static void
BusFini (void) BusDisable (KdPointerInfo *pi)
{ {
KdUnregisterFds (BusInputType, TRUE); KdUnregisterFd(pi, (int)pi->driverPrivate, TRUE);
} }
KdMouseFuncs BusMouseFuncs = { static void
BusFini (KdPointerInfo *pi)
{
return;
}
KdPointerDriver BusMouseDriver = {
"bus",
BusInit, BusInit,
BusFini BusEnable,
BusDisable,
BusFini,
NULL
}; };

View File

@ -62,12 +62,14 @@ typedef struct _kevdevMouse {
struct input_absinfo absinfo[ABS_MAX + 1]; struct input_absinfo absinfo[ABS_MAX + 1];
int max_rel; int max_rel;
int max_abs; int max_abs;
int fd;
} Kevdev; } Kevdev;
static void static void
EvdevMotion (KdMouseInfo *mi) EvdevMotion (KdPointerInfo *pi)
{ {
Kevdev *ke = mi->driver; Kevdev *ke = pi->driverPrivate;
int i; int i;
for (i = 0; i <= ke->max_rel; i++) for (i = 0; i <= ke->max_rel; i++)
@ -103,8 +105,8 @@ EvdevMotion (KdMouseInfo *mi)
static void static void
EvdevRead (int evdevPort, void *closure) EvdevRead (int evdevPort, void *closure)
{ {
KdMouseInfo *mi = closure; KdPointerInfo *pi = closure;
Kevdev *ke = mi->driver; Kevdev *ke = pi->driverPrivate;
int i; int i;
struct input_event events[NUM_EVENTS]; struct input_event events[NUM_EVENTS];
int n; int n;
@ -119,7 +121,7 @@ EvdevRead (int evdevPort, void *closure)
case EV_SYN: case EV_SYN:
break; break;
case EV_KEY: case EV_KEY:
EvdevMotion (mi); EvdevMotion (pi);
ASSIGNBIT(ke->key,events[i].code, events[i].value); ASSIGNBIT(ke->key,events[i].code, events[i].value);
if (events[i].code < 0x100) if (events[i].code < 0x100)
ErrorF ("key %d %d\n", events[i].code, events[i].value); ErrorF ("key %d %d\n", events[i].code, events[i].value);
@ -134,7 +136,7 @@ EvdevRead (int evdevPort, void *closure)
break; break;
} }
} }
EvdevMotion (mi); EvdevMotion (pi);
} }
int EvdevInputType; int EvdevInputType;
@ -148,41 +150,46 @@ char *kdefaultEvdev[] = {
#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0])) #define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
static Bool static Status
EvdevInit (void) EvdevInit (KdPointerInfo *pi)
{ {
int i; int i;
int fd; int fd;
KdMouseInfo *mi, *next;
int n = 0; int n = 0;
char *prot; char *prot;
if (!EvdevInputType) if (!pi->path) {
EvdevInputType = KdAllocInputType (); for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
for (mi = kdMouseInfo; mi; mi = next)
{
next = mi->next;
prot = mi->prot;
if (mi->inputType)
continue;
if (!mi->name)
{
for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
{
fd = open (kdefaultEvdev[i], 2); fd = open (kdefaultEvdev[i], 2);
if (fd >= 0) if (fd >= 0) {
{ pi->path = KdSaveString (kdefaultEvdev[i]);
mi->name = KdSaveString (kdefaultEvdev[i]);
break; break;
} }
} }
} }
else else {
fd = open (mi->name, 2); fd = open (pi->path, 2);
if (fd < 0) {
ErrorF("Failed to open evdev device %s\n", pi->path);
return BadMatch;
}
}
return Success;
}
static Status
EvdevEnable (KdPointerInfo *pi)
{
int fd;
if (!pi || !pi->path)
return BadImplementation;
fd = open(pi->path, 2);
if (fd < 0)
return BadMatch;
if (fd >= 0)
{
unsigned long ev[NBITS(EV_MAX)]; unsigned long ev[NBITS(EV_MAX)];
Kevdev *ke; Kevdev *ke;
@ -190,13 +197,13 @@ EvdevInit (void)
{ {
perror ("EVIOCGBIT 0"); perror ("EVIOCGBIT 0");
close (fd); close (fd);
continue; return BadMatch;
} }
ke = xalloc (sizeof (Kevdev)); ke = xalloc (sizeof (Kevdev));
if (!ke) if (!ke)
{ {
close (fd); close (fd);
continue; return BadAlloc;
} }
memset (ke, '\0', sizeof (Kevdev)); memset (ke, '\0', sizeof (Kevdev));
if (ISBITSET (ev, EV_KEY)) if (ISBITSET (ev, EV_KEY))
@ -207,7 +214,7 @@ EvdevInit (void)
perror ("EVIOCGBIT EV_KEY"); perror ("EVIOCGBIT EV_KEY");
xfree (ke); xfree (ke);
close (fd); close (fd);
continue; return BadMatch;
} }
} }
if (ISBITSET (ev, EV_REL)) if (ISBITSET (ev, EV_REL))
@ -218,7 +225,7 @@ EvdevInit (void)
perror ("EVIOCGBIT EV_REL"); perror ("EVIOCGBIT EV_REL");
xfree (ke); xfree (ke);
close (fd); close (fd);
continue; return BadMatch;
} }
for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--) for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
if (ISBITSET(ke->relbits, ke->max_rel)) if (ISBITSET(ke->relbits, ke->max_rel))
@ -234,7 +241,7 @@ EvdevInit (void)
perror ("EVIOCGBIT EV_ABS"); perror ("EVIOCGBIT EV_ABS");
xfree (ke); xfree (ke);
close (fd); close (fd);
continue; return BadMatch;
} }
for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--) for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
if (ISBITSET(ke->absbits, ke->max_abs)) if (ISBITSET(ke->absbits, ke->max_abs))
@ -253,38 +260,43 @@ EvdevInit (void)
{ {
xfree (ke); xfree (ke);
close (fd); close (fd);
continue; return BadValue;
} }
} }
mi->driver = ke; if (!KdRegisterFd (fd, EvdevRead, pi)) {
mi->inputType = EvdevInputType; xfree (ke);
if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi)) close (fd);
n++; return BadAlloc;
} }
} pi->driverPrivate = ke;
return TRUE; return Success;
} }
static void static void
EvdevFini (void) EvdevDisable (KdPointerInfo *pi)
{ {
KdMouseInfo *mi; Kevdev *ke;
KdUnregisterFds (EvdevInputType, TRUE); if (!pi || !pi->driverPrivate)
for (mi = kdMouseInfo; mi; mi = mi->next) return;
{
if (mi->inputType == EvdevInputType) KdUnregisterFd (pi, ke->fd, TRUE);
{ xfree (ke);
xfree (mi->driver); pi->driverPrivate = 0;
mi->driver = 0;
mi->inputType = 0;
}
}
} }
KdMouseFuncs LinuxEvdevMouseFuncs = { static void
EvdevFini (KdPointerInfo *pi)
{
}
KdPointerDriver LinuxEvdevMouseDriver = {
"evdev",
EvdevInit, EvdevInit,
EvdevEnable,
EvdevDisable,
EvdevFini, EvdevFini,
NULL,
}; };
#if 0 #if 0

View File

@ -2,31 +2,40 @@
* $RCSId: xc/programs/Xserver/hw/kdrive/linux/keyboard.c,v 1.10 2001/11/08 10:26:24 keithp Exp $ * $RCSId: xc/programs/Xserver/hw/kdrive/linux/keyboard.c,v 1.10 2001/11/08 10:26:24 keithp Exp $
* *
* Copyright © 1999 Keith Packard * Copyright © 1999 Keith Packard
* XKB integration © 2006 Nokia Corporation, author: Tomas Frydrych <tf@o-hand.com>
* *
* Permission to use, copy, modify, distribute, and sell this software and its * LinuxKeyboardRead() XKB code based on xf86KbdLnx.c:
* documentation for any purpose is hereby granted without fee, provided that * Copyright © 1990,91 by Thomas Roell, Dinkelscherben, Germany.
* the above copyright notice appear in all copies and that both that * Copyright © 1994-2001 by The XFree86 Project, Inc.
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
* *
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * Permission is hereby granted, free of charge, to any person obtaining a
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO * copy of this software and associated documentation files (the "Software"),
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR * to deal in the Software without restriction, including without limitation
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * and/or sell copies of the Software, and to permit persons to whom the
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * Software is furnished to do so, subject to the following conditions:
* PERFORMANCE OF THIS SOFTWARE. *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <kdrive-config.h> #include <kdrive-config.h>
#endif #endif
#include "kdrive.h" #include "kdrive.h"
#include "kkeymap.h"
#include <linux/keyboard.h> #include <linux/keyboard.h>
#include <linux/kd.h> #include <linux/kd.h>
#define XK_PUBLISHING #define XK_PUBLISHING
@ -103,6 +112,107 @@ static const KeySym linux_to_x[256] = {
XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
}; };
#ifdef XKB
/*
* Getting a keycode from scancode
*
* With XKB
* --------
*
* We have to enqueue keyboard events using standard X keycodes which correspond
* to AT scancode + 8; this means that we need to translate the Linux scancode
* provided by the kernel to an AT scancode -- this translation is not linear
* and requires that we use a LUT.
*
*
* Without XKB
* -----------
*
* We can use custom keycodes, which makes things simpler; we define our custom
* keycodes as Linux scancodes + KD_KEY_OFFSET
*/
/*
This LUT translates AT scancodes into Linux ones -- the keymap we create
for the core X keyboard protocol has to be AT-scancode based so that it
corresponds to the Xkb keymap.
*/
static unsigned char at2lnx[] =
{
0x0, /* no valid scancode */
0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
0x03, /* KEY_2 */ 0x04, /* KEY_3 */
0x05, /* KEY_4 */ 0x06, /* KEY_5 */
0x07, /* KEY_6 */ 0x08, /* KEY_7 */
0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
0x11, /* KEY_W */ 0x12, /* KEY_E */
0x13, /* KEY_R */ 0x14, /* KEY_T */
0x15, /* KEY_Y */ 0x16, /* KEY_U */
0x17, /* KEY_I */ 0x18, /* KEY_O */
0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
0x1f, /* KEY_S */ 0x20, /* KEY_D */
0x21, /* KEY_F */ 0x22, /* KEY_G */
0x23, /* KEY_H */ 0x24, /* KEY_J */
0x25, /* KEY_K */ 0x26, /* KEY_L */
0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
0x2d, /* KEY_X */ 0x2e, /* KEY_C */
0x2f, /* KEY_V */ 0x30, /* KEY_B */
0x31, /* KEY_N */ 0x32, /* KEY_M */
0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
0x00, /* 0x55 */ 0x56, /* KEY_Less */
0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
0x66, /* KEY_Home */ 0x67, /* KEY_Up */
0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
0x00, /* 0x71 */ 0x00, /* 0x72 */
0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
0x00, /* 0x75 */ 0x00, /* 0x76 */
0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
0x00, /* 0x7f */
};
#define NUM_AT_KEYS (sizeof(at2lnx)/sizeof(at2lnx[0]))
#define LNX_KEY_INDEX(n) n < NUM_AT_KEYS ? at2lnx[n] : 0
#else /* not XKB */
#define LNX_KEY_INDEX(n) n
#endif
static unsigned char tbl[KD_MAX_WIDTH] = static unsigned char tbl[KD_MAX_WIDTH] =
{ {
0, 0,
@ -112,24 +222,31 @@ static unsigned char tbl[KD_MAX_WIDTH] =
}; };
static void static void
readKernelMapping(void) readKernelMapping(KdKeyboardInfo *ki)
{ {
KeySym *k; KeySym *k;
int i, j; int i, j;
struct kbentry kbe; struct kbentry kbe;
int minKeyCode, maxKeyCode; int minKeyCode, maxKeyCode;
int row; int row;
int fd;
if (!ki)
return;
fd = LinuxConsoleFd;
minKeyCode = NR_KEYS; minKeyCode = NR_KEYS;
maxKeyCode = 0; maxKeyCode = 0;
row = 0; row = 0;
ki->keySyms.mapWidth = KD_MAX_WIDTH;
for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i) for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i)
{ {
kbe.kb_index = i; kbe.kb_index = LNX_KEY_INDEX(i);
k = kdKeymap + row * KD_MAX_WIDTH; k = ki->keySyms.map + row * ki->keySyms.mapWidth;
for (j = 0; j < KD_MAX_WIDTH; ++j) for (j = 0; j < ki->keySyms.mapWidth; ++j)
{ {
unsigned short kval; unsigned short kval;
@ -137,7 +254,7 @@ readKernelMapping(void)
kbe.kb_table = tbl[j]; kbe.kb_table = tbl[j];
kbe.kb_value = 0; kbe.kb_value = 0;
if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe)) if (ioctl(fd, KDGKBENT, &kbe))
continue; continue;
kval = KVAL(kbe.kb_value); kval = KVAL(kbe.kb_value);
@ -370,28 +487,223 @@ readKernelMapping(void)
if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] =NoSymbol; if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] =NoSymbol;
row++; row++;
} }
kdMinScanCode = minKeyCode; ki->minScanCode = minKeyCode;
kdMaxScanCode = maxKeyCode; ki->maxScanCode = maxKeyCode;
} }
static void #ifdef XKB
LinuxKeyboardLoad (void)
{ /*
readKernelMapping (); * We need these to handle extended scancodes correctly (I could just use the
} * numbers below, but this makes the code more readable
*/
/* The prefix codes */
#define KEY_Prefix0 /* special 0x60 */ 96
#define KEY_Prefix1 /* special 0x61 */ 97
/* The raw scancodes */
#define KEY_Enter /* Enter 0x1c */ 28
#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
#define KEY_Slash /* / (Slash) ? 0x35 */ 53
#define KEY_KP_Multiply /* * 0x37 */ 55
#define KEY_Alt /* Alt(left) 0x38 */ 56
#define KEY_F3 /* F3 0x3d */ 61
#define KEY_F4 /* F4 0x3e */ 62
#define KEY_F5 /* F5 0x3f */ 63
#define KEY_F6 /* F6 0x40 */ 64
#define KEY_F7 /* F7 0x41 */ 65
#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
#define KEY_KP_7 /* 7 Home 0x47 */ 71
#define KEY_KP_8 /* 8 Up 0x48 */ 72
#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
#define KEY_KP_4 /* 4 Left 0x4b */ 75
#define KEY_KP_5 /* 5 0x4c */ 76
#define KEY_KP_6 /* 6 Right 0x4d */ 77
#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
#define KEY_KP_1 /* 1 End 0x4f */ 79
#define KEY_KP_2 /* 2 Down 0x50 */ 80
#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
#define KEY_KP_0 /* 0 Insert 0x52 */ 82
#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
#define KEY_Home /* Home 0x59 */ 89
#define KEY_Up /* Up 0x5a */ 90
#define KEY_PgUp /* PgUp 0x5b */ 91
#define KEY_Left /* Left 0x5c */ 92
#define KEY_Begin /* Begin 0x5d */ 93
#define KEY_Right /* Right 0x5e */ 94
#define KEY_End /* End 0x5f */ 95
#define KEY_Down /* Down 0x60 */ 96
#define KEY_PgDown /* PgDown 0x61 */ 97
#define KEY_Insert /* Insert 0x62 */ 98
#define KEY_Delete /* Delete 0x63 */ 99
#define KEY_KP_Enter /* Enter 0x64 */ 100
#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
#define KEY_Pause /* Pause 0x66 */ 102
#define KEY_Print /* Print 0x67 */ 103
#define KEY_KP_Divide /* Divide 0x68 */ 104
#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
#define KEY_Break /* Break 0x6a */ 106
#define KEY_LMeta /* Left Meta 0x6b */ 107
#define KEY_RMeta /* Right Meta 0x6c */ 108
#define KEY_Menu /* Menu 0x6d */ 109
#define KEY_F13 /* F13 0x6e */ 110
#define KEY_F14 /* F14 0x6f */ 111
#define KEY_F15 /* F15 0x70 */ 112
#define KEY_F16 /* F16 0x71 */ 113
#define KEY_F17 /* F17 0x72 */ 114
#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
#endif /* XKB */
static void static void
LinuxKeyboardRead (int fd, void *closure) LinuxKeyboardRead (int fd, void *closure)
{ {
unsigned char buf[256], *b; unsigned char buf[256], *b;
int n; int n;
unsigned char prefix = 0, scancode = 0;
while ((n = read (fd, buf, sizeof (buf))) > 0) while ((n = read (fd, buf, sizeof (buf))) > 0) {
{
b = buf; b = buf;
while (n--) while (n--) {
#ifdef XKB
if (!noXkbExtension) {
/*
* With xkb we use RAW mode for reading the console, which allows us
* process extended scancodes.
*
* See if this is a prefix extending the following keycode
*/
if (!prefix && ((b[0] & 0x7f) == KEY_Prefix0))
{ {
KdEnqueueKeyboardEvent (b[0] & 0x7f, b[0] & 0x80); prefix = KEY_Prefix0;
#ifdef DEBUG
ErrorF("Prefix0");
#endif
/* swallow this up */
b++;
continue;
}
else if (!prefix && ((b[0] & 0x7f) == KEY_Prefix1))
{
prefix = KEY_Prefix1;
ErrorF("Prefix1");
/* swallow this up */
b++;
continue;
}
scancode = b[0] & 0x7f;
switch (prefix) {
/* from xf86Events.c */
case KEY_Prefix0:
{
#ifdef DEBUG
ErrorF("Prefix0 scancode: 0x%02x\n", scancode);
#endif
switch (scancode) {
case KEY_KP_7:
scancode = KEY_Home; break; /* curs home */
case KEY_KP_8:
scancode = KEY_Up; break; /* curs up */
case KEY_KP_9:
scancode = KEY_PgUp; break; /* curs pgup */
case KEY_KP_4:
scancode = KEY_Left; break; /* curs left */
case KEY_KP_5:
scancode = KEY_Begin; break; /* curs begin */
case KEY_KP_6:
scancode = KEY_Right; break; /* curs right */
case KEY_KP_1:
scancode = KEY_End; break; /* curs end */
case KEY_KP_2:
scancode = KEY_Down; break; /* curs down */
case KEY_KP_3:
scancode = KEY_PgDown; break; /* curs pgdown */
case KEY_KP_0:
scancode = KEY_Insert; break; /* curs insert */
case KEY_KP_Decimal:
scancode = KEY_Delete; break; /* curs delete */
case KEY_Enter:
scancode = KEY_KP_Enter; break; /* keypad enter */
case KEY_LCtrl:
scancode = KEY_RCtrl; break; /* right ctrl */
case KEY_KP_Multiply:
scancode = KEY_Print; break; /* print */
case KEY_Slash:
scancode = KEY_KP_Divide; break; /* keyp divide */
case KEY_Alt:
scancode = KEY_AltLang; break; /* right alt */
case KEY_ScrollLock:
scancode = KEY_Break; break; /* curs break */
case 0x5b:
scancode = KEY_LMeta; break;
case 0x5c:
scancode = KEY_RMeta; break;
case 0x5d:
scancode = KEY_Menu; break;
case KEY_F3:
scancode = KEY_F13; break;
case KEY_F4:
scancode = KEY_F14; break;
case KEY_F5:
scancode = KEY_F15; break;
case KEY_F6:
scancode = KEY_F16; break;
case KEY_F7:
scancode = KEY_F17; break;
case KEY_KP_Plus:
scancode = KEY_KP_DEC; break;
/* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */
case 0x2A:
case 0x36:
b++;
prefix = 0;
continue;
default:
#ifdef DEBUG
ErrorF("Unreported Prefix0 scancode: 0x%02x\n",
scancode);
#endif
/*
* "Internet" keyboards are generating lots of new
* codes. Let them pass. There is little consistency
* between them, so don't bother with symbolic names at
* this level.
*/
scancode += 0x78;
}
break;
}
case KEY_Prefix1:
{
/* we do no handle these */
#ifdef DEBUG
ErrorF("Prefix1 scancode: 0x%02x\n", scancode);
#endif
b++;
prefix = 0;
continue;
}
default: /* should not happen*/
case 0: /* do nothing */
#ifdef DEBUG
ErrorF("Plain scancode: 0x%02x\n", scancode);
#endif
;
}
prefix = 0;
}
/* without xkb we use mediumraw mode -- enqueue the scancode as is */
else
#endif
scancode = b[0] & 0x7f;
KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
b++; b++;
} }
} }
@ -399,19 +711,30 @@ LinuxKeyboardRead (int fd, void *closure)
static int LinuxKbdTrans; static int LinuxKbdTrans;
static struct termios LinuxTermios; static struct termios LinuxTermios;
static int LinuxKbdType;
static int static Status
LinuxKeyboardEnable (int fd, void *closure) LinuxKeyboardEnable (KdKeyboardInfo *ki)
{ {
struct termios nTty; struct termios nTty;
unsigned char buf[256]; unsigned char buf[256];
int n; int n;
int fd;
if (!ki)
return !Success;
fd = LinuxConsoleFd;
ki->driverPrivate = (void *) fd;
ioctl (fd, KDGKBMODE, &LinuxKbdTrans); ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
tcgetattr (fd, &LinuxTermios); tcgetattr (fd, &LinuxTermios);
#ifdef XKB
if (!noXkbExtension)
ioctl(fd, KDSKBMODE, K_RAW);
else
#else
ioctl(fd, KDSKBMODE, K_MEDIUMRAW); ioctl(fd, KDSKBMODE, K_MEDIUMRAW);
#endif
nTty = LinuxTermios; nTty = LinuxTermios;
nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
nTty.c_oflag = 0; nTty.c_oflag = 0;
@ -422,66 +745,64 @@ LinuxKeyboardEnable (int fd, void *closure)
cfsetispeed(&nTty, 9600); cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600); cfsetospeed(&nTty, 9600);
tcsetattr(fd, TCSANOW, &nTty); tcsetattr(fd, TCSANOW, &nTty);
/* Our kernel cleverly ignores O_NONBLOCK. Sigh. */
#if 0
/* /*
* Flush any pending keystrokes * Flush any pending keystrokes
*/ */
while ((n = read (fd, buf, sizeof (buf))) > 0) while ((n = read (fd, buf, sizeof (buf))) > 0)
; ;
return fd; #endif
KdRegisterFd (fd, LinuxKeyboardRead, ki);
return Success;
} }
static void static void
LinuxKeyboardDisable (int fd, void *closure) LinuxKeyboardDisable (KdKeyboardInfo *ki)
{ {
ioctl(LinuxConsoleFd, KDSKBMODE, LinuxKbdTrans); int fd;
tcsetattr(LinuxConsoleFd, TCSANOW, &LinuxTermios);
if (!ki)
return;
fd = (int) ki->driverPrivate;
KdUnregisterFd(ki, fd, FALSE);
ioctl(fd, KDSKBMODE, LinuxKbdTrans);
tcsetattr(fd, TCSANOW, &LinuxTermios);
} }
static int static Status
LinuxKeyboardInit (void) LinuxKeyboardInit (KdKeyboardInfo *ki)
{ {
if (!LinuxKbdType) if (!ki)
LinuxKbdType = KdAllocInputType (); return !Success;
KdRegisterFd (LinuxKbdType, LinuxConsoleFd, LinuxKeyboardRead, 0); if (ki->path)
LinuxKeyboardEnable (LinuxConsoleFd, 0); xfree(ki->path);
KdRegisterFdEnableDisable (LinuxConsoleFd, ki->path = KdSaveString("console");
LinuxKeyboardEnable, if (ki->name)
LinuxKeyboardDisable); xfree(ki->name);
return 1; ki->name = KdSaveString("Linux console keyboard");
readKernelMapping (ki);
return Success;
} }
static void static void
LinuxKeyboardFini (void) LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
{ {
LinuxKeyboardDisable (LinuxConsoleFd, 0); if (!ki)
KdUnregisterFds (LinuxKbdType, FALSE); return;
ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
} }
static void KdKeyboardDriver LinuxKeyboardDriver = {
LinuxKeyboardLeds (int leds) "keyboard",
{ .Init = LinuxKeyboardInit,
ioctl (LinuxConsoleFd, KDSETLED, leds & 7); .Enable = LinuxKeyboardEnable,
} .Leds = LinuxKeyboardLeds,
.Disable = LinuxKeyboardDisable,
static void
LinuxKeyboardBell (int volume, int pitch, int duration)
{
if (volume && pitch)
{
ioctl(LinuxConsoleFd, KDMKTONE,
((1193190 / pitch) & 0xffff) |
(((unsigned long)duration *
volume / 50) << 16));
}
}
KdKeyboardFuncs LinuxKeyboardFuncs = {
LinuxKeyboardLoad,
LinuxKeyboardInit,
LinuxKeyboardLeds,
LinuxKeyboardBell,
LinuxKeyboardFini,
3,
}; };

View File

@ -373,26 +373,6 @@ LinuxEnable (void)
enabled = TRUE; enabled = TRUE;
} }
static Bool
LinuxSpecialKey (KeySym sym)
{
struct vt_stat vts;
int con;
if (XK_F1 <= sym && sym <= XK_F12)
{
con = sym - XK_F1 + 1;
memset (&vts, '\0', sizeof (vts)); /* valgrind */
ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
if (con != vts.v_active && (vts.v_state & (1 << con)))
{
ioctl (LinuxConsoleFd, VT_ACTIVATE, con);
return TRUE;
}
}
return FALSE;
}
static void static void
LinuxDisable (void) LinuxDisable (void)
{ {
@ -456,6 +436,7 @@ LinuxFini (void)
} }
} }
close(LinuxConsoleFd); /* make the vt-manager happy */ close(LinuxConsoleFd); /* make the vt-manager happy */
LinuxConsoleFd = -1;
fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0); fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
if (fd >= 0) if (fd >= 0)
{ {
@ -468,13 +449,32 @@ LinuxFini (void)
return; return;
} }
void
KdOsAddInputDrivers ()
{
KdAddPointerDriver(&LinuxMouseDriver);
KdAddPointerDriver(&MsMouseDriver);
KdAddPointerDriver(&Ps2MouseDriver);
#ifdef TSLIB
KdAddPointerDriver(&TsDriver);
#endif
KdAddKeyboardDriver(&LinuxKeyboardDriver);
}
static void
LinuxBell(int volume, int pitch, int duration)
{
if (volume && pitch)
ioctl(LinuxConsoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) |
(((unsigned long)duration * volume / 50) << 16));
}
KdOsFuncs LinuxFuncs = { KdOsFuncs LinuxFuncs = {
LinuxInit, .Init = LinuxInit,
LinuxEnable, .Enable = LinuxEnable,
LinuxSpecialKey, .Disable = LinuxDisable,
LinuxDisable, .Fini = LinuxFini,
LinuxFini, .Bell = LinuxBell,
0
}; };
void void

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