#include "RFBGlue.h"
#include "inputstr.h"
-#if XORG >= 110
#include "inpututils.h"
-#endif
#include "mi.h"
#include "mipointer.h"
#include "exevents.h"
#define BUTTONS 7
-/* Event queue is shared between all devices. */
-#if XORG < 111
-static EventList *eventq = NULL;
-#endif
-
DeviceIntPtr vncKeyboardDev;
DeviceIntPtr vncPointerDev;
!EnableDevice(vncKeyboardDev, TRUE))
FatalError("Failed to activate TigerVNC devices\n");
-#if XORG < 111
- /* eventq is never free()-ed because it exists during server life. */
- if (eventq == NULL)
- GetEventList(&eventq);
-#endif
-
vncPrepareInputDevices();
}
-#if XORG < 111
-static void enqueueEvents(DeviceIntPtr dev, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- /*
- * Passing arguments in global variable eventq is probably not
- * good programming practise but in this case it is safe and
- * clear.
- */
- mieqEnqueue(dev, (InternalEvent *) (eventq + i)->event);
- }
-}
-#endif /* XORG < 111 */
-
void vncPointerButtonAction(int buttonMask)
{
int i;
-#if XORG < 111
- int n;
-#endif
-#if XORG >= 110
ValuatorMask mask;
-#endif
for (i = 0; i < BUTTONS; i++) {
if ((buttonMask ^ oldButtonMask) & (1 << i)) {
int action = (buttonMask & (1<<i)) ?
ButtonPress : ButtonRelease;
-#if XORG < 110
- n = GetPointerEvents(eventq, vncPointerDev,
- action, i + 1,
- POINTER_RELATIVE, 0, 0, NULL);
- enqueueEvents(vncPointerDev, n);
-#elif XORG < 111
- valuator_mask_set_range(&mask, 0, 0, NULL);
- n = GetPointerEvents(eventq, vncPointerDev,
- action, i + 1,
- POINTER_RELATIVE, &mask);
- enqueueEvents(vncPointerDev, n);
-#else
valuator_mask_set_range(&mask, 0, 0, NULL);
QueuePointerEvents(vncPointerDev, action, i + 1,
POINTER_RELATIVE, &mask);
-#endif
}
}
void vncPointerMove(int x, int y)
{
int valuators[2];
-#if XORG < 111
- int n;
-#endif
-#if XORG >= 110
ValuatorMask mask;
-#endif
if (cursorPosX == x && cursorPosY == y)
return;
valuators[0] = x;
valuators[1] = y;
-#if XORG < 110
- n = GetPointerEvents(eventq, vncPointerDev, MotionNotify, 0,
- POINTER_ABSOLUTE, 0, 2, valuators);
- enqueueEvents(vncPointerDev, n);
-#elif XORG < 111
- valuator_mask_set_range(&mask, 0, 2, valuators);
- n = GetPointerEvents(eventq, vncPointerDev, MotionNotify, 0,
- POINTER_ABSOLUTE, &mask);
- enqueueEvents(vncPointerDev, n);
-#else
valuator_mask_set_range(&mask, 0, 2, valuators);
QueuePointerEvents(vncPointerDev, MotionNotify, 0,
POINTER_ABSOLUTE, &mask);
-#endif
cursorPosX = x;
cursorPosY = y;
static inline void pressKey(DeviceIntPtr dev, int kc, Bool down, const char *msg)
{
int action;
-#if XORG < 111
- unsigned int n;
-#endif
if (msg != NULL)
LOG_DEBUG("%s %d %s", msg, kc, down ? "down" : "up");
action = down ? KeyPress : KeyRelease;
-#if XORG < 111
- n = GetKeyboardEvents(eventq, dev, action, kc);
- enqueueEvents(dev, n);
-#elif XORG < 118
+#if XORG < 118
QueueKeyboardEvents(dev, action, kc, NULL);
#else
QueueKeyboardEvents(dev, action, kc);
#endif
#if XORG < 118
-#if XORG < 110
-#define GetMaster(dev, type) ((dev)->u.master)
-#else
#define GetMaster(dev, type) ((dev)->master)
#endif
-#endif
extern DeviceIntPtr vncKeyboardDev;
ev.sequenceNumber = cur->client->sequence;
ev.window = cur->window;
if (cur->client->swapped) {
-#if XORG < 112
- int n;
- swaps(&ev.sequenceNumber, n);
- swapl(&ev.window, n);
-#else
swaps(&ev.sequenceNumber);
swapl(&ev.window);
-#endif
}
WriteToClient(cur->client, sizeof(xVncExtQueryConnectNotifyEvent),
(char *)&ev);
free(param);
if (client->swapped) {
-#if XORG < 112
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
-#else
swaps(&rep.sequenceNumber);
swapl(&rep.length);
-#endif
}
WriteToClient(client, sizeof(xVncExtSetParamReply), (char *)&rep);
return (client->noClientException);
static int SProcVncExtSetParam(ClientPtr client)
{
REQUEST(xVncExtSetParamReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
-#else
swaps(&stuff->length);
-#endif
REQUEST_AT_LEAST_SIZE(xVncExtSetParamReq);
return ProcVncExtSetParam(client);
}
rep.length = (len + 3) >> 2;
rep.valueLen = len;
if (client->swapped) {
-#if XORG < 112
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.valueLen, n);
-#else
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.valueLen);
-#endif
}
WriteToClient(client, sizeof(xVncExtGetParamReply), (char *)&rep);
if (value)
static int SProcVncExtGetParam(ClientPtr client)
{
REQUEST(xVncExtGetParamReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
-#else
swaps(&stuff->length);
-#endif
REQUEST_AT_LEAST_SIZE(xVncExtGetParamReq);
return ProcVncExtGetParam(client);
}
rep.length = (len + 3) >> 2;
rep.descLen = len;
if (client->swapped) {
-#if XORG < 112
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.descLen, n);
-#else
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.descLen);
-#endif
}
WriteToClient(client, sizeof(xVncExtGetParamDescReply), (char *)&rep);
if (desc)
static int SProcVncExtGetParamDesc(ClientPtr client)
{
REQUEST(xVncExtGetParamDescReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
-#else
swaps(&stuff->length);
-#endif
REQUEST_AT_LEAST_SIZE(xVncExtGetParamDescReq);
return ProcVncExtGetParamDesc(client);
}
rep.length = (len + 3) >> 2;
rep.nParams = vncGetParamCount();
if (client->swapped) {
-#if XORG < 112
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- swaps(&rep.nParams, n);
-#else
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.nParams);
-#endif
}
WriteToClient(client, sizeof(xVncExtListParamsReply), (char *)&rep);
WriteToClient(client, len, (char*)params);
static int SProcVncExtListParams(ClientPtr client)
{
REQUEST(xVncExtListParamsReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
-#else
swaps(&stuff->length);
-#endif
REQUEST_SIZE_MATCH(xVncExtListParamsReq);
return ProcVncExtListParams(client);
}
static int SProcVncExtSelectInput(ClientPtr client)
{
REQUEST(xVncExtSelectInputReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
-#else
swaps(&stuff->length);
-#endif
REQUEST_SIZE_MATCH(xVncExtSelectInputReq);
-#if XORG < 112
- swapl(&stuff->window, n);
- swapl(&stuff->mask, n);
-#else
swapl(&stuff->window);
swapl(&stuff->mask);
-#endif
return ProcVncExtSelectInput(client);
}
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (client->swapped) {
-#if XORG < 112
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
-#else
swaps(&rep.sequenceNumber);
swapl(&rep.length);
-#endif
}
WriteToClient(client, sizeof(xVncExtConnectReply), (char *)&rep);
static int SProcVncExtConnect(ClientPtr client)
{
REQUEST(xVncExtConnectReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
-#else
swaps(&stuff->length);
-#endif
REQUEST_AT_LEAST_SIZE(xVncExtConnectReq);
return ProcVncExtConnect(client);
}
rep.opaqueId = (CARD32)(long)opaqueId;
rep.length = ((rep.userLen + 3) >> 2) + ((rep.addrLen + 3) >> 2);
if (client->swapped) {
-#if XORG < 112
- int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.addrLen, n);
- swapl(&rep.userLen, n);
- swapl(&rep.timeout, n);
- swapl(&rep.opaqueId, n);
- swapl(&rep.length, n);
-#else
swaps(&rep.sequenceNumber);
swapl(&rep.addrLen);
swapl(&rep.userLen);
swapl(&rep.timeout);
swapl(&rep.opaqueId);
swapl(&rep.length);
-#endif
}
WriteToClient(client, sizeof(xVncExtGetQueryConnectReply), (char *)&rep);
if (qcTimeout)
static int SProcVncExtGetQueryConnect(ClientPtr client)
{
REQUEST(xVncExtGetQueryConnectReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
-#else
swaps(&stuff->length);
-#endif
REQUEST_SIZE_MATCH(xVncExtGetQueryConnectReq);
return ProcVncExtGetQueryConnect(client);
}
static int SProcVncExtApproveConnect(ClientPtr client)
{
REQUEST(xVncExtApproveConnectReq);
-#if XORG < 112
- register char n;
- swaps(&stuff->length, n);
- swapl(&stuff->opaqueId, n);
-#else
swaps(&stuff->length);
swapl(&stuff->opaqueId);
-#endif
REQUEST_SIZE_MATCH(xVncExtApproveConnectReq);
return ProcVncExtApproveConnect(client);
}
CreateGCProcPtr CreateGC;
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
-#if XORG < 110
- RestoreAreasProcPtr RestoreAreas;
-#endif
DisplayCursorProcPtr DisplayCursor;
ScreenBlockHandlerProcPtr BlockHandler;
#ifdef RENDER
CompositeRectsProcPtr CompositeRects;
TrapezoidsProcPtr Trapezoids;
TrianglesProcPtr Triangles;
-#if PICTURE_SCREEN_VERSION >= 2
TriStripProcPtr TriStrip;
TriFanProcPtr TriFan;
-#endif
#endif
RRSetConfigProcPtr rrSetConfig;
RRScreenSetSizeProcPtr rrScreenSetSize;
} vncHooksScreenRec, *vncHooksScreenPtr;
typedef struct _vncHooksGCRec {
-#if XORG >= 116
const GCFuncs *funcs;
const GCOps *ops;
-#else
- GCFuncs *funcs;
- GCOps *ops;
-#endif
} vncHooksGCRec, *vncHooksGCPtr;
#define wrap(priv, real, mem, func) {\
real->mem = priv->mem; \
}
-#if XORG < 19
-static int vncHooksScreenPrivateKeyIndex;
-static int vncHooksGCPrivateKeyIndex;
-static DevPrivateKey vncHooksScreenPrivateKey = &vncHooksScreenPrivateKeyIndex;
-static DevPrivateKey vncHooksGCPrivateKey = &vncHooksGCPrivateKeyIndex;
-#else
static DevPrivateKeyRec vncHooksScreenKeyRec;
static DevPrivateKeyRec vncHooksGCKeyRec;
#define vncHooksScreenPrivateKey (&vncHooksScreenKeyRec)
#define vncHooksGCPrivateKey (&vncHooksGCKeyRec)
-#endif
#define vncHooksScreenPrivate(pScreen) \
(vncHooksScreenPtr) dixLookupPrivate(&(pScreen)->devPrivates, \
// screen functions
-#if XORG <= 112
-static Bool vncHooksCloseScreen(int i, ScreenPtr pScreen);
-#else
static Bool vncHooksCloseScreen(ScreenPtr pScreen);
-#endif
static Bool vncHooksCreateGC(GCPtr pGC);
static void vncHooksCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
RegionPtr pOldRegion);
static void vncHooksClearToBackground(WindowPtr pWin, int x, int y, int w,
int h, Bool generateExposures);
-#if XORG < 110
-static RegionPtr vncHooksRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed);
-#endif
static Bool vncHooksDisplayCursor(DeviceIntPtr pDev,
ScreenPtr pScreen, CursorPtr cursor);
-#if XORG <= 112
-static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
- pointer pReadmask);
-#elif XORG <= 118
+#if XORG <= 118
static void vncHooksBlockHandler(ScreenPtr pScreen, void * pTimeout,
void * pReadmask);
#else
static void vncHooksTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntri, xTriangle * tris);
-#if PICTURE_SCREEN_VERSION >= 2
static void vncHooksTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int npoint, xPointFixed * points);
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int npoint, xPointFixed * points);
#endif
-#endif
static Bool vncHooksRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
int rate, RRScreenSizePtr pSize);
static Bool vncHooksRandRScreenSetSize(ScreenPtr pScreen,
return FALSE;
}
-#if XORG < 19
- if (!dixRequestPrivate(vncHooksScreenPrivateKey, sizeof(vncHooksScreenRec))) {
- ErrorF("vncHooksInit: Allocation of vncHooksScreen failed\n");
- return FALSE;
- }
- if (!dixRequestPrivate(vncHooksGCPrivateKey, sizeof(vncHooksGCRec))) {
- ErrorF("vncHooksInit: Allocation of vncHooksGCRec failed\n");
- return FALSE;
- }
-
-#else
if (!dixRegisterPrivateKey(&vncHooksScreenKeyRec, PRIVATE_SCREEN,
sizeof(vncHooksScreenRec))) {
ErrorF("vncHooksInit: Allocation of vncHooksScreen failed\n");
return FALSE;
}
-#endif
-
vncHooksScreen = vncHooksScreenPrivate(pScreen);
vncHooksScreen->ignoreHooks = 0;
wrap(vncHooksScreen, pScreen, CreateGC, vncHooksCreateGC);
wrap(vncHooksScreen, pScreen, CopyWindow, vncHooksCopyWindow);
wrap(vncHooksScreen, pScreen, ClearToBackground, vncHooksClearToBackground);
-#if XORG < 110
- wrap(vncHooksScreen, pScreen, RestoreAreas, vncHooksRestoreAreas);
-#endif
wrap(vncHooksScreen, pScreen, DisplayCursor, vncHooksDisplayCursor);
wrap(vncHooksScreen, pScreen, BlockHandler, vncHooksBlockHandler);
#ifdef RENDER
wrap(vncHooksScreen, ps, CompositeRects, vncHooksCompositeRects);
wrap(vncHooksScreen, ps, Trapezoids, vncHooksTrapezoids);
wrap(vncHooksScreen, ps, Triangles, vncHooksTriangles);
-#if PICTURE_SCREEN_VERSION >= 2
wrap(vncHooksScreen, ps, TriStrip, vncHooksTriStrip);
wrap(vncHooksScreen, ps, TriFan, vncHooksTriFan);
-#endif
}
#endif
rp = rrGetScrPriv(pScreen);
// We do one line at a time since GetImage() cannot handle stride
for (i = y; i < y + height; i++) {
DrawablePtr pDrawable;
-#if XORG < 19
- pDrawable = (DrawablePtr) WindowTable[scrIdx];
-#else
pDrawable = (DrawablePtr) pScreen->root;
-#endif
(*pScreen->GetImage) (pDrawable, x, i, width, 1,
ZPixmap, (unsigned long)~0L, buffer);
// CloseScreen - unwrap the screen functions and call the original CloseScreen
// function
-#if XORG <= 112
-static Bool vncHooksCloseScreen(int i, ScreenPtr pScreen_)
-#else
static Bool vncHooksCloseScreen(ScreenPtr pScreen_)
-#endif
{
#ifdef RENDER
PictureScreenPtr ps;
unwrap(vncHooksScreen, pScreen, CreateGC);
unwrap(vncHooksScreen, pScreen, CopyWindow);
unwrap(vncHooksScreen, pScreen, ClearToBackground);
-#if XORG < 110
- unwrap(vncHooksScreen, pScreen, RestoreAreas);
-#endif
unwrap(vncHooksScreen, pScreen, DisplayCursor);
unwrap(vncHooksScreen, pScreen, BlockHandler);
#ifdef RENDER
unwrap(vncHooksScreen, ps, CompositeRects);
unwrap(vncHooksScreen, ps, Trapezoids);
unwrap(vncHooksScreen, ps, Triangles);
-#if PICTURE_SCREEN_VERSION >= 2
unwrap(vncHooksScreen, ps, TriStrip);
unwrap(vncHooksScreen, ps, TriFan);
-#endif
}
#endif
rp = rrGetScrPriv(pScreen);
DBGPRINT((stderr,"vncHooksCloseScreen: unwrapped screen functions\n"));
-#if XORG <= 112
- return (*pScreen->CloseScreen)(i, pScreen);
-#else
return (*pScreen->CloseScreen)(pScreen);
-#endif
}
// CreateGC - wrap the "GC funcs"
SCREEN_EPILOGUE(ClearToBackground);
}
-#if XORG < 110
-// RestoreAreas - changed region is the given region
-
-static RegionPtr vncHooksRestoreAreas(WindowPtr pWin, RegionPtr pRegion)
-{
- RegionRec reg;
-
- SCREEN_PROLOGUE(pWin->drawable.pScreen, RestoreAreas);
-
- REGION_NULL(pScreen, ®);
- REGION_COPY(pScreen, ®, pRegion);
-
- RegionPtr result = (*pScreen->RestoreAreas) (pWin, pRegion);
-
- add_changed(pScreen, ®);
-
- REGION_UNINIT(pScreen, ®);
-
- SCREEN_EPILOGUE(RestoreAreas);
-
- return result;
-}
-#endif
-
// DisplayCursor - get the cursor shape
static Bool vncHooksDisplayCursor(DeviceIntPtr pDev,
if (rgbaData == NULL)
goto out;
-#ifdef ARGB_CURSOR
if (cursor->bits->argb) {
unsigned char *out;
CARD32 *in;
in++;
}
} else {
-#endif
unsigned char *out;
int xMaskBytesPerRow;
out += 4;
}
}
-#ifdef ARGB_CURSOR
}
-#endif
vncSetCursor(width, height, hotX, hotY, rgbaData);
// BlockHandler - ignore any changes during the block handler - it's likely
// these are just drawing the cursor.
-#if XORG <= 112
-static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
- pointer pReadmask)
-#elif XORG <= 118
+#if XORG <= 118
static void vncHooksBlockHandler(ScreenPtr pScreen_, void * pTimeout,
void * pReadmask)
#else
static void vncHooksBlockHandler(ScreenPtr pScreen_, void * pTimeout)
#endif
{
-#if XORG <= 112
- SCREEN_PROLOGUE(screenInfo.screens[i], BlockHandler);
-#else
SCREEN_PROLOGUE(pScreen_, BlockHandler);
-#endif
vncHooksScreen->ignoreHooks++;
-#if XORG <= 112
- (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
-#elif XORG <= 118
+#if XORG <= 118
(*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
#else
(*pScreen->BlockHandler) (pScreen, pTimeout);
RENDER_EPILOGUE(Triangles);
}
-#if PICTURE_SCREEN_VERSION >= 2
-
static void vncHooksTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int npoint, xPointFixed * points)
RENDER_EPILOGUE(TriFan);
}
-#endif /* PICTURE_SCREEN_VERSION */
-
#endif /* RENDER */
// Unwrap and rewrap helpers
// Unwrap and rewrap helpers
-#if XORG >= 116
#define GC_OP_PROLOGUE(pGC, name)\
vncHooksGCPtr pGCPriv = vncHooksGCPrivate(pGC);\
const GCFuncs *oldFuncs = pGC->funcs;\
unwrap(pGCPriv, pGC, funcs);\
unwrap(pGCPriv, pGC, ops);\
DBGPRINT((stderr,"vncHooks" #name " called\n"))
-#else
-#define GC_OP_PROLOGUE(pGC, name)\
- vncHooksGCPtr pGCPriv = vncHooksGCPrivate(pGC);\
- GCFuncs *oldFuncs = pGC->funcs;\
- unwrap(pGCPriv, pGC, funcs);\
- unwrap(pGCPriv, pGC, ops);\
- DBGPRINT((stderr,"vncHooks" #name " called\n"))
-#endif
#define GC_OP_EPILOGUE(pGC)\
wrap(pGCPriv, pGC, funcs, oldFuncs); \
#include "randrstr.h"
#include "xorg-version.h"
-#if XORG <= 111
-typedef pointer XF86OptionPtr;
-#endif
#include "xf86.h"
#include "xf86Module.h"
{
vncModuleInit,
"VNC",
-#if XORG < 112
- NULL,
- NULL,
-#endif
NULL
};
static void *
vncSetup(void * module, void * opts, int *errmaj, int *errmin) {
-#if XORG >= 116
LoadExtensionList(&vncExt, 1, FALSE);
-#else
- LoadExtension(&vncExt, FALSE);
-#endif
/* Need a non-NULL return value to indicate success */
return (void *)1;
}
#include <dix-config.h>
#endif
-#if XORG_VERSION_CURRENT < ((1 * 10000000) + (6 * 100000) + (99 * 1000))
-#error "X.Org older than 1.7 is not supported"
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (7 * 100000) + (99 * 1000))
-#define XORG 17
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (8 * 100000) + (99 * 1000))
-#define XORG 18
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (9 * 100000) + (99 * 1000))
-#define XORG 19
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (10 * 100000) + (99 * 1000))
-#define XORG 110
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (11 * 100000) + (99 * 1000))
-#define XORG 111
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (12 * 100000) + (99 * 1000))
-#define XORG 112
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (13 * 100000) + (99 * 1000))
-#define XORG 113
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (14 * 100000) + (99 * 1000))
-#define XORG 114
-#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (15 * 100000) + (99 * 1000))
-#define XORG 115
+#if XORG_VERSION_CURRENT < ((1 * 10000000) + (15 * 100000) + (99 * 1000))
+#error "X.Org older than 1.16 is not supported"
#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (16 * 100000) + (99 * 1000))
#define XORG 116
#elif XORG_VERSION_CURRENT < ((1 * 10000000) + (17 * 100000) + (99 * 1000))
#include <X11/Xproto.h>
#include <X11/Xos.h>
#include "scrnintstr.h"
-#if XORG >= 120
#include "glx_extinit.h"
-#endif
#include "servermd.h"
#include "fb.h"
#include "mi.h"
-#if XORG < 114
-#include "mibstore.h"
-#endif
#include "colormapst.h"
#include "gcstruct.h"
#include "input.h"
#endif
#endif
-#if XORG < 111
-void ddxGiveUp()
-#else
void ddxGiveUp(enum ExitCode error)
-#endif
{
int i;
}
void
-#if XORG < 111
-AbortDDX()
-#else
AbortDDX(enum ExitCode error)
-#endif
{
-#if XORG < 111
- ddxGiveUp();
-#else
ddxGiveUp(error);
-#endif
}
#ifdef __DARWIN__
}
void
-#if XORG < 113
-OsVendorFatalError()
-#else
OsVendorFatalError(const char *f, va_list args)
-#endif
{
}
}
#endif
-#if XORG < 113
-static ColormapPtr InstalledMaps[MAXSCREENS];
-#else
static DevPrivateKeyRec cmapScrPrivateKeyRec;
#define cmapScrPrivateKey (&cmapScrPrivateKeyRec)
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
-#endif
static int
vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
/* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */
-#if XORG < 113
- *pmaps = InstalledMaps[pScreen->myNum]->mid;
-#else
*pmaps = GetInstalledColormap(pScreen)->mid;
-#endif
return (1);
}
static void
vfbInstallColormap(ColormapPtr pmap)
{
-#if XORG < 113
- int index = pmap->pScreen->myNum;
-#endif
ColormapPtr oldpmap;
-#if XORG < 113
- oldpmap = InstalledMaps[index];
-#else
oldpmap = GetInstalledColormap(pmap->pScreen);
-#endif
if (pmap != oldpmap)
{
if(oldpmap != (ColormapPtr)None)
WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
/* Install pmap */
-#if XORG < 113
- InstalledMaps[index] = pmap;
-#else
SetInstalledColormap(pmap->pScreen, pmap);
-#endif
WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
entries = pmap->pVisual->ColormapEntries;
for (i = 0; i < entries; i++) ppix[i] = i;
/* XXX truecolor */
-#if XORG < 19
- QueryColors(pmap, entries, ppix, prgb);
-#else
QueryColors(pmap, entries, ppix, prgb, serverClient);
-#endif
for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */
static void
vfbUninstallColormap(ColormapPtr pmap)
{
-#if XORG < 113
- ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum];
-#else
ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
-#endif
if(pmap == curpmap)
{
if (pmap->mid != pmap->pScreen->defColormap)
{
-#if XORG < 111
- curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
- RT_COLORMAP);
-#else
int rc = dixLookupResourceByType((void * *) &curpmap, pmap->pScreen->defColormap,
RT_COLORMAP, serverClient, DixUnknownAccess);
if (rc != Success)
ErrorF("Failed to uninstall color map\n");
else
-#endif
(*pmap->pScreen->InstallColormap)(curpmap);
}
}
static void
xf86SetRootClip (ScreenPtr pScreen, Bool enable)
{
-#if XORG < 19
- WindowPtr pWin = WindowTable[pScreen->myNum];
-#else
WindowPtr pWin = pScreen->root;
-#endif
WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = FALSE;
-#if XORG < 110
- RegionPtr pOldClip = NULL, bsExposed;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
-#endif
WindowPtr pLayerWin;
BoxRec box;
if (WasViewable)
{
-#if XORG < 110
- if (pWin->backStorage)
- {
- pOldClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, pOldClip, &pWin->clipList);
- }
-#endif
if (pWin->firstChild)
{
anyMarked = TRUE;
}
-#if XORG < 110 && defined(DO_SAVE_UNDERS)
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
- }
-#endif /* DO_SAVE_UNDERS */
-
if (anyMarked)
(*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
}
-#if XORG < 110
- if (pWin->backStorage &&
- ((pWin->backingStore == Always) || WasViewable))
- {
- if (!WasViewable)
- pOldClip = &pWin->clipList; /* a convenient empty region */
- bsExposed = (*pScreen->TranslateBackingStore)
- (pWin, 0, 0, pOldClip,
- pWin->drawable.x, pWin->drawable.y);
- if (WasViewable)
- REGION_DESTROY(pScreen, pOldClip);
- if (bsExposed)
- {
- RegionPtr valExposed = NullRegion;
-
- if (pWin->valdata)
- valExposed = &pWin->valdata->after.exposed;
- (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
- if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
- }
- }
-#endif
if (WasViewable)
{
if (anyMarked)
(*pScreen->HandleExposures)(pWin);
-#if XORG < 110 && defined(DO_SAVE_UNDERS)
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
-#endif /* DO_SAVE_UNDERS */
if (anyMarked && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
}
static Bool
-#if XORG < 113
-vfbCloseScreen(int index, ScreenPtr pScreen)
-#else
vfbCloseScreen(ScreenPtr pScreen)
-#endif
{
-#if XORG < 113
- vfbScreenInfoPtr pvfb = &vfbScreens[index];
-#else
vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum];
-#endif
int i;
pScreen->CloseScreen = pvfb->closeScreen;
* XXX probably lots of stuff to clean. For now,
* clear installed colormaps so that server reset works correctly.
*/
-#if XORG < 113
- for (i = 0; i < MAXSCREENS; i++)
- InstalledMaps[i] = NULL;
-
- return pScreen->CloseScreen(index, pScreen);
-#else
for (i = 0; i < screenInfo.numScreens; i++)
SetInstalledColormap(screenInfo.screens[i], NULL);
pScreen->devPrivate = NULL;
return pScreen->CloseScreen(pScreen);
-#endif
}
static Bool
-#if XORG < 113
-vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
-#else
vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
-#endif
{
-#if XORG >= 113
int index = pScreen->myNum;
-#endif
vfbScreenInfoPtr pvfb = &vfbScreens[index];
int dpi;
int ret;
rrScrPrivPtr rp;
-#if XORG >= 113
if (!dixRegisterPrivateKey(&cmapScrPrivateKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
-#endif
/* 96 is the default used by most other systems */
dpi = 96;
if (!ret) return FALSE;
-#if XORG < 110
- miInitializeBackingStore(pScreen);
-#endif
-
/*
* Circumvent the backing store that was just initialised. This amounts
* to a truely bizarre way of initialising SaveDoomedAreas and friends.
}
}
-#if XORG >= 113
#ifdef GLXEXT
extern void GlxExtensionInit(void);
&noGlxExtension
};
#endif
-#endif
void
InitOutput(ScreenInfo *scrInfo, int argc, char **argv)
xorgGlxCreateVendor();
#else
-#if XORG >= 113
#ifdef GLXEXT
if (serverGeneration == 1)
-#if XORG >= 116
LoadExtensionList(&glxExt, 1, TRUE);
-#else
- LoadExtension(&glxExt, TRUE);
-#endif
-#endif
#endif
#endif
mieqInit ();
}
-#if XORG > 17
void CloseInput(void)
{
}
-#endif
void vncClientGone(int fd)
{