diff options
author | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
commit | 0f834b91a4768673833ab4917e87d86c237bb1a6 (patch) | |
tree | 363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/randr/rrxinerama.c | |
parent | fc72edebf875378459368c5383d9023730cbca54 (diff) | |
download | vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2 vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip |
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/randr/rrxinerama.c')
-rw-r--r-- | xorg-server/randr/rrxinerama.c | 311 |
1 files changed, 154 insertions, 157 deletions
diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c index 6d4519043..aa8a61eee 100644 --- a/xorg-server/randr/rrxinerama.c +++ b/xorg-server/randr/rrxinerama.c @@ -89,7 +89,7 @@ static int SProcRRXineramaDispatch(ClientPtr client); int ProcRRXineramaQueryVersion(ClientPtr client) { - xPanoramiXQueryVersionReply rep; + xPanoramiXQueryVersionReply rep; REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); rep.type = X_Reply; @@ -97,13 +97,13 @@ ProcRRXineramaQueryVersion(ClientPtr client) rep.sequenceNumber = client->sequence; rep.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION; rep.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION; - if(client->swapped) { + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *)&rep); + WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep); return Success; } @@ -111,24 +111,23 @@ int ProcRRXineramaGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); - WindowPtr pWin; - xPanoramiXGetStateReply rep; - register int rc; - ScreenPtr pScreen; - rrScrPrivPtr pScrPriv; - Bool active = FALSE; + WindowPtr pWin; + xPanoramiXGetStateReply rep; + register int rc; + ScreenPtr pScreen; + rrScrPrivPtr pScrPriv; + Bool active = FALSE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); - if(rc != Success) - return rc; + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); - if (pScrPriv) - { - /* XXX do we need more than this? */ - active = TRUE; + if (pScrPriv) { + /* XXX do we need more than this? */ + active = TRUE; } rep.type = X_Reply; @@ -136,67 +135,66 @@ ProcRRXineramaGetState(ClientPtr client) rep.sequenceNumber = client->sequence; rep.state = active; rep.window = stuff->window; - if(client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.window); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.window); } - WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep); + WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep); return Success; } static Bool -RRXineramaCrtcActive (RRCrtcPtr crtc) +RRXineramaCrtcActive(RRCrtcPtr crtc) { return crtc->mode != NULL && crtc->numOutputs > 0; } static int -RRXineramaScreenCount (ScreenPtr pScreen) +RRXineramaScreenCount(ScreenPtr pScreen) { - int i, n; - + int i, n; + n = 0; - if (rrGetScrPriv (pScreen)) - { - rrScrPriv(pScreen); - for (i = 0; i < pScrPriv->numCrtcs; i++) - if (RRXineramaCrtcActive (pScrPriv->crtcs[i])) - n++; + if (rrGetScrPriv(pScreen)) { + rrScrPriv(pScreen); + for (i = 0; i < pScrPriv->numCrtcs; i++) + if (RRXineramaCrtcActive(pScrPriv->crtcs[i])) + n++; } return n; } static Bool -RRXineramaScreenActive (ScreenPtr pScreen) +RRXineramaScreenActive(ScreenPtr pScreen) { - return RRXineramaScreenCount (pScreen) > 0; + return RRXineramaScreenCount(pScreen) > 0; } int ProcRRXineramaGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); - WindowPtr pWin; - xPanoramiXGetScreenCountReply rep; - register int rc; + WindowPtr pWin; + xPanoramiXGetScreenCountReply rep; + register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) - return rc; - + return rc; + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.ScreenCount = RRXineramaScreenCount (pWin->drawable.pScreen); + rep.ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen); rep.window = stuff->window; - if(client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.window); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.window); } - WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep); + WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep); return Success; } @@ -204,42 +202,42 @@ int ProcRRXineramaGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); - WindowPtr pWin, pRoot; - ScreenPtr pScreen; - xPanoramiXGetScreenSizeReply rep; - register int rc; + WindowPtr pWin, pRoot; + ScreenPtr pScreen; + xPanoramiXGetScreenSizeReply rep; + register int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) - return rc; + return rc; pScreen = pWin->drawable.pScreen; pRoot = pScreen->root; - + rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.width = pRoot->drawable.width; + rep.width = pRoot->drawable.width; rep.height = pRoot->drawable.height; rep.window = stuff->window; rep.screen = stuff->screen; - if(client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.width); - swapl(&rep.height); - swapl(&rep.window); - swapl(&rep.screen); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.width); + swapl(&rep.height); + swapl(&rep.window); + swapl(&rep.screen); } - WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep); + WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep); return Success; } int ProcRRXineramaIsActive(ClientPtr client) { - xXineramaIsActiveReply rep; + xXineramaIsActiveReply rep; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); @@ -247,11 +245,11 @@ ProcRRXineramaIsActive(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.state = RRXineramaScreenActive (screenInfo.screens[RR_XINERAMA_SCREEN]); - if(client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.state); + rep.state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.state); } WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep); return Success; @@ -262,79 +260,80 @@ RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc) { xXineramaScreenInfo scratch; - if (RRXineramaCrtcActive (crtc)) - { - ScreenPtr pScreen = crtc->pScreen; - rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); - BoxRec panned_area; - - /* Check to see if crtc is panned and return the full area when applicable. */ - if (pScrPriv && pScrPriv->rrGetPanning && - pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) && - (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) { - scratch.x_org = panned_area.x1; - scratch.y_org = panned_area.y1; - scratch.width = panned_area.x2 - panned_area.x1; - scratch.height = panned_area.y2 - panned_area.y1; - } else { - int width, height; - RRCrtcGetScanoutSize (crtc, &width, &height); - scratch.x_org = crtc->x; - scratch.y_org = crtc->y; - scratch.width = width; - scratch.height = height; - } - if(client->swapped) { - swaps(&scratch.x_org); - swaps(&scratch.y_org); - swaps(&scratch.width); - swaps(&scratch.height); - } - WriteToClient(client, sz_XineramaScreenInfo, &scratch); + if (RRXineramaCrtcActive(crtc)) { + ScreenPtr pScreen = crtc->pScreen; + rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); + BoxRec panned_area; + + /* Check to see if crtc is panned and return the full area when applicable. */ + if (pScrPriv && pScrPriv->rrGetPanning && + pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && + (panned_area.x2 > panned_area.x1) && + (panned_area.y2 > panned_area.y1)) { + scratch.x_org = panned_area.x1; + scratch.y_org = panned_area.y1; + scratch.width = panned_area.x2 - panned_area.x1; + scratch.height = panned_area.y2 - panned_area.y1; + } + else { + int width, height; + + RRCrtcGetScanoutSize(crtc, &width, &height); + scratch.x_org = crtc->x; + scratch.y_org = crtc->y; + scratch.width = width; + scratch.height = height; + } + if (client->swapped) { + swaps(&scratch.x_org); + swaps(&scratch.y_org); + swaps(&scratch.width); + swaps(&scratch.height); + } + WriteToClient(client, sz_XineramaScreenInfo, &scratch); } } int ProcRRXineramaQueryScreens(ClientPtr client) { - xXineramaQueryScreensReply rep; - ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; + xXineramaQueryScreensReply rep; + ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); - if (RRXineramaScreenActive (pScreen)) - RRGetInfo (pScreen, FALSE); + if (RRXineramaScreenActive(pScreen)) + RRGetInfo(pScreen, FALSE); rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.number = RRXineramaScreenCount (pScreen); + rep.number = RRXineramaScreenCount(pScreen); rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo); - if(client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.number); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.number); } - WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *)&rep); - - if(rep.number) { - rrScrPriv(pScreen); - int i; - int has_primary = 0; - - if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { - has_primary = 1; - RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc); - } - - for(i = 0; i < pScrPriv->numCrtcs; i++) { - if (has_primary && - pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) - { - has_primary = 0; - continue; - } - RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]); - } + WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep); + + if (rep.number) { + rrScrPriv(pScreen); + int i; + int has_primary = 0; + + if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { + has_primary = 1; + RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc); + } + + for (i = 0; i < pScrPriv->numCrtcs; i++) { + if (has_primary && + pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) { + has_primary = 0; + continue; + } + RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]); + } } return Success; @@ -345,18 +344,18 @@ ProcRRXineramaDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { - case X_PanoramiXQueryVersion: - return ProcRRXineramaQueryVersion(client); - case X_PanoramiXGetState: - return ProcRRXineramaGetState(client); - case X_PanoramiXGetScreenCount: - return ProcRRXineramaGetScreenCount(client); - case X_PanoramiXGetScreenSize: - return ProcRRXineramaGetScreenSize(client); - case X_XineramaIsActive: - return ProcRRXineramaIsActive(client); - case X_XineramaQueryScreens: - return ProcRRXineramaQueryScreens(client); + case X_PanoramiXQueryVersion: + return ProcRRXineramaQueryVersion(client); + case X_PanoramiXGetState: + return ProcRRXineramaGetState(client); + case X_PanoramiXGetScreenCount: + return ProcRRXineramaGetScreenCount(client); + case X_PanoramiXGetScreenSize: + return ProcRRXineramaGetScreenSize(client); + case X_XineramaIsActive: + return ProcRRXineramaIsActive(client); + case X_XineramaQueryScreens: + return ProcRRXineramaQueryScreens(client); } return BadRequest; } @@ -364,11 +363,11 @@ ProcRRXineramaDispatch(ClientPtr client) /* SProc */ static int -SProcRRXineramaQueryVersion (ClientPtr client) +SProcRRXineramaQueryVersion(ClientPtr client) { REQUEST(xPanoramiXQueryVersionReq); swaps(&stuff->length); - REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); + REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); return ProcRRXineramaQueryVersion(client); } @@ -426,18 +425,18 @@ SProcRRXineramaDispatch(ClientPtr client) { REQUEST(xReq); switch (stuff->data) { - case X_PanoramiXQueryVersion: - return SProcRRXineramaQueryVersion(client); - case X_PanoramiXGetState: - return SProcRRXineramaGetState(client); - case X_PanoramiXGetScreenCount: - return SProcRRXineramaGetScreenCount(client); - case X_PanoramiXGetScreenSize: - return SProcRRXineramaGetScreenSize(client); - case X_XineramaIsActive: - return SProcRRXineramaIsActive(client); - case X_XineramaQueryScreens: - return SProcRRXineramaQueryScreens(client); + case X_PanoramiXQueryVersion: + return SProcRRXineramaQueryVersion(client); + case X_PanoramiXGetState: + return SProcRRXineramaGetState(client); + case X_PanoramiXGetScreenCount: + return SProcRRXineramaGetScreenCount(client); + case X_PanoramiXGetScreenSize: + return SProcRRXineramaGetScreenSize(client); + case X_XineramaIsActive: + return SProcRRXineramaIsActive(client); + case X_XineramaQueryScreens: + return SProcRRXineramaQueryScreens(client); } return BadRequest; } @@ -446,8 +445,8 @@ void RRXineramaExtensionInit(void) { #ifdef PANORAMIX - if(!noPanoramiXExtension) - return; + if (!noPanoramiXExtension) + return; #endif /* @@ -456,11 +455,9 @@ RRXineramaExtensionInit(void) * screen, just don't even try. */ if (screenInfo.numScreens > 1) - return; + return; - (void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0, - ProcRRXineramaDispatch, - SProcRRXineramaDispatch, - NULL, - StandardMinorOpcode); + (void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0, + ProcRRXineramaDispatch, + SProcRRXineramaDispatch, NULL, StandardMinorOpcode); } |