From: Ville Syrjälä <[email protected]>

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ä <[email protected]>
---
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

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to