Move physical size from mode to output.
Modes can be shared across different sized monitors this way. Also caught some missing byteswapping and an incorrect return type.
This commit is contained in:
parent
e21604914d
commit
4056e6e79a
|
@ -111,8 +111,6 @@ miRandRInit (ScreenPtr pScreen)
|
|||
memset (&modeInfo, '\0', sizeof (modeInfo));
|
||||
modeInfo.width = pScreen->width;
|
||||
modeInfo.height = pScreen->height;
|
||||
modeInfo.mmWidth = pScreen->mmWidth;
|
||||
modeInfo.mmHeight = pScreen->mmHeight;
|
||||
modeInfo.nameLength = strlen (name);
|
||||
|
||||
mode = RRModeGet (pScreen, &modeInfo, name);
|
||||
|
|
|
@ -107,6 +107,8 @@ struct _rrOutput {
|
|||
int nameLength;
|
||||
CARD8 connection;
|
||||
CARD8 subpixelOrder;
|
||||
int mmWidth;
|
||||
int mmHeight;
|
||||
RRCrtcPtr crtc;
|
||||
CARD32 currentOptions;
|
||||
CARD32 possibleOptions;
|
||||
|
@ -642,6 +644,11 @@ Bool
|
|||
RROutputSetCurrentOptions (RROutputPtr output,
|
||||
CARD32 currentOptions);
|
||||
|
||||
Bool
|
||||
RROutputSetPhysicalSize (RROutputPtr output,
|
||||
int mmWidth,
|
||||
int mmHeight);
|
||||
|
||||
void
|
||||
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
|
||||
|
||||
|
|
|
@ -270,8 +270,16 @@ RRCrtcSet (RRCrtcPtr crtc,
|
|||
|
||||
size.width = mode->mode.width;
|
||||
size.height = mode->mode.height;
|
||||
size.mmWidth = mode->mode.mmWidth;
|
||||
size.mmHeight = mode->mode.mmHeight;
|
||||
if (outputs[0].output->mmWidth && outputs[0].output->mmHeight)
|
||||
{
|
||||
size.mmWidth = outputs[0].output->mmWidth;
|
||||
size.mmHeight = outputs[0].output->mmHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
size.mmWidth = pScreen->mmWidth;
|
||||
size.mmHeight = pScreen->mmHeight;
|
||||
}
|
||||
size.nRates = 1;
|
||||
rate.rate = RRVerticalRefresh (&mode->mode);
|
||||
size.pRates = &rate;
|
||||
|
|
|
@ -39,8 +39,6 @@ RROldModeAdd (RROutputPtr output, RRScreenSizePtr size, int refresh)
|
|||
|
||||
modeInfo.width = size->width;
|
||||
modeInfo.height = size->height;
|
||||
modeInfo.mmWidth = size->mmWidth;
|
||||
modeInfo.mmHeight = size->mmHeight;
|
||||
modeInfo.hTotal = size->width;
|
||||
modeInfo.vTotal = size->height;
|
||||
modeInfo.dotClock = ((CARD32) size->width * (CARD32) size->height *
|
||||
|
|
|
@ -29,8 +29,6 @@ RRModeEqual (xRRModeInfo *a, xRRModeInfo *b)
|
|||
{
|
||||
if (a->width != b->width) return FALSE;
|
||||
if (a->height != b->height) return FALSE;
|
||||
if (a->mmWidth != b->mmWidth) return FALSE;
|
||||
if (a->mmHeight != b->mmHeight) return FALSE;
|
||||
if (a->dotClock != b->dotClock) return FALSE;
|
||||
if (a->hSyncStart != b->hSyncStart) return FALSE;
|
||||
if (a->hSyncEnd != b->hSyncEnd) return FALSE;
|
||||
|
|
|
@ -72,6 +72,8 @@ RROutputCreate (ScreenPtr pScreen,
|
|||
output->name[nameLength] = '\0';
|
||||
output->connection = RR_UnknownConnection;
|
||||
output->subpixelOrder = SubPixelUnknown;
|
||||
output->mmWidth = 0;
|
||||
output->mmHeight = 0;
|
||||
output->crtc = NULL;
|
||||
output->currentOptions = 0;
|
||||
output->possibleOptions = 0;
|
||||
|
@ -262,6 +264,20 @@ RROutputSetCurrentOptions (RROutputPtr output,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
RROutputSetPhysicalSize (RROutputPtr output,
|
||||
int mmWidth,
|
||||
int mmHeight)
|
||||
{
|
||||
if (output->mmWidth == mmWidth && output->mmHeight == mmHeight)
|
||||
return TRUE;
|
||||
output->mmWidth = mmWidth;
|
||||
output->mmHeight = mmHeight;
|
||||
RROutputChanged (output);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
|
||||
{
|
||||
|
@ -381,6 +397,8 @@ ProcRRGetOutputInfo (ClientPtr client)
|
|||
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
|
||||
rep.crtc = output->crtc ? output->crtc->id : None;
|
||||
rep.currentOptions = output->currentOptions;
|
||||
rep.mmWidth = output->mmWidth;
|
||||
rep.mmHeight = output->mmHeight;
|
||||
rep.connection = output->connection;
|
||||
rep.subpixelOrder = output->subpixelOrder;
|
||||
rep.nCrtcs = output->numCrtcs;
|
||||
|
@ -434,10 +452,15 @@ ProcRRGetOutputInfo (ClientPtr client)
|
|||
swapl(&rep.length, n);
|
||||
swapl(&rep.timestamp, n);
|
||||
swapl(&rep.crtc, n);
|
||||
swapl(&rep.currentOptions, n);
|
||||
swapl(&rep.mmWidth, n);
|
||||
swapl(&rep.mmHeight, n);
|
||||
swaps(&rep.nCrtcs, n);
|
||||
swaps(&rep.nModes, n);
|
||||
swaps(&rep.nClones, n);
|
||||
swapl(&rep.possibleOptions, n);
|
||||
swaps(&rep.nameLength, n);
|
||||
swapl(&rep.possibleOptions, n);
|
||||
}
|
||||
WriteToClient(client, sizeof(xRRGetOutputInfoReply), (char *)&rep);
|
||||
if (extraLen)
|
||||
|
|
|
@ -131,7 +131,7 @@ RRPointerScreenConfigured (ScreenPtr pScreen)
|
|||
int x, y;
|
||||
|
||||
if (pScreen != pCurrentScreen)
|
||||
return FALSE;
|
||||
return;
|
||||
GetSpritePosition (&x, &y);
|
||||
RRPointerToNearestCrtc (pScreen, x, y, NULL);
|
||||
}
|
||||
|
|
|
@ -126,8 +126,8 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
|
|||
}
|
||||
se.widthInPixels = mode->mode.width;
|
||||
se.heightInPixels = mode->mode.height;
|
||||
se.widthInMillimeters = mode->mode.mmWidth;
|
||||
se.heightInMillimeters = mode->mode.mmHeight;
|
||||
se.widthInMillimeters = pScreen->mmWidth;
|
||||
se.heightInMillimeters = pScreen->mmHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -415,8 +415,6 @@ ProcRRGetScreenResources (ClientPtr client)
|
|||
swapl (&modeinfos[i].id, n);
|
||||
swaps (&modeinfos[i].width, n);
|
||||
swaps (&modeinfos[i].height, n);
|
||||
swapl (&modeinfos[i].mmWidth, n);
|
||||
swapl (&modeinfos[i].mmHeight, n);
|
||||
swapl (&modeinfos[i].dotClock, n);
|
||||
swaps (&modeinfos[i].hSyncStart, n);
|
||||
swaps (&modeinfos[i].hSyncEnd, n);
|
||||
|
@ -501,8 +499,13 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output)
|
|||
size[j].id = j;
|
||||
size[j].width = mode->mode.width;
|
||||
size[j].height = mode->mode.height;
|
||||
size[j].mmWidth = mode->mode.mmWidth;
|
||||
size[j].mmHeight = mode->mode.mmHeight;
|
||||
if (output->mmWidth && output->mmHeight) {
|
||||
size[j].mmWidth = output->mmWidth;
|
||||
size[j].mmHeight = output->mmHeight;
|
||||
} else {
|
||||
size[j].mmWidth = pScreen->mmWidth;
|
||||
size[j].mmHeight = pScreen->mmHeight;
|
||||
}
|
||||
size[j].nRates = 0;
|
||||
size[j].pRates = &refresh[data->nrefresh];
|
||||
data->nsize++;
|
||||
|
|
Loading…
Reference in New Issue
Block a user