xserver: Branch 'mpx' - 2 commits
Peter Hutterer
whot at kemper.freedesktop.org
Mon Apr 2 04:59:03 EEST 2007
Xi/exevents.c | 2 -
Xi/extinit.c | 16 +++++++++++++
Xi/listdev.c | 9 +++++++
dix/cursor.c | 47 +++++++++--------------------------------
dix/events.c | 1
hw/xfree86/common/xf86Xinput.c | 2 -
include/extinit.h | 5 ++++
7 files changed, 43 insertions(+), 39 deletions(-)
New commits:
diff-tree a12054757d21edacc1c24c3077b9214726652829 (from 63d8f01819ef44ea3bf0d4fb20ba1d698ae91cd2)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Mon Apr 2 11:20:44 2007 +0930
Xi: fix ProcXListInputDevices to include the virtual core devices.
diff --git a/Xi/listdev.c b/Xi/listdev.c
index 02d55ad..33266ae 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -116,6 +116,10 @@ ProcXListInputDevices(register ClientPtr
AddOtherInputDevices();
+ SizeDeviceInfo(inputInfo.keyboard, &namesize, &size);
+ SizeDeviceInfo(inputInfo.pointer, &namesize, &size);
+ numdevs = 2;
+
for (d = inputInfo.devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size);
numdevs++;
@@ -132,6 +136,11 @@ ProcXListInputDevices(register ClientPtr
savbuf = devbuf;
dev = (xDeviceInfoPtr) devbuf;
+ ListDeviceInfo(client, inputInfo.keyboard, dev++,
+ &devbuf, &classbuf, &namebuf);
+ ListDeviceInfo(client, inputInfo.pointer, dev++,
+ &devbuf, &classbuf, &namebuf);
+
for (d = inputInfo.devices; d; d = d->next, dev++)
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
for (d = inputInfo.off_devices; d; d = d->next, dev++)
diff-tree 63d8f01819ef44ea3bf0d4fb20ba1d698ae91cd2 (from 20e4314b178e1a093bce85e93329d4bcfb4f4210)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Fri Mar 30 14:59:43 2007 +0930
dix: Fix wrong cursor refcount.
Calloc cursor struct to ensure devPrivates are zeroed out and don't
increase the refcnt for devices automatically when allocating a new
cursor. Use new DeviceIsPointerType() to detect if device is a pointer
_before_ device has been activated and can thus be identified and set
up grab functions accordingly. This way we can increase the refcnt
when we get a pointer grab.
diff --git a/Xi/exevents.c b/Xi/exevents.c
index bc26189..3e3f15a 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -101,7 +101,7 @@ RegisterOtherDevice(DeviceIntPtr device)
device->public.realInputProc = ProcessOtherEvent;
(device)->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
(device)->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
- if (IsPointerDevice(device))
+ if (DeviceIsPointerType(device))
{
(device)->coreGrab.ActivateGrab = ActivatePointerGrab;
(device)->coreGrab.DeactivateGrab = DeactivatePointerGrab;
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 3766a95..971617e 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -983,6 +983,22 @@ IResetProc(ExtensionEntry * unused)
RestoreExtensionEvents();
}
+/*****************************************************************
+ *
+ * Returns TRUE if the device has some sort of pointer type.
+ *
+ */
+
+Bool
+DeviceIsPointerType(DeviceIntPtr dev)
+{
+ if (dev_type[1].type == dev->type)
+ return TRUE;
+
+ return FALSE;
+}
+
+
/***********************************************************************
*
* Assign an id and type to an input device.
diff --git a/dix/cursor.c b/dix/cursor.c
index 27ae9f1..5886422 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -179,7 +179,7 @@ AllocCursorARGB(unsigned char *psrcbits,
ScreenPtr pscr;
DeviceIntPtr pDev;
- pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits));
+ pCurs = (CursorPtr)xcalloc(sizeof(CursorRec) + sizeof(CursorBits), 1);
if (!pCurs)
{
xfree(psrcbits);
@@ -196,7 +196,7 @@ AllocCursorARGB(unsigned char *psrcbits,
bits->height = cm->height;
bits->xhot = cm->xhot;
bits->yhot = cm->yhot;
- pCurs->refcnt = 0;
+ pCurs->refcnt = 1;
CheckForEmptyMask(bits);
pCurs->bits = bits;
@@ -215,6 +215,8 @@ AllocCursorARGB(unsigned char *psrcbits,
/*
* realize the cursor for every screen
+ * Do not change the refcnt, this will be changed when ChangeToCursor
+ * actually changes the sprite.
*/
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
{
@@ -223,7 +225,6 @@ AllocCursorARGB(unsigned char *psrcbits,
{
if (DevHasCursor(pDev))
{
- pCurs->refcnt++;
if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
{
/* Realize failed for device pDev on screen pscr.
@@ -325,7 +326,7 @@ AllocGlyphCursor(Font source, unsigned s
}
if (pShare)
{
- pCurs = (CursorPtr)xalloc(sizeof(CursorRec));
+ pCurs = (CursorPtr)xcalloc(sizeof(CursorRec), 1);
if (!pCurs)
return BadAlloc;
bits = pShare->bits;
@@ -367,7 +368,8 @@ AllocGlyphCursor(Font source, unsigned s
}
if (sourcefont != maskfont)
{
- pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits));
+ pCurs =
+ (CursorPtr)xcalloc(sizeof(CursorRec) + sizeof(CursorBits), 1);
if (pCurs)
bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
else
@@ -375,9 +377,9 @@ AllocGlyphCursor(Font source, unsigned s
}
else
{
- pCurs = (CursorPtr)xalloc(sizeof(CursorRec));
+ pCurs = (CursorPtr)xcalloc(sizeof(CursorRec), 1);
if (pCurs)
- bits = (CursorBitsPtr)xalloc(sizeof(CursorBits));
+ bits = (CursorBitsPtr)xcalloc(sizeof(CursorBits), 1);
else
bits = (CursorBitsPtr)NULL;
}
@@ -417,9 +419,10 @@ AllocGlyphCursor(Font source, unsigned s
sharedGlyphs = pShare;
}
}
+
CheckForEmptyMask(bits);
pCurs->bits = bits;
- pCurs->refcnt = 0;
+ pCurs->refcnt = 1;
#ifdef XFIXES
pCurs->serialNumber = ++cursorSerial;
pCurs->name = None;
@@ -440,38 +443,10 @@ AllocGlyphCursor(Font source, unsigned s
{
pscr = screenInfo.screens[nscr];
- pCurs->refcnt++;
- if (!(*pscr->RealizeCursor)(inputInfo.pointer, pscr, pCurs))
- {
- DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator*/
- /* Realize for core pointer failed. Unrealize everything from
- * previous screens.
- */
- while (--nscr >= 0)
- {
- pscr = screenInfo.screens[nscr];
- /* now unrealize all devices on previous screens */
- ( *pscr->UnrealizeCursor)(inputInfo.pointer, pscr, pCurs);
-
- pDevIt = inputInfo.devices;
- while (pDevIt)
- {
- if (DevHasCursor(pDevIt))
- ( *pscr->UnrealizeCursor)(pDevIt, pscr, pCurs);
- pDevIt = pDevIt->next;
- }
- ( *pscr->UnrealizeCursor)(pDev, pscr, pCurs);
- }
- FreeCursorBits(bits);
- xfree(pCurs);
- return BadAlloc;
- }
-
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
if (DevHasCursor(pDev))
{
- pCurs->refcnt++;
if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
{
/* Realize failed for device pDev on screen pscr.
diff --git a/dix/events.c b/dix/events.c
index a51a56c..c482f5c 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4024,7 +4024,6 @@ ProcGrabPointer(ClientPtr client)
oldCursor = grab->cursor;
}
tempGrab.cursor = cursor;
- /* FIXME: refcnt?? */
tempGrab.resource = client->clientAsMask;
tempGrab.ownerEvents = stuff->ownerEvents;
tempGrab.eventMask = stuff->eventMask;
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index a9ce211..2c74001 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -174,7 +174,7 @@ xf86ActivateDevice(LocalDevicePtr local)
dev->spriteInfo->spriteOwner = !(local->flags & XI86_SHARED_POINTER);
#ifdef XKB
- if (!IsPointerDevice(dev))
+ if (!DeviceIsPointerType(dev))
{
/* FIXME: that's not the nice way to do it. XKB wraps the previously
* set procs, so if we don't have them here, our event will disappear
diff --git a/include/extinit.h b/include/extinit.h
index ead59be..7a12b1b 100644
--- a/include/extinit.h
+++ b/include/extinit.h
@@ -142,6 +142,11 @@ IResetProc(
ExtensionEntry * /* unused */
);
+Bool
+DeviceIsPointerType(
+ DeviceIntPtr dev
+ );
+
void
AssignTypeAndName (
DeviceIntPtr /* dev */,
More information about the xorg-commit
mailing list