From b943cfe2afbd593e814de47b2f13f8b3b1af78da Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 7 Jun 2016 10:14:50 +0200 Subject: Drop trailing whitespaces (randr extension) sed -i "s/[ ]\+$//g" randr/*.{c,h} happy reviewing... git diff -w is an empty diff. --- nx-X11/programs/Xserver/randr/rrdispatch.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nx-X11/programs/Xserver/randr/rrdispatch.c') diff --git a/nx-X11/programs/Xserver/randr/rrdispatch.c b/nx-X11/programs/Xserver/randr/rrdispatch.c index 4c6a5ff48..88970937e 100644 --- a/nx-X11/programs/Xserver/randr/rrdispatch.c +++ b/nx-X11/programs/Xserver/randr/rrdispatch.c @@ -90,13 +90,13 @@ ProcRRSelectInput (ClientPtr client) if (stuff->enable & (RRScreenChangeNotifyMask| RRCrtcChangeNotifyMask| - RROutputChangeNotifyMask)) + RROutputChangeNotifyMask)) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv (pScreen); pRREvent = NULL; - if (pHead) + if (pHead) { /* check for existing entry. */ for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) @@ -148,16 +148,16 @@ ProcRRSelectInput (ClientPtr client) if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask)) { pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum]; - if (CompareTimeStamps (pTimes->setTime, + if (CompareTimeStamps (pTimes->setTime, pScrPriv->lastSetTime) != 0 || - CompareTimeStamps (pTimes->configTime, + CompareTimeStamps (pTimes->configTime, pScrPriv->lastConfigTime) != 0) { RRDeliverScreenEvent (client, pWin, pScreen); } } } - else if (stuff->enable == 0) + else if (stuff->enable == 0) { /* delete the interest */ if (pHead) { @@ -177,7 +177,7 @@ ProcRRSelectInput (ClientPtr client) } } } - else + else { client->errorValue = stuff->enable; return BadValue; -- cgit v1.2.3 From e440ea768d004ca83993dfb5774daa7971d90c10 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 7 Jun 2016 10:26:58 +0200 Subject: randr extension: Convert to Xorg coding style. The reformatting has been achieved by applying x-indent.sh to all .c and .h files in Xserver/randr/. --- nx-X11/programs/Xserver/randr/rrdispatch.c | 267 ++++++++++++++--------------- 1 file changed, 130 insertions(+), 137 deletions(-) (limited to 'nx-X11/programs/Xserver/randr/rrdispatch.c') diff --git a/nx-X11/programs/Xserver/randr/rrdispatch.c b/nx-X11/programs/Xserver/randr/rrdispatch.c index 88970937e..a8fa6965f 100644 --- a/nx-X11/programs/Xserver/randr/rrdispatch.c +++ b/nx-X11/programs/Xserver/randr/rrdispatch.c @@ -26,19 +26,20 @@ #define SERVER_RANDR_MINOR 2 Bool -RRClientKnowsRates (ClientPtr pClient) +RRClientKnowsRates(ClientPtr pClient) { rrClientPriv(pClient); return (pRRClient->major_version > 1 || - (pRRClient->major_version == 1 && pRRClient->minor_version >= 1)); + (pRRClient->major_version == 1 && pRRClient->minor_version >= 1)); } static int -ProcRRQueryVersion (ClientPtr client) +ProcRRQueryVersion(ClientPtr client) { xRRQueryVersionReply rep; register int n; + REQUEST(xRRQueryVersionReq); rrClientPriv(client); @@ -55,165 +56,157 @@ ProcRRQueryVersion (ClientPtr client) rep.majorVersion = SERVER_RANDR_MAJOR; rep.minorVersion = SERVER_RANDR_MINOR; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.majorVersion, n); - swapl(&rep.minorVersion, n); + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.majorVersion, n); + swapl(&rep.minorVersion, n); } - WriteToClient(client, sizeof(xRRQueryVersionReply), (char *)&rep); + WriteToClient(client, sizeof(xRRQueryVersionReply), (char *) &rep); return (client->noClientException); } static int -ProcRRSelectInput (ClientPtr client) +ProcRRSelectInput(ClientPtr client) { REQUEST(xRRSelectInputReq); rrClientPriv(client); - RRTimesPtr pTimes; - WindowPtr pWin; - RREventPtr pRREvent, *pHead; - XID clientResource; - int rc; + RRTimesPtr pTimes; + WindowPtr pWin; + RREventPtr pRREvent, *pHead; + XID clientResource; + int rc; REQUEST_SIZE_MATCH(xRRSelectInputReq); - #ifndef NXAGENT_SERVER +#ifndef NXAGENT_SERVER rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); - #else +#else pWin = SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); rc = pWin ? Success : BadWindow; - #endif +#endif if (rc != Success) - return rc; - pHead = (RREventPtr *)SecurityLookupIDByType(client, - pWin->drawable.id, RREventType, - DixWriteAccess); + return rc; + pHead = (RREventPtr *) SecurityLookupIDByType(client, + pWin->drawable.id, + RREventType, DixWriteAccess); + + if (stuff->enable & (RRScreenChangeNotifyMask | + RRCrtcChangeNotifyMask | RROutputChangeNotifyMask)) { + ScreenPtr pScreen = pWin->drawable.pScreen; - if (stuff->enable & (RRScreenChangeNotifyMask| - RRCrtcChangeNotifyMask| - RROutputChangeNotifyMask)) - { - ScreenPtr pScreen = pWin->drawable.pScreen; - rrScrPriv (pScreen); + rrScrPriv(pScreen); - pRREvent = NULL; - if (pHead) - { - /* check for existing entry. */ - for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) - if (pRREvent->client == client) - break; - } + pRREvent = NULL; + if (pHead) { + /* check for existing entry. */ + for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) + if (pRREvent->client == client) + break; + } - if (!pRREvent) - { - /* build the entry */ - pRREvent = (RREventPtr) xalloc (sizeof (RREventRec)); - if (!pRREvent) - return BadAlloc; - pRREvent->next = 0; - pRREvent->client = client; - pRREvent->window = pWin; - pRREvent->mask = stuff->enable; - /* - * add a resource that will be deleted when - * the client goes away - */ - clientResource = FakeClientID (client->index); - pRREvent->clientResource = clientResource; - if (!AddResource (clientResource, RRClientType, (void *)pRREvent)) - return BadAlloc; - /* - * create a resource to contain a pointer to the list - * of clients selecting input. This must be indirect as - * the list may be arbitrarily rearranged which cannot be - * done through the resource database. - */ - if (!pHead) - { - pHead = (RREventPtr *) xalloc (sizeof (RREventPtr)); - if (!pHead || - !AddResource (pWin->drawable.id, RREventType, (void *)pHead)) - { - FreeResource (clientResource, RT_NONE); - return BadAlloc; - } - *pHead = 0; - } - pRREvent->next = *pHead; - *pHead = pRREvent; - } - /* - * Now see if the client needs an event - */ - if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask)) - { - pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum]; - if (CompareTimeStamps (pTimes->setTime, - pScrPriv->lastSetTime) != 0 || - CompareTimeStamps (pTimes->configTime, - pScrPriv->lastConfigTime) != 0) - { - RRDeliverScreenEvent (client, pWin, pScreen); - } - } + if (!pRREvent) { + /* build the entry */ + pRREvent = (RREventPtr) xalloc(sizeof(RREventRec)); + if (!pRREvent) + return BadAlloc; + pRREvent->next = 0; + pRREvent->client = client; + pRREvent->window = pWin; + pRREvent->mask = stuff->enable; + /* + * add a resource that will be deleted when + * the client goes away + */ + clientResource = FakeClientID(client->index); + pRREvent->clientResource = clientResource; + if (!AddResource(clientResource, RRClientType, (void *) pRREvent)) + return BadAlloc; + /* + * create a resource to contain a pointer to the list + * of clients selecting input. This must be indirect as + * the list may be arbitrarily rearranged which cannot be + * done through the resource database. + */ + if (!pHead) { + pHead = (RREventPtr *) xalloc(sizeof(RREventPtr)); + if (!pHead || + !AddResource(pWin->drawable.id, RREventType, + (void *) pHead)) { + FreeResource(clientResource, RT_NONE); + return BadAlloc; + } + *pHead = 0; + } + pRREvent->next = *pHead; + *pHead = pRREvent; + } + /* + * Now see if the client needs an event + */ + if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask)) { + pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum]; + if (CompareTimeStamps(pTimes->setTime, + pScrPriv->lastSetTime) != 0 || + CompareTimeStamps(pTimes->configTime, + pScrPriv->lastConfigTime) != 0) { + RRDeliverScreenEvent(client, pWin, pScreen); + } + } } - else if (stuff->enable == 0) - { - /* delete the interest */ - if (pHead) { - RREventPtr pNewRREvent = 0; - for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { - if (pRREvent->client == client) - break; - pNewRREvent = pRREvent; - } - if (pRREvent) { - FreeResource (pRREvent->clientResource, RRClientType); - if (pNewRREvent) - pNewRREvent->next = pRREvent->next; - else - *pHead = pRREvent->next; - xfree (pRREvent); - } - } + else if (stuff->enable == 0) { + /* delete the interest */ + if (pHead) { + RREventPtr pNewRREvent = 0; + + for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { + if (pRREvent->client == client) + break; + pNewRREvent = pRREvent; + } + if (pRREvent) { + FreeResource(pRREvent->clientResource, RRClientType); + if (pNewRREvent) + pNewRREvent->next = pRREvent->next; + else + *pHead = pRREvent->next; + xfree(pRREvent); + } + } } - else - { - client->errorValue = stuff->enable; - return BadValue; + else { + client->errorValue = stuff->enable; + return BadValue; } return Success; } -int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = { - ProcRRQueryVersion, /* 0 */ +int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = { + ProcRRQueryVersion, /* 0 */ /* we skip 1 to make old clients fail pretty immediately */ - NULL, /* 1 ProcRandrOldGetScreenInfo */ + NULL, /* 1 ProcRandrOldGetScreenInfo */ /* V1.0 apps share the same set screen config request id */ - ProcRRSetScreenConfig, /* 2 */ - NULL, /* 3 ProcRandrOldScreenChangeSelectInput */ + ProcRRSetScreenConfig, /* 2 */ + NULL, /* 3 ProcRandrOldScreenChangeSelectInput */ /* 3 used to be ScreenChangeSelectInput; deprecated */ - ProcRRSelectInput, /* 4 */ - ProcRRGetScreenInfo, /* 5 */ + ProcRRSelectInput, /* 4 */ + ProcRRGetScreenInfo, /* 5 */ /* V1.2 additions */ - ProcRRGetScreenSizeRange, /* 6 */ - ProcRRSetScreenSize, /* 7 */ - ProcRRGetScreenResources, /* 8 */ - ProcRRGetOutputInfo, /* 9 */ - ProcRRListOutputProperties, /* 10 */ - ProcRRQueryOutputProperty, /* 11 */ - ProcRRConfigureOutputProperty, /* 12 */ - ProcRRChangeOutputProperty, /* 13 */ - ProcRRDeleteOutputProperty, /* 14 */ - ProcRRGetOutputProperty, /* 15 */ - ProcRRCreateMode, /* 16 */ - ProcRRDestroyMode, /* 17 */ - ProcRRAddOutputMode, /* 18 */ - ProcRRDeleteOutputMode, /* 19 */ - ProcRRGetCrtcInfo, /* 20 */ - ProcRRSetCrtcConfig, /* 21 */ - ProcRRGetCrtcGammaSize, /* 22 */ - ProcRRGetCrtcGamma, /* 23 */ - ProcRRSetCrtcGamma, /* 24 */ + ProcRRGetScreenSizeRange, /* 6 */ + ProcRRSetScreenSize, /* 7 */ + ProcRRGetScreenResources, /* 8 */ + ProcRRGetOutputInfo, /* 9 */ + ProcRRListOutputProperties, /* 10 */ + ProcRRQueryOutputProperty, /* 11 */ + ProcRRConfigureOutputProperty, /* 12 */ + ProcRRChangeOutputProperty, /* 13 */ + ProcRRDeleteOutputProperty, /* 14 */ + ProcRRGetOutputProperty, /* 15 */ + ProcRRCreateMode, /* 16 */ + ProcRRDestroyMode, /* 17 */ + ProcRRAddOutputMode, /* 18 */ + ProcRRDeleteOutputMode, /* 19 */ + ProcRRGetCrtcInfo, /* 20 */ + ProcRRSetCrtcConfig, /* 21 */ + ProcRRGetCrtcGammaSize, /* 22 */ + ProcRRGetCrtcGamma, /* 23 */ + ProcRRSetCrtcGamma, /* 24 */ }; - -- cgit v1.2.3 From c2b1f489d7998c83af73c7cb25bbb2bc53f26094 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 20 Jun 2016 11:10:06 +0200 Subject: Backport RANDR proto version 1.5 to nx-X11's Xserver. Backported to X.org's /xorg/xserver Git hash level: a6b6e8ba026acedef6336b17adf06aebddd5f22f. --- nx-X11/programs/Xserver/randr/rrdispatch.c | 119 +++++++++++++++++++++++------ 1 file changed, 95 insertions(+), 24 deletions(-) (limited to 'nx-X11/programs/Xserver/randr/rrdispatch.c') diff --git a/nx-X11/programs/Xserver/randr/rrdispatch.c b/nx-X11/programs/Xserver/randr/rrdispatch.c index a8fa6965f..a8ca35d16 100644 --- a/nx-X11/programs/Xserver/randr/rrdispatch.c +++ b/nx-X11/programs/Xserver/randr/rrdispatch.c @@ -21,48 +21,62 @@ */ #include "randrstr.h" - -#define SERVER_RANDR_MAJOR 1 -#define SERVER_RANDR_MINOR 2 +#ifndef NXAGENT_SERVER +#include "protocol-versions.h" +#else +#define SERVER_RANDR_MAJOR_VERSION 1 +#define SERVER_RANDR_MINOR_VERSION 5 +#endif Bool RRClientKnowsRates(ClientPtr pClient) { rrClientPriv(pClient); - return (pRRClient->major_version > 1 || - (pRRClient->major_version == 1 && pRRClient->minor_version >= 1)); + return version_compare(pRRClient->major_version, pRRClient->minor_version, + 1, 1) >= 0; } static int ProcRRQueryVersion(ClientPtr client) { - xRRQueryVersionReply rep; - register int n; + int n; + xRRQueryVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; REQUEST(xRRQueryVersionReq); rrClientPriv(client); REQUEST_SIZE_MATCH(xRRQueryVersionReq); pRRClient->major_version = stuff->majorVersion; pRRClient->minor_version = stuff->minorVersion; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - /* - * Report the current version; the current - * spec says they're all compatible after 1.0 - */ - rep.majorVersion = SERVER_RANDR_MAJOR; - rep.minorVersion = SERVER_RANDR_MINOR; + + if (version_compare(stuff->majorVersion, stuff->minorVersion, + SERVER_RANDR_MAJOR_VERSION, + SERVER_RANDR_MINOR_VERSION) < 0) { + rep.majorVersion = stuff->majorVersion; + rep.minorVersion = stuff->minorVersion; + } + else { + rep.majorVersion = SERVER_RANDR_MAJOR_VERSION; + rep.minorVersion = SERVER_RANDR_MINOR_VERSION; + } + if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.majorVersion, n); swapl(&rep.minorVersion, n); } +#ifndef NXAGENT_SERVER + WriteToClient(client, sizeof(xRRQueryVersionReply), &rep); +#else WriteToClient(client, sizeof(xRRQueryVersionReply), (char *) &rep); - return (client->noClientException); +#endif + return Success; } static int @@ -78,19 +92,30 @@ ProcRRSelectInput(ClientPtr client) REQUEST_SIZE_MATCH(xRRSelectInputReq); #ifndef NXAGENT_SERVER - rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); #else pWin = SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); rc = pWin ? Success : BadWindow; #endif if (rc != Success) return rc; - pHead = (RREventPtr *) SecurityLookupIDByType(client, - pWin->drawable.id, - RREventType, DixWriteAccess); +#ifndef NXAGENT_SERVER + rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id, + RREventType, client, DixWriteAccess); +#else /* !defined(NXAGENT_SERVER) */ + pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType); +#endif /* !defined(NXAGENT_SERVER) */ + + if (rc != Success && rc != BadValue) + return rc; if (stuff->enable & (RRScreenChangeNotifyMask | - RRCrtcChangeNotifyMask | RROutputChangeNotifyMask)) { + RRCrtcChangeNotifyMask | + RROutputChangeNotifyMask | + RROutputPropertyNotifyMask | + RRProviderChangeNotifyMask | + RRProviderPropertyNotifyMask | + RRResourceChangeNotifyMask)) { ScreenPtr pScreen = pWin->drawable.pScreen; rrScrPriv(pScreen); @@ -142,13 +167,37 @@ ProcRRSelectInput(ClientPtr client) /* * Now see if the client needs an event */ - if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask)) { + if (pScrPriv) { pTimes = &((RRTimesPtr) (pRRClient + 1))[pScreen->myNum]; if (CompareTimeStamps(pTimes->setTime, pScrPriv->lastSetTime) != 0 || CompareTimeStamps(pTimes->configTime, pScrPriv->lastConfigTime) != 0) { - RRDeliverScreenEvent(client, pWin, pScreen); + if (pRREvent->mask & RRScreenChangeNotifyMask) { + RRDeliverScreenEvent(client, pWin, pScreen); + } + + if (pRREvent->mask & RRCrtcChangeNotifyMask) { + int i; + + for (i = 0; i < pScrPriv->numCrtcs; i++) { + RRDeliverCrtcEvent(client, pWin, pScrPriv->crtcs[i]); + } + } + + if (pRREvent->mask & RROutputChangeNotifyMask) { + int i; + + for (i = 0; i < pScrPriv->numOutputs; i++) { + RRDeliverOutputEvent(client, pWin, + pScrPriv->outputs[i]); + } + } + + /* We don't check for RROutputPropertyNotifyMask, as randrproto.txt doesn't + * say if there ought to be notifications of changes to output properties + * if those changes occurred before the time RRSelectInput is called. + */ } } } @@ -209,4 +258,26 @@ int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = { ProcRRGetCrtcGammaSize, /* 22 */ ProcRRGetCrtcGamma, /* 23 */ ProcRRSetCrtcGamma, /* 24 */ +/* V1.3 additions */ + ProcRRGetScreenResourcesCurrent, /* 25 */ + ProcRRSetCrtcTransform, /* 26 */ + ProcRRGetCrtcTransform, /* 27 */ + ProcRRGetPanning, /* 28 */ + ProcRRSetPanning, /* 29 */ + ProcRRSetOutputPrimary, /* 30 */ + ProcRRGetOutputPrimary, /* 31 */ +/* V1.4 additions */ + ProcRRGetProviders, /* 32 */ + ProcRRGetProviderInfo, /* 33 */ + ProcRRSetProviderOffloadSink, /* 34 */ + ProcRRSetProviderOutputSource, /* 35 */ + ProcRRListProviderProperties, /* 36 */ + ProcRRQueryProviderProperty, /* 37 */ + ProcRRConfigureProviderProperty, /* 38 */ + ProcRRChangeProviderProperty, /* 39 */ + ProcRRDeleteProviderProperty, /* 40 */ + ProcRRGetProviderProperty, /* 41 */ + ProcRRGetMonitors, /* 42 */ + ProcRRSetMonitor, /* 43 */ + ProcRRDeleteMonitor, /* 44 */ }; -- cgit v1.2.3