aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-05-05 09:43:03 +0000
committermarha <marha@users.sourceforge.net>2010-05-05 09:43:03 +0000
commit0874ae23a16946781dd517cfdb011c691ad0b581 (patch)
tree8de31864935e96a5e59b9fe6ceb12390bbc474cd /xorg-server/dix
parentd059ebdcb012228102f0b64f8cddf9464d5b625a (diff)
downloadvcxsrv-0874ae23a16946781dd517cfdb011c691ad0b581.tar.gz
vcxsrv-0874ae23a16946781dd517cfdb011c691ad0b581.tar.bz2
vcxsrv-0874ae23a16946781dd517cfdb011c691ad0b581.zip
svn merge -r571:HEAD "^/branches/released" .
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/devices.c20
-rw-r--r--xorg-server/dix/events.c41
-rw-r--r--xorg-server/dix/main.c1
-rw-r--r--xorg-server/dix/ptrveloc.c31
-rw-r--r--xorg-server/dix/window.c3
5 files changed, 36 insertions, 60 deletions
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 6119dcebb..a33df4d0a 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -89,13 +89,6 @@ SOFTWARE.
* This file handles input device-related stuff.
*/
-static int CoreDevicePrivateKeyIndex;
-DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKeyIndex;
-/* Used to store classes currently not in use by an MD */
-static int UnusedClassesPrivateKeyIndex;
-DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKeyIndex;
-
-
static void RecalculateMasterButtons(DeviceIntPtr slave);
/**
@@ -852,11 +845,14 @@ CloseDevice(DeviceIntPtr dev)
if (IsMaster(dev))
{
- classes = dixLookupPrivate(&dev->devPrivates, UnusedClassesPrivateKey);
+ classes = dev->unused_classes;
FreeAllDeviceClasses(classes);
+ xfree(classes);
}
if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
+ if (dev->spriteInfo->sprite->current)
+ FreeCursor(dev->spriteInfo->sprite->current, None);
xfree(dev->spriteInfo->sprite->spriteTrace);
xfree(dev->spriteInfo->sprite);
}
@@ -2465,7 +2461,6 @@ AllocDevicePair (ClientPtr client, char* name,
{
DeviceIntPtr pointer;
DeviceIntPtr keyboard;
- ClassesPtr classes;
*ptr = *keybd = NULL;
pointer = AddInputDevice(client, ptr_proc, TRUE);
@@ -2511,12 +2506,9 @@ AllocDevicePair (ClientPtr client, char* name,
keyboard->last.slave = NULL;
keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
-
/* The ClassesRec stores the device classes currently not used. */
- classes = xcalloc(1, sizeof(ClassesRec));
- dixSetPrivate(&pointer->devPrivates, UnusedClassesPrivateKey, classes);
- classes = xcalloc(1, sizeof(ClassesRec));
- dixSetPrivate(&keyboard->devPrivates, UnusedClassesPrivateKey, classes);
+ pointer->unused_classes = xcalloc(1, sizeof(ClassesRec));
+ keyboard->unused_classes = xcalloc(1, sizeof(ClassesRec));
*ptr = pointer;
*keybd = keyboard;
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index bfe6a8c42..a1c24bc97 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -1411,12 +1411,8 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
ComputeFreezes();
}
-/* Only ever used if a grab is called on an attached slave device. */
-static int GrabPrivateKeyIndex;
-static DevPrivateKey GrabPrivateKey = &GrabPrivateKeyIndex;
-
/**
- * Save the device's master device in the devPrivates. This needs to be done
+ * Save the device's master device id. This needs to be done
* if a client directly grabs a slave device that is attached to a master. For
* the duration of the grab, the device is detached, ungrabbing re-attaches it
* though.
@@ -1427,35 +1423,28 @@ static DevPrivateKey GrabPrivateKey = &GrabPrivateKeyIndex;
static void
DetachFromMaster(DeviceIntPtr dev)
{
- intptr_t id;
if (!dev->u.master)
return;
- id = dev->u.master->id;
+ dev->saved_master_id = dev->u.master->id;
- dixSetPrivate(&dev->devPrivates, GrabPrivateKey, (void *)id);
AttachDevice(NULL, dev, NULL);
}
static void
ReattachToOldMaster(DeviceIntPtr dev)
{
- int id;
- void *p;
DeviceIntPtr master = NULL;
if (IsMaster(dev))
return;
-
- p = dixLookupPrivate(&dev->devPrivates, GrabPrivateKey);
- id = (intptr_t) p; /* silence gcc warnings */
- dixLookupDevice(&master, id, serverClient, DixUseAccess);
+ dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess);
if (master)
{
AttachDevice(serverClient, dev, master);
- dixSetPrivate(&dev->devPrivates, GrabPrivateKey, NULL);
+ dev->saved_master_id = 0;
}
}
@@ -2572,7 +2561,6 @@ static Bool
PointInBorderSize(WindowPtr pWin, int x, int y)
{
BoxRec box;
- SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite;
if(POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box))
return TRUE;
@@ -2580,6 +2568,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
#ifdef PANORAMIX
if(!noPanoramiXExtension &&
XineramaSetWindowPntrs(inputInfo.pointer, pWin)) {
+ SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite;
int i;
for(i = 1; i < PanoramiXNumScreens; i++) {
@@ -2946,6 +2935,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
{
SpritePtr pSprite;
ScreenPtr pScreen;
+ CursorPtr pCursor;
if (!pDev->spriteInfo->sprite)
{
@@ -2989,8 +2979,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
if (pWin)
{
- pSprite->current = wCursor(pWin);
- pSprite->current->refcnt++;
+ pCursor = wCursor(pWin);
pSprite->spriteTrace = (WindowPtr *)xcalloc(1, 32*sizeof(WindowPtr));
if (!pSprite->spriteTrace)
FatalError("Failed to allocate spriteTrace");
@@ -3003,13 +2992,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
} else {
- pSprite->current = NullCursor;
+ pCursor = NullCursor;
pSprite->spriteTrace = NULL;
pSprite->spriteTraceSize = 0;
pSprite->spriteTraceGood = 0;
pSprite->pEnqueueScreen = screenInfo.screens[0];
pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
}
+ if (pCursor)
+ pCursor->refcnt++;
+ if (pSprite->current)
+ FreeCursor(pSprite->current, None);
+ pSprite->current = pCursor;
if (pScreen)
{
@@ -3062,6 +3056,7 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
{
SpritePtr pSprite = NULL;
WindowPtr win = NULL;
+ CursorPtr pCursor;
if (!pScreen)
return ;
@@ -3077,8 +3072,12 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
pSprite->hotLimits.x2 = pScreen->width;
pSprite->hotLimits.y2 = pScreen->height;
pSprite->win = win;
- pSprite->current = wCursor (win);
- pSprite->current->refcnt++;
+ pCursor = wCursor(win);
+ if (pCursor)
+ pCursor->refcnt++;
+ if (pSprite->current)
+ FreeCursor(pSprite->current, 0);
+ pSprite->current = pCursor;
pSprite->spriteTraceGood = 1;
pSprite->spriteTrace[0] = win;
(*pScreen->CursorLimits) (pDev,
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 923dbe99a..6cde35553 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -232,7 +232,6 @@ int main(int argc, char *argv[], char *envp[])
FatalError("couldn't init server resources");
SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
- screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 0;
InitAtoms();
diff --git a/xorg-server/dix/ptrveloc.c b/xorg-server/dix/ptrveloc.c
index b9ece2159..ffc1a1d85 100644
--- a/xorg-server/dix/ptrveloc.c
+++ b/xorg-server/dix/ptrveloc.c
@@ -92,8 +92,6 @@ GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
/* some int which is not a profile number */
#define PROFILE_UNINITIALIZE (-100)
-/* number of properties for predictable acceleration */
-#define NPROPS_PREDICTABLE_ACCEL 4
/**
* Init struct so it should match the average case
@@ -332,26 +330,18 @@ AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
}
-static int AccelPropHandlerPrivateKeyIndex;
-DevPrivateKey AccelPropHandlerPrivateKey = &AccelPropHandlerPrivateKeyIndex;
-
BOOL
InitializePredictableAccelerationProperties(DeviceIntPtr dev)
{
DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
- long *prop_handlers;
if(!vel)
return FALSE;
- prop_handlers = xalloc(NPROPS_PREDICTABLE_ACCEL * sizeof(long));
-
- prop_handlers[0] = AccelInitProfileProperty(dev, vel);
- prop_handlers[1] = AccelInitDecelProperty(dev, vel);
- prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
- prop_handlers[3] = AccelInitScaleProperty(dev, vel);
- dixSetPrivate(&dev->devPrivates, AccelPropHandlerPrivateKey,
- prop_handlers);
+ vel->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
+ vel->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
+ vel->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
+ vel->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
return TRUE;
}
@@ -359,8 +349,8 @@ InitializePredictableAccelerationProperties(DeviceIntPtr dev)
BOOL
DeletePredictableAccelerationProperties(DeviceIntPtr dev)
{
+ DeviceVelocityPtr vel;
Atom prop;
- long *prop_handlers;
int i;
prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
@@ -372,13 +362,10 @@ DeletePredictableAccelerationProperties(DeviceIntPtr dev)
prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
XIDeleteDeviceProperty(dev, prop, FALSE);
- prop_handlers = dixLookupPrivate(&dev->devPrivates,
- AccelPropHandlerPrivateKey);
- dixSetPrivate(&dev->devPrivates, AccelPropHandlerPrivateKey, NULL);
-
- for (i = 0; prop_handlers && i < NPROPS_PREDICTABLE_ACCEL; i++)
- XIUnregisterPropertyHandler(dev, prop_handlers[i]);
- xfree(prop_handlers);
+ vel = GetDevicePredictableAccelData(dev);
+ for (i = 0; vel && i < NPROPS_PREDICTABLE_ACCEL; i++)
+ if (vel->prop_handlers[i])
+ XIUnregisterPropertyHandler(dev, vel->prop_handlers[i]);
return TRUE;
}
diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c
index c7201df09..02451fc7e 100644
--- a/xorg-server/dix/window.c
+++ b/xorg-server/dix/window.c
@@ -2777,7 +2777,6 @@ UnrealizeTree(
WindowPtr pChild;
UnrealizeWindowProcPtr Unrealize;
MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
- int rc;
Unrealize = pWin->drawable.pScreen->UnrealizeWindow;
MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow;
@@ -2791,7 +2790,7 @@ UnrealizeTree(
#ifdef PANORAMIX
if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
PanoramiXRes *win;
- rc = dixLookupResourceByType((pointer *)&win,
+ int rc = dixLookupResourceByType((pointer *)&win,
pChild->drawable.id, XRT_WINDOW,
serverClient, DixWriteAccess);
if (rc == Success)