Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver
This commit is contained in:
commit
539bf3c283
|
@ -31,8 +31,6 @@ INCLUDES = \
|
|||
|
||||
nodist_libglx_la_SOURCES = indirect_size.h \
|
||||
glapi.c \
|
||||
glcontextmodes.c \
|
||||
glcontextmode.h \
|
||||
glthread.c \
|
||||
indirect_dispatch.c \
|
||||
indirect_dispatch.h \
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include <windowstr.h>
|
||||
#include "glxutil.h"
|
||||
#include "glxext.h"
|
||||
#include "glcontextmodes.h"
|
||||
#include "glapitable.h"
|
||||
#include "glapi.h"
|
||||
#include "glthread.h"
|
||||
|
@ -83,9 +82,9 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err)
|
|||
|
||||
static int
|
||||
validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
||||
__GLcontextModes **config, int *err)
|
||||
__GLXconfig **config, int *err)
|
||||
{
|
||||
__GLcontextModes *m;
|
||||
__GLXconfig *m;
|
||||
|
||||
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next)
|
||||
if (m->fbconfigID == id) {
|
||||
|
@ -101,7 +100,7 @@ validGlxFBConfig(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
|||
|
||||
static int
|
||||
validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
||||
__GLcontextModes **config, int *err)
|
||||
__GLXconfig **config, int *err)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -118,7 +117,7 @@ validGlxVisual(ClientPtr client, __GLXscreen *pGlxScreen, XID id,
|
|||
}
|
||||
|
||||
static int
|
||||
validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config,
|
||||
validGlxFBConfigForWindow(ClientPtr client, __GLXconfig *config,
|
||||
DrawablePtr pDraw, int *err)
|
||||
{
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
|
@ -135,7 +134,7 @@ validGlxFBConfigForWindow(ClientPtr client, __GLcontextModes *config,
|
|||
}
|
||||
|
||||
/* FIXME: What exactly should we check here... */
|
||||
if (pVisual->class != _gl_convert_to_x_visual_type(config->visualType) ||
|
||||
if (pVisual->class != glxConvertToXVisualType(config->visualType) ||
|
||||
!(config->drawableType & GLX_WINDOW_BIT)) {
|
||||
client->errorValue = pDraw->id;
|
||||
*err = BadMatch;
|
||||
|
@ -161,7 +160,7 @@ static void __glXdirectContextDestroy(__GLXcontext *context)
|
|||
}
|
||||
|
||||
static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *modes,
|
||||
__GLXcontext *shareContext)
|
||||
{
|
||||
__GLXcontext *context;
|
||||
|
@ -186,7 +185,7 @@ static __GLXcontext *__glXdirectContextCreate(__GLXscreen *screen,
|
|||
|
||||
static int
|
||||
DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
||||
GLXContextID shareList, __GLcontextModes *config,
|
||||
GLXContextID shareList, __GLXconfig *config,
|
||||
__GLXscreen *pGlxScreen, GLboolean isDirect)
|
||||
{
|
||||
ClientPtr client = cl->client;
|
||||
|
@ -248,7 +247,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
** a GL core that needs windowing information (e.g., Mesa).
|
||||
*/
|
||||
glxc->pGlxScreen = pGlxScreen;
|
||||
glxc->modes = config;
|
||||
glxc->config = config;
|
||||
|
||||
/*
|
||||
** Register this context as a resource.
|
||||
|
@ -276,7 +275,7 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
|
|||
int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -292,7 +291,7 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc)
|
|||
int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -309,7 +308,7 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
{
|
||||
xGLXCreateContextWithConfigSGIXReq *req =
|
||||
(xGLXCreateContextWithConfigSGIXReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -462,7 +461,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
|
|||
* GLXPixmap and we just return the __GLXdrawable. */
|
||||
pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes);
|
||||
if (pGlxDraw != NULL) {
|
||||
if (glxc != NULL && pGlxDraw->modes != glxc->modes) {
|
||||
if (glxc != NULL && pGlxDraw->config != glxc->config) {
|
||||
client->errorValue = drawId;
|
||||
*error = BadMatch;
|
||||
return NULL;
|
||||
|
@ -497,12 +496,12 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client,
|
|||
* the context screen and that the context fbconfig is compatible
|
||||
* with the window visual. */
|
||||
if (pDraw->pScreen != glxc->pGlxScreen->pScreen ||
|
||||
!validGlxFBConfigForWindow(client, glxc->modes, pDraw, error))
|
||||
!validGlxFBConfigForWindow(client, glxc->config, pDraw, error))
|
||||
return NULL;
|
||||
|
||||
pGlxDraw = glxc->pGlxScreen->createDrawable(glxc->pGlxScreen,
|
||||
pDraw, GLX_DRAWABLE_WINDOW,
|
||||
drawId, glxc->modes);
|
||||
drawId, glxc->config);
|
||||
|
||||
/* since we are creating the drawablePrivate, drawId should be new */
|
||||
if (!AddResource(drawId, __glXDrawableRes, pGlxDraw)) {
|
||||
|
@ -878,7 +877,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
ClientPtr client = cl->client;
|
||||
xGLXGetVisualConfigsReply reply;
|
||||
__GLXscreen *pGlxScreen;
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *modes;
|
||||
CARD32 buf[__GLX_TOTAL_CONFIG];
|
||||
int p, i, err;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
|
@ -907,7 +906,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
|
||||
p = 0;
|
||||
buf[p++] = modes->visualID;
|
||||
buf[p++] = _gl_convert_to_x_visual_type( modes->visualType );
|
||||
buf[p++] = glxConvertToXVisualType( modes->visualType );
|
||||
buf[p++] = modes->rgbMode;
|
||||
|
||||
buf[p++] = modes->redBits;
|
||||
|
@ -960,7 +959,7 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
|
|||
return Success;
|
||||
}
|
||||
|
||||
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28)
|
||||
#define __GLX_TOTAL_FBCONFIG_ATTRIBS (33)
|
||||
#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
|
||||
/**
|
||||
* Send the set of GLXFBConfigs to the client. There is not currently
|
||||
|
@ -980,7 +979,7 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
|
|||
__GLXscreen *pGlxScreen;
|
||||
CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH];
|
||||
int p, err;
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *modes;
|
||||
__GLX_DECLARE_SWAP_VARIABLES;
|
||||
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
|
||||
|
||||
|
@ -1038,6 +1037,11 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen)
|
|||
WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha );
|
||||
WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex );
|
||||
WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod );
|
||||
WRITE_PAIR( GLX_DRAWABLE_TYPE, modes->drawableType );
|
||||
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb );
|
||||
WRITE_PAIR( GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba );
|
||||
WRITE_PAIR( GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture );
|
||||
WRITE_PAIR( GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets );
|
||||
|
||||
if (client->swapped) {
|
||||
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
|
||||
|
@ -1062,7 +1066,7 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
}
|
||||
|
||||
static int
|
||||
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config,
|
||||
DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
|
||||
DrawablePtr pDraw, XID glxDrawableId, int type)
|
||||
{
|
||||
__GLXdrawable *pGlxDraw;
|
||||
|
@ -1086,7 +1090,7 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes
|
|||
}
|
||||
|
||||
static int
|
||||
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLcontextModes *config,
|
||||
DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config,
|
||||
XID drawableId, XID glxDrawableId)
|
||||
{
|
||||
DrawablePtr pDraw;
|
||||
|
@ -1144,7 +1148,7 @@ determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs)
|
|||
int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -1160,7 +1164,7 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
|
|||
int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -1184,7 +1188,7 @@ int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
{
|
||||
xGLXCreateGLXPixmapWithConfigSGIXReq *req =
|
||||
(xGLXCreateGLXPixmapWithConfigSGIXReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
int err;
|
||||
|
||||
|
@ -1246,7 +1250,7 @@ static int
|
|||
DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
|
||||
int width, int height, XID glxDrawableId)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
PixmapPtr pPixmap;
|
||||
int err;
|
||||
|
@ -1359,7 +1363,7 @@ int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
|
|||
int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
|
||||
{
|
||||
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
__GLXscreen *pGlxScreen;
|
||||
ClientPtr client = cl->client;
|
||||
DrawablePtr pDraw;
|
||||
|
@ -1473,7 +1477,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId)
|
|||
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
|
||||
*pSendBuf++ = (int)(ctx->share_id);
|
||||
*pSendBuf++ = GLX_VISUAL_ID_EXT;
|
||||
*pSendBuf++ = (int)(ctx->modes->visualID);
|
||||
*pSendBuf++ = (int)(ctx->config->visualID);
|
||||
*pSendBuf++ = GLX_SCREEN_EXT;
|
||||
*pSendBuf++ = (int)(ctx->pGlxScreen->pScreen->myNum);
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
typedef struct __GLXtextureFromPixmap __GLXtextureFromPixmap;
|
||||
struct __GLXtextureFromPixmap {
|
||||
int (*bindTexImage) (__GLXcontext *baseContext,
|
||||
|
@ -77,9 +75,9 @@ struct __GLXcontext {
|
|||
__GLXcontext *nextReadPriv;
|
||||
|
||||
/*
|
||||
** mode struct for this context
|
||||
** config struct for this context
|
||||
*/
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *config;
|
||||
|
||||
/*
|
||||
** Pointer to screen info data for this context. This is set
|
||||
|
|
|
@ -74,7 +74,7 @@ struct __GLXdrawable {
|
|||
/*
|
||||
** Configuration of the visual to which this drawable was created.
|
||||
*/
|
||||
__GLcontextModes *modes;
|
||||
__GLXconfig *config;
|
||||
|
||||
/*
|
||||
** Lists of contexts bound to this drawable. There are two lists here.
|
||||
|
|
227
GL/glx/glxdri.c
227
GL/glx/glxdri.c
|
@ -52,7 +52,6 @@
|
|||
#define DRI_NEW_INTERFACE_ONLY
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#include "g_disptab.h"
|
||||
#include "glapitable.h"
|
||||
|
@ -61,26 +60,26 @@
|
|||
#include "dispatch.h"
|
||||
#include "extension_string.h"
|
||||
|
||||
#define containerOf(ptr, type, member) \
|
||||
(type *)( (char *)ptr - offsetof(type,member) )
|
||||
|
||||
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
|
||||
typedef struct __GLXDRIconfig __GLXDRIconfig;
|
||||
|
||||
struct __GLXDRIscreen {
|
||||
__GLXscreen base;
|
||||
__DRIscreen driScreen;
|
||||
__DRIscreen *driScreen;
|
||||
void *driver;
|
||||
|
||||
xf86EnterVTProc *enterVT;
|
||||
xf86LeaveVTProc *leaveVT;
|
||||
|
||||
__DRIcopySubBufferExtension *copySubBuffer;
|
||||
__DRIswapControlExtension *swapControl;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRIlegacyExtension *legacy;
|
||||
const __DRIcopySubBufferExtension *copySubBuffer;
|
||||
const __DRIswapControlExtension *swapControl;
|
||||
|
||||
#ifdef __DRI_TEX_OFFSET
|
||||
__DRItexOffsetExtension *texOffset;
|
||||
const __DRItexOffsetExtension *texOffset;
|
||||
DRITexOffsetStartProcPtr texOffsetStart;
|
||||
DRITexOffsetFinishProcPtr texOffsetFinish;
|
||||
__GLXDRIdrawable *texOffsetOverride[16];
|
||||
|
@ -92,13 +91,13 @@ struct __GLXDRIscreen {
|
|||
|
||||
struct __GLXDRIcontext {
|
||||
__GLXcontext base;
|
||||
__DRIcontext driContext;
|
||||
__DRIcontext *driContext;
|
||||
XID hwContextID;
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawable {
|
||||
__GLXdrawable base;
|
||||
__DRIdrawable driDrawable;
|
||||
__DRIdrawable *driDrawable;
|
||||
|
||||
/* Pulled in from old __GLXpixmap */
|
||||
#ifdef __DRI_TEX_OFFSET
|
||||
|
@ -109,7 +108,10 @@ struct __GLXDRIdrawable {
|
|||
#endif
|
||||
};
|
||||
|
||||
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI_CREATE_NEW_SCREEN_STRING;
|
||||
struct __GLXDRIconfig {
|
||||
__GLXconfig config;
|
||||
__DRIconfig *driConfig;
|
||||
};
|
||||
|
||||
static void
|
||||
__glXDRIleaveServer(GLboolean rendering)
|
||||
|
@ -151,7 +153,7 @@ __glXDRIleaveServer(GLboolean rendering)
|
|||
__GLXDRIdrawable *pGlxPix = texOffsetOverride[j];
|
||||
|
||||
if (pGlxPix && pGlxPix->texname) {
|
||||
screen->texOffset->setTexOffset(&pGlxPix->ctx->driContext,
|
||||
screen->texOffset->setTexOffset(pGlxPix->ctx->driContext,
|
||||
pGlxPix->texname,
|
||||
pGlxPix->offset,
|
||||
pGlxPix->base.pDraw->depth,
|
||||
|
@ -219,20 +221,20 @@ static void
|
|||
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
|
||||
__GLXDRIscreen *screen;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
|
||||
glxGetScreen(screenInfo.screens[i]),
|
||||
private);
|
||||
screen = (__GLXDRIscreen *) glxGetScreen(screenInfo.screens[i]);
|
||||
__glXDRIdoReleaseTexImage(screen, private);
|
||||
}
|
||||
|
||||
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
||||
|
||||
/* If the X window was destroyed, the dri DestroyWindow hook will
|
||||
* aready have taken care of this, so only call if pDraw isn't NULL. */
|
||||
if (drawable->pDraw != NULL) {
|
||||
screen = (__GLXDRIscreen *) glxGetScreen(drawable->pDraw->pScreen);
|
||||
(*screen->core->destroyDrawable)(private->driDrawable);
|
||||
|
||||
__glXenterServer(GL_FALSE);
|
||||
DRIDestroyDrawable(drawable->pDraw->pScreen,
|
||||
serverClient, drawable->pDraw);
|
||||
|
@ -255,8 +257,10 @@ static GLboolean
|
|||
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIscreen *screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(basePrivate->pDraw->pScreen);
|
||||
|
||||
(*private->driDrawable.swapBuffers)(&private->driDrawable);
|
||||
(*screen->core->swapBuffers)(private->driDrawable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -266,11 +270,11 @@ static int
|
|||
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
|
||||
{
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||
__GLXDRIscreen *screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||
|
||||
if (screen->swapControl)
|
||||
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
|
||||
screen->swapControl->setSwapInterval(draw->driDrawable, interval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -285,20 +289,21 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
|
|||
glxGetScreen(basePrivate->pDraw->pScreen);
|
||||
|
||||
if (screen->copySubBuffer)
|
||||
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
|
||||
x, y, w, h);
|
||||
screen->copySubBuffer->copySubBuffer(private->driDrawable, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
Bool retval;
|
||||
|
||||
context->driContext.destroyContext(&context->driContext);
|
||||
screen->core->destroyContext(context->driContext);
|
||||
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen, context->hwContextID);
|
||||
retval = DRIDestroyContext(baseContext->pGlxScreen->pScreen,
|
||||
context->hwContextID);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
__glXContextDestroy(&context->base);
|
||||
|
@ -309,20 +314,22 @@ static int
|
|||
__glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.unbindContext)(&context->driContext);
|
||||
return (*screen->core->unbindContext)(context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -331,13 +338,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
|
|||
{
|
||||
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
|
||||
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
|
||||
|
||||
/* FIXME: We will need to add DRIcontext::copyContext for this. */
|
||||
|
||||
(void) dst;
|
||||
(void) src;
|
||||
|
||||
return FALSE;
|
||||
return (*screen->core->copyContext)(dst->driContext,
|
||||
src->driContext, mask);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -346,10 +350,11 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
|||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -392,10 +397,8 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
|
|||
int bpp, override = 0, texname;
|
||||
GLenum format, type;
|
||||
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
|
||||
__GLXDRIdrawable *driDraw =
|
||||
containerOf(glxPixmap, __GLXDRIdrawable, base);
|
||||
__GLXDRIscreen * const screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
__GLXDRIdrawable *driDraw = (__GLXDRIdrawable *) glxPixmap;
|
||||
__GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
|
||||
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
|
||||
GL_TEXTURE_BINDING_2D :
|
||||
|
@ -439,7 +442,7 @@ alreadyin:
|
|||
|
||||
driDraw->texname = texname;
|
||||
|
||||
screen->texOffset->setTexOffset(&driDraw->ctx->driContext, texname, 0,
|
||||
screen->texOffset->setTexOffset(driDraw->ctx->driContext, texname, 0,
|
||||
pixmap->drawable.depth,
|
||||
pixmap->devKind);
|
||||
}
|
||||
|
@ -568,9 +571,11 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext,
|
|||
int buffer,
|
||||
__GLXdrawable *pixmap)
|
||||
{
|
||||
__glXDRIdoReleaseTexImage((__GLXDRIscreen *)
|
||||
glxGetScreen(pixmap->pDraw->pScreen),
|
||||
containerOf(pixmap, __GLXDRIdrawable, base));
|
||||
__GLXDRIscreen *screen =
|
||||
(__GLXDRIscreen *) glxGetScreen(pixmap->pDraw->pScreen);
|
||||
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) pixmap;
|
||||
|
||||
__glXDRIdoReleaseTexImage(screen, drawable);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
@ -585,7 +590,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
|
||||
screen->driScreen.destroyScreen(&screen->driScreen);
|
||||
screen->core->destroyScreen(screen->driScreen);
|
||||
|
||||
dlclose(screen->driver);
|
||||
|
||||
|
@ -596,11 +601,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
|
||||
static __GLXcontext *
|
||||
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *glxConfig,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
__GLXDRIcontext *context, *shareContext;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
VisualPtr visual;
|
||||
int i;
|
||||
GLboolean retval;
|
||||
|
@ -610,7 +616,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
|
||||
shareContext = (__GLXDRIcontext *) baseShareContext;
|
||||
if (shareContext)
|
||||
driShare = &shareContext->driContext;
|
||||
driShare = shareContext->driContext;
|
||||
else
|
||||
driShare = NULL;
|
||||
|
||||
|
@ -632,7 +638,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
/* Find the requested X visual */
|
||||
visual = pScreen->visuals;
|
||||
for (i = 0; i < pScreen->numVisuals; i++, visual++)
|
||||
if (visual->vid == modes->visualID)
|
||||
if (visual->vid == glxConfig->visualID)
|
||||
break;
|
||||
if (i == pScreen->numVisuals)
|
||||
return GL_FALSE;
|
||||
|
@ -644,15 +650,15 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
context->hwContextID, &hwContext);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
||||
context->driContext.private =
|
||||
screen->driScreen.createNewContext(&screen->driScreen,
|
||||
modes,
|
||||
context->driContext =
|
||||
screen->legacy->createNewContext(screen->driScreen,
|
||||
config->driConfig,
|
||||
0, /* render type */
|
||||
driShare,
|
||||
hwContext,
|
||||
&context->driContext);
|
||||
context);
|
||||
|
||||
if (context->driContext.private == NULL) {
|
||||
if (context->driContext == NULL) {
|
||||
__glXenterServer(GL_FALSE);
|
||||
retval = DRIDestroyContext(baseScreen->pScreen, context->hwContextID);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
@ -668,9 +674,10 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXconfig *glxConfig)
|
||||
{
|
||||
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
__GLXDRIdrawable *private;
|
||||
GLboolean retval;
|
||||
drm_drawable_t hwDrawable;
|
||||
|
@ -682,7 +689,7 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
memset(private, 0, sizeof *private);
|
||||
|
||||
if (!__glXDrawableInit(&private->base, screen,
|
||||
pDraw, type, drawId, modes)) {
|
||||
pDraw, type, drawId, glxConfig)) {
|
||||
xfree(private);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -700,13 +707,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
/* The last argument is 'attrs', which is used with pbuffers which
|
||||
* we currently don't support. */
|
||||
|
||||
private->driDrawable.private =
|
||||
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
|
||||
modes,
|
||||
&private->driDrawable,
|
||||
hwDrawable, 0, 0, NULL);
|
||||
private->driDrawable =
|
||||
(driScreen->legacy->createNewDrawable)(driScreen->driScreen,
|
||||
config->driConfig,
|
||||
hwDrawable, 0, NULL, private);
|
||||
|
||||
if (private->driDrawable.private == NULL) {
|
||||
if (private->driDrawable == NULL) {
|
||||
__glXenterServer(GL_FALSE);
|
||||
DRIDestroyDrawable(screen->pScreen, serverClient, pDraw);
|
||||
__glXleaveServer(GL_FALSE);
|
||||
|
@ -723,10 +729,10 @@ getDrawableInfo(__DRIdrawable *driDrawable,
|
|||
int *x, int *y, int *width, int *height,
|
||||
int *numClipRects, drm_clip_rect_t **ppClipRects,
|
||||
int *backX, int *backY,
|
||||
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects)
|
||||
int *numBackClipRects, drm_clip_rect_t **ppBackClipRects,
|
||||
void *data)
|
||||
{
|
||||
__GLXDRIdrawable *drawable = containerOf(driDrawable,
|
||||
__GLXDRIdrawable, driDrawable);
|
||||
__GLXDRIdrawable *drawable = data;
|
||||
ScreenPtr pScreen;
|
||||
drm_clip_rect_t *pClipRects, *pBackClipRects;
|
||||
GLboolean retval;
|
||||
|
@ -810,10 +816,10 @@ getUST(int64_t *ust)
|
|||
static void __glXReportDamage(__DRIdrawable *driDraw,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
GLboolean front_buffer)
|
||||
GLboolean front_buffer,
|
||||
void *data)
|
||||
{
|
||||
__GLXDRIdrawable *drawable =
|
||||
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
|
||||
__GLXDRIdrawable *drawable = data;
|
||||
DrawablePtr pDraw = drawable->base.pDraw;
|
||||
RegionRec region;
|
||||
|
||||
|
@ -827,13 +833,6 @@ static void __glXReportDamage(__DRIdrawable *driDraw,
|
|||
__glXleaveServer(GL_FALSE);
|
||||
}
|
||||
|
||||
/* Table of functions that we export to the driver. */
|
||||
static const __DRIcontextModesExtension contextModesExtension = {
|
||||
{ __DRI_CONTEXT_MODES, __DRI_CONTEXT_MODES_VERSION },
|
||||
_gl_context_modes_create,
|
||||
_gl_context_modes_destroy,
|
||||
};
|
||||
|
||||
static const __DRIsystemTimeExtension systemTimeExtension = {
|
||||
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
|
||||
getUST,
|
||||
|
@ -851,7 +850,6 @@ static const __DRIdamageExtension damageExtension = {
|
|||
};
|
||||
|
||||
static const __DRIextension *loader_extensions[] = {
|
||||
&contextModesExtension.base,
|
||||
&systemTimeExtension.base,
|
||||
&getDrawableInfoExtension.base,
|
||||
&damageExtension.base,
|
||||
|
@ -897,7 +895,8 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
extensions = screen->driScreen.getExtensions(&screen->driScreen);
|
||||
extensions = screen->core->getExtensions(screen->driScreen);
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
|
@ -931,12 +930,12 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
}
|
||||
}
|
||||
|
||||
#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
|
||||
extern __GLXconfig *
|
||||
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
|
||||
|
||||
static __GLXscreen *
|
||||
__glXDRIscreenProbe(ScreenPtr pScreen)
|
||||
{
|
||||
PFNCREATENEWSCREENFUNC createNewScreen;
|
||||
drm_handle_t hSAREA;
|
||||
drmAddress pSAREA = NULL;
|
||||
char *BusID;
|
||||
|
@ -953,11 +952,13 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
drm_handle_t hFB;
|
||||
int junk;
|
||||
__GLXDRIscreen *screen;
|
||||
void *dev_priv = NULL;
|
||||
char filename[128];
|
||||
Bool isCapable;
|
||||
size_t buffer_size;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
const __DRIconfig **driConfigs;
|
||||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
|
||||
!DRIQueryDirectRenderingCapable(pScreen, &isCapable) ||
|
||||
|
@ -985,9 +986,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
dri_version.minor = XF86DRI_MINOR_VERSION;
|
||||
dri_version.patch = XF86DRI_PATCH_VERSION;
|
||||
|
||||
framebuffer.base = NULL;
|
||||
framebuffer.dev_priv = NULL;
|
||||
|
||||
if (!DRIOpenConnection(pScreen, &hSAREA, &BusID)) {
|
||||
LogMessage(X_ERROR, "AIGLX error: DRIOpenConnection failed\n");
|
||||
goto handle_error;
|
||||
|
@ -1046,10 +1044,29 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
|
||||
if (createNewScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n",
|
||||
CREATE_NEW_SCREEN_FUNC, dlerror());
|
||||
extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
|
||||
driverName, dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
|
||||
extensions[i]->version >= __DRI_CORE_VERSION) {
|
||||
screen->core = (__DRIcoreExtension *) extensions[i];
|
||||
}
|
||||
|
||||
if (strcmp(extensions[i]->name, __DRI_LEGACY) == 0 &&
|
||||
extensions[i]->version >= __DRI_LEGACY_VERSION) {
|
||||
screen->legacy = (__DRIlegacyExtension *) extensions[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (screen->core == NULL || screen->legacy == NULL) {
|
||||
LogMessage(X_ERROR,
|
||||
"AIGLX error: %s does not export required DRI extension\n",
|
||||
driverName);
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
|
@ -1066,19 +1083,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
/* Sigh... the DRI interface is broken; the DRI driver will free
|
||||
* the dev private pointer using _mesa_free() on screen destroy,
|
||||
* but we can't use _mesa_malloc() here. In fact, the DRI driver
|
||||
* shouldn't free data it didn't allocate itself, but what can you
|
||||
* do... */
|
||||
dev_priv = xalloc(framebuffer.dev_priv_size);
|
||||
if (dev_priv == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: dev_priv allocation failed");
|
||||
goto handle_error;
|
||||
}
|
||||
memcpy(dev_priv, framebuffer.dev_priv, framebuffer.dev_priv_size);
|
||||
framebuffer.dev_priv = dev_priv;
|
||||
|
||||
framebuffer.width = pScreen->width;
|
||||
framebuffer.height = pScreen->height;
|
||||
|
||||
|
@ -1101,9 +1105,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
screen->driScreen.private =
|
||||
(*createNewScreen)(pScreen->myNum,
|
||||
&screen->driScreen,
|
||||
screen->driScreen =
|
||||
(*screen->legacy->createNewScreen)(pScreen->myNum,
|
||||
&ddx_version,
|
||||
&dri_version,
|
||||
&drm_version,
|
||||
|
@ -1111,18 +1114,21 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
pSAREA,
|
||||
fd,
|
||||
loader_extensions,
|
||||
&screen->base.fbconfigs);
|
||||
&driConfigs,
|
||||
screen);
|
||||
|
||||
if (screen->driScreen.private == NULL) {
|
||||
if (screen->driScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed");
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
|
||||
&screen->texOffsetFinish);
|
||||
screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
|
||||
|
||||
initializeExtensions(screen);
|
||||
|
||||
DRIGetTexOffsetFuncs(pScreen, &screen->texOffsetStart,
|
||||
&screen->texOffsetFinish);
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
|
||||
|
@ -1155,9 +1161,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
if (framebuffer.base != NULL)
|
||||
drmUnmap((drmAddress)framebuffer.base, framebuffer.size);
|
||||
|
||||
if (dev_priv != NULL)
|
||||
xfree(dev_priv);
|
||||
|
||||
if (fd >= 0)
|
||||
drmCloseOnce(fd);
|
||||
|
||||
|
|
409
GL/glx/glxdri2.c
409
GL/glx/glxdri2.c
|
@ -35,20 +35,18 @@
|
|||
#include <drm.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/internal/dri_interface.h>
|
||||
#include <GL/glxtokens.h>
|
||||
|
||||
#include <windowstr.h>
|
||||
#include <os.h>
|
||||
|
||||
#define _XF86DRI_SERVER_
|
||||
#include <xf86drm.h>
|
||||
#include <xf86dristr.h>
|
||||
#include <xf86str.h>
|
||||
#include <xf86.h>
|
||||
#include <dri2.h>
|
||||
|
||||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
#include "g_disptab.h"
|
||||
#include "glapitable.h"
|
||||
|
@ -57,53 +55,56 @@
|
|||
#include "dispatch.h"
|
||||
#include "extension_string.h"
|
||||
|
||||
#define containerOf(ptr, type, member) \
|
||||
(type *)( (char *)ptr - offsetof(type,member) )
|
||||
|
||||
typedef struct __GLXDRIscreen __GLXDRIscreen;
|
||||
typedef struct __GLXDRIcontext __GLXDRIcontext;
|
||||
typedef struct __GLXDRIdrawable __GLXDRIdrawable;
|
||||
typedef struct __GLXDRIconfig __GLXDRIconfig;
|
||||
|
||||
struct __GLXDRIscreen {
|
||||
__GLXscreen base;
|
||||
__DRIscreen driScreen;
|
||||
__DRIscreen *driScreen;
|
||||
void *driver;
|
||||
int fd;
|
||||
|
||||
xf86EnterVTProc *enterVT;
|
||||
xf86LeaveVTProc *leaveVT;
|
||||
|
||||
__DRIcopySubBufferExtension *copySubBuffer;
|
||||
__DRIswapControlExtension *swapControl;
|
||||
__DRItexBufferExtension *texBuffer;
|
||||
const __DRIcoreExtension *core;
|
||||
const __DRIcopySubBufferExtension *copySubBuffer;
|
||||
const __DRIswapControlExtension *swapControl;
|
||||
const __DRItexBufferExtension *texBuffer;
|
||||
|
||||
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
|
||||
};
|
||||
|
||||
struct __GLXDRIcontext {
|
||||
__GLXcontext base;
|
||||
__DRIcontext driContext;
|
||||
drm_context_t hwContext;
|
||||
__DRIcontext *driContext;
|
||||
};
|
||||
|
||||
struct __GLXDRIdrawable {
|
||||
__GLXdrawable base;
|
||||
__DRIdrawable driDrawable;
|
||||
__DRIdrawable *driDrawable;
|
||||
__GLXDRIscreen *screen;
|
||||
};
|
||||
|
||||
static const char CREATE_NEW_SCREEN_FUNC[] = __DRI2_CREATE_NEW_SCREEN_STRING;
|
||||
struct __GLXDRIconfig {
|
||||
__GLXconfig config;
|
||||
const __DRIconfig *driConfig;
|
||||
};
|
||||
|
||||
static void
|
||||
__glXDRIdrawableDestroy(__GLXdrawable *drawable)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
const __DRIcoreExtension *core = private->screen->core;
|
||||
|
||||
(*private->driDrawable.destroyDrawable)(&private->driDrawable);
|
||||
(*core->destroyDrawable)(private->driDrawable);
|
||||
|
||||
/* If the X window was destroyed, the dri DestroyWindow hook will
|
||||
* aready have taken care of this, so only call if pDraw isn't NULL. */
|
||||
if (drawable->pDraw != NULL)
|
||||
DRI2DestroyDrawable(drawable->pDraw->pScreen, drawable->pDraw);
|
||||
DRI2DestroyDrawable(drawable->pDraw);
|
||||
|
||||
xfree(private);
|
||||
}
|
||||
|
@ -118,25 +119,25 @@ __glXDRIdrawableResize(__GLXdrawable *glxPriv)
|
|||
}
|
||||
|
||||
static GLboolean
|
||||
__glXDRIdrawableSwapBuffers(__GLXdrawable *basePrivate)
|
||||
__glXDRIdrawableSwapBuffers(__GLXdrawable *drawable)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
const __DRIcoreExtension *core = private->screen->core;
|
||||
|
||||
(*private->driDrawable.swapBuffers)(&private->driDrawable);
|
||||
(*core->swapBuffers)(private->driDrawable);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
__glXDRIdrawableSwapInterval(__GLXdrawable *baseDrawable, int interval)
|
||||
__glXDRIdrawableSwapInterval(__GLXdrawable *drawable, int interval)
|
||||
{
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseDrawable;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(baseDrawable->pDraw->pScreen);
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
|
||||
const __DRIswapControlExtension *swapControl = private->screen->swapControl;
|
||||
|
||||
if (screen->swapControl)
|
||||
screen->swapControl->setSwapInterval(&draw->driDrawable, interval);
|
||||
if (swapControl)
|
||||
swapControl->setSwapInterval(private->driDrawable, interval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -147,22 +148,20 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
|
|||
int x, int y, int w, int h)
|
||||
{
|
||||
__GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *)
|
||||
glxGetScreen(basePrivate->pDraw->pScreen);
|
||||
const __DRIcopySubBufferExtension *copySubBuffer =
|
||||
private->screen->copySubBuffer;
|
||||
|
||||
if (screen->copySubBuffer)
|
||||
screen->copySubBuffer->copySubBuffer(&private->driDrawable,
|
||||
x, y, w, h);
|
||||
if (copySubBuffer)
|
||||
(*copySubBuffer->copySubBuffer)(private->driDrawable, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseContext->pGlxScreen;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
context->driContext.destroyContext(&context->driContext);
|
||||
drmDestroyContext(screen->fd, context->hwContext);
|
||||
(*screen->core->destroyContext)(context->driContext);
|
||||
__glXContextDestroy(&context->base);
|
||||
xfree(context);
|
||||
}
|
||||
|
@ -173,18 +172,20 @@ __glXDRIcontextMakeCurrent(__GLXcontext *baseContext)
|
|||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
static int
|
||||
__glXDRIcontextLoseCurrent(__GLXcontext *baseContext)
|
||||
{
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.unbindContext)(&context->driContext);
|
||||
return (*screen->core->unbindContext)(context->driContext);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -193,13 +194,10 @@ __glXDRIcontextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc,
|
|||
{
|
||||
__GLXDRIcontext *dst = (__GLXDRIcontext *) baseDst;
|
||||
__GLXDRIcontext *src = (__GLXDRIcontext *) baseSrc;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) dst->base.pGlxScreen;
|
||||
|
||||
/* FIXME: We will need to add DRIcontext::copyContext for this. */
|
||||
|
||||
(void) dst;
|
||||
(void) src;
|
||||
|
||||
return FALSE;
|
||||
return (*screen->core->copyContext)(dst->driContext,
|
||||
src->driContext, mask);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -208,10 +206,11 @@ __glXDRIcontextForceCurrent(__GLXcontext *baseContext)
|
|||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *draw = (__GLXDRIdrawable *) baseContext->drawPriv;
|
||||
__GLXDRIdrawable *read = (__GLXDRIdrawable *) baseContext->readPriv;
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) context->base.pGlxScreen;
|
||||
|
||||
return (*context->driContext.bindContext)(&context->driContext,
|
||||
&draw->driDrawable,
|
||||
&read->driDrawable);
|
||||
return (*screen->core->bindContext)(context->driContext,
|
||||
draw->driDrawable,
|
||||
read->driDrawable);
|
||||
}
|
||||
|
||||
#ifdef __DRI_TEX_BUFFER
|
||||
|
@ -221,19 +220,16 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
|
|||
int buffer,
|
||||
__GLXdrawable *glxPixmap)
|
||||
{
|
||||
ScreenPtr pScreen = glxPixmap->pDraw->pScreen;
|
||||
__GLXDRIscreen * const screen = (__GLXDRIscreen *) glxGetScreen(pScreen);
|
||||
PixmapPtr pixmap;
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
__GLXDRIdrawable *drawable = (__GLXDRIdrawable *) glxPixmap;
|
||||
const __DRItexBufferExtension *texBuffer = drawable->screen->texBuffer;
|
||||
__GLXDRIcontext *context = (__GLXDRIcontext *) baseContext;
|
||||
|
||||
if (screen->texBuffer == NULL)
|
||||
if (texBuffer == NULL)
|
||||
return Success;
|
||||
|
||||
pixmap = (PixmapPtr) glxPixmap->pDraw;
|
||||
screen->texBuffer->setTexBuffer(&context->driContext,
|
||||
texBuffer->setTexBuffer(context->driContext,
|
||||
glxPixmap->target,
|
||||
&drawable->driDrawable);
|
||||
drawable->driDrawable);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
@ -277,7 +273,7 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
|
||||
screen->driScreen.destroyScreen(&screen->driScreen);
|
||||
(*screen->core->destroyScreen)(screen->driScreen);
|
||||
|
||||
dlclose(screen->driver);
|
||||
|
||||
|
@ -288,16 +284,18 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen)
|
|||
|
||||
static __GLXcontext *
|
||||
__glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *glxConfig,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen;
|
||||
__GLXDRIcontext *context, *shareContext;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
const __DRIcoreExtension *core = screen->core;
|
||||
__DRIcontext *driShare;
|
||||
|
||||
shareContext = (__GLXDRIcontext *) baseShareContext;
|
||||
if (shareContext)
|
||||
driShare = &shareContext->driContext;
|
||||
driShare = shareContext->driContext;
|
||||
else
|
||||
driShare = NULL;
|
||||
|
||||
|
@ -313,16 +311,9 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
|
|||
context->base.forceCurrent = __glXDRIcontextForceCurrent;
|
||||
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
|
||||
|
||||
if (drmCreateContext(screen->fd, &context->hwContext))
|
||||
return GL_FALSE;
|
||||
|
||||
context->driContext.private =
|
||||
screen->driScreen.createNewContext(&screen->driScreen,
|
||||
modes,
|
||||
0, /* render type */
|
||||
driShare,
|
||||
context->hwContext,
|
||||
&context->driContext);
|
||||
context->driContext =
|
||||
(*core->createNewContext)(screen->driScreen,
|
||||
config->driConfig, driShare, context);
|
||||
|
||||
return &context->base;
|
||||
}
|
||||
|
@ -332,13 +323,13 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXconfig *glxConfig)
|
||||
{
|
||||
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
|
||||
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
|
||||
__GLXDRIdrawable *private;
|
||||
GLboolean retval;
|
||||
drm_drawable_t hwDrawable;
|
||||
unsigned int head;
|
||||
unsigned int handle, head;
|
||||
|
||||
private = xalloc(sizeof *private);
|
||||
if (private == NULL)
|
||||
|
@ -346,8 +337,9 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
|
||||
memset(private, 0, sizeof *private);
|
||||
|
||||
private->screen = driScreen;
|
||||
if (!__glXDrawableInit(&private->base, screen,
|
||||
pDraw, type, drawId, modes)) {
|
||||
pDraw, type, drawId, glxConfig)) {
|
||||
xfree(private);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -357,14 +349,12 @@ __glXDRIscreenCreateDrawable(__GLXscreen *screen,
|
|||
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
|
||||
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
|
||||
|
||||
retval = DRI2CreateDrawable(screen->pScreen, pDraw,
|
||||
&hwDrawable, &head);
|
||||
retval = DRI2CreateDrawable(pDraw, &handle, &head);
|
||||
|
||||
private->driDrawable.private =
|
||||
(driScreen->driScreen.createNewDrawable)(&driScreen->driScreen,
|
||||
modes,
|
||||
&private->driDrawable,
|
||||
hwDrawable, head, 0, NULL);
|
||||
private->driDrawable =
|
||||
(*driScreen->core->createNewDrawable)(driScreen->driScreen,
|
||||
config->driConfig,
|
||||
handle, head, private);
|
||||
|
||||
return &private->base;
|
||||
}
|
||||
|
@ -385,44 +375,43 @@ getUST(int64_t *ust)
|
|||
}
|
||||
}
|
||||
|
||||
static void __glXReportDamage(__DRIdrawable *driDraw,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
GLboolean front_buffer)
|
||||
{
|
||||
__GLXDRIdrawable *drawable =
|
||||
containerOf(driDraw, __GLXDRIdrawable, driDrawable);
|
||||
DrawablePtr pDraw = drawable->base.pDraw;
|
||||
RegionRec region;
|
||||
|
||||
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, num_rects);
|
||||
REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y);
|
||||
DamageDamageRegion(pDraw, ®ion);
|
||||
REGION_UNINIT(pDraw->pScreen, ®ion);
|
||||
}
|
||||
|
||||
/* Table of functions that we export to the driver. */
|
||||
static const __DRIcontextModesExtension contextModesExtension = {
|
||||
{ __DRI_CONTEXT_MODES, __DRI_CONTEXT_MODES_VERSION },
|
||||
_gl_context_modes_create,
|
||||
_gl_context_modes_destroy,
|
||||
};
|
||||
|
||||
static const __DRIsystemTimeExtension systemTimeExtension = {
|
||||
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
|
||||
getUST,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const __DRIdamageExtension damageExtension = {
|
||||
{ __DRI_DAMAGE, __DRI_DAMAGE_VERSION },
|
||||
__glXReportDamage,
|
||||
static void dri2ReemitDrawableInfo(__DRIdrawable *draw, unsigned int *tail,
|
||||
void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawable *pdraw = loaderPrivate;
|
||||
|
||||
DRI2ReemitDrawableInfo(pdraw->base.pDraw, tail);
|
||||
}
|
||||
|
||||
static void dri2PostDamage(__DRIdrawable *draw,
|
||||
struct drm_clip_rect *rects,
|
||||
int numRects, void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawable *drawable = loaderPrivate;
|
||||
DrawablePtr pDraw = drawable->base.pDraw;
|
||||
RegionRec region;
|
||||
|
||||
REGION_INIT(pDraw->pScreen, ®ion, (BoxPtr) rects, numRects);
|
||||
REGION_TRANSLATE(pScreen, ®ion, pDraw->x, pDraw->y);
|
||||
DamageDamageRegion(pDraw, ®ion);
|
||||
REGION_UNINIT(pDraw->pScreen, ®ion);
|
||||
}
|
||||
|
||||
static const __DRIloaderExtension loaderExtension = {
|
||||
{ __DRI_LOADER, __DRI_LOADER_VERSION },
|
||||
dri2ReemitDrawableInfo,
|
||||
dri2PostDamage
|
||||
};
|
||||
|
||||
static const __DRIextension *loader_extensions[] = {
|
||||
&contextModesExtension.base,
|
||||
&systemTimeExtension.base,
|
||||
&damageExtension.base,
|
||||
&loaderExtension.base,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -463,11 +452,13 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
const __DRIextension **extensions;
|
||||
int i;
|
||||
|
||||
extensions = screen->driScreen.getExtensions(&screen->driScreen);
|
||||
extensions = screen->core->getExtensions(screen->driScreen);
|
||||
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
|
||||
screen->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
|
||||
screen->copySubBuffer =
|
||||
(const __DRIcopySubBufferExtension *) extensions[i];
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_MESA_copy_sub_buffer");
|
||||
|
||||
|
@ -477,7 +468,8 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
|
||||
#ifdef __DRI_SWAP_CONTROL
|
||||
if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) {
|
||||
screen->swapControl = (__DRIswapControlExtension *) extensions[i];
|
||||
screen->swapControl =
|
||||
(const __DRIswapControlExtension *) extensions[i];
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
"GLX_SGI_swap_control");
|
||||
__glXEnableExtension(screen->glx_enable_bits,
|
||||
|
@ -489,7 +481,8 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
|
||||
#ifdef __DRI_TEX_BUFFER
|
||||
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
|
||||
screen->texBuffer = (__DRItexBufferExtension *) extensions[i];
|
||||
screen->texBuffer =
|
||||
(const __DRItexBufferExtension *) extensions[i];
|
||||
/* GLX_EXT_texture_from_pixmap is always enabled. */
|
||||
LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n");
|
||||
}
|
||||
|
@ -498,16 +491,168 @@ initializeExtensions(__GLXDRIscreen *screen)
|
|||
}
|
||||
}
|
||||
|
||||
#define __ATTRIB(attrib, field) \
|
||||
{ attrib, offsetof(__GLXconfig, field) }
|
||||
|
||||
static const struct { unsigned int attrib, offset; } attribMap[] = {
|
||||
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
|
||||
__ATTRIB(__DRI_ATTRIB_LEVEL, level),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits),
|
||||
__ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits),
|
||||
__ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers),
|
||||
__ATTRIB(__DRI_ATTRIB_SAMPLES, samples),
|
||||
__ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode),
|
||||
__ATTRIB(__DRI_ATTRIB_STEREO, stereoMode),
|
||||
__ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue),
|
||||
__ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
|
||||
__ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode),
|
||||
__ATTRIB(__DRI_ATTRIB_RED_MASK, redMask),
|
||||
__ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
|
||||
__ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
|
||||
__ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
|
||||
__ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth),
|
||||
__ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight),
|
||||
__ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
|
||||
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
|
||||
__ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
|
||||
};
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
|
||||
|
||||
static void
|
||||
setScalar(__GLXconfig *config, unsigned int attrib, unsigned int value)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(attribMap); i++)
|
||||
if (attribMap[i].attrib == attrib) {
|
||||
*(unsigned int *) ((char *) config + attribMap[i].offset) = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static __GLXconfig *
|
||||
createModeFromConfig(const __DRIcoreExtension *core,
|
||||
const __DRIconfig *driConfig,
|
||||
unsigned int visualType)
|
||||
{
|
||||
__GLXDRIconfig *config;
|
||||
unsigned int attrib, value;
|
||||
int i;
|
||||
|
||||
config = xalloc(sizeof *config);
|
||||
|
||||
config->driConfig = driConfig;
|
||||
|
||||
i = 0;
|
||||
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
if (value & __DRI_ATTRIB_RGBA_BIT) {
|
||||
config->config.renderType |= GLX_RGBA_BIT;
|
||||
config->config.rgbMode = GL_TRUE;
|
||||
} else if (value & __DRI_ATTRIB_COLOR_INDEX_BIT) {
|
||||
config->config.renderType |= GLX_COLOR_INDEX_BIT;
|
||||
config->config.rgbMode = GL_FALSE;
|
||||
} else {
|
||||
config->config.renderType = 0;
|
||||
config->config.rgbMode = GL_FALSE;
|
||||
}
|
||||
break;
|
||||
case __DRI_ATTRIB_CONFIG_CAVEAT:
|
||||
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
|
||||
config->config.visualRating = GLX_NON_CONFORMANT_CONFIG;
|
||||
else if (value & __DRI_ATTRIB_SLOW_BIT)
|
||||
config->config.visualRating = GLX_SLOW_CONFIG;
|
||||
else
|
||||
config->config.visualRating = GLX_NONE;
|
||||
break;
|
||||
case __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS:
|
||||
config->config.bindToTextureTargets = 0;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_1D_BIT)
|
||||
config->config.bindToTextureTargets |= GLX_TEXTURE_1D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_2D_BIT)
|
||||
config->config.bindToTextureTargets |= GLX_TEXTURE_2D_BIT_EXT;
|
||||
if (value & __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT)
|
||||
config->config.bindToTextureTargets |= GLX_TEXTURE_RECTANGLE_BIT_EXT;
|
||||
break;
|
||||
default:
|
||||
setScalar(&config->config, attrib, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
config->config.next = NULL;
|
||||
config->config.xRenderable = GL_TRUE;
|
||||
config->config.visualType = visualType;
|
||||
config->config.drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
|
||||
|
||||
return &config->config;
|
||||
}
|
||||
|
||||
__GLXconfig *
|
||||
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs);
|
||||
|
||||
__GLXconfig *
|
||||
glxConvertConfigs(const __DRIcoreExtension *core, const __DRIconfig **configs)
|
||||
{
|
||||
__GLXconfig head, *tail;
|
||||
int i;
|
||||
|
||||
tail = &head;
|
||||
head.next = NULL;
|
||||
|
||||
for (i = 0; configs[i]; i++) {
|
||||
tail->next = createModeFromConfig(core,
|
||||
configs[i], GLX_TRUE_COLOR);
|
||||
if (tail->next == NULL)
|
||||
break;
|
||||
|
||||
tail = tail->next;
|
||||
}
|
||||
|
||||
for (i = 0; configs[i]; i++) {
|
||||
tail->next = createModeFromConfig(core,
|
||||
configs[i], GLX_DIRECT_COLOR);
|
||||
if (tail->next == NULL)
|
||||
break;
|
||||
|
||||
tail = tail->next;
|
||||
}
|
||||
|
||||
return head.next;
|
||||
}
|
||||
|
||||
static __GLXscreen *
|
||||
__glXDRIscreenProbe(ScreenPtr pScreen)
|
||||
{
|
||||
__DRI2_CREATE_NEW_SCREEN_FUNC *createNewScreen;
|
||||
const char *driverName;
|
||||
__GLXDRIscreen *screen;
|
||||
char filename[128];
|
||||
size_t buffer_size;
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
unsigned int sareaHandle;
|
||||
const __DRIextension **extensions;
|
||||
const __DRIconfig **driConfigs;
|
||||
int i;
|
||||
|
||||
screen = xalloc(sizeof *screen);
|
||||
if (screen == NULL)
|
||||
|
@ -515,10 +660,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
memset(screen, 0, sizeof *screen);
|
||||
|
||||
if (!xf86LoaderCheckSymbol("DRI2Connect") ||
|
||||
!DRI2Connect(pScreen,
|
||||
&screen->fd,
|
||||
&driverName,
|
||||
&sareaHandle)) {
|
||||
!DRI2Connect(pScreen, &screen->fd, &driverName, &sareaHandle)) {
|
||||
LogMessage(X_INFO,
|
||||
"AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
|
||||
return NULL;
|
||||
|
@ -532,8 +674,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
|
||||
__glXInitExtensionEnableBits(screen->glx_enable_bits);
|
||||
|
||||
snprintf(filename, sizeof filename, "%s/%s_dri.so",
|
||||
dri_driver_path, driverName);
|
||||
snprintf(filename, sizeof filename,
|
||||
"%s/%s_dri.so", dri_driver_path, driverName);
|
||||
|
||||
screen->driver = dlopen(filename, RTLD_LAZY | RTLD_LOCAL);
|
||||
if (screen->driver == NULL) {
|
||||
|
@ -542,28 +684,43 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
|
|||
goto handle_error;
|
||||
}
|
||||
|
||||
createNewScreen = dlsym(screen->driver, CREATE_NEW_SCREEN_FUNC);
|
||||
if (createNewScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: dlsym for %s failed (%s)\n",
|
||||
CREATE_NEW_SCREEN_FUNC, dlerror());
|
||||
extensions = dlsym(screen->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: %s exports no extensions (%s)\n",
|
||||
driverName, dlerror());
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
screen->driScreen.private =
|
||||
(*createNewScreen)(pScreen->myNum,
|
||||
&screen->driScreen,
|
||||
for (i = 0; extensions[i]; i++) {
|
||||
if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
|
||||
extensions[i]->version >= __DRI_CORE_VERSION) {
|
||||
screen->core = (const __DRIcoreExtension *) extensions[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (screen->core == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: %s exports no DRI extension\n",
|
||||
driverName);
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
screen->driScreen =
|
||||
(*screen->core->createNewScreen)(pScreen->myNum,
|
||||
screen->fd,
|
||||
sareaHandle,
|
||||
loader_extensions,
|
||||
&screen->base.fbconfigs);
|
||||
&driConfigs,
|
||||
screen);
|
||||
|
||||
if (screen->driScreen.private == NULL) {
|
||||
if (screen->driScreen == NULL) {
|
||||
LogMessage(X_ERROR, "AIGLX error: Calling driver entry point failed");
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
initializeExtensions(screen);
|
||||
|
||||
screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs);
|
||||
|
||||
__glXScreenInit(&screen->base, pScreen);
|
||||
|
||||
buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
|
||||
|
|
|
@ -46,7 +46,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <glxcontext.h>
|
||||
#include <glxutil.h>
|
||||
|
||||
#include "glcontextmodes.h"
|
||||
#include "os.h"
|
||||
|
||||
typedef struct __GLXMESAscreen __GLXMESAscreen;
|
||||
|
@ -120,7 +119,7 @@ static __GLXdrawable *
|
|||
__glXMesaScreenCreateDrawable(__GLXscreen *screen,
|
||||
DrawablePtr pDraw, int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes)
|
||||
__GLXconfig *modes)
|
||||
{
|
||||
__GLXMESAdrawable *glxPriv;
|
||||
XMesaVisual xm_vis;
|
||||
|
@ -217,7 +216,7 @@ __glXMesaContextForceCurrent(__GLXcontext *baseContext)
|
|||
|
||||
static __GLXcontext *
|
||||
__glXMesaScreenCreateContext(__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *config,
|
||||
__GLXcontext *baseShareContext)
|
||||
{
|
||||
__GLXMESAcontext *context;
|
||||
|
@ -232,7 +231,7 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
|
|||
memset(context, 0, sizeof *context);
|
||||
|
||||
context->base.pGlxScreen = screen;
|
||||
context->base.modes = modes;
|
||||
context->base.config = config;
|
||||
|
||||
context->base.destroy = __glXMesaContextDestroy;
|
||||
context->base.makeCurrent = __glXMesaContextMakeCurrent;
|
||||
|
@ -240,10 +239,10 @@ __glXMesaScreenCreateContext(__GLXscreen *screen,
|
|||
context->base.copy = __glXMesaContextCopy;
|
||||
context->base.forceCurrent = __glXMesaContextForceCurrent;
|
||||
|
||||
xm_vis = find_mesa_visual(screen, modes->fbconfigID);
|
||||
xm_vis = find_mesa_visual(screen, config->fbconfigID);
|
||||
if (!xm_vis) {
|
||||
ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n",
|
||||
modes->visualID);
|
||||
config->visualID);
|
||||
xfree(context);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -282,11 +281,11 @@ static XMesaVisual
|
|||
find_mesa_visual(__GLXscreen *screen, XID fbconfigID)
|
||||
{
|
||||
__GLXMESAscreen *mesaScreen = (__GLXMESAscreen *) screen;
|
||||
const __GLcontextModes *modes;
|
||||
const __GLXconfig *config;
|
||||
unsigned i = 0;
|
||||
|
||||
for (modes = screen->fbconfigs; modes != NULL; modes = modes->next) {
|
||||
if (modes->fbconfigID == fbconfigID)
|
||||
for (config = screen->fbconfigs; config != NULL; config = config->next) {
|
||||
if (config->fbconfigID == fbconfigID)
|
||||
return mesaScreen->xm_vis[i];
|
||||
i++;
|
||||
}
|
||||
|
@ -298,9 +297,18 @@ const static int numBack = 2;
|
|||
const static int numDepth = 2;
|
||||
const static int numStencil = 2;
|
||||
|
||||
static __GLcontextModes *
|
||||
static const int glx_visual_types[] = {
|
||||
GLX_STATIC_GRAY,
|
||||
GLX_GRAY_SCALE,
|
||||
GLX_STATIC_COLOR,
|
||||
GLX_PSEUDO_COLOR,
|
||||
GLX_TRUE_COLOR,
|
||||
GLX_DIRECT_COLOR
|
||||
};
|
||||
|
||||
static __GLXconfig *
|
||||
createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
||||
VisualPtr visual, __GLcontextModes *config)
|
||||
VisualPtr visual, __GLXconfig *config)
|
||||
{
|
||||
int back, depth, stencil;
|
||||
|
||||
|
@ -309,7 +317,10 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
|||
for (back = numBack - 1; back >= 0; back--)
|
||||
for (depth = 0; depth < numDepth; depth++)
|
||||
for (stencil = 0; stencil < numStencil; stencil++) {
|
||||
config->visualType = _gl_convert_from_x_visual_type(visual->class);
|
||||
config->next = xalloc(sizeof *config);
|
||||
config = config->next;
|
||||
|
||||
config->visualType = glx_visual_types[visual->class];
|
||||
config->xRenderable = GL_TRUE;
|
||||
config->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
|
||||
config->rgbMode = (visual->class >= TrueColor);
|
||||
|
@ -333,7 +344,6 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
|||
config->alphaMask = 0;
|
||||
config->rgbBits = config->rgbMode ? visual->nplanes : 0;
|
||||
config->indexBits = config->colorIndexMode ? visual->nplanes : 0;
|
||||
config = config->next;
|
||||
}
|
||||
|
||||
return config;
|
||||
|
@ -342,26 +352,27 @@ createFBConfigsForVisual(__GLXscreen *screen, ScreenPtr pScreen,
|
|||
static void
|
||||
createFBConfigs(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
|
||||
{
|
||||
__GLcontextModes *configs;
|
||||
__GLXconfig head, *tail;
|
||||
int i;
|
||||
|
||||
/* We assume here that each existing visual correspond to a
|
||||
* different visual class. Note, this runs before COMPOSITE adds
|
||||
* its visual, so it's not entirely crazy. */
|
||||
pGlxScreen->numFBConfigs = pScreen->numVisuals * numBack * numDepth * numStencil;
|
||||
pGlxScreen->fbconfigs = _gl_context_modes_create(pGlxScreen->numFBConfigs,
|
||||
sizeof *configs);
|
||||
|
||||
configs = pGlxScreen->fbconfigs;
|
||||
head.next = NULL;
|
||||
tail = &head;
|
||||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
configs = createFBConfigsForVisual(pGlxScreen, pScreen,
|
||||
&pScreen->visuals[i], configs);
|
||||
tail = createFBConfigsForVisual(pGlxScreen, pScreen,
|
||||
&pScreen->visuals[i], tail);
|
||||
|
||||
pGlxScreen->fbconfigs = head.next;
|
||||
}
|
||||
|
||||
static void
|
||||
createMesaVisuals(__GLXMESAscreen *pMesaScreen)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
ScreenPtr pScreen;
|
||||
VisualPtr visual = NULL;
|
||||
int i, j;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <GL/glxtokens.h>
|
||||
#include <string.h>
|
||||
#include <windowstr.h>
|
||||
#include <os.h>
|
||||
|
@ -46,7 +47,6 @@
|
|||
#include "glxserver.h"
|
||||
#include "glxutil.h"
|
||||
#include "glxext.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
static DevPrivateKey glxScreenPrivateKey = &glxScreenPrivateKey;
|
||||
|
||||
|
@ -280,10 +280,23 @@ void GlxSetVisualConfigs(int nconfigs,
|
|||
* call it. */
|
||||
}
|
||||
|
||||
GLint glxConvertToXVisualType(int visualType)
|
||||
{
|
||||
static const int x_visual_types[] = {
|
||||
TrueColor, DirectColor,
|
||||
PseudoColor, StaticColor,
|
||||
GrayScale, StaticGray
|
||||
};
|
||||
|
||||
return ( (unsigned) (visualType - GLX_TRUE_COLOR) < 6 )
|
||||
? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
filterOutNativeConfigs(__GLXscreen *pGlxScreen)
|
||||
{
|
||||
__GLcontextModes *m, *next, *native_modes, **last;
|
||||
__GLXconfig *m, *next, **last;
|
||||
ScreenPtr pScreen = pGlxScreen->pScreen;
|
||||
int i, depth;
|
||||
|
||||
|
@ -305,12 +318,12 @@ filterOutNativeConfigs(__GLXscreen *pGlxScreen)
|
|||
}
|
||||
|
||||
static XID
|
||||
findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m)
|
||||
findVisualForConfig(ScreenPtr pScreen, __GLXconfig *m)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numVisuals; i++) {
|
||||
if (_gl_convert_to_x_visual_type(m->visualType) == pScreen->visuals[i].class)
|
||||
if (glxConvertToXVisualType(m->visualType) == pScreen->visuals[i].class)
|
||||
return pScreen->visuals[i].vid;
|
||||
}
|
||||
|
||||
|
@ -405,10 +418,10 @@ findFirstSet(unsigned int v)
|
|||
}
|
||||
|
||||
static void
|
||||
initGlxVisual(VisualPtr visual, __GLcontextModes *config)
|
||||
initGlxVisual(VisualPtr visual, __GLXconfig *config)
|
||||
{
|
||||
config->visualID = visual->vid;
|
||||
visual->class = _gl_convert_to_x_visual_type(config->visualType);
|
||||
visual->class = glxConvertToXVisualType(config->visualType);
|
||||
visual->bitsPerRGBValue = config->redBits;
|
||||
visual->ColormapEntries = 1 << config->redBits;
|
||||
visual->nplanes = config->redBits + config->greenBits + config->blueBits;
|
||||
|
@ -426,15 +439,15 @@ typedef struct {
|
|||
GLboolean depthBuffer;
|
||||
} FBConfigTemplateRec, *FBConfigTemplatePtr;
|
||||
|
||||
static __GLcontextModes *
|
||||
static __GLXconfig *
|
||||
pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
|
||||
for (config = pGlxScreen->fbconfigs; config != NULL; config = config->next) {
|
||||
if (config->visualRating != GLX_NONE)
|
||||
continue;
|
||||
if (_gl_convert_to_x_visual_type(config->visualType) != class)
|
||||
if (glxConvertToXVisualType(config->visualType) != class)
|
||||
continue;
|
||||
if ((config->doubleBufferMode > 0) != template->doubleBuffer)
|
||||
continue;
|
||||
|
@ -450,32 +463,36 @@ pickFBConfig(__GLXscreen *pGlxScreen, FBConfigTemplatePtr template, int class)
|
|||
static void
|
||||
addMinimalSet(__GLXscreen *pGlxScreen)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
VisualPtr visuals;
|
||||
int i;
|
||||
int i, j;
|
||||
FBConfigTemplateRec best = { GL_TRUE, GL_TRUE };
|
||||
FBConfigTemplateRec minimal = { GL_FALSE, GL_FALSE };
|
||||
|
||||
pGlxScreen->visuals = xcalloc(pGlxScreen->pScreen->numVisuals,
|
||||
sizeof (__GLcontextModes *));
|
||||
sizeof (__GLXconfig *));
|
||||
if (pGlxScreen->visuals == NULL) {
|
||||
ErrorF("Failed to allocate for minimal set of GLX visuals\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pGlxScreen->numVisuals = pGlxScreen->pScreen->numVisuals;
|
||||
visuals = pGlxScreen->pScreen->visuals;
|
||||
for (i = 0; i < pGlxScreen->numVisuals; i++) {
|
||||
for (i = 0, j = 0; i < pGlxScreen->pScreen->numVisuals; i++) {
|
||||
if (visuals[i].nplanes == 32)
|
||||
config = pickFBConfig(pGlxScreen, &minimal, visuals[i].class);
|
||||
else
|
||||
config = pickFBConfig(pGlxScreen, &best, visuals[i].class);
|
||||
if (config == NULL)
|
||||
config = pGlxScreen->fbconfigs;
|
||||
pGlxScreen->visuals[i] = config;
|
||||
config->visualID = visuals[i].vid;
|
||||
if (config == NULL)
|
||||
continue;
|
||||
|
||||
pGlxScreen->visuals[j] = config;
|
||||
config->visualID = visuals[j].vid;
|
||||
j++;
|
||||
}
|
||||
|
||||
pGlxScreen->numVisuals = j;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -487,12 +504,12 @@ addTypicalSet(__GLXscreen *pGlxScreen)
|
|||
static void
|
||||
addFullSet(__GLXscreen *pGlxScreen)
|
||||
{
|
||||
__GLcontextModes *config;
|
||||
__GLXconfig *config;
|
||||
VisualPtr visuals;
|
||||
int i, depth;
|
||||
|
||||
pGlxScreen->visuals =
|
||||
xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLcontextModes *));
|
||||
xcalloc(pGlxScreen->numFBConfigs, sizeof (__GLXconfig *));
|
||||
if (pGlxScreen->visuals == NULL) {
|
||||
ErrorF("Failed to allocate for full set of GLX visuals\n");
|
||||
return;
|
||||
|
@ -522,7 +539,7 @@ void GlxSetVisualConfig(int config)
|
|||
|
||||
void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
|
||||
{
|
||||
__GLcontextModes *m;
|
||||
__GLXconfig *m;
|
||||
int i;
|
||||
|
||||
pGlxScreen->pScreen = pScreen;
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "GL/internal/glcore.h"
|
||||
|
||||
typedef struct {
|
||||
void * (* queryHyperpipeNetworkFunc)(int, int *, int *);
|
||||
void * (* queryHyperpipeConfigFunc)(int, int, int *, int *);
|
||||
|
@ -57,6 +55,84 @@ typedef struct {
|
|||
void __glXHyperpipeInit(int screen, __GLXHyperpipeExtensionFuncs *funcs);
|
||||
void __glXSwapBarrierInit(int screen, __GLXSwapBarrierExtensionFuncs *funcs);
|
||||
|
||||
typedef struct __GLXconfig __GLXconfig;
|
||||
struct __GLXconfig {
|
||||
__GLXconfig *next;
|
||||
GLboolean rgbMode;
|
||||
GLboolean floatMode;
|
||||
GLboolean colorIndexMode;
|
||||
GLuint doubleBufferMode;
|
||||
GLuint stereoMode;
|
||||
|
||||
GLboolean haveAccumBuffer;
|
||||
GLboolean haveDepthBuffer;
|
||||
GLboolean haveStencilBuffer;
|
||||
|
||||
GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
|
||||
GLuint redMask, greenMask, blueMask, alphaMask;
|
||||
GLint rgbBits; /* total bits for rgb */
|
||||
GLint indexBits; /* total bits for colorindex */
|
||||
|
||||
GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
|
||||
GLint depthBits;
|
||||
GLint stencilBits;
|
||||
|
||||
GLint numAuxBuffers;
|
||||
|
||||
GLint level;
|
||||
|
||||
GLint pixmapMode;
|
||||
|
||||
/* GLX */
|
||||
GLint visualID;
|
||||
GLint visualType; /**< One of the GLX X visual types. (i.e.,
|
||||
* \c GLX_TRUE_COLOR, etc.)
|
||||
*/
|
||||
|
||||
/* EXT_visual_rating / GLX 1.2 */
|
||||
GLint visualRating;
|
||||
|
||||
/* EXT_visual_info / GLX 1.2 */
|
||||
GLint transparentPixel;
|
||||
/* colors are floats scaled to ints */
|
||||
GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
|
||||
GLint transparentIndex;
|
||||
|
||||
/* ARB_multisample / SGIS_multisample */
|
||||
GLint sampleBuffers;
|
||||
GLint samples;
|
||||
|
||||
/* SGIX_fbconfig / GLX 1.3 */
|
||||
GLint drawableType;
|
||||
GLint renderType;
|
||||
GLint xRenderable;
|
||||
GLint fbconfigID;
|
||||
|
||||
/* SGIX_pbuffer / GLX 1.3 */
|
||||
GLint maxPbufferWidth;
|
||||
GLint maxPbufferHeight;
|
||||
GLint maxPbufferPixels;
|
||||
GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
|
||||
GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
|
||||
|
||||
/* SGIX_visual_select_group */
|
||||
GLint visualSelectGroup;
|
||||
|
||||
/* OML_swap_method */
|
||||
GLint swapMethod;
|
||||
|
||||
GLint screen;
|
||||
|
||||
/* EXT_texture_from_pixmap */
|
||||
GLint bindToTextureRgb;
|
||||
GLint bindToTextureRgba;
|
||||
GLint bindToMipmapTexture;
|
||||
GLint bindToTextureTargets;
|
||||
GLint yInverted;
|
||||
};
|
||||
|
||||
GLint glxConvertToXVisualType(int visualType);
|
||||
|
||||
/*
|
||||
** Screen dependent data. These methods are the interface between the DIX
|
||||
** and DDX layers of the GLX server extension. The methods provide an
|
||||
|
@ -67,14 +143,14 @@ struct __GLXscreen {
|
|||
void (*destroy) (__GLXscreen *screen);
|
||||
|
||||
__GLXcontext *(*createContext) (__GLXscreen *screen,
|
||||
__GLcontextModes *modes,
|
||||
__GLXconfig *modes,
|
||||
__GLXcontext *shareContext);
|
||||
|
||||
__GLXdrawable *(*createDrawable)(__GLXscreen *context,
|
||||
DrawablePtr pDraw,
|
||||
int type,
|
||||
XID drawId,
|
||||
__GLcontextModes *modes);
|
||||
__GLXconfig *modes);
|
||||
int (*swapInterval) (__GLXdrawable *drawable,
|
||||
int interval);
|
||||
|
||||
|
@ -84,11 +160,11 @@ struct __GLXscreen {
|
|||
ScreenPtr pScreen;
|
||||
|
||||
/* Linked list of valid fbconfigs for this screen. */
|
||||
__GLcontextModes *fbconfigs;
|
||||
__GLXconfig *fbconfigs;
|
||||
int numFBConfigs;
|
||||
|
||||
/* Subset of fbconfigs that are exposed as GLX visuals. */
|
||||
__GLcontextModes **visuals;
|
||||
__GLXconfig **visuals;
|
||||
GLint numVisuals;
|
||||
|
||||
char *GLextensions;
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "glxutil.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
#include "GL/glxint.h"
|
||||
#include "glcontextmodes.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* Context stuff */
|
||||
|
@ -140,13 +139,13 @@ __glXUnrefDrawable(__GLXdrawable *glxPriv)
|
|||
GLboolean
|
||||
__glXDrawableInit(__GLXdrawable *drawable,
|
||||
__GLXscreen *screen, DrawablePtr pDraw, int type,
|
||||
XID drawId, __GLcontextModes *modes)
|
||||
XID drawId, __GLXconfig *config)
|
||||
{
|
||||
drawable->pDraw = pDraw;
|
||||
drawable->type = type;
|
||||
drawable->drawId = drawId;
|
||||
drawable->refCount = 1;
|
||||
drawable->modes = modes;
|
||||
drawable->config = config;
|
||||
drawable->eventMask = 0;
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -51,7 +51,7 @@ extern void __glXUnrefDrawable(__GLXdrawable *glxPriv);
|
|||
extern GLboolean __glXDrawableInit(__GLXdrawable *drawable,
|
||||
__GLXscreen *screen,
|
||||
DrawablePtr pDraw, int type, XID drawID,
|
||||
__GLcontextModes *modes);
|
||||
__GLXconfig *config);
|
||||
|
||||
/* context helper routines */
|
||||
extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
|
||||
|
|
|
@ -227,8 +227,6 @@ symlink_glx() {
|
|||
dst_dir glx
|
||||
|
||||
action indirect_size.h
|
||||
action glcontextmodes.c
|
||||
action glcontextmodes.h
|
||||
action indirect_dispatch.c
|
||||
action indirect_dispatch.h
|
||||
action indirect_dispatch_swap.c
|
||||
|
|
|
@ -1472,6 +1472,24 @@ ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
|
|||
return SELinuxSendContextReply(client, obj->sid);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcSELinuxGetClientContext(ClientPtr client)
|
||||
{
|
||||
ClientPtr target;
|
||||
SELinuxSubjectRec *subj;
|
||||
int rc;
|
||||
|
||||
REQUEST(SELinuxGetContextReq);
|
||||
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
|
||||
|
||||
rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
subj = dixLookupPrivate(&target->devPrivates, subjectKey);
|
||||
return SELinuxSendContextReply(client, subj->sid);
|
||||
}
|
||||
|
||||
static int
|
||||
SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id,
|
||||
int *size)
|
||||
|
@ -1686,6 +1704,8 @@ ProcSELinuxDispatch(ClientPtr client)
|
|||
return ProcSELinuxGetSelectionContext(client, dataKey);
|
||||
case X_SELinuxListSelections:
|
||||
return ProcSELinuxListSelections(client);
|
||||
case X_SELinuxGetClientContext:
|
||||
return ProcSELinuxGetClientContext(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
|
@ -1782,6 +1802,17 @@ SProcSELinuxListProperties(ClientPtr client)
|
|||
return ProcSELinuxListProperties(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcSELinuxGetClientContext(ClientPtr client)
|
||||
{
|
||||
REQUEST(SELinuxGetContextReq);
|
||||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
|
||||
swapl(&stuff->id, n);
|
||||
return ProcSELinuxGetClientContext(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcSELinuxDispatch(ClientPtr client)
|
||||
{
|
||||
|
@ -1835,6 +1866,8 @@ SProcSELinuxDispatch(ClientPtr client)
|
|||
return SProcSELinuxGetSelectionContext(client, dataKey);
|
||||
case X_SELinuxListSelections:
|
||||
return ProcSELinuxListSelections(client);
|
||||
case X_SELinuxGetClientContext:
|
||||
return SProcSELinuxGetClientContext(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define X_SELinuxGetSelectionContext 19
|
||||
#define X_SELinuxGetSelectionDataContext 20
|
||||
#define X_SELinuxListSelections 21
|
||||
#define X_SELinuxGetClientContext 22
|
||||
|
||||
typedef struct {
|
||||
CARD8 reqType;
|
||||
|
|
18
configure.ac
18
configure.ac
|
@ -705,6 +705,15 @@ if test "x$NEED_DBUS" = xyes; then
|
|||
fi
|
||||
CONFIG_LIB='$(top_builddir)/config/libconfig.a'
|
||||
|
||||
AC_MSG_CHECKING([for glibc...])
|
||||
AC_PREPROC_IFELSE([
|
||||
#include <features.h>
|
||||
#ifndef __GLIBC__
|
||||
#error
|
||||
#endif
|
||||
], glibc=yes, glibc=no)
|
||||
AC_MSG_RESULT([$glibc])
|
||||
|
||||
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
|
||||
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
|
||||
[have_clock_gettime=no])])
|
||||
|
@ -720,9 +729,13 @@ if ! test "x$have_clock_gettime" = xno; then
|
|||
|
||||
LIBS_SAVE="$LIBS"
|
||||
LIBS="$CLOCK_LIBS"
|
||||
CPPFLAGS_SAVE="$CPPFLAGS"
|
||||
|
||||
if test x"$glibc" = xyes; then
|
||||
CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=199309L"
|
||||
fi
|
||||
|
||||
AC_RUN_IFELSE([
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
#include <time.h>
|
||||
|
||||
int main(int argc, char *argv[[]]) {
|
||||
|
@ -737,6 +750,7 @@ int main(int argc, char *argv[[]]) {
|
|||
[MONOTONIC_CLOCK="cross compiling"])
|
||||
|
||||
LIBS="$LIBS_SAVE"
|
||||
CPPFLAGS="$CPPFLAGS_SAVE"
|
||||
else
|
||||
MONOTONIC_CLOCK=no
|
||||
fi
|
||||
|
@ -860,7 +874,7 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
|
|||
if test "x$DRI2" = xyes; then
|
||||
# FIXME: Bump the versions once we have releases of these.
|
||||
AC_DEFINE(DRI2, 1, [Build DRI2 extension])
|
||||
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto >= 2.0.3])
|
||||
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1])
|
||||
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1])
|
||||
fi
|
||||
|
||||
|
|
14
dix/main.c
14
dix/main.c
|
@ -113,6 +113,9 @@ Equipment Corporation.
|
|||
#include "dispatch.h" /* InitProcVectors() */
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
pthread_key_t threadname_key=0;
|
||||
|
||||
#ifdef DPMSExtension
|
||||
#define DPMS_SERVER
|
||||
#include <X11/extensions/dpms.h>
|
||||
|
@ -248,6 +251,17 @@ main(int argc, char *argv[], char *envp[])
|
|||
char *xauthfile;
|
||||
HWEventQueueType alwaysCheckForInput[2];
|
||||
|
||||
if(threadname_key == 0) ErrorF("pthread_key_create returned %d\n", pthread_key_create(&threadname_key, NULL));
|
||||
ErrorF("threadname_key = %d\n", threadname_key);
|
||||
if(pthread_getspecific(threadname_key) == NULL) {
|
||||
char *nameptr = malloc(32);
|
||||
sprintf(nameptr, "main thread %d", random());
|
||||
// strcpy(nameptr, "main thread");
|
||||
ErrorF("calling: pthread_setspecific(%d, %s)=%d\n", threadname_key, nameptr, pthread_setspecific(threadname_key, nameptr));
|
||||
if (pthread_getspecific(threadname_key) != NULL) ErrorF("current thread: %s\n", (char *)pthread_getspecific(threadname_key));
|
||||
} else {
|
||||
if (pthread_getspecific(threadname_key) != NULL) ErrorF("thread was already: %s\n", (char *)pthread_getspecific(threadname_key));
|
||||
}
|
||||
display = "0";
|
||||
|
||||
InitGlobals();
|
||||
|
|
|
@ -436,9 +436,10 @@ chooseVideoDriver(void)
|
|||
if (!info) {
|
||||
ErrorF("Primary device is not PCI\n");
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
else {
|
||||
matchDriverFromFiles(matches, info->vendor_id, info->device_id);
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
/* TODO Handle multiple drivers claiming to support the same PCI ID */
|
||||
|
|
|
@ -119,8 +119,11 @@ static ModuleDefault ModuleDefaults[] = {
|
|||
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
|
||||
#ifdef XRECORD
|
||||
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
|
||||
#endif
|
||||
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
|
||||
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ libdri_la_CFLAGS = -I$(top_srcdir)/hw/xfree86/common \
|
|||
-I$(top_builddir)/GL/include \
|
||||
-I@MESA_SOURCE@/include \
|
||||
-DHAVE_XORG_CONFIG_H \
|
||||
@DIX_CFLAGS@ @DRIPROTO_CFLAGS@ \
|
||||
@DIX_CFLAGS@ @XORG_CFLAGS@ @DRIPROTO_CFLAGS@ \
|
||||
@LIBDRM_CFLAGS@ \
|
||||
@GL_CFLAGS@
|
||||
libdri_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
|
||||
|
|
|
@ -2,7 +2,7 @@ libdri2_la_LTLIBRARIES = libdri2.la
|
|||
libdri2_la_CFLAGS = \
|
||||
-DHAVE_XORG_CONFIG_H \
|
||||
-I@MESA_SOURCE@/include \
|
||||
@DIX_CFLAGS@ @DRIPROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
|
||||
@DIX_CFLAGS@ @XORG_CFLAGS@ @DRI2PROTO_CFLAGS@ @LIBDRM_CFLAGS@ \
|
||||
-I$(top_srcdir)/hw/xfree86/common \
|
||||
-I$(top_srcdir)/hw/xfree86/os-support/bus
|
||||
|
||||
|
@ -10,6 +10,7 @@ libdri2_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@
|
|||
libdri2_ladir = $(moduledir)/extensions
|
||||
libdri2_la_SOURCES = \
|
||||
dri2.c \
|
||||
dri2.h
|
||||
dri2.h \
|
||||
dri2ext.c
|
||||
|
||||
sdk_HEADERS = dri2.h
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include "xf86Module.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "region.h"
|
||||
#include "damage.h"
|
||||
#include "dri2.h"
|
||||
#include <GL/internal/dri_sarea.h>
|
||||
|
||||
|
@ -48,8 +50,9 @@ static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKey;
|
|||
static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKey;
|
||||
|
||||
typedef struct _DRI2DrawablePriv {
|
||||
drm_drawable_t drawable;
|
||||
unsigned int handle;
|
||||
unsigned int refCount;
|
||||
unsigned int boHandle;
|
||||
unsigned int dri2Handle;
|
||||
} DRI2DrawablePrivRec, *DRI2DrawablePrivPtr;
|
||||
|
||||
typedef struct _DRI2Screen {
|
||||
|
@ -58,6 +61,7 @@ typedef struct _DRI2Screen {
|
|||
void *sarea;
|
||||
unsigned int sareaSize;
|
||||
const char *driverName;
|
||||
unsigned int nextHandle;
|
||||
|
||||
__DRIEventBuffer *buffer;
|
||||
int locked;
|
||||
|
@ -147,7 +151,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw)
|
|||
|
||||
e = DRI2ScreenAllocEvent(ds, size);
|
||||
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_DRAWABLE_CONFIG, size);
|
||||
e->drawable = pPriv->drawable;
|
||||
e->drawable = pPriv->dri2Handle;
|
||||
e->x = pDraw->x - pPixmap->screen_x;
|
||||
e->y = pDraw->y - pPixmap->screen_y;
|
||||
e->width = pDraw->width;
|
||||
|
@ -164,7 +168,7 @@ DRI2PostDrawableConfig(DrawablePtr pDraw)
|
|||
}
|
||||
|
||||
static void
|
||||
DRI2PostBufferAttach(DrawablePtr pDraw)
|
||||
DRI2PostBufferAttach(DrawablePtr pDraw, Bool force)
|
||||
{
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
|
@ -173,7 +177,8 @@ DRI2PostBufferAttach(DrawablePtr pDraw)
|
|||
PixmapPtr pPixmap;
|
||||
__DRIBufferAttachEvent *e;
|
||||
size_t size;
|
||||
unsigned int handle, flags;
|
||||
unsigned int flags;
|
||||
unsigned int boHandle;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr) pDraw;
|
||||
|
@ -187,22 +192,20 @@ DRI2PostBufferAttach(DrawablePtr pDraw)
|
|||
if (!pPriv)
|
||||
return;
|
||||
|
||||
size = sizeof *e;
|
||||
|
||||
handle = ds->getPixmapHandle(pPixmap, &flags);
|
||||
if (handle == 0 || handle == pPriv->handle)
|
||||
boHandle = ds->getPixmapHandle(pPixmap, &flags);
|
||||
if (boHandle == pPriv->boHandle && !force)
|
||||
return;
|
||||
|
||||
pPriv->boHandle = boHandle;
|
||||
size = sizeof *e;
|
||||
e = DRI2ScreenAllocEvent(ds, size);
|
||||
e->event_header = DRI2_EVENT_HEADER(DRI2_EVENT_BUFFER_ATTACH, size);
|
||||
e->drawable = pPriv->drawable;
|
||||
e->drawable = pPriv->dri2Handle;
|
||||
e->buffer.attachment = DRI_DRAWABLE_BUFFER_FRONT_LEFT;
|
||||
e->buffer.handle = handle;
|
||||
e->buffer.handle = pPriv->boHandle;
|
||||
e->buffer.pitch = pPixmap->devKind;
|
||||
e->buffer.cpp = pPixmap->drawable.bitsPerPixel / 8;
|
||||
e->buffer.flags = flags;
|
||||
|
||||
pPriv->handle = handle;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -223,7 +226,7 @@ DRI2ClipNotify(WindowPtr pWin, int dx, int dy)
|
|||
}
|
||||
|
||||
DRI2PostDrawableConfig(&pWin->drawable);
|
||||
DRI2PostBufferAttach(&pWin->drawable);
|
||||
DRI2PostBufferAttach(&pWin->drawable, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -262,10 +265,10 @@ DRI2CloseScreen(ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
Bool
|
||||
DRI2CreateDrawable(ScreenPtr pScreen, DrawablePtr pDraw,
|
||||
drm_drawable_t *pDrmDrawable, unsigned int *head)
|
||||
DRI2CreateDrawable(DrawablePtr pDraw,
|
||||
unsigned int *handle, unsigned int *head)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
||||
WindowPtr pWin;
|
||||
PixmapPtr pPixmap;
|
||||
DRI2DrawablePrivPtr pPriv;
|
||||
|
@ -283,48 +286,67 @@ DRI2CreateDrawable(ScreenPtr pScreen, DrawablePtr pDraw,
|
|||
}
|
||||
|
||||
pPriv = dixLookupPrivate(devPrivates, key);
|
||||
if (pPriv == NULL) {
|
||||
if (pPriv != NULL) {
|
||||
pPriv->refCount++;
|
||||
} else {
|
||||
pPriv = xalloc(sizeof *pPriv);
|
||||
if (drmCreateDrawable(ds->fd, &pPriv->drawable))
|
||||
return FALSE;
|
||||
|
||||
pPriv->refCount = 1;
|
||||
pPriv->boHandle = 0;
|
||||
pPriv->dri2Handle = ds->nextHandle++;
|
||||
dixSetPrivate(devPrivates, key, pPriv);
|
||||
}
|
||||
|
||||
*pDrmDrawable = pPriv->drawable;
|
||||
|
||||
*handle = pPriv->dri2Handle;
|
||||
*head = ds->buffer->head;
|
||||
|
||||
DRI2PostDrawableConfig(pDraw);
|
||||
DRI2PostBufferAttach(pDraw);
|
||||
DRI2PostBufferAttach(pDraw, TRUE);
|
||||
DRI2ScreenCommitEvents(ds);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
DRI2DestroyDrawable(ScreenPtr pScreen, DrawablePtr pDraw)
|
||||
DRI2DestroyDrawable(DrawablePtr pDraw)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
|
||||
PixmapPtr pPixmap;
|
||||
WindowPtr pWin;
|
||||
DRI2DrawablePrivPtr pPriv;
|
||||
DevPrivateKey key;
|
||||
PrivateRec **devPrivates;
|
||||
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr) pDraw;
|
||||
pPriv = dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
|
||||
dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
|
||||
devPrivates = &pWin->devPrivates;
|
||||
key = dri2WindowPrivateKey;
|
||||
} else {
|
||||
pPixmap = (PixmapPtr) pDraw;
|
||||
pPriv = dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
|
||||
dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
|
||||
devPrivates = &pPixmap->devPrivates;
|
||||
key = dri2PixmapPrivateKey;
|
||||
}
|
||||
|
||||
pPriv = dixLookupPrivate(devPrivates, key);
|
||||
if (pPriv == NULL)
|
||||
return;
|
||||
|
||||
drmDestroyDrawable(ds->fd, pPriv->drawable);
|
||||
pPriv->refCount--;
|
||||
if (pPriv->refCount == 0) {
|
||||
dixSetPrivate(devPrivates, key, NULL);
|
||||
xfree(pPriv);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DRI2ReemitDrawableInfo(DrawablePtr pDraw, unsigned int *head)
|
||||
{
|
||||
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
|
||||
|
||||
*head = ds->buffer->head;
|
||||
|
||||
DRI2PostDrawableConfig(pDraw);
|
||||
DRI2PostBufferAttach(pDraw, TRUE);
|
||||
DRI2ScreenCommitEvents(ds);
|
||||
}
|
||||
|
||||
Bool
|
||||
DRI2Connect(ScreenPtr pScreen, int *fd, const char **driverName,
|
||||
|
@ -411,6 +433,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
|||
|
||||
ds->fd = info->fd;
|
||||
ds->driverName = info->driverName;
|
||||
ds->nextHandle = 1;
|
||||
|
||||
ds->getPixmapHandle = info->getPixmapHandle;
|
||||
ds->beginClipNotify = info->beginClipNotify;
|
||||
|
@ -434,9 +457,21 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
|||
return p;
|
||||
}
|
||||
|
||||
extern ExtensionModule dri2ExtensionModule;
|
||||
|
||||
static pointer
|
||||
DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
|
||||
{
|
||||
static Bool setupDone = FALSE;
|
||||
|
||||
if (!setupDone) {
|
||||
setupDone = TRUE;
|
||||
LoadExtension(&dri2ExtensionModule, FALSE);
|
||||
} else {
|
||||
if (errmaj)
|
||||
*errmaj = LDR_ONCEONLY;
|
||||
}
|
||||
|
||||
return (pointer) 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,14 +66,16 @@ unsigned int DRI2GetPixmapHandle(PixmapPtr pPixmap,
|
|||
void DRI2Lock(ScreenPtr pScreen);
|
||||
void DRI2Unlock(ScreenPtr pScreen);
|
||||
|
||||
Bool DRI2CreateDrawable(ScreenPtr pScreen,
|
||||
DrawablePtr pDraw,
|
||||
drm_drawable_t *pDrmDrawable,
|
||||
Bool DRI2CreateDrawable(DrawablePtr pDraw,
|
||||
unsigned int *handle,
|
||||
unsigned int *head);
|
||||
|
||||
void DRI2DestroyDrawable(ScreenPtr pScreen,
|
||||
DrawablePtr pDraw);
|
||||
void DRI2DestroyDrawable(DrawablePtr pDraw);
|
||||
|
||||
void DRI2ExtensionInit(void);
|
||||
void DRI2ReemitDrawableInfo(DrawablePtr pDraw,
|
||||
unsigned int *head);
|
||||
|
||||
Bool DRI2PostDamage(DrawablePtr pDrawable,
|
||||
struct drm_clip_rect *rects, int numRects);
|
||||
|
||||
#endif
|
||||
|
|
361
hw/xfree86/dri2/dri2ext.c
Normal file
361
hw/xfree86/dri2/dri2ext.c
Normal file
|
@ -0,0 +1,361 @@
|
|||
/*
|
||||
* Copyright © 2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Soft-
|
||||
* ware"), to deal in the Software without restriction, including without
|
||||
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, provided that the above copyright
|
||||
* notice(s) and this permission notice appear in all copies of the Soft-
|
||||
* ware and that both the above copyright notice(s) and this permission
|
||||
* notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
||||
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
||||
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
||||
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
||||
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
||||
* MANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of a copyright holder shall
|
||||
* not be used in advertising or otherwise to promote the sale, use or
|
||||
* other dealings in this Software without prior written authorization of
|
||||
* the copyright holder.
|
||||
*
|
||||
* Authors:
|
||||
* Kristian Høgsberg (krh@redhat.com)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XORG_CONFIG_H
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
#define NEED_REPLIES
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/dri2proto.h>
|
||||
#include "dixstruct.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "xf86drm.h"
|
||||
#include "dri2.h"
|
||||
|
||||
/* The only xf86 include */
|
||||
#include "xf86Module.h"
|
||||
|
||||
static ExtensionEntry *dri2Extension;
|
||||
static RESTYPE dri2DrawableRes;
|
||||
|
||||
static Bool
|
||||
validScreen(ClientPtr client, int screen, ScreenPtr *pScreen)
|
||||
{
|
||||
if (screen >= screenInfo.numScreens) {
|
||||
client->errorValue = screen;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pScreen = screenInfo.screens[screen];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
validDrawable(ClientPtr client, XID drawable,
|
||||
DrawablePtr *pDrawable, int *status)
|
||||
{
|
||||
*status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess);
|
||||
if (*status != Success) {
|
||||
client->errorValue = drawable;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2QueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2QueryVersionReq);
|
||||
xDRI2QueryVersionReply rep;
|
||||
int n;
|
||||
|
||||
if (client->swapped)
|
||||
swaps(&stuff->length, n);
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.majorVersion = DRI2_MAJOR;
|
||||
rep.minorVersion = DRI2_MINOR;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
swapl(&rep.majorVersion, n);
|
||||
swapl(&rep.minorVersion, n);
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2Connect(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2ConnectReq);
|
||||
xDRI2ConnectReply rep;
|
||||
ScreenPtr pScreen;
|
||||
int fd;
|
||||
const char *driverName;
|
||||
char *busId = NULL;
|
||||
unsigned int sareaHandle;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2ConnectReq);
|
||||
if (!validScreen(client, stuff->screen, &pScreen))
|
||||
return BadValue;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.driverNameLength = 0;
|
||||
rep.busIdLength = 0;
|
||||
rep.sareaHandle = 0;
|
||||
|
||||
if (!DRI2Connect(pScreen, &fd, &driverName, &sareaHandle))
|
||||
goto fail;
|
||||
|
||||
busId = drmGetBusid(fd);
|
||||
if (busId == NULL)
|
||||
goto fail;
|
||||
|
||||
rep.driverNameLength = strlen(driverName);
|
||||
rep.busIdLength = strlen(busId);
|
||||
rep.sareaHandle = sareaHandle;
|
||||
rep.length = (rep.driverNameLength + 3) / 4 + (rep.busIdLength + 3) / 4;
|
||||
|
||||
fail:
|
||||
WriteToClient(client, sizeof(xDRI2ConnectReply), &rep);
|
||||
WriteToClient(client, rep.driverNameLength, driverName);
|
||||
WriteToClient(client, rep.busIdLength, busId);
|
||||
drmFreeBusid(busId);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2AuthConnection(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2AuthConnectionReq);
|
||||
xDRI2AuthConnectionReply rep;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2AuthConnectionReq);
|
||||
if (!validScreen(client, stuff->screen, &pScreen))
|
||||
return BadValue;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.authenticated = 1;
|
||||
|
||||
if (!DRI2AuthConnection(pScreen, stuff->magic)) {
|
||||
ErrorF("DRI2: Failed to authenticate %lu\n",
|
||||
(unsigned long) stuff->magic);
|
||||
rep.authenticated = 0;
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2AuthConnectionReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2CreateDrawable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2CreateDrawableReq);
|
||||
xDRI2CreateDrawableReply rep;
|
||||
DrawablePtr pDrawable;
|
||||
unsigned int handle, head;
|
||||
int status;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
|
||||
|
||||
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
|
||||
return status;
|
||||
|
||||
if (!DRI2CreateDrawable(pDrawable, &handle, &head))
|
||||
return BadMatch;
|
||||
|
||||
if (!AddResource(stuff->drawable, dri2DrawableRes, pDrawable)) {
|
||||
DRI2DestroyDrawable(pDrawable);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.handle = handle;
|
||||
rep.head = head;
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2CreateDrawableReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2DestroyDrawable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2DestroyDrawableReq);
|
||||
DrawablePtr pDrawable;
|
||||
int status;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
|
||||
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
|
||||
return status;
|
||||
|
||||
FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2ReemitDrawableInfo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2ReemitDrawableInfoReq);
|
||||
xDRI2ReemitDrawableInfoReply rep;
|
||||
DrawablePtr pDrawable;
|
||||
unsigned int head;
|
||||
int status;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI2ReemitDrawableInfoReq);
|
||||
if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
|
||||
return status;
|
||||
|
||||
DRI2ReemitDrawableInfo(pDrawable, &head);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.head = head;
|
||||
|
||||
WriteToClient(client, sizeof(xDRI2ReemitDrawableInfoReply), &rep);
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDRI2Dispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_DRI2QueryVersion:
|
||||
return ProcDRI2QueryVersion(client);
|
||||
}
|
||||
|
||||
if (!LocalClient(client))
|
||||
return BadRequest;
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_DRI2Connect:
|
||||
return ProcDRI2Connect(client);
|
||||
case X_DRI2AuthConnection:
|
||||
return ProcDRI2AuthConnection(client);
|
||||
case X_DRI2CreateDrawable:
|
||||
return ProcDRI2CreateDrawable(client);
|
||||
case X_DRI2DestroyDrawable:
|
||||
return ProcDRI2DestroyDrawable(client);
|
||||
case X_DRI2ReemitDrawableInfo:
|
||||
return ProcDRI2ReemitDrawableInfo(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDRI2Connect(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDRI2ConnectReq);
|
||||
xDRI2ConnectReply rep;
|
||||
int n;
|
||||
|
||||
/* If the client is swapped, it's not local. Talk to the hand. */
|
||||
|
||||
swaps(&stuff->length, n);
|
||||
if (sizeof(*stuff) / 4 != client->req_len)
|
||||
return BadLength;
|
||||
|
||||
rep.sequenceNumber = client->sequence;
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
rep.length = 0;
|
||||
rep.driverNameLength = 0;
|
||||
rep.busIdLength = 0;
|
||||
rep.sareaHandle = 0;
|
||||
|
||||
return client->noClientException;
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDRI2Dispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
/*
|
||||
* Only local clients are allowed DRI access, but remote clients
|
||||
* still need these requests to find out cleanly.
|
||||
*/
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_DRI2QueryVersion:
|
||||
return ProcDRI2QueryVersion(client);
|
||||
case X_DRI2Connect:
|
||||
return SProcDRI2Connect(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DRI2ResetProc (ExtensionEntry *extEntry)
|
||||
{
|
||||
}
|
||||
|
||||
static int DRI2DrawableGone(pointer p, XID id)
|
||||
{
|
||||
DrawablePtr pDrawable = p;
|
||||
|
||||
DRI2DestroyDrawable(pDrawable);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
DRI2ExtensionInit(void)
|
||||
{
|
||||
dri2Extension = AddExtension(DRI2_NAME,
|
||||
DRI2NumberEvents,
|
||||
DRI2NumberErrors,
|
||||
ProcDRI2Dispatch,
|
||||
SProcDRI2Dispatch,
|
||||
DRI2ResetProc,
|
||||
StandardMinorOpcode);
|
||||
|
||||
dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone);
|
||||
}
|
||||
|
||||
extern Bool noDRI2Extension;
|
||||
|
||||
_X_HIDDEN ExtensionModule dri2ExtensionModule = {
|
||||
DRI2ExtensionInit,
|
||||
DRI2_NAME,
|
||||
&noDRI2Extension,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
|
@ -461,7 +461,7 @@ Mem_wl(CARD32 addr, CARD32 val)
|
|||
static CARD32 PciCfg1Addr = 0;
|
||||
|
||||
#define PCI_OFFSET(x) ((x) & 0x000000ff)
|
||||
#define PCI_TAG(x) ((x) & 0xffffff00)
|
||||
#define PCI_TAG(x) ((x) & 0x7fffff00)
|
||||
|
||||
static struct pci_device*
|
||||
pci_device_for_cfg_address (CARD32 addr)
|
||||
|
|
|
@ -153,6 +153,16 @@ static Bool quirk_first_detailed_preferred (int scrnIndex, xf86MonPtr DDC)
|
|||
DDC->vendor.prod_id == 57364)
|
||||
return TRUE;
|
||||
|
||||
/* Proview AY765C 17" LCD. See bug #15160*/
|
||||
if (memcmp (DDC->vendor.name, "PTS", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 765)
|
||||
return TRUE;
|
||||
|
||||
/* ACR of some sort RH #284231 */
|
||||
if (memcmp (DDC->vendor.name, "ACR", 4) == 0 &&
|
||||
DDC->vendor.prod_id == 2423)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,6 @@ EXTRA_DIST = \
|
|||
quartz.h \
|
||||
quartzAudio.h \
|
||||
quartzCommon.h \
|
||||
quartzCursor.c \
|
||||
quartzCursor.h \
|
||||
quartzForeground.h \
|
||||
quartzKeyboard.h \
|
||||
quartzPasteboard.h
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* X11Application.m -- subclass of NSApplication to multiplex events
|
||||
|
||||
Copyright (c) 2002-2007 Apple Inc.
|
||||
Copyright (c) 2002-2008 Apple Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
|
@ -153,7 +153,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
|
||||
tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
|
||||
|
||||
[dict setObject:[NSString stringWithFormat:@"Xquartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
|
||||
[dict setObject:[NSString stringWithFormat:@"XQuartz %@ - (xorg-server %s)", tem, XSERVER_VERSION]
|
||||
forKey:@"ApplicationVersion"];
|
||||
|
||||
[self orderFrontStandardAboutPanelWithOptions: dict];
|
||||
|
@ -166,7 +166,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
static TSMDocumentID x11_document;
|
||||
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
|
||||
if (state) {
|
||||
QuartzMessageServerThread (kXquartzActivate, 0);
|
||||
DarwinSendDDXEvent(kXquartzActivate, 0);
|
||||
|
||||
if (!_x_active) {
|
||||
if (x11_document == 0 && darwinKeymapFile == NULL) {
|
||||
|
@ -178,7 +178,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
if (x11_document != 0) ActivateTSMDocument (x11_document);
|
||||
}
|
||||
} else {
|
||||
QuartzMessageServerThread (kXquartzDeactivate, 0);
|
||||
DarwinSendDDXEvent(kXquartzDeactivate, 0);
|
||||
|
||||
if (_x_active && x11_document != 0)
|
||||
DeactivateTSMDocument (x11_document);
|
||||
|
@ -216,7 +216,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
|
||||
if ([self isActive]) {
|
||||
[self deactivate];
|
||||
|
||||
if (!_x_active && quartzProcs->IsX11Window([e window],
|
||||
[e windowNumber]))
|
||||
[self activateX:YES];
|
||||
|
@ -246,7 +245,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
swallow_up = 0;
|
||||
for_x = NO;
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzMessageServerThread (kXquartzToggleFullscreen, 0);
|
||||
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
|
@ -654,7 +653,7 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
|||
|
||||
/* This will end up at the end of the responder chain. */
|
||||
- (void) copy:sender {
|
||||
QuartzMessageServerThread (kXquartzPasteboardNotify, 1,
|
||||
DarwinSendDDXEvent(kXquartzPasteboardNotify, 1,
|
||||
AppleWMCopyToPasteboard);
|
||||
}
|
||||
|
||||
|
@ -855,16 +854,12 @@ convert_flags (unsigned int nsflags) {
|
|||
return xflags;
|
||||
}
|
||||
|
||||
|
||||
// This code should probably be merged with that in XDarwin's XServer.m - BB
|
||||
static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||
// static unsigned int button_state = 0;
|
||||
NSRect screen;
|
||||
NSPoint location;
|
||||
NSWindow *window;
|
||||
int pointer_x, pointer_y, ev_button, ev_type;
|
||||
// int num_events=0, i=0, state;
|
||||
// xEvent xe;
|
||||
float pressure, tilt_x, tilt_y;
|
||||
|
||||
/* convert location to global top-left coordinates */
|
||||
location = [e locationInWindow];
|
||||
|
@ -882,7 +877,10 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
|||
}
|
||||
|
||||
pointer_y -= aquaMenuBarHeight;
|
||||
// state = convert_flags ([e modifierFlags]);
|
||||
|
||||
pressure = 0; // for tablets
|
||||
tilt_x = 0;
|
||||
tilt_y = 0;
|
||||
|
||||
switch (type) {
|
||||
case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
|
||||
|
@ -894,27 +892,24 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
|||
case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
|
||||
case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
|
||||
case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
|
||||
case NSTabletPoint:
|
||||
pressure = [e pressure];
|
||||
tilt_x = [e tilt].x;
|
||||
tilt_y = [e tilt].y; // fall through
|
||||
case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
|
||||
handle_mouse:
|
||||
|
||||
/* I'm not sure the below code is necessary or useful (-bb)
|
||||
if(ev_type==ButtonPress) {
|
||||
if (!quartzProcs->IsX11Window([e window], [e windowNumber])) {
|
||||
fprintf(stderr, "Dropping event because it's not a window\n");
|
||||
break;
|
||||
}
|
||||
button_state |= (1 << ev_button);
|
||||
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
|
||||
} else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
|
||||
*/
|
||||
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
|
||||
break;
|
||||
case NSScrollWheel:
|
||||
DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y);
|
||||
// if ([e subtype] == NSTabletPointEventSubtype) pressure = [e pressure];
|
||||
DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
|
||||
pressure, tilt_x, tilt_y);
|
||||
break;
|
||||
|
||||
case NSKeyDown: // do we need to translate these keyCodes?
|
||||
case NSKeyUp:
|
||||
case NSScrollWheel:
|
||||
DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y,
|
||||
pressure, tilt_x, tilt_y);
|
||||
break;
|
||||
|
||||
case NSKeyDown: case NSKeyUp:
|
||||
DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* X11Controller.m -- connect the IB ui, also the NSApp delegate
|
||||
|
||||
Copyright (c) 2002-2007 Apple Inc. All rights reserved.
|
||||
Copyright (c) 2002-2008 Apple Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
|
@ -103,7 +103,7 @@
|
|||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 2,
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 2,
|
||||
AppleWMWindowMenuItem, [sender tag]);
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@
|
|||
[self remove_window_menu];
|
||||
[self install_window_menu:list];
|
||||
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1,
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1,
|
||||
AppleWMWindowMenuNotify);
|
||||
}
|
||||
|
||||
|
@ -539,20 +539,20 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
- (void) hide_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideWindow);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideWindow);
|
||||
else
|
||||
NSBeep (); /* FIXME: something here */
|
||||
}
|
||||
|
||||
- (IBAction)bring_to_front:sender
|
||||
{
|
||||
QuartzMessageServerThread(kXquartzControllerNotify, 1, AppleWMBringAllToFront);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMBringAllToFront);
|
||||
}
|
||||
|
||||
- (IBAction)close_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMCloseWindow);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMCloseWindow);
|
||||
else
|
||||
[[NSApp keyWindow] performClose:sender];
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
- (IBAction)minimize_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMMinimizeWindow);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMMinimizeWindow);
|
||||
else
|
||||
[[NSApp keyWindow] performMiniaturize:sender];
|
||||
}
|
||||
|
@ -568,19 +568,19 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
- (IBAction)zoom_window:sender
|
||||
{
|
||||
if ([X11App x_active])
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMZoomWindow);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMZoomWindow);
|
||||
else
|
||||
[[NSApp keyWindow] performZoom:sender];
|
||||
}
|
||||
|
||||
- (IBAction) next_window:sender
|
||||
{
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMNextWindow);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMNextWindow);
|
||||
}
|
||||
|
||||
- (IBAction) previous_window:sender
|
||||
{
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMPreviousWindow);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMPreviousWindow);
|
||||
}
|
||||
|
||||
- (IBAction) enable_fullscreen_changed:sender
|
||||
|
@ -588,7 +588,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
int value = ![enable_fullscreen intValue];
|
||||
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzMessageServerThread (kXquartzSetRootless, 1, value);
|
||||
DarwinSendDDXEvent(kXquartzSetRootless, 1, value);
|
||||
#endif
|
||||
|
||||
[NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
|
||||
|
@ -598,7 +598,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
- (IBAction) toggle_fullscreen:sender
|
||||
{
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzMessageServerThread (kXquartzToggleFullscreen, 0);
|
||||
DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
|
||||
- (IBAction) quit:sender
|
||||
{
|
||||
QuartzMessageServerThread (kXquartzQuit, 0);
|
||||
DarwinSendDDXEvent(kXquartzQuit, 0);
|
||||
}
|
||||
|
||||
- (IBAction) x11_help:sender
|
||||
|
@ -684,12 +684,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
|
||||
- (void) applicationDidHide:(NSNotification *)notify
|
||||
{
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMHideAll);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMHideAll);
|
||||
}
|
||||
|
||||
- (void) applicationDidUnhide:(NSNotification *)notify
|
||||
{
|
||||
QuartzMessageServerThread (kXquartzControllerNotify, 1, AppleWMShowAll);
|
||||
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll);
|
||||
}
|
||||
|
||||
- (NSApplicationTerminateReply) applicationShouldTerminate:sender
|
||||
|
@ -717,7 +717,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
|
|||
[X11App prefs_synchronize];
|
||||
|
||||
/* shutdown the X server, it will exit () for us. */
|
||||
QuartzMessageServerThread (kXquartzQuit, 0);
|
||||
DarwinSendDDXEvent(kXquartzQuit, 0);
|
||||
|
||||
/* In case it doesn't, exit anyway after a while. */
|
||||
while (sleep (10) != 0) ;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<string key="IBDocument.SystemVersion">9C31</string>
|
||||
<string key="IBDocument.SystemVersion">9C7010</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">639</string>
|
||||
<string key="IBDocument.AppKitVersion">949.26</string>
|
||||
<string key="IBDocument.HIToolboxVersion">352.00</string>
|
||||
|
@ -948,7 +948,7 @@ ZSBhbmQgcmlnaHQgbW91c2UgYnV0dG9ucy4KA</string>
|
|||
<object class="NSTextFieldCell" key="NSCell" id="989804990">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
<int key="NSCellFlags2">4194304</int>
|
||||
<string key="NSContents">When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc.</string>
|
||||
<string key="NSContents">When enabled, creation of a new X11 window will cause X11.app to move to the foreground (instead of Finder.app, Terminal.app, etc.)</string>
|
||||
<reference key="NSSupport" ref="26"/>
|
||||
<reference key="NSControlView" ref="57161931"/>
|
||||
<reference key="NSBackgroundColor" ref="57160303"/>
|
||||
|
|
Binary file not shown.
|
@ -353,24 +353,8 @@ static int DarwinMouseProc(
|
|||
InitPointerDeviceStruct( (DevicePtr)pPointer, map, 5,
|
||||
GetMotionHistory,
|
||||
(PtrCtrlProcPtr)NoopDDA,
|
||||
GetMotionHistorySize(), 2);
|
||||
|
||||
#ifdef XINPUT
|
||||
InitValuatorAxisStruct( pPointer,
|
||||
0, // X axis
|
||||
0, // min value
|
||||
16000, // max value (fixme screen size?)
|
||||
1, // resolution (fixme ?)
|
||||
1, // min resolution
|
||||
1 ); // max resolution
|
||||
InitValuatorAxisStruct( pPointer,
|
||||
1, // X axis
|
||||
0, // min value
|
||||
16000, // max value (fixme screen size?)
|
||||
1, // resolution (fixme ?)
|
||||
1, // min resolution
|
||||
1 ); // max resolution
|
||||
#endif
|
||||
GetMotionHistorySize(), 5);
|
||||
InitProximityClassDeviceStruct( (DevicePtr)pPointer);
|
||||
break;
|
||||
|
||||
case DEVICE_ON:
|
||||
|
@ -896,7 +880,7 @@ void AbortDDX( void )
|
|||
*/
|
||||
|
||||
void
|
||||
xf86SetRootClip (ScreenPtr pScreen, BOOL enable)
|
||||
xf86SetRootClip (ScreenPtr pScreen, int enable)
|
||||
{
|
||||
WindowPtr pWin = WindowTable[pScreen->myNum];
|
||||
WindowPtr pChild;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2008 Apple, Inc.
|
||||
* Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -54,7 +55,7 @@ typedef struct {
|
|||
void DarwinPrintBanner(void);
|
||||
int DarwinParseModifierList(const char *constmodifiers);
|
||||
void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo);
|
||||
void xf86SetRootClip (ScreenPtr pScreen, BOOL enable);
|
||||
void xf86SetRootClip (ScreenPtr pScreen, int enable);
|
||||
|
||||
#define SCREEN_PRIV(pScreen) ((DarwinFramebufferPtr) \
|
||||
dixLookupPrivate(&pScreen->devPrivates, darwinScreenKey))
|
||||
|
@ -90,13 +91,8 @@ extern int darwinMainScreenY;
|
|||
* Special ddx events understood by the X server
|
||||
*/
|
||||
enum {
|
||||
kXquartzUpdateModifiers // update all modifier keys
|
||||
kXquartzReloadKeymap // Reload system keymap
|
||||
= LASTEvent+1, // (from X.h list of event names)
|
||||
kXquartzUpdateButtons, // update state of mouse buttons 2 and up
|
||||
kXquartzScrollWheel, // scroll wheel event
|
||||
/*
|
||||
* Quartz-specific events -- not used in IOKit mode
|
||||
*/
|
||||
kXquartzActivate, // restore X drawing and cursor
|
||||
kXquartzDeactivate, // clip X drawing and switch to Aqua cursor
|
||||
kXquartzSetRootClip, // enable or disable drawing to the X screen
|
||||
|
@ -120,12 +116,14 @@ enum {
|
|||
kXquartzWindowMoved, // window has moved on screen
|
||||
};
|
||||
|
||||
void DarwinSendDDXEvent(int type, int argc, ...);
|
||||
|
||||
#define ENABLE_DEBUG_LOG 1
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOG
|
||||
extern FILE *debug_log_fp;
|
||||
#define DEBUG_LOG_NAME "x11-debug.txt"
|
||||
#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
|
||||
#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%x:%s:%s:%d " msg, pthread_self(), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
|
||||
#else
|
||||
#define DEBUG_LOG(msg, args...)
|
||||
#endif
|
||||
|
|
|
@ -52,33 +52,20 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include <unistd.h>
|
||||
#include <IOKit/hidsystem/IOLLEvent.h>
|
||||
|
||||
#define _APPLEWM_SERVER_
|
||||
#include "applewmExt.h"
|
||||
#include <X11/extensions/applewm.h>
|
||||
|
||||
|
||||
/* Fake button press/release for scroll wheel move. */
|
||||
#define SCROLLWHEELUPFAKE 4
|
||||
#define SCROLLWHEELDOWNFAKE 5
|
||||
|
||||
#define QUEUE_SIZE 256
|
||||
|
||||
typedef struct _Event {
|
||||
xEvent event;
|
||||
ScreenPtr pScreen;
|
||||
} EventRec, *EventPtr;
|
||||
|
||||
int input_check_zero, input_check_flag;
|
||||
|
||||
static int old_flags = 0; // last known modifier state
|
||||
|
||||
typedef struct _EventQueue {
|
||||
HWEventQueueType head, tail; /* long for SetInputCheck */
|
||||
CARD32 lastEventTime; /* to avoid time running backwards */
|
||||
Bool lastMotion;
|
||||
EventRec events[QUEUE_SIZE]; /* static allocation for signals */
|
||||
DevicePtr pKbd, pPtr; /* device pointer, to get funcs */
|
||||
ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
|
||||
ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
|
||||
} EventQueueRec, *EventQueuePtr;
|
||||
|
||||
static EventQueueRec darwinEventQueue;
|
||||
xEvent *darwinEvents;
|
||||
xEvent *darwinEvents = NULL;
|
||||
|
||||
/*
|
||||
* DarwinPressModifierMask
|
||||
|
@ -173,6 +160,9 @@ static void DarwinReleaseModifiers(void) {
|
|||
static void DarwinSimulateMouseClick(
|
||||
int pointer_x,
|
||||
int pointer_y,
|
||||
float pressure,
|
||||
float tilt_x,
|
||||
float tilt_y,
|
||||
int whichButton, // mouse button to be pressed
|
||||
int modifierMask) // modifiers used for the fake click
|
||||
{
|
||||
|
@ -183,96 +173,146 @@ static void DarwinSimulateMouseClick(
|
|||
DarwinUpdateModifiers(KeyRelease, modifierMask);
|
||||
|
||||
// push the mouse button
|
||||
DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y);
|
||||
DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y);
|
||||
DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y,
|
||||
pressure, tilt_x, tilt_y);
|
||||
DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y,
|
||||
pressure, tilt_x, tilt_y);
|
||||
|
||||
// restore old modifiers
|
||||
DarwinUpdateModifiers(KeyPress, modifierMask);
|
||||
}
|
||||
|
||||
/* Generic handler for Xquartz-specifc events. When possible, these should
|
||||
be moved into their own individual functions and set as handlers using
|
||||
mieqSetHandler. */
|
||||
|
||||
void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
|
||||
int i;
|
||||
|
||||
DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
|
||||
for (i=0; i<nevents; i++) {
|
||||
switch(xe[i].u.u.type) {
|
||||
case kXquartzControllerNotify:
|
||||
DEBUG_LOG("kXquartzControllerNotify\n");
|
||||
AppleWMSendEvent(AppleWMControllerNotify,
|
||||
AppleWMControllerNotifyMask,
|
||||
xe[i].u.clientMessage.u.l.longs0,
|
||||
xe[i].u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXquartzPasteboardNotify:
|
||||
DEBUG_LOG("kXquartzPasteboardNotify\n");
|
||||
AppleWMSendEvent(AppleWMPasteboardNotify,
|
||||
AppleWMPasteboardNotifyMask,
|
||||
xe[i].u.clientMessage.u.l.longs0,
|
||||
xe[i].u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXquartzActivate:
|
||||
DEBUG_LOG("kXquartzActivate\n");
|
||||
QuartzShow(xe[i].u.keyButtonPointer.rootX,
|
||||
xe[i].u.keyButtonPointer.rootY);
|
||||
AppleWMSendEvent(AppleWMActivationNotify,
|
||||
AppleWMActivationNotifyMask,
|
||||
AppleWMIsActive, 0);
|
||||
break;
|
||||
|
||||
case kXquartzDeactivate:
|
||||
DEBUG_LOG("kXquartzDeactivate\n");
|
||||
DarwinReleaseModifiers();
|
||||
AppleWMSendEvent(AppleWMActivationNotify,
|
||||
AppleWMActivationNotifyMask,
|
||||
AppleWMIsInactive, 0);
|
||||
QuartzHide();
|
||||
break;
|
||||
|
||||
case kXquartzWindowState:
|
||||
DEBUG_LOG("kXquartzWindowState\n");
|
||||
RootlessNativeWindowStateChanged(xe[i].u.clientMessage.u.l.longs0,
|
||||
xe[i].u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXquartzWindowMoved:
|
||||
DEBUG_LOG("kXquartzWindowMoved\n");
|
||||
RootlessNativeWindowMoved ((WindowPtr)xe[i].u.clientMessage.u.l.longs0);
|
||||
break;
|
||||
|
||||
case kXquartzToggleFullscreen:
|
||||
DEBUG_LOG("kXquartzToggleFullscreen\n");
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
|
||||
else if (quartzHasRoot) QuartzHide();
|
||||
else QuartzShow();
|
||||
#else
|
||||
// ErrorF("kXquartzToggleFullscreen not implemented\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kXquartzSetRootless:
|
||||
DEBUG_LOG("kXquartzSetRootless\n");
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzSetRootless(xe[i].u.clientMessage.u.l.longs0);
|
||||
if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
|
||||
#else
|
||||
// ErrorF("kXquartzSetRootless not implemented\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kXquartzSetRootClip:
|
||||
QuartzSetRootClip((BOOL)xe[i].u.clientMessage.u.l.longs0);
|
||||
break;
|
||||
|
||||
case kXquartzQuit:
|
||||
GiveUp(0);
|
||||
break;
|
||||
|
||||
case kXquartzBringAllToFront:
|
||||
DEBUG_LOG("kXquartzBringAllToFront\n");
|
||||
RootlessOrderAllWindows();
|
||||
break;
|
||||
|
||||
case kXquartzSpaceChanged:
|
||||
DEBUG_LOG("kXquartzSpaceChanged\n");
|
||||
QuartzSpaceChanged(xe[i].u.clientMessage.u.l.longs0);
|
||||
|
||||
break;
|
||||
default:
|
||||
ErrorF("Unknown application defined event type %d.\n", xe[i].u.u.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
|
||||
darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
|
||||
if (!darwinEvents)
|
||||
darwinEvents = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
|
||||
if (!darwinEvents)
|
||||
FatalError("Couldn't allocate event buffer\n");
|
||||
|
||||
mieqInit();
|
||||
darwinEventQueue.head = darwinEventQueue.tail = 0;
|
||||
darwinEventQueue.lastEventTime = GetTimeInMillis ();
|
||||
darwinEventQueue.pKbd = pKbd;
|
||||
darwinEventQueue.pPtr = pPtr;
|
||||
darwinEventQueue.pEnqueueScreen = screenInfo.screens[0];
|
||||
darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen;
|
||||
SetInputCheck(&input_check_zero, &input_check_flag);
|
||||
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
|
||||
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzDeactivate, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzQuit, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
|
||||
mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
|
||||
mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzSetRootless, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzControllerNotify, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzPasteboardNotify, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzDisplayChanged, QuartzDisplayChangedHandler);
|
||||
mieqSetHandler(kXquartzWindowState, DarwinEventHandler);
|
||||
mieqSetHandler(kXquartzWindowMoved, DarwinEventHandler);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DarwinEQEnqueue
|
||||
* Must be thread safe with ProcessInputEvents.
|
||||
* DarwinEQEnqueue - called from event gathering thread
|
||||
* ProcessInputEvents - called from X server thread
|
||||
* DarwinEQEnqueue should never be called from more than one thread.
|
||||
*
|
||||
* This should be deprecated in favor of miEQEnqueue -- BB
|
||||
*/
|
||||
void DarwinEQEnqueue(const xEventPtr e) {
|
||||
HWEventQueueType oldtail, newtail;
|
||||
|
||||
oldtail = darwinEventQueue.tail;
|
||||
|
||||
// mieqEnqueue() collapses successive motion events into one event.
|
||||
// This is difficult to do in a thread-safe way and rarely useful.
|
||||
|
||||
newtail = oldtail + 1;
|
||||
if (newtail == QUEUE_SIZE) newtail = 0;
|
||||
/* Toss events which come in late */
|
||||
if (newtail == darwinEventQueue.head) return;
|
||||
|
||||
darwinEventQueue.events[oldtail].event = *e;
|
||||
|
||||
/*
|
||||
* Make sure that event times don't go backwards - this
|
||||
* is "unnecessary", but very useful
|
||||
*/
|
||||
if (e->u.keyButtonPointer.time < darwinEventQueue.lastEventTime &&
|
||||
darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
|
||||
{
|
||||
darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time =
|
||||
darwinEventQueue.lastEventTime;
|
||||
}
|
||||
darwinEventQueue.events[oldtail].pScreen = darwinEventQueue.pEnqueueScreen;
|
||||
|
||||
// Update the tail after the event is prepared
|
||||
darwinEventQueue.tail = newtail;
|
||||
|
||||
// Signal there is an event ready to handle
|
||||
DarwinPokeEQ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DarwinEQPointerPost
|
||||
* Post a pointer event. Used by the mipointer.c routines.
|
||||
*/
|
||||
void DarwinEQPointerPost(DeviceIntPtr pdev, xEventPtr e) {
|
||||
(*darwinEventQueue.pPtr->processInputProc)
|
||||
(e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
||||
}
|
||||
|
||||
|
||||
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
|
||||
darwinEventQueue.pEnqueueScreen = pScreen;
|
||||
if (fromDIX)
|
||||
darwinEventQueue.pDequeueScreen = pScreen;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ProcessInputEvents
|
||||
* Read and process events from the event queue until it is empty.
|
||||
*/
|
||||
void ProcessInputEvents(void) {
|
||||
EventRec *e;
|
||||
int x, y;
|
||||
xEvent xe;
|
||||
// button number and modifier mask of currently pressed fake button
|
||||
input_check_flag=0;
|
||||
|
@ -281,92 +321,11 @@ void ProcessInputEvents(void) {
|
|||
mieqProcessInputEvents();
|
||||
|
||||
// Empty the signaling pipe
|
||||
x = sizeof(xe);
|
||||
while (x == sizeof(xe))
|
||||
int x = sizeof(xe);
|
||||
while (x == sizeof(xe)) {
|
||||
// DEBUG_LOG("draining pipe\n");
|
||||
x = read(darwinEventReadFD, &xe, sizeof(xe));
|
||||
|
||||
while (darwinEventQueue.head != darwinEventQueue.tail)
|
||||
{
|
||||
if (screenIsSaved == SCREEN_SAVER_ON)
|
||||
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
|
||||
|
||||
e = &darwinEventQueue.events[darwinEventQueue.head];
|
||||
xe = e->event;
|
||||
|
||||
// Shift from global screen coordinates to coordinates relative to
|
||||
// the origin of the current screen.
|
||||
xe.u.keyButtonPointer.rootX -= darwinMainScreenX +
|
||||
dixScreenOrigins[miPointerCurrentScreen()->myNum].x;
|
||||
xe.u.keyButtonPointer.rootY -= darwinMainScreenY +
|
||||
dixScreenOrigins[miPointerCurrentScreen()->myNum].y;
|
||||
|
||||
/* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n",
|
||||
xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY,
|
||||
darwinMainScreenX, darwinMainScreenY,
|
||||
miPointerCurrentScreen()->myNum,
|
||||
dixScreenOrigins[miPointerCurrentScreen()->myNum].x,
|
||||
dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */
|
||||
|
||||
//Assumption - screen switching can only occur on motion events
|
||||
|
||||
if (e->pScreen != darwinEventQueue.pDequeueScreen)
|
||||
{
|
||||
darwinEventQueue.pDequeueScreen = e->pScreen;
|
||||
x = xe.u.keyButtonPointer.rootX;
|
||||
y = xe.u.keyButtonPointer.rootY;
|
||||
if (darwinEventQueue.head == QUEUE_SIZE - 1)
|
||||
darwinEventQueue.head = 0;
|
||||
else
|
||||
++darwinEventQueue.head;
|
||||
NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (darwinEventQueue.head == QUEUE_SIZE - 1)
|
||||
darwinEventQueue.head = 0;
|
||||
else
|
||||
++darwinEventQueue.head;
|
||||
switch (xe.u.u.type) {
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n");
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n");
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
ErrorF("Unexpected MotionNotify event in DarwinProcessInputEvents\n");
|
||||
break;
|
||||
|
||||
case kXquartzUpdateModifiers:
|
||||
ErrorF("Unexpected kXquartzUpdateModifiers event in DarwinProcessInputEvents\n");
|
||||
break;
|
||||
|
||||
case kXquartzUpdateButtons:
|
||||
ErrorF("Unexpected kXquartzUpdateButtons event in DarwinProcessInputEvents\n");
|
||||
break;
|
||||
|
||||
case kXquartzScrollWheel:
|
||||
ErrorF("Unexpected kXquartzScrollWheel event in DarwinProcessInputEvents\n");
|
||||
break;
|
||||
|
||||
case kXquartzDeactivate:
|
||||
DarwinReleaseModifiers();
|
||||
// fall through
|
||||
default:
|
||||
// Check for mode specific event
|
||||
QuartzProcessEvent(&xe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// miPointerUpdate();
|
||||
}
|
||||
|
||||
/* Sends a null byte down darwinEventWriteFD, which will cause the
|
||||
|
@ -378,22 +337,43 @@ void DarwinPokeEQ(void) {
|
|||
write(darwinEventWriteFD, &nullbyte, 1);
|
||||
}
|
||||
|
||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
|
||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
|
||||
float pressure, float tilt_x, float tilt_y) {
|
||||
static int darwinFakeMouseButtonDown = 0;
|
||||
static int darwinFakeMouseButtonMask = 0;
|
||||
int i, num_events;
|
||||
int valuators[2] = {pointer_x, pointer_y};
|
||||
|
||||
if(!darwinEvents) {
|
||||
ErrorF("DarwinSendPointerEvents called before darwinEvents was initialized\n");
|
||||
return;
|
||||
}
|
||||
/* I can't find a spec for this, but at least GTK expects that tablets are
|
||||
just like mice, except they have either one or three extra valuators, in this
|
||||
order:
|
||||
|
||||
X coord, Y coord, pressure, X tilt, Y tilt
|
||||
Pressure and tilt should be represented natively as floats; unfortunately,
|
||||
we can't do that. Again, GTK seems to record the min/max of each valuator,
|
||||
and then perform scaling back to float itself using that info. Soo.... */
|
||||
|
||||
int valuators[5] = {pointer_x, pointer_y,
|
||||
pressure * INT32_MAX * 1.0f,
|
||||
tilt_x * INT32_MAX * 1.0f,
|
||||
tilt_y * INT32_MAX * 1.0f};
|
||||
|
||||
if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
|
||||
// Mimic multi-button mouse with modifier-clicks
|
||||
// If both sets of modifiers are pressed,
|
||||
// button 2 is clicked.
|
||||
if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
|
||||
DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask);
|
||||
DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
|
||||
tilt_x, tilt_y, 2, darwinFakeMouse2Mask);
|
||||
darwinFakeMouseButtonDown = 2;
|
||||
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
|
||||
return;
|
||||
} else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
|
||||
DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
|
||||
DarwinSimulateMouseClick(pointer_x, pointer_y, pressure,
|
||||
tilt_x, tilt_y, 3, darwinFakeMouse3Mask);
|
||||
darwinFakeMouseButtonDown = 3;
|
||||
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
|
||||
return;
|
||||
|
@ -412,7 +392,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
|
|||
}
|
||||
|
||||
num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
|
||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||
POINTER_ABSOLUTE, 0, 5, valuators);
|
||||
|
||||
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
||||
DarwinPokeEQ();
|
||||
|
@ -420,6 +400,11 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
|
|||
|
||||
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
||||
int i, num_events;
|
||||
if(!darwinEvents) {
|
||||
ErrorF("DarwinSendKeyboardEvents called before darwinEvents was initialized\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
|
||||
/* See if keymap has changed. */
|
||||
|
||||
|
@ -429,7 +414,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
|||
this_seed = QuartzSystemKeymapSeed();
|
||||
if (this_seed != last_seed) {
|
||||
last_seed = this_seed;
|
||||
DarwinKeyboardReload(darwinKeyboard);
|
||||
DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,18 +423,48 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
|||
DarwinPokeEQ();
|
||||
}
|
||||
|
||||
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
|
||||
float pressure, float tilt_x, float tilt_y) {
|
||||
int i, num_events;
|
||||
int valuators[5] = {pointer_x, pointer_y,
|
||||
pressure * INT32_MAX * 1.0f,
|
||||
tilt_x * INT32_MAX * 1.0f,
|
||||
tilt_y * INT32_MAX * 1.0f};
|
||||
|
||||
if(!darwinEvents) {
|
||||
ErrorF("DarwinSendProximityvents called before darwinEvents was initialized\n");
|
||||
return;
|
||||
}
|
||||
|
||||
num_events = GetProximityEvents(darwinEvents, darwinPointer, ev_type,
|
||||
0, 5, valuators);
|
||||
|
||||
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
||||
DarwinPokeEQ();
|
||||
}
|
||||
|
||||
|
||||
/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
|
||||
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
|
||||
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
|
||||
float pressure, float tilt_x, float tilt_y) {
|
||||
int i;
|
||||
int ev_button = count > 0.0f ? 4 : 5;
|
||||
int valuators[2] = {pointer_x, pointer_y};
|
||||
int valuators[5] = {pointer_x, pointer_y,
|
||||
pressure * INT32_MAX * 1.0f,
|
||||
tilt_x * INT32_MAX * 1.0f,
|
||||
tilt_y * INT32_MAX * 1.0f};
|
||||
|
||||
if(!darwinEvents) {
|
||||
ErrorF("DarwinSendScrollEvents called before darwinEvents was initialized\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
|
||||
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
|
||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||
POINTER_ABSOLUTE, 0, 5, valuators);
|
||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
||||
num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
|
||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||
POINTER_ABSOLUTE, 0, 5, valuators);
|
||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
||||
}
|
||||
DarwinPokeEQ();
|
||||
|
@ -462,3 +477,31 @@ void DarwinUpdateModKeys(int flags) {
|
|||
DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
|
||||
old_flags = flags;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DarwinSendDDXEvent
|
||||
* Send the X server thread a message by placing it on the event queue.
|
||||
*/
|
||||
void DarwinSendDDXEvent(int type, int argc, ...) {
|
||||
xEvent xe;
|
||||
INT32 *argv;
|
||||
int i, max_args;
|
||||
va_list args;
|
||||
|
||||
memset(&xe, 0, sizeof(xe));
|
||||
xe.u.u.type = type;
|
||||
xe.u.clientMessage.u.l.type = type;
|
||||
|
||||
argv = &xe.u.clientMessage.u.l.longs0;
|
||||
max_args = 4;
|
||||
|
||||
if (argc > 0 && argc <= max_args) {
|
||||
va_start (args, argc);
|
||||
for (i = 0; i < argc; i++)
|
||||
argv[i] = (int) va_arg (args, int);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
mieqEnqueue(NULL, &xe);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Apple, Inc.
|
||||
* Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -32,9 +33,16 @@ void DarwinEQEnqueue(const xEventPtr e);
|
|||
void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
|
||||
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
||||
void DarwinPokeEQ(void);
|
||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y);
|
||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
|
||||
float pressure, float tilt_x, float tilt_y);
|
||||
void DarwinSendProximityEvents(int ev_type, int pointer_x, int pointer_y,
|
||||
float pressure, float tilt_x, float tilt_y);
|
||||
void DarwinSendKeyboardEvents(int ev_type, int keycode);
|
||||
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y);
|
||||
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y,
|
||||
float pressure, float tilt_x, float tilt_y);
|
||||
void DarwinUpdateModKeys(int flags);
|
||||
|
||||
void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev,
|
||||
int nevents);
|
||||
|
||||
#endif /* _DARWIN_EVENTS_H */
|
||||
|
|
|
@ -730,6 +730,14 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
|
|||
* it to an equivalent X keyboard map and modifier map.
|
||||
*/
|
||||
static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
|
||||
void* callstack[128];
|
||||
int i, frames = backtrace(callstack, 128);
|
||||
char** strs = backtrace_symbols(callstack, frames);
|
||||
for (i = 0; i < frames; ++i) {
|
||||
ErrorF("%s\n", strs[i]);
|
||||
}
|
||||
free(strs);
|
||||
|
||||
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
|
||||
|
||||
/* TODO: Clean this up
|
||||
|
@ -842,16 +850,18 @@ static Bool InitModMap(register KeyClassPtr keyc) {
|
|||
}
|
||||
|
||||
|
||||
void DarwinKeyboardReload(DeviceIntPtr pDev) {
|
||||
void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
|
||||
KeySymsRec keySyms;
|
||||
if (dev == NULL) dev = darwinKeyboard;
|
||||
|
||||
DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", dev);
|
||||
DarwinLoadKeyboardMapping(&keySyms);
|
||||
|
||||
if (SetKeySymsMap(&pDev->key->curKeySyms, &keySyms)) {
|
||||
if (SetKeySymsMap(&dev->key->curKeySyms, &keySyms)) {
|
||||
/* now try to update modifiers. */
|
||||
|
||||
memmove(pDev->key->modifierMap, keyInfo.modMap, MAP_LENGTH);
|
||||
InitModMap(pDev->key);
|
||||
memmove(dev->key->modifierMap, keyInfo.modMap, MAP_LENGTH);
|
||||
InitModMap(dev->key);
|
||||
} else DEBUG_LOG("SetKeySymsMap=0\n");
|
||||
|
||||
SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
/* Provided for darwinEvents.c */
|
||||
extern darwinKeyboardInfo keyInfo;
|
||||
void DarwinKeyboardReload(DeviceIntPtr pDev);
|
||||
void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
|
||||
void DarwinKeyboardInit(DeviceIntPtr pDev);
|
||||
int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
|
||||
int DarwinModifierNXKeyToNXKeycode(int key, int side);
|
||||
|
|
|
@ -62,6 +62,7 @@ SOFTWARE.
|
|||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "XIstubs.h"
|
||||
#include "darwin.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
|
@ -79,6 +80,7 @@ SOFTWARE.
|
|||
void
|
||||
CloseInputDevice(DeviceIntPtr d, ClientPtr client)
|
||||
{
|
||||
DEBUG_LOG("CloseInputDevice(%p, %p)\n", d, client);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -122,7 +124,7 @@ AddOtherInputDevices(void)
|
|||
RegisterOtherDevice(dev);
|
||||
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
|
||||
************************************************************************/
|
||||
|
||||
DEBUG_LOG("AddOtherInputDevices\n");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -150,6 +152,7 @@ AddOtherInputDevices(void)
|
|||
void
|
||||
OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
|
||||
{
|
||||
DEBUG_LOG("OpenInputDevice(%p, %p, %p)\n", dev, client, status);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -167,6 +170,7 @@ OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
|
|||
int
|
||||
SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
|
||||
{
|
||||
DEBUG_LOG("SetDeviceMode(%p, %p, %d)\n", client, dev, mode);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
@ -186,6 +190,8 @@ int
|
|||
SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
|
||||
int *valuators, int first_valuator, int num_valuators)
|
||||
{
|
||||
DEBUG_LOG("SetDeviceValuators(%p, %p, %p, %d, %d)\n", client,
|
||||
dev, valuators, first_valuator, num_valuators);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
@ -201,6 +207,8 @@ int
|
|||
ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
|
||||
xDeviceCtl * control)
|
||||
{
|
||||
|
||||
DEBUG_LOG("ChangeDeviceControl(%p, %p, %p)\n", client, dev, control);
|
||||
switch (control->control) {
|
||||
case DEVICE_RESOLUTION:
|
||||
return (BadMatch);
|
||||
|
@ -225,6 +233,7 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
|
|||
int
|
||||
NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
|
||||
{
|
||||
DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev);
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
|
@ -238,4 +247,5 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
|
|||
void
|
||||
DeleteInputDeviceRequest(DeviceIntPtr dev)
|
||||
{
|
||||
DEBUG_LOG("DeleteInputDeviceRequest(%p)\n", dev);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#endif
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "inputstr.h"
|
||||
#include "quartz.h"
|
||||
#include "darwin.h"
|
||||
#include "darwinEvents.h"
|
||||
|
@ -231,17 +232,17 @@ RREditConnectionInfo (ScreenPtr pScreen)
|
|||
#endif
|
||||
|
||||
/*
|
||||
* QuartzUpdateScreens
|
||||
* QuartzDisplayChangeHandler
|
||||
* Adjust for screen arrangement changes.
|
||||
*/
|
||||
static void QuartzUpdateScreens(void)
|
||||
void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
WindowPtr pRoot;
|
||||
int x, y, width, height, sx, sy;
|
||||
xEvent e;
|
||||
|
||||
DEBUG_LOG("QuartzUpdateScreens()\n");
|
||||
DEBUG_LOG("QuartzDisplayChangedHandler()\n");
|
||||
if (noPseudoramiXExtension || screenInfo.numScreens != 1)
|
||||
{
|
||||
/* FIXME: if not using Xinerama, we have multiple screens, and
|
||||
|
@ -307,7 +308,7 @@ static void QuartzUpdateScreens(void)
|
|||
* Calls mode specific screen resume to restore the X clip regions
|
||||
* (if needed) and the X server cursor state.
|
||||
*/
|
||||
static void QuartzShow(
|
||||
void QuartzShow(
|
||||
int x, // cursor location
|
||||
int y )
|
||||
{
|
||||
|
@ -330,7 +331,7 @@ static void QuartzShow(
|
|||
* hidden. Calls mode specific screen suspend to set X clip regions to
|
||||
* prevent drawing (if needed) and restore the Aqua cursor.
|
||||
*/
|
||||
static void QuartzHide(void)
|
||||
void QuartzHide(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -349,7 +350,7 @@ static void QuartzHide(void)
|
|||
* QuartzSetRootClip
|
||||
* Enable or disable rendering to the X screen.
|
||||
*/
|
||||
static void QuartzSetRootClip(
|
||||
void QuartzSetRootClip(
|
||||
BOOL enable)
|
||||
{
|
||||
int i;
|
||||
|
@ -368,145 +369,7 @@ static void QuartzSetRootClip(
|
|||
* QuartzSpaceChanged
|
||||
* Unmap offscreen windows, map onscreen windows
|
||||
*/
|
||||
static void QuartzSpaceChanged(uint32_t space_id) {
|
||||
void QuartzSpaceChanged(uint32_t space_id) {
|
||||
/* Do something special here, so we don't depend on quartz-wm for spaces to work... */
|
||||
DEBUG_LOG("Space Changed (%u) ... do something interesting...\n", space_id);
|
||||
}
|
||||
|
||||
/*
|
||||
* QuartzMessageServerThread
|
||||
* Send the X server thread a message by placing it on the event queue.
|
||||
*/
|
||||
void
|
||||
QuartzMessageServerThread(
|
||||
int type,
|
||||
int argc, ...)
|
||||
{
|
||||
xEvent xe;
|
||||
INT32 *argv;
|
||||
int i, max_args;
|
||||
va_list args;
|
||||
|
||||
memset(&xe, 0, sizeof(xe));
|
||||
xe.u.u.type = type;
|
||||
xe.u.clientMessage.u.l.type = type;
|
||||
|
||||
argv = &xe.u.clientMessage.u.l.longs0;
|
||||
max_args = 4;
|
||||
|
||||
if (argc > 0 && argc <= max_args) {
|
||||
va_start (args, argc);
|
||||
for (i = 0; i < argc; i++)
|
||||
argv[i] = (int) va_arg (args, int);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
DarwinEQEnqueue(&xe);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzProcessEvent
|
||||
* Process Quartz specific events.
|
||||
*/
|
||||
void QuartzProcessEvent(xEvent *xe) {
|
||||
switch (xe->u.u.type) {
|
||||
case kXquartzControllerNotify:
|
||||
DEBUG_LOG("kXquartzControllerNotify\n");
|
||||
AppleWMSendEvent(AppleWMControllerNotify,
|
||||
AppleWMControllerNotifyMask,
|
||||
xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXquartzPasteboardNotify:
|
||||
DEBUG_LOG("kXquartzPasteboardNotify\n");
|
||||
AppleWMSendEvent(AppleWMPasteboardNotify,
|
||||
AppleWMPasteboardNotifyMask,
|
||||
xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXquartzActivate:
|
||||
DEBUG_LOG("kXquartzActivate\n");
|
||||
QuartzShow(xe->u.keyButtonPointer.rootX,
|
||||
xe->u.keyButtonPointer.rootY);
|
||||
AppleWMSendEvent(AppleWMActivationNotify,
|
||||
AppleWMActivationNotifyMask,
|
||||
AppleWMIsActive, 0);
|
||||
break;
|
||||
|
||||
case kXquartzDeactivate:
|
||||
DEBUG_LOG("kXquartzDeactivate\n");
|
||||
AppleWMSendEvent(AppleWMActivationNotify,
|
||||
AppleWMActivationNotifyMask,
|
||||
AppleWMIsInactive, 0);
|
||||
QuartzHide();
|
||||
break;
|
||||
|
||||
case kXquartzDisplayChanged:
|
||||
DEBUG_LOG("kXquartzDisplayChanged\n");
|
||||
QuartzUpdateScreens();
|
||||
break;
|
||||
|
||||
case kXquartzWindowState:
|
||||
DEBUG_LOG("kXquartzWindowState\n");
|
||||
RootlessNativeWindowStateChanged(xe->u.clientMessage.u.l.longs0,
|
||||
xe->u.clientMessage.u.l.longs1);
|
||||
break;
|
||||
|
||||
case kXquartzWindowMoved:
|
||||
DEBUG_LOG("kXquartzWindowMoved\n");
|
||||
RootlessNativeWindowMoved ((WindowPtr)xe->u.clientMessage.u.l.longs0);
|
||||
break;
|
||||
|
||||
case kXquartzToggleFullscreen:
|
||||
DEBUG_LOG("kXquartzToggleFullscreen\n");
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
if (quartzEnableRootless) QuartzSetFullscreen(!quartzHasRoot);
|
||||
else if (quartzHasRoot) QuartzHide();
|
||||
else QuartzShow();
|
||||
#else
|
||||
// ErrorF("kXquartzToggleFullscreen not implemented\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kXquartzSetRootless:
|
||||
DEBUG_LOG("kXquartzSetRootless\n");
|
||||
#ifdef DARWIN_DDX_MISSING
|
||||
QuartzSetRootless(xe->u.clientMessage.u.l.longs0);
|
||||
if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
|
||||
#else
|
||||
// ErrorF("kXquartzSetRootless not implemented\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kXquartzSetRootClip:
|
||||
QuartzSetRootClip((BOOL)xe->u.clientMessage.u.l.longs0);
|
||||
break;
|
||||
|
||||
case kXquartzQuit:
|
||||
GiveUp(0);
|
||||
break;
|
||||
|
||||
case kXquartzReadPasteboard:
|
||||
QuartzReadPasteboard();
|
||||
break;
|
||||
|
||||
case kXquartzWritePasteboard:
|
||||
QuartzWritePasteboard();
|
||||
break;
|
||||
|
||||
case kXquartzBringAllToFront:
|
||||
DEBUG_LOG("kXquartzBringAllToFront\n");
|
||||
RootlessOrderAllWindows();
|
||||
break;
|
||||
|
||||
case kXquartzSpaceChanged:
|
||||
DEBUG_LOG("kXquartzSpaceChanged\n");
|
||||
QuartzSpaceChanged(xe->u.clientMessage.u.l.longs0);
|
||||
break;
|
||||
default:
|
||||
ErrorF("Unknown application defined event type %d.\n", xe->u.u.type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,5 +130,5 @@ void QuartzInitOutput(int argc,char **argv);
|
|||
void QuartzInitInput(int argc, char **argv);
|
||||
void QuartzGiveUp(void);
|
||||
void QuartzProcessEvent(xEvent *xe);
|
||||
|
||||
void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
|
||||
#endif
|
||||
|
|
|
@ -37,13 +37,14 @@
|
|||
#endif
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "inputstr.h"
|
||||
#include "quartzPasteboard.h"
|
||||
|
||||
#define BOOL xBOOL
|
||||
#include "darwin.h"
|
||||
#undef BOOL
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#undef BOOL
|
||||
|
||||
#include "pseudoramiX.h"
|
||||
|
||||
|
|
|
@ -1,646 +0,0 @@
|
|||
/**************************************************************
|
||||
*
|
||||
* Support for using the Quartz Window Manager cursor
|
||||
*
|
||||
* Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name(s) of the above copyright
|
||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "quartzCursor.h"
|
||||
#include "darwin.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "mi.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "cursorstr.h"
|
||||
#include "mipointrst.h"
|
||||
#include "globals.h"
|
||||
|
||||
// Size of the QuickDraw cursor
|
||||
#define CURSORWIDTH 16
|
||||
#define CURSORHEIGHT 16
|
||||
|
||||
typedef struct {
|
||||
int qdCursorMode;
|
||||
int qdCursorVisible;
|
||||
int useQDCursor;
|
||||
QueryBestSizeProcPtr QueryBestSize;
|
||||
miPointerSpriteFuncPtr spriteFuncs;
|
||||
} QuartzCursorScreenRec, *QuartzCursorScreenPtr;
|
||||
|
||||
static DevPrivateKey darwinCursorScreenKey = &darwinCursorScreenKey;
|
||||
static CursorPtr quartzLatentCursor = NULL;
|
||||
static QD_Cursor gQDArrow; // QuickDraw arrow cursor
|
||||
|
||||
// Cursor for the main thread to set (NULL = arrow cursor).
|
||||
static CCrsrHandle currentCursor = NULL;
|
||||
static pthread_mutex_t cursorMutex;
|
||||
static pthread_cond_t cursorCondition;
|
||||
|
||||
#define CURSOR_PRIV(pScreen) ((QuartzCursorScreenPtr) \
|
||||
dixLookupPrivate(&pScreen->devPrivates, darwinCursorScreenKey))
|
||||
|
||||
#define HIDE_QD_CURSOR(pScreen, visible) \
|
||||
if (visible) { \
|
||||
int ix; \
|
||||
for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
|
||||
CGDisplayHideCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
|
||||
} \
|
||||
visible = FALSE; \
|
||||
} ((void)0)
|
||||
|
||||
#define SHOW_QD_CURSOR(pScreen, visible) \
|
||||
{ \
|
||||
int ix; \
|
||||
for (ix = 0; ix < QUARTZ_PRIV(pScreen)->displayCount; ix++) { \
|
||||
CGDisplayShowCursor(QUARTZ_PRIV(pScreen)->displayIDs[ix]); \
|
||||
} \
|
||||
visible = TRUE; \
|
||||
} ((void)0)
|
||||
|
||||
#define CHANGE_QD_CURSOR(cursorH) \
|
||||
if (!quartzServerQuitting) { \
|
||||
/* Acquire lock and tell the main thread to change cursor */ \
|
||||
pthread_mutex_lock(&cursorMutex); \
|
||||
currentCursor = (CCrsrHandle) (cursorH); \
|
||||
QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
|
||||
\
|
||||
/* Wait for the main thread to change the cursor */ \
|
||||
pthread_cond_wait(&cursorCondition, &cursorMutex); \
|
||||
pthread_mutex_unlock(&cursorMutex); \
|
||||
} ((void)0)
|
||||
|
||||
|
||||
/*
|
||||
* MakeQDCursor helpers: CTAB_ENTER, interleave
|
||||
*/
|
||||
|
||||
// Add a color entry to a ctab
|
||||
#define CTAB_ENTER(ctab, index, r, g, b) \
|
||||
ctab->ctTable[index].value = index; \
|
||||
ctab->ctTable[index].rgb.red = r; \
|
||||
ctab->ctTable[index].rgb.green = g; \
|
||||
ctab->ctTable[index].rgb.blue = b
|
||||
|
||||
// Make an unsigned short by interleaving the bits of bytes c1 and c2.
|
||||
// High bit of c1 is first; low bit of c2 is last.
|
||||
// Interleave is a built-in INTERCAL operator.
|
||||
static unsigned short
|
||||
interleave(
|
||||
unsigned char c1,
|
||||
unsigned char c2 )
|
||||
{
|
||||
return
|
||||
((c1 & 0x80) << 8) | ((c2 & 0x80) << 7) |
|
||||
((c1 & 0x40) << 7) | ((c2 & 0x40) << 6) |
|
||||
((c1 & 0x20) << 6) | ((c2 & 0x20) << 5) |
|
||||
((c1 & 0x10) << 5) | ((c2 & 0x10) << 4) |
|
||||
((c1 & 0x08) << 4) | ((c2 & 0x08) << 3) |
|
||||
((c1 & 0x04) << 3) | ((c2 & 0x04) << 2) |
|
||||
((c1 & 0x02) << 2) | ((c2 & 0x02) << 1) |
|
||||
((c1 & 0x01) << 1) | ((c2 & 0x01) << 0) ;
|
||||
}
|
||||
|
||||
/*
|
||||
* MakeQDCursor
|
||||
* Make a QuickDraw color cursor from the given X11 cursor.
|
||||
* Warning: This code is nasty. Color cursors were meant to be read
|
||||
* from resources; constructing the structures programmatically is messy.
|
||||
*/
|
||||
/*
|
||||
QuickDraw cursor representation:
|
||||
Our color cursor is a 2 bit per pixel pixmap.
|
||||
Each pixel's bits are (source<<1 | mask) from the original X cursor pixel.
|
||||
The cursor's color table maps the colors like this:
|
||||
(2-bit value | X result | colortable | Mac result)
|
||||
00 | transparent | white | transparent (white outside mask)
|
||||
01 | back color | back color | back color
|
||||
10 | undefined | black | invert background (just for fun)
|
||||
11 | fore color | fore color | fore color
|
||||
*/
|
||||
static CCrsrHandle
|
||||
MakeQDCursor(
|
||||
CursorPtr pCursor )
|
||||
{
|
||||
CCrsrHandle result;
|
||||
CCrsrPtr curs;
|
||||
int i, w, h;
|
||||
unsigned short rowMask;
|
||||
PixMap *pix;
|
||||
ColorTable *ctab;
|
||||
unsigned short *image;
|
||||
|
||||
result = (CCrsrHandle) NewHandleClear(sizeof(CCrsr));
|
||||
if (!result) return NULL;
|
||||
HLock((Handle)result);
|
||||
curs = *result;
|
||||
|
||||
// Initialize CCrsr
|
||||
curs->crsrType = 0x8001; // 0x8000 = b&w, 0x8001 = color
|
||||
curs->crsrMap = (PixMapHandle) NewHandleClear(sizeof(PixMap));
|
||||
if (!curs->crsrMap) goto pixAllocFailed;
|
||||
HLock((Handle)curs->crsrMap);
|
||||
pix = *curs->crsrMap;
|
||||
curs->crsrData = NULL; // raw cursor image data (set below)
|
||||
curs->crsrXData = NULL; // QD's processed data
|
||||
curs->crsrXValid = 0; // zero means QD must re-process cursor data
|
||||
curs->crsrXHandle = NULL; // reserved
|
||||
memset(curs->crsr1Data, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w data
|
||||
memset(curs->crsrMask, 0, CURSORWIDTH*CURSORHEIGHT/8); // b&w & color mask
|
||||
curs->crsrHotSpot.h = min(CURSORWIDTH, pCursor->bits->xhot); // hot spot
|
||||
curs->crsrHotSpot.v = min(CURSORHEIGHT, pCursor->bits->yhot); // hot spot
|
||||
curs->crsrXTable = 0; // reserved
|
||||
curs->crsrID = GetCTSeed(); // unique ID from Color Manager
|
||||
|
||||
// Set the b&w data and mask
|
||||
w = min(pCursor->bits->width, CURSORWIDTH);
|
||||
h = min(pCursor->bits->height, CURSORHEIGHT);
|
||||
rowMask = ~((1 << (CURSORWIDTH - w)) - 1);
|
||||
for (i = 0; i < h; i++) {
|
||||
curs->crsr1Data[i] = rowMask &
|
||||
((pCursor->bits->source[i*4]<<8) | pCursor->bits->source[i*4+1]);
|
||||
curs->crsrMask[i] = rowMask &
|
||||
((pCursor->bits->mask[i*4]<<8) | pCursor->bits->mask[i*4+1]);
|
||||
}
|
||||
|
||||
// Set the color data and mask
|
||||
// crsrMap: defines bit depth and size and colortable only
|
||||
pix->rowBytes = (CURSORWIDTH * 2 / 8) | 0x8000; // last bit on means PixMap
|
||||
SetRect(&pix->bounds, 0, 0, CURSORWIDTH, CURSORHEIGHT); // see TN 1020
|
||||
pix->pixelSize = 2;
|
||||
pix->cmpCount = 1;
|
||||
pix->cmpSize = 2;
|
||||
// pix->pmTable set below
|
||||
|
||||
// crsrData is the pixel data. crsrMap's baseAddr is not used.
|
||||
curs->crsrData = NewHandleClear(CURSORWIDTH*CURSORHEIGHT * 2 / 8);
|
||||
if (!curs->crsrData) goto imageAllocFailed;
|
||||
HLock((Handle)curs->crsrData);
|
||||
image = (unsigned short *) *curs->crsrData;
|
||||
// Pixel data is just 1-bit data and mask interleaved (see above)
|
||||
for (i = 0; i < h; i++) {
|
||||
unsigned char s, m;
|
||||
s = pCursor->bits->source[i*4] & (rowMask >> 8);
|
||||
m = pCursor->bits->mask[i*4] & (rowMask >> 8);
|
||||
image[2*i] = interleave(s, m);
|
||||
s = pCursor->bits->source[i*4+1] & (rowMask & 0x00ff);
|
||||
m = pCursor->bits->mask[i*4+1] & (rowMask & 0x00ff);
|
||||
image[2*i+1] = interleave(s, m);
|
||||
}
|
||||
|
||||
// Build the color table (entries described above)
|
||||
// NewPixMap allocates a color table handle.
|
||||
pix->pmTable = (CTabHandle) NewHandleClear(sizeof(ColorTable) + 3
|
||||
* sizeof(ColorSpec));
|
||||
if (!pix->pmTable) goto ctabAllocFailed;
|
||||
HLock((Handle)pix->pmTable);
|
||||
ctab = *pix->pmTable;
|
||||
ctab->ctSeed = GetCTSeed();
|
||||
ctab->ctFlags = 0;
|
||||
ctab->ctSize = 3; // color count - 1
|
||||
CTAB_ENTER(ctab, 0, 0xffff, 0xffff, 0xffff);
|
||||
CTAB_ENTER(ctab, 1, pCursor->backRed, pCursor->backGreen,
|
||||
pCursor->backBlue);
|
||||
CTAB_ENTER(ctab, 2, 0x0000, 0x0000, 0x0000);
|
||||
CTAB_ENTER(ctab, 3, pCursor->foreRed, pCursor->foreGreen,
|
||||
pCursor->foreBlue);
|
||||
|
||||
HUnlock((Handle)pix->pmTable); // ctab
|
||||
HUnlock((Handle)curs->crsrData); // image data
|
||||
HUnlock((Handle)curs->crsrMap); // pix
|
||||
HUnlock((Handle)result); // cursor
|
||||
|
||||
return result;
|
||||
|
||||
// "What we have here is a failure to allocate"
|
||||
ctabAllocFailed:
|
||||
HUnlock((Handle)curs->crsrData);
|
||||
DisposeHandle((Handle)curs->crsrData);
|
||||
imageAllocFailed:
|
||||
HUnlock((Handle)curs->crsrMap);
|
||||
DisposeHandle((Handle)curs->crsrMap);
|
||||
pixAllocFailed:
|
||||
HUnlock((Handle)result);
|
||||
DisposeHandle((Handle)result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FreeQDCursor
|
||||
* Destroy a QuickDraw color cursor created with MakeQDCursor().
|
||||
* The cursor must not currently be on screen.
|
||||
*/
|
||||
static void FreeQDCursor(CCrsrHandle cursHandle)
|
||||
{
|
||||
CCrsrPtr curs;
|
||||
PixMap *pix;
|
||||
|
||||
HLock((Handle)cursHandle);
|
||||
curs = *cursHandle;
|
||||
HLock((Handle)curs->crsrMap);
|
||||
pix = *curs->crsrMap;
|
||||
DisposeHandle((Handle)pix->pmTable);
|
||||
HUnlock((Handle)curs->crsrMap);
|
||||
DisposeHandle((Handle)curs->crsrMap);
|
||||
DisposeHandle((Handle)curs->crsrData);
|
||||
HUnlock((Handle)cursHandle);
|
||||
DisposeHandle((Handle)cursHandle);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Pointer sprite functions
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* QuartzRealizeCursor
|
||||
* Convert the X cursor representation to QuickDraw format if possible.
|
||||
*/
|
||||
Bool
|
||||
QuartzRealizeCursor(
|
||||
ScreenPtr pScreen,
|
||||
CursorPtr pCursor )
|
||||
{
|
||||
CCrsrHandle qdCursor;
|
||||
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
||||
|
||||
if(!pCursor || !pCursor->bits)
|
||||
return FALSE;
|
||||
|
||||
// if the cursor is too big we use a software cursor
|
||||
if ((pCursor->bits->height > CURSORHEIGHT) ||
|
||||
(pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
|
||||
{
|
||||
if (quartzRootless) {
|
||||
// rootless can't use a software cursor
|
||||
return TRUE;
|
||||
} else {
|
||||
return (*ScreenPriv->spriteFuncs->RealizeCursor)
|
||||
(pScreen, pCursor);
|
||||
}
|
||||
}
|
||||
|
||||
// make new cursor image
|
||||
qdCursor = MakeQDCursor(pCursor);
|
||||
if (!qdCursor) return FALSE;
|
||||
|
||||
// save the result
|
||||
dixSetPrivate(&pCursor->devPrivates, pScreen, qdCursor);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzUnrealizeCursor
|
||||
* Free the storage space associated with a realized cursor.
|
||||
*/
|
||||
Bool
|
||||
QuartzUnrealizeCursor(
|
||||
ScreenPtr pScreen,
|
||||
CursorPtr pCursor )
|
||||
{
|
||||
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
||||
|
||||
if ((pCursor->bits->height > CURSORHEIGHT) ||
|
||||
(pCursor->bits->width > CURSORWIDTH) || !ScreenPriv->useQDCursor)
|
||||
{
|
||||
if (quartzRootless) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return (*ScreenPriv->spriteFuncs->UnrealizeCursor)
|
||||
(pScreen, pCursor);
|
||||
}
|
||||
} else {
|
||||
CCrsrHandle oldCursor = dixLookupPrivate(&pCursor->devPrivates,
|
||||
pScreen);
|
||||
if (currentCursor != oldCursor) {
|
||||
// This should only fail when quitting, in which case we just leak.
|
||||
FreeQDCursor(oldCursor);
|
||||
}
|
||||
dixSetPrivate(&pCursor->devPrivates, pScreen, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzSetCursor
|
||||
* Set the cursor sprite and position.
|
||||
* Use QuickDraw cursor if possible.
|
||||
*/
|
||||
static void
|
||||
QuartzSetCursor(
|
||||
ScreenPtr pScreen,
|
||||
CursorPtr pCursor,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
||||
|
||||
quartzLatentCursor = pCursor;
|
||||
|
||||
// Don't touch Mac OS cursor if X is hidden!
|
||||
if (!quartzServerVisible)
|
||||
return;
|
||||
|
||||
if (!pCursor) {
|
||||
// Remove the cursor completely.
|
||||
HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
|
||||
if (! ScreenPriv->qdCursorMode)
|
||||
(*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
|
||||
}
|
||||
else if ((pCursor->bits->height <= CURSORHEIGHT) &&
|
||||
(pCursor->bits->width <= CURSORWIDTH) && ScreenPriv->useQDCursor)
|
||||
{
|
||||
// Cursor is small enough to use QuickDraw directly.
|
||||
if (! ScreenPriv->qdCursorMode) // remove the X cursor
|
||||
(*ScreenPriv->spriteFuncs->SetCursor)(pScreen, 0, x, y);
|
||||
ScreenPriv->qdCursorMode = TRUE;
|
||||
|
||||
CHANGE_QD_CURSOR(dixLookupPrivate(&pCursor->devPrivates, pScreen));
|
||||
SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
|
||||
}
|
||||
else if (quartzRootless) {
|
||||
// Rootless can't use a software cursor, so we just use Mac OS arrow.
|
||||
CHANGE_QD_CURSOR(NULL);
|
||||
SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
|
||||
}
|
||||
else {
|
||||
// Cursor is too big for QuickDraw. Use X software cursor.
|
||||
HIDE_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
|
||||
ScreenPriv->qdCursorMode = FALSE;
|
||||
(*ScreenPriv->spriteFuncs->SetCursor)(pScreen, pCursor, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzReallySetCursor
|
||||
* Set the QuickDraw cursor. Called from the main thread since changing the
|
||||
* cursor with QuickDraw is not thread safe on dual processor machines.
|
||||
*/
|
||||
void
|
||||
QuartzReallySetCursor()
|
||||
{
|
||||
pthread_mutex_lock(&cursorMutex);
|
||||
|
||||
if (currentCursor) {
|
||||
SetCCursor(currentCursor);
|
||||
} else {
|
||||
SetCursor(&gQDArrow);
|
||||
}
|
||||
|
||||
pthread_cond_signal(&cursorCondition);
|
||||
pthread_mutex_unlock(&cursorMutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzMoveCursor
|
||||
* Move the cursor. This is a noop for QuickDraw.
|
||||
*/
|
||||
static void
|
||||
QuartzMoveCursor(
|
||||
ScreenPtr pScreen,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
||||
|
||||
// only the X cursor needs to be explicitly moved
|
||||
if (!ScreenPriv->qdCursorMode)
|
||||
(*ScreenPriv->spriteFuncs->MoveCursor)(pScreen, x, y);
|
||||
}
|
||||
|
||||
|
||||
static miPointerSpriteFuncRec quartzSpriteFuncsRec = {
|
||||
QuartzRealizeCursor,
|
||||
QuartzUnrealizeCursor,
|
||||
QuartzSetCursor,
|
||||
QuartzMoveCursor
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Pointer screen functions
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* QuartzCursorOffScreen
|
||||
*/
|
||||
static Bool QuartzCursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzCrossScreen
|
||||
*/
|
||||
static void QuartzCrossScreen(ScreenPtr pScreen, Bool entering)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzWarpCursor
|
||||
* Change the cursor position without generating an event or motion history.
|
||||
* The input coordinates (x,y) are in pScreen-local X11 coordinates.
|
||||
*
|
||||
*/
|
||||
static void
|
||||
QuartzWarpCursor(
|
||||
ScreenPtr pScreen,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
static int neverMoved = TRUE;
|
||||
|
||||
if (neverMoved) {
|
||||
// Don't move the cursor the first time. This is the jump-to-center
|
||||
// initialization, and it's annoying because we may still be in MacOS.
|
||||
neverMoved = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (quartzServerVisible) {
|
||||
CGDisplayErr cgErr;
|
||||
CGPoint cgPoint;
|
||||
// Only need to do this for one display. Any display will do.
|
||||
CGDirectDisplayID cgID = QUARTZ_PRIV(pScreen)->displayIDs[0];
|
||||
CGRect cgRect = CGDisplayBounds(cgID);
|
||||
|
||||
// Convert (x,y) to CoreGraphics screen-local CG coordinates.
|
||||
// This is necessary because the X11 screen and CG screen may not
|
||||
// coincide. (e.g. X11 screen may be moved to dodge the menu bar)
|
||||
|
||||
// Make point in X11 global coordinates
|
||||
cgPoint = CGPointMake(x + dixScreenOrigins[pScreen->myNum].x,
|
||||
y + dixScreenOrigins[pScreen->myNum].y);
|
||||
// Shift to CoreGraphics global screen coordinates
|
||||
cgPoint.x += darwinMainScreenX;
|
||||
cgPoint.y += darwinMainScreenY;
|
||||
// Shift to CoreGraphics screen-local coordinates
|
||||
cgPoint.x -= cgRect.origin.x;
|
||||
cgPoint.y -= cgRect.origin.y;
|
||||
|
||||
cgErr = CGDisplayMoveCursorToPoint(cgID, cgPoint);
|
||||
if (cgErr != CGDisplayNoErr) {
|
||||
ErrorF("Could not set cursor position with error code 0x%x.\n",
|
||||
cgErr);
|
||||
}
|
||||
}
|
||||
|
||||
miPointerWarpCursor(pScreen, x, y);
|
||||
miPointerUpdate();
|
||||
}
|
||||
|
||||
|
||||
static miPointerScreenFuncRec quartzScreenFuncsRec = {
|
||||
QuartzCursorOffScreen,
|
||||
QuartzCrossScreen,
|
||||
QuartzWarpCursor,
|
||||
DarwinEQPointerPost,
|
||||
DarwinEQSwitchScreen
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
===========================================================================
|
||||
|
||||
Other screen functions
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* QuartzCursorQueryBestSize
|
||||
* Handle queries for best cursor size
|
||||
*/
|
||||
static void
|
||||
QuartzCursorQueryBestSize(
|
||||
int class,
|
||||
unsigned short *width,
|
||||
unsigned short *height,
|
||||
ScreenPtr pScreen)
|
||||
{
|
||||
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
||||
|
||||
if (class == CursorShape) {
|
||||
*width = CURSORWIDTH;
|
||||
*height = CURSORHEIGHT;
|
||||
} else {
|
||||
(*ScreenPriv->QueryBestSize)(class, width, height, pScreen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* QuartzInitCursor
|
||||
* Initialize cursor support
|
||||
*/
|
||||
Bool
|
||||
QuartzInitCursor(
|
||||
ScreenPtr pScreen )
|
||||
{
|
||||
QuartzCursorScreenPtr ScreenPriv;
|
||||
miPointerScreenPtr PointPriv;
|
||||
DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen);
|
||||
|
||||
// initialize software cursor handling (always needed as backup)
|
||||
if (!miDCInitialize(pScreen, &quartzScreenFuncsRec)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ScreenPriv = xcalloc( 1, sizeof(QuartzCursorScreenRec) );
|
||||
if (!ScreenPriv) return FALSE;
|
||||
|
||||
CURSOR_PRIV(pScreen) = ScreenPriv;
|
||||
|
||||
// override some screen procedures
|
||||
ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
|
||||
pScreen->QueryBestSize = QuartzCursorQueryBestSize;
|
||||
|
||||
// initialize QuickDraw cursor handling
|
||||
GetQDGlobalsArrow(&gQDArrow);
|
||||
PointPriv = (miPointerScreenPtr)
|
||||
dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
|
||||
|
||||
ScreenPriv->spriteFuncs = PointPriv->spriteFuncs;
|
||||
PointPriv->spriteFuncs = &quartzSpriteFuncsRec;
|
||||
|
||||
if (!quartzRootless)
|
||||
ScreenPriv->useQDCursor = QuartzFSUseQDCursor(dfb->colorBitsPerPixel);
|
||||
else
|
||||
ScreenPriv->useQDCursor = TRUE;
|
||||
ScreenPriv->qdCursorMode = TRUE;
|
||||
ScreenPriv->qdCursorVisible = TRUE;
|
||||
|
||||
// initialize cursor mutex lock
|
||||
pthread_mutex_init(&cursorMutex, NULL);
|
||||
|
||||
// initialize condition for waiting
|
||||
pthread_cond_init(&cursorCondition, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
// X server is hiding. Restore the Aqua cursor.
|
||||
void QuartzSuspendXCursor(
|
||||
ScreenPtr pScreen )
|
||||
{
|
||||
QuartzCursorScreenPtr ScreenPriv = CURSOR_PRIV(pScreen);
|
||||
|
||||
CHANGE_QD_CURSOR(NULL);
|
||||
SHOW_QD_CURSOR(pScreen, ScreenPriv->qdCursorVisible);
|
||||
}
|
||||
|
||||
|
||||
// X server is showing. Restore the X cursor.
|
||||
void QuartzResumeXCursor(
|
||||
ScreenPtr pScreen,
|
||||
int x,
|
||||
int y )
|
||||
{
|
||||
QuartzSetCursor(pScreen, quartzLatentCursor, x, y);
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* quartzCursor.h
|
||||
*
|
||||
* External interface for Quartz hardware cursor
|
||||
*
|
||||
* Copyright (c) 2001 Torrey T. Lyons and Greg Parker.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name(s) of the above copyright
|
||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifndef QUARTZCURSOR_H
|
||||
#define QUARTZCURSOR_H
|
||||
|
||||
#include "screenint.h"
|
||||
|
||||
Bool QuartzInitCursor(ScreenPtr pScreen);
|
||||
void QuartzReallySetCursor(void);
|
||||
void QuartzSuspendXCursor(ScreenPtr pScreen);
|
||||
void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
|
||||
|
||||
#endif
|
|
@ -46,7 +46,6 @@ typedef struct darwinKeyboardInfo_struct {
|
|||
} darwinKeyboardInfo;
|
||||
|
||||
/* These functions need to be implemented by Xquartz, XDarwin, etc. */
|
||||
void DarwinKeyboardReload(DeviceIntPtr pDev);
|
||||
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
|
||||
unsigned int QuartzSystemKeymapSeed(void);
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "misc.h"
|
||||
#include "inputstr.h"
|
||||
#include "quartzPasteboard.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
@ -76,8 +78,8 @@ static char * QuartzReadCutBuffer(void)
|
|||
}
|
||||
|
||||
// Write X cut buffer to Mac OS X pasteboard
|
||||
// Called by ProcessInputEvents() in response to request from X server thread.
|
||||
void QuartzWritePasteboard(void)
|
||||
// Called by mieqProcessInputEvents() in response to request from X server thread.
|
||||
void QuartzWritePasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
|
||||
{
|
||||
char *text;
|
||||
text = QuartzReadCutBuffer();
|
||||
|
@ -90,8 +92,8 @@ void QuartzWritePasteboard(void)
|
|||
#define strequal(a, b) (0 == strcmp((a), (b)))
|
||||
|
||||
// Read Mac OS X pasteboard into X cut buffer
|
||||
// Called by ProcessInputEvents() in response to request from X server thread.
|
||||
void QuartzReadPasteboard(void)
|
||||
// Called by mieqProcessInputEvents() in response to request from X server thread.
|
||||
void QuartzReadPasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
|
||||
{
|
||||
char *oldText = QuartzReadCutBuffer();
|
||||
char *text = QuartzReadCocoaPasteboard();
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
#define _QUARTZPASTEBOARD_H
|
||||
|
||||
// Aqua->X
|
||||
void QuartzReadPasteboard(void);
|
||||
void QuartzReadPasteboard(int, xEventPtr, DeviceIntPtr, int);
|
||||
char * QuartzReadCocoaPasteboard(void); // caller must free string
|
||||
|
||||
// X->Aqua
|
||||
void QuartzWritePasteboard(void);
|
||||
void QuartzWritePasteboard(int, xEventPtr, DeviceIntPtr, int);
|
||||
void QuartzWriteCocoaPasteboard(char *text);
|
||||
|
||||
#endif /* _QUARTZPASTEBOARD_H */
|
||||
|
|
|
@ -320,8 +320,8 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = {
|
|||
QuartzCursorOffScreen,
|
||||
QuartzCrossScreen,
|
||||
QuartzWarpCursor,
|
||||
DarwinEQPointerPost,
|
||||
DarwinEQSwitchScreen
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#endif
|
||||
|
||||
#include "quartzCommon.h"
|
||||
#include "inputstr.h"
|
||||
#include "quartz.h"
|
||||
#include "xpr.h"
|
||||
#include "pseudoramiX.h"
|
||||
|
@ -67,7 +68,7 @@ static void eventHandler(unsigned int type, const void *arg,
|
|||
switch (type) {
|
||||
case XP_EVENT_DISPLAY_CHANGED:
|
||||
DEBUG_LOG("XP_EVENT_DISPLAY_CHANGED\n");
|
||||
QuartzMessageServerThread(kXquartzDisplayChanged, 0);
|
||||
DarwinSendDDXEvent(kXquartzDisplayChanged, 0);
|
||||
break;
|
||||
|
||||
case XP_EVENT_WINDOW_STATE_CHANGED:
|
||||
|
@ -75,7 +76,7 @@ static void eventHandler(unsigned int type, const void *arg,
|
|||
const xp_window_state_event *ws_arg = arg;
|
||||
|
||||
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: id=%d, state=%d\n", ws_arg->id, ws_arg->state);
|
||||
QuartzMessageServerThread(kXquartzWindowState, 2,
|
||||
DarwinSendDDXEvent(kXquartzWindowState, 2,
|
||||
ws_arg->id, ws_arg->state);
|
||||
} else {
|
||||
DEBUG_LOG("XP_EVENT_WINDOW_STATE_CHANGED: ignored\n");
|
||||
|
@ -87,7 +88,7 @@ static void eventHandler(unsigned int type, const void *arg,
|
|||
if (arg_size == sizeof(xp_window_id)) {
|
||||
xp_window_id id = * (xp_window_id *) arg;
|
||||
WindowPtr pWin = xprGetXWindow(id);
|
||||
QuartzMessageServerThread(kXquartzWindowMoved, 1, pWin);
|
||||
DarwinSendDDXEvent(kXquartzWindowMoved, 1, pWin);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -107,10 +108,10 @@ static void eventHandler(unsigned int type, const void *arg,
|
|||
}
|
||||
break;
|
||||
case XP_EVENT_SPACE_CHANGED:
|
||||
ErrorF("XP_EVENT_SPACE_CHANGED\n");
|
||||
DEBUG_LOG("XP_EVENT_SPACE_CHANGED\n");
|
||||
if(arg_size == sizeof(uint32_t)) {
|
||||
uint32_t space_id = *(uint32_t *)arg;
|
||||
QuartzMessageServerThread(kXquartzSpaceChanged, 1, space_id);
|
||||
DarwinSendDDXEvent(kXquartzSpaceChanged, 1, space_id);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -237,6 +237,14 @@ typedef struct _XkbSrvLedInfo {
|
|||
typedef struct
|
||||
{
|
||||
ProcessInputProc processInputProc;
|
||||
/* If processInputProc is set to something different than realInputProc,
|
||||
* UNWRAP and COND_WRAP will not touch processInputProc and update only
|
||||
* realInputProc. This ensures that
|
||||
* processInputProc == (frozen ? EnqueueEvent : realInputProc)
|
||||
*
|
||||
* WRAP_PROCESS_INPUT_PROC should only be called during initialization,
|
||||
* since it may destroy this invariant.
|
||||
*/
|
||||
ProcessInputProc realInputProc;
|
||||
DeviceUnwrapProc unwrapProc;
|
||||
} xkbDeviceInfoRec, *xkbDeviceInfoPtr;
|
||||
|
@ -254,14 +262,14 @@ typedef struct
|
|||
device->public.processInputProc = proc; \
|
||||
oldprocs->processInputProc = \
|
||||
oldprocs->realInputProc = device->public.realInputProc; \
|
||||
if (proc != device->public.enqueueInputProc) \
|
||||
device->public.realInputProc = proc; \
|
||||
oldprocs->unwrapProc = device->unwrapProc; \
|
||||
device->unwrapProc = unwrapproc;
|
||||
|
||||
#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs, backupproc) \
|
||||
backupproc = device->public.processInputProc; \
|
||||
device->public.processInputProc = oldprocs->processInputProc; \
|
||||
backupproc = device->public.realInputProc; \
|
||||
if (device->public.processInputProc == device->public.realInputProc)\
|
||||
device->public.processInputProc = oldprocs->realInputProc; \
|
||||
device->public.realInputProc = oldprocs->realInputProc; \
|
||||
device->unwrapProc = oldprocs->unwrapProc;
|
||||
|
||||
|
|
|
@ -239,6 +239,9 @@ _X_EXPORT int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
|
|||
#ifdef XV
|
||||
_X_EXPORT Bool noXvExtension = FALSE;
|
||||
#endif
|
||||
#ifdef DRI2
|
||||
_X_EXPORT Bool noDRI2Extension = FALSE;
|
||||
#endif
|
||||
|
||||
#define X_INCLUDE_NETDB_H
|
||||
#include <X11/Xos_r.h>
|
||||
|
|
|
@ -49,15 +49,14 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
|
|||
pointer data)
|
||||
{
|
||||
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
|
||||
ProcessInputProc tmp = device->public.processInputProc;
|
||||
ProcessInputProc dummy; /* unused, but neede for macro */
|
||||
ProcessInputProc backupproc;
|
||||
if(xkbPrivPtr->unwrapProc)
|
||||
xkbPrivPtr->unwrapProc = NULL;
|
||||
|
||||
UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, dummy);
|
||||
UNWRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr, backupproc);
|
||||
proc(device,data);
|
||||
WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr,
|
||||
tmp,xkbUnwrapProc);
|
||||
COND_WRAP_PROCESS_INPUT_PROC(device,xkbPrivPtr,
|
||||
backupproc,xkbUnwrapProc);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user