Get modes code building with old X servers again.

This change uses XORG_VERSION_CURRENT < 7.0 to mean "server newer than 1.2"
since XORG_VERSION current went backwards at some point.
This commit is contained in:
Aaron Plattner 2008-03-02 20:13:11 -08:00
parent ca616b902b
commit a8d760f567
5 changed files with 60 additions and 4 deletions

View File

@ -226,8 +226,13 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
CursorPtr cursor = xf86_config->cursor; CursorPtr cursor = xf86_config->cursor;
int c; int c;
CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates, CARD8 *bits = cursor ?
screen) : NULL; #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixLookupPrivate(&cursor->devPrivates, screen)
#else
cursor->devPriv[screen->myNum]
#endif
: NULL;
/* Save ARGB versions of these colors */ /* Save ARGB versions of these colors */
xf86_config->cursor_fg = (CARD32) fg | 0xff000000; xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
@ -613,7 +618,12 @@ xf86_reload_cursors (ScreenPtr screen)
else else
#endif #endif
(*cursor_info->LoadCursorImage)(cursor_info->pScrn, (*cursor_info->LoadCursorImage)(cursor_info->pScrn,
dixLookupPrivate(&cursor->devPrivates, screen)); #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixLookupPrivate(&cursor->devPrivates, screen)
#else
cursor->devPriv[screen->myNum]
#endif
);
(*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y); (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
(*cursor_info->ShowCursor)(cursor_info->pScrn); (*cursor_info->ShowCursor)(cursor_info->pScrn);

View File

@ -410,6 +410,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
return Mode; return Mode;
} }
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
static DisplayModePtr static DisplayModePtr
DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
{ {
@ -438,6 +439,7 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
return modes; return modes;
} }
#endif
/* /*
@ -621,10 +623,12 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
quirks, timing_level); quirks, timing_level);
Modes = xf86ModesAdd(Modes, Mode); Modes = xf86ModesAdd(Modes, Mode);
break; break;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
case DS_CVT: case DS_CVT:
Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt); Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt);
Modes = xf86ModesAdd(Modes, Mode); Modes = xf86ModesAdd(Modes, Mode);
break; break;
#endif
default: default:
break; break;
} }

View File

@ -513,7 +513,12 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
for (mode = modeList; mode != NULL; mode = mode->next) { for (mode = modeList; mode != NULL; mode = mode->next) {
if (xf86ModeBandwidth(mode, depth) > bandwidth) if (xf86ModeBandwidth(mode, depth) > bandwidth)
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
mode->status = MODE_BANDWIDTH; mode->status = MODE_BANDWIDTH;
#else
/* MODE_BANDWIDTH didn't exist in xserver 1.2 */
mode->status = MODE_BAD;
#endif
} }
} }

View File

@ -60,11 +60,21 @@ static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
#endif #endif
static int xf86RandR12Generation; static int xf86RandR12Generation;
static DevPrivateKey xf86RandR12Key; #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
static DevPrivateKey xf86RandR12Key;
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \ #define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key)) dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
#else /* XORG_VERSION_CURRENT < 7.0 */
static int xf86RandR12Index;
#define XF86RANDRINFO(p) \
((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
#endif /* XORG_VERSION_CURRENT < 7.0 */
static int static int
xf86RandR12ModeRefresh (DisplayModePtr mode) xf86RandR12ModeRefresh (DisplayModePtr mode)
{ {
@ -340,13 +350,17 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen); PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
Bool ret = FALSE; Bool ret = FALSE;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key) { if (xf86RandR12Key) {
#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1) if (randrp->virtualX == -1 || randrp->virtualY == -1)
{ {
randrp->virtualX = pScrn->virtualX; randrp->virtualX = pScrn->virtualX;
randrp->virtualY = pScrn->virtualY; randrp->virtualY = pScrn->virtualY;
} }
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
} }
#endif
if (pRoot && pScrn->vtSema) if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE); (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
@ -468,8 +482,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
mmHeight); mmHeight);
} }
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return TRUE; return TRUE;
#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1) if (randrp->virtualX == -1 || randrp->virtualY == -1)
{ {
@ -500,7 +516,11 @@ xf86RandR12Init (ScreenPtr pScreen)
if (xf86RandR12Generation != serverGeneration) if (xf86RandR12Generation != serverGeneration)
xf86RandR12Generation = serverGeneration; xf86RandR12Generation = serverGeneration;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
xf86RandR12Key = &xf86RandR12Key; xf86RandR12Key = &xf86RandR12Key;
#else
xf86RandR12Index = AllocateScreenPrivateIndex();
#endif
randrp = xalloc (sizeof (XF86RandRInfoRec)); randrp = xalloc (sizeof (XF86RandRInfoRec));
if (!randrp) if (!randrp)
@ -526,7 +546,11 @@ xf86RandR12Init (ScreenPtr pScreen)
randrp->maxX = randrp->maxY = 0; randrp->maxX = randrp->maxY = 0;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp); dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
#else
pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
#endif
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
if (!xf86RandR12Init12 (pScreen)) if (!xf86RandR12Init12 (pScreen))
@ -545,8 +569,10 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif #endif
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return; return;
#endif
randrp = XF86RANDRINFO(pScreen); randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
@ -1090,8 +1116,10 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return TRUE; return TRUE;
#endif
for (c = 0; c < config->num_crtc; c++) for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc); xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
@ -1113,8 +1141,13 @@ xf86RandR12TellChanged (ScreenPtr pScreen)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c; int c;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return; return;
#else
if (!XF86RANDRINFO(pScreen))
return;
#endif
xf86RandR12SetInfo12 (pScreen); xf86RandR12SetInfo12 (pScreen);
for (c = 0; c < config->num_crtc; c++) for (c = 0; c < config->num_crtc; c++)

View File

@ -62,6 +62,10 @@
#ifdef HAVE_XORG_CONFIG_H #ifdef HAVE_XORG_CONFIG_H
# include <xorg-config.h> # include <xorg-config.h>
#else
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#endif #endif
#include "xf86.h" #include "xf86.h"