summaryrefslogtreecommitdiff
path: root/dix/property.c
diff options
context:
space:
mode:
Diffstat (limited to 'dix/property.c')
-rw-r--r--dix/property.c64
1 files changed, 21 insertions, 43 deletions
diff --git a/dix/property.c b/dix/property.c
index 034d86f63..e281dd765 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -91,6 +91,19 @@ PrintPropertys(WindowPtr pWin)
}
#endif
+static void
+deliverPropertyNotifyEvent(WindowPtr pWin, int state, Atom atom)
+{
+ xEvent event;
+
+ event.u.u.type = PropertyNotify;
+ event.u.property.window = pWin->drawable.id;
+ event.u.property.state = state;
+ event.u.property.atom = atom;
+ event.u.property.time = currentTime.milliseconds;
+ DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+}
+
int
ProcRotateProperties(ClientPtr client)
{
@@ -100,7 +113,6 @@ ProcRotateProperties(ClientPtr client)
Atom * atoms;
PropertyPtr * props; /* array of pointer */
PropertyPtr pProp;
- xEvent event;
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime();
@@ -157,16 +169,9 @@ found:
delta += stuff->nAtoms;
for (i = 0; i < stuff->nAtoms; i++)
{
- /* Generate a PropertyNotify event for each property whose value
- is changed in the order in which they appear in the request. */
+ deliverPropertyNotifyEvent(pWin, PropertyNewValue,
+ props[i]->propertyName);
- event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = PropertyNewValue;
- event.u.property.atom = props[i]->propertyName;
- event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
-
props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms];
}
}
@@ -243,7 +248,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
Bool sendevent)
{
PropertyPtr pProp;
- xEvent event;
int sizeInBytes;
int totalSize;
pointer data;
@@ -338,15 +342,10 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
pProp->size += len;
}
}
+
if (sendevent)
- {
- event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = PropertyNewValue;
- event.u.property.atom = pProp->propertyName;
- event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
- }
+ deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName);
+
return(Success);
}
@@ -354,7 +353,6 @@ int
DeleteProperty(WindowPtr pWin, Atom propName)
{
PropertyPtr pProp, prevProp;
- xEvent event;
if (!(pProp = wUserProps (pWin)))
return(Success);
@@ -377,12 +375,7 @@ DeleteProperty(WindowPtr pWin, Atom propName)
{
prevProp->next = pProp->next;
}
- event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = PropertyDelete;
- event.u.property.atom = pProp->propertyName;
- event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
xfree(pProp->data);
xfree(pProp);
}
@@ -393,17 +386,11 @@ void
DeleteAllWindowProperties(WindowPtr pWin)
{
PropertyPtr pProp, pNextProp;
- xEvent event;
pProp = wUserProps (pWin);
while (pProp)
{
- event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = PropertyDelete;
- event.u.property.atom = pProp->propertyName;
- event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
pNextProp = pProp->next;
xfree(pProp->data);
xfree(pProp);
@@ -537,16 +524,7 @@ ProcGetProperty(ClientPtr client)
reply.propertyType = pProp->type;
if (stuff->delete && (reply.bytesAfter == 0))
- { /* send the event */
- xEvent event;
-
- event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = PropertyDelete;
- event.u.property.atom = pProp->propertyName;
- event.u.property.time = currentTime.milliseconds;
- DeliverEvents(pWin, &event, 1, (WindowPtr)NULL);
- }
+ deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
if (len)