aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-19 07:24:51 +0000
committermarha <marha@users.sourceforge.net>2010-04-19 07:24:51 +0000
commitd76a22b9314bfd407c7e26f78305aeecb5d2bcfb (patch)
tree12159810407a7473bed2b7ebf2dd33a86aabf854 /xorg-server
parentc9431e290c4f5bc0dcd290880df404fb50a5aa5e (diff)
downloadvcxsrv-d76a22b9314bfd407c7e26f78305aeecb5d2bcfb.tar.gz
vcxsrv-d76a22b9314bfd407c7e26f78305aeecb5d2bcfb.tar.bz2
vcxsrv-d76a22b9314bfd407c7e26f78305aeecb5d2bcfb.zip
xserver git update 19/4/2010
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/glx/glxcmds.c39
-rw-r--r--xorg-server/glx/glxdri2.c5
-rw-r--r--xorg-server/glx/glxext.c11
-rw-r--r--xorg-server/glx/glxscreens.c28
-rw-r--r--xorg-server/glx/glxscreens.h1
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c8
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c139
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2ext.c22
-rw-r--r--xorg-server/include/xkbsrv.h12
-rw-r--r--xorg-server/xkb/Makefile.am4
-rw-r--r--xorg-server/xkb/ddxDevBtn.c77
-rw-r--r--xorg-server/xkb/ddxFakeMtn.c118
-rw-r--r--xorg-server/xkb/xkbActions.c97
13 files changed, 164 insertions, 397 deletions
diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index 77afbf4b1..087d52ec2 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -161,7 +161,11 @@ validGlxDrawable(ClientPtr client, XID id, int type, int access_mode,
return FALSE;
}
+ /* If the ID of the glx drawable we looked up doesn't match the id
+ * we looked for, it's because we looked it up under the X
+ * drawable ID (see DoCreateGLXDrawable). */
if (rc == BadValue ||
+ (*drawable)->drawId != id ||
(type != GLX_DRAWABLE_ANY && type != (*drawable)->type)) {
client->errorValue = id;
switch (type) {
@@ -1097,14 +1101,6 @@ __glXDrawableInit(__GLXdrawable *drawable,
void
__glXDrawableRelease(__GLXdrawable *drawable)
{
- ScreenPtr pScreen = drawable->pDraw->pScreen;
-
- switch (drawable->type) {
- case GLX_DRAWABLE_PIXMAP:
- case GLX_DRAWABLE_PBUFFER:
- (*pScreen->DestroyPixmap)((PixmapPtr) drawable->pDraw);
- break;
- }
}
static int
@@ -1113,8 +1109,6 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf
{
__GLXdrawable *pGlxDraw;
- LEGAL_NEW_RESOURCE(glxDrawableId, client);
-
if (pGlxScreen->pScreen != pDraw->pScreen)
return BadMatch;
@@ -1128,6 +1122,15 @@ DoCreateGLXDrawable(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *conf
return BadAlloc;
}
+ /* Add the glx drawable under the XID of the underlying X drawable
+ * too. That way we'll get a callback in DrawableGone and can
+ * clean up properly when the drawable is destroyed. */
+ if (pDraw->id != glxDrawableId &&
+ !AddResource(pDraw->id, __glXDrawableRes, pGlxDraw)) {
+ pGlxDraw->destroy (pGlxDraw);
+ return BadAlloc;
+ }
+
return Success;
}
@@ -1138,6 +1141,8 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
DrawablePtr pDraw;
int err;
+ LEGAL_NEW_RESOURCE(glxDrawableId, client);
+
err = dixLookupDrawable(&pDraw, drawableId, client, 0, DixAddAccess);
if (err != Success) {
client->errorValue = drawableId;
@@ -1151,9 +1156,6 @@ DoCreateGLXPixmap(ClientPtr client, __GLXscreen *pGlxScreen, __GLXconfig *config
err = DoCreateGLXDrawable(client, pGlxScreen, config, pDraw,
glxDrawableId, GLX_DRAWABLE_PIXMAP);
- if (err == Success)
- ((PixmapPtr) pDraw)->refcnt++;
-
return err;
}
@@ -1294,6 +1296,8 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
PixmapPtr pPixmap;
int err;
+ LEGAL_NEW_RESOURCE(glxDrawableId, client);
+
if (!validGlxScreen(client, screenNum, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(client, pGlxScreen, fbconfigId, &config, &err))
@@ -1304,6 +1308,13 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId,
width, height, config->rgbBits, 0);
__glXleaveServer(GL_FALSE);
+ /* Assign the pixmap the same id as the pbuffer and add it as a
+ * resource so it and the DRI2 drawable will be reclaimed when the
+ * pbuffer is destroyed. */
+ pPixmap->drawable.id = glxDrawableId;
+ if (!AddResource(pPixmap->drawable.id, RT_PIXMAP, pPixmap))
+ return BadAlloc;
+
return DoCreateGLXDrawable(client, pGlxScreen, config, &pPixmap->drawable,
glxDrawableId, GLX_DRAWABLE_PBUFFER);
}
@@ -1411,6 +1422,8 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc)
DrawablePtr pDraw;
int err;
+ LEGAL_NEW_RESOURCE(req->glxwindow, client);
+
if (!validGlxScreen(client, req->screen, &pGlxScreen, &err))
return err;
if (!validGlxFBConfig(client, pGlxScreen, req->fbconfig, &config, &err))
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index 4c9f381c6..74d6ebc5d 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -105,11 +105,6 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
(*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);
-
__glXDrawableRelease(drawable);
xfree(private);
diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c
index 59bcfbed2..89e58b0b0 100644
--- a/xorg-server/glx/glxext.c
+++ b/xorg-server/glx/glxext.c
@@ -126,6 +126,17 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
{
__GLXcontext *c;
+ /* If this drawable was created using glx 1.3 drawable
+ * constructors, we added it as a glx drawable resource under both
+ * its glx drawable ID and it X drawable ID. Remove the other
+ * resource now so we don't a callback for freed memory. */
+ if (glxPriv->drawId != glxPriv->pDraw->id) {
+ if (xid == glxPriv->drawId)
+ FreeResourceByType(glxPriv->pDraw->id, __glXDrawableRes, TRUE);
+ else
+ FreeResourceByType(glxPriv->drawId, __glXDrawableRes, TRUE);
+ }
+
for (c = glxAllContexts; c; c = c->next) {
if (c->isCurrent && (c->drawPriv == glxPriv || c->readPriv == glxPriv)) {
int i;
diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c
index a9b1b7955..3d3c23feb 100644
--- a/xorg-server/glx/glxscreens.c
+++ b/xorg-server/glx/glxscreens.c
@@ -215,7 +215,6 @@ glxCloseScreen (int index, ScreenPtr pScreen)
__GLXscreen *pGlxScreen = glxGetScreen(pScreen);
pScreen->CloseScreen = pGlxScreen->CloseScreen;
- pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
pGlxScreen->destroy(pGlxScreen);
@@ -347,31 +346,6 @@ pickFBConfig(__GLXscreen *pGlxScreen, VisualPtr visual)
return best;
}
-static Bool
-glxDestroyWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- __GLXscreen *pGlxScreen = glxGetScreen(pScreen);
- Bool retval = TRUE;
-
- FreeResource(pWin->drawable.id, FALSE);
-
- /* call lower wrapped functions */
- if (pGlxScreen->DestroyWindow) {
- /* unwrap */
- pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
-
- /* call lower layers */
- retval = (*pScreen->DestroyWindow)(pWin);
-
- /* rewrap */
- pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = glxDestroyWindow;
- }
-
- return retval;
-}
-
void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
{
__GLXconfig *m;
@@ -394,8 +368,6 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
pGlxScreen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = glxCloseScreen;
- pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
- pScreen->DestroyWindow = glxDestroyWindow;
i = 0;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
diff --git a/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h
index bff436307..d52099fc2 100644
--- a/xorg-server/glx/glxscreens.h
+++ b/xorg-server/glx/glxscreens.h
@@ -173,7 +173,6 @@ struct __GLXscreen {
/*@}*/
Bool (*CloseScreen)(int index, ScreenPtr pScreen);
- Bool (*DestroyWindow)(WindowPtr pWindow);
};
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index 7723ba683..dba3370f3 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -86,6 +86,7 @@
#include "windowstr.h" /* screenIsSaved */
#include <stdarg.h>
+#include <stdint.h> /* for int64_t */
#include <X11/Xpoll.h>
@@ -1177,12 +1178,11 @@ xf86ScaleAxis(int Cx,
int Rxlow )
{
int X;
- int dSx = Sxhigh - Sxlow;
- int dRx = Rxhigh - Rxlow;
+ int64_t dSx = Sxhigh - Sxlow;
+ int64_t dRx = Rxhigh - Rxlow;
- dSx = Sxhigh - Sxlow;
if (dRx) {
- X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
+ X = (int)(((dSx * (Cx - Rxlow)) / dRx) + Sxlow);
}
else {
X = 0;
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index 2bdb73392..6c4dabc41 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -48,15 +48,14 @@
CARD8 dri2_major; /* version of DRI2 supported by DDX */
CARD8 dri2_minor;
-static int dri2ScreenPrivateKeyIndex;
+static int dri2ScreenPrivateKeyIndex;
static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKeyIndex;
-static int dri2WindowPrivateKeyIndex;
-static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKeyIndex;
-static int dri2PixmapPrivateKeyIndex;
-static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKeyIndex;
+static RESTYPE dri2DrawableRes;
+
+typedef struct _DRI2Screen *DRI2ScreenPtr;
typedef struct _DRI2Drawable {
- unsigned int refCount;
+ DRI2ScreenPtr dri2_screen;
int width;
int height;
DRI2BufferPtr *buffers;
@@ -73,9 +72,8 @@ typedef struct _DRI2Drawable {
int swap_limit; /* for N-buffering */
} DRI2DrawableRec, *DRI2DrawablePtr;
-typedef struct _DRI2Screen *DRI2ScreenPtr;
-
typedef struct _DRI2Screen {
+ ScreenPtr screen;
unsigned int numDrivers;
const char **driverNames;
const char *deviceName;
@@ -101,45 +99,35 @@ DRI2GetScreen(ScreenPtr pScreen)
static DRI2DrawablePtr
DRI2GetDrawable(DrawablePtr pDraw)
{
- WindowPtr pWin;
- PixmapPtr pPixmap;
+ DRI2DrawablePtr pPriv;
+ int rc;
- if (!pDraw)
+ rc = dixLookupResourceByType((pointer *) &pPriv, pDraw->id,
+ dri2DrawableRes, NULL, DixReadAccess);
+ if (rc != Success)
return NULL;
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDraw;
- return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
- }
- else
- {
- pPixmap = (PixmapPtr) pDraw;
- return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
- }
+ return pPriv;
}
int
DRI2CreateDrawable(DrawablePtr pDraw)
{
DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- WindowPtr pWin;
- PixmapPtr pPixmap;
DRI2DrawablePtr pPriv;
CARD64 ust;
+ int rc;
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv != NULL)
- {
- pPriv->refCount++;
- return Success;
- }
+ rc = dixLookupResourceByType((pointer *) &pPriv, pDraw->id,
+ dri2DrawableRes, NULL, DixReadAccess);
+ if (rc == Success || rc != BadValue)
+ return rc;
pPriv = xalloc(sizeof *pPriv);
if (pPriv == NULL)
return BadAlloc;
- pPriv->refCount = 1;
+ pPriv->dri2_screen = ds;
pPriv->width = pDraw->width;
pPriv->height = pDraw->height;
pPriv->buffers = NULL;
@@ -158,43 +146,30 @@ DRI2CreateDrawable(DrawablePtr pDraw)
pPriv->last_swap_msc = 0;
pPriv->last_swap_ust = 0;
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDraw;
- dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
- }
- else
- {
- pPixmap = (PixmapPtr) pDraw;
- dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
- }
+ if (!AddResource(pDraw->id, dri2DrawableRes, pPriv))
+ return BadAlloc;
return Success;
}
-static void
-DRI2FreeDrawable(DrawablePtr pDraw)
+static int DRI2DrawableGone(pointer p, XID id)
{
- DRI2DrawablePtr pPriv;
- WindowPtr pWin;
- PixmapPtr pPixmap;
+ DRI2DrawablePtr pPriv = p;
+ DRI2ScreenPtr ds = pPriv->dri2_screen;
+ DrawablePtr root;
+ int i;
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return;
+ root = &WindowTable[ds->screen->myNum]->drawable;
+ if (pPriv->buffers != NULL) {
+ for (i = 0; i < pPriv->bufferCount; i++)
+ (*ds->DestroyBuffer)(root, pPriv->buffers[i]);
+
+ xfree(pPriv->buffers);
+ }
xfree(pPriv);
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDraw;
- dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
- }
- else
- {
- pPixmap = (PixmapPtr) pDraw;
- dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
- }
+ return Success;
}
static int
@@ -505,10 +480,6 @@ DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame,
pPriv->blockedClient = NULL;
pPriv->blockedOnMsc = FALSE;
-
- /* If there's still a swap pending, let DRI2SwapComplete free it */
- if (pPriv->refCount == 0 && pPriv->swapsPending == 0)
- DRI2FreeDrawable(pDraw);
}
static void
@@ -576,13 +547,6 @@ DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
pPriv->last_swap_ust = ust;
DRI2WakeClient(client, pDraw, frame, tv_sec, tv_usec);
-
- /*
- * It's normal for the app to have exited with a swap outstanding, but
- * don't free the drawable until they're all complete.
- */
- if (pPriv->swapsPending == 0 && pPriv->refCount == 0)
- DRI2FreeDrawable(pDraw);
}
Bool
@@ -750,7 +714,7 @@ DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
Bool ret;
pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL || pPriv->refCount == 0)
+ if (pPriv == NULL)
return BadDrawable;
/* Old DDX just completes immediately */
@@ -774,7 +738,7 @@ DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc,
DRI2DrawablePtr pPriv;
pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL || pPriv->refCount == 0)
+ if (pPriv == NULL)
return BadDrawable;
/* target_sbc == 0 means to block until all pending swaps are
@@ -800,36 +764,6 @@ DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc,
return Success;
}
-void
-DRI2DestroyDrawable(DrawablePtr pDraw)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return;
-
- pPriv->refCount--;
- if (pPriv->refCount > 0)
- return;
-
- if (pPriv->buffers != NULL) {
- int i;
-
- for (i = 0; i < pPriv->bufferCount; i++)
- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
-
- xfree(pPriv->buffers);
- }
-
- /* If the window is destroyed while we have a swap or wait pending, don't
- * actually free the priv yet. We'll need it in the DRI2SwapComplete()
- * callback and we'll free it there once we're done. */
- if (!pPriv->swapsPending && !pPriv->blockedClient)
- DRI2FreeDrawable(pDraw);
-}
-
Bool
DRI2HasSwapControl(ScreenPtr pScreen)
{
@@ -890,6 +824,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
if (!ds)
return FALSE;
+ ds->screen = pScreen;
ds->fd = info->fd;
ds->deviceName = info->deviceName;
dri2_major = 1;
@@ -961,6 +896,8 @@ DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
{
static Bool setupDone = FALSE;
+ dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
+
if (!setupDone)
{
setupDone = TRUE;
diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c
index 094d54dc0..17df1304e 100644
--- a/xorg-server/hw/xfree86/dri2/dri2ext.c
+++ b/xorg-server/hw/xfree86/dri2/dri2ext.c
@@ -51,7 +51,6 @@
#include "xf86Module.h"
static ExtensionEntry *dri2Extension;
-static RESTYPE dri2DrawableRes;
static Bool
validDrawable(ClientPtr client, XID drawable, Mask access_mode,
@@ -172,11 +171,6 @@ ProcDRI2CreateDrawable(ClientPtr client)
if (status != Success)
return status;
- if (!AddResource(stuff->drawable, dri2DrawableRes, pDrawable)) {
- DRI2DestroyDrawable(pDrawable);
- return BadAlloc;
- }
-
return client->noClientException;
}
@@ -192,8 +186,6 @@ ProcDRI2DestroyDrawable(ClientPtr client)
&pDrawable, &status))
return status;
- FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
-
return client->noClientException;
}
@@ -627,25 +619,11 @@ SProcDRI2Dispatch (ClientPtr client)
}
}
-static int DRI2DrawableGone(pointer p, XID id)
-{
- DrawablePtr pDrawable = p;
-
- DRI2DestroyDrawable(pDrawable);
-
- return Success;
-}
-
int DRI2EventBase;
static void
DRI2ExtensionInit(void)
{
- dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
-
- if (!dri2DrawableRes)
- return;
-
dri2Extension = AddExtension(DRI2_NAME,
DRI2NumberEvents,
DRI2NumberErrors,
diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h
index 278ff769d..a5d25d009 100644
--- a/xorg-server/include/xkbsrv.h
+++ b/xorg-server/include/xkbsrv.h
@@ -768,18 +768,6 @@ extern _X_EXPORT void XkbDDXUpdateDeviceIndicators(
CARD32 /* newState */
);
-extern _X_EXPORT void XkbDDXFakePointerMotion(
- unsigned int /* flags */,
- int /* x */,
- int /* y */
-);
-
-extern _X_EXPORT void XkbDDXFakeDeviceButton(
- DeviceIntPtr /* dev */,
- Bool /* press */,
- int /* button */
-);
-
extern _X_EXPORT int XkbDDXTerminateServer(
DeviceIntPtr /* dev */,
KeyCode /* key */,
diff --git a/xorg-server/xkb/Makefile.am b/xorg-server/xkb/Makefile.am
index e54ce59f0..fb3ccbf6f 100644
--- a/xorg-server/xkb/Makefile.am
+++ b/xorg-server/xkb/Makefile.am
@@ -5,11 +5,9 @@ AM_CFLAGS = $(DIX_CFLAGS)
DDX_SRCS = \
ddxBeep.c \
ddxCtrls.c \
- ddxFakeMtn.c \
ddxLEDs.c \
ddxLoad.c \
- ddxList.c \
- ddxDevBtn.c
+ ddxList.c
DIX_SRCS = \
xkb.c \
diff --git a/xorg-server/xkb/ddxDevBtn.c b/xorg-server/xkb/ddxDevBtn.c
deleted file mode 100644
index 94630d1c9..000000000
--- a/xorg-server/xkb/ddxDevBtn.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/************************************************************
-Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "eventstr.h"
-#include <xkbsrv.h>
-#include "mi.h"
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-
-void
-XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
-{
- EventListPtr events;
- int nevents, i;
- DeviceIntPtr ptr;
-
- /* If dev is a slave device, and the SD is attached, do nothing. If we'd
- * post through the attached master pointer we'd get duplicate events.
- *
- * if dev is a master keyboard, post through the master pointer.
- *
- * if dev is a floating slave, post through the device itself.
- */
-
- if (IsMaster(dev))
- ptr = GetMaster(dev, MASTER_POINTER);
- else if (!dev->u.master)
- ptr = dev;
- else
- return;
-
- events = InitEventList(GetMaximumEventsNum());
- nevents = GetPointerEvents(events, ptr,
- press ? ButtonPress : ButtonRelease, button,
- 0 /* flags */, 0 /* first */,
- 0 /* num_val */, NULL);
-
-
- for (i = 0; i < nevents; i++)
- mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
-
- FreeEventList(events, GetMaximumEventsNum());
-}
diff --git a/xorg-server/xkb/ddxFakeMtn.c b/xorg-server/xkb/ddxFakeMtn.c
deleted file mode 100644
index f90d2099a..000000000
--- a/xorg-server/xkb/ddxFakeMtn.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/************************************************************
-Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of Silicon Graphics not be
-used in advertising or publicity pertaining to distribution
-of the software without specific prior written permission.
-Silicon Graphics makes no representation about the suitability
-of this software for any purpose. It is provided "as is"
-without any express or implied warranty.
-
-SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
-SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
-GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
-THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/keysym.h>
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include <xkbsrv.h>
-#include <X11/extensions/XI.h>
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-
-#include "mipointer.h"
-#include "mipointrst.h"
-
-void
-XkbDDXFakePointerMotion(unsigned flags,int x,int y)
-{
-int oldX,oldY;
-ScreenPtr pScreen, oldScreen;
-
- GetSpritePosition(inputInfo.pointer, &oldX, &oldY);
- pScreen = oldScreen = GetSpriteWindow(inputInfo.pointer)->drawable.pScreen;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- BoxRec box;
- int i;
-
- if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
- oldX, oldY, &box)) {
- FOR_NSCREENS(i) {
- if(i == pScreen->myNum)
- continue;
- if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
- oldX, oldY, &box)) {
- pScreen = screenInfo.screens[i];
- break;
- }
- }
- }
- oldScreen = pScreen;
-
- if (flags&XkbSA_MoveAbsoluteX)
- oldX= x;
- else oldX+= x;
- if (flags&XkbSA_MoveAbsoluteY)
- oldY= y;
- else oldY+= y;
-
- if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
- oldX, oldY, &box)) {
- FOR_NSCREENS(i) {
- if(i == pScreen->myNum)
- continue;
- if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i],
- oldX, oldY, &box)) {
- pScreen = screenInfo.screens[i];
- break;
- }
- }
- }
- oldX -= panoramiXdataPtr[pScreen->myNum].x;
- oldY -= panoramiXdataPtr[pScreen->myNum].y;
- }
- else
-#endif
- {
- if (flags&XkbSA_MoveAbsoluteX)
- oldX= x;
- else oldX+= x;
- if (flags&XkbSA_MoveAbsoluteY)
- oldY= y;
- else oldY+= y;
-
-#define GetScreenPrivate(s) ((miPointerScreenPtr)dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey))
- (*(GetScreenPrivate(oldScreen))->screenFuncs->CursorOffScreen)
- (&pScreen, &oldX, &oldY);
- }
-
- if (pScreen != oldScreen)
- NewCurrentScreen(inputInfo.pointer, pScreen, oldX, oldY);
- if (pScreen->SetCursorPosition)
- (*pScreen->SetCursorPosition)(inputInfo.pointer, pScreen, oldX, oldY, TRUE);
-}
diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c
index 2cdb6fcea..6a9943fbc 100644
--- a/xorg-server/xkb/xkbActions.c
+++ b/xorg-server/xkb/xkbActions.c
@@ -40,11 +40,15 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkbsrv.h>
#include "xkb.h"
#include <ctype.h>
+#include "mi.h"
#define EXTENSION_EVENT_BASE 64
static int xkbDevicePrivateKeyIndex;
DevPrivateKey xkbDevicePrivateKey = &xkbDevicePrivateKeyIndex;
+static void XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button);
+static void XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y);
+
void
xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
pointer data)
@@ -479,7 +483,7 @@ int dx,dy;
dx= xkbi->mouseKeysDX;
dy= xkbi->mouseKeysDY;
}
- XkbDDXFakePointerMotion(xkbi->mouseKeysFlags,dx,dy);
+ XkbFakePointerMotion(xkbi->device, xkbi->mouseKeysFlags,dx,dy);
return xkbi->desc->ctrls->mk_interval;
}
@@ -507,7 +511,7 @@ Bool accel;
accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
x= XkbPtrActionX(&pAction->ptr);
y= XkbPtrActionY(&pAction->ptr);
- XkbDDXFakePointerMotion(pAction->ptr.flags,x,y);
+ XkbFakePointerMotion(xkbi->device, pAction->ptr.flags,x,y);
AccessXCancelRepeatKey(xkbi,keycode);
xkbi->mouseKeysAccel= accel&&
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
@@ -554,7 +558,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
((pAction->btn.flags&XkbSA_LockNoLock)==0)) {
xkbi->lockedPtrButtons|= (1<<button);
AccessXCancelRepeatKey(xkbi,keycode);
- XkbDDXFakeDeviceButton(xkbi->device, 1, button);
+ XkbFakeDeviceButton(xkbi->device, 1, button);
filter->upAction.type= XkbSA_NoAction;
}
break;
@@ -565,12 +569,12 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
if (pAction->btn.count>0) {
nClicks= pAction->btn.count;
for (i=0;i<nClicks;i++) {
- XkbDDXFakeDeviceButton(xkbi->device, 1, button);
- XkbDDXFakeDeviceButton(xkbi->device, 0, button);
+ XkbFakeDeviceButton(xkbi->device, 1, button);
+ XkbFakeDeviceButton(xkbi->device, 0, button);
}
filter->upAction.type= XkbSA_NoAction;
}
- else XkbDDXFakeDeviceButton(xkbi->device, 1, button);
+ else XkbFakeDeviceButton(xkbi->device, 1, button);
}
break;
case XkbSA_SetPtrDflt:
@@ -626,7 +630,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
}
xkbi->lockedPtrButtons&= ~(1<<button);
case XkbSA_PtrBtn:
- XkbDDXFakeDeviceButton(xkbi->device, 0, button);
+ XkbFakeDeviceButton(xkbi->device, 0, button);
break;
}
filter->active = 0;
@@ -964,7 +968,7 @@ int button;
if ((pAction->devbtn.flags&XkbSA_LockNoLock)||
BitIsOn(dev->button->down, button))
return 0;
- XkbDDXFakeDeviceButton(dev,TRUE,button);
+ XkbFakeDeviceButton(dev,TRUE,button);
filter->upAction.type= XkbSA_NoAction;
break;
case XkbSA_DeviceBtn:
@@ -972,12 +976,12 @@ int button;
int nClicks,i;
nClicks= pAction->btn.count;
for (i=0;i<nClicks;i++) {
- XkbDDXFakeDeviceButton(dev,TRUE,button);
- XkbDDXFakeDeviceButton(dev,FALSE,button);
+ XkbFakeDeviceButton(dev,TRUE,button);
+ XkbFakeDeviceButton(dev,FALSE,button);
}
filter->upAction.type= XkbSA_NoAction;
}
- else XkbDDXFakeDeviceButton(dev,TRUE,button);
+ else XkbFakeDeviceButton(dev,TRUE,button);
break;
}
}
@@ -996,10 +1000,10 @@ int button;
if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
!BitIsOn(dev->button->down, button))
return 0;
- XkbDDXFakeDeviceButton(dev,FALSE,button);
+ XkbFakeDeviceButton(dev,FALSE,button);
break;
case XkbSA_DeviceBtn:
- XkbDDXFakeDeviceButton(dev,FALSE,button);
+ XkbFakeDeviceButton(dev,FALSE,button);
break;
}
filter->active = 0;
@@ -1316,3 +1320,70 @@ xkbStateNotify sn;
return;
}
+static void
+XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
+{
+ EventListPtr events;
+ int nevents, i;
+ DeviceIntPtr ptr;
+ int gpe_flags = 0;
+
+ if (!dev->u.master)
+ ptr = dev;
+ else
+ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+
+ if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
+ gpe_flags = POINTER_ABSOLUTE;
+ else
+ gpe_flags = POINTER_RELATIVE;
+
+ events = InitEventList(GetMaximumEventsNum());
+ OsBlockSignals();
+ nevents = GetPointerEvents(events, ptr,
+ MotionNotify, 0,
+ gpe_flags, 0, 2, (int[]){x, y});
+ OsReleaseSignals();
+
+ for (i = 0; i < nevents; i++)
+ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
+
+ FreeEventList(events, GetMaximumEventsNum());
+}
+
+static void
+XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
+{
+ EventListPtr events;
+ int nevents, i;
+ DeviceIntPtr ptr;
+
+ /* If dev is a slave device, and the SD is attached, do nothing. If we'd
+ * post through the attached master pointer we'd get duplicate events.
+ *
+ * if dev is a master keyboard, post through the XTEST device
+ *
+ * if dev is a floating slave, post through the device itself.
+ */
+
+ if (IsMaster(dev))
+ ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+ else if (!dev->u.master)
+ ptr = dev;
+ else
+ return;
+
+ events = InitEventList(GetMaximumEventsNum());
+ OsBlockSignals();
+ nevents = GetPointerEvents(events, ptr,
+ press ? ButtonPress : ButtonRelease, button,
+ 0 /* flags */, 0 /* first */,
+ 0 /* num_val */, NULL);
+ OsReleaseSignals();
+
+
+ for (i = 0; i < nevents; i++)
+ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
+
+ FreeEventList(events, GetMaximumEventsNum());
+}