diff options
author | Keith Packard <keithp@mandolin.keithp.com> | 2006-11-01 00:29:46 -0800 |
---|---|---|
committer | Keith Packard <keithp@mandolin.keithp.com> | 2006-11-01 00:29:46 -0800 |
commit | 4056e6e79a4e37101d298ae29139c83d3816368b (patch) | |
tree | be8d982fb4855ac338d4113fb611f62fddc93a68 /randr | |
parent | e21604914dccece6bc64c69b55512d1f1a969235 (diff) |
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.
Diffstat (limited to 'randr')
-rw-r--r-- | randr/mirandr.c | 2 | ||||
-rw-r--r-- | randr/randrstr.h | 7 | ||||
-rw-r--r-- | randr/rrcrtc.c | 12 | ||||
-rw-r--r-- | randr/rrinfo.c | 2 | ||||
-rw-r--r-- | randr/rrmode.c | 2 | ||||
-rw-r--r-- | randr/rroutput.c | 23 | ||||
-rw-r--r-- | randr/rrpointer.c | 2 | ||||
-rw-r--r-- | randr/rrscreen.c | 15 |
8 files changed, 50 insertions, 15 deletions
diff --git a/randr/mirandr.c b/randr/mirandr.c index 8d79e8a11..11c299133 100644 --- a/randr/mirandr.c +++ b/randr/mirandr.c @@ -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); diff --git a/randr/randrstr.h b/randr/randrstr.h index a8a995026..60877a3c1 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -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); diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index ee51cc23a..c40dac129 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -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; diff --git a/randr/rrinfo.c b/randr/rrinfo.c index 6fd4ee581..e92caadfa 100644 --- a/randr/rrinfo.c +++ b/randr/rrinfo.c @@ -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 * diff --git a/randr/rrmode.c b/randr/rrmode.c index 07cd0c14f..fb4b5eb1e 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -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; diff --git a/randr/rroutput.c b/randr/rroutput.c index fc84ec1e6..1f6f33030 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -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) diff --git a/randr/rrpointer.c b/randr/rrpointer.c index 7ba0460f5..c092e494b 100644 --- a/randr/rrpointer.c +++ b/randr/rrpointer.c @@ -131,7 +131,7 @@ RRPointerScreenConfigured (ScreenPtr pScreen) int x, y; if (pScreen != pCurrentScreen) - return FALSE; + return; GetSpritePosition (&x, &y); RRPointerToNearestCrtc (pScreen, x, y, NULL); } diff --git a/randr/rrscreen.c b/randr/rrscreen.c index b4d361846..705e7d78c 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -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++; |