Commit a8d760f5 authored by Aaron Plattner's avatar Aaron Plattner

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.
parent ca616b90
......@@ -226,8 +226,13 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
CursorPtr cursor = xf86_config->cursor;
int c;
CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates,
screen) : NULL;
CARD8 *bits = cursor ?
#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 */
xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
......@@ -613,7 +618,12 @@ xf86_reload_cursors (ScreenPtr screen)
else
#endif
(*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->ShowCursor)(cursor_info->pScrn);
......
......@@ -410,6 +410,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
return Mode;
}
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
static DisplayModePtr
DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
{
......@@ -438,6 +439,7 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
return modes;
}
#endif
/*
......@@ -621,10 +623,12 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
quirks, timing_level);
Modes = xf86ModesAdd(Modes, Mode);
break;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
case DS_CVT:
Mode = DDCModesFromCVT(scrnIndex, det_mon->section.cvt);
Modes = xf86ModesAdd(Modes, Mode);
break;
#endif
default:
break;
}
......
......@@ -513,7 +513,12 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
for (mode = modeList; mode != NULL; mode = mode->next) {
if (xf86ModeBandwidth(mode, depth) > bandwidth)
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
mode->status = MODE_BANDWIDTH;
#else
/* MODE_BANDWIDTH didn't exist in xserver 1.2 */
mode->status = MODE_BAD;
#endif
}
}
......
......@@ -60,11 +60,21 @@ static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
#endif
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) \
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
xf86RandR12ModeRefresh (DisplayModePtr mode)
{
......@@ -340,13 +350,17 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
PixmapPtr pScrnPix = (*pScreen->GetScreenPixmap)(pScreen);
Bool ret = FALSE;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key) {
#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1)
{
randrp->virtualX = pScrn->virtualX;
randrp->virtualY = pScrn->virtualY;
}
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
}
#endif
if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
......@@ -468,8 +482,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
mmHeight);
}
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return TRUE;
#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1)
{
......@@ -500,7 +516,11 @@ xf86RandR12Init (ScreenPtr pScreen)
if (xf86RandR12Generation != serverGeneration)
xf86RandR12Generation = serverGeneration;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
xf86RandR12Key = &xf86RandR12Key;
#else
xf86RandR12Index = AllocateScreenPrivateIndex();
#endif
randrp = xalloc (sizeof (XF86RandRInfoRec));
if (!randrp)
......@@ -526,7 +546,11 @@ xf86RandR12Init (ScreenPtr pScreen)
randrp->maxX = randrp->maxY = 0;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
#else
pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
#endif
#if RANDR_12_INTERFACE
if (!xf86RandR12Init12 (pScreen))
......@@ -545,8 +569,10 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return;
#endif
randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE
......@@ -1090,8 +1116,10 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return TRUE;
#endif
for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
......@@ -1113,8 +1141,13 @@ xf86RandR12TellChanged (ScreenPtr pScreen)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL)
return;
#else
if (!XF86RANDRINFO(pScreen))
return;
#endif
xf86RandR12SetInfo12 (pScreen);
for (c = 0; c < config->num_crtc; c++)
......
......@@ -62,6 +62,10 @@
#ifdef HAVE_XORG_CONFIG_H
# include <xorg-config.h>
#else
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#endif
#include "xf86.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment