📄 dispatch.c
字号:
SecurityWriteAccess); if (!pParent) return(BadWindow); if (SAME_SCREENS(pWin->drawable, pParent->drawable)) { if ((pWin->backgroundState == ParentRelative) && (pParent->drawable.depth != pWin->drawable.depth)) return BadMatch; if ((pWin->drawable.class != InputOnly) && (pParent->drawable.class == InputOnly)) return BadMatch; result = ReparentWindow(pWin, pParent, (short)stuff->x, (short)stuff->y, client); if (client->noClientException != Success) return(client->noClientException); else return(result); } else return (BadMatch);}intProcMapWindow(client) register ClientPtr client;{ register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); MapWindow(pWin, client); /* update cache to say it is mapped */ return(client->noClientException);}intProcMapSubwindows(client) register ClientPtr client;{ register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); MapSubwindows(pWin, client); /* update cache to say it is mapped */ return(client->noClientException);}intProcUnmapWindow(client) register ClientPtr client;{ register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); UnmapWindow(pWin, FALSE); /* update cache to say it is mapped */ return(client->noClientException);}intProcUnmapSubwindows(client) register ClientPtr client;{ register WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); UnmapSubwindows(pWin); return(client->noClientException);}intProcConfigureWindow(client) register ClientPtr client;{ register WindowPtr pWin; REQUEST(xConfigureWindowReq); register int result; int len; REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); if (Ones((Mask)stuff->mask) != len) return BadLength; result = ConfigureWindow(pWin, (Mask)stuff->mask, (XID *) &stuff[1], client); if (client->noClientException != Success) return(client->noClientException); else return(result);}intProcCirculateWindow(client) register ClientPtr client;{ register WindowPtr pWin; REQUEST(xCirculateWindowReq); REQUEST_SIZE_MATCH(xCirculateWindowReq); if ((stuff->direction != RaiseLowest) && (stuff->direction != LowerHighest)) { client->errorValue = stuff->direction; return BadValue; } pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityWriteAccess); if (!pWin) return(BadWindow); CirculateWindow(pWin, (int)stuff->direction, client); return(client->noClientException);}intGetGeometry(client, rep) register ClientPtr client; xGetGeometryReply *rep;{ register DrawablePtr pDraw; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, SecurityReadAccess); rep->type = X_Reply; rep->length = 0; rep->sequenceNumber = client->sequence; rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id; rep->depth = pDraw->depth; rep->width = pDraw->width; rep->height = pDraw->height; /* XXX - Because the pixmap-implementation of the multibuffer extension * may have the buffer-id's drawable resource value be a pointer * to the buffer's window instead of the buffer itself * (this happens if the buffer is the displayed buffer), * we also have to check that the id matches before we can * truly say that it is a DRAWABLE_WINDOW. */ if ((pDraw->type == UNDRAWABLE_WINDOW) || ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) { register WindowPtr pWin = (WindowPtr)pDraw; rep->x = pWin->origin.x - wBorderWidth (pWin); rep->y = pWin->origin.y - wBorderWidth (pWin); rep->borderWidth = pWin->borderWidth; } else /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */ { rep->x = rep->y = rep->borderWidth = 0; } return Success;}intProcGetGeometry(client) register ClientPtr client;{ xGetGeometryReply rep; int status; if ((status = GetGeometry(client, &rep)) != Success) return status; WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); return(client->noClientException);}intProcQueryTree(client) register ClientPtr client;{ xQueryTreeReply reply; int numChildren = 0; register WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, SecurityReadAccess); if (!pWin) return(BadWindow); reply.type = X_Reply; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.sequenceNumber = client->sequence; if (pWin->parent) reply.parent = pWin->parent->drawable.id; else reply.parent = (Window)None; pHead = RealChildHead(pWin); for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) numChildren++; if (numChildren) { int curChild = 0; childIDs = (Window *) ALLOCATE_LOCAL(numChildren * sizeof(Window)); if (!childIDs) return BadAlloc; for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) childIDs[curChild++] = pChild->drawable.id; } reply.nChildren = numChildren; reply.length = (numChildren * sizeof(Window)) >> 2; WriteReplyToClient(client, sizeof(xQueryTreeReply), &reply); if (numChildren) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, numChildren * sizeof(Window), childIDs); DEALLOCATE_LOCAL(childIDs); } return(client->noClientException);}intProcInternAtom(client) register ClientPtr client;{ Atom atom; char *tchar; REQUEST(xInternAtomReq); REQUEST_FIXED_SIZE(xInternAtomReq, stuff->nbytes); if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse)) { client->errorValue = stuff->onlyIfExists; return(BadValue); } tchar = (char *) &stuff[1]; atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists); if (atom != BAD_RESOURCE) { xInternAtomReply reply; reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; reply.atom = atom; WriteReplyToClient(client, sizeof(xInternAtomReply), &reply); return(client->noClientException); } else return (BadAlloc);}intProcGetAtomName(client) register ClientPtr client;{ char *str; xGetAtomNameReply reply; int len; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if ( (str = NameForAtom(stuff->id)) ) { len = strlen(str); reply.type = X_Reply; reply.length = (len + 3) >> 2; reply.sequenceNumber = client->sequence; reply.nameLength = len; WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply); (void)WriteToClient(client, len, str); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadAtom); }}#ifdef K5AUTHextern int k5_bad();#endifintProcSetSelectionOwner(client) register ClientPtr client;{ WindowPtr pWin; TimeStamp time; 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) { pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, SecurityReadAccess); if (!pWin) return(BadWindow); } else pWin = (WindowPtr)None; if (ValidAtom(stuff->selection)) { int i = 0; /* * First, see if the selection is already set... */ while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; if (i < NumCurrentSelections) { xEvent event; /* 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, CurrentSelections[i].lastTimeChanged) == EARLIER) return Success; if (CurrentSelections[i].client && (!pWin || (CurrentSelections[i].client != client))) { event.u.u.type = SelectionClear; event.u.selectionClear.time = time.milliseconds; event.u.selectionClear.window = CurrentSelections[i].window; event.u.selectionClear.atom = CurrentSelections[i].selection; (void) TryClientEvents (CurrentSelections[i].client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); } } else { /* * It doesn't exist, so add it... */ Selection *newsels; if (i == 0) newsels = (Selection *)xalloc(sizeof(Selection)); else newsels = (Selection *)xrealloc(CurrentSelections, (NumCurrentSelections + 1) * sizeof(Selection)); if (!newsels) return BadAlloc; NumCurrentSelections++; CurrentSelections = newsels; CurrentSelections[i].selection = stuff->selection; } CurrentSelections[i].lastTimeChanged = time; CurrentSelections[i].window = stuff->window; CurrentSelections[i].pWin = pWin; CurrentSelections[i].client = (pWin ? client : NullClient); return (client->noClientException); } else { client->errorValue = stuff->selection; return (BadAtom); }}intProcGetSelectionOwner(client) register ClientPtr client;{ REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if (ValidAtom(stuff->id)) { int i; xGetSelectionOwnerReply reply; i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->id) i++; reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; if (i < NumCurrentSelections) reply.owner = CurrentSelections[i].window; else reply.owner = None; WriteReplyToClient(client, sizeof(xGetSelectionOwnerReply), &reply); return(client->noClientException); } else { client->errorValue = stuff->id; return (BadAtom); }}intProcConvertSelection(client) register ClientPtr client;{ Bool paramsOkay; xEvent event; WindowPtr pWin; REQUEST(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, SecurityReadAccess); if (!pWin) return(BadWindow); paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); if (stuff->property != None) paramsOkay &= ValidAtom(stuff->property); if (paramsOkay) { int i; i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != stuff->selection) i++; if ((i < NumCurrentSelections) && (CurrentSelections[i].window != None)#ifdef XCSECURITY && (!client->CheckAccess || (* client->CheckAccess)(client, CurrentSelections[i].window, RT_WINDOW, SecurityReadAccess, CurrentSelections[i].pWin))#endif ) { event.u.u.type = SelectionRequest; event.u.selectionRequest.time = stuff->time; event.u.selectionRequest.owner = CurrentSelections[i].window; 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( CurrentSelections[i].client, &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; (void) TryClientEvents(client, &event, 1, NoEventMask, NoEventMask /* CantBeFiltered */, NullGrab); return (client->noClientException); } else { client->errorValue = stuff->property; return (BadAtom); }}intProcGrabServer(client) register ClientPtr client;{ REQUEST_SIZE_MATCH(xReq);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -