gtk+ and randr

Keith Packard keithp at keithp.com
Tue Jul 29 10:36:43 PDT 2008


On Tue, 2008-07-29 at 10:51 -0400, Adam Jackson wrote:

> http://people.freedesktop.org/~ajax/patches/randr-deliver-events-dammit.patch
> 
> Keith, does this look sane?

Cloning the existing TellChanged model would look like:

--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -24,10 +24,36 @@
 #include "propertyst.h"
 #include "swaprep.h"
 
-static void
-RRDeliverEvent (ScreenPtr pScreen, xEvent *event, CARD32 mask)
+static int
+DeliverPropertyEvent (WindowPtr pWin, pointer value)
 {
+    xRROutputPropertyNotifyEvent    *event = value;
+    RREventPtr			    *pHead, pRREvent;
+    ClientPtr			    client;
+
+    pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, RREventType);
+    if (!pHead)
+	return WT_WALKCHILDREN;
+
+    for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) 
+    {
+	client = pRREvent->client;
+	if (client == serverClient || client->clientGone)
+	    continue;
+
+	if (!(pRREvent->mask & RROutputPropertyNotifyMask))
+	    continue;
+
+	event->window = pRREvent->window->drawable.id;
+	WriteEventsToClient(pRREvent->client, 1, (xEvent *) event);
+    }
+    return WT_WALKCHILDREN;
+}
 
+static void
+RRDeliverPropertyEvent (ScreenPtr pScreen, xEvent *event)
+{
+    WalkTree (pScreen, DeliverPropertyEvent, (pointer) event);
 }
 
 void
@@ -45,7 +71,7 @@ RRDeleteAllOutputProperties (RROutputPtr output)
 	event.state = PropertyDelete;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
 	if (prop->current.data)
 	    xfree(prop->current.data);
 	if (prop->pending.data)
@@ -113,7 +139,7 @@ RRDeleteOutputProperty (RROutputPtr output, Atom property)
 	event.state = PropertyDelete;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
 	RRDestroyOutputProperty (prop);
     }
 }
@@ -238,7 +264,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
 	event.state = PropertyNewValue;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
     }
     return(Success);
 }
@@ -674,7 +700,7 @@ ProcRRGetOutputProperty (ClientPtr client)
 	event.state = PropertyDelete;
 	event.atom = prop->propertyName;
 	event.timestamp = currentTime.milliseconds;
-	RRDeliverEvent (output->pScreen, (xEvent *) &event, RROutputPropertyNotifyMask);
+	RRDeliverPropertyEvent (output->pScreen, (xEvent *) &event);
     }
 
     WriteReplyToClient(client, sizeof(xGenericReply), &reply);

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg/attachments/20080729/5fa1b91c/attachment.pgp>


More information about the xorg mailing list