diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-04-26 05:59:56 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-06-25 00:53:09 +0200 |
commit | a434613354ab42f78fad9e6f560eae0b8dc1308f (patch) | |
tree | bae0d4cb445c5a435ce652085e3d38b7d22d092f /nx-X11/programs | |
parent | c6f86b3b2f0862edb95a46c6955876efe10e20f9 (diff) | |
download | nx-libs-a434613354ab42f78fad9e6f560eae0b8dc1308f.tar.gz nx-libs-a434613354ab42f78fad9e6f560eae0b8dc1308f.tar.bz2 nx-libs-a434613354ab42f78fad9e6f560eae0b8dc1308f.zip |
hw/nxagent/NXproperty.c: Shrink file, drop duplicate code that can identically be found in dix/property.c.
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/dix/Imakefile | 4 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/dix/property.c | 5 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 325 |
3 files changed, 8 insertions, 326 deletions
diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile index 3e71898b6..48f0eeb1b 100644 --- a/nx-X11/programs/Xserver/dix/Imakefile +++ b/nx-X11/programs/Xserver/dix/Imakefile @@ -18,6 +18,7 @@ NXAGENT_SKIP_SRCS = \ events.c \ extension.c \ glyphcurs.c \ + property.c \ resource.c \ window.c \ $(NULL) @@ -25,6 +26,7 @@ NXAGENT_SKIP_OBJS = \ events.o \ extension.o \ glyphcurs.o \ + property.o \ resource.o \ window.o \ $(NULL) @@ -42,7 +44,6 @@ SRCS = \ globals.c \ grabs.c \ main.c \ - property.c \ region.c \ swaprep.c \ swapreq.c \ @@ -66,7 +67,6 @@ OBJS = \ globals.o \ grabs.o \ main.o \ - property.o \ region.o \ swaprep.o \ swapreq.o \ diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c index 6041595ce..b3b650dda 100644 --- a/nx-X11/programs/Xserver/dix/property.c +++ b/nx-X11/programs/Xserver/dix/property.c @@ -188,6 +188,7 @@ found: return Success; } +#ifndef NXAGENT_SERVER int ProcChangeProperty(ClientPtr client) { @@ -368,6 +369,7 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, } return(Success); } +#endif /* NXAGENT_SERVER */ int DeleteProperty(WindowPtr pWin, Atom propName) @@ -446,6 +448,8 @@ NullPropertyReply( return(client->noClientException); } +#ifndef NXAGENT_SERVER + /***************** * GetProperty * If type Any is specified, returns the property from the specified @@ -600,6 +604,7 @@ ProcGetProperty(ClientPtr client) } return(client->noClientException); } +#endif /* NXAGENT_SERVER */ int ProcListProperties(ClientPtr client) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index d6c5aa4dd..ab2edd51f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -64,42 +64,13 @@ SOFTWARE. ******************************************************************/ /* $Xorg: property.c,v 1.4 2001/02/09 02:04:40 xorgcvs Exp $ */ -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <nx-X11/X.h> -#define NEED_REPLIES -#define NEED_EVENTS -#include <nx-X11/Xproto.h> -#include "windowstr.h" -#include "propertyst.h" -#include "dixstruct.h" -#include "../../dix/dispatch.h" -#include "swaprep.h" -#ifdef XCSECURITY -#define _SECURITY_SERVER -#include <nx-X11/extensions/security.h> -#endif -#ifdef LBX -#include "lbxserve.h" -#include "lbxtags.h" -#endif +#include "../../dix/property.c" #include "Options.h" #include "Rootless.h" #include "Client.h" #include "Windows.h" -#if defined(LBX) || defined(LBX_COMPAT) -#if 0 /* no header in X11 environment, not used in X11 environment */ -int fWriteToClient(ClientPtr client, int len, char *buf) -{ - return WriteToClient(client, len, buf); -} -#endif -#endif - extern Atom clientCutProperty; #ifdef NXAGENT_SERVER @@ -111,129 +82,6 @@ typedef struct nxagentWMStateRec; #endif -/***************************************************************** - * Property Stuff - * - * ChangeProperty, DeleteProperty, GetProperties, - * ListProperties - * - * Properties below to windows. A allocate slots each time - * a property is added. No fancy searching done. - * - *****************************************************************/ - -#ifdef notdef -static void -PrintPropertys(WindowPtr pWin) -{ - PropertyPtr pProp; - register int j; - - pProp = pWin->userProps; - while (pProp) - { - ErrorF( "%x %x\n", pProp->propertyName, pProp->type); - ErrorF("property format: %d\n", pProp->format); - ErrorF("property data: \n"); - for (j=0; j<(pProp->format/8)*pProp->size; j++) - ErrorF("%c\n", pProp->data[j]); - pProp = pProp->next; - } -} -#endif - -int -ProcRotateProperties(ClientPtr client) -{ - int i, j, delta; - REQUEST(xRotatePropertiesReq); - WindowPtr pWin; - register Atom * atoms; - PropertyPtr * props; /* array of pointer */ - PropertyPtr pProp; - xEvent event; - - REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); - UpdateCurrentTime(); - pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); - if (!stuff->nAtoms) - return(Success); - atoms = (Atom *) & stuff[1]; - props = (PropertyPtr *)ALLOCATE_LOCAL(stuff->nAtoms * sizeof(PropertyPtr)); - if (!props) - return(BadAlloc); - for (i = 0; i < stuff->nAtoms; i++) - { -#ifdef XCSECURITY - char action = SecurityCheckPropertyAccess(client, pWin, atoms[i], - SecurityReadAccess|SecurityWriteAccess); -#endif - if (!ValidAtom(atoms[i]) -#ifdef XCSECURITY - || (SecurityErrorOperation == action) -#endif - ) - { - DEALLOCATE_LOCAL(props); - client->errorValue = atoms[i]; - return BadAtom; - } -#ifdef XCSECURITY - if (SecurityIgnoreOperation == action) - { - DEALLOCATE_LOCAL(props); - return Success; - } -#endif - for (j = i + 1; j < stuff->nAtoms; j++) - if (atoms[j] == atoms[i]) - { - DEALLOCATE_LOCAL(props); - return BadMatch; - } - pProp = wUserProps (pWin); - while (pProp) - { - if (pProp->propertyName == atoms[i]) - goto found; - pProp = pProp->next; - } - DEALLOCATE_LOCAL(props); - return BadMatch; -found: - props[i] = pProp; - } - delta = stuff->nPositions; - - /* If the rotation is a complete 360 degrees, then moving the properties - around and generating PropertyNotify events should be skipped. */ - - if ( (stuff->nAtoms != 0) && (abs(delta) % stuff->nAtoms) != 0 ) - { - while (delta < 0) /* faster if abs value is small */ - 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. */ - - 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]; - } - } - DEALLOCATE_LOCAL(props); - return Success; -} - int ProcChangeProperty(ClientPtr client) { @@ -476,91 +324,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format, #endif } -int -DeleteProperty(WindowPtr pWin, Atom propName) -{ - PropertyPtr pProp, prevProp; - xEvent event; - - if (!(pProp = wUserProps (pWin))) - return(Success); - prevProp = (PropertyPtr)NULL; - while (pProp) - { - if (pProp->propertyName == propName) - break; - prevProp = pProp; - pProp = pProp->next; - } - if (pProp) - { - if (prevProp == (PropertyPtr)NULL) /* takes care of head */ - { - if (!(pWin->optional->userProps = pProp->next)) - CheckWindowOptionalNeed (pWin); - } - else - { - prevProp->next = pProp->next; - } -#ifdef LBX - if (pProp->tag_id) - TagDeleteTag(pProp->tag_id); -#endif - 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); - xfree(pProp->data); - xfree(pProp); - } - return(Success); -} - -void -DeleteAllWindowProperties(WindowPtr pWin) -{ - PropertyPtr pProp, pNextProp; - xEvent event; - - pProp = wUserProps (pWin); - while (pProp) - { -#ifdef LBX - if (pProp->tag_id) - TagDeleteTag(pProp->tag_id); -#endif - 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); - pNextProp = pProp->next; - xfree(pProp->data); - xfree(pProp); - pProp = pNextProp; - } -} - -static int -NullPropertyReply( - ClientPtr client, - ATOM propertyType, - int format, - xGetPropertyReply *reply) -{ - reply->nItems = 0; - reply->length = 0; - reply->bytesAfter = 0; - reply->propertyType = propertyType; - reply->format = format; - WriteReplyToClient(client, sizeof(xGenericReply), reply); - return(client->noClientException); -} - /***************** * GetProperty * If type Any is specified, returns the property from the specified @@ -905,89 +668,3 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, return(Success); } #endif - -int -ProcListProperties(ClientPtr client) -{ - Atom *pAtoms = NULL, *temppAtoms; - xListPropertiesReply xlpr; - int numProps = 0; - WindowPtr pWin; - PropertyPtr pProp; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); - - pProp = wUserProps (pWin); - while (pProp) - { - pProp = pProp->next; - numProps++; - } - if (numProps) - if(!(pAtoms = (Atom *)ALLOCATE_LOCAL(numProps * sizeof(Atom)))) - return(BadAlloc); - - xlpr.type = X_Reply; - xlpr.nProperties = numProps; - xlpr.length = (numProps * sizeof(Atom)) >> 2; - xlpr.sequenceNumber = client->sequence; - pProp = wUserProps (pWin); - temppAtoms = pAtoms; - while (pProp) - { - *temppAtoms++ = pProp->propertyName; - pProp = pProp->next; - } - WriteReplyToClient(client, sizeof(xGenericReply), &xlpr); - if (numProps) - { - client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write; - WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms); - DEALLOCATE_LOCAL(pAtoms); - } - return(client->noClientException); -} - -int -ProcDeleteProperty(register ClientPtr client) -{ - WindowPtr pWin; - REQUEST(xDeletePropertyReq); - int result; - - REQUEST_SIZE_MATCH(xDeletePropertyReq); - UpdateCurrentTime(); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - SecurityWriteAccess); - if (!pWin) - return(BadWindow); - if (!ValidAtom(stuff->property)) - { - client->errorValue = stuff->property; - return (BadAtom); - } - -#ifdef XCSECURITY - switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, - SecurityDestroyAccess)) - { - case SecurityErrorOperation: - client->errorValue = stuff->property; - return BadAtom;; - case SecurityIgnoreOperation: - return Success; - } -#endif - - result = DeleteProperty(pWin, stuff->property); - if (client->noClientException != Success) - return(client->noClientException); - else - return(result); -} - |