⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swapreq.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 2 页
字号:
/************************************************************Copyright (c) 1987  X ConsortiumPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THEX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER INAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.Except as contained in this notice, the name of the X Consortium shall not beused in advertising or otherwise to promote the sale, use or other dealingsin this Software without prior written authorization from the X Consortium.Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.                        All Rights ReservedPermission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and thatboth that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not beused in advertising or publicity pertaining to distribution of thesoftware without specific, written prior permission.  DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDINGALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALLDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ORANY 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 THISSOFTWARE.********************************************************//* $XConsortium: swapreq.c,v 1.39 94/04/17 20:26:45 dpw Exp $ *//* $XFree86: xc/programs/Xserver/dix/swapreq.c,v 3.1 1996/05/06 05:56:24 dawes Exp $ */#include "X.h"#define NEED_EVENTS#include "Xproto.h"#include "Xprotostr.h"#include "misc.h"#include "dixstruct.h"#include "extnsionst.h"	/* for SendEvent */#include "swapreq.h"extern int (* ProcVector[256]) ();/* Thanks to Jack Palevich for testing and subsequently rewriting all this *//* Byte swap a list of longs */voidSwapLongs (list, count)	register CARD32 *list;	register unsigned long count;{	register char n;	while (count >= 8) {	    swapl(list+0, n);	    swapl(list+1, n);	    swapl(list+2, n);	    swapl(list+3, n);	    swapl(list+4, n);	    swapl(list+5, n);	    swapl(list+6, n);	    swapl(list+7, n);	    list += 8;	    count -= 8;	}	if (count != 0) {	    do {		swapl(list, n);		list++;	    } while (--count != 0);	}}/* Byte swap a list of shorts */voidSwapShorts (list, count)	register short *list;	register unsigned long count;{	register char n;	while (count >= 16) {	    swaps(list+0, n);	    swaps(list+1, n);	    swaps(list+2, n);	    swaps(list+3, n);	    swaps(list+4, n);	    swaps(list+5, n);	    swaps(list+6, n);	    swaps(list+7, n);	    swaps(list+8, n);	    swaps(list+9, n);	    swaps(list+10, n);	    swaps(list+11, n);	    swaps(list+12, n);	    swaps(list+13, n);	    swaps(list+14, n);	    swaps(list+15, n);	    list += 16;	    count -= 16;	}	if (count != 0) {	    do {		swaps(list, n);		list++;	    } while (--count != 0);	}}/* The following is used for all requests that have   no fields to be swapped (except "length") */intSProcSimpleReq(client)	register ClientPtr client;{    register char n;    REQUEST(xReq);    swaps(&stuff->length, n);    return(*ProcVector[stuff->reqType])(client);}/* The following is used for all requests that have   only a single 32-bit field to be swapped, coming   right after the "length" field */intSProcResourceReq(client)	register ClientPtr client;{    register char n;    REQUEST(xResourceReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */    swapl(&stuff->id, n);    return(*ProcVector[stuff->reqType])(client);}intSProcCreateWindow(client)    register ClientPtr client;{    register char n;    REQUEST(xCreateWindowReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xCreateWindowReq);    swapl(&stuff->wid, n);    swapl(&stuff->parent, n);    swaps(&stuff->x, n);    swaps(&stuff->y, n);    swaps(&stuff->width, n);    swaps(&stuff->height, n);    swaps(&stuff->borderWidth, n);    swaps(&stuff->class, n);    swapl(&stuff->visual, n);    swapl(&stuff->mask, n);    SwapRestL(stuff);    return((* ProcVector[X_CreateWindow])(client));}intSProcChangeWindowAttributes(client)    register ClientPtr client;{    register char n;    REQUEST(xChangeWindowAttributesReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);    swapl(&stuff->window, n);    swapl(&stuff->valueMask, n);    SwapRestL(stuff);    return((* ProcVector[X_ChangeWindowAttributes])(client));}intSProcReparentWindow(client)    register ClientPtr client;{    register char n;    REQUEST(xReparentWindowReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xReparentWindowReq);    swapl(&stuff->window, n);    swapl(&stuff->parent, n);    swaps(&stuff->x, n);    swaps(&stuff->y, n);    return((* ProcVector[X_ReparentWindow])(client));}intSProcConfigureWindow(client)    register ClientPtr client;{    register char n;    REQUEST(xConfigureWindowReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);    swapl(&stuff->window, n);    swaps(&stuff->mask, n);    SwapRestL(stuff);    return((* ProcVector[X_ConfigureWindow])(client));}intSProcInternAtom(client)    register ClientPtr client;{    register char n;    REQUEST(xInternAtomReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xInternAtomReq);    swaps(&stuff->nbytes, n);    return((* ProcVector[X_InternAtom])(client));}intSProcChangeProperty(client)    register ClientPtr client;{    register char n;    REQUEST(xChangePropertyReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xChangePropertyReq);    swapl(&stuff->window, n);    swapl(&stuff->property, n);    swapl(&stuff->type, n);    swapl(&stuff->nUnits, n);    switch ( stuff->format ) {        case 8 :	    break;        case 16:	    SwapRestS(stuff);	    break;	case 32:	    SwapRestL(stuff);	    break;	}    return((* ProcVector[X_ChangeProperty])(client));}int SProcDeleteProperty(client)    register ClientPtr client;{    register char n;    REQUEST(xDeletePropertyReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xDeletePropertyReq);    swapl(&stuff->window, n);    swapl(&stuff->property, n);    return((* ProcVector[X_DeleteProperty])(client));              }int SProcGetProperty(client)    register ClientPtr client;{    register char n;    REQUEST(xGetPropertyReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xGetPropertyReq);    swapl(&stuff->window, n);    swapl(&stuff->property, n);    swapl(&stuff->type, n);    swapl(&stuff->longOffset, n);    swapl(&stuff->longLength, n);    return((* ProcVector[X_GetProperty])(client));}intSProcSetSelectionOwner(client)    register ClientPtr client;{    register char n;    REQUEST(xSetSelectionOwnerReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);    swapl(&stuff->window, n);    swapl(&stuff->selection, n);    swapl(&stuff->time, n);    return((* ProcVector[X_SetSelectionOwner])(client));}intSProcConvertSelection(client)    register ClientPtr client;{    register char n;    REQUEST(xConvertSelectionReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xConvertSelectionReq);    swapl(&stuff->requestor, n);    swapl(&stuff->selection, n);    swapl(&stuff->target, n);    swapl(&stuff->property, n);    swapl(&stuff->time, n);    return((* ProcVector[X_ConvertSelection])(client));}intSProcSendEvent(client)    register ClientPtr client;{    register char n;    xEvent eventT;    EventSwapPtr proc;    REQUEST(xSendEventReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xSendEventReq);    swapl(&stuff->destination, n);    swapl(&stuff->eventMask, n);    /* Swap event */    proc = EventSwapVector[stuff->event.u.u.type & 0177];    if (!proc ||  proc == NotImplemented)    /* no swapping proc; invalid event type? */       return (BadValue);    (*proc)(&stuff->event, &eventT);    stuff->event = eventT;    return((* ProcVector[X_SendEvent])(client));}intSProcGrabPointer(client)    register ClientPtr client;{    register char n;    REQUEST(xGrabPointerReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xGrabPointerReq);    swapl(&stuff->grabWindow, n);    swaps(&stuff->eventMask, n);    swapl(&stuff->confineTo, n);    swapl(&stuff->cursor, n);    swapl(&stuff->time, n);    return((* ProcVector[X_GrabPointer])(client));}intSProcGrabButton(client)    register ClientPtr client;{    register char n;    REQUEST(xGrabButtonReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xGrabButtonReq);    swapl(&stuff->grabWindow, n);    swaps(&stuff->eventMask, n);    swapl(&stuff->confineTo, n);    swapl(&stuff->cursor, n);    swaps(&stuff->modifiers, n);    return((* ProcVector[X_GrabButton])(client));}intSProcUngrabButton(client)    register ClientPtr client;{    register char n;    REQUEST(xUngrabButtonReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xUngrabButtonReq);    swapl(&stuff->grabWindow, n);    swaps(&stuff->modifiers, n);    return((* ProcVector[X_UngrabButton])(client));}intSProcChangeActivePointerGrab(client)    register ClientPtr client;{    register char n;    REQUEST(xChangeActivePointerGrabReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);    swapl(&stuff->cursor, n);    swapl(&stuff->time, n);    swaps(&stuff->eventMask, n);    return((* ProcVector[X_ChangeActivePointerGrab])(client));}intSProcGrabKeyboard(client)    register ClientPtr client;{    register char n;    REQUEST(xGrabKeyboardReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xGrabKeyboardReq);    swapl(&stuff->grabWindow, n);    swapl(&stuff->time, n);    return((* ProcVector[X_GrabKeyboard])(client));}intSProcGrabKey(client)    register ClientPtr client;{    register char n;    REQUEST(xGrabKeyReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xGrabKeyReq);    swapl(&stuff->grabWindow, n);    swaps(&stuff->modifiers, n);    return((* ProcVector[X_GrabKey])(client));}intSProcUngrabKey(client)    register ClientPtr client;{    register char n;    REQUEST(xUngrabKeyReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xUngrabKeyReq);    swapl(&stuff->grabWindow, n);    swaps(&stuff->modifiers, n);    return((* ProcVector[X_UngrabKey])(client));}intSProcGetMotionEvents(client)    register ClientPtr client;{    register char n;    REQUEST(xGetMotionEventsReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xGetMotionEventsReq);    swapl(&stuff->window, n);    swapl(&stuff->start, n);    swapl(&stuff->stop, n);    return((* ProcVector[X_GetMotionEvents])(client));}intSProcTranslateCoords(client)    register ClientPtr client;{    register char n;    REQUEST(xTranslateCoordsReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xTranslateCoordsReq);    swapl(&stuff->srcWid, n);    swapl(&stuff->dstWid, n);    swaps(&stuff->srcX, n);    swaps(&stuff->srcY, n);    return((* ProcVector[X_TranslateCoords])(client));}intSProcWarpPointer(client)    register ClientPtr client;{    register char n;    REQUEST(xWarpPointerReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xWarpPointerReq);    swapl(&stuff->srcWid, n);    swapl(&stuff->dstWid, n);    swaps(&stuff->srcX, n);    swaps(&stuff->srcY, n);    swaps(&stuff->srcWidth, n);    swaps(&stuff->srcHeight, n);    swaps(&stuff->dstX, n);    swaps(&stuff->dstY, n);    return((* ProcVector[X_WarpPointer])(client));}intSProcSetInputFocus(client)    register ClientPtr client;{    register char n;    REQUEST(xSetInputFocusReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xSetInputFocusReq);    swapl(&stuff->focus, n);    swapl(&stuff->time, n);    return((* ProcVector[X_SetInputFocus])(client));}intSProcOpenFont(client)    register ClientPtr client;{    register char n;    REQUEST(xOpenFontReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xOpenFontReq);    swapl(&stuff->fid, n);    swaps(&stuff->nbytes, n);    return((* ProcVector[X_OpenFont])(client));}intSProcListFonts(client)    register ClientPtr client;{    register char n;    REQUEST(xListFontsReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xListFontsReq);    swaps(&stuff->maxNames, n);    swaps(&stuff->nbytes, n);    return((* ProcVector[X_ListFonts])(client));}intSProcListFontsWithInfo(client)    register ClientPtr client;{    register char n;    REQUEST(xListFontsWithInfoReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq);    swaps(&stuff->maxNames, n);    swaps(&stuff->nbytes, n);    return((* ProcVector[X_ListFontsWithInfo])(client));}intSProcSetFontPath(client)    register ClientPtr client;{    register char n;    REQUEST(xSetFontPathReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xSetFontPathReq);    swaps(&stuff->nFonts, n);    return((* ProcVector[X_SetFontPath])(client));}intSProcCreatePixmap(client)    register ClientPtr client;{    register char n;    REQUEST(xCreatePixmapReq);    swaps(&stuff->length, n);    REQUEST_SIZE_MATCH(xCreatePixmapReq);    swapl(&stuff->pid, n);    swapl(&stuff->drawable, n);    swaps(&stuff->width, n);    swaps(&stuff->height, n);    return((* ProcVector[X_CreatePixmap])(client));}intSProcCreateGC(client)    register ClientPtr client;{    register char n;    REQUEST(xCreateGCReq);    swaps(&stuff->length, n);    REQUEST_AT_LEAST_SIZE(xCreateGCReq);    swapl(&stuff->gc, n);    swapl(&stuff->drawable, n);    swapl(&stuff->mask, n);    SwapRestL(stuff);    return((* ProcVector[X_CreateGC])(client));}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -