summaryrefslogtreecommitdiff
path: root/xserver/randr/rrproperty.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2010-12-05 15:36:12 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2010-12-05 15:36:12 +0000
commita90ee792d96752ad1b71b9ada922fa6afe478c99 (patch)
tree6143b00f7646951d23dfe2a4fe2992ca40b77069 /xserver/randr/rrproperty.c
parentbc97d4ecc0aa9e1b823565b07282f848700bd11a (diff)
Upgrade to xorg-server 1.9.2.
Tested by ajacoutot@, krw@, shadchin@ and jasper@ on various configurations including multihead with both zaphod and xrandr.
Diffstat (limited to 'xserver/randr/rrproperty.c')
-rw-r--r--xserver/randr/rrproperty.c160
1 files changed, 69 insertions, 91 deletions
diff --git a/xserver/randr/rrproperty.c b/xserver/randr/rrproperty.c
index 12e30e486..ba04c16e2 100644
--- a/xserver/randr/rrproperty.c
+++ b/xserver/randr/rrproperty.c
@@ -29,7 +29,6 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
{
xRROutputPropertyNotifyEvent *event = value;
RREventPtr *pHead, pRREvent;
- ClientPtr client;
dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
RREventType, serverClient, DixReadAccess);
@@ -38,14 +37,9 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
{
- client = pRREvent->client;
- if (client == serverClient || client->clientGone)
- continue;
-
if (!(pRREvent->mask & RROutputPropertyNotifyMask))
continue;
- event->sequenceNumber = client->sequence;
event->window = pRREvent->window->drawable.id;
WriteEventsToClient(pRREvent->client, 1, (xEvent *)event);
}
@@ -59,27 +53,39 @@ static void RRDeliverPropertyEvent(ScreenPtr pScreen, xEvent *event)
WalkTree(pScreen, DeliverPropertyEvent, event);
}
+static void
+RRDestroyOutputProperty (RRPropertyPtr prop)
+{
+ free(prop->valid_values);
+ free(prop->current.data);
+ free(prop->pending.data);
+ free(prop);
+}
+
+static void
+RRDeleteProperty(RROutputRec *output, RRPropertyRec *prop)
+{
+ xRROutputPropertyNotifyEvent event;
+ event.type = RREventBase + RRNotify;
+ event.subCode = RRNotify_OutputProperty;
+ event.output = output->id;
+ event.state = PropertyDelete;
+ event.atom = prop->propertyName;
+ event.timestamp = currentTime.milliseconds;
+
+ RRDeliverPropertyEvent(output->pScreen, (xEvent *)&event);
+
+ RRDestroyOutputProperty(prop);
+}
+
void
-RRDeleteAllOutputProperties (RROutputPtr output)
+RRDeleteAllOutputProperties(RROutputPtr output)
{
RRPropertyPtr prop, next;
- xRROutputPropertyNotifyEvent event;
- for (prop = output->properties; prop; prop = next)
- {
+ for (prop = output->properties; prop; prop = next) {
next = prop->next;
- event.type = RREventBase + RRNotify;
- event.subCode = RRNotify_OutputProperty;
- event.output = output->id;
- event.state = PropertyDelete;
- event.atom = prop->propertyName;
- event.timestamp = currentTime.milliseconds;
- RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
- if (prop->current.data)
- xfree(prop->current.data);
- if (prop->pending.data)
- xfree(prop->pending.data);
- xfree(prop);
+ RRDeleteProperty(output, prop);
}
}
@@ -97,7 +103,7 @@ RRCreateOutputProperty (Atom property)
{
RRPropertyPtr prop;
- prop = (RRPropertyPtr)xalloc(sizeof(RRPropertyRec));
+ prop = (RRPropertyPtr)malloc(sizeof(RRPropertyRec));
if (!prop)
return NULL;
prop->next = NULL;
@@ -112,41 +118,17 @@ RRCreateOutputProperty (Atom property)
return prop;
}
-static void
-RRDestroyOutputProperty (RRPropertyPtr prop)
-{
- if (prop->valid_values)
- xfree (prop->valid_values);
- if (prop->current.data)
- xfree(prop->current.data);
- if (prop->pending.data)
- xfree(prop->pending.data);
- if (prop->valid_values)
- xfree(prop->valid_values);
- xfree(prop);
-}
-
void
-RRDeleteOutputProperty (RROutputPtr output, Atom property)
+RRDeleteOutputProperty(RROutputPtr output, Atom property)
{
- RRPropertyPtr prop, *prev;
- xRROutputPropertyNotifyEvent event;
+ RRPropertyRec *prop, **prev;
for (prev = &output->properties; (prop = *prev); prev = &(prop->next))
- if (prop->propertyName == property)
- break;
- if (prop)
- {
- *prev = prop->next;
- event.type = RREventBase + RRNotify;
- event.subCode = RRNotify_OutputProperty;
- event.output = output->id;
- event.state = PropertyDelete;
- event.atom = prop->propertyName;
- event.timestamp = currentTime.milliseconds;
- RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
- RRDestroyOutputProperty (prop);
- }
+ if (prop->propertyName == property) {
+ *prev = prop->next;
+ RRDeleteProperty(output, prop);
+ return;
+ }
}
int
@@ -172,7 +154,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
{
prop = RRCreateOutputProperty (property);
if (!prop)
- return(BadAlloc);
+ return BadAlloc;
add = TRUE;
mode = PropModeReplace;
}
@@ -187,9 +169,9 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
"PropModeReplace" since they will be written over. */
if ((format != prop_value->format) && (mode != PropModeReplace))
- return(BadMatch);
+ return BadMatch;
if ((prop_value->type != type) && (mode != PropModeReplace))
- return(BadMatch);
+ return BadMatch;
new_value = *prop_value;
if (mode == PropModeReplace)
total_len = len;
@@ -201,7 +183,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
pointer new_data = NULL, old_data = NULL;
total_size = total_len * size_in_bytes;
- new_value.data = (pointer)xalloc (total_size);
+ new_value.data = (pointer)malloc(total_size);
if (!new_value.data && total_size)
{
if (add)
@@ -238,12 +220,10 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
!pScrPriv->rrOutputSetProperty(output->pScreen, output,
prop->propertyName, &new_value))
{
- if (new_value.data)
- xfree (new_value.data);
- return (BadValue);
+ free(new_value.data);
+ return BadValue;
}
- if (prop_value->data)
- xfree (prop_value->data);
+ free(prop_value->data);
*prop_value = new_value;
}
@@ -271,7 +251,7 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
event.timestamp = currentTime.milliseconds;
RRDeliverPropertyEvent (output->pScreen, (xEvent *)&event);
}
- return(Success);
+ return Success;
}
Bool
@@ -361,10 +341,10 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
{
prop = RRCreateOutputProperty (property);
if (!prop)
- return(BadAlloc);
+ return BadAlloc;
add = TRUE;
} else if (prop->immutable && !immutable)
- return(BadAccess);
+ return BadAccess;
/*
* ranges must have even number of values
@@ -372,7 +352,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
if (range && (num_values & 1))
return BadMatch;
- new_values = xalloc (num_values * sizeof (INT32));
+ new_values = malloc(num_values * sizeof (INT32));
if (!new_values && num_values)
return BadAlloc;
if (num_values)
@@ -384,8 +364,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
*/
if (prop->is_pending && !pending)
{
- if (prop->pending.data)
- xfree (prop->pending.data);
+ free(prop->pending.data);
RRInitOutputPropertyValue (&prop->pending);
}
@@ -393,8 +372,7 @@ RRConfigureOutputProperty (RROutputPtr output, Atom property,
prop->range = range;
prop->immutable = immutable;
prop->num_valid = num_values;
- if (prop->valid_values)
- xfree (prop->valid_values);
+ free(prop->valid_values);
prop->valid_values = new_values;
if (add) {
@@ -422,8 +400,8 @@ ProcRRListOutputProperties (ClientPtr client)
for (prop = output->properties; prop; prop = prop->next)
numProps++;
if (numProps)
- if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
- return(BadAlloc);
+ if(!(pAtoms = (Atom *)malloc(numProps * sizeof(Atom))))
+ return BadAlloc;
rep.type = X_Reply;
rep.length = bytes_to_int32(numProps * sizeof(Atom));
@@ -445,9 +423,9 @@ ProcRRListOutputProperties (ClientPtr client)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
- xfree(pAtoms);
+ free(pAtoms);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -468,7 +446,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
return BadName;
if (prop->num_valid) {
- extra = xalloc(prop->num_valid * sizeof(INT32));
+ extra = malloc(prop->num_valid * sizeof(INT32));
if (!extra)
return BadAlloc;
}
@@ -491,9 +469,9 @@ ProcRRQueryOutputProperty (ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
extra);
- xfree(extra);
+ free(extra);
}
- return(client->noClientException);
+ return Success;
}
int
@@ -552,12 +530,12 @@ ProcRRChangeOutputProperty (ClientPtr client)
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
- return(BadAtom);
+ return BadAtom;
}
if (!ValidAtom(stuff->type))
{
client->errorValue = stuff->type;
- return(BadAtom);
+ return BadAtom;
}
err = RRChangeOutputProperty(output, stuff->property,
@@ -566,7 +544,7 @@ ProcRRChangeOutputProperty (ClientPtr client)
if (err != Success)
return err;
else
- return client->noClientException;
+ return Success;
}
int
@@ -582,12 +560,12 @@ ProcRRDeleteOutputProperty (ClientPtr client)
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
- return (BadAtom);
+ return BadAtom;
}
RRDeleteOutputProperty(output, stuff->property);
- return client->noClientException;
+ return Success;
}
int
@@ -610,17 +588,17 @@ ProcRRGetOutputProperty (ClientPtr client)
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
- return(BadAtom);
+ return BadAtom;
}
if ((stuff->delete != xTrue) && (stuff->delete != xFalse))
{
client->errorValue = stuff->delete;
- return(BadValue);
+ return BadValue;
}
if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
{
client->errorValue = stuff->type;
- return(BadAtom);
+ return BadAtom;
}
for (prev = &output->properties; (prop = *prev); prev = &prop->next)
@@ -646,7 +624,7 @@ ProcRRGetOutputProperty (ClientPtr client)
swapl(&reply.nItems, n);
}
WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
- return(client->noClientException);
+ return Success;
}
if (prop->immutable && stuff->delete)
@@ -678,7 +656,7 @@ ProcRRGetOutputProperty (ClientPtr client)
swapl(&reply.nItems, n);
}
WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
- return(client->noClientException);
+ return Success;
}
/*
@@ -699,7 +677,7 @@ ProcRRGetOutputProperty (ClientPtr client)
len = min(n - ind, 4 * stuff->longLength);
if (len) {
- extra = xalloc(len);
+ extra = malloc(len);
if (!extra)
return BadAlloc;
}
@@ -745,7 +723,7 @@ ProcRRGetOutputProperty (ClientPtr client)
}
WriteSwappedDataToClient(client, len,
extra);
- xfree(extra);
+ free(extra);
}
if (stuff->delete && (reply.bytesAfter == 0))
@@ -753,6 +731,6 @@ ProcRRGetOutputProperty (ClientPtr client)
*prev = prop->next;
RRDestroyOutputProperty (prop);
}
- return(client->noClientException);
+ return Success;
}