Partial redundancy elimination in PropertyNotify generation.
This commit is contained in:
		
							parent
							
								
									0f91abd5c6
								
							
						
					
					
						commit
						7da38bb6a1
					
				|  | @ -91,6 +91,19 @@ PrintPropertys(WindowPtr pWin) | ||||||
| } | } | ||||||
| #endif | #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 | int | ||||||
| ProcRotateProperties(ClientPtr client) | ProcRotateProperties(ClientPtr client) | ||||||
| { | { | ||||||
|  | @ -100,7 +113,6 @@ ProcRotateProperties(ClientPtr client) | ||||||
|     Atom * atoms; |     Atom * atoms; | ||||||
|     PropertyPtr * props;               /* array of pointer */ |     PropertyPtr * props;               /* array of pointer */ | ||||||
|     PropertyPtr pProp; |     PropertyPtr pProp; | ||||||
|     xEvent event; |  | ||||||
| 
 | 
 | ||||||
|     REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); |     REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); | ||||||
|     UpdateCurrentTime(); |     UpdateCurrentTime(); | ||||||
|  | @ -157,15 +169,8 @@ found: | ||||||
|             delta += stuff->nAtoms; |             delta += stuff->nAtoms; | ||||||
|     	for (i = 0; i < stuff->nAtoms; i++) |     	for (i = 0; i < stuff->nAtoms; i++) | ||||||
|  	{ |  	{ | ||||||
| 	    /* Generate a PropertyNotify event for each property whose value
 | 	    deliverPropertyNotifyEvent(pWin, PropertyNewValue, | ||||||
| 		is changed in the order in which they appear in the request. */ | 				       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]; |             props[i]->propertyName = atoms[(i + delta) % stuff->nAtoms]; | ||||||
| 	} | 	} | ||||||
|  | @ -243,7 +248,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, | ||||||
|                      Bool sendevent) |                      Bool sendevent) | ||||||
| { | { | ||||||
|     PropertyPtr pProp; |     PropertyPtr pProp; | ||||||
|     xEvent event; |  | ||||||
|     int sizeInBytes; |     int sizeInBytes; | ||||||
|     int totalSize; |     int totalSize; | ||||||
|     pointer data; |     pointer data; | ||||||
|  | @ -338,15 +342,10 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, | ||||||
|             pProp->size += len; |             pProp->size += len; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     if (sendevent) |     if (sendevent) | ||||||
|     { | 	deliverPropertyNotifyEvent(pWin, PropertyNewValue, pProp->propertyName); | ||||||
| 	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); |  | ||||||
|     } |  | ||||||
|     return(Success); |     return(Success); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -354,7 +353,6 @@ int | ||||||
| DeleteProperty(WindowPtr pWin, Atom propName) | DeleteProperty(WindowPtr pWin, Atom propName) | ||||||
| { | { | ||||||
|     PropertyPtr pProp, prevProp; |     PropertyPtr pProp, prevProp; | ||||||
|     xEvent event; |  | ||||||
| 
 | 
 | ||||||
|     if (!(pProp = wUserProps (pWin))) |     if (!(pProp = wUserProps (pWin))) | ||||||
| 	return(Success); | 	return(Success); | ||||||
|  | @ -377,12 +375,7 @@ DeleteProperty(WindowPtr pWin, Atom propName) | ||||||
|         { |         { | ||||||
|             prevProp->next = pProp->next; |             prevProp->next = pProp->next; | ||||||
|         } |         } | ||||||
| 	event.u.u.type = PropertyNotify; | 	deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); | ||||||
| 	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); |  | ||||||
| 	xfree(pProp->data); | 	xfree(pProp->data); | ||||||
|         xfree(pProp); |         xfree(pProp); | ||||||
|     } |     } | ||||||
|  | @ -393,17 +386,11 @@ void | ||||||
| DeleteAllWindowProperties(WindowPtr pWin) | DeleteAllWindowProperties(WindowPtr pWin) | ||||||
| { | { | ||||||
|     PropertyPtr pProp, pNextProp; |     PropertyPtr pProp, pNextProp; | ||||||
|     xEvent event; |  | ||||||
| 
 | 
 | ||||||
|     pProp = wUserProps (pWin); |     pProp = wUserProps (pWin); | ||||||
|     while (pProp) |     while (pProp) | ||||||
|     { |     { | ||||||
| 	event.u.u.type = PropertyNotify; | 	deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); | ||||||
| 	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); |  | ||||||
| 	pNextProp = pProp->next; | 	pNextProp = pProp->next; | ||||||
|         xfree(pProp->data); |         xfree(pProp->data); | ||||||
|         xfree(pProp); |         xfree(pProp); | ||||||
|  | @ -537,16 +524,7 @@ ProcGetProperty(ClientPtr client) | ||||||
|     reply.propertyType = pProp->type; |     reply.propertyType = pProp->type; | ||||||
| 
 | 
 | ||||||
|     if (stuff->delete && (reply.bytesAfter == 0)) |     if (stuff->delete && (reply.bytesAfter == 0)) | ||||||
|     { /* send the event */ | 	deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); | ||||||
| 	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); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     WriteReplyToClient(client, sizeof(xGenericReply), &reply); |     WriteReplyToClient(client, sizeof(xGenericReply), &reply); | ||||||
|     if (len) |     if (len) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue