[RFC][PATCH] dix: Skip PropertyNotify events if the property value didn't change
ville.syrjala at nokia.com
ville.syrjala at nokia.com
Mon Sep 20 08:35:11 PDT 2010
From: Ville Syrjälä <ville.syrjala at nokia.com>
Avoid sending PropertyNotify events with the same value in case the
value didn't actually change. Avoids waking up the clients needlessly.
Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
---
I'm not sure if this kind of optimization is always legal or if some
specification says that the event must be sent even if the value doesn't
change. Hence the RFC.
dix/property.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/dix/property.c b/dix/property.c
index 1d4332a..ec77cd1 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -316,14 +316,22 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
if (!data && len)
return BadAlloc;
memcpy(data, value, totalSize);
- pProp->data = data;
pProp->size = len;
pProp->type = type;
pProp->format = format;
+
+ /* No need to send event if nothing changed */
+ if (!memcmp(&savedProp, pProp, sizeof(PropertyRec)) &&
+ !memcmp(savedProp.data, data, totalSize))
+ sendevent = FALSE;
+
+ pProp->data = data;
}
else if (len == 0)
{
/* do nothing */
+ /* No need to send event if nothing changed */
+ sendevent = FALSE;
}
else if (mode == PropModeAppend)
{
--
1.7.2.2
More information about the xorg-devel
mailing list