dix: Remove InitSprite, work can be done by InitializeSprite.
Free sprite struct if a spriteOwner is paired. xfree86: Use PairDevices instead of passing booleans around when creating a sprite. Xext: Switch back to using LookupPointer/KeyboardDevice instead of inputInfo.xyz.
This commit is contained in:
parent
2a35d44b6d
commit
43bd35fcf8
|
@ -316,7 +316,7 @@ ProcXTestFakeInput(client)
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
if (!extension)
|
if (!extension)
|
||||||
#endif /* XINPUT */
|
#endif /* XINPUT */
|
||||||
dev = inputInfo.keyboard;
|
dev = (DeviceIntPtr)LookupKeyboardDevice();
|
||||||
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
|
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
|
||||||
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
|
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
|
||||||
{
|
{
|
||||||
|
@ -361,7 +361,7 @@ ProcXTestFakeInput(client)
|
||||||
}
|
}
|
||||||
#endif /* XINPUT */
|
#endif /* XINPUT */
|
||||||
if (!dev)
|
if (!dev)
|
||||||
dev = inputInfo.pointer;
|
dev = (DeviceIntPtr*)LookupPointerDevice();
|
||||||
if (ev->u.keyButtonPointer.root == None)
|
if (ev->u.keyButtonPointer.root == None)
|
||||||
root = GetCurrentRootWindow();
|
root = GetCurrentRootWindow();
|
||||||
else
|
else
|
||||||
|
@ -427,7 +427,7 @@ ProcXTestFakeInput(client)
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
if ((!noPanoramiXExtension
|
if ((!noPanoramiXExtension
|
||||||
&& root->drawable.pScreen->myNum
|
&& root->drawable.pScreen->myNum
|
||||||
!= XineramaGetCursorScreen(inputInfo.pointer))
|
!= XineramaGetCursorScreen(dev))
|
||||||
|| (noPanoramiXExtension && root != GetCurrentRootWindow()))
|
|| (noPanoramiXExtension && root != GetCurrentRootWindow()))
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -451,7 +451,7 @@ ProcXTestFakeInput(client)
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
if (!extension)
|
if (!extension)
|
||||||
#endif /* XINPUT */
|
#endif /* XINPUT */
|
||||||
dev = inputInfo.pointer;
|
dev = (DeviceIntPtr*)LookupPointerDevice();
|
||||||
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
|
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
|
||||||
{
|
{
|
||||||
client->errorValue = ev->u.u.detail;
|
client->errorValue = ev->u.u.detail;
|
||||||
|
|
|
@ -9,4 +9,4 @@ cd $srcdir
|
||||||
autoreconf -v --install || exit 1
|
autoreconf -v --install || exit 1
|
||||||
cd $ORIGDIR || exit $?
|
cd $ORIGDIR || exit $?
|
||||||
|
|
||||||
$srcdir/configure --enable-maintainer-mode "$@"
|
$srcdir/configure --enable-maintainer-mode --disable-dmx "$@"
|
||||||
|
|
|
@ -1937,14 +1937,21 @@ ProcQueryKeymap(ClientPtr client)
|
||||||
* pointer sprite.
|
* pointer sprite.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
PairDevices(ClientPtr client, DeviceIntPtr pointer, DeviceIntPtr keyboard)
|
PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
|
||||||
{
|
{
|
||||||
if (!pairingClient)
|
if (!pairingClient)
|
||||||
RegisterPairingClient(client);
|
RegisterPairingClient(client);
|
||||||
else if (pairingClient != client)
|
else if (pairingClient != client)
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
|
|
||||||
keyboard->pSprite = pointer->pSprite;
|
if (kbd->spriteOwner)
|
||||||
|
{
|
||||||
|
xfree(kbd->pSprite);
|
||||||
|
kbd->pSprite = NULL;
|
||||||
|
kbd->spriteOwner = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
kbd->pSprite = ptr->pSprite;
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
dix/events.c
21
dix/events.c
|
@ -240,7 +240,6 @@ static WindowPtr *spriteTrace = (WindowPtr *)NULL;
|
||||||
static int spriteTraceSize = 0;
|
static int spriteTraceSize = 0;
|
||||||
static int spriteTraceGood;
|
static int spriteTraceGood;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if device owns a cursor, false if device shares a cursor sprite with
|
* True if device owns a cursor, false if device shares a cursor sprite with
|
||||||
* another device.
|
* another device.
|
||||||
|
@ -2212,8 +2211,16 @@ void
|
||||||
InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
||||||
{
|
{
|
||||||
SpritePtr pSprite;
|
SpritePtr pSprite;
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
ScreenPtr pScreen;
|
||||||
|
|
||||||
|
if (!pDev->pSprite)
|
||||||
|
{
|
||||||
|
pDev->pSprite = (SpritePtr)xcalloc(1, sizeof(SpriteRec));
|
||||||
|
if (!pDev->pSprite)
|
||||||
|
FatalError("InitializeSprite: failed to allocate sprite struct");
|
||||||
|
}
|
||||||
|
|
||||||
|
pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr)NULL;
|
||||||
pSprite = pDev->pSprite;
|
pSprite = pDev->pSprite;
|
||||||
pSprite->hotPhys.pScreen = pScreen;
|
pSprite->hotPhys.pScreen = pScreen;
|
||||||
pSprite->hotPhys.x = pScreen->width / 2;
|
pSprite->hotPhys.x = pScreen->width / 2;
|
||||||
|
@ -2222,8 +2229,12 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
||||||
pSprite->hotLimits.x2 = pScreen->width;
|
pSprite->hotLimits.x2 = pScreen->width;
|
||||||
pSprite->hotLimits.y2 = pScreen->height;
|
pSprite->hotLimits.y2 = pScreen->height;
|
||||||
pSprite->win = pWin;
|
pSprite->win = pWin;
|
||||||
pSprite->current = wCursor (pWin);
|
if (pWin)
|
||||||
pSprite->current->refcnt++;
|
{
|
||||||
|
pSprite->current = wCursor(pWin);
|
||||||
|
pSprite->current->refcnt++;
|
||||||
|
} else
|
||||||
|
pSprite->current = NullCursor;
|
||||||
|
|
||||||
(*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
|
(*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
|
||||||
&pSprite->hotLimits, &pSprite->physLimits);
|
&pSprite->hotLimits, &pSprite->physLimits);
|
||||||
|
@ -2252,6 +2263,8 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
||||||
REGION_NULL(pScreen, &pSprite->Reg2);
|
REGION_NULL(pScreen, &pSprite->Reg2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
pDev->spriteOwner = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -187,7 +187,11 @@ xf86ActivateDevice(LocalDevicePtr local)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Only create a new sprite if it's a non-shared pointer */
|
/* Only create a new sprite if it's a non-shared pointer */
|
||||||
InitSprite(dev, IsPointerDevice(dev) && dev->isMPDev);
|
if (IsPointerDevice(dev) && dev->isMPDev)
|
||||||
|
InitializeSprite(pDev, NullWindow);
|
||||||
|
else
|
||||||
|
PairDevices(pairingClient, inputInfo.pointer, pDev);
|
||||||
|
|
||||||
RegisterOtherDevice(dev);
|
RegisterOtherDevice(dev);
|
||||||
|
|
||||||
if (serverGeneration == 1)
|
if (serverGeneration == 1)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
#ifdef HAVE_XORG_CONFIG_H
|
||||||
#include <xorg-config.h>
|
#include <xorg-config.h>
|
||||||
|
#include <linux/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
|
|
|
@ -355,7 +355,7 @@ typedef struct _DeviceIntRec {
|
||||||
int nPrivates;
|
int nPrivates;
|
||||||
DeviceUnwrapProc unwrapProc;
|
DeviceUnwrapProc unwrapProc;
|
||||||
Bool isMPDev; /* TRUE if multipointer device */
|
Bool isMPDev; /* TRUE if multipointer device */
|
||||||
/* Each devices has a sprite. However, keyboards and shared pointers do
|
/* Each device has a sprite. However, keyboards and shared pointers do
|
||||||
not in fact own a sprite but rather have their pointer set to the
|
not in fact own a sprite but rather have their pointer set to the
|
||||||
sprite of another device. pSprite always has to point to a valid
|
sprite of another device. pSprite always has to point to a valid
|
||||||
sprite. spriteOwner indicates whether it is the device's sprite. */
|
sprite. spriteOwner indicates whether it is the device's sprite. */
|
||||||
|
|
Loading…
Reference in New Issue