diff options
author | Keith Packard <keithp@guitar.keithp.com> | 2006-09-18 12:18:22 -0700 |
---|---|---|
committer | Keith Packard <keithp@guitar.keithp.com> | 2006-09-18 12:18:22 -0700 |
commit | afe5e9483b352ed06075ed68a6ffa50799194e2d (patch) | |
tree | f44e59a037f6132e3873609027c65c837bab4fbc /randr/rrmode.c | |
parent | 2be1ac15aee592782d7693b8de2c3815478a094e (diff) |
RandR working with old clients and old API.
Diffstat (limited to 'randr/rrmode.c')
-rw-r--r-- | randr/rrmode.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/randr/rrmode.c b/randr/rrmode.c index 3a9d55671..52585d967 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -32,6 +32,7 @@ RRModeGet (ScreenPtr pScreen, rrScrPriv (pScreen); int i; RRModePtr mode; + RRModePtr *modes; for (i = 0; i < pScrPriv->numModes; i++) { @@ -43,16 +44,34 @@ RRModeGet (ScreenPtr pScreen, return mode; } } + mode = xalloc (sizeof (RRModeRec) + modeInfo->nameLength + 1); + if (!mode) + return NULL; mode->refcnt = 1; mode->mode = *modeInfo; mode->name = (char *) (mode + 1); memcpy (mode->name, name, modeInfo->nameLength); mode->name[modeInfo->nameLength] = '\0'; + + if (pScrPriv->numModes) + modes = xrealloc (pScrPriv->modes, + (pScrPriv->numModes + 1) * sizeof (RRModePtr)); + else + modes = xalloc (sizeof (RRModePtr)); + + if (!modes) + { + xfree (mode); + return NULL; + } + mode->id = FakeClientID(0); if (!AddResource (mode->id, RRModeType, (pointer) mode)) return NULL; ++mode->refcnt; + pScrPriv->modes = modes; + pScrPriv->modes[pScrPriv->numModes++] = mode; pScrPriv->changed = TRUE; return mode; } |