void DamageExtensionInit(void) { ExtensionEntry *extEntry; int s; for (s = 0; s < screenInfo.numScreens; s++) DamageSetup (screenInfo.screens[s]); DamageExtType = CreateNewResourceType (FreeDamageExt, "DamageExt"); if (!DamageExtType) return; DamageExtWinType = CreateNewResourceType (FreeDamageExtWin, "DamageExtWin"); if (!DamageExtWinType) return; if (!dixRegisterPrivateKey(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (DamageClientRec))) return; if (!AddCallback (&ClientStateCallback, DamageClientCallback, 0)) return; if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents, XDamageNumberErrors, ProcDamageDispatch, SProcDamageDispatch, DamageResetProc, StandardMinorOpcode)) != 0) { DamageReqCode = (unsigned char)extEntry->base; DamageEventBase = extEntry->eventBase; EventSwapVector[DamageEventBase + XDamageNotify] = (EventSwapPtr) SDamageNotifyEvent; SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage); } }
Bool vivante_dri2_ScreenInit(ScreenPtr pScreen) { struct vivante *vivante = vivante_get_screen_priv(pScreen); struct vivante_dri2_info *dri; DRI2InfoRec info; int dri2_major = 0; int dri2_minor = 0; const char *driverNames[1]; if (xf86LoaderCheckSymbol("DRI2Version")) DRI2Version(&dri2_major, &dri2_minor); if (dri2_major < 1 || (dri2_major == 1 && dri2_minor < 1)) { xf86DrvMsg(vivante->scrnIndex, X_WARNING, "DRI2 requires DRI2 module version 1.1.0 or later\n"); return FALSE; } if (!vivante_dri2_register_private()) return FALSE; if (dri2_server_generation != serverGeneration) { dri2_server_generation = serverGeneration; wait_client_restype = CreateNewResourceType(vivante_dri2_client_gone, "Frame Event Client"); wait_drawable_restype = CreateNewResourceType(vivante_dri2_drawable_gone, "Frame Event Drawable"); if (!wait_client_restype || !wait_drawable_restype) { xf86DrvMsg(vivante->scrnIndex, X_WARNING, "Can not register DRI2 frame event resources\n"); return FALSE; } } dri = xnfcalloc(1, sizeof *dri); dri->devname = drmGetDeviceNameFromFd(vivante->drm_fd); vivante->dri2 = dri; memset(&info, 0, sizeof(info)); info.version = 4; info.fd = vivante->drm_fd; info.driverName = "galdri"; info.deviceName = dri->devname; info.CreateBuffer = vivante_dri2_CreateBuffer; info.DestroyBuffer = vivante_dri2_DestroyBuffer; info.CopyRegion = vivante_dri2_CopyRegion; info.ScheduleSwap = vivante_dri2_ScheduleSwap; info.GetMSC = vivante_dri2_GetMSC; info.ScheduleWaitMSC = vivante_dri2_ScheduleWaitMSC; info.numDrivers = 1; info.driverNames = driverNames; driverNames[0] = info.driverName; return DRI2ScreenInit(pScreen, &info); }
void XvMCExtensionInit() { ExtensionEntry *extEntry; if(XvMCScreenIndex < 0) /* nobody supports it */ return; if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes))) return; if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes))) return; if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes))) return; extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors, ProcXvMCDispatch, SProcXvMCDispatch, XvMCResetProc, StandardMinorOpcode); if(!extEntry) return; XvMCReqCode = extEntry->base; XvMCEventBase = extEntry->eventBase; XvMCErrorBase = extEntry->errorBase; }
Bool XFixesSelectionInit (void) { SelectionClientType = CreateNewResourceType(SelectionFreeClient); SelectionWindowType = CreateNewResourceType(SelectionFreeWindow); return SelectionClientType && SelectionWindowType; }
void winWindowsWMExtensionInit(void) { ExtensionEntry *extEntry; ClientType = CreateNewResourceType(WMFreeClient, "WMClient"); eventResourceType = CreateNewResourceType(WMFreeEvents, "WMEvent"); eventResource = FakeClientID(0); if (ClientType && eventResourceType && (extEntry = AddExtension(WINDOWSWMNAME, WindowsWMNumberEvents, WindowsWMNumberErrors, ProcWindowsWMDispatch, SProcWindowsWMDispatch, NULL, StandardMinorOpcode))) { size_t i; WMReqCode = (unsigned char) extEntry->base; WMErrorBase = extEntry->errorBase; WMEventBase = extEntry->eventBase; for (i = 0; i < WindowsWMNumberEvents; i++) EventSwapVector[WMEventBase + i] = (EventSwapPtr) SNotifyEvent; } }
void XvMCExtensionInit(void) { ExtensionEntry *extEntry; if(XvMCScreenKey == NULL) /* nobody supports it */ return; if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes, "XvMCRTContext"))) return; if(!(XvMCRTSurface = CreateNewResourceType(XvMCDestroySurfaceRes, "XvMCRTSurface"))) return; if(!(XvMCRTSubpicture = CreateNewResourceType(XvMCDestroySubpictureRes, "XvMCRTSubpicture"))) return; extEntry = AddExtension(XvMCName, XvMCNumEvents, XvMCNumErrors, ProcXvMCDispatch, SProcXvMCDispatch, NULL, StandardMinorOpcode); if(!extEntry) return; XvMCReqCode = extEntry->base; XvMCEventBase = extEntry->eventBase; SetResourceTypeErrorValue(XvMCRTContext, extEntry->errorBase + XvMCBadContext); SetResourceTypeErrorValue(XvMCRTSurface, extEntry->errorBase + XvMCBadSurface); SetResourceTypeErrorValue(XvMCRTSubpicture, extEntry->errorBase + XvMCBadSubpicture); }
void RRExtensionInit (void) { ExtensionEntry *extEntry; if (RRNScreens == 0) return; if (!dixRequestPrivate(RRClientPrivateKey, sizeof (RRClientRec) + screenInfo.numScreens * sizeof (RRTimesRec))) return; if (!AddCallback (&ClientStateCallback, RRClientCallback, 0)) return; RRClientType = CreateNewResourceType(RRFreeClient); if (!RRClientType) return; RREventType = CreateNewResourceType(RRFreeEvents); if (!RREventType) return; extEntry = AddExtension (RANDR_NAME, RRNumberEvents, RRNumberErrors, ProcRRDispatch, SProcRRDispatch, NULL, StandardMinorOpcode); if (!extEntry) return; RRErrorBase = extEntry->errorBase; RREventBase = extEntry->eventBase; EventSwapVector[RREventBase + RRScreenChangeNotify] = (EventSwapPtr) SRRScreenChangeNotifyEvent; EventSwapVector[RREventBase + RRNotify] = (EventSwapPtr) SRRNotifyEvent; #ifdef PANORAMIX RRXineramaExtensionInit(); #endif }
void AppleWMExtensionInit( AppleWMProcsPtr procsPtr) { ExtensionEntry* extEntry; ClientType = CreateNewResourceType(WMFreeClient); EventType = CreateNewResourceType(WMFreeEvents); eventResource = FakeClientID(0); if (ClientType && EventType && (extEntry = AddExtension(APPLEWMNAME, AppleWMNumberEvents, AppleWMNumberErrors, ProcAppleWMDispatch, SProcAppleWMDispatch, NULL, StandardMinorOpcode))) { WMReqCode = (unsigned char)extEntry->base; WMErrorBase = extEntry->errorBase; WMEventBase = extEntry->eventBase; EventSwapVector[WMEventBase] = (EventSwapPtr) SNotifyEvent; appleWMProcs = procsPtr; } }
void SecurityExtensionInit(INITARGS) { ExtensionEntry *extEntry; int ret = TRUE; SecurityAuthorizationResType = CreateNewResourceType(SecurityDeleteAuthorization, "SecurityAuthorization"); RTEventClient = CreateNewResourceType(SecurityDeleteAuthorizationEventClient, "SecurityEventClient"); if (!SecurityAuthorizationResType || !RTEventClient) return; RTEventClient |= RC_NEVERRETAIN; /* Allocate the private storage */ if (!dixRegisterPrivateKey(stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec))) FatalError("SecurityExtensionSetup: Can't allocate client private.\n"); /* Register callbacks */ ret &= AddCallback(&ClientStateCallback, SecurityClientState, NULL); ret &= XaceRegisterCallback(XACE_EXT_DISPATCH, SecurityExtension, NULL); ret &= XaceRegisterCallback(XACE_RESOURCE_ACCESS, SecurityResource, NULL); ret &= XaceRegisterCallback(XACE_DEVICE_ACCESS, SecurityDevice, NULL); ret &= XaceRegisterCallback(XACE_PROPERTY_ACCESS, SecurityProperty, NULL); ret &= XaceRegisterCallback(XACE_SEND_ACCESS, SecuritySend, NULL); ret &= XaceRegisterCallback(XACE_RECEIVE_ACCESS, SecurityReceive, NULL); ret &= XaceRegisterCallback(XACE_CLIENT_ACCESS, SecurityClient, NULL); ret &= XaceRegisterCallback(XACE_EXT_ACCESS, SecurityExtension, NULL); ret &= XaceRegisterCallback(XACE_SERVER_ACCESS, SecurityServer, NULL); if (!ret) FatalError("SecurityExtensionSetup: Failed to register callbacks\n"); /* Add extension to server */ extEntry = AddExtension(SECURITY_EXTENSION_NAME, XSecurityNumberEvents, XSecurityNumberErrors, ProcSecurityDispatch, SProcSecurityDispatch, SecurityResetProc, StandardMinorOpcode); SecurityErrorBase = extEntry->errorBase; SecurityEventBase = extEntry->eventBase; EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent; SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization); /* Label objects that were created before we could register ourself */ SecurityLabelInitial(); }
void ShapeExtensionInit(void) { ExtensionEntry *extEntry; ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient"); ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent"); if (ClientType && ShapeEventType && (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, ProcShapeDispatch, SProcShapeDispatch, NULL, StandardMinorOpcode))) { ShapeEventBase = extEntry->eventBase; EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; } }
Bool DRIExtensionInit(void) { static unsigned long DRIGeneration = 0; if (DRIGeneration != serverGeneration) { if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) return FALSE; DRIGeneration = serverGeneration; } /* * Allocate a window private index with a zero sized private area for * each window, then should a window become a DRI window, we'll hang * a DRIWindowPrivateRec off of this private index. Do same for pixmaps. */ if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) return FALSE; if ((DRIPixmapPrivIndex = AllocatePixmapPrivateIndex()) < 0) return FALSE; DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete); return TRUE; }
void XInputExtensionInit(void) { ExtensionEntry *extEntry; extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch, SProcIDispatch, IResetProc, StandardMinorOpcode); if (extEntry) { IReqCode = extEntry->base; AllExtensionVersions[IReqCode - 128] = thisversion; MakeDeviceTypeAtoms(); RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone); FixExtensionEvents(extEntry); ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch; EventSwapVector[DeviceValuator] = SEventIDispatch; EventSwapVector[DeviceKeyPress] = SEventIDispatch; EventSwapVector[DeviceKeyRelease] = SEventIDispatch; EventSwapVector[DeviceButtonPress] = SEventIDispatch; EventSwapVector[DeviceButtonRelease] = SEventIDispatch; EventSwapVector[DeviceMotionNotify] = SEventIDispatch; EventSwapVector[DeviceFocusIn] = SEventIDispatch; EventSwapVector[DeviceFocusOut] = SEventIDispatch; EventSwapVector[ProximityIn] = SEventIDispatch; EventSwapVector[ProximityOut] = SEventIDispatch; EventSwapVector[DeviceStateNotify] = SEventIDispatch; EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch; EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch; EventSwapVector[DeviceMappingNotify] = SEventIDispatch; EventSwapVector[ChangeDeviceNotify] = SEventIDispatch; } else { FatalError("IExtensionInit: AddExtensions failed\n"); } }
void XFree86DRIExtensionInit(void) { ExtensionEntry* extEntry; #ifdef XF86DRI_EVENTS EventType = CreateNewResourceType(XF86DRIFreeEvents); #endif if ( DRIExtensionInit() && #ifdef XF86DRI_EVENTS EventType && ScreenPrivateIndex != -1 && #endif (extEntry = AddExtension(XF86DRINAME, XF86DRINumberEvents, XF86DRINumberErrors, ProcXF86DRIDispatch, SProcXF86DRIDispatch, XF86DRIResetProc, StandardMinorOpcode))) { DRIReqCode = (unsigned char)extEntry->base; DRIErrorBase = extEntry->errorBase; } }
Bool XFixesRegionInit(void) { RegionResType = CreateNewResourceType(RegionResFree, "XFixesRegion"); return RegionResType != 0; }
Bool DRIExtensionInit(void) { DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete); return TRUE; }
void MultibufferExtensionInit() { ExtensionEntry *extEntry; int i, j; ScreenPtr pScreen; MultibufferScreenPtr pMultibufferScreen; for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; if (!(pMultibufferScreen = (MultibufferScreenPtr) xalloc (sizeof (MultibufferScreenRec)))) { for (j = 0; j < i; j++) xfree (dixLookupPrivate(&screenInfo.screens[j]->devPrivates, MultibufferScreenPrivKey)); return; } dixSetPrivate(&pScreen->devPrivates, MultibufferScreenPrivKey, pMultibufferScreen); /* * wrap PositionWindow to resize the pixmap when the window * changes size */ pMultibufferScreen->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = MultibufferPositionWindow; } /* * create the resource types */ MultibufferDrawableResType = CreateNewResourceType(MultibufferDrawableDelete)|RC_DRAWABLE; MultibufferResType = CreateNewResourceType(MultibufferDelete); MultibuffersResType = CreateNewResourceType(MultibuffersDelete); OtherClientResType = CreateNewResourceType(OtherClientDelete); if (MultibufferDrawableResType && MultibufferResType && MultibuffersResType && OtherClientResType && (extEntry = AddExtension(MULTIBUFFER_PROTOCOL_NAME, MultibufferNumberEvents, MultibufferNumberErrors, ProcMultibufferDispatch, SProcMultibufferDispatch, MultibufferResetProc, StandardMinorOpcode))) { MultibufferEventBase = extEntry->eventBase; MultibufferErrorBase = extEntry->errorBase; EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent; EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent; } }
Bool DRIExtensionInit(void) { DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete, "DRIDrawable"); return DRIDrawablePrivResType != 0; }
void ShapeExtensionInit() { ExtensionEntry *extEntry; ClientType = CreateNewResourceType(ShapeFreeClient); EventType = CreateNewResourceType(ShapeFreeEvents); if (ClientType && EventType && (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, ProcShapeDispatch, SProcShapeDispatch, ShapeResetProc, StandardMinorOpcode))) { ShapeReqCode = (unsigned char)extEntry->base; ShapeEventBase = extEntry->eventBase; EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; } }
/* * Initialize crtc type */ Bool RRCrtcInit (void) { RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC"); if (!RRCrtcType) return FALSE; return TRUE; }
/* * Initialize output type */ Bool RROutputInit(void) { RROutputType = CreateNewResourceType(RROutputDestroyResource, "OUTPUT"); if (!RROutputType) return FALSE; return TRUE; }
/* * Initialize crtc type */ Bool RRCrtcInit (void) { RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC"); if (!RRCrtcType) return FALSE; SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc); return TRUE; }
/***************************************************************************** * * XTestExtension1Init * * Called from InitExtensions in main() or from QueryExtension() if the * extension is dynamically loaded. * * XTestExtension1Init has no events or errors * (other than the core errors). */ void XTestExtension1Init() { /* * holds the pointer to the extension entry structure */ ExtensionEntry *extEntry; extEntry = AddExtension(XTestEXTENSION_NAME, XTestEVENT_COUNT, 0, ProcXTestDispatch, SProcXTestDispatch, XTestResetProc, StandardMinorOpcode); if (extEntry) { /* * remember the request code assigned to this extension */ XTestReqCode = extEntry->base; /* * make an atom saying that this extension is present */ (void) MakeAtom(XTestEXTENSION_NAME, strlen(XTestEXTENSION_NAME), TRUE); /* * remember the event codes assigned to this extension */ XTestInputActionType += extEntry->eventBase; XTestFakeAckType += extEntry->eventBase; /* * install the routine to handle byte-swapping the replies * for this extension in the ReplySwapVector table */ ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch; /* * install the routine to handle byte-swapping the events * for this extension in the EventSwapVector table */ EventSwapVector[XTestInputActionType] = SEventXTestDispatch; EventSwapVector[XTestFakeAckType] = SEventXTestDispatch; /* * get the resource type for this extension */ XTestType = CreateNewResourceType(XTestCurrentClientGone); if (XTestType == 0) { FatalError("XTestExtension1Init: CreateNewResourceType failed\n"); } } else { FatalError("XTestExtension1Init: AddExtensions failed\n"); } }
Bool present_event_init(void) { present_event_type = CreateNewResourceType(present_free_event, "PresentEvent"); if (!present_event_type) return FALSE; GERegisterExtension(present_request, present_event_swap); return TRUE; }
Bool dri3_event_init(void) { dri3_event_type = CreateNewResourceType(dri3_free_event, "DRI3Event"); if (!dri3_event_type) return FALSE; GERegisterExtension(dri3_request, dri3_event_swap); return TRUE; }
Bool RRModeInit (void) { assert (num_modes == 0); assert (modes == NULL); RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE"); if (!RRModeType) return FALSE; return TRUE; }
int ClientSleepUntil(ClientPtr client, TimeStamp *revive, void (*notifyFunc) (ClientPtr, void *), void *closure) { SertafiedPtr pRequest, pReq, pPrev; if (SertafiedGeneration != serverGeneration) { SertafiedResType = CreateNewResourceType(SertafiedDelete, "ClientSleep"); if (!SertafiedResType) return FALSE; SertafiedGeneration = serverGeneration; BlockHandlerRegistered = FALSE; } pRequest = malloc(sizeof(SertafiedRec)); if (!pRequest) return FALSE; pRequest->pClient = client; pRequest->revive = *revive; pRequest->id = FakeClientID(client->index); pRequest->closure = closure; if (!BlockHandlerRegistered) { if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler, SertafiedWakeupHandler, (void *) 0)) { free(pRequest); return FALSE; } BlockHandlerRegistered = TRUE; } pRequest->notifyFunc = 0; if (!AddResource(pRequest->id, SertafiedResType, (void *) pRequest)) return FALSE; if (!notifyFunc) notifyFunc = ClientAwaken; pRequest->notifyFunc = notifyFunc; /* Insert into time-ordered queue, with earliest activation time coming first. */ pPrev = 0; for (pReq = pPending; pReq; pReq = pReq->next) { if (CompareTimeStamps(pReq->revive, *revive) == LATER) break; pPrev = pReq; } if (pPrev) pPrev->next = pRequest; else pPending = pRequest; pRequest->next = pReq; IgnoreClient(client); return TRUE; }
void CompositeExtensionInit (void) { ExtensionEntry *extEntry; int s; CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow); if (!CompositeClientWindowType) return; CompositeClientSubwindowsType = CreateNewResourceType (FreeCompositeClientSubwindows); if (!CompositeClientSubwindowsType) return; CompositeClientOverlayType = CreateNewResourceType (FreeCompositeClientOverlay); if (!CompositeClientOverlayType) return; CompositeClientPrivateIndex = AllocateClientPrivateIndex (); if (!AllocateClientPrivate (CompositeClientPrivateIndex, sizeof (CompositeClientRec))) return; if (!AddCallback (&ClientStateCallback, CompositeClientCallback, 0)) return; extEntry = AddExtension (COMPOSITE_NAME, 0, 0, ProcCompositeDispatch, SProcCompositeDispatch, CompositeResetProc, StandardMinorOpcode); if (!extEntry) return; CompositeReqCode = (CARD8) extEntry->base; for (s = 0; s < screenInfo.numScreens; s++) if (!compScreenInit (screenInfo.screens[s])) return; miRegisterRedirectBorderClipProc (compSetRedirectBorderClip, compGetRedirectBorderClip); }
void XagExtensionInit(INITARGS) { if (AddExtension (XAGNAME, 0, XagNumberErrors, ProcXagDispatch, SProcXagDispatch, XagResetProc, StandardMinorOpcode)) { RT_APPGROUP = CreateNewResourceType (XagAppGroupFree); XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL); } }
void __glXScreenInit(GLint numscreens) { GLint i,j; __glXScreens[0] = __glXglDDXScreenInfo(); /* from GLcore */ /* ** This alloc has to work or else the server might as well core dump. */ __glXActiveScreens = (__GLXscreenInfo *) __glXMalloc(sizeof(__GLXscreenInfo) * numscreens); for (i=0; i < numscreens; i++) { /* ** Probe each static screen to see which exists. */ for (j=0; j < __glXNumStaticScreens; j++) { if ((*__glXScreens[j]->screenProbe)(i)) { __glXActiveScreens[i] = *__glXScreens[j]; __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); #ifdef X11R5 __glXDrawableRes = CreateNewResourceType(DrawableGone); #else __glXDrawableRes = CreateNewResourceType((DeleteType)DrawableGone); #endif wrapPositionWindow(i); } } } __glXNumActiveScreens = numscreens; }
void ShmExtensionInit(INITARGS) { ExtensionEntry *extEntry; int i; #ifdef MUST_CHECK_FOR_SHM_SYSCALL if (!CheckForShmSyscall()) { ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); return; } #endif if (!ShmRegisterPrivates()) return; sharedPixmaps = xFalse; { sharedPixmaps = xTrue; for (i = 0; i < screenInfo.numScreens; i++) { ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]); if (!screen_priv->shmFuncs) screen_priv->shmFuncs = &miFuncs; if (!screen_priv->shmFuncs->CreatePixmap) sharedPixmaps = xFalse; } if (sharedPixmaps) for (i = 0; i < screenInfo.numScreens; i++) { ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]); screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap; screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; } } ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg"); if (ShmSegType && (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, ProcShmDispatch, SProcShmDispatch, ShmResetProc, StandardMinorOpcode))) { ShmReqCode = (unsigned char)extEntry->base; ShmCompletionCode = extEntry->eventBase; BadShmSegCode = extEntry->errorBase; SetResourceTypeErrorValue(ShmSegType, BadShmSegCode); EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; } }