aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/randr/rrxinerama.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/randr/rrxinerama.c')
-rw-r--r--xorg-server/randr/rrxinerama.c81
1 files changed, 52 insertions, 29 deletions
diff --git a/xorg-server/randr/rrxinerama.c b/xorg-server/randr/rrxinerama.c
index e6acd5e57..36135c6c1 100644
--- a/xorg-server/randr/rrxinerama.c
+++ b/xorg-server/randr/rrxinerama.c
@@ -260,6 +260,44 @@ ProcRRXineramaIsActive(ClientPtr client)
return client->noClientException;
}
+static void
+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) {
+ register int n;
+ swaps(&scratch.x_org, n);
+ swaps(&scratch.y_org, n);
+ swaps(&scratch.width, n);
+ swaps(&scratch.height, n);
+ }
+ WriteToClient(client, sz_XineramaScreenInfo, &scratch);
+ }
+}
+
int
ProcRRXineramaQueryScreens(ClientPtr client)
{
@@ -269,12 +307,8 @@ ProcRRXineramaQueryScreens(ClientPtr client)
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
if (RRXineramaScreenActive (pScreen))
- {
- rrScrPriv(pScreen);
- if (pScrPriv->numCrtcs == 0 || pScrPriv->numOutputs == 0)
- RRGetInfo (pScreen);
- }
-
+ RRGetInfo (pScreen, FALSE);
+
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.number = RRXineramaScreenCount (pScreen);
@@ -289,28 +323,22 @@ ProcRRXineramaQueryScreens(ClientPtr client)
if(rep.number) {
rrScrPriv(pScreen);
- xXineramaScreenInfo scratch;
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++) {
- RRCrtcPtr crtc = pScrPriv->crtcs[i];
- if (RRXineramaCrtcActive (crtc))
+ if (has_primary &&
+ pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
{
- 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) {
- register int n;
- swaps(&scratch.x_org, n);
- swaps(&scratch.y_org, n);
- swaps(&scratch.width, n);
- swaps(&scratch.height, n);
- }
- WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
+ has_primary = 0;
+ continue;
}
+ RRXineramaWriteCrtc(client, pScrPriv->crtcs[i]);
}
}
@@ -425,11 +453,6 @@ SProcRRXineramaDispatch(ClientPtr client)
return BadRequest;
}
-static void
-RRXineramaResetProc(ExtensionEntry* extEntry)
-{
-}
-
void
RRXineramaExtensionInit(void)
{
@@ -449,6 +472,6 @@ RRXineramaExtensionInit(void)
(void) AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
ProcRRXineramaDispatch,
SProcRRXineramaDispatch,
- RRXineramaResetProc,
+ NULL,
StandardMinorOpcode);
}