From 15bedbec50ed12ed3b59792b49fd0f50a8bd5bd1 Mon Sep 17 00:00:00 2001 From: Stuart Kreitman Date: Wed, 25 Feb 2004 23:28:43 +0000 Subject: [PATCH] Integration of XEVIE on XEVIE branch. --- Xext/panoramiX.c | 1258 ----------- Xext/panoramiX.h | 102 - Xext/panoramiXSwap.c | 140 -- Xext/panoramiXh.h | 78 - Xext/panoramiXprocs.c | 2368 --------------------- Xext/panoramiXsrv.h | 44 - Xext/xevie.c | 628 ++++++ hw/xfree86/common/compiler.h | 11 +- hw/xfree86/common/xf86AutoConfig.c | 47 +- hw/xfree86/common/xf86Bus.c | 5 +- hw/xfree86/common/xf86Init.c | 19 +- hw/xfree86/common/xf86cmap.c | 4 +- hw/xfree86/getconfig/getconfig | 47 +- hw/xfree86/getconfig/getconfig.pl | 47 +- hw/xfree86/os-support/bus/Pci.h | 3 +- hw/xfree86/os-support/linux/int10/linux.c | 7 +- hw/xfree86/os-support/misc/PortIO.S | 57 + hw/xfree86/vbe/vbe.h | 3 +- mi/miarc.c | 5 +- 19 files changed, 802 insertions(+), 4071 deletions(-) delete mode 100644 Xext/panoramiX.c delete mode 100644 Xext/panoramiX.h delete mode 100644 Xext/panoramiXSwap.c delete mode 100644 Xext/panoramiXh.h delete mode 100644 Xext/panoramiXprocs.c delete mode 100644 Xext/panoramiXsrv.h create mode 100644 Xext/xevie.c create mode 100644 hw/xfree86/os-support/misc/PortIO.S diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c deleted file mode 100644 index 89a8a2d2e..000000000 --- a/Xext/panoramiX.c +++ /dev/null @@ -1,1258 +0,0 @@ -/* $Xorg: panoramiX.c,v 1.5 2000/08/17 19:47:57 cpqbld Exp $ */ -/***************************************************************** -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. -******************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.38 2003/11/10 18:21:43 tsi Exp $ */ - -#define NEED_REPLIES -#include -#include "X.h" -#include "Xproto.h" -#include "Xarch.h" -#include "misc.h" -#include "cursor.h" -#include "cursorstr.h" -#include "extnsionst.h" -#include "dixstruct.h" -#include "gc.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "window.h" -#include "windowstr.h" -#include "pixmapstr.h" -#include "panoramiX.h" -#include "panoramiXproto.h" -#include "panoramiXsrv.h" -#include "globals.h" -#include "servermd.h" -#include "resource.h" -#ifdef RENDER -#include "picturestr.h" -#endif -#include "modinit.h" - - -#if 0 -static unsigned char PanoramiXReqCode = 0; -#endif -/* - * PanoramiX data declarations - */ - -int PanoramiXPixWidth = 0; -int PanoramiXPixHeight = 0; -int PanoramiXNumScreens = 0; - -PanoramiXData *panoramiXdataPtr = NULL; -RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; - -static int PanoramiXNumDepths; -static DepthPtr PanoramiXDepths; -static int PanoramiXNumVisuals; -static VisualPtr PanoramiXVisuals; - -/* We support at most 256 visuals */ -XID *PanoramiXVisualTable = NULL; - -unsigned long XRC_DRAWABLE; -unsigned long XRT_WINDOW; -unsigned long XRT_PIXMAP; -unsigned long XRT_GC; -unsigned long XRT_COLORMAP; - -/* - * Function prototypes - */ - -static int panoramiXGeneration; -static int ProcPanoramiXDispatch(ClientPtr client); - -static void PanoramiXResetProc(ExtensionEntry*); - -/* - * External references for functions and data variables - */ - -#include "panoramiXh.h" - -int (* SavedProcVector[256]) (ClientPtr client) = { NULL, }; -ScreenInfo *GlobalScrInfo = NULL; - -static int PanoramiXGCIndex = -1; -static int PanoramiXScreenIndex = -1; - -typedef struct { - DDXPointRec clipOrg; - DDXPointRec patOrg; - GCFuncs *wrapFuncs; -} PanoramiXGCRec, *PanoramiXGCPtr; - -typedef struct { - CreateGCProcPtr CreateGC; - CloseScreenProcPtr CloseScreen; -} PanoramiXScreenRec, *PanoramiXScreenPtr; - -RegionRec XineramaScreenRegions[MAXSCREENS]; - -static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr); -static void XineramaChangeGC(GCPtr, unsigned long); -static void XineramaCopyGC(GCPtr, unsigned long, GCPtr); -static void XineramaDestroyGC(GCPtr); -static void XineramaChangeClip(GCPtr, int, pointer, int); -static void XineramaDestroyClip(GCPtr); -static void XineramaCopyClip(GCPtr, GCPtr); - -GCFuncs XineramaGCFuncs = { - XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC, - XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip -}; - -#define Xinerama_GC_FUNC_PROLOGUE(pGC)\ - PanoramiXGCPtr pGCPriv = \ - (PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\ - (pGC)->funcs = pGCPriv->wrapFuncs; - -#define Xinerama_GC_FUNC_EPILOGUE(pGC)\ - pGCPriv->wrapFuncs = (pGC)->funcs;\ - (pGC)->funcs = &XineramaGCFuncs; - - -static Bool -XineramaCloseScreen (int i, ScreenPtr pScreen) -{ - PanoramiXScreenPtr pScreenPriv = - (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr; - - pScreen->CloseScreen = pScreenPriv->CloseScreen; - pScreen->CreateGC = pScreenPriv->CreateGC; - - REGION_UNINIT(pScreen, &XineramaScreenRegions[pScreen->myNum]); - if (pScreen->myNum == 0) - REGION_UNINIT(pScreen, &PanoramiXScreenRegion); - - xfree ((pointer) pScreenPriv); - - return (*pScreen->CloseScreen) (i, pScreen); -} - -Bool -XineramaCreateGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - PanoramiXScreenPtr pScreenPriv = - (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr; - Bool ret; - - pScreen->CreateGC = pScreenPriv->CreateGC; - if((ret = (*pScreen->CreateGC)(pGC))) { - PanoramiXGCPtr pGCPriv = - (PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr; - - pGCPriv->wrapFuncs = pGC->funcs; - pGC->funcs = &XineramaGCFuncs; - - pGCPriv->clipOrg.x = pGC->clipOrg.x; - pGCPriv->clipOrg.y = pGC->clipOrg.y; - pGCPriv->patOrg.x = pGC->patOrg.x; - pGCPriv->patOrg.y = pGC->patOrg.y; - } - pScreen->CreateGC = XineramaCreateGC; - - return ret; -} - -static void -XineramaValidateGC( - GCPtr pGC, - unsigned long changes, - DrawablePtr pDraw -){ - Xinerama_GC_FUNC_PROLOGUE (pGC); - - if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) { - /* the root window */ - int x_off = panoramiXdataPtr[pGC->pScreen->myNum].x; - int y_off = panoramiXdataPtr[pGC->pScreen->myNum].y; - int new_val; - - new_val = pGCPriv->clipOrg.x - x_off; - if(pGC->clipOrg.x != new_val) { - pGC->clipOrg.x = new_val; - changes |= GCClipXOrigin; - } - new_val = pGCPriv->clipOrg.y - y_off; - if(pGC->clipOrg.y != new_val) { - pGC->clipOrg.y = new_val; - changes |= GCClipYOrigin; - } - new_val = pGCPriv->patOrg.x - x_off; - if(pGC->patOrg.x != new_val) { - pGC->patOrg.x = new_val; - changes |= GCTileStipXOrigin; - } - new_val = pGCPriv->patOrg.y - y_off; - if(pGC->patOrg.y != new_val) { - pGC->patOrg.y = new_val; - changes |= GCTileStipYOrigin; - } - } else { - if(pGC->clipOrg.x != pGCPriv->clipOrg.x) { - pGC->clipOrg.x = pGCPriv->clipOrg.x; - changes |= GCClipXOrigin; - } - if(pGC->clipOrg.y != pGCPriv->clipOrg.y) { - pGC->clipOrg.y = pGCPriv->clipOrg.y; - changes |= GCClipYOrigin; - } - if(pGC->patOrg.x != pGCPriv->patOrg.x) { - pGC->patOrg.x = pGCPriv->patOrg.x; - changes |= GCTileStipXOrigin; - } - if(pGC->patOrg.y != pGCPriv->patOrg.y) { - pGC->patOrg.y = pGCPriv->patOrg.y; - changes |= GCTileStipYOrigin; - } - } - - (*pGC->funcs->ValidateGC)(pGC, changes, pDraw); - Xinerama_GC_FUNC_EPILOGUE (pGC); -} - -static void -XineramaDestroyGC(GCPtr pGC) -{ - Xinerama_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->DestroyGC)(pGC); - Xinerama_GC_FUNC_EPILOGUE (pGC); -} - -static void -XineramaChangeGC ( - GCPtr pGC, - unsigned long mask -){ - Xinerama_GC_FUNC_PROLOGUE (pGC); - - if(mask & GCTileStipXOrigin) - pGCPriv->patOrg.x = pGC->patOrg.x; - if(mask & GCTileStipYOrigin) - pGCPriv->patOrg.y = pGC->patOrg.y; - if(mask & GCClipXOrigin) - pGCPriv->clipOrg.x = pGC->clipOrg.x; - if(mask & GCClipYOrigin) - pGCPriv->clipOrg.y = pGC->clipOrg.y; - - (*pGC->funcs->ChangeGC) (pGC, mask); - Xinerama_GC_FUNC_EPILOGUE (pGC); -} - -static void -XineramaCopyGC ( - GCPtr pGCSrc, - unsigned long mask, - GCPtr pGCDst -){ - PanoramiXGCPtr pSrcPriv = - (PanoramiXGCPtr) pGCSrc->devPrivates[PanoramiXGCIndex].ptr; - Xinerama_GC_FUNC_PROLOGUE (pGCDst); - - if(mask & GCTileStipXOrigin) - pGCPriv->patOrg.x = pSrcPriv->patOrg.x; - if(mask & GCTileStipYOrigin) - pGCPriv->patOrg.y = pSrcPriv->patOrg.y; - if(mask & GCClipXOrigin) - pGCPriv->clipOrg.x = pSrcPriv->clipOrg.x; - if(mask & GCClipYOrigin) - pGCPriv->clipOrg.y = pSrcPriv->clipOrg.y; - - (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst); - Xinerama_GC_FUNC_EPILOGUE (pGCDst); -} - -static void -XineramaChangeClip ( - GCPtr pGC, - int type, - pointer pvalue, - int nrects -){ - Xinerama_GC_FUNC_PROLOGUE (pGC); - (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects); - Xinerama_GC_FUNC_EPILOGUE (pGC); -} - -static void -XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc) -{ - Xinerama_GC_FUNC_PROLOGUE (pgcDst); - (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc); - Xinerama_GC_FUNC_EPILOGUE (pgcDst); -} - -static void -XineramaDestroyClip(GCPtr pGC) -{ - Xinerama_GC_FUNC_PROLOGUE (pGC); - (* pGC->funcs->DestroyClip)(pGC); - Xinerama_GC_FUNC_EPILOGUE (pGC); -} - - - -int -XineramaDeleteResource(pointer data, XID id) -{ - xfree(data); - return 1; -} - - -static Bool -XineramaFindIDOnAnyScreen(pointer resource, XID id, pointer privdata) -{ - PanoramiXRes *res = (PanoramiXRes*)resource; - int j; - - FOR_NSCREENS(j) - if(res->info[j].id == *((XID*)privdata)) return TRUE; - - return FALSE; -} - -PanoramiXRes * -PanoramiXFindIDOnAnyScreen(RESTYPE type, XID id) -{ - return LookupClientResourceComplex(clients[CLIENT_ID(id)], type, - XineramaFindIDOnAnyScreen, &id); -} - -typedef struct { - int screen; - int id; -} PanoramiXSearchData; - - -static Bool -XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata) -{ - PanoramiXRes *res = (PanoramiXRes*)resource; - PanoramiXSearchData *data = (PanoramiXSearchData*)privdata; - - return (res->info[data->screen].id == data->id); -} - -PanoramiXRes * -PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen) -{ - PanoramiXSearchData data; - - if(!screen) - return LookupIDByType(id, type); - - data.screen = screen; - data.id = id; - - return LookupClientResourceComplex(clients[CLIENT_ID(id)], type, - XineramaFindIDByScrnum, &data); -} - -WindowPtr -PanoramiXChangeWindow(int ScrnNum, WindowPtr pWin) -{ - int num = pWin->drawable.pScreen->myNum; - - if(num != ScrnNum) { - PanoramiXRes *win; - - win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, num); - - if (win) - pWin = (WindowPtr) LookupIDByType(win->info[ScrnNum].id, RT_WINDOW); - } - - return pWin; -} - -typedef struct _connect_callback_list { - void (*func)(void); - struct _connect_callback_list *next; -} XineramaConnectionCallbackList; - -static XineramaConnectionCallbackList *ConnectionCallbackList = NULL; - -Bool -XineramaRegisterConnectionBlockCallback(void (*func)(void)) -{ - XineramaConnectionCallbackList *newlist; - - if(!(newlist = xalloc(sizeof(XineramaConnectionCallbackList)))) - return FALSE; - - newlist->next = ConnectionCallbackList; - newlist->func = func; - ConnectionCallbackList = newlist; - - return TRUE; -} - -/* - * PanoramiXExtensionInit(): - * Called from InitExtensions in main(). - * Register PanoramiXeen Extension - * Initialize global variables. - */ - -void PanoramiXExtensionInit(int argc, char *argv[]) -{ - int i; - Bool success = FALSE; - ExtensionEntry *extEntry; - ScreenPtr pScreen = screenInfo.screens[0]; - PanoramiXScreenPtr pScreenPriv; - int w, h; - - if (noPanoramiXExtension) - return; - - GlobalScrInfo = &screenInfo; /* For debug visibility */ - PanoramiXNumScreens = screenInfo.numScreens; - if (PanoramiXNumScreens == 1) { /* Only 1 screen */ - noPanoramiXExtension = TRUE; - return; - } - - while (panoramiXGeneration != serverGeneration) { - extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0, - ProcPanoramiXDispatch, - SProcPanoramiXDispatch, PanoramiXResetProc, - StandardMinorOpcode); - if (!extEntry) { - ErrorF("PanoramiXExtensionInit(): failed to AddExtension\n"); - break; - } - -#if 0 - PanoramiXReqCode = (unsigned char)extEntry->base; -#endif - - /* - * First make sure all the basic allocations succeed. If not, - * run in non-PanoramiXeen mode. - */ - - panoramiXdataPtr = (PanoramiXData *) - xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData)); - - BREAK_IF(!panoramiXdataPtr); - BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0); - BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0); - - for (i = 0; i < PanoramiXNumScreens; i++) { - pScreen = screenInfo.screens[i]; - if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex, - sizeof(PanoramiXGCRec))) { - noPanoramiXExtension = TRUE; - return; - } - - pScreenPriv = xalloc(sizeof(PanoramiXScreenRec)); - pScreen->devPrivates[PanoramiXScreenIndex].ptr = - (pointer)pScreenPriv; - if(!pScreenPriv) { - noPanoramiXExtension = TRUE; - return; - } - - pScreenPriv->CreateGC = pScreen->CreateGC; - pScreenPriv->CloseScreen = pScreen->CloseScreen; - - pScreen->CreateGC = XineramaCreateGC; - pScreen->CloseScreen = XineramaCloseScreen; - } - - XRC_DRAWABLE = CreateNewResourceClass(); - XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource) | - XRC_DRAWABLE; - XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource) | - XRC_DRAWABLE; - XRT_GC = CreateNewResourceType(XineramaDeleteResource); - XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource); - - panoramiXGeneration = serverGeneration; - success = TRUE; - } - - if (!success) { - noPanoramiXExtension = TRUE; - ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME); - return; - } - - - REGION_NULL(pScreen, &PanoramiXScreenRegion); - for (i = 0; i < PanoramiXNumScreens; i++) { - BoxRec TheBox; - - pScreen = screenInfo.screens[i]; - - panoramiXdataPtr[i].x = dixScreenOrigins[i].x; - panoramiXdataPtr[i].y = dixScreenOrigins[i].y; - panoramiXdataPtr[i].width = pScreen->width; - panoramiXdataPtr[i].height = pScreen->height; - - TheBox.x1 = panoramiXdataPtr[i].x; - TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width; - TheBox.y1 = panoramiXdataPtr[i].y; - TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height; - - REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1); - REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion, - &XineramaScreenRegions[i]); - } - - - PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width; - PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height; - - for (i = 1; i < PanoramiXNumScreens; i++) { - w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width; - h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height; - - if(PanoramiXPixWidth < w) - PanoramiXPixWidth = w; - if(PanoramiXPixHeight < h) - PanoramiXPixHeight = h; - } - - /* - * Put our processes into the ProcVector - */ - - for (i = 256; i--; ) - SavedProcVector[i] = ProcVector[i]; - - ProcVector[X_CreateWindow] = PanoramiXCreateWindow; - ProcVector[X_ChangeWindowAttributes] = PanoramiXChangeWindowAttributes; - ProcVector[X_DestroyWindow] = PanoramiXDestroyWindow; - ProcVector[X_DestroySubwindows] = PanoramiXDestroySubwindows; - ProcVector[X_ChangeSaveSet] = PanoramiXChangeSaveSet; - ProcVector[X_ReparentWindow] = PanoramiXReparentWindow; - ProcVector[X_MapWindow] = PanoramiXMapWindow; - ProcVector[X_MapSubwindows] = PanoramiXMapSubwindows; - ProcVector[X_UnmapWindow] = PanoramiXUnmapWindow; - ProcVector[X_UnmapSubwindows] = PanoramiXUnmapSubwindows; - ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow; - ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow; - ProcVector[X_GetGeometry] = PanoramiXGetGeometry; - ProcVector[X_TranslateCoords] = PanoramiXTranslateCoords; - ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap; - ProcVector[X_FreePixmap] = PanoramiXFreePixmap; - ProcVector[X_CreateGC] = PanoramiXCreateGC; - ProcVector[X_ChangeGC] = PanoramiXChangeGC; - ProcVector[X_CopyGC] = PanoramiXCopyGC; - ProcVector[X_SetDashes] = PanoramiXSetDashes; - ProcVector[X_SetClipRectangles] = PanoramiXSetClipRectangles; - ProcVector[X_FreeGC] = PanoramiXFreeGC; - ProcVector[X_ClearArea] = PanoramiXClearToBackground; - ProcVector[X_CopyArea] = PanoramiXCopyArea;; - ProcVector[X_CopyPlane] = PanoramiXCopyPlane;; - ProcVector[X_PolyPoint] = PanoramiXPolyPoint; - ProcVector[X_PolyLine] = PanoramiXPolyLine; - ProcVector[X_PolySegment] = PanoramiXPolySegment; - ProcVector[X_PolyRectangle] = PanoramiXPolyRectangle; - ProcVector[X_PolyArc] = PanoramiXPolyArc; - ProcVector[X_FillPoly] = PanoramiXFillPoly; - ProcVector[X_PolyFillRectangle] = PanoramiXPolyFillRectangle; - ProcVector[X_PolyFillArc] = PanoramiXPolyFillArc; - ProcVector[X_PutImage] = PanoramiXPutImage; - ProcVector[X_GetImage] = PanoramiXGetImage; - ProcVector[X_PolyText8] = PanoramiXPolyText8; - ProcVector[X_PolyText16] = PanoramiXPolyText16; - ProcVector[X_ImageText8] = PanoramiXImageText8; - ProcVector[X_ImageText16] = PanoramiXImageText16; - ProcVector[X_CreateColormap] = PanoramiXCreateColormap; - ProcVector[X_FreeColormap] = PanoramiXFreeColormap; - ProcVector[X_CopyColormapAndFree] = PanoramiXCopyColormapAndFree; - ProcVector[X_InstallColormap] = PanoramiXInstallColormap; - ProcVector[X_UninstallColormap] = PanoramiXUninstallColormap; - ProcVector[X_AllocColor] = PanoramiXAllocColor; - ProcVector[X_AllocNamedColor] = PanoramiXAllocNamedColor; - ProcVector[X_AllocColorCells] = PanoramiXAllocColorCells; - ProcVector[X_AllocColorPlanes] = PanoramiXAllocColorPlanes; - ProcVector[X_FreeColors] = PanoramiXFreeColors; - ProcVector[X_StoreColors] = PanoramiXStoreColors; - ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor; - -#ifdef RENDER - PanoramiXRenderInit (); -#endif -} - -extern Bool CreateConnectionBlock(void); - -Bool PanoramiXCreateConnectionBlock(void) -{ - int i, j, length; - Bool disableBackingStore = FALSE; - Bool disableSaveUnders = FALSE; - int old_width, old_height; - float width_mult, height_mult; - xWindowRoot *root; - xVisualType *visual; - xDepth *depth; - VisualPtr pVisual; - ScreenPtr pScreen; - - /* - * Do normal CreateConnectionBlock but faking it for only one screen - */ - - if(!PanoramiXNumDepths) { - ErrorF("PanoramiX error: Incompatible screens. No common visuals\n"); - return FALSE; - } - - for(i = 1; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) { - ErrorF("PanoramiX error: Incompatible screens. Root window depths differ\n"); - return FALSE; - } - if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport) - disableBackingStore = TRUE; - if(pScreen->saveUnderSupport != screenInfo.screens[0]->saveUnderSupport) - disableSaveUnders = TRUE; - } - - if(disableBackingStore || disableSaveUnders) { - for(i = 0; i < screenInfo.numScreens; i++) { - pScreen = screenInfo.screens[i]; - if(disableBackingStore) - pScreen->backingStoreSupport = NotUseful; - if(disableSaveUnders) - pScreen->saveUnderSupport = NotUseful; - } - } - - i = screenInfo.numScreens; - screenInfo.numScreens = 1; - if (!CreateConnectionBlock()) { - screenInfo.numScreens = i; - return FALSE; - } - - screenInfo.numScreens = i; - - root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart); - length = connBlockScreenStart + sizeof(xWindowRoot); - - /* overwrite the connection block */ - root->nDepths = PanoramiXNumDepths; - - for (i = 0; i < PanoramiXNumDepths; i++) { - depth = (xDepth *) (ConnectionInfo + length); - depth->depth = PanoramiXDepths[i].depth; - depth->nVisuals = PanoramiXDepths[i].numVids; - length += sizeof(xDepth); - visual = (xVisualType *)(ConnectionInfo + length); - - for (j = 0; j < depth->nVisuals; j++, visual++) { - visual->visualID = PanoramiXDepths[i].vids[j]; - - for (pVisual = PanoramiXVisuals; - pVisual->vid != visual->visualID; - pVisual++) - ; - - visual->class = pVisual->class; - visual->bitsPerRGB = pVisual->bitsPerRGBValue; - visual->colormapEntries = pVisual->ColormapEntries; - visual->redMask = pVisual->redMask; - visual->greenMask = pVisual->greenMask; - visual->blueMask = pVisual->blueMask; - } - - length += (depth->nVisuals * sizeof(xVisualType)); - } - - connSetupPrefix.length = length >> 2; - - xfree(PanoramiXVisuals); - for (i = 0; i < PanoramiXNumDepths; i++) - xfree(PanoramiXDepths[i].vids); - xfree(PanoramiXDepths); - - /* - * OK, change some dimensions so it looks as if it were one big screen - */ - - old_width = root->pixWidth; - old_height = root->pixHeight; - - root->pixWidth = PanoramiXPixWidth; - root->pixHeight = PanoramiXPixHeight; - width_mult = (1.0 * root->pixWidth) / old_width; - height_mult = (1.0 * root->pixHeight) / old_height; - root->mmWidth *= width_mult; - root->mmHeight *= height_mult; - - while(ConnectionCallbackList) { - pointer tmp; - - tmp = (pointer)ConnectionCallbackList; - (*ConnectionCallbackList->func)(); - ConnectionCallbackList = ConnectionCallbackList->next; - xfree(tmp); - } - - return TRUE; -} - -extern -void PanoramiXConsolidate(void) -{ - int i, j, k; - VisualPtr pVisual, pVisual2; - ScreenPtr pScreen, pScreen2; - DepthPtr pDepth, pDepth2; - PanoramiXRes *root, *defmap, *saver; - Bool foundDepth, missingDepth; - - if(!PanoramiXVisualTable) - PanoramiXVisualTable = xcalloc(256 * MAXSCREENS, sizeof(XID)); - - pScreen = screenInfo.screens[0]; - pVisual = pScreen->visuals; - pDepth = pScreen->allowedDepths; - - PanoramiXNumDepths = 0; - PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec)); - PanoramiXNumVisuals = 0; - PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec)); - - for (i = 0; i < pScreen->numDepths; i++, pDepth++) { - missingDepth = FALSE; - for (j = 1; j < PanoramiXNumScreens; j++) { - pScreen2 = screenInfo.screens[j]; - pDepth2 = pScreen2->allowedDepths; - - foundDepth = FALSE; - for (k = 0; k < pScreen2->numDepths; k++, pDepth2++) { - if(pDepth2->depth == pDepth->depth) { - foundDepth = TRUE; - break; - } - } - - if(!foundDepth) { - missingDepth = TRUE; - break; - } - } - - if(!missingDepth) { - PanoramiXDepths[PanoramiXNumDepths].depth = pDepth->depth; - PanoramiXDepths[PanoramiXNumDepths].numVids = 0; - if(pDepth->numVids) - PanoramiXDepths[PanoramiXNumDepths].vids = - xalloc(sizeof(VisualID) * pDepth->numVids); - else - PanoramiXDepths[PanoramiXNumDepths].vids = NULL; - PanoramiXNumDepths++; - } - } - - for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { - PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = pVisual->vid; - - /* check if the visual exists on all screens */ - for (j = 1; j < PanoramiXNumScreens; j++) { - pScreen2 = screenInfo.screens[j]; - pVisual2 = pScreen2->visuals; - - for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) { - if ((pVisual->class == pVisual2->class) && - (pVisual->ColormapEntries == pVisual2->ColormapEntries) && - (pVisual->nplanes == pVisual2->nplanes) && - (pVisual->redMask == pVisual2->redMask) && - (pVisual->greenMask == pVisual2->greenMask) && - (pVisual->blueMask == pVisual2->blueMask) && - (pVisual->offsetRed == pVisual2->offsetRed) && - (pVisual->offsetGreen == pVisual2->offsetGreen) && - (pVisual->offsetBlue == pVisual2->offsetBlue)) - { - /* We merely assign the first visual that matches. OpenGL - will need to get involved at some point if you want - match GLX visuals */ - PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = - pVisual2->vid; - break; - } - } - } - - /* if it doesn't exist on all screens we can't use it */ - for (j = 0; j < PanoramiXNumScreens; j++) { - if (!PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j]) { - PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = 0; - break; - } - } - - /* if it does, make sure it's in the list of supported depths and visuals */ - if(PanoramiXVisualTable[pVisual->vid * MAXSCREENS]) { - PanoramiXVisuals[PanoramiXNumVisuals].vid = pVisual->vid; - PanoramiXVisuals[PanoramiXNumVisuals].class = pVisual->class; - PanoramiXVisuals[PanoramiXNumVisuals].bitsPerRGBValue = pVisual->bitsPerRGBValue; - PanoramiXVisuals[PanoramiXNumVisuals].ColormapEntries = pVisual->ColormapEntries; - PanoramiXVisuals[PanoramiXNumVisuals].nplanes = pVisual->nplanes; - PanoramiXVisuals[PanoramiXNumVisuals].redMask = pVisual->redMask; - PanoramiXVisuals[PanoramiXNumVisuals].greenMask = pVisual->greenMask; - PanoramiXVisuals[PanoramiXNumVisuals].blueMask = pVisual->blueMask; - PanoramiXVisuals[PanoramiXNumVisuals].offsetRed = pVisual->offsetRed; - PanoramiXVisuals[PanoramiXNumVisuals].offsetGreen = pVisual->offsetGreen; - PanoramiXVisuals[PanoramiXNumVisuals].offsetBlue = pVisual->offsetBlue; - PanoramiXNumVisuals++; - - for (j = 0; j < PanoramiXNumDepths; j++) { - if (PanoramiXDepths[j].depth == pVisual->nplanes) { - PanoramiXDepths[j].vids[PanoramiXDepths[j].numVids] = pVisual->vid; - PanoramiXDepths[j].numVids++; - break; - } - } - } - } - - - root = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)); - root->type = XRT_WINDOW; - defmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)); - defmap->type = XRT_COLORMAP; - saver = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)); - saver->type = XRT_WINDOW; - - - for (i = 0; i < PanoramiXNumScreens; i++) { - root->info[i].id = WindowTable[i]->drawable.id; - root->u.win.class = InputOutput; - root->u.win.root = TRUE; - saver->info[i].id = savedScreenInfo[i].wid; - saver->u.win.class = InputOutput; - saver->u.win.root = TRUE; - defmap->info[i].id = (screenInfo.screens[i])->defColormap; - } - - AddResource(root->info[0].id, XRT_WINDOW, root); - AddResource(saver->info[0].id, XRT_WINDOW, saver); - AddResource(defmap->info[0].id, XRT_COLORMAP, defmap); -} - - -/* - * PanoramiXResetProc() - * Exit, deallocating as needed. - */ - -static void PanoramiXResetProc(ExtensionEntry* extEntry) -{ - int i; - -#ifdef RENDER - PanoramiXRenderReset (); -#endif - screenInfo.numScreens = PanoramiXNumScreens; - for (i = 256; i--; ) - ProcVector[i] = SavedProcVector[i]; - - Xfree(panoramiXdataPtr); -} - - -int -ProcPanoramiXQueryVersion (ClientPtr client) -{ - /* REQUEST(xPanoramiXQueryVersionReq); */ - xPanoramiXQueryVersionReply rep; - register int n; - - REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = PANORAMIX_MAJOR_VERSION; - rep.minorVersion = PANORAMIX_MINOR_VERSION; - if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.majorVersion, n); - swaps(&rep.minorVersion, n); - } - WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), (char *)&rep); - return (client->noClientException); -} - -int -ProcPanoramiXGetState(ClientPtr client) -{ - REQUEST(xPanoramiXGetStateReq); - WindowPtr pWin; - xPanoramiXGetStateReply rep; - register int n; - - REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.state = !noPanoramiXExtension; - if (client->swapped) { - swaps (&rep.sequenceNumber, n); - swapl (&rep.length, n); - swaps (&rep.state, n); - } - WriteToClient (client, sizeof (xPanoramiXGetStateReply), (char *) &rep); - return client->noClientException; - -} - -int -ProcPanoramiXGetScreenCount(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenCountReq); - WindowPtr pWin; - xPanoramiXGetScreenCountReply rep; - register int n; - - REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.ScreenCount = PanoramiXNumScreens; - if (client->swapped) { - swaps (&rep.sequenceNumber, n); - swapl (&rep.length, n); - swaps (&rep.ScreenCount, n); - } - WriteToClient (client, sizeof (xPanoramiXGetScreenCountReply), (char *) &rep); - return client->noClientException; -} - -int -ProcPanoramiXGetScreenSize(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenSizeReq); - WindowPtr pWin; - xPanoramiXGetScreenSizeReply rep; - register int n; - - REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - pWin = LookupWindow (stuff->window, client); - if (!pWin) - return BadWindow; - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - /* screen dimensions */ - rep.width = panoramiXdataPtr[stuff->screen].width; - rep.height = panoramiXdataPtr[stuff->screen].height; - if (client->swapped) { - swaps (&rep.sequenceNumber, n); - swapl (&rep.length, n); - swaps (&rep.width, n); - swaps (&rep.height, n); - } - WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), (char *) &rep); - return client->noClientException; -} - - -int -ProcXineramaIsActive(ClientPtr client) -{ - /* REQUEST(xXineramaIsActiveReq); */ - xXineramaIsActiveReply rep; - - REQUEST_SIZE_MATCH(xXineramaIsActiveReq); - - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.state = !noPanoramiXExtension; - if (client->swapped) { - register int n; - swaps (&rep.sequenceNumber, n); - swapl (&rep.length, n); - swapl (&rep.state, n); - } - WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep); - return client->noClientException; -} - - -int -ProcXineramaQueryScreens(ClientPtr client) -{ - /* REQUEST(xXineramaQueryScreensReq); */ - xXineramaQueryScreensReply rep; - - REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); - - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens; - rep.length = rep.number * sz_XineramaScreenInfo >> 2; - if (client->swapped) { - register int n; - swaps (&rep.sequenceNumber, n); - swapl (&rep.length, n); - swapl (&rep.number, n); - } - WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep); - - if(!noPanoramiXExtension) { - xXineramaScreenInfo scratch; - int i; - - for(i = 0; i < PanoramiXNumScreens; i++) { - scratch.x_org = panoramiXdataPtr[i].x; - scratch.y_org = panoramiXdataPtr[i].y; - scratch.width = panoramiXdataPtr[i].width; - scratch.height = panoramiXdataPtr[i].height; - - if(client->swapped) { - register int n; - swaps (&scratch.x_org, n); - swaps (&scratch.y_org, n); - swaps (&scratch.width, n); - swaps (&scratch.height, n); - } - WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch); - } - } - - return client->noClientException; -} - - -static int -ProcPanoramiXDispatch (ClientPtr client) -{ REQUEST(xReq); - switch (stuff->data) - { - case X_PanoramiXQueryVersion: - return ProcPanoramiXQueryVersion(client); - case X_PanoramiXGetState: - return ProcPanoramiXGetState(client); - case X_PanoramiXGetScreenCount: - return ProcPanoramiXGetScreenCount(client); - case X_PanoramiXGetScreenSize: - return ProcPanoramiXGetScreenSize(client); - case X_XineramaIsActive: - return ProcXineramaIsActive(client); - case X_XineramaQueryScreens: - return ProcXineramaQueryScreens(client); - } - return BadRequest; -} - - -#if X_BYTE_ORDER == X_LITTLE_ENDIAN -#define SHIFT_L(v,s) (v) << (s) -#define SHIFT_R(v,s) (v) >> (s) -#else -#define SHIFT_L(v,s) (v) >> (s) -#define SHIFT_R(v,s) (v) << (s) -#endif - -static void -CopyBits(char *dst, int shiftL, char *src, int bytes) -{ - /* Just get it to work. Worry about speed later */ - int shiftR = 8 - shiftL; - - while(bytes--) { - *dst |= SHIFT_L(*src, shiftL); - *(dst + 1) |= SHIFT_R(*src, shiftR); - dst++; src++; - } -} - - -/* Caution. This doesn't support 2 and 4 bpp formats. We expect - 1 bpp and planar data to be already cleared when presented - to this function */ - -void -XineramaGetImageData( - DrawablePtr *pDrawables, - int left, - int top, - int width, - int height, - unsigned int format, - unsigned long planemask, - char *data, - int pitch, - Bool isRoot -){ - RegionRec SrcRegion, GrabRegion; - BoxRec SrcBox, *pbox; - int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth; - DrawablePtr pDraw = pDrawables[0]; - ScreenPtr pScreen = pDraw->pScreen; - char *ScratchMem = NULL; - - size = 0; - - /* find box in logical screen space */ - SrcBox.x1 = left; - SrcBox.y1 = top; - if(!isRoot) { - SrcBox.x1 += pDraw->x + panoramiXdataPtr[0].x; - SrcBox.y1 += pDraw->y + panoramiXdataPtr[0].y; - } - SrcBox.x2 = SrcBox.x1 + width; - SrcBox.y2 = SrcBox.y1 + height; - - REGION_INIT(pScreen, &SrcRegion, &SrcBox, 1); - REGION_NULL(pScreen, &GrabRegion); - - depth = (format == XYPixmap) ? 1 : pDraw->depth; - - for(i = 0; i < PanoramiXNumScreens; i++) { - pDraw = pDrawables[i]; - - inOut = RECT_IN_REGION(pScreen,&XineramaScreenRegions[i],&SrcBox); - - if(inOut == rgnIN) { - (*pDraw->pScreen->GetImage)(pDraw, - SrcBox.x1 - pDraw->x - panoramiXdataPtr[i].x, - SrcBox.y1 - pDraw->y - panoramiXdataPtr[i].y, - width, height, format, planemask, data); - break; - } else if (inOut == rgnOUT) - continue; - - REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion, - &XineramaScreenRegions[i]); - - nbox = REGION_NUM_RECTS(&GrabRegion); - - if(nbox) { - pbox = REGION_RECTS(&GrabRegion); - - while(nbox--) { - w = pbox->x2 - pbox->x1; - h = pbox->y2 - pbox->y1; - ScratchPitch = PixmapBytePad(w, depth); - sizeNeeded = ScratchPitch * h; - - if(sizeNeeded > size) { - char *tmpdata = ScratchMem; - ScratchMem = xrealloc(ScratchMem, sizeNeeded); - if(ScratchMem) - size = sizeNeeded; - else { - ScratchMem = tmpdata; - break; - } - } - - x = pbox->x1 - pDraw->x - panoramiXdataPtr[i].x; - y = pbox->y1 - pDraw->y - panoramiXdataPtr[i].y; - - (*pDraw->pScreen->GetImage)(pDraw, x, y, w, h, - format, planemask, ScratchMem); - - /* copy the memory over */ - - if(depth == 1) { - int k, shift, leftover, index, index2; - - x = pbox->x1 - SrcBox.x1; - y = pbox->y1 - SrcBox.y1; - shift = x & 7; - x >>= 3; - leftover = w & 7; - w >>= 3; - - /* clean up the edge */ - if(leftover) { - int mask = (1 << leftover) - 1; - for(j = h, k = w; j--; k += ScratchPitch) - ScratchMem[k] &= mask; - } - - for(j = 0, index = (pitch * y) + x, index2 = 0; j < h; - j++, index += pitch, index2 += ScratchPitch) - { - if(w) { - if(!shift) - memcpy(data + index, ScratchMem + index2, w); - else - CopyBits(data + index, shift, - ScratchMem + index2, w); - } - - if(leftover) { - data[index + w] |= - SHIFT_L(ScratchMem[index2 + w], shift); - if((shift + leftover) > 8) - data[index + w + 1] |= - SHIFT_R(ScratchMem[index2 + w],(8 - shift)); - } - } - } else { - j = BitsPerPixel(depth) >> 3; - x = (pbox->x1 - SrcBox.x1) * j; - y = pbox->y1 - SrcBox.y1; - w *= j; - - for(j = 0; j < h; j++) { - memcpy(data + (pitch * (y + j)) + x, - ScratchMem + (ScratchPitch * j), w); - } - } - pbox++; - } - - REGION_SUBTRACT(pScreen, &SrcRegion, &SrcRegion, &GrabRegion); - if(!REGION_NOTEMPTY(pScreen, &SrcRegion)) - break; - } - - } - - if(ScratchMem) - xfree(ScratchMem); - - REGION_UNINIT(pScreen, &SrcRegion); - REGION_UNINIT(pScreen, &GrabRegion); -} diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h deleted file mode 100644 index d01b0b854..000000000 --- a/Xext/panoramiX.h +++ /dev/null @@ -1,102 +0,0 @@ -/* $TOG: panoramiX.h /main/4 1998/03/17 06:51:02 kaleb $ */ -/**************************************************************** -* * -* Copyright (c) Digital Equipment Corporation, 1991, 1997 * -* * -* All Rights Reserved. Unpublished rights reserved under * -* the copyright laws of the United States. * -* * -* The software contained on this media is proprietary to * -* and embodies the confidential technology of Digital * -* Equipment Corporation. Possession, use, duplication or * -* dissemination of the software and media is authorized only * -* pursuant to a valid written license from Digital Equipment * -* Corporation. * -* * -* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure * -* by the U.S. Government is subject to restrictions as set * -* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, * -* or in FAR 52.227-19, as applicable. * -* * -*****************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/panoramiX.h,v 1.6 2003/03/23 04:56:02 mvojkovi Exp $ */ - -/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ - -/* - * PanoramiX definitions - */ - -#ifndef _PANORAMIX_H_ -#define _PANORAMIX_H_ - -#include "panoramiXext.h" -#include "gcstruct.h" - - -typedef struct _PanoramiXData { - int x; - int y; - int width; - int height; -} PanoramiXData; - -typedef struct _PanoramiXInfo { - XID id ; -} PanoramiXInfo; - -typedef struct { - PanoramiXInfo info[MAXSCREENS]; - RESTYPE type; - union { - struct { - char visibility; - char class; - char root; - } win; - struct { - Bool shared; - } pix; -#ifdef RENDER - struct { - Bool root; - } pict; -#endif - char raw_data[4]; - } u; -} PanoramiXRes; - -#define FOR_NSCREENS_FORWARD(j) for(j = 0; j < PanoramiXNumScreens; j++) -#define FOR_NSCREENS_BACKWARD(j) for(j = PanoramiXNumScreens - 1; j >= 0; j--) -#define FOR_NSCREENS(j) FOR_NSCREENS_FORWARD(j) - -#define BREAK_IF(a) if ((a)) break -#define IF_RETURN(a,b) if ((a)) return (b) - -#define FORCE_ROOT(a) { \ - int _j; \ - for (_j = PanoramiXNumScreens - 1; _j; _j--) \ - if ((a).root == WindowTable[_j]->drawable.id) \ - break; \ - (a).rootX += panoramiXdataPtr[_j].x; \ - (a).rootY += panoramiXdataPtr[_j].y; \ - (a).root = WindowTable[0]->drawable.id; \ -} - -#define FORCE_WIN(a) { \ - if ((win = PanoramiXFindIDOnAnyScreen(XRT_WINDOW, a))) { \ - (a) = win->info[0].id; /* Real ID */ \ - } \ -} - -#define FORCE_CMAP(a) { \ - if ((win = PanoramiXFindIDOnAnyScreen(XRT_COLORMAP, a))) { \ - (a) = win->info[0].id; /* Real ID */ \ - } \ -} - -#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared) - -#define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return - -#endif /* _PANORAMIX_H_ */ diff --git a/Xext/panoramiXSwap.c b/Xext/panoramiXSwap.c deleted file mode 100644 index e3ea803e6..000000000 --- a/Xext/panoramiXSwap.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $Xorg: panoramiXSwap.c,v 1.4 2000/08/17 19:47:57 cpqbld Exp $ */ -/***************************************************************** -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. -******************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXSwap.c,v 3.10 2003/09/13 21:33:03 dawes Exp $ */ - -#include -#include "X.h" -#include "Xproto.h" -#include "misc.h" -#include "cursor.h" -#include "cursorstr.h" -#include "extnsionst.h" -#include "dixstruct.h" -#include "gc.h" -#include "gcstruct.h" -#include "scrnintstr.h" -#include "window.h" -#include "windowstr.h" -#include "pixmapstr.h" -#if 0 -#include -#include -#endif -#include "panoramiX.h" -#include "panoramiXproto.h" -#include "panoramiXsrv.h" -#include "globals.h" -#include "panoramiXh.h" - -static int -SProcPanoramiXQueryVersion (ClientPtr client) -{ - REQUEST(xPanoramiXQueryVersionReq); - register int n; - - swaps(&stuff->length,n); - REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq); - return ProcPanoramiXQueryVersion(client); -} - -static int -SProcPanoramiXGetState(ClientPtr client) -{ - REQUEST(xPanoramiXGetStateReq); - register int n; - - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - return ProcPanoramiXGetState(client); -} - -static int -SProcPanoramiXGetScreenCount(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenCountReq); - register int n; - - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - return ProcPanoramiXGetScreenCount(client); -} - -static int -SProcPanoramiXGetScreenSize(ClientPtr client) -{ - REQUEST(xPanoramiXGetScreenSizeReq); - register int n; - - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - return ProcPanoramiXGetScreenSize(client); -} - - -static int -SProcXineramaIsActive(ClientPtr client) -{ - REQUEST(xXineramaIsActiveReq); - register int n; - - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xXineramaIsActiveReq); - return ProcXineramaIsActive(client); -} - - -static int -SProcXineramaQueryScreens(ClientPtr client) -{ - REQUEST(xXineramaQueryScreensReq); - register int n; - - swaps (&stuff->length, n); - REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); - return ProcXineramaQueryScreens(client); -} - - -int -SProcPanoramiXDispatch (ClientPtr client) -{ REQUEST(xReq); - switch (stuff->data) - { - case X_PanoramiXQueryVersion: - return SProcPanoramiXQueryVersion(client); - case X_PanoramiXGetState: - return SProcPanoramiXGetState(client); - case X_PanoramiXGetScreenCount: - return SProcPanoramiXGetScreenCount(client); - case X_PanoramiXGetScreenSize: - return SProcPanoramiXGetScreenSize(client); - case X_XineramaIsActive: - return SProcXineramaIsActive(client); - case X_XineramaQueryScreens: - return SProcXineramaQueryScreens(client); - } - return BadRequest; -} diff --git a/Xext/panoramiXh.h b/Xext/panoramiXh.h deleted file mode 100644 index d15fc8002..000000000 --- a/Xext/panoramiXh.h +++ /dev/null @@ -1,78 +0,0 @@ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXh.h,v 1.3 2003/11/17 22:20:26 dawes Exp $ */ - -/* - * Server dispatcher function replacements - */ - -extern int PanoramiXCreateWindow(ClientPtr client); -extern int PanoramiXChangeWindowAttributes(ClientPtr client); -extern int PanoramiXDestroyWindow(ClientPtr client); -extern int PanoramiXDestroySubwindows(ClientPtr client); -extern int PanoramiXChangeSaveSet(ClientPtr client); -extern int PanoramiXReparentWindow(ClientPtr client); -extern int PanoramiXMapWindow(ClientPtr client); -extern int PanoramiXMapSubwindows(ClientPtr client); -extern int PanoramiXUnmapWindow(ClientPtr client); -extern int PanoramiXUnmapSubwindows(ClientPtr client); -extern int PanoramiXConfigureWindow(ClientPtr client); -extern int PanoramiXCirculateWindow(ClientPtr client); -extern int PanoramiXGetGeometry(ClientPtr client); -extern int PanoramiXTranslateCoords(ClientPtr client); -extern int PanoramiXCreatePixmap(ClientPtr client); -extern int PanoramiXFreePixmap(ClientPtr client); -extern int PanoramiXCreateGC(ClientPtr client); -extern int PanoramiXChangeGC(ClientPtr client); -extern int PanoramiXCopyGC(ClientPtr client); -extern int PanoramiXCopyColormapAndFree(ClientPtr client); -extern int PanoramiXSetDashes(ClientPtr client); -extern int PanoramiXSetClipRectangles(ClientPtr client); -extern int PanoramiXFreeGC(ClientPtr client); -extern int PanoramiXClearToBackground(ClientPtr client); -extern int PanoramiXCopyArea(ClientPtr client); -extern int PanoramiXCopyPlane(ClientPtr client); -extern int PanoramiXPolyPoint(ClientPtr client); -extern int PanoramiXPolyLine(ClientPtr client); -extern int PanoramiXPolySegment(ClientPtr client); -extern int PanoramiXPolyRectangle(ClientPtr client); -extern int PanoramiXPolyArc(ClientPtr client); -extern int PanoramiXFillPoly(ClientPtr client); -extern int PanoramiXPolyFillArc(ClientPtr client); -extern int PanoramiXPolyFillRectangle(ClientPtr client); -extern int PanoramiXPutImage(ClientPtr client); -extern int PanoramiXGetImage(ClientPtr client); -extern int PanoramiXPolyText8(ClientPtr client); -extern int PanoramiXPolyText16(ClientPtr client); -extern int PanoramiXImageText8(ClientPtr client); -extern int PanoramiXImageText16(ClientPtr client); -extern int PanoramiXCreateColormap(ClientPtr client); -extern int PanoramiXFreeColormap(ClientPtr client); -extern int PanoramiXInstallColormap(ClientPtr client); -extern int PanoramiXUninstallColormap(ClientPtr client); -extern int PanoramiXAllocColor(ClientPtr client); -extern int PanoramiXAllocNamedColor(ClientPtr client); -extern int PanoramiXAllocColorCells(ClientPtr client); -extern int PanoramiXStoreNamedColor(ClientPtr client); -extern int PanoramiXFreeColors(ClientPtr client); -extern int PanoramiXStoreColors(ClientPtr client); -extern int PanoramiXAllocColorPlanes(ClientPtr client); - -#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr) - -PROC_EXTERN(ProcPanoramiXQueryVersion); -PROC_EXTERN(ProcPanoramiXGetState); -PROC_EXTERN(ProcPanoramiXGetScreenCount); -PROC_EXTERN(ProcPanoramiXGetScreenSize); - -PROC_EXTERN(ProcXineramaQueryScreens); -PROC_EXTERN(ProcXineramaIsActive); -extern Bool XineramaCreateGC(GCPtr pGC); - -extern int SProcPanoramiXDispatch(ClientPtr client); - -extern char *ConnectionInfo; -extern int connBlockScreenStart; -extern xConnSetupPrefix connSetupPrefix; - -extern ScreenInfo *GlobalScrInfo; -extern int (* SavedProcVector[256]) (ClientPtr client); - diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c deleted file mode 100644 index 73a441a88..000000000 --- a/Xext/panoramiXprocs.c +++ /dev/null @@ -1,2368 +0,0 @@ -/* $Xorg: panoramiXprocs.c,v 1.5 2000/08/17 19:47:57 cpqbld Exp $ */ -/***************************************************************** -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. -******************************************************************/ - -/* Massively rewritten by Mark Vojkovich */ - -/* $XFree86: xc/programs/Xserver/Xext/panoramiXprocs.c,v 3.37 2003/11/10 18:21:43 tsi Exp $ */ - -#include -#include "X.h" -#define NEED_REPLIES -#define NEED_EVENTS -#include "Xproto.h" -#include "windowstr.h" -#include "dixfontstr.h" -#include "gcstruct.h" -#include "colormapst.h" -#include "scrnintstr.h" -#include "opaque.h" -#include "inputstr.h" -#include "migc.h" -#include "misc.h" -#include "dixstruct.h" -#include "panoramiX.h" -#include "panoramiXsrv.h" -#include "resource.h" -#include "panoramiXh.h" - -#define XINERAMA_IMAGE_BUFSIZE (256*1024) -#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \ - CWDontPropagate | CWOverrideRedirect | CWCursor ) - -#if 0 -extern void (* EventSwapVector[128]) (fsError *, fsError *); - -extern void Swap32Write(); -extern void SLHostsExtend(); -extern void SQColorsExtend(); -WriteSConnectionInfo(); -extern void WriteSConnSetupPrefix(); -#endif - -/* Various of the DIX function interfaces were not designed to allow - * the client->errorValue to be set on BadValue and other errors. - * Rather than changing interfaces and breaking untold code we introduce - * a new global that dispatch can use. - */ -extern XID clientErrorValue; /* XXX this is a kludge */ - -int PanoramiXCreateWindow(ClientPtr client) -{ - PanoramiXRes *parent, *newWin; - PanoramiXRes *backPix = NULL; - PanoramiXRes *bordPix = NULL; - PanoramiXRes *cmap = NULL; - REQUEST(xCreateWindowReq); - int pback_offset = 0, pbord_offset = 0, cmap_offset = 0; - int result = 0, len, j; - int orig_x, orig_y; - XID orig_visual, tmp; - Bool parentIsRoot; - - REQUEST_AT_LEAST_SIZE(xCreateWindowReq); - - len = client->req_len - (sizeof(xCreateWindowReq) >> 2); - if (Ones(stuff->mask) != len) - return BadLength; - - if (!(parent = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->parent, XRT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - if(stuff->class == CopyFromParent) - stuff->class = parent->u.win.class; - - if((stuff->class == InputOnly) && (stuff->mask & (~INPUTONLY_LEGAL_MASK))) - return BadMatch; - - if ((Mask)stuff->mask & CWBackPixmap) { - pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1)); - tmp = *((CARD32 *) &stuff[1] + pback_offset); - if ((tmp != None) && (tmp != ParentRelative)) { - if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->mask & CWBorderPixmap) { - pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1)); - tmp = *((CARD32 *) &stuff[1] + pbord_offset); - if (tmp != CopyFromParent) { - if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->mask & CWColormap) { - cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1)); - tmp = *((CARD32 *) &stuff[1] + cmap_offset); - if ((tmp != CopyFromParent) && (tmp != None)) { - if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, SecurityReadAccess))) - return BadColor; - } - } - - if(!(newWin = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) - return BadAlloc; - - newWin->type = XRT_WINDOW; - newWin->u.win.visibility = VisibilityNotViewable; - newWin->u.win.class = stuff->class; - newWin->u.win.root = FALSE; - newWin->info[0].id = stuff->wid; - for(j = 1; j < PanoramiXNumScreens; j++) - newWin->info[j].id = FakeClientID(client->index); - - if (stuff->class == InputOnly) - stuff->visual = CopyFromParent; - orig_visual = stuff->visual; - orig_x = stuff->x; - orig_y = stuff->y; - parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || - (stuff->parent == savedScreenInfo[0].wid); - FOR_NSCREENS_BACKWARD(j) { - stuff->wid = newWin->info[j].id; - stuff->parent = parent->info[j].id; - if (parentIsRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; - } - if (backPix) - *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id; - if (bordPix) - *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id; - if (cmap) - *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id; - if ( orig_visual != CopyFromParent ) - stuff->visual = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + j]; - result = (*SavedProcVector[X_CreateWindow])(client); - if(result != Success) break; - } - - if (result == Success) - AddResource(newWin->info[0].id, XRT_WINDOW, newWin); - else - xfree(newWin); - - return (result); -} - - -int PanoramiXChangeWindowAttributes(ClientPtr client) -{ - PanoramiXRes *win; - PanoramiXRes *backPix = NULL; - PanoramiXRes *bordPix = NULL; - PanoramiXRes *cmap = NULL; - REQUEST(xChangeWindowAttributesReq); - int pback_offset = 0, pbord_offset = 0, cmap_offset = 0; - int result = 0, len, j; - XID tmp; - - REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - - len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); - if (Ones(stuff->valueMask) != len) - return BadLength; - - if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - if((win->u.win.class == InputOnly) && - (stuff->valueMask & (~INPUTONLY_LEGAL_MASK))) - return BadMatch; - - if ((Mask)stuff->valueMask & CWBackPixmap) { - pback_offset = Ones((Mask)stuff->valueMask & (CWBackPixmap - 1)); - tmp = *((CARD32 *) &stuff[1] + pback_offset); - if ((tmp != None) && (tmp != ParentRelative)) { - if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->valueMask & CWBorderPixmap) { - pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1)); - tmp = *((CARD32 *) &stuff[1] + pbord_offset); - if (tmp != CopyFromParent) { - if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->valueMask & CWColormap) { - cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1)); - tmp = *((CARD32 *) &stuff[1] + cmap_offset); - if ((tmp != CopyFromParent) && (tmp != None)) { - if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, SecurityReadAccess))) - return BadColor; - } - } - - FOR_NSCREENS_BACKWARD(j) { - stuff->window = win->info[j].id; - if (backPix) - *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id; - if (bordPix) - *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id; - if (cmap) - *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id; - result = (*SavedProcVector[X_ChangeWindowAttributes])(client); - } - - return (result); -} - - -int PanoramiXDestroyWindow(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityDestroyAccess))) - return BadWindow; - - FOR_NSCREENS_BACKWARD(j) { - stuff->id = win->info[j].id; - result = (*SavedProcVector[X_DestroyWindow])(client); - if(result != Success) break; - } - - /* Since ProcDestroyWindow is using FreeResource, it will free - our resource for us on the last pass through the loop above */ - - return (result); -} - - -int PanoramiXDestroySubwindows(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityDestroyAccess))) - return BadWindow; - - FOR_NSCREENS_BACKWARD(j) { - stuff->id = win->info[j].id; - result = (*SavedProcVector[X_DestroySubwindows])(client); - if(result != Success) break; - } - - /* DestroySubwindows is using FreeResource which will free - our resources for us on the last pass through the loop above */ - - return (result); -} - - -int PanoramiXChangeSaveSet(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xChangeSaveSetReq); - - REQUEST_SIZE_MATCH(xChangeSaveSetReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityReadAccess))) - return BadWindow; - - FOR_NSCREENS_BACKWARD(j) { - stuff->window = win->info[j].id; - result = (*SavedProcVector[X_ChangeSaveSet])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXReparentWindow(ClientPtr client) -{ - PanoramiXRes *win, *parent; - int result = 0, j; - int x, y; - Bool parentIsRoot; - REQUEST(xReparentWindowReq); - - REQUEST_SIZE_MATCH(xReparentWindowReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - if(!(parent = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->parent, XRT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - x = stuff->x; - y = stuff->y; - parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || - (stuff->parent == savedScreenInfo[0].wid); - FOR_NSCREENS_BACKWARD(j) { - stuff->window = win->info[j].id; - stuff->parent = parent->info[j].id; - if(parentIsRoot) { - stuff->x = x - panoramiXdataPtr[j].x; - stuff->y = y - panoramiXdataPtr[j].y; - } - result = (*SavedProcVector[X_ReparentWindow])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXMapWindow(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) - return BadWindow; - - FOR_NSCREENS_FORWARD(j) { - stuff->id = win->info[j].id; - result = (*SavedProcVector[X_MapWindow])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXMapSubwindows(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) - return BadWindow; - - FOR_NSCREENS_FORWARD(j) { - stuff->id = win->info[j].id; - result = (*SavedProcVector[X_MapSubwindows])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXUnmapWindow(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) - return BadWindow; - - FOR_NSCREENS_FORWARD(j) { - stuff->id = win->info[j].id; - result = (*SavedProcVector[X_UnmapWindow])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXUnmapSubwindows(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, SecurityReadAccess))) - return BadWindow; - - FOR_NSCREENS_FORWARD(j) { - stuff->id = win->info[j].id; - result = (*SavedProcVector[X_UnmapSubwindows])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXConfigureWindow(ClientPtr client) -{ - PanoramiXRes *win; - PanoramiXRes *sib = NULL; - WindowPtr pWin; - int result = 0, j, len, sib_offset = 0, x = 0, y = 0; - int x_offset = -1; - int y_offset = -1; - REQUEST(xConfigureWindowReq); - - REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); - - len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); - if (Ones(stuff->mask) != len) - return BadLength; - - /* because we need the parent */ - if (!(pWin = (WindowPtr)SecurityLookupIDByType( - client, stuff->window, RT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - if ((Mask)stuff->mask & CWSibling) { - XID tmp; - sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1)); - if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) { - if(!(sib = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_WINDOW, SecurityReadAccess))) - return BadWindow; - } - } - - if(pWin->parent && ((pWin->parent == WindowTable[0]) || - (pWin->parent->drawable.id == savedScreenInfo[0].wid))) - { - if ((Mask)stuff->mask & CWX) { - x_offset = 0; - x = *((CARD32 *)&stuff[1]); - } - if ((Mask)stuff->mask & CWY) { - y_offset = (x_offset == -1) ? 0 : 1; - y = *((CARD32 *) &stuff[1] + y_offset); - } - } - - /* have to go forward or you get expose events before - ConfigureNotify events */ - FOR_NSCREENS_FORWARD(j) { - stuff->window = win->info[j].id; - if(sib) - *((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id; - if(x_offset >= 0) - *((CARD32 *) &stuff[1] + x_offset) = x - panoramiXdataPtr[j].x; - if(y_offset >= 0) - *((CARD32 *) &stuff[1] + y_offset) = y - panoramiXdataPtr[j].y; - result = (*SavedProcVector[X_ConfigureWindow])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXCirculateWindow(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j; - REQUEST(xCirculateWindowReq); - - REQUEST_SIZE_MATCH(xCirculateWindowReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - FOR_NSCREENS_FORWARD(j) { - stuff->window = win->info[j].id; - result = (*SavedProcVector[X_CirculateWindow])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXGetGeometry(ClientPtr client) -{ - xGetGeometryReply rep; - DrawablePtr pDraw; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - VERIFY_GEOMETRABLE (pDraw, stuff->id, client); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.root = WindowTable[0]->drawable.id; - rep.depth = pDraw->depth; - rep.width = pDraw->width; - rep.height = pDraw->height; - rep.x = rep.y = rep.borderWidth = 0; - - if (stuff->id == rep.root) { - xWindowRoot *root = (xWindowRoot *) - (ConnectionInfo + connBlockScreenStart); - - rep.width = root->pixWidth; - rep.height = root->pixHeight; - } else - if ((pDraw->type == UNDRAWABLE_WINDOW) || (pDraw->type == DRAWABLE_WINDOW)) - { - WindowPtr pWin = (WindowPtr)pDraw; - rep.x = pWin->origin.x - wBorderWidth (pWin); - rep.y = pWin->origin.y - wBorderWidth (pWin); - if((pWin->parent == WindowTable[0]) || - (pWin->parent->drawable.id == savedScreenInfo[0].wid)) - { - rep.x += panoramiXdataPtr[0].x; - rep.y += panoramiXdataPtr[0].y; - } - rep.borderWidth = pWin->borderWidth; - } - - WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); - return (client->noClientException); -} - -int PanoramiXTranslateCoords(ClientPtr client) -{ - INT16 x, y; - REQUEST(xTranslateCoordsReq); - - register WindowPtr pWin, pDst; - xTranslateCoordsReply rep; - - REQUEST_SIZE_MATCH(xTranslateCoordsReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - SecurityReadAccess); - if (!pWin) - return(BadWindow); - pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - SecurityReadAccess); - if (!pDst) - return(BadWindow); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.sameScreen = xTrue; - rep.child = None; - - if((pWin == WindowTable[0]) || - (pWin->drawable.id == savedScreenInfo[0].wid)) - { - x = stuff->srcX - panoramiXdataPtr[0].x; - y = stuff->srcY - panoramiXdataPtr[0].y; - } else { - x = pWin->drawable.x + stuff->srcX; - y = pWin->drawable.y + stuff->srcY; - } - pWin = pDst->firstChild; - while (pWin) { -#ifdef SHAPE - BoxRec box; -#endif - if ((pWin->mapped) && - (x >= pWin->drawable.x - wBorderWidth (pWin)) && - (x < pWin->drawable.x + (int)pWin->drawable.width + - wBorderWidth (pWin)) && - (y >= pWin->drawable.y - wBorderWidth (pWin)) && - (y < pWin->drawable.y + (int)pWin->drawable.height + - wBorderWidth (pWin)) -#ifdef SHAPE - /* When a window is shaped, a further check - * is made to see if the point is inside - * borderSize - */ - && (!wBoundingShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, - wBoundingShape(pWin), - x - pWin->drawable.x, - y - pWin->drawable.y, &box)) -#endif - ) - { - rep.child = pWin->drawable.id; - pWin = (WindowPtr) NULL; - } - else - pWin = pWin->nextSib; - } - rep.dstX = x - pDst->drawable.x; - rep.dstY = y - pDst->drawable.y; - if((pDst == WindowTable[0]) || - (pDst->drawable.id == savedScreenInfo[0].wid)) - { - rep.dstX += panoramiXdataPtr[0].x; - rep.dstY += panoramiXdataPtr[0].y; - } - - WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep); - return(client->noClientException); -} - -int PanoramiXCreatePixmap(ClientPtr client) -{ - PanoramiXRes *refDraw, *newPix; - int result = 0, j; - REQUEST(xCreatePixmapReq); - - REQUEST_SIZE_MATCH(xCreatePixmapReq); - client->errorValue = stuff->pid; - - if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess))) - return BadDrawable; - - if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) - return BadAlloc; - - newPix->type = XRT_PIXMAP; - newPix->u.pix.shared = FALSE; - newPix->info[0].id = stuff->pid; - for(j = 1; j < PanoramiXNumScreens; j++) - newPix->info[j].id = FakeClientID(client->index); - - FOR_NSCREENS_BACKWARD(j) { - stuff->pid = newPix->info[j].id; - stuff->drawable = refDraw->info[j].id; - result = (*SavedProcVector[X_CreatePixmap])(client); - if(result != Success) break; - } - - if (result == Success) - AddResource(newPix->info[0].id, XRT_PIXMAP, newPix); - else - xfree(newPix); - - return (result); -} - - -int PanoramiXFreePixmap(ClientPtr client) -{ - PanoramiXRes *pix; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - client->errorValue = stuff->id; - - if(!(pix = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_PIXMAP, SecurityDestroyAccess))) - return BadPixmap; - - FOR_NSCREENS_BACKWARD(j) { - stuff->id = pix->info[j].id; - result = (*SavedProcVector[X_FreePixmap])(client); - if(result != Success) break; - } - - /* Since ProcFreePixmap is using FreeResource, it will free - our resource for us on the last pass through the loop above */ - - return (result); -} - - -int PanoramiXCreateGC(ClientPtr client) -{ - PanoramiXRes *refDraw; - PanoramiXRes *newGC; - PanoramiXRes *stip = NULL; - PanoramiXRes *tile = NULL; - PanoramiXRes *clip = NULL; - REQUEST(xCreateGCReq); - int tile_offset = 0, stip_offset = 0, clip_offset = 0; - int result = 0, len, j; - XID tmp; - - REQUEST_AT_LEAST_SIZE(xCreateGCReq); - - client->errorValue = stuff->gc; - len = client->req_len - (sizeof(xCreateGCReq) >> 2); - if (Ones(stuff->mask) != len) - return BadLength; - - if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess))) - return BadDrawable; - - if ((Mask)stuff->mask & GCTile) { - tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); - if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { - if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->mask & GCStipple) { - stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); - if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { - if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->mask & GCClipMask) { - clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); - if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { - if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - - if(!(newGC = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) - return BadAlloc; - - newGC->type = XRT_GC; - newGC->info[0].id = stuff->gc; - for(j = 1; j < PanoramiXNumScreens; j++) - newGC->info[j].id = FakeClientID(client->index); - - FOR_NSCREENS_BACKWARD(j) { - stuff->gc = newGC->info[j].id; - stuff->drawable = refDraw->info[j].id; - if (tile) - *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id; - if (stip) - *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id; - if (clip) - *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id; - result = (*SavedProcVector[X_CreateGC])(client); - if(result != Success) break; - } - - if (result == Success) - AddResource(newGC->info[0].id, XRT_GC, newGC); - else - xfree(newGC); - - return (result); -} - -int PanoramiXChangeGC(ClientPtr client) -{ - PanoramiXRes *gc; - PanoramiXRes *stip = NULL; - PanoramiXRes *tile = NULL; - PanoramiXRes *clip = NULL; - REQUEST(xChangeGCReq); - int tile_offset = 0, stip_offset = 0, clip_offset = 0; - int result = 0, len, j; - XID tmp; - - REQUEST_AT_LEAST_SIZE(xChangeGCReq); - - len = client->req_len - (sizeof(xChangeGCReq) >> 2); - if (Ones(stuff->mask) != len) - return BadLength; - - if (!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - if ((Mask)stuff->mask & GCTile) { - tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); - if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { - if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->mask & GCStipple) { - stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); - if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { - if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - if ((Mask)stuff->mask & GCClipMask) { - clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); - if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { - if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, SecurityReadAccess))) - return BadPixmap; - } - } - - - FOR_NSCREENS_BACKWARD(j) { - stuff->gc = gc->info[j].id; - if (tile) - *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id; - if (stip) - *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id; - if (clip) - *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id; - result = (*SavedProcVector[X_ChangeGC])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXCopyGC(ClientPtr client) -{ - PanoramiXRes *srcGC, *dstGC; - int result = 0, j; - REQUEST(xCopyGCReq); - - REQUEST_SIZE_MATCH(xCopyGCReq); - - if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->srcGC, XRT_GC, SecurityReadAccess))) - return BadGC; - - if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dstGC, XRT_GC, SecurityWriteAccess))) - return BadGC; - - FOR_NSCREENS(j) { - stuff->srcGC = srcGC->info[j].id; - stuff->dstGC = dstGC->info[j].id; - result = (*SavedProcVector[X_CopyGC])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXSetDashes(ClientPtr client) -{ - PanoramiXRes *gc; - int result = 0, j; - REQUEST(xSetDashesReq); - - REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityWriteAccess))) - return BadGC; - - FOR_NSCREENS_BACKWARD(j) { - stuff->gc = gc->info[j].id; - result = (*SavedProcVector[X_SetDashes])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXSetClipRectangles(ClientPtr client) -{ - PanoramiXRes *gc; - int result = 0, j; - REQUEST(xSetClipRectanglesReq); - - REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityWriteAccess))) - return BadGC; - - FOR_NSCREENS_BACKWARD(j) { - stuff->gc = gc->info[j].id; - result = (*SavedProcVector[X_SetClipRectangles])(client); - if(result != Success) break; - } - - return (result); -} - - -int PanoramiXFreeGC(ClientPtr client) -{ - PanoramiXRes *gc; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_GC, SecurityDestroyAccess))) - return BadGC; - - FOR_NSCREENS_BACKWARD(j) { - stuff->id = gc->info[j].id; - result = (*SavedProcVector[X_FreeGC])(client); - if(result != Success) break; - } - - /* Since ProcFreeGC is using FreeResource, it will free - our resource for us on the last pass through the loop above */ - - return (result); -} - - -int PanoramiXClearToBackground(ClientPtr client) -{ - PanoramiXRes *win; - int result = 0, j, x, y; - Bool isRoot; - REQUEST(xClearAreaReq); - - REQUEST_SIZE_MATCH(xClearAreaReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityWriteAccess))) - return BadWindow; - - x = stuff->x; - y = stuff->y; - isRoot = win->u.win.root; - FOR_NSCREENS_BACKWARD(j) { - stuff->window = win->info[j].id; - if(isRoot) { - stuff->x = x - panoramiXdataPtr[j].x; - stuff->y = y - panoramiXdataPtr[j].y; - } - result = (*SavedProcVector[X_ClearArea])(client); - if(result != Success) break; - } - - return (result); -} - - -/* - For Window to Pixmap copies you're screwed since each screen's - pixmap will look like what it sees on its screen. Unless the - screens overlap and the window lies on each, the two copies - will be out of sync. To remedy this we do a GetImage and PutImage - in place of the copy. Doing this as a single Image isn't quite - correct since it will include the obscured areas but we will - have to fix this later. (MArk). -*/ - -int PanoramiXCopyArea(ClientPtr client) -{ - int j, result = 0, srcx, srcy, dstx, dsty; - PanoramiXRes *gc, *src, *dst; - Bool srcIsRoot = FALSE; - Bool dstIsRoot = FALSE; - Bool srcShared, dstShared; - REQUEST(xCopyAreaReq); - - REQUEST_SIZE_MATCH(xCopyAreaReq); - - if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess))) - return BadDrawable; - - srcShared = IS_SHARED_PIXMAP(src); - - if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - dstShared = IS_SHARED_PIXMAP(dst); - - if(dstShared && srcShared) - return (* SavedProcVector[X_CopyArea])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - if((dst->type == XRT_WINDOW) && dst->u.win.root) - dstIsRoot = TRUE; - if((src->type == XRT_WINDOW) && src->u.win.root) - srcIsRoot = TRUE; - - srcx = stuff->srcX; srcy = stuff->srcY; - dstx = stuff->dstX; dsty = stuff->dstY; - if((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) { - DrawablePtr drawables[MAXSCREENS]; - DrawablePtr pDst; - GCPtr pGC; - char *data; - int pitch; - - FOR_NSCREENS(j) - VERIFY_DRAWABLE(drawables[j], src->info[j].id, client); - - pitch = PixmapBytePad(stuff->width, drawables[0]->depth); - if(!(data = xcalloc(1, stuff->height * pitch))) - return BadAlloc; - - XineramaGetImageData(drawables, srcx, srcy, - stuff->width, stuff->height, ZPixmap, ~0, data, pitch, - srcIsRoot); - - FOR_NSCREENS_BACKWARD(j) { - stuff->gc = gc->info[j].id; - VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, pGC, client); - - if(drawables[0]->depth != pDst->depth) { - client->errorValue = stuff->dstDrawable; - xfree(data); - return (BadMatch); - } - - (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty, - stuff->width, stuff->height, - 0, ZPixmap, data); - - if(dstShared) break; - } - - xfree(data); - - result = Success; - } else { - DrawablePtr pDst = NULL, pSrc = NULL; - GCPtr pGC = NULL; - RegionPtr pRgn[MAXSCREENS]; - - FOR_NSCREENS_BACKWARD(j) { - stuff->dstDrawable = dst->info[j].id; - stuff->srcDrawable = src->info[j].id; - stuff->gc = gc->info[j].id; - if (srcIsRoot) { - stuff->srcX = srcx - panoramiXdataPtr[j].x; - stuff->srcY = srcy - panoramiXdataPtr[j].y; - } - if (dstIsRoot) { - stuff->dstX = dstx - panoramiXdataPtr[j].x; - stuff->dstY = dsty - panoramiXdataPtr[j].y; - } - - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); - if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client, - SecurityReadAccess); - if ((pDst->pScreen != pSrc->pScreen) || - (pDst->depth != pSrc->depth)) { - client->errorValue = stuff->dstDrawable; - return (BadMatch); - } - } else - pSrc = pDst; - - pRgn[j] = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, - stuff->srcX, stuff->srcY, - stuff->width, stuff->height, - stuff->dstX, stuff->dstY); - - if(dstShared) { - while(j--) pRgn[j] = NULL; - break; - } - } - - if(pGC->graphicsExposures) { - ScreenPtr pScreen = pDst->pScreen; - RegionRec totalReg; - Bool overlap; - - REGION_NULL(pScreen, &totalReg); - FOR_NSCREENS_BACKWARD(j) { - if(pRgn[j]) { - if(srcIsRoot) { - REGION_TRANSLATE(pScreen, pRgn[j], - panoramiXdataPtr[j].x, panoramiXdataPtr[j].y); - } - REGION_APPEND(pScreen, &totalReg, pRgn[j]); - REGION_DESTROY(pScreen, pRgn[j]); - } - } - REGION_VALIDATE(pScreen, &totalReg, &overlap); - (*pScreen->SendGraphicsExpose)( - client, &totalReg, stuff->dstDrawable, X_CopyArea, 0); - REGION_UNINIT(pScreen, &totalReg); - } - - result = client->noClientException; - } - - return (result); -} - - -int PanoramiXCopyPlane(ClientPtr client) -{ - int j, srcx, srcy, dstx, dsty; - PanoramiXRes *gc, *src, *dst; - Bool srcIsRoot = FALSE; - Bool dstIsRoot = FALSE; - Bool srcShared, dstShared; - DrawablePtr psrcDraw, pdstDraw = NULL; - GCPtr pGC = NULL; - RegionPtr pRgn[MAXSCREENS]; - REQUEST(xCopyPlaneReq); - - REQUEST_SIZE_MATCH(xCopyPlaneReq); - - if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess))) - return BadDrawable; - - srcShared = IS_SHARED_PIXMAP(src); - - if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - dstShared = IS_SHARED_PIXMAP(dst); - - if(dstShared && srcShared) - return (* SavedProcVector[X_CopyPlane])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - if((dst->type == XRT_WINDOW) && dst->u.win.root) - dstIsRoot = TRUE; - if((src->type == XRT_WINDOW) && src->u.win.root) - srcIsRoot = TRUE; - - srcx = stuff->srcX; srcy = stuff->srcY; - dstx = stuff->dstX; dsty = stuff->dstY; - - FOR_NSCREENS_BACKWARD(j) { - stuff->dstDrawable = dst->info[j].id; - stuff->srcDrawable = src->info[j].id; - stuff->gc = gc->info[j].id; - if (srcIsRoot) { - stuff->srcX = srcx - panoramiXdataPtr[j].x; - stuff->srcY = srcy - panoramiXdataPtr[j].y; - } - if (dstIsRoot) { - stuff->dstX = dstx - panoramiXdataPtr[j].x; - stuff->dstY = dsty - panoramiXdataPtr[j].y; - } - - VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client); - if (stuff->dstDrawable != stuff->srcDrawable) { - SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client, - SecurityReadAccess); - if (pdstDraw->pScreen != psrcDraw->pScreen) { - client->errorValue = stuff->dstDrawable; - return (BadMatch); - } - } else - psrcDraw = pdstDraw; - - if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) || - (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) { - client->errorValue = stuff->bitPlane; - return(BadValue); - } - - pRgn[j] = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, - stuff->srcX, stuff->srcY, - stuff->width, stuff->height, - stuff->dstX, stuff->dstY, stuff->bitPlane); - - if(dstShared) { - while(j--) pRgn[j] = NULL; - break; - } - } - - if(pGC->graphicsExposures) { - ScreenPtr pScreen = pdstDraw->pScreen; - RegionRec totalReg; - Bool overlap; - - REGION_NULL(pScreen, &totalReg); - FOR_NSCREENS_BACKWARD(j) { - if(pRgn[j]) { - REGION_APPEND(pScreen, &totalReg, pRgn[j]); - REGION_DESTROY(pScreen, pRgn[j]); - } - } - REGION_VALIDATE(pScreen, &totalReg, &overlap); - (*pScreen->SendGraphicsExpose)( - client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0); - REGION_UNINIT(pScreen, &totalReg); - } - - return (client->noClientException); -} - - -int PanoramiXPolyPoint(ClientPtr client) -{ - PanoramiXRes *gc, *draw; - int result = 0, npoint, j; - xPoint *origPts; - Bool isRoot; - REQUEST(xPolyPointReq); - - REQUEST_AT_LEAST_SIZE(xPolyPointReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyPoint])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2; - if (npoint > 0) { - origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint)); - memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - if(x_off || y_off) { - xPoint *pnts = (xPoint*)&stuff[1]; - int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint; - - while(i--) { - pnts->x -= x_off; - pnts->y -= y_off; - pnts++; - } - } - } - - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PolyPoint])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(origPts); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXPolyLine(ClientPtr client) -{ - PanoramiXRes *gc, *draw; - int result = 0, npoint, j; - xPoint *origPts; - Bool isRoot; - REQUEST(xPolyLineReq); - - REQUEST_AT_LEAST_SIZE(xPolyLineReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyLine])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2; - if (npoint > 0){ - origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint)); - memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - if(x_off || y_off) { - xPoint *pnts = (xPoint*)&stuff[1]; - int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint; - - while(i--) { - pnts->x -= x_off; - pnts->y -= y_off; - pnts++; - } - } - } - - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PolyLine])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(origPts); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXPolySegment(ClientPtr client) -{ - int result = 0, nsegs, i, j; - PanoramiXRes *gc, *draw; - xSegment *origSegs; - Bool isRoot; - REQUEST(xPolySegmentReq); - - REQUEST_AT_LEAST_SIZE(xPolySegmentReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolySegment])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq); - if(nsegs & 4) return BadLength; - nsegs >>= 3; - if (nsegs > 0) { - origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment)); - memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - if(x_off || y_off) { - xSegment *segs = (xSegment*)&stuff[1]; - - for (i = nsegs; i--; segs++) { - segs->x1 -= x_off; - segs->x2 -= x_off; - segs->y1 -= y_off; - segs->y2 -= y_off; - } - } - } - - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PolySegment])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(origSegs); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXPolyRectangle(ClientPtr client) -{ - int result = 0, nrects, i, j; - PanoramiXRes *gc, *draw; - Bool isRoot; - xRectangle *origRecs; - REQUEST(xPolyRectangleReq); - - REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); - - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyRectangle])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq); - if(nrects & 4) return BadLength; - nrects >>= 3; - if (nrects > 0){ - origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle)); - memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - - if(x_off || y_off) { - xRectangle *rects = (xRectangle *) &stuff[1]; - - for (i = nrects; i--; rects++) { - rects->x -= x_off; - rects->y -= y_off; - } - } - } - - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PolyRectangle])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(origRecs); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXPolyArc(ClientPtr client) -{ - int result = 0, narcs, i, j; - PanoramiXRes *gc, *draw; - Bool isRoot; - xArc *origArcs; - REQUEST(xPolyArcReq); - - REQUEST_AT_LEAST_SIZE(xPolyArcReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyArc])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - narcs = (client->req_len << 2) - sizeof(xPolyArcReq); - if(narcs % sizeof(xArc)) return BadLength; - narcs /= sizeof(xArc); - if (narcs > 0){ - origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc)); - memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - if(x_off || y_off) { - xArc *arcs = (xArc *) &stuff[1]; - - for (i = narcs; i--; arcs++) { - arcs->x -= x_off; - arcs->y -= y_off; - } - } - } - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PolyArc])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(origArcs); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXFillPoly(ClientPtr client) -{ - int result = 0, count, j; - PanoramiXRes *gc, *draw; - Bool isRoot; - DDXPointPtr locPts; - REQUEST(xFillPolyReq); - - REQUEST_AT_LEAST_SIZE(xFillPolyReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_FillPoly])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2; - if (count > 0){ - locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec)); - memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - if(x_off || y_off) { - DDXPointPtr pnts = (DDXPointPtr)&stuff[1]; - int i = (stuff->coordMode==CoordModePrevious) ? 1 : count; - - while(i--) { - pnts->x -= x_off; - pnts->y -= y_off; - pnts++; - } - } - } - - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_FillPoly])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(locPts); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXPolyFillRectangle(ClientPtr client) -{ - int result = 0, things, i, j; - PanoramiXRes *gc, *draw; - Bool isRoot; - xRectangle *origRects; - REQUEST(xPolyFillRectangleReq); - - REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyFillRectangle])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); - if(things & 4) return BadLength; - things >>= 3; - if (things > 0){ - origRects = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle)); - memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - if(x_off || y_off) { - xRectangle *rects = (xRectangle *) &stuff[1]; - - for (i = things; i--; rects++) { - rects->x -= x_off; - rects->y -= y_off; - } - } - } - - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PolyFillRectangle])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(origRects); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXPolyFillArc(ClientPtr client) -{ - PanoramiXRes *gc, *draw; - Bool isRoot; - int result = 0, narcs, i, j; - xArc *origArcs; - REQUEST(xPolyFillArcReq); - - REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyFillArc])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq); - IF_RETURN((narcs % sizeof(xArc)), BadLength); - narcs /= sizeof(xArc); - if (narcs > 0) { - origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc)); - memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc)); - FOR_NSCREENS_FORWARD(j){ - - if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc)); - - if (isRoot) { - int x_off = panoramiXdataPtr[j].x; - int y_off = panoramiXdataPtr[j].y; - - if(x_off || y_off) { - xArc *arcs = (xArc *) &stuff[1]; - - for (i = narcs; i--; arcs++) { - arcs->x -= x_off; - arcs->y -= y_off; - } - } - } - - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PolyFillArc])(client); - if(result != Success) break; - } - DEALLOCATE_LOCAL(origArcs); - return (result); - } else - return (client->noClientException); -} - - -int PanoramiXPutImage(ClientPtr client) -{ - PanoramiXRes *gc, *draw; - Bool isRoot; - int j, result = 0, orig_x, orig_y; - REQUEST(xPutImageReq); - - REQUEST_AT_LEAST_SIZE(xPutImageReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PutImage])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - orig_x = stuff->dstX; - orig_y = stuff->dstY; - FOR_NSCREENS_BACKWARD(j){ - if (isRoot) { - stuff->dstX = orig_x - panoramiXdataPtr[j].x; - stuff->dstY = orig_y - panoramiXdataPtr[j].y; - } - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - result = (* SavedProcVector[X_PutImage])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXGetImage(ClientPtr client) -{ - DrawablePtr drawables[MAXSCREENS]; - DrawablePtr pDraw; - PanoramiXRes *draw; - xGetImageReply xgi; - Bool isRoot; - char *pBuf; - int i, x, y, w, h, format; - Mask plane = 0, planemask; - int linesDone, nlines, linesPerBuf; - long widthBytesLine, length; - - REQUEST(xGetImageReq); - - REQUEST_SIZE_MATCH(xGetImageReq); - - if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) { - client->errorValue = stuff->format; - return(BadValue); - } - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(draw->type == XRT_PIXMAP) - return (*SavedProcVector[X_GetImage])(client); - - VERIFY_DRAWABLE(pDraw, stuff->drawable, client); - - if(!((WindowPtr)pDraw)->realized) - return(BadMatch); - - x = stuff->x; - y = stuff->y; - w = stuff->width; - h = stuff->height; - format = stuff->format; - planemask = stuff->planeMask; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - if(isRoot) { - if( /* check for being onscreen */ - x < 0 || x + w > PanoramiXPixWidth || - y < 0 || y + h > PanoramiXPixHeight ) - return(BadMatch); - } else { - if( /* check for being onscreen */ - panoramiXdataPtr[0].x + pDraw->x + x < 0 || - panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth || - panoramiXdataPtr[0].y + pDraw->y + y < 0 || - panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight || - /* check for being inside of border */ - x < - wBorderWidth((WindowPtr)pDraw) || - x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || - y < -wBorderWidth((WindowPtr)pDraw) || - y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height) - return(BadMatch); - } - - drawables[0] = pDraw; - for(i = 1; i < PanoramiXNumScreens; i++) - VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client); - - xgi.visual = wVisual (((WindowPtr) pDraw)); - xgi.type = X_Reply; - xgi.sequenceNumber = client->sequence; - xgi.depth = pDraw->depth; - if(format == ZPixmap) { - widthBytesLine = PixmapBytePad(w, pDraw->depth); - length = widthBytesLine * h; - - - } else { - widthBytesLine = BitmapBytePad(w); - plane = ((Mask)1) << (pDraw->depth - 1); - /* only planes asked for */ - length = widthBytesLine * h * - Ones(planemask & (plane | (plane - 1))); - - } - - xgi.length = (length + 3) >> 2; - - if (widthBytesLine == 0 || h == 0) - linesPerBuf = 0; - else if (widthBytesLine >= XINERAMA_IMAGE_BUFSIZE) - linesPerBuf = 1; - else { - linesPerBuf = XINERAMA_IMAGE_BUFSIZE / widthBytesLine; - if (linesPerBuf > h) - linesPerBuf = h; - } - length = linesPerBuf * widthBytesLine; - if(!(pBuf = xalloc(length))) - return (BadAlloc); - - WriteReplyToClient(client, sizeof (xGetImageReply), &xgi); - - if (linesPerBuf == 0) { - /* nothing to do */ - } - else if (format == ZPixmap) { - linesDone = 0; - while (h - linesDone > 0) { - nlines = min(linesPerBuf, h - linesDone); - - if(pDraw->depth == 1) - bzero(pBuf, nlines * widthBytesLine); - - XineramaGetImageData(drawables, x, y + linesDone, w, nlines, - format, planemask, pBuf, widthBytesLine, isRoot); - - (void)WriteToClient(client, - (int)(nlines * widthBytesLine), - pBuf); - linesDone += nlines; - } - } else { /* XYPixmap */ - for (; plane; plane >>= 1) { - if (planemask & plane) { - linesDone = 0; - while (h - linesDone > 0) { - nlines = min(linesPerBuf, h - linesDone); - - bzero(pBuf, nlines * widthBytesLine); - - XineramaGetImageData(drawables, x, y + linesDone, w, - nlines, format, plane, pBuf, - widthBytesLine, isRoot); - - (void)WriteToClient(client, - (int)(nlines * widthBytesLine), - pBuf); - - linesDone += nlines; - } - } - } - } - xfree(pBuf); - return (client->noClientException); -} - - -/* The text stuff should be rewritten so that duplication happens - at the GlyphBlt level. That is, loading the font and getting - the glyphs should only happen once */ - -int -PanoramiXPolyText8(ClientPtr client) -{ - PanoramiXRes *gc, *draw; - Bool isRoot; - int result = 0, j; - int orig_x, orig_y; - REQUEST(xPolyTextReq); - - REQUEST_AT_LEAST_SIZE(xPolyTextReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyText8])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - orig_x = stuff->x; - orig_y = stuff->y; - FOR_NSCREENS_BACKWARD(j){ - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; - } - result = (*SavedProcVector[X_PolyText8])(client); - if(result != Success) break; - } - return (result); -} - -int -PanoramiXPolyText16(ClientPtr client) -{ - PanoramiXRes *gc, *draw; - Bool isRoot; - int result = 0, j; - int orig_x, orig_y; - REQUEST(xPolyTextReq); - - REQUEST_AT_LEAST_SIZE(xPolyTextReq); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_PolyText16])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - orig_x = stuff->x; - orig_y = stuff->y; - FOR_NSCREENS_BACKWARD(j){ - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; - } - result = (*SavedProcVector[X_PolyText16])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXImageText8(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *gc, *draw; - Bool isRoot; - int orig_x, orig_y; - REQUEST(xImageTextReq); - - REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_ImageText8])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - orig_x = stuff->x; - orig_y = stuff->y; - FOR_NSCREENS_BACKWARD(j){ - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; - } - result = (*SavedProcVector[X_ImageText8])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXImageText16(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *gc, *draw; - Bool isRoot; - int orig_x, orig_y; - REQUEST(xImageTextReq); - - REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); - - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) - return BadDrawable; - - if(IS_SHARED_PIXMAP(draw)) - return (*SavedProcVector[X_ImageText16])(client); - - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, SecurityReadAccess))) - return BadGC; - - isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; - - orig_x = stuff->x; - orig_y = stuff->y; - FOR_NSCREENS_BACKWARD(j){ - stuff->drawable = draw->info[j].id; - stuff->gc = gc->info[j].id; - if (isRoot) { - stuff->x = orig_x - panoramiXdataPtr[j].x; - stuff->y = orig_y - panoramiXdataPtr[j].y; - } - result = (*SavedProcVector[X_ImageText16])(client); - if(result != Success) break; - } - return (result); -} - - - -int PanoramiXCreateColormap(ClientPtr client) -{ - PanoramiXRes *win, *newCmap; - int result = 0, j, orig_visual; - REQUEST(xCreateColormapReq); - - REQUEST_SIZE_MATCH(xCreateColormapReq); - - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, SecurityReadAccess))) - return BadWindow; - - if(!stuff->visual || (stuff->visual > 255)) - return BadValue; - - if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) - return BadAlloc; - - newCmap->type = XRT_COLORMAP; - newCmap->info[0].id = stuff->mid; - for(j = 1; j < PanoramiXNumScreens; j++) - newCmap->info[j].id = FakeClientID(client->index); - - orig_visual = stuff->visual; - FOR_NSCREENS_BACKWARD(j){ - stuff->mid = newCmap->info[j].id; - stuff->window = win->info[j].id; - stuff->visual = PanoramiXVisualTable[(orig_visual * MAXSCREENS) + j]; - result = (* SavedProcVector[X_CreateColormap])(client); - if(result != Success) break; - } - - if (result == Success) - AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap); - else - xfree(newCmap); - - return (result); -} - - -int PanoramiXFreeColormap(ClientPtr client) -{ - PanoramiXRes *cmap; - int result = 0, j; - REQUEST(xResourceReq); - - REQUEST_SIZE_MATCH(xResourceReq); - - client->errorValue = stuff->id; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, SecurityDestroyAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j) { - stuff->id = cmap->info[j].id; - result = (* SavedProcVector[X_FreeColormap])(client); - if(result != Success) break; - } - - /* Since ProcFreeColormap is using FreeResource, it will free - our resource for us on the last pass through the loop above */ - - return (result); -} - - -int -PanoramiXCopyColormapAndFree(ClientPtr client) -{ - PanoramiXRes *cmap, *newCmap; - int result = 0, j; - REQUEST(xCopyColormapAndFreeReq); - - REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); - - client->errorValue = stuff->srcCmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->srcCmap, XRT_COLORMAP, - SecurityReadAccess | SecurityWriteAccess))) - return BadColor; - - if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) - return BadAlloc; - - newCmap->type = XRT_COLORMAP; - newCmap->info[0].id = stuff->mid; - for(j = 1; j < PanoramiXNumScreens; j++) - newCmap->info[j].id = FakeClientID(client->index); - - FOR_NSCREENS_BACKWARD(j){ - stuff->srcCmap = cmap->info[j].id; - stuff->mid = newCmap->info[j].id; - result = (* SavedProcVector[X_CopyColormapAndFree])(client); - if(result != Success) break; - } - - if (result == Success) - AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap); - else - xfree(newCmap); - - return (result); -} - - -int PanoramiXInstallColormap(ClientPtr client) -{ - REQUEST(xResourceReq); - int result = 0, j; - PanoramiXRes *cmap; - - REQUEST_SIZE_MATCH(xResourceReq); - - client->errorValue = stuff->id; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, SecurityReadAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j){ - stuff->id = cmap->info[j].id; - result = (* SavedProcVector[X_InstallColormap])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXUninstallColormap(ClientPtr client) -{ - REQUEST(xResourceReq); - int result = 0, j; - PanoramiXRes *cmap; - - REQUEST_SIZE_MATCH(xResourceReq); - - client->errorValue = stuff->id; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, SecurityReadAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j) { - stuff->id = cmap->info[j].id; - result = (* SavedProcVector[X_UninstallColormap])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXAllocColor(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *cmap; - REQUEST(xAllocColorReq); - - REQUEST_SIZE_MATCH(xAllocColorReq); - - client->errorValue = stuff->cmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j){ - stuff->cmap = cmap->info[j].id; - result = (* SavedProcVector[X_AllocColor])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXAllocNamedColor(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *cmap; - REQUEST(xAllocNamedColorReq); - - REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes); - - client->errorValue = stuff->cmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j){ - stuff->cmap = cmap->info[j].id; - result = (* SavedProcVector[X_AllocNamedColor])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXAllocColorCells(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *cmap; - REQUEST(xAllocColorCellsReq); - - REQUEST_SIZE_MATCH(xAllocColorCellsReq); - - client->errorValue = stuff->cmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j){ - stuff->cmap = cmap->info[j].id; - result = (* SavedProcVector[X_AllocColorCells])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXAllocColorPlanes(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *cmap; - REQUEST(xAllocColorPlanesReq); - - REQUEST_SIZE_MATCH(xAllocColorPlanesReq); - - client->errorValue = stuff->cmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j){ - stuff->cmap = cmap->info[j].id; - result = (* SavedProcVector[X_AllocColorPlanes])(client); - if(result != Success) break; - } - return (result); -} - - - -int PanoramiXFreeColors(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *cmap; - REQUEST(xFreeColorsReq); - - REQUEST_AT_LEAST_SIZE(xFreeColorsReq); - - client->errorValue = stuff->cmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j) { - stuff->cmap = cmap->info[j].id; - result = (* SavedProcVector[X_FreeColors])(client); - } - return (result); -} - - -int PanoramiXStoreColors(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *cmap; - REQUEST(xStoreColorsReq); - - REQUEST_AT_LEAST_SIZE(xStoreColorsReq); - - client->errorValue = stuff->cmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j){ - stuff->cmap = cmap->info[j].id; - result = (* SavedProcVector[X_StoreColors])(client); - if(result != Success) break; - } - return (result); -} - - -int PanoramiXStoreNamedColor(ClientPtr client) -{ - int result = 0, j; - PanoramiXRes *cmap; - REQUEST(xStoreNamedColorReq); - - REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes); - - client->errorValue = stuff->cmap; - - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess))) - return BadColor; - - FOR_NSCREENS_BACKWARD(j){ - stuff->cmap = cmap->info[j].id; - result = (* SavedProcVector[X_StoreNamedColor])(client); - if(result != Success) break; - } - return (result); -} diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h deleted file mode 100644 index 27cbcda52..000000000 --- a/Xext/panoramiXsrv.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.9 2001/08/11 21:00:06 mvojkovi Exp $ */ - -#ifndef _PANORAMIXSRV_H_ -#define _PANORAMIXSRV_H_ - -#include "panoramiX.h" - -extern int PanoramiXNumScreens; -extern PanoramiXData *panoramiXdataPtr; -extern int PanoramiXPixWidth; -extern int PanoramiXPixHeight; -extern RegionRec PanoramiXScreenRegion; -extern XID *PanoramiXVisualTable; - -extern void PanoramiXConsolidate(void); -extern Bool PanoramiXCreateConnectionBlock(void); -extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int); -extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID); -extern WindowPtr PanoramiXChangeWindow(int, WindowPtr); -extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)); -extern int XineramaDeleteResource(pointer, XID); - -extern RegionRec XineramaScreenRegions[MAXSCREENS]; - -extern unsigned long XRC_DRAWABLE; -extern unsigned long XRT_WINDOW; -extern unsigned long XRT_PIXMAP; -extern unsigned long XRT_GC; -extern unsigned long XRT_COLORMAP; - -extern void XineramaGetImageData( - DrawablePtr *pDrawables, - int left, - int top, - int width, - int height, - unsigned int format, - unsigned long planemask, - char *data, - int pitch, - Bool isRoot -); - -#endif /* _PANORAMIXSRV_H_ */ diff --git a/Xext/xevie.c b/Xext/xevie.c new file mode 100644 index 000000000..76b5bca3b --- /dev/null +++ b/Xext/xevie.c @@ -0,0 +1,628 @@ +/************************************************************ + +Copyright 2003 Sun Microsystems, Inc. + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL +INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING +FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION +WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +************************************************************/ + +#define NEED_REPLIES +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" +#include "misc.h" +#include "dixstruct.h" +#include "extnsionst.h" +#include "colormapst.h" +#include "scrnintstr.h" +#include "servermd.h" +#include "opaque.h" +#define _XEVIE_SERVER_ +#include "Xeviestr.h" +#include "Xfuncproto.h" +#include "input.h" +#include "inputstr.h" +#include "windowstr.h" +#include "cursorstr.h" +#include "swaprep.h" +#include "xinerama.h" +#include "xineramaSrv.h" + +#ifndef EXTMODULE +#include "../os/osdep.h" +#else +#include "xf86_ansic.h" +#endif + +#if 0 +#define DEBUG +#endif + +#ifdef DEBUG +# define ERR(x) ErrorF(x) +#else +#define ERR +#endif + +static int xevieFlag = 0; +static int xevieClientIndex = 0; +static Mask xevieMask = 0; +static Bool xeviegrabState = FALSE; +static unsigned int xevieServerGeneration; +static int xevieDevicePrivateIndex; +static Bool xevieModifiersOn = FALSE; + +#define XEVIEINFO(dev) ((xevieDeviceInfoPtr)dev->devPrivates[xevieDevicePrivateIndex].ptr) +#define NoSuchEvent 0x80000000 + +Mask xevieFilters[128] = +{ + NoSuchEvent, /* 0 */ + NoSuchEvent, /* 1 */ + KeyPressMask, /* KeyPress */ + KeyReleaseMask, /* KeyRelease */ + ButtonPressMask, /* ButtonPress */ + ButtonReleaseMask, /* ButtonRelease */ + PointerMotionMask /* MotionNotify (initial state) */ +}; +#undef NoSuchEvent + +typedef struct { + ProcessInputProc processInputProc; + ProcessInputProc realInputProc; + DeviceUnwrapProc unwrapProc; +} xevieDeviceInfoRec, *xevieDeviceInfoPtr; + +static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr); +static void ResetProc (ExtensionEntry*); + +static unsigned char ReqCode = 0; +static int ErrorBase; + +static Bool XevieStart(void); +static void XevieEnd(int clientIndex); +static void XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata, + pointer calldata); +static void XevieServerGrabStateCallback(CallbackListPtr *pcbl, + pointer nulldata, + pointer calldata); + +static Bool XevieAdd(DeviceIntPtr device, pointer data); +static void XevieWrap(DeviceIntPtr device, ProcessInputProc proc); +static Bool XevieRemove(DeviceIntPtr device, pointer data); +static void doSendEvent(xEvent *xE, DeviceIntPtr device); +static void XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev, + int count); +static void XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count); + +void +XevieExtensionInit (INITARGS) +{ + ExtensionEntry* extEntry; + + if (serverGeneration != xevieServerGeneration) { + if ((xevieDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1) + return; + xevieServerGeneration = serverGeneration; + } + + if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL)) + return; + + if ((extEntry = AddExtension (XEVIENAME, + 0, + XevieNumberErrors, + ProcDispatch, + SProcDispatch, + ResetProc, + StandardMinorOpcode))) { + ReqCode = (unsigned char)extEntry->base; + ErrorBase = extEntry->errorBase; + } +} + +/*ARGSUSED*/ +static +void ResetProc (ExtensionEntry* extEntry) +{ +} + +static +int ProcQueryVersion (ClientPtr client) +{ + xXevieQueryVersionReply rep; + + REQUEST_SIZE_MATCH (xXevieQueryVersionReq); + rep.type = X_Reply; + rep.length = 0; + rep.sequence_number = client->sequence; + rep.server_major_version = XEVIE_MAJOR_VERSION; + rep.server_minor_version = XEVIE_MINOR_VERSION; + WriteToClient (client, sizeof (xXevieQueryVersionReply), (char *)&rep); + return client->noClientException; +} + +static +int ProcStart (ClientPtr client) +{ + xXevieStartReply rep; + + REQUEST_SIZE_MATCH (xXevieStartReq); + rep.pad1 = 0; + + if(!xevieFlag){ + if (AddCallback(&ClientStateCallback,XevieClientStateCallback,NULL)) { + xevieFlag = 1; + rep.pad1 = 1; + xevieClientIndex = client->index; + } else + return BadAlloc; + } else + return BadAccess; + + if (!XevieStart()) { + DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL); + return BadAlloc; + } + + xevieModifiersOn = FALSE; + + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieStartReply), (char *)&rep); + return client->noClientException; +} + +static +int ProcEnd (ClientPtr client) +{ + xXevieEndReply rep; + + if (xevieFlag) { + if (client->index != xevieClientIndex) + return BadAccess; + + DeleteCallback(&ClientStateCallback,XevieClientStateCallback,NULL); + XevieEnd(xevieClientIndex); + } + + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieEndReply), (char *)&rep); + return client->noClientException; +} + +static +int ProcSend (ClientPtr client) +{ + REQUEST (xXevieSendReq); + xXevieSendReply rep; + xEvent *xE; + static unsigned char lastDetail = 0, lastType = 0; + + ERR("ProcSend\n"); + + if (client->index != xevieClientIndex) + return BadAccess; + + xE = (xEvent *)&stuff->event; + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieSendReply), (char *)&rep); + + switch(xE->u.u.type) { + case KeyPress: + case KeyRelease: + doSendEvent(xE, inputInfo.keyboard); + break; + case ButtonPress: + case ButtonRelease: + case MotionNotify: + doSendEvent(xE, inputInfo.pointer); + break; + default: + break; + } + lastType = xE->u.u.type; + lastDetail = xE->u.u.detail; + + return client->noClientException; +} + +static +int ProcSelectInput (ClientPtr client) +{ + REQUEST (xXevieSelectInputReq); + xXevieSelectInputReply rep; + + if (client->index != xevieClientIndex) + return BadAccess; + + xevieMask = (long)stuff->event_mask; + rep.type = X_Reply; + rep.sequence_number = client->sequence; + WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep); + return client->noClientException; +} + +static +int ProcDispatch (ClientPtr client) +{ + REQUEST (xReq); + switch (stuff->data) + { + case X_XevieQueryVersion: + return ProcQueryVersion (client); + case X_XevieStart: + return ProcStart (client); + case X_XevieEnd: + return ProcEnd (client); + case X_XevieSend: + return ProcSend (client); + case X_XevieSelectInput: + return ProcSelectInput(client); + default: + return BadRequest; + } +} + +static +int SProcQueryVersion (ClientPtr client) +{ + register int n; + + REQUEST(xXevieQueryVersionReq); + swaps(&stuff->length, n); + return ProcQueryVersion(client); +} + +static +int SProcStart (ClientPtr client) +{ + register int n; + + REQUEST (xXevieStartReq); + swaps (&stuff->length, n); + swapl (&stuff->screen, n); + REQUEST_AT_LEAST_SIZE (xXevieStartReq); + return ProcStart (client); +} + +static +int SProcEnd (ClientPtr client) +{ + register int n; + + REQUEST (xXevieEndReq); + swaps (&stuff->length, n); + REQUEST_AT_LEAST_SIZE (xXevieEndReq); + swapl(&stuff->cmap, n); + return ProcEnd (client); +} + +static +int SProcSend (ClientPtr client) +{ + register int n; + + REQUEST (xXevieSendReq); + swaps (&stuff->length, n); + REQUEST_AT_LEAST_SIZE (xXevieSendReq); + swapl(&stuff->event, n); + return ProcSend (client); +} + +static +int SProcSelectInput (ClientPtr client) +{ + register int n; + + REQUEST (xXevieSelectInputReq); + swaps (&stuff->length, n); + REQUEST_AT_LEAST_SIZE (xXevieSendReq); + swapl(&stuff->event_mask, n); + return ProcSelectInput (client); +} + + +static +int SProcDispatch (ClientPtr client) +{ + REQUEST(xReq); + switch (stuff->data) + { + case X_XevieQueryVersion: + return SProcQueryVersion (client); + case X_XevieStart: + return SProcStart (client); + case X_XevieEnd: + return SProcEnd (client); + case X_XevieSend: + return SProcSend (client); + case X_XevieSelectInput: + return SProcSelectInput(client); + default: + return BadRequest; + } +} + +/*=====================================================*/ + + +#define WRAP_INPUTPROC(dev,store,inputProc) \ + store->processInputProc = dev->public.processInputProc; \ + dev->public.processInputProc = inputProc; \ + store->realInputProc = dev->public.realInputProc; \ + dev->public.realInputProc = inputProc; + +#define COND_WRAP_INPUTPROC(dev,store,inputProc) \ + if (dev->public.processInputProc == dev->public.realInputProc) \ + dev->public.processInputProc = inputProc; \ + store->processInputProc = \ + store->realInputProc = dev->public.realInputProc; \ + dev->public.realInputProc = inputProc; + +#define UNWRAP_INPUTPROC(dev,restore) \ + dev->public.processInputProc = restore->processInputProc; \ + dev->public.realInputProc = restore->realInputProc; + +#define UNWRAP_INPUTPROC(dev,restore) \ + dev->public.processInputProc = restore->processInputProc; \ + dev->public.realInputProc = restore->realInputProc; + +#define XEVIE_EVENT(xE) \ + (xevieFlag \ + && !xeviegrabState \ + && clients[xevieClientIndex] \ + && (xevieMask & xevieFilters[xE->u.u.type])) + + +static void +sendEvent(ClientPtr pClient, xEvent *xE) +{ + if(pClient->swapped) { + xEvent eventTo; + + /* Remember to strip off the leading bit of type in case + this event was sent with "SendEvent." */ + (*EventSwapVector[xE->u.u.type & 0177]) (xE, &eventTo); + (void)WriteToClient(pClient, sizeof(xEvent), (char *)&eventTo); + } else { + (void)WriteToClient(pClient, sizeof(xEvent), (char *) xE); + } +} + +static void +XevieKbdProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count) +{ + int key, bit; + BYTE *kptr; + ProcessInputProc tmp; + KeyClassPtr keyc = dev->key; + xevieDeviceInfoPtr xeviep = XEVIEINFO(dev); + + if(XEVIE_EVENT(xE)) { + ERR("XevieKbdProcessInputProc\n"); + + key = xE->u.u.detail; + kptr = &keyc->down[key >> 3]; + bit = 1 << (key & 7); + + /* + * This is a horrible hack: with xkb on we must zero the modifiers + * before sending an event sent back by xevie to + * CoreProcessKeyboardEvent. + * Since we cannot probe for xkb directly we need to check if the + * modifers are set at this point. If they are we know that xkb + * isn't active. + */ + if (dev->key->modifierMap[xE->u.u.detail]) + xevieModifiersOn = TRUE; + + xE->u.keyButtonPointer.event = xeviewin->drawable.id; + xE->u.keyButtonPointer.root = GetCurrentRootWindow()->drawable.id; + xE->u.keyButtonPointer.child = (xeviewin->firstChild) + ? xeviewin->firstChild->drawable.id:0; + xE->u.keyButtonPointer.rootX = xeviehot.x; + xE->u.keyButtonPointer.rootY = xeviehot.y; + xE->u.keyButtonPointer.state = keyc->state; + /* fix bug: sequence lost in Xlib */ + xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence; + sendEvent(clients[xevieClientIndex], xE); + return; + } + + tmp = dev->public.realInputProc; + UNWRAP_INPUTPROC(dev,xeviep); + dev->public.processInputProc(xE,dev,count); + COND_WRAP_INPUTPROC(dev,xeviep,tmp); +} + +static void +XeviePointerProcessInputProc(xEvent *xE, DeviceIntPtr dev, int count) +{ + xevieDeviceInfoPtr xeviep = XEVIEINFO(dev); + ProcessInputProc tmp; + + if (XEVIE_EVENT(xE)) { + ERR("XeviePointerProcessInputProc\n"); + /* fix bug: sequence lost in Xlib */ + xE->u.u.sequenceNumber = clients[xevieClientIndex]->sequence; + sendEvent(clients[xevieClientIndex], xE); + return; + } + + tmp = dev->public.realInputProc; + UNWRAP_INPUTPROC(dev,xeviep); + dev->public.processInputProc(xE,dev,count); + COND_WRAP_INPUTPROC(dev,xeviep,tmp); +} + +static Bool +XevieStart(void) +{ + ProcessInputProc prp; + prp = XevieKbdProcessInputProc; + if (!XevieAdd(inputInfo.keyboard,&prp)) + return FALSE; + prp = XeviePointerProcessInputProc; + if (!XevieAdd(inputInfo.pointer,&prp)) + return FALSE; + + return TRUE; +} + +static void +XevieEnd(int clientIndex) +{ + if (!clientIndex || clientIndex == xevieClientIndex) { + XevieRemove(inputInfo.keyboard,NULL); + XevieRemove(inputInfo.pointer,NULL); + xevieFlag = 0; + xevieClientIndex = 0; + DeleteCallback (&ClientStateCallback, XevieClientStateCallback, NULL); + } +} + +static void +XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata, + pointer calldata) +{ + NewClientInfoRec *pci = (NewClientInfoRec *)calldata; + ClientPtr client = pci->client; + if (client->clientState == ClientStateGone + || client->clientState == ClientStateRetained) + XevieEnd(client->index); +} + +static void +XevieServerGrabStateCallback(CallbackListPtr *pcbl, pointer nulldata, + pointer calldata) +{ + ServerGrabInfoRec *grbinfo = (ServerGrabInfoRec *)calldata; + if (grbinfo->grabstate == SERVER_GRABBED) + xeviegrabState = TRUE; + else + xeviegrabState = FALSE; +} + +#define UNWRAP_UNWRAPPROC(device,proc_store) \ + device->unwrapProc = proc_store; + +#define WRAP_UNWRAPPROC(device,proc_store,proc) \ + proc_store = device->unwrapProc; \ + device->unwrapProc = proc; + +static void +xevieUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, pointer data) +{ + xevieDeviceInfoPtr xeviep = XEVIEINFO(device); + ProcessInputProc tmp = device->public.processInputProc; + + UNWRAP_INPUTPROC(device,xeviep); + UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc); + proc(device,data); + WRAP_INPUTPROC(device,xeviep,tmp); + WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc); +} + +static Bool +XevieUnwrapAdd(DeviceIntPtr device, void* data) +{ + if (device->unwrapProc) + device->unwrapProc(device,XevieUnwrapAdd,data); + else { + ProcessInputProc *ptr = data; + XevieWrap(device,*ptr); + } + + return TRUE; +} + +static Bool +XevieAdd(DeviceIntPtr device, void* data) +{ + xevieDeviceInfoPtr xeviep; + + if (!AllocateDevicePrivate(device, xevieDevicePrivateIndex)) + return FALSE; + + xeviep = xcalloc (sizeof (xevieDeviceInfoRec),1); + if (!xeviep) + return FALSE; + + device->devPrivates[xevieDevicePrivateIndex].ptr = xeviep; + XevieUnwrapAdd(device, data); + + return TRUE; +} + +static Bool +XevieRemove(DeviceIntPtr device,pointer data) +{ + xevieDeviceInfoPtr xeviep = XEVIEINFO(device); + + if (!xeviep) return TRUE; + + UNWRAP_INPUTPROC(device,xeviep); + UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc); + + xfree(xeviep); + device->devPrivates[xevieDevicePrivateIndex].ptr = NULL; + return TRUE; +} + +static void +XevieWrap(DeviceIntPtr device, ProcessInputProc proc) +{ + xevieDeviceInfoPtr xeviep = XEVIEINFO(device); + + WRAP_INPUTPROC(device,xeviep,proc); + WRAP_UNWRAPPROC(device,xeviep->unwrapProc,xevieUnwrapProc); +} + +static void +doSendEvent(xEvent *xE, DeviceIntPtr dev) +{ + xevieDeviceInfoPtr xeviep = XEVIEINFO(dev); + ProcessInputProc tmp = dev->public.realInputProc; + if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease)) + && !xevieModifiersOn) { + CARD8 realModes = dev->key->modifierMap[xE->u.u.detail]; + dev->key->modifierMap[xE->u.u.detail] = 0; + + UNWRAP_INPUTPROC(dev,xeviep); + dev->public.processInputProc(xE,dev,1); + COND_WRAP_INPUTPROC(dev,xeviep,tmp); + dev->key->modifierMap[xE->u.u.detail] = realModes; + } else { + UNWRAP_INPUTPROC(dev,xeviep); + dev->public.processInputProc(xE,dev,1); + COND_WRAP_INPUTPROC(dev,xeviep,tmp); + } +} diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index 56b0b1a32..a9951e705 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 1.1.4.3 2003/12/20 00:28:26 kaleb Exp $ */ +/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.105 2003/12/18 21:56:37 dawes Exp $ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.105 2003/12/18 21:56:37 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -113,10 +113,6 @@ extern int ffs(unsigned long); ; # endif -# if defined(__SUNPRO_C) -# define DO_PROTOTYPES -# endif - # if defined(NO_INLINE) || defined(DO_PROTOTYPES) # if !defined(__sparc__) && !defined(__arm32__) \ @@ -1541,7 +1537,7 @@ extern void outl(unsigned int a, unsigned int l); #if 0 # include #endif -# if !defined(__HIGHC__) && !defined(__SUNPRO_C) +# ifndef __HIGHC__ # ifndef __USLC__ # define __USLC__ # endif @@ -1567,8 +1563,7 @@ extern void outl(unsigned int a, unsigned int l); # else # include "scoasm.h" # endif -# if !defined(__HIGHC__) && !defined(SCO325) && !defined(sgi) && \ - !defined(__SUNPRO_C) +# if !defined(__HIGHC__) && !defined(SCO325) && !defined(sgi) # pragma asm partial_optimization outl # pragma asm partial_optimization outw # pragma asm partial_optimization outb diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index 7c773fee6..159d3de71 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -12,26 +12,43 @@ * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by X-Oz Technologies + * (http://www.x-oz.com/)." Alternately, this acknowledgment may + * appear in the software itself, if and wherever such third-party + * acknowledgments normally appear. + * + * 4. Except as contained in this notice, the name of X-Oz + * Technologies shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from X-Oz Technologies. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL X-OZ TECHNOLOGIES OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Author: David Dawes . */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c,v 1.2 2003/11/03 05:11:01 tsi Exp $ */ +/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c,v 1.3 2003/12/12 00:39:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86AutoConfig.c,v 1.3 2003/12/12 00:39:16 dawes Exp $ */ #include "xf86.h" #include "xf86Parser.h" diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 388823ddb..2ffbfa964 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -1,5 +1,4 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.79 2003/11/03 05:11:01 tsi Exp $ */ -/* $XdotOrg$ */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. * @@ -526,14 +525,14 @@ disableAccess(void) for (i = 0; i < xf86NumScreens; i++) { peacc = xf86Screens[i]->CurrentAccess->pIoAccess; while (peacc) { - if (peacc->pAccess && peacc->pAccess->AccessDisable) + if (peacc->pAccess->AccessDisable) peacc->pAccess->AccessDisable(peacc->pAccess->arg); peacc = peacc->next; } xf86Screens[i]->CurrentAccess->pIoAccess = NULL; peacc = xf86Screens[i]->CurrentAccess->pMemAccess; while (peacc) { - if (peacc->pAccess && peacc->pAccess->AccessDisable) + if (peacc->pAccess->AccessDisable) peacc->pAccess->AccessDisable(peacc->pAccess->arg); peacc = peacc->next; } diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 38f495090..ce8817096 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1251,8 +1251,8 @@ AbortDDX() void OsVendorFatalError() { - ErrorF("\nWhen reporting a problem related to a server crash, please\n" - "send the full server output, not just the last messages.\n"); + ErrorF("\nWhen reporting a problem related to a server crash, please send\n" + "the full server output, not just the last messages.\n"); if (xf86LogFile && xf86LogFileWasOpened) ErrorF("This can be found in the log file \"%s\".\n", xf86LogFile); ErrorF("Please report problems to %s.\n", BUILDERADDR); @@ -1703,15 +1703,14 @@ xf86PrintBanner() { #if PRE_RELEASE ErrorF("\n" - "This is a pre-release version of the X.org Foundation's X11.\n" - "Portions of this release are based on XFree86 4.4RC2 and selected\n" - "files from XFree86 4.4RC3. It is not supported in any way.\n" - "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" - "Select the \"xorg\" product for bugs you find in this release.\n" - "Before reporting bugs in pre-release versions please check the\n" - "latest version in the X.org Foundation \"monolithic tree\" CVS\n" - "repository hosted at http://www.freedesktop.org/Software/xorg/" + "This is a pre-release version of XFree86, and is not supported in any\n" + "way. Bugs may be reported to XFree86@XFree86.Org and patches submitted\n" + "to fixes@XFree86.Org. Before reporting bugs in pre-release versions,\n" + "please check the latest version in the XFree86 CVS repository\n" + "(http://www.XFree86.Org/cvs).\n"); #endif + ErrorF("\nXFree86 Version %d.%d.%d", XF86_VERSION_MAJOR, XF86_VERSION_MINOR, + XF86_VERSION_PATCH); #if XF86_VERSION_SNAP > 0 ErrorF(".%d", XF86_VERSION_SNAP); #endif diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index 52ab57f4a..f7cb065a4 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -1,4 +1,3 @@ -/* $XdotOrg$ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.25 2003/10/17 20:02:12 alanh Exp $ */ /* * Copyright (c) 1998-2001 by The XFree86 Project, Inc. @@ -27,8 +26,7 @@ * authorization from the copyright holder(s) and author(s). */ -#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) \ - || (defined(sun) && defined(__SVR4)) +#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) #include #else #define _XOPEN_SOURCE /* to get prototype for pow on some systems */ diff --git a/hw/xfree86/getconfig/getconfig b/hw/xfree86/getconfig/getconfig index d2acc9bb8..8cbb18e2e 100644 --- a/hw/xfree86/getconfig/getconfig +++ b/hw/xfree86/getconfig/getconfig @@ -1,5 +1,6 @@ #!/bin/sh +# $XdotOrg: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.sh,v 1.2 2003/09/20 01:45:57 dawes Exp $ # $DHD: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.sh,v 1.2 2003/09/20 01:45:57 dawes Exp $ # @@ -14,26 +15,42 @@ # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions, and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the copyright holder(s) -# and author(s) shall not be used in advertising or otherwise to promote -# the sale, use or other dealings in this Software without prior written -# authorization from the copyright holder(s) and author(s). +# 3. The end-user documentation included with the redistribution, +# if any, must include the following acknowledgment: "This product +# includes software developed by X-Oz Technologies +# (http://www.x-oz.com/)." Alternately, this acknowledgment may +# appear in the software itself, if and wherever such third-party +# acknowledgments normally appear. +# +# 4. Except as contained in this notice, the name of X-Oz +# Technologies shall not be used in advertising or otherwise to +# promote the sale, use or other dealings in this Software without +# prior written authorization from X-Oz Technologies. +# +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL X-OZ TECHNOLOGIES OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Author: David Dawes . # -# $XFree86: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.sh,v 1.1 2003/10/08 14:58:29 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.sh,v 1.2 2003/12/12 00:39:16 dawes Exp $ # A simple wrapper to execute the real getconfig program. So long as perl # is in $PATH, we don't need to know where it is this way. diff --git a/hw/xfree86/getconfig/getconfig.pl b/hw/xfree86/getconfig/getconfig.pl index fcfd7d057..7ff0b2b6d 100644 --- a/hw/xfree86/getconfig/getconfig.pl +++ b/hw/xfree86/getconfig/getconfig.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl +# $XdotOrg: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.pl,v 1.13 2003/09/23 05:12:07 dawes Exp $ # $DHD: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.pl,v 1.13 2003/09/23 05:12:07 dawes Exp $ # @@ -14,26 +15,42 @@ # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions, and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the copyright holder(s) -# and author(s) shall not be used in advertising or otherwise to promote -# the sale, use or other dealings in this Software without prior written -# authorization from the copyright holder(s) and author(s). +# 3. The end-user documentation included with the redistribution, +# if any, must include the following acknowledgment: "This product +# includes software developed by X-Oz Technologies +# (http://www.x-oz.com/)." Alternately, this acknowledgment may +# appear in the software itself, if and wherever such third-party +# acknowledgments normally appear. +# +# 4. Except as contained in this notice, the name of X-Oz +# Technologies shall not be used in advertising or otherwise to +# promote the sale, use or other dealings in this Software without +# prior written authorization from X-Oz Technologies. +# +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL X-OZ TECHNOLOGIES OR ITS CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Author: David Dawes . # -# $XFree86: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.pl,v 1.1 2003/10/08 14:58:29 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/getconfig/getconfig.pl,v 1.2 2003/12/12 00:39:16 dawes Exp $ # # This script takes PCI id information, compares it against an ordered list diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index dccc6cee4..74ca95baf 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -1,4 +1,3 @@ -/* $XdotOrg$ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h,v 1.44 2003/11/07 23:57:47 dawes Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation @@ -262,7 +261,7 @@ # define INCLUDE_XF86_NO_DOMAIN # endif # define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper -#elif defined(__i386__) || defined(__i386) +#elif defined(__i386__) # define ARCH_PCI_INIT ix86PciInit # define INCLUDE_XF86_MAP_PCI_MEM # define INCLUDE_XF86_NO_DOMAIN diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index 2f9a0f5ab..11fe19f67 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -1,8 +1,7 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.31 2003/09/24 02:43:35 dawes Exp $ */ -/* $XdotOrg$ */ /* * linux specific part of the int10 module - * Copyright 1999, 2000, 2001, 2002, 2003, 2004 Egbert Eich + * Copyright 1999 Egbert Eich */ #include "xf86.h" #include "xf86_OSproc.h" @@ -213,9 +212,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags) } else ((linuxInt10Priv*)pInt->private)->base_high = NULL; - if (!MapCurrentInt10(pInt)) - goto error3; - + MapCurrentInt10(pInt); Int10Current = pInt; #ifdef DEBUG diff --git a/hw/xfree86/os-support/misc/PortIO.S b/hw/xfree86/os-support/misc/PortIO.S new file mode 100644 index 000000000..61aac6b89 --- /dev/null +++ b/hw/xfree86/os-support/misc/PortIO.S @@ -0,0 +1,57 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/PortIO.S,v 1.1 2004/02/02 03:55:32 dawes Exp $ */ + +/* Port I/O functions for platforms with no inlining. */ + +#include "assyntax.h" + + FILE("PortIO.s") + + AS_BEGIN + + GLOBL GLNAME(outb) + GLOBL GLNAME(outw) + GLOBL GLNAME(outl) + GLOBL GLNAME(inb) + GLOBL GLNAME(inw) + GLOBL GLNAME(inl) + + SEG_TEXT + ALIGNTEXT4 +GLNAME(outb): + MOV_L (REGOFF(4,ESP), EDX) + MOV_L (REGOFF(8,ESP), EAX) + OUT_B + RET + + ALIGNTEXT4 +GLNAME(outw): + MOV_L (REGOFF(4,ESP), EDX) + MOV_L (REGOFF(8,ESP), EAX) + OUT_W + RET + + ALIGNTEXT4 +GLNAME(outl): + MOV_L (REGOFF(4,ESP), EDX) + MOV_L (REGOFF(8,ESP), EAX) + OUT_L + RET + + ALIGNTEXT4 +GLNAME(inb): + MOV_L (REGOFF(4,ESP), EDX) + IN_B + RET + + ALIGNTEXT4 +GLNAME(inw): + MOV_L (REGOFF(4,ESP), EDX) + IN_L + RET + + ALIGNTEXT4 +GLNAME(inl): + MOV_L (REGOFF(4,ESP), EDX) + IN_L + RET + diff --git a/hw/xfree86/vbe/vbe.h b/hw/xfree86/vbe/vbe.h index f3af4ff52..30756119d 100644 --- a/hw/xfree86/vbe/vbe.h +++ b/hw/xfree86/vbe/vbe.h @@ -1,4 +1,3 @@ -/* $XdotOrg$ */ /* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.h,v 1.3 2003/11/14 14:58:45 tsi Exp $ */ /* @@ -61,7 +60,7 @@ typedef struct vbeControllerInfoBlock { CARD8 OemData[256]; } vbeControllerInfoRec, *vbeControllerInfoPtr; -#if defined(__GNUC__) || defined(__SUNPRO_C) +#ifdef __GNUC__ #pragma pack() /* All GCC versions recognise this syntax */ #else #pragma pack(0) diff --git a/mi/miarc.c b/mi/miarc.c index 38bd998ee..70b9fde04 100644 --- a/mi/miarc.c +++ b/mi/miarc.c @@ -1,4 +1,4 @@ -/* $XdotOrg: xc/programs/Xserver/mi/miarc.c,v 1.1.4.3 2003/12/20 00:28:31 kaleb Exp $ */ +/* $XdotOrg: xc/programs/Xserver/mi/miarc.c,v 3.15 2003/12/06 18:46:28 dawes Exp $ */ /* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.15 2003/12/06 18:46:28 dawes Exp $ */ /*********************************************************** @@ -50,8 +50,7 @@ SOFTWARE. /* Author: Keith Packard and Bob Scheifler */ /* Warning: this code is toxic, do not dally very long here. */ -#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) \ - || (defined(sun) && defined(__SVR4)) +#if defined(_XOPEN_SOURCE) || defined(__QNXNTO__) #include #else #define _XOPEN_SOURCE /* to get prototype for hypot on some systems */