static int ProcAppleWMAttachTransient(register ClientPtr client) { WindowPtr pWinChild, pWinParent; REQUEST(xAppleWMAttachTransientReq); int err; REQUEST_SIZE_MATCH(xAppleWMAttachTransientReq); if(!appleWMProcs->AttachTransient) return BadRequest; if (Success != dixLookupWindow(&pWinChild, stuff->child, client, DixReadAccess)) return BadValue; if(stuff->parent) { if(Success != dixLookupWindow(&pWinParent, stuff->parent, client, DixReadAccess)) return BadValue; } else { pWinParent = NULL; } err = appleWMProcs->AttachTransient(pWinChild, pWinParent); if (err != Success) { return err; } return (client->noClientException); }
// was PanoramiX static int ProcPseudoramiXGetScreenCount(ClientPtr client) { REQUEST(xPanoramiXGetScreenCountReq); WindowPtr pWin; xPanoramiXGetScreenCountReply rep; register int rc; TRACE; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.ScreenCount = pseudoramiXNumScreens; rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply),&rep); return Success; }
static int proc_present_notify_msc(ClientPtr client) { REQUEST(xPresentNotifyMSCReq); WindowPtr window; int rc; REQUEST_SIZE_MATCH(xPresentNotifyMSCReq); rc = dixLookupWindow(&window, stuff->window, client, DixReadAccess); if (rc != Success) return rc; /* * Check to see if remainder is sane */ if (stuff->divisor == 0) { if (stuff->remainder != 0) { client->errorValue = (CARD32) stuff->remainder; return BadValue; } } else { if (stuff->remainder >= stuff->divisor) { client->errorValue = (CARD32) stuff->remainder; return BadValue; } } return present_notify_msc(window, stuff->serial, stuff->target_msc, stuff->divisor, stuff->remainder); }
int ProcRRGetOutputPrimary(ClientPtr client) { REQUEST(xRRGetOutputPrimaryReq); WindowPtr pWin; rrScrPrivPtr pScrPriv; xRRGetOutputPrimaryReply rep; RROutputPtr primary = NULL; int rc; REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); if (pScrPriv) primary = pScrPriv->primaryOutput; memset(&rep, 0, sizeof(rep)); rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.output = primary ? primary->id : None; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.output); } WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep); return Success; }
int ProcRRSetOutputPrimary(ClientPtr client) { REQUEST(xRRSetOutputPrimaryReq); RROutputPtr output = NULL; WindowPtr pWin; rrScrPrivPtr pScrPriv; int rc; REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (stuff->output) { VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (output->pScreen != pWin->drawable.pScreen) { client->errorValue = stuff->window; return BadMatch; } } pScrPriv = rrGetScrPriv(pWin->drawable.pScreen); RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output); return Success; }
static int ProcShapeOffset(ClientPtr client) { WindowPtr pWin; REQUEST(xShapeOffsetReq); RegionPtr srcRgn; int rc; REQUEST_SIZE_MATCH(xShapeOffsetReq); UpdateCurrentTime(); rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess); if (rc != Success) return rc; switch (stuff->destKind) { case ShapeBounding: srcRgn = wBoundingShape(pWin); break; case ShapeClip: srcRgn = wClipShape(pWin); break; case ShapeInput: srcRgn = wInputShape(pWin); break; default: client->errorValue = stuff->destKind; return BadValue; } if (srcRgn) { RegionTranslate(srcRgn, stuff->xOff, stuff->yOff); (*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind); } SendShapeNotify(pWin, (int) stuff->destKind); return Success; }
void miSendExposures(WindowPtr pWin, RegionPtr pRgn, int dx, int dy) { BoxPtr pBox; int numRects; xEvent *pEvent, *pe; int i; pBox = RegionRects(pRgn); numRects = RegionNumRects(pRgn); if (!(pEvent = calloc(1, numRects * sizeof(xEvent)))) return; for (i = numRects, pe = pEvent; --i >= 0; pe++, pBox++) { pe->u.u.type = Expose; pe->u.expose.window = pWin->drawable.id; pe->u.expose.x = pBox->x1 - dx; pe->u.expose.y = pBox->y1 - dy; pe->u.expose.width = pBox->x2 - pBox->x1; pe->u.expose.height = pBox->y2 - pBox->y1; pe->u.expose.count = i; } #ifdef PANORAMIX if (!noPanoramiXExtension) { int scrnum = pWin->drawable.pScreen->myNum; int x = 0, y = 0; XID realWin = 0; if (!pWin->parent) { x = screenInfo.screens[scrnum]->x; y = screenInfo.screens[scrnum]->y; pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, scrnum); if (!win) { free(pEvent); return; } realWin = win->info[0].id; dixLookupWindow(&pWin, realWin, serverClient, DixSendAccess); } if (x || y || scrnum) for (i = 0; i < numRects; i++) { pEvent[i].u.expose.window = realWin; pEvent[i].u.expose.x += x; pEvent[i].u.expose.y += y; } } #endif DeliverEvents(pWin, pEvent, numRects, NullWindow); free(pEvent); }
static int ProcAppleWMFrameDraw(register ClientPtr client) { BoxRec ir, or; unsigned int title_length, title_max; unsigned char *title_bytes; REQUEST(xAppleWMFrameDrawReq); WindowPtr pWin; REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq); if (Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess)) return BadValue; ir = make_box(stuff->ix, stuff->iy, stuff->iw, stuff->ih); or = make_box(stuff->ox, stuff->oy, stuff->ow, stuff->oh); title_length = stuff->title_length; title_max = (stuff->length << 2) - sizeof(xAppleWMFrameDrawReq); if (title_max < title_length) return BadValue; title_bytes = (unsigned char *)&stuff[1]; errno = appleWMProcs->FrameDraw(pWin, stuff->frame_class, stuff->frame_attr, &or, &ir, title_length, title_bytes); if (errno != Success) { return errno; } return Success; }
static int ProcDMXForceWindowCreation(ClientPtr client) { xDMXForceWindowCreationReply rep; REQUEST(xDMXForceWindowCreationReq); WindowPtr pWin; int n; REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq); #ifdef PANORAMIX if (!noPanoramiXExtension) { PanoramiXRes *win; int i; if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW, DixReadAccess))) return -1; /* BadWindow */ FOR_NSCREENS(i) { if (Success != dixLookupWindow(&pWin, win->info[i].id, client, DixReadAccess)) return -1; /* BadWindow */ dmxForceWindowCreation(pWin); } goto doreply; }
int ProcXUngrabDeviceButton(ClientPtr client) { DeviceIntPtr dev; DeviceIntPtr mdev; WindowPtr pWin; GrabPtr temporaryGrab; int rc; REQUEST(xUngrabDeviceButtonReq); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); if (rc != Success) return rc; if (dev->button == NULL) return BadMatch; if (stuff->modifier_device != UseXKeyboard) { rc = dixLookupDevice(&mdev, stuff->modifier_device, client, DixReadAccess); if (rc != Success) return BadDevice; if (mdev->key == NULL) return BadMatch; } else mdev = PickKeyboard(client); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) return BadValue; temporaryGrab = AllocGrab(); if (!temporaryGrab) return BadAlloc; temporaryGrab->resource = client->clientAsMask; temporaryGrab->device = dev; temporaryGrab->window = pWin; temporaryGrab->type = DeviceButtonPress; temporaryGrab->grabtype = XI; temporaryGrab->modifierDevice = mdev; temporaryGrab->modifiersDetail.exact = stuff->modifiers; temporaryGrab->modifiersDetail.pMask = NULL; temporaryGrab->detail.exact = stuff->button; temporaryGrab->detail.pMask = NULL; DeletePassiveGrabFromList(temporaryGrab); FreeGrab(temporaryGrab); return Success; }
static int ProcWindowsWMFrameSetTitle(ClientPtr client) { unsigned int title_length, title_max; char *title_bytes; REQUEST(xWindowsWMFrameSetTitleReq); WindowPtr pWin; win32RootlessWindowPtr pRLWinPriv; int rc; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle\n"); #endif REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); if (rc != Success) return rc; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle - Window found\n"); #endif title_length = stuff->title_length; title_max = (stuff->length << 2) - sizeof(xWindowsWMFrameSetTitleReq); if (title_max < title_length) return BadValue; #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle - length is valid\n"); #endif title_bytes = malloc(title_length + 1); strncpy(title_bytes, (char *) &stuff[1], title_length); title_bytes[title_length] = '\0'; pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); if (pRLWinPriv == 0) { free(title_bytes); return BadWindow; } /* Flush the window style */ SetWindowText(pRLWinPriv->hWnd, title_bytes); free(title_bytes); #if CYGMULTIWINDOW_DEBUG ErrorF("ProcWindowsWMFrameSetTitle - done\n"); #endif return Success; }
int ProcXUngrabDeviceKey(ClientPtr client) { DeviceIntPtr dev; DeviceIntPtr mdev; WindowPtr pWin; GrabRec temporaryGrab; int rc; REQUEST(xUngrabDeviceKeyReq); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); if (rc != Success) return rc; if (dev->key == NULL) return BadMatch; if (stuff->modifier_device != UseXKeyboard) { rc = dixLookupDevice(&mdev, stuff->modifier_device, client, DixReadAccess); if (rc != Success) return BadDevice; if (mdev->key == NULL) return BadMatch; } else mdev = PickKeyboard(client); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (((stuff->key > dev->key->curKeySyms.maxKeyCode) || (stuff->key < dev->key->curKeySyms.minKeyCode)) && (stuff->key != AnyKey)) return BadValue; if ((stuff->modifiers != AnyModifier) && (stuff->modifiers & ~AllModifiersMask)) return BadValue; temporaryGrab.resource = client->clientAsMask; temporaryGrab.device = dev; temporaryGrab.window = pWin; temporaryGrab.type = DeviceKeyPress; temporaryGrab.modifierDevice = mdev; temporaryGrab.modifiersDetail.exact = stuff->modifiers; temporaryGrab.modifiersDetail.pMask = NULL; temporaryGrab.detail.exact = stuff->key; temporaryGrab.detail.pMask = NULL; DeletePassiveGrabFromList(&temporaryGrab); return Success; }
static int proc_present_query_capabilities (ClientPtr client) { REQUEST(xPresentQueryCapabilitiesReq); xPresentQueryCapabilitiesReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, }; WindowPtr window; RRCrtcPtr crtc = NULL; int r; REQUEST_SIZE_MATCH(xPresentQueryCapabilitiesReq); r = dixLookupWindow(&window, stuff->target, client, DixGetAttrAccess); switch (r) { case Success: crtc = present_get_crtc(window); break; case BadWindow: VERIFY_RR_CRTC(stuff->target, crtc, DixGetAttrAccess); break; default: return r; } rep.capabilities = present_query_capabilities(crtc); if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.capabilities); } WriteToClient(client, sizeof(rep), &rep); return Success; } static int (*proc_present_vector[PresentNumberRequests]) (ClientPtr) = { proc_present_query_version, /* 0 */ proc_present_pixmap, /* 1 */ proc_present_notify_msc, /* 2 */ proc_present_select_input, /* 3 */ proc_present_query_capabilities, /* 4 */ }; int proc_present_dispatch(ClientPtr client) { REQUEST(xReq); if (stuff->data >= PresentNumberRequests || !proc_present_vector[stuff->data]) return BadRequest; return (*proc_present_vector[stuff->data]) (client); }
/* replaced by dixLookupWindow */ WindowPtr SecurityLookupWindow(XID id, ClientPtr client, Mask access_mode) { WindowPtr pWin; int i = dixLookupWindow(&pWin, id, client, access_mode); static int warn = 1; if (warn > 0 && --warn) ErrorF("Warning: LookupWindow()/SecurityLookupWindow() " "are deprecated. Please convert your driver/module " "to use dixLookupWindow().\n"); return (i == Success) ? pWin : NULL; }
int ProcConvertSelection(ClientPtr client) { Bool paramsOkay; xEvent event; WindowPtr pWin; Selection *pSel; int rc; REQUEST(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq); rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess); if (rc != Success) return rc; paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target); paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property); if (!paramsOkay) { client->errorValue = stuff->property; return BadAtom; } rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess); memset(&event, 0, sizeof(xEvent)); if (rc != Success && rc != BadMatch) return rc; else if (rc == Success && pSel->window != None) { event.u.u.type = SelectionRequest; event.u.selectionRequest.owner = pSel->window; event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.requestor = stuff->requestor; event.u.selectionRequest.selection = stuff->selection; event.u.selectionRequest.target = stuff->target; event.u.selectionRequest.property = stuff->property; if (pSel->client && pSel->client != serverClient && !pSel->client->clientGone) { WriteEventsToClient(pSel->client, 1, &event); return Success; } } event.u.u.type = SelectionNotify; event.u.selectionNotify.time = stuff->time; event.u.selectionNotify.requestor = stuff->requestor; event.u.selectionNotify.selection = stuff->selection; event.u.selectionNotify.target = stuff->target; event.u.selectionNotify.property = None; WriteEventsToClient(client, 1, &event); return Success; }
int ProcSetSelectionOwner(ClientPtr client) { WindowPtr pWin = NULL; TimeStamp time; Selection *pSel; int rc; REQUEST(xSetSelectionOwnerReq); REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); UpdateCurrentTime(); time = ClientTimeToServerTime(stuff->time); /* If the client's time stamp is in the future relative to the server's time stamp, do not set the selection, just return success. */ if (CompareTimeStamps(time, currentTime) == LATER) return Success; if (stuff->window != None) { rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess); if (rc != Success) return rc; } if (!ValidAtom(stuff->selection)) { client->errorValue = stuff->selection; return BadAtom; } /* * First, see if the selection is already set... */ rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess); if (rc == Success) { /* If the timestamp in client's request is in the past relative to the time stamp indicating the last time the owner of the selection was set, do not set the selection, just return success. */ if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER) return Success; if (pSel->client && (!pWin || (pSel->client != client))) { xEvent event = { .u.selectionClear.time = time.milliseconds, .u.selectionClear.window = pSel->window, .u.selectionClear.atom = pSel->selection }; event.u.u.type = SelectionClear; WriteEventsToClient(pSel->client, 1, &event); } } else if (rc == BadMatch) {
int ProcConvertSelection(ClientPtr client) { Bool paramsOkay; xEvent event; WindowPtr pWin; Selection *pSel; int rc; REQUEST(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq); rc = dixLookupWindow(&pWin, stuff->requestor, client, DixSetAttrAccess); if (rc != Success) return rc; paramsOkay = ValidAtom(stuff->selection) && ValidAtom(stuff->target); paramsOkay &= (stuff->property == None) || ValidAtom(stuff->property); if (!paramsOkay) { client->errorValue = stuff->property; return BadAtom; } rc = dixLookupSelection(&pSel, stuff->selection, client, DixReadAccess); memset(&event, 0, sizeof(xEvent)); if (rc != Success && rc != BadMatch) return rc; else if (rc == Success && pSel->window != None) { event.u.u.type = SelectionRequest; event.u.selectionRequest.owner = pSel->window; event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.requestor = stuff->requestor; event.u.selectionRequest.selection = stuff->selection; event.u.selectionRequest.target = stuff->target; event.u.selectionRequest.property = stuff->property; if (TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab)) return client->noClientException; } event.u.u.type = SelectionNotify; event.u.selectionNotify.time = stuff->time; event.u.selectionNotify.requestor = stuff->requestor; event.u.selectionNotify.selection = stuff->selection; event.u.selectionNotify.target = stuff->target; event.u.selectionNotify.property = None; TryClientEvents(client, NULL, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); return client->noClientException; }
int ProcRRCreateMode (ClientPtr client) { REQUEST(xRRCreateModeReq); xRRCreateModeReply rep; WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; xRRModeInfo *modeInfo; long units_after; char *name; int error, rc; RRModePtr mode; REQUEST_AT_LEAST_SIZE (xRRCreateModeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); modeInfo = &stuff->modeInfo; name = (char *) (stuff + 1); units_after = (stuff->length - bytes_to_int32(sizeof (xRRCreateModeReq))); /* check to make sure requested name fits within the data provided */ if (bytes_to_int32(modeInfo->nameLength) > units_after) return BadLength; mode = RRModeCreateUser (pScreen, modeInfo, name, &error); if (!mode) return error; rep.type = X_Reply; rep.pad0 = 0; rep.sequenceNumber = client->sequence; rep.length = 0; rep.mode = mode->mode.id; if (client->swapped) { int n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.mode, n); } WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep); /* Drop out reference to this mode */ RRModeDestroy (mode); return client->noClientException; }
int ProcXGetDeviceDontPropagateList(ClientPtr client) { CARD16 count = 0; int i, rc; XEventClass *buf = NULL, *tbuf; WindowPtr pWin; xGetDeviceDontPropagateListReply rep; OtherInputMasks *others; REQUEST(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); rep.repType = X_Reply; rep.RepType = X_GetDeviceDontPropagateList; rep.sequenceNumber = client->sequence; rep.length = 0; rep.count = 0; rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if ((others = wOtherInputMasks(pWin)) != 0) { for (i = 0; i < EMASKSIZE; i++) ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT); if (count) { rep.count = count; buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass)); rep.length = bytes_to_int32(rep.count * sizeof(XEventClass)); tbuf = buf; for (i = 0; i < EMASKSIZE; i++) tbuf = ClassFromMask(tbuf, others->dontPropagateMask[i], i, NULL, CREATE); } } WriteReplyToClient(client, sizeof(xGetDeviceDontPropagateListReply), &rep); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XEventClass), buf); free(buf); } return Success; }
int ProcXFixesSelectSelectionInput(ClientPtr client) { REQUEST(xXFixesSelectSelectionInputReq); WindowPtr pWin; int rc; REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (stuff->eventMask & ~SelectionAllEvents) { client->errorValue = stuff->eventMask; return BadValue; } return XFixesSelectSelectionInput(client, stuff->selection, pWin, stuff->eventMask); }
static int AttrValidate( ClientPtr client, int attrib_mask, AppGroupPtr pAppGrp) { WindowPtr pWin; int idepth, ivids, found, rc; ScreenPtr pScreen; DepthPtr pDepth; ColormapPtr pColormap; rc = dixLookupWindow(&pWin, pAppGrp->default_root, client, DixUnknownAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root) return BadWindow; pDepth = pScreen->allowedDepths; if (pAppGrp->root_visual) { found = FALSE; for (idepth = 0; idepth < pScreen->numDepths; idepth++, pDepth++) { for (ivids = 0; ivids < pDepth->numVids; ivids++) { if (pAppGrp->root_visual == pDepth->vids[ivids]) { found = TRUE; break; } } } if (!found) return BadMatch; } if (pAppGrp->default_colormap) { pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP); /* XXX check that pColormap is not NULL */ if (pColormap->pScreen != pScreen) return BadColor; if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual)) return BadMatch; } return client->noClientException; }
int ProcXIChangeCursor(ClientPtr client) { int rc; WindowPtr pWin = NULL; DeviceIntPtr pDev = NULL; CursorPtr pCursor = NULL; REQUEST(xXIChangeCursorReq); REQUEST_SIZE_MATCH(xXIChangeCursorReq); rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess); if (rc != Success) return rc; if (!IsMaster(pDev) || !IsPointerDevice(pDev)) return BadDevice; if (stuff->win != None) { rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess); if (rc != Success) return rc; } if (stuff->cursor == None) { if (pWin == pWin->drawable.pScreen->root) pCursor = rootCursor; else pCursor = (CursorPtr)None; } else { rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) return rc; } ChangeWindowDeviceCursor(pWin, pDev, pCursor); return Success; }
static int VMwareXineramaGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin; xPanoramiXGetScreenSizeReply rep; register int n; ExtensionEntry *ext; ScrnInfoPtr pScrn; VMWAREPtr pVMWARE; int rc; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (!(ext = CheckExtension(PANORAMIX_PROTOCOL_NAME))) { return BadMatch; } pScrn = ext->extPrivate; pVMWARE = VMWAREPTR(pScrn); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; rep.width = pVMWARE->xineramaState[stuff->screen].width; rep.height = pVMWARE->xineramaState[stuff->screen].height; rep.window = stuff->window; rep.screen = stuff->screen; if(client->swapped) { _swaps(&rep.sequenceNumber, n); _swapl(&rep.length, n); _swapl(&rep.width, n); _swapl(&rep.height, n); _swapl(&rep.window, n); _swapl(&rep.screen, n); } WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep); return client->noClientException; }
static int ProcXTestCompareCursor(ClientPtr client) { REQUEST(xXTestCompareCursorReq); xXTestCompareCursorReply rep; WindowPtr pWin; CursorPtr pCursor; int rc; DeviceIntPtr ptr = PickPointer(client); REQUEST_SIZE_MATCH(xXTestCompareCursorReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (!ptr) return BadAccess; if (stuff->cursor == None) pCursor = NullCursor; else if (stuff->cursor == XTestCurrentCursor) pCursor = GetSpriteCursor(ptr); else { rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor, RT_CURSOR, client, DixReadAccess); if (rc != Success) { client->errorValue = stuff->cursor; return rc; } } rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; rep.same = (wCursor(pWin) == pCursor); if (client->swapped) { swaps(&rep.sequenceNumber); } WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep); return Success; }
static int proc_present_select_input (ClientPtr client) { REQUEST(xPresentSelectInputReq); WindowPtr window; int rc; REQUEST_SIZE_MATCH(xPresentSelectInputReq); LEGAL_NEW_RESOURCE(stuff->eid, client); rc = dixLookupWindow(&window, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; if (stuff->eventMask & ~PresentAllEvents) { client->errorValue = stuff->eventMask; return BadValue; } return present_select_input(client, stuff->eid, window, stuff->eventMask); }
static int ProcSELinuxListProperties(ClientPtr client) { WindowPtr pWin; PropertyPtr pProp; SELinuxListItemRec *items; int rc, count, size, i; CARD32 id; REQUEST(SELinuxGetContextReq); REQUEST_SIZE_MATCH(SELinuxGetContextReq); rc = dixLookupWindow(&pWin, stuff->id, client, DixListPropAccess); if (rc != Success) return rc; /* Count the number of properties and allocate items */ count = 0; for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) count++; items = calloc(count, sizeof(SELinuxListItemRec)); if (count && !items) return BadAlloc; /* Fill in the items and calculate size */ i = 0; size = 0; for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) { id = pProp->propertyName; rc = SELinuxPopulateItem(items + i, &pProp->devPrivates, id, &size); if (rc != Success) { SELinuxFreeItems(items, count); return rc; } i++; } return SELinuxSendItemsToClient(client, items, size, count); }
static int ProcShapeInputSelected(ClientPtr client) { REQUEST(xShapeInputSelectedReq); WindowPtr pWin; ShapeEventPtr pShapeEvent, *pHead; int enabled, rc; xShapeInputSelectedReply rep; REQUEST_SIZE_MATCH(xShapeInputSelectedReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id, ShapeEventType, client, DixReadAccess); if (rc != Success && rc != BadValue) return rc; enabled = xFalse; if (pHead) { for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { if (pShapeEvent->client == client) { enabled = xTrue; break; } } } rep.type = X_Reply; rep.enabled = enabled; rep.sequenceNumber = client->sequence; rep.length = 0; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep); return Success; }
// was PanoramiX static int ProcPseudoramiXGetScreenSize(ClientPtr client) { REQUEST(xPanoramiXGetScreenSizeReq); WindowPtr pWin; xPanoramiXGetScreenSizeReply rep; register int rc; TRACE; if (stuff->screen >= pseudoramiXNumScreens) return BadMatch; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; /* screen dimensions */ rep.width = pseudoramiXScreens[stuff->screen].w; // was screenInfo.screens[stuff->screen]->width; rep.height = pseudoramiXScreens[stuff->screen].h; // was screenInfo.screens[stuff->screen]->height; rep.window = stuff->window; rep.screen = stuff->screen; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.width); swapl(&rep.height); swapl(&rep.window); swapl(&rep.screen); } WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply),&rep); return Success; }
int ProcRRXineramaGetState(ClientPtr client) { REQUEST(xPanoramiXGetStateReq); WindowPtr pWin; xPanoramiXGetStateReply rep; register int rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; Bool active = FALSE; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); if (pScrPriv) { /* XXX do we need more than this? */ active = TRUE; } rep.type = X_Reply; rep.state = active; rep.sequenceNumber = client->sequence; rep.length = 0; rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep); return Success; }
static int ProcSELinuxGetPropertyContext(ClientPtr client, pointer privKey) { WindowPtr pWin; PropertyPtr pProp; SELinuxObjectRec *obj; int rc; REQUEST(SELinuxGetPropertyContextReq); REQUEST_SIZE_MATCH(SELinuxGetPropertyContextReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixGetPropAccess); if (rc != Success) return rc; rc = dixLookupProperty(&pProp, pWin, stuff->property, client, DixGetAttrAccess); if (rc != Success) return rc; obj = dixLookupPrivate(&pProp->devPrivates, privKey); return SELinuxSendContextReply(client, obj->sid); }