Commit e440ea76 authored by Mike Gabriel's avatar Mike Gabriel

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/.
parent 7f7c96c7
......@@ -67,13 +67,13 @@ typedef struct {
#define sz_xPanoramiXQueryVersionReply 32
typedef struct _PanoramiXGetState {
CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length B16;
CARD32 window B32;
} xPanoramiXGetStateReq;
#define sz_xPanoramiXGetStateReq 8
typedef struct {
......@@ -97,6 +97,7 @@ typedef struct _PanoramiXGetScreenCount {
CARD16 length B16;
CARD32 window B32;
} xPanoramiXGetScreenCountReq;
#define sz_xPanoramiXGetScreenCountReq 8
typedef struct {
......@@ -111,6 +112,7 @@ typedef struct {
CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */
} xPanoramiXGetScreenCountReply;
#define sz_panoramiXGetScreenCountReply 32
typedef struct _PanoramiXGetScreenSize {
......@@ -120,6 +122,7 @@ typedef struct _PanoramiXGetScreenSize {
CARD32 window B32;
CARD32 screen B32;
} xPanoramiXGetScreenSizeReq;
#define sz_xPanoramiXGetScreenSizeReq 12
typedef struct {
......@@ -134,6 +137,7 @@ typedef struct {
CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */
} xPanoramiXGetScreenSizeReply;
#define sz_panoramiXGetScreenSizeReply 32
/************ Alternate protocol ******************/
......@@ -143,6 +147,7 @@ typedef struct {
CARD8 panoramiXReqType;
CARD16 length B16;
} xXineramaIsActiveReq;
#define sz_xXineramaIsActiveReq 4
typedef struct {
......@@ -157,14 +162,15 @@ typedef struct {
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXineramaIsActiveReply;
#define sz_XineramaIsActiveReply 32
#define sz_XineramaIsActiveReply 32
typedef struct {
CARD8 reqType;
CARD8 panoramiXReqType;
CARD16 length B16;
} xXineramaQueryScreensReq;
#define sz_xXineramaQueryScreensReq 4
typedef struct {
......@@ -179,6 +185,7 @@ typedef struct {
CARD32 pad5 B32;
CARD32 pad6 B32;
} xXineramaQueryScreensReply;
#define sz_XineramaQueryScreensReply 32
typedef struct {
......@@ -187,6 +194,7 @@ typedef struct {
CARD16 width B16;
CARD16 height B16;
} xXineramaScreenInfo;
#define sz_XineramaScreenInfo 8
#endif
......@@ -63,6 +63,7 @@ typedef struct {
CARD16 widthInMillimeters B16;
CARD16 heightInMillimeters B16;
} xScreenSizes;
#define sz_xScreenSizes 8
/*
......@@ -76,6 +77,7 @@ typedef struct {
CARD32 majorVersion B32;
CARD32 minorVersion B32;
} xRRQueryVersionReq;
#define sz_xRRQueryVersionReq 12
typedef struct {
......@@ -90,6 +92,7 @@ typedef struct {
CARD32 pad4 B32;
CARD32 pad5 B32;
} xRRQueryVersionReply;
#define sz_xRRQueryVersionReply 32
typedef struct {
......@@ -98,6 +101,7 @@ typedef struct {
CARD16 length B16;
Window window B32;
} xRRGetScreenInfoReq;
#define sz_xRRGetScreenInfoReq 8
/*
......@@ -106,7 +110,6 @@ typedef struct {
* the size information
*/
typedef struct {
BYTE type; /* X_Reply */
BYTE setOfRotations;
......@@ -122,6 +125,7 @@ typedef struct {
CARD16 nrateEnts B16;
CARD16 pad B16;
} xRRGetScreenInfoReply;
#define sz_xRRGetScreenInfoReply 32
typedef struct {
......@@ -134,6 +138,7 @@ typedef struct {
SizeID sizeID B16;
Rotation rotation B16;
} xRR1_0SetScreenConfigReq;
#define sz_xRR1_0SetScreenConfigReq 20
typedef struct {
......@@ -148,6 +153,7 @@ typedef struct {
CARD16 rate B16;
CARD16 pad B16;
} xRRSetScreenConfigReq;
#define sz_xRRSetScreenConfigReq 24
typedef struct {
......@@ -163,6 +169,7 @@ typedef struct {
CARD32 pad5 B32;
CARD32 pad6 B32;
} xRRSetScreenConfigReply;
#define sz_xRRSetScreenConfigReply 32
typedef struct {
......@@ -173,6 +180,7 @@ typedef struct {
CARD16 enable B16;
CARD16 pad2 B16;
} xRRSelectInputReq;
#define sz_xRRSelectInputReq 12
/*
......@@ -194,6 +202,7 @@ typedef struct _xRRModeInfo {
CARD16 nameLength B16;
RRModeFlags modeFlags B32;
} xRRModeInfo;
#define sz_xRRModeInfo 32
typedef struct {
......@@ -202,6 +211,7 @@ typedef struct {
CARD16 length B16;
Window window B32;
} xRRGetScreenSizeRangeReq;
#define sz_xRRGetScreenSizeRangeReq 8
typedef struct {
......@@ -218,6 +228,7 @@ typedef struct {
CARD32 pad2 B32;
CARD32 pad3 B32;
} xRRGetScreenSizeRangeReply;
#define sz_xRRGetScreenSizeRangeReply 32
typedef struct {
......@@ -230,6 +241,7 @@ typedef struct {
CARD32 widthInMillimeters B32;
CARD32 heightInMillimeters B32;
} xRRSetScreenSizeReq;
#define sz_xRRSetScreenSizeReq 20
typedef struct {
......@@ -238,6 +250,7 @@ typedef struct {
CARD16 length B16;
Window window B32;
} xRRGetScreenResourcesReq;
#define sz_xRRGetScreenResourcesReq 8
typedef struct {
......@@ -254,6 +267,7 @@ typedef struct {
CARD32 pad1 B32;
CARD32 pad2 B32;
} xRRGetScreenResourcesReply;
#define sz_xRRGetScreenResourcesReply 32
typedef struct {
......@@ -263,6 +277,7 @@ typedef struct {
RROutput output B32;
Time configTimestamp B32;
} xRRGetOutputInfoReq;
#define sz_xRRGetOutputInfoReq 12
typedef struct {
......@@ -282,6 +297,7 @@ typedef struct {
CARD16 nClones B16;
CARD16 nameLength B16;
} xRRGetOutputInfoReply;
#define sz_xRRGetOutputInfoReply 36
typedef struct {
......@@ -290,6 +306,7 @@ typedef struct {
CARD16 length B16;
RROutput output B32;
} xRRListOutputPropertiesReq;
#define sz_xRRListOutputPropertiesReq 8
typedef struct {
......@@ -305,6 +322,7 @@ typedef struct {
CARD32 pad5 B32;
CARD32 pad6 B32;
} xRRListOutputPropertiesReply;
#define sz_xRRListOutputPropertiesReply 32
typedef struct {
......@@ -314,6 +332,7 @@ typedef struct {
RROutput output B32;
Atom property B32;
} xRRQueryOutputPropertyReq;
#define sz_xRRQueryOutputPropertyReq 12
typedef struct {
......@@ -331,6 +350,7 @@ typedef struct {
CARD32 pad5 B32;
CARD32 pad6 B32;
} xRRQueryOutputPropertyReply;
#define sz_xRRQueryOutputPropertyReply 32
typedef struct {
......@@ -343,6 +363,7 @@ typedef struct {
BOOL range;
CARD16 pad B16;
} xRRConfigureOutputPropertyReq;
#define sz_xRRConfigureOutputPropertyReq 16
typedef struct {
......@@ -357,6 +378,7 @@ typedef struct {
CARD16 pad;
CARD32 nUnits B32;
} xRRChangeOutputPropertyReq;
#define sz_xRRChangeOutputPropertyReq 24
typedef struct {
......@@ -366,6 +388,7 @@ typedef struct {
RROutput output B32;
Atom property B32;
} xRRDeleteOutputPropertyReq;
#define sz_xRRDeleteOutputPropertyReq 12
typedef struct {
......@@ -385,6 +408,7 @@ typedef struct {
BOOL pending;
CARD16 pad1 B16;
} xRRGetOutputPropertyReq;
#define sz_xRRGetOutputPropertyReq 28
typedef struct {
......@@ -399,6 +423,7 @@ typedef struct {
CARD32 pad2 B32;
CARD32 pad3 B32;
} xRRGetOutputPropertyReply;
#define sz_xRRGetOutputPropertyReply 32
typedef struct {
......@@ -408,6 +433,7 @@ typedef struct {
Window window B32;
xRRModeInfo modeInfo;
} xRRCreateModeReq;
#define sz_xRRCreateModeReq 40
typedef struct {
......@@ -422,6 +448,7 @@ typedef struct {
CARD32 pad4 B32;
CARD32 pad5 B32;
} xRRCreateModeReply;
#define sz_xRRCreateModeReply 32
typedef struct {
......@@ -430,6 +457,7 @@ typedef struct {
CARD16 length B16;
RRMode mode B32;
} xRRDestroyModeReq;
#define sz_xRRDestroyModeReq 8
typedef struct {
......@@ -439,6 +467,7 @@ typedef struct {
RROutput output B32;
RRMode mode B32;
} xRRAddOutputModeReq;
#define sz_xRRAddOutputModeReq 12
typedef struct {
......@@ -448,6 +477,7 @@ typedef struct {
RROutput output B32;
RRMode mode B32;
} xRRDeleteOutputModeReq;
#define sz_xRRDeleteOutputModeReq 12
typedef struct {
......@@ -457,6 +487,7 @@ typedef struct {
RRCrtc crtc B32;
Time configTimestamp B32;
} xRRGetCrtcInfoReq;
#define sz_xRRGetCrtcInfoReq 12
typedef struct {
......@@ -475,6 +506,7 @@ typedef struct {
CARD16 nOutput B16;
CARD16 nPossibleOutput B16;
} xRRGetCrtcInfoReply;
#define sz_xRRGetCrtcInfoReply 32
typedef struct {
......@@ -490,6 +522,7 @@ typedef struct {
Rotation rotation B16;
CARD16 pad B16;
} xRRSetCrtcConfigReq;
#define sz_xRRSetCrtcConfigReq 28
typedef struct {
......@@ -504,6 +537,7 @@ typedef struct {
CARD32 pad4 B32;
CARD32 pad5 B32;
} xRRSetCrtcConfigReply;
#define sz_xRRSetCrtcConfigReply 32
typedef struct {
......@@ -512,6 +546,7 @@ typedef struct {
CARD16 length B16;
RRCrtc crtc B32;
} xRRGetCrtcGammaSizeReq;
#define sz_xRRGetCrtcGammaSizeReq 8
typedef struct {
......@@ -527,6 +562,7 @@ typedef struct {
CARD32 pad5 B32;
CARD32 pad6 B32;
} xRRGetCrtcGammaSizeReply;
#define sz_xRRGetCrtcGammaSizeReply 32
typedef struct {
......@@ -535,6 +571,7 @@ typedef struct {
CARD16 length B16;
RRCrtc crtc B32;
} xRRGetCrtcGammaReq;
#define sz_xRRGetCrtcGammaReq 8
typedef struct {
......@@ -550,6 +587,7 @@ typedef struct {
CARD32 pad5 B32;
CARD32 pad6 B32;
} xRRGetCrtcGammaReply;
#define sz_xRRGetCrtcGammaReply 32
typedef struct {
......@@ -560,6 +598,7 @@ typedef struct {
CARD16 size B16;
CARD16 pad1 B16;
} xRRSetCrtcGammaReq;
#define sz_xRRSetCrtcGammaReq 12
/*
......@@ -580,6 +619,7 @@ typedef struct {
CARD16 widthInMillimeters B16;
CARD16 heightInMillimeters B16;
} xRRScreenChangeNotifyEvent;
#define sz_xRRScreenChangeNotifyEvent 32
typedef struct {
......@@ -597,6 +637,7 @@ typedef struct {
CARD16 width B16; /* new size */
CARD16 height B16;
} xRRCrtcChangeNotifyEvent;
#define sz_xRRCrtcChangeNotifyEvent 32
typedef struct {
......@@ -613,6 +654,7 @@ typedef struct {
CARD8 connection; /* connection status */
CARD8 subpixelOrder; /* subpixel order */
} xRROutputChangeNotifyEvent;
#define sz_xRROutputChangeNotifyEvent 32
typedef struct {
......@@ -629,6 +671,7 @@ typedef struct {
CARD32 pad3 B32;
CARD32 pad4 B32;
} xRROutputPropertyNotifyEvent;
#define sz_xRROutputPropertyNotifyEvent 32
#undef RRModeFlags
......
......@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* not be a stack variable.
*/
void RegisterResourceName(RESTYPE type, char *name);
void RegisterExtensionNames(ExtensionEntry *ext);
void RegisterExtensionNames(ExtensionEntry * ext);
/*
* Lookup functions. The returned string must not be modified or freed.
......
......@@ -26,7 +26,7 @@
#define SERVER_RANDR_MINOR 2
Bool
RRClientKnowsRates (ClientPtr pClient)
RRClientKnowsRates(ClientPtr pClient)
{
rrClientPriv(pClient);
......@@ -35,10 +35,11 @@ RRClientKnowsRates (ClientPtr pClient)
}
static int
ProcRRQueryVersion (ClientPtr client)
ProcRRQueryVersion(ClientPtr client)
{
xRRQueryVersionReply rep;
register int n;
REQUEST(xRRQueryVersionReq);
rrClientPriv(client);
......@@ -60,12 +61,12 @@ ProcRRQueryVersion (ClientPtr client)
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);
......@@ -76,38 +77,35 @@ ProcRRSelectInput (ClientPtr client)
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);
pHead = (RREventPtr *) SecurityLookupIDByType(client,
pWin->drawable.id,
RREventType, DixWriteAccess);
if (stuff->enable & (RRScreenChangeNotifyMask|
RRCrtcChangeNotifyMask|
RROutputChangeNotifyMask))
{
if (stuff->enable & (RRScreenChangeNotifyMask |
RRCrtcChangeNotifyMask | RROutputChangeNotifyMask)) {
ScreenPtr pScreen = pWin->drawable.pScreen;
rrScrPriv (pScreen);
rrScrPriv(pScreen);
pRREvent = NULL;
if (pHead)
{
if (pHead) {
/* check for existing entry. */
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
if (pRREvent->client == client)
break;
}
if (!pRREvent)
{
if (!pRREvent) {
/* build the entry */
pRREvent = (RREventPtr) xalloc (sizeof (RREventRec));
pRREvent = (RREventPtr) xalloc(sizeof(RREventRec));
if (!pRREvent)
return BadAlloc;
pRREvent->next = 0;
......@@ -118,9 +116,9 @@ ProcRRSelectInput (ClientPtr client)
* add a resource that will be deleted when
* the client goes away
*/
clientResource = FakeClientID (client->index);
clientResource = FakeClientID(client->index);
pRREvent->clientResource = clientResource;
if (!AddResource (clientResource, RRClientType, (void *)pRREvent))
if (!AddResource(clientResource, RRClientType, (void *) pRREvent))
return BadAlloc;
/*
* create a resource to contain a pointer to the list
......@@ -128,13 +126,12 @@ ProcRRSelectInput (ClientPtr client)
* the list may be arbitrarily rearranged which cannot be
* done through the resource database.
*/
if (!pHead)
{
pHead = (RREventPtr *) xalloc (sizeof (RREventPtr));
if (!pHead) {
pHead = (RREventPtr *) xalloc(sizeof(RREventPtr));
if (!pHead ||
!AddResource (pWin->drawable.id, RREventType, (void *)pHead))
{
FreeResource (clientResource, RT_NONE);
!AddResource(pWin->drawable.id, RREventType,
(void *) pHead)) {
FreeResource(clientResource, RT_NONE);
return BadAlloc;
}
*pHead = 0;
......@@ -145,47 +142,44 @@ ProcRRSelectInput (ClientPtr client)
/*
* Now see if the client needs an event
*/
if (pScrPriv && (pRREvent->mask & RRScreenChangeNotifyMask))
{
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,
pScrPriv->lastConfigTime) != 0)
{
RRDeliverScreenEvent (client, pWin, pScreen);
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) {
RREventPtr pNewRREvent = 0;
for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) {
if (pRREvent->client == client)
break;
pNewRREvent = pRREvent;
}
if (pRREvent) {
FreeResource (pRREvent->clientResource, RRClientType);
FreeResource(pRREvent->clientResource, RRClientType);
if (pNewRREvent)
pNewRREvent->next = pRREvent->next;
else
*pHead = pRREvent->next;
xfree (pRREvent);
xfree(pRREvent);
}
}
}
else
{
else {
client->errorValue = stuff->enable;
return BadValue;
}
return Success;
}
int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = {
ProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
NULL, /* 1 ProcRandrOldGetScreenInfo */
......@@ -216,4 +210,3 @@ int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
ProcRRGetCrtcGamma, /* 23 */
ProcRRSetCrtcGamma, /* 24 */
};
......@@ -24,9 +24,10 @@
#ifdef RANDR_10_INTERFACE
static RRModePtr
RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh)
{
ScreenPtr pScreen = output->pScreen;
rrScrPriv(pScreen);
xRRModeInfo modeInfo;
char name[100];
......@@ -34,8 +35,8 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
int i;
RRModePtr *modes;
memset (&modeInfo, '\0', sizeof (modeInfo));
sprintf (name, "%dx%d", size->width, size->height);
memset(&modeInfo, '\0', sizeof(modeInfo));
sprintf(name, "%dx%d", size->width, size->height);
modeInfo.width = size->width;
modeInfo.height = size->height;
......@@ -43,26 +44,24 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
modeInfo.vTotal = size->height;
modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height *
(CARD32) refresh);
modeInfo.nameLength = strlen (name);
mode = RRModeGet (&modeInfo, name);
modeInfo.nameLength = strlen(name);
mode = RRModeGet(&modeInfo, name);
if (!mode)
return NULL;
for (i = 0; i < output->numModes; i++)
if (output->modes[i] == mode)
{
RRModeDestroy (mode);
if (output->modes[i] == mode) {
RRModeDestroy(mode);
return mode;
}
if (output->numModes)
modes = xrealloc (output->modes,
(output->numModes + 1) * sizeof (RRModePtr));
modes = xrealloc(output->modes,
(output->numModes + 1) * sizeof(RRModePtr));
else
modes = xalloc (sizeof (RRModePtr));
if (!modes)
{
RRModeDestroy (mode);
FreeResource (mode->mode.id, 0);
modes = xalloc(sizeof(RRModePtr));
if (!modes) {
RRModeDestroy(mode);
FreeResource(mode->mode.id, 0);
return NULL;
}
modes[output->numModes++] = mode;
......@@ -74,7 +73,7 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
}
static void
RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
RRScanOldConfig(ScreenPtr pScreen, Rotation rotations)
{
rrScrPriv(pScreen);
RROutputPtr output;
......@@ -89,19 +88,17 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
* First time through, create a crtc and output and hook
* them together
*/
if (pScrPriv->numOutputs == 0 &&
pScrPriv->numCrtcs == 0)
{
crtc = RRCrtcCreate (pScreen, NULL);
if (pScrPriv->numOutputs == 0 && pScrPriv->numCrtcs == 0) {
crtc = RRCrtcCreate(pScreen, NULL);
if (!crtc)
return;
output = RROutputCreate (pScreen, "default", 7, NULL);
output = RROutputCreate(pScreen, "default", 7, NULL);
if (!output)
return;
RROutputSetCrtcs (output, &crtc, 1);
RROutputSetConnection (output, RR_Connected);
RROutputSetCrtcs(output, &crtc, 1);
RROutputSetConnection(output, RR_Connected);
#ifdef RENDER
RROutputSetSubpixelOrder (output, PictureGetSubpixelOrder (pScreen));
RROutputSetSubpixelOrder(output, PictureGetSubpixelOrder(pScreen));
#endif
}
......@@ -113,65 +110,60 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
return;
/* check rotations */
if (rotations != crtc->rotations)
{
if (rotations != crtc->rotations) {
crtc->rotations = rotations;
crtc->changed = TRUE;
pScrPriv->changed = TRUE;
}
/* regenerate mode list */
for (i = 0; i < pScrPriv->nSizes; i++)
{
for (i = 0; i < pScrPriv->nSizes; i++) {
RRScreenSizePtr size = &pScrPriv->pSizes[i];
int r;
if (size->nRates)
{
for (r = 0; r < size->nRates; r++)
{
mode = RROldModeAdd (output, size, size->pRates[r].rate);
if (size->nRates) {
for (r = 0; r < size->nRates; r++) {
mode = RROldModeAdd(output, size, size->pRates[r].rate);
if (i == pScrPriv->size &&
size->pRates[r].rate == pScrPriv->rate)
{
size->pRates[r].rate == pScrPriv->rate) {
newMode = mode;
}
}
xfree (size->pRates);
xfree(size->pRates);
}
else
{
mode = RROldModeAdd (output, size, 0);
else {
mode = RROldModeAdd(output, size, 0);
if (i == pScrPriv->size)
newMode = mode;
}
}
if (pScrPriv->nSizes)
xfree (pScrPriv->pSizes);
xfree(pScrPriv->pSizes);
pScrPriv->pSizes = NULL;
pScrPriv->nSizes = 0;
/* find size bounds */
for (i = 0; i < output->numModes + output->numUserModes; i++)
{
for (i = 0; i < output->numModes + output->numUserModes; i++) {
mode = (i < output->numModes ?
output->modes[i] :
output->userModes[i-output->numModes]);
output->modes[i] : output->userModes[i - output->numModes]);
width = mode->mode.width;
height = mode->mode.height;
if (width < minWidth) minWidth = width;
if (width > maxWidth) maxWidth = width;
if (height < minHeight) minHeight = height;
if (height > maxHeight) maxHeight = height;
if (width < minWidth)
minWidth = width;
if (width > maxWidth)
maxWidth = width;
if (height < minHeight)
minHeight = height;
if (height > maxHeight)
maxHeight = height;
}
RRScreenSetSizeRange (pScreen, minWidth, minHeight, maxWidth, maxHeight);
RRScreenSetSizeRange(pScreen, minWidth, minHeight, maxWidth, maxHeight);
/* notice current mode */
if (newMode)
RRCrtcNotify (crtc, newMode, 0, 0, pScrPriv->rotation,
1, &output);
RRCrtcNotify(crtc, newMode, 0, 0, pScrPriv->rotation, 1, &output);
}
#endif
......@@ -179,9 +171,9 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
* Poll the driver for changed information
*/
Bool
RRGetInfo (ScreenPtr pScreen)
RRGetInfo(ScreenPtr pScreen)
{
rrScrPriv (pScreen);
rrScrPriv(pScreen);
Rotation rotations;
int i;
......@@ -199,9 +191,9 @@ RRGetInfo (ScreenPtr pScreen)
#if RANDR_10_INTERFACE
if (pScrPriv->nSizes)
RRScanOldConfig (pScreen, rotations);
RRScanOldConfig(pScreen, rotations);
#endif
RRTellChanged (pScreen);
RRTellChanged(pScreen);
return TRUE;
}
......@@ -209,19 +201,16 @@ RRGetInfo (ScreenPtr pScreen)
* Register the range of sizes for the screen
*/
void
RRScreenSetSizeRange (ScreenPtr pScreen,
RRScreenSetSizeRange(ScreenPtr pScreen,
CARD16 minWidth,
CARD16 minHeight,
CARD16 maxWidth,
CARD16 maxHeight)
CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight)
{
rrScrPriv (pScreen);
rrScrPriv(pScreen);
if (!pScrPriv)
return;
if (pScrPriv->minWidth == minWidth && pScrPriv->minHeight == minHeight &&
pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight)
{
pScrPriv->maxWidth == maxWidth && pScrPriv->maxHeight == maxHeight) {
return;
}
......@@ -235,8 +224,7 @@ RRScreenSetSizeRange (ScreenPtr pScreen,
#ifdef RANDR_10_INTERFACE
static Bool
RRScreenSizeMatches (RRScreenSizePtr a,
RRScreenSizePtr b)
RRScreenSizeMatches(RRScreenSizePtr a, RRScreenSizePtr b)
{
if (a->width != b->width)
return FALSE;
......@@ -250,13 +238,10 @@ RRScreenSizeMatches (RRScreenSizePtr a,
}
RRScreenSizePtr
RRRegisterSize (ScreenPtr pScreen,
short width,
short height,
short mmWidth,
short mmHeight)
RRRegisterSize(ScreenPtr pScreen,
short width, short height, short mmWidth, short mmHeight)
{
rrScrPriv (pScreen);
rrScrPriv(pScreen);
int i;
RRScreenSize tmp;
RRScreenSizePtr pNew;
......@@ -266,26 +251,25 @@ RRRegisterSize (ScreenPtr pScreen,
tmp.id = 0;
tmp.width = width;
tmp.height= height;
tmp.height = height;
tmp.mmWidth = mmWidth;
tmp.mmHeight = mmHeight;
tmp.pRates = 0;
tmp.nRates = 0;
for (i = 0; i < pScrPriv->nSizes; i++)
if (RRScreenSizeMatches (&tmp, &pScrPriv->pSizes[i]))
if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i]))
return &pScrPriv->pSizes[i];
pNew = xrealloc (pScrPriv->pSizes,
(pScrPriv->nSizes + 1) * sizeof (RRScreenSize));
pNew = xrealloc(pScrPriv->pSizes,
(pScrPriv->nSizes + 1) * sizeof(RRScreenSize));
if (!pNew)
return 0;
pNew[pScrPriv->nSizes++] = tmp;
pScrPriv->pSizes = pNew;
return &pNew[pScrPriv->nSizes-1];
return &pNew[pScrPriv->nSizes - 1];
}
Bool RRRegisterRate (ScreenPtr pScreen,
RRScreenSizePtr pSize,
int rate)
Bool
RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate)
{
rrScrPriv(pScreen);
int i;
......@@ -298,8 +282,7 @@ Bool RRRegisterRate (ScreenPtr pScreen,
if (pSize->pRates[i].rate == rate)
return TRUE;
pNew = xrealloc (pSize->pRates,
(pSize->nRates + 1) * sizeof (RRScreenRate));
pNew = xrealloc(pSize->pRates, (pSize->nRates + 1) * sizeof(RRScreenRate));
if (!pNew)
return FALSE;
pRate = &pNew[pSize->nRates++];
......@@ -311,7 +294,7 @@ Bool RRRegisterRate (ScreenPtr pScreen,
Rotation
RRGetRotation(ScreenPtr pScreen)
{
RROutputPtr output = RRFirstOutput (pScreen);
RROutputPtr output = RRFirstOutput(pScreen);
if (!output)
return RR_Rotate_0;
......@@ -320,12 +303,10 @@ RRGetRotation(ScreenPtr pScreen)
}
void
RRSetCurrentConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize)
RRSetCurrentConfig(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize)
{
rrScrPriv (pScreen);
rrScrPriv(pScreen);
if (!pScrPriv)
return;
......
......@@ -31,7 +31,7 @@
*/
static Bool
RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
RRCrtcContainsPosition(RRCrtcPtr crtc, int x, int y)
{
RRModePtr mode = crtc->mode;
int scan_width, scan_height;
......@@ -39,7 +39,7 @@ RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
if (!mode)
return FALSE;
RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height);
if (crtc->x <= x && x < crtc->x + scan_width &&
crtc->y <= y && y < crtc->y + scan_height)
......@@ -51,16 +51,15 @@ RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
* Find the CRTC nearest the specified position, ignoring 'skip'
*/
static void
RRPointerToNearestCrtc (ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
RRPointerToNearestCrtc(ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
{
rrScrPriv (pScreen);
rrScrPriv(pScreen);
int c;
RRCrtcPtr nearest = NULL;
int best = 0;
int best_dx = 0, best_dy = 0;
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
for (c = 0; c < pScrPriv->numCrtcs; c++) {
RRCrtcPtr crtc = pScrPriv->crtcs[c];
RRModePtr mode = crtc->mode;
int dx, dy;
......@@ -72,7 +71,7 @@ RRPointerToNearestCrtc (ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
if (crtc == skip)
continue;
RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height);
if (x < crtc->x)
dx = crtc->x - x;
......@@ -87,8 +86,7 @@ RRPointerToNearestCrtc (ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
else
dy = 0;
dist = dx + dy;
if (!nearest || dist < best)
{
if (!nearest || dist < best) {
nearest = crtc;
best_dx = dx;
best_dy = dy;
......@@ -100,23 +98,21 @@ RRPointerToNearestCrtc (ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
}
void
RRPointerMoved (ScreenPtr pScreen, int x, int y)
RRPointerMoved(ScreenPtr pScreen, int x, int y)
{
rrScrPriv (pScreen);
rrScrPriv(pScreen);
RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;
int c;
/* Check last known CRTC */
if (pointerCrtc && RRCrtcContainsPosition (pointerCrtc, x, y))
if (pointerCrtc && RRCrtcContainsPosition(pointerCrtc, x, y))
return;
/* Check all CRTCs */
for (c = 0; c < pScrPriv->numCrtcs; c++)
{
for (c = 0; c < pScrPriv->numCrtcs; c++) {
RRCrtcPtr crtc = pScrPriv->crtcs[c];
if (RRCrtcContainsPosition (crtc, x, y))
{
if (RRCrtcContainsPosition(crtc, x, y)) {
/* Remember containing CRTC */
pScrPriv->pointerCrtc = crtc;
return;
......@@ -124,7 +120,7 @@ RRPointerMoved (ScreenPtr pScreen, int x, int y)
}
/* None contain pointer, find nearest */
RRPointerToNearestCrtc (pScreen, x, y, pointerCrtc);
RRPointerToNearestCrtc(pScreen, x, y, pointerCrtc);
}
/*
......@@ -132,14 +128,14 @@ RRPointerMoved (ScreenPtr pScreen, int x, int y)
* CRTC
*/
void
RRPointerScreenConfigured (ScreenPtr pScreen)
RRPointerScreenConfigured(ScreenPtr pScreen)
{
WindowPtr pRoot = GetCurrentRootWindow ();
WindowPtr pRoot = GetCurrentRootWindow();
ScreenPtr pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL;
int x, y;
if (pScreen != pCurrentScreen)
return;
GetSpritePosition (&x, &y);
RRPointerToNearestCrtc (pScreen, x, y, NULL);
GetSpritePosition(&x, &y);
RRPointerToNearestCrtc(pScreen, x, y, NULL);
}
......@@ -23,9 +23,10 @@
#include "randrstr.h"
static int
SProcRRQueryVersion (ClientPtr client)
SProcRRQueryVersion(ClientPtr client)
{
register int n;
REQUEST(xRRQueryVersionReq);
REQUEST_SIZE_MATCH(xRRQueryVersionReq);
......@@ -36,9 +37,10 @@ SProcRRQueryVersion (ClientPtr client)
}
static int
SProcRRGetScreenInfo (ClientPtr client)
SProcRRGetScreenInfo(ClientPtr client)
{
register int n;
REQUEST(xRRGetScreenInfoReq);
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
......@@ -48,19 +50,18 @@ SProcRRGetScreenInfo (ClientPtr client)
}
static int
SProcRRSetScreenConfig (ClientPtr client)
SProcRRSetScreenConfig(ClientPtr client)
{
register int n;
REQUEST(xRRSetScreenConfigReq);
if (RRClientKnowsRates (client))
{
REQUEST_SIZE_MATCH (xRRSetScreenConfigReq);
swaps (&stuff->rate, n);
if (RRClientKnowsRates(client)) {
REQUEST_SIZE_MATCH(xRRSetScreenConfigReq);
swaps(&stuff->rate, n);
}
else
{
REQUEST_SIZE_MATCH (xRR1_0SetScreenConfigReq);
else {
REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq);
}
swaps(&stuff->length, n);
......@@ -72,9 +73,10 @@ SProcRRSetScreenConfig (ClientPtr client)
}
static int
SProcRRSelectInput (ClientPtr client)
SProcRRSelectInput(ClientPtr client)
{
register int n;
REQUEST(xRRSelectInputReq);
REQUEST_SIZE_MATCH(xRRSelectInputReq);
......@@ -85,9 +87,10 @@ SProcRRSelectInput (ClientPtr client)
}
static int
SProcRRGetScreenSizeRange (ClientPtr client)
SProcRRGetScreenSizeRange(ClientPtr client)
{
int n;
REQUEST(xRRGetScreenSizeRangeReq);
REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
......@@ -97,9 +100,10 @@ SProcRRGetScreenSizeRange (ClientPtr client)
}
static int
SProcRRSetScreenSize (ClientPtr client)
SProcRRSetScreenSize(ClientPtr client)
{
int n;
REQUEST(xRRSetScreenSizeReq);
REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
......@@ -113,9 +117,10 @@ SProcRRSetScreenSize (ClientPtr client)
}
static int
SProcRRGetScreenResources (ClientPtr client)
SProcRRGetScreenResources(ClientPtr client)
{
int n;
REQUEST(xRRGetScreenResourcesReq);
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
......@@ -125,9 +130,10 @@ SProcRRGetScreenResources (ClientPtr client)
}
static int
SProcRRGetOutputInfo (ClientPtr client)
SProcRRGetOutputInfo(ClientPtr client)
{
int n;
REQUEST(xRRGetOutputInfoReq);;
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
......@@ -138,9 +144,10 @@ SProcRRGetOutputInfo (ClientPtr client)
}
static int
SProcRRListOutputProperties (ClientPtr client)
SProcRRListOutputProperties(ClientPtr client)
{
int n;
REQUEST(xRRListOutputPropertiesReq);
REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
......@@ -150,9 +157,10 @@ SProcRRListOutputProperties (ClientPtr client)
}
static int
SProcRRQueryOutputProperty (ClientPtr client)
SProcRRQueryOutputProperty(ClientPtr client)
{
int n;
REQUEST(xRRQueryOutputPropertyReq);
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
......@@ -163,9 +171,10 @@ SProcRRQueryOutputProperty (ClientPtr client)
}
static int
SProcRRConfigureOutputProperty (ClientPtr client)
SProcRRConfigureOutputProperty(ClientPtr client)
{
int n;
REQUEST(xRRConfigureOutputPropertyReq);
swaps(&stuff->length, n);
......@@ -176,18 +185,19 @@ SProcRRConfigureOutputProperty (ClientPtr client)
}
static int
SProcRRChangeOutputProperty (ClientPtr client)
SProcRRChangeOutputProperty(ClientPtr client)
{
int n;
REQUEST(xRRChangeOutputPropertyReq);
REQUEST_AT_LEAST_SIZE (xRRChangeOutputPropertyReq);
REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq);
swaps(&stuff->length, n);
swapl(&stuff->output, n);
swapl(&stuff->property, n);
swapl(&stuff->type, n);
swapl(&stuff->nUnits, n);
switch(stuff->format) {
switch (stuff->format) {
case 8:
break;
case 16:
......@@ -204,9 +214,10 @@ SProcRRChangeOutputProperty (ClientPtr client)
}
static int
SProcRRDeleteOutputProperty (ClientPtr client)
SProcRRDeleteOutputProperty(ClientPtr client)
{
int n;
REQUEST(xRRDeleteOutputPropertyReq);
REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
......@@ -217,9 +228,10 @@ SProcRRDeleteOutputProperty (ClientPtr client)
}
static int
SProcRRGetOutputProperty (ClientPtr client)
SProcRRGetOutputProperty(ClientPtr client)
{
int n;
REQUEST(xRRGetOutputPropertyReq);
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
......@@ -233,10 +245,11 @@ SProcRRGetOutputProperty (ClientPtr client)
}
static int
SProcRRCreateMode (ClientPtr client)
SProcRRCreateMode(ClientPtr client)
{
int n;
xRRModeInfo *modeinfo;
REQUEST(xRRCreateModeReq);
REQUEST_AT_LEAST_SIZE(xRRCreateModeReq);
......@@ -260,9 +273,10 @@ SProcRRCreateMode (ClientPtr client)
}
static int
SProcRRDestroyMode (ClientPtr client)
SProcRRDestroyMode(ClientPtr client)
{
int n;
REQUEST(xRRDestroyModeReq);
REQUEST_SIZE_MATCH(xRRDestroyModeReq);
......@@ -272,9 +286,10 @@ SProcRRDestroyMode (ClientPtr client)
}
static int
SProcRRAddOutputMode (ClientPtr client)
SProcRRAddOutputMode(ClientPtr client)
{
int n;
REQUEST(xRRAddOutputModeReq);
REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
......@@ -285,9 +300,10 @@ SProcRRAddOutputMode (ClientPtr client)
}
static int
SProcRRDeleteOutputMode (ClientPtr client)
SProcRRDeleteOutputMode(ClientPtr client)
{
int n;
REQUEST(xRRDeleteOutputModeReq);
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
......@@ -298,9 +314,10 @@ SProcRRDeleteOutputMode (ClientPtr client)
}
static int
SProcRRGetCrtcInfo (ClientPtr client)
SProcRRGetCrtcInfo(ClientPtr client)
{
int n;
REQUEST(xRRGetCrtcInfoReq);
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
......@@ -311,9 +328,10 @@ SProcRRGetCrtcInfo (ClientPtr client)
}
static int
SProcRRSetCrtcConfig (ClientPtr client)
SProcRRSetCrtcConfig(ClientPtr client)
{
int n;
REQUEST(xRRSetCrtcConfigReq);
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
......@@ -330,9 +348,10 @@ SProcRRSetCrtcConfig (ClientPtr client)
}
static int
SProcRRGetCrtcGammaSize (ClientPtr client)
SProcRRGetCrtcGammaSize(ClientPtr client)
{
int n;
REQUEST(xRRGetCrtcGammaSizeReq);
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
......@@ -342,9 +361,10 @@ SProcRRGetCrtcGammaSize (ClientPtr client)
}
static int
SProcRRGetCrtcGamma (ClientPtr client)
SProcRRGetCrtcGamma(ClientPtr client)
{
int n;
REQUEST(xRRGetCrtcGammaReq);
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
......@@ -354,9 +374,10 @@ SProcRRGetCrtcGamma (ClientPtr client)
}
static int
SProcRRSetCrtcGamma (ClientPtr client)
SProcRRSetCrtcGamma(ClientPtr client)
{
int n;
REQUEST(xRRSetCrtcGammaReq);
REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
......@@ -367,7 +388,7 @@ SProcRRSetCrtcGamma (ClientPtr client)
return (*ProcRandrVector[stuff->randrReqType]) (client);
}
int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
SProcRRQueryVersion, /* 0 */
/* we skip 1 to make old clients fail pretty immediately */
NULL, /* 1 SProcRandrOldGetScreenInfo */
......@@ -382,11 +403,11 @@ int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
SProcRRSetScreenSize, /* 7 */
SProcRRGetScreenResources, /* 8 */
SProcRRGetOutputInfo, /* 9 */
SProcRRListOutputProperties,/* 10 */
SProcRRListOutputProperties, /* 10 */
SProcRRQueryOutputProperty, /* 11 */
SProcRRConfigureOutputProperty, /* 12 */
SProcRRChangeOutputProperty,/* 13 */
SProcRRDeleteOutputProperty,/* 14 */
SProcRRChangeOutputProperty, /* 13 */
SProcRRDeleteOutputProperty, /* 14 */
SProcRRGetOutputProperty, /* 15 */
SProcRRCreateMode, /* 16 */
SProcRRDestroyMode, /* 17 */
......@@ -398,4 +419,3 @@ int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
SProcRRGetCrtcGamma, /* 23 */
SProcRRSetCrtcGamma, /* 24 */
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment