diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-06-20 11:10:06 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-06-21 04:09:17 +0200 |
commit | c2b1f489d7998c83af73c7cb25bbb2bc53f26094 (patch) | |
tree | f6f5ff5fe899c840ffe6623244070699c10a95fe /nx-X11/programs/Xserver/randr/rrinfo.c | |
parent | 2e5b98986ffe9de86d7329304ead298c164340bf (diff) | |
download | nx-libs-c2b1f489d7998c83af73c7cb25bbb2bc53f26094.tar.gz nx-libs-c2b1f489d7998c83af73c7cb25bbb2bc53f26094.tar.bz2 nx-libs-c2b1f489d7998c83af73c7cb25bbb2bc53f26094.zip |
Backport RANDR proto version 1.5 to nx-X11's Xserver.
Backported to X.org's /xorg/xserver Git hash level:
a6b6e8ba026acedef6336b17adf06aebddd5f22f.
Diffstat (limited to 'nx-X11/programs/Xserver/randr/rrinfo.c')
-rw-r--r-- | nx-X11/programs/Xserver/randr/rrinfo.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/nx-X11/programs/Xserver/randr/rrinfo.c b/nx-X11/programs/Xserver/randr/rrinfo.c index 070f5ca0c..df9b79986 100644 --- a/nx-X11/programs/Xserver/randr/rrinfo.c +++ b/nx-X11/programs/Xserver/randr/rrinfo.c @@ -36,7 +36,7 @@ RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh) RRModePtr *modes; memset(&modeInfo, '\0', sizeof(modeInfo)); - sprintf(name, "%dx%d", size->width, size->height); + snprintf(name, sizeof(name), "%dx%d", size->width, size->height); modeInfo.width = size->width; modeInfo.height = size->height; @@ -55,8 +55,13 @@ RROldModeAdd(RROutputPtr output, RRScreenSizePtr size, int refresh) } if (output->numModes) +#ifndef NXAGENT_SERVER + modes = reallocarray(output->modes, + output->numModes + 1, sizeof(RRModePtr)); +#else /* !defined(NXAGENT_SERVER) */ modes = xrealloc(output->modes, (output->numModes + 1) * sizeof(RRModePtr)); +#endif /* !defined(NXAGENT_SERVER) */ else modes = xalloc(sizeof(RRModePtr)); if (!modes) { @@ -97,9 +102,7 @@ RRScanOldConfig(ScreenPtr pScreen, Rotation rotations) return; RROutputSetCrtcs(output, &crtc, 1); RROutputSetConnection(output, RR_Connected); -#ifdef RENDER RROutputSetSubpixelOrder(output, PictureGetSubpixelOrder(pScreen)); -#endif } output = pScrPriv->outputs[0]; @@ -145,7 +148,8 @@ RRScanOldConfig(ScreenPtr pScreen, Rotation rotations) /* find size bounds */ for (i = 0; i < output->numModes + output->numUserModes; i++) { mode = (i < output->numModes ? - output->modes[i] : output->userModes[i - output->numModes]); + output->modes[i] : + output->userModes[i - output->numModes]); width = mode->mode.width; height = mode->mode.height; @@ -163,7 +167,7 @@ RRScanOldConfig(ScreenPtr pScreen, Rotation rotations) /* notice current mode */ if (newMode) - RRCrtcNotify(crtc, newMode, 0, 0, pScrPriv->rotation, 1, &output); + RRCrtcNotify(crtc, newMode, 0, 0, pScrPriv->rotation, NULL, 1, &output); } #endif @@ -171,12 +175,20 @@ RRScanOldConfig(ScreenPtr pScreen, Rotation rotations) * Poll the driver for changed information */ Bool -RRGetInfo(ScreenPtr pScreen) +RRGetInfo(ScreenPtr pScreen, Bool force_query) { rrScrPriv(pScreen); Rotation rotations; int i; + /* Return immediately if we don't need to re-query and we already have the + * information. + */ + if (!force_query) { + if (pScrPriv->numCrtcs != 0 || pScrPriv->numOutputs != 0) + return TRUE; + } + for (i = 0; i < pScrPriv->numOutputs; i++) pScrPriv->outputs[i]->changed = FALSE; for (i = 0; i < pScrPriv->numCrtcs; i++) @@ -218,7 +230,7 @@ RRScreenSetSizeRange(ScreenPtr pScreen, pScrPriv->minHeight = minHeight; pScrPriv->maxWidth = maxWidth; pScrPriv->maxHeight = maxHeight; - pScrPriv->changed = TRUE; + RRSetChanged(pScreen); pScrPriv->configChanged = TRUE; } @@ -259,8 +271,13 @@ RRRegisterSize(ScreenPtr pScreen, for (i = 0; i < pScrPriv->nSizes; i++) if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i])) return &pScrPriv->pSizes[i]; +#ifndef NXAGENT_SERVER + pNew = reallocarray(pScrPriv->pSizes, + pScrPriv->nSizes + 1, sizeof(RRScreenSize)); +#else /* !defined(NXAGENT_SERVER) */ pNew = xrealloc(pScrPriv->pSizes, (pScrPriv->nSizes + 1) * sizeof(RRScreenSize)); +#endif /* !defined(NXAGENT_SERVER) */ if (!pNew) return 0; pNew[pScrPriv->nSizes++] = tmp; @@ -282,7 +299,11 @@ RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate) if (pSize->pRates[i].rate == rate) return TRUE; +#ifndef NXAGENT_SERVER + pNew = reallocarray(pSize->pRates, pSize->nRates + 1, sizeof(RRScreenRate)); +#else /* !defined(NXAGENT_SERVER) */ pNew = xrealloc(pSize->pRates, (pSize->nRates + 1) * sizeof(RRScreenRate)); +#endif /* !defined(NXAGENT_SERVER) */ if (!pNew) return FALSE; pRate = &pNew[pSize->nRates++]; |