randr: Add [GS]etOutputPrimary
This commit is contained in:
parent
d281866b74
commit
9d58d2a319
|
@ -2,6 +2,7 @@
|
||||||
* Copyright © 2000 Compaq Computer Corporation
|
* Copyright © 2000 Compaq Computer Corporation
|
||||||
* Copyright © 2002 Hewlett-Packard Company
|
* Copyright © 2002 Hewlett-Packard Company
|
||||||
* Copyright © 2006 Intel Corporation
|
* Copyright © 2006 Intel Corporation
|
||||||
|
* Copyright © 2008 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
* documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
@ -272,6 +273,7 @@ typedef struct _rrScrPriv {
|
||||||
|
|
||||||
int numOutputs;
|
int numOutputs;
|
||||||
RROutputPtr *outputs;
|
RROutputPtr *outputs;
|
||||||
|
RROutputPtr primaryOutput;
|
||||||
|
|
||||||
int numCrtcs;
|
int numCrtcs;
|
||||||
RRCrtcPtr *crtcs;
|
RRCrtcPtr *crtcs;
|
||||||
|
@ -811,6 +813,12 @@ RROutputDestroy (RROutputPtr output);
|
||||||
extern _X_EXPORT int
|
extern _X_EXPORT int
|
||||||
ProcRRGetOutputInfo (ClientPtr client);
|
ProcRRGetOutputInfo (ClientPtr client);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
ProcRRSetOutputPrimary (ClientPtr client);
|
||||||
|
|
||||||
|
extern int
|
||||||
|
ProcRRGetOutputPrimary (ClientPtr client);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize output type
|
* Initialize output type
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -217,5 +217,7 @@ int (*ProcRandrVector[RRNumberRequests])(ClientPtr) = {
|
||||||
ProcRRGetCrtcTransform, /* 27 */
|
ProcRRGetCrtcTransform, /* 27 */
|
||||||
ProcRRGetPanning, /* 28 */
|
ProcRRGetPanning, /* 28 */
|
||||||
ProcRRSetPanning, /* 29 */
|
ProcRRSetPanning, /* 29 */
|
||||||
|
ProcRRSetOutputPrimary, /* 30 */
|
||||||
|
ProcRRGetOutputPrimary, /* 31 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
107
randr/rroutput.c
107
randr/rroutput.c
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2006 Keith Packard
|
* Copyright © 2006 Keith Packard
|
||||||
|
* Copyright © 2008 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
* documentation for any purpose is hereby granted without fee, provided that
|
||||||
|
@ -533,3 +534,109 @@ ProcRRGetOutputInfo (ClientPtr client)
|
||||||
|
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RRSetPrimaryOutput(ScreenPtr pScreen, rrScrPrivPtr pScrPriv,
|
||||||
|
RROutputPtr output)
|
||||||
|
{
|
||||||
|
if (pScrPriv->primaryOutput == output)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* clear the old primary */
|
||||||
|
if (pScrPriv->primaryOutput) {
|
||||||
|
RROutputChanged(pScrPriv->primaryOutput, 0);
|
||||||
|
pScrPriv->primaryOutput = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set the new primary */
|
||||||
|
if (output) {
|
||||||
|
pScrPriv->primaryOutput = output;
|
||||||
|
RROutputChanged(output, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pScrPriv->layoutChanged = TRUE;
|
||||||
|
|
||||||
|
RRTellChanged(pScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ProcRRSetOutputPrimary(ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(xRRSetOutputPrimaryReq);
|
||||||
|
RROutputPtr output = NULL;
|
||||||
|
WindowPtr pWin;
|
||||||
|
rrScrPrivPtr pScrPriv;
|
||||||
|
|
||||||
|
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
|
||||||
|
|
||||||
|
pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
|
||||||
|
DixReadAccess);
|
||||||
|
|
||||||
|
if (!pWin) {
|
||||||
|
client->errorValue = stuff->window;
|
||||||
|
return BadWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stuff->output) {
|
||||||
|
output = LookupOutput(client, stuff->output, DixReadAccess);
|
||||||
|
|
||||||
|
if (!output) {
|
||||||
|
client->errorValue = stuff->output;
|
||||||
|
return RRErrorBase + BadRROutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output->crtc) {
|
||||||
|
client->errorValue = stuff->output;
|
||||||
|
return BadMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output->pScreen != pWin->drawable.pScreen) {
|
||||||
|
client->errorValue = stuff->window;
|
||||||
|
return BadMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
|
||||||
|
RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
|
||||||
|
|
||||||
|
return client->noClientException;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ProcRRGetOutputPrimary(ClientPtr client)
|
||||||
|
{
|
||||||
|
REQUEST(xRRGetOutputPrimaryReq);
|
||||||
|
WindowPtr pWin;
|
||||||
|
rrScrPrivPtr pScrPriv;
|
||||||
|
xRRGetOutputPrimaryReply rep;
|
||||||
|
RROutputPtr primary = NULL;
|
||||||
|
|
||||||
|
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
|
||||||
|
|
||||||
|
pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
|
||||||
|
DixReadAccess);
|
||||||
|
|
||||||
|
if (!pWin) {
|
||||||
|
client->errorValue = stuff->window;
|
||||||
|
return BadWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
|
||||||
|
if (pScrPriv)
|
||||||
|
primary = pScrPriv->primaryOutput;
|
||||||
|
|
||||||
|
memset(&rep, 0, sizeof(rep));
|
||||||
|
rep.type = X_Reply;
|
||||||
|
rep.sequenceNumber = client->sequence;
|
||||||
|
rep.output = primary ? primary->id : None;
|
||||||
|
|
||||||
|
if (client->swapped) {
|
||||||
|
int n;
|
||||||
|
swaps(&rep.sequenceNumber, n);
|
||||||
|
swapl(&rep.output, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep);
|
||||||
|
|
||||||
|
return client->noClientException;
|
||||||
|
}
|
||||||
|
|
|
@ -436,6 +436,31 @@ SProcRRSetPanning (ClientPtr client)
|
||||||
return (*ProcRandrVector[stuff->randrReqType]) (client);
|
return (*ProcRandrVector[stuff->randrReqType]) (client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SProcRRSetOutputPrimary (ClientPtr client)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
REQUEST(xRRSetOutputPrimaryReq);
|
||||||
|
|
||||||
|
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
|
||||||
|
swaps(&stuff->length, n);
|
||||||
|
swapl(&stuff->window, n);
|
||||||
|
swapl(&stuff->output, n);
|
||||||
|
return ProcRandrVector[stuff->randrReqType](client);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SProcRRGetOutputPrimary (ClientPtr client)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
REQUEST(xRRSetOutputPrimaryReq);
|
||||||
|
|
||||||
|
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
|
||||||
|
swaps(&stuff->length, n);
|
||||||
|
swapl(&stuff->window, n);
|
||||||
|
return ProcRandrVector[stuff->randrReqType](client);
|
||||||
|
}
|
||||||
|
|
||||||
int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
|
int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
|
||||||
SProcRRQueryVersion, /* 0 */
|
SProcRRQueryVersion, /* 0 */
|
||||||
/* we skip 1 to make old clients fail pretty immediately */
|
/* we skip 1 to make old clients fail pretty immediately */
|
||||||
|
@ -472,5 +497,7 @@ int (*SProcRandrVector[RRNumberRequests])(ClientPtr) = {
|
||||||
SProcRRGetCrtcTransform, /* 27 */
|
SProcRRGetCrtcTransform, /* 27 */
|
||||||
SProcRRGetPanning, /* 28 */
|
SProcRRGetPanning, /* 28 */
|
||||||
SProcRRSetPanning, /* 29 */
|
SProcRRSetPanning, /* 29 */
|
||||||
|
SProcRRSetOutputPrimary, /* 30 */
|
||||||
|
SProcRRGetOutputPrimary, /* 31 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue