[PATCH 3/7] dix: move freeing the sprite into a function
Peter Hutterer
peter.hutterer at who-t.net
Tue May 15 03:36:25 PDT 2012
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/devices.c | 7 +------
dix/events.c | 12 ++++++++++++
include/dix.h | 2 ++
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/dix/devices.c b/dix/devices.c
index 2be8bf1..8adf3c9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -918,12 +918,7 @@ CloseDevice(DeviceIntPtr dev)
free(classes);
}
- if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
- if (dev->spriteInfo->sprite->current)
- FreeCursor(dev->spriteInfo->sprite->current, None);
- free(dev->spriteInfo->sprite->spriteTrace);
- free(dev->spriteInfo->sprite);
- }
+ FreeSprite(dev);
/* a client may have the device set as client pointer */
for (j = 0; j < currentMaxClients; j++) {
diff --git a/dix/events.c b/dix/events.c
index 9496b6f..a9a5722 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3194,6 +3194,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
#endif
}
+void FreeSprite(DeviceIntPtr dev)
+{
+ if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
+ if (dev->spriteInfo->sprite->current)
+ FreeCursor(dev->spriteInfo->sprite->current, None);
+ free(dev->spriteInfo->sprite->spriteTrace);
+ free(dev->spriteInfo->sprite);
+ }
+ dev->spriteInfo->sprite = NULL;
+}
+
+
/**
* Update the mouse sprite info when the server switches from a pScreen to another.
* Otherwise, the pScreen of the mouse sprite is never updated when we switch
diff --git a/include/dix.h b/include/dix.h
index 5dc2ac5..3d8b0e5 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -395,6 +395,8 @@ DeliverTouchEvents(DeviceIntPtr /* dev */ ,
extern void
InitializeSprite(DeviceIntPtr /* pDev */ ,
WindowPtr /* pWin */ );
+extern void
+FreeSprite(DeviceIntPtr pDev);
extern void
UpdateSpriteForScreen(DeviceIntPtr /* pDev */ ,
--
1.7.10.1
More information about the xorg-devel
mailing list