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