swapreq.c revision 05b261ec
1/************************************************************ 2 3Copyright 1987, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25 26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 27 28 All Rights Reserved 29 30Permission to use, copy, modify, and distribute this software and its 31documentation for any purpose and without fee is hereby granted, 32provided that the above copyright notice appear in all copies and that 33both that copyright notice and this permission notice appear in 34supporting documentation, and that the name of Digital not be 35used in advertising or publicity pertaining to distribution of the 36software without specific, written prior permission. 37 38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 44SOFTWARE. 45 46********************************************************/ 47 48 49#ifdef HAVE_DIX_CONFIG_H 50#include <dix-config.h> 51#endif 52 53#include <X11/X.h> 54#define NEED_EVENTS 55#include <X11/Xproto.h> 56#include <X11/Xprotostr.h> 57#include "misc.h" 58#include "dixstruct.h" 59#include "extnsionst.h" /* for SendEvent */ 60#include "swapreq.h" 61 62/* Thanks to Jack Palevich for testing and subsequently rewriting all this */ 63 64/* Byte swap a list of longs */ 65_X_EXPORT void 66SwapLongs (CARD32 *list, unsigned long count) 67{ 68 char n; 69 70 while (count >= 8) { 71 swapl(list+0, n); 72 swapl(list+1, n); 73 swapl(list+2, n); 74 swapl(list+3, n); 75 swapl(list+4, n); 76 swapl(list+5, n); 77 swapl(list+6, n); 78 swapl(list+7, n); 79 list += 8; 80 count -= 8; 81 } 82 if (count != 0) { 83 do { 84 swapl(list, n); 85 list++; 86 } while (--count != 0); 87 } 88} 89 90/* Byte swap a list of shorts */ 91_X_EXPORT void 92SwapShorts (short *list, unsigned long count) 93{ 94 char n; 95 96 while (count >= 16) { 97 swaps(list+0, n); 98 swaps(list+1, n); 99 swaps(list+2, n); 100 swaps(list+3, n); 101 swaps(list+4, n); 102 swaps(list+5, n); 103 swaps(list+6, n); 104 swaps(list+7, n); 105 swaps(list+8, n); 106 swaps(list+9, n); 107 swaps(list+10, n); 108 swaps(list+11, n); 109 swaps(list+12, n); 110 swaps(list+13, n); 111 swaps(list+14, n); 112 swaps(list+15, n); 113 list += 16; 114 count -= 16; 115 } 116 if (count != 0) { 117 do { 118 swaps(list, n); 119 list++; 120 } while (--count != 0); 121 } 122} 123 124/* The following is used for all requests that have 125 no fields to be swapped (except "length") */ 126int 127SProcSimpleReq(ClientPtr client) 128{ 129 char n; 130 131 REQUEST(xReq); 132 swaps(&stuff->length, n); 133 return(*ProcVector[stuff->reqType])(client); 134} 135 136/* The following is used for all requests that have 137 only a single 32-bit field to be swapped, coming 138 right after the "length" field */ 139int 140SProcResourceReq(ClientPtr client) 141{ 142 char n; 143 144 REQUEST(xResourceReq); 145 swaps(&stuff->length, n); 146 REQUEST_AT_LEAST_SIZE(xResourceReq); /* not EXACT */ 147 swapl(&stuff->id, n); 148 return(*ProcVector[stuff->reqType])(client); 149} 150 151int 152SProcCreateWindow(ClientPtr client) 153{ 154 char n; 155 156 REQUEST(xCreateWindowReq); 157 swaps(&stuff->length, n); 158 REQUEST_AT_LEAST_SIZE(xCreateWindowReq); 159 swapl(&stuff->wid, n); 160 swapl(&stuff->parent, n); 161 swaps(&stuff->x, n); 162 swaps(&stuff->y, n); 163 swaps(&stuff->width, n); 164 swaps(&stuff->height, n); 165 swaps(&stuff->borderWidth, n); 166 swaps(&stuff->class, n); 167 swapl(&stuff->visual, n); 168 swapl(&stuff->mask, n); 169 SwapRestL(stuff); 170 return((* ProcVector[X_CreateWindow])(client)); 171} 172 173int 174SProcChangeWindowAttributes(ClientPtr client) 175{ 176 char n; 177 178 REQUEST(xChangeWindowAttributesReq); 179 swaps(&stuff->length, n); 180 REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); 181 swapl(&stuff->window, n); 182 swapl(&stuff->valueMask, n); 183 SwapRestL(stuff); 184 return((* ProcVector[X_ChangeWindowAttributes])(client)); 185} 186 187int 188SProcReparentWindow(ClientPtr client) 189{ 190 char n; 191 REQUEST(xReparentWindowReq); 192 swaps(&stuff->length, n); 193 REQUEST_SIZE_MATCH(xReparentWindowReq); 194 swapl(&stuff->window, n); 195 swapl(&stuff->parent, n); 196 swaps(&stuff->x, n); 197 swaps(&stuff->y, n); 198 return((* ProcVector[X_ReparentWindow])(client)); 199} 200 201int 202SProcConfigureWindow(ClientPtr client) 203{ 204 char n; 205 REQUEST(xConfigureWindowReq); 206 swaps(&stuff->length, n); 207 REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); 208 swapl(&stuff->window, n); 209 swaps(&stuff->mask, n); 210 SwapRestL(stuff); 211 return((* ProcVector[X_ConfigureWindow])(client)); 212 213} 214 215 216int 217SProcInternAtom(ClientPtr client) 218{ 219 char n; 220 REQUEST(xInternAtomReq); 221 swaps(&stuff->length, n); 222 REQUEST_AT_LEAST_SIZE(xInternAtomReq); 223 swaps(&stuff->nbytes, n); 224 return((* ProcVector[X_InternAtom])(client)); 225} 226 227int 228SProcChangeProperty(ClientPtr client) 229{ 230 char n; 231 REQUEST(xChangePropertyReq); 232 swaps(&stuff->length, n); 233 REQUEST_AT_LEAST_SIZE(xChangePropertyReq); 234 swapl(&stuff->window, n); 235 swapl(&stuff->property, n); 236 swapl(&stuff->type, n); 237 swapl(&stuff->nUnits, n); 238 switch ( stuff->format ) { 239 case 8 : 240 break; 241 case 16: 242 SwapRestS(stuff); 243 break; 244 case 32: 245 SwapRestL(stuff); 246 break; 247 } 248 return((* ProcVector[X_ChangeProperty])(client)); 249} 250 251int 252SProcDeleteProperty(ClientPtr client) 253{ 254 char n; 255 REQUEST(xDeletePropertyReq); 256 swaps(&stuff->length, n); 257 REQUEST_SIZE_MATCH(xDeletePropertyReq); 258 swapl(&stuff->window, n); 259 swapl(&stuff->property, n); 260 return((* ProcVector[X_DeleteProperty])(client)); 261 262} 263 264int 265SProcGetProperty(ClientPtr client) 266{ 267 char n; 268 REQUEST(xGetPropertyReq); 269 swaps(&stuff->length, n); 270 REQUEST_SIZE_MATCH(xGetPropertyReq); 271 swapl(&stuff->window, n); 272 swapl(&stuff->property, n); 273 swapl(&stuff->type, n); 274 swapl(&stuff->longOffset, n); 275 swapl(&stuff->longLength, n); 276 return((* ProcVector[X_GetProperty])(client)); 277} 278 279int 280SProcSetSelectionOwner(ClientPtr client) 281{ 282 char n; 283 REQUEST(xSetSelectionOwnerReq); 284 swaps(&stuff->length, n); 285 REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); 286 swapl(&stuff->window, n); 287 swapl(&stuff->selection, n); 288 swapl(&stuff->time, n); 289 return((* ProcVector[X_SetSelectionOwner])(client)); 290} 291 292int 293SProcConvertSelection(ClientPtr client) 294{ 295 char n; 296 REQUEST(xConvertSelectionReq); 297 swaps(&stuff->length, n); 298 REQUEST_SIZE_MATCH(xConvertSelectionReq); 299 swapl(&stuff->requestor, n); 300 swapl(&stuff->selection, n); 301 swapl(&stuff->target, n); 302 swapl(&stuff->property, n); 303 swapl(&stuff->time, n); 304 return((* ProcVector[X_ConvertSelection])(client)); 305} 306 307int 308SProcSendEvent(ClientPtr client) 309{ 310 char n; 311 xEvent eventT; 312 EventSwapPtr proc; 313 REQUEST(xSendEventReq); 314 swaps(&stuff->length, n); 315 REQUEST_SIZE_MATCH(xSendEventReq); 316 swapl(&stuff->destination, n); 317 swapl(&stuff->eventMask, n); 318 319 /* Swap event */ 320 proc = EventSwapVector[stuff->event.u.u.type & 0177]; 321 if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */ 322 return (BadValue); 323 (*proc)(&stuff->event, &eventT); 324 stuff->event = eventT; 325 326 return((* ProcVector[X_SendEvent])(client)); 327} 328 329int 330SProcGrabPointer(ClientPtr client) 331{ 332 char n; 333 REQUEST(xGrabPointerReq); 334 swaps(&stuff->length, n); 335 REQUEST_SIZE_MATCH(xGrabPointerReq); 336 swapl(&stuff->grabWindow, n); 337 swaps(&stuff->eventMask, n); 338 swapl(&stuff->confineTo, n); 339 swapl(&stuff->cursor, n); 340 swapl(&stuff->time, n); 341 return((* ProcVector[X_GrabPointer])(client)); 342} 343 344int 345SProcGrabButton(ClientPtr client) 346{ 347 char n; 348 REQUEST(xGrabButtonReq); 349 swaps(&stuff->length, n); 350 REQUEST_SIZE_MATCH(xGrabButtonReq); 351 swapl(&stuff->grabWindow, n); 352 swaps(&stuff->eventMask, n); 353 swapl(&stuff->confineTo, n); 354 swapl(&stuff->cursor, n); 355 swaps(&stuff->modifiers, n); 356 return((* ProcVector[X_GrabButton])(client)); 357} 358 359int 360SProcUngrabButton(ClientPtr client) 361{ 362 char n; 363 REQUEST(xUngrabButtonReq); 364 swaps(&stuff->length, n); 365 REQUEST_SIZE_MATCH(xUngrabButtonReq); 366 swapl(&stuff->grabWindow, n); 367 swaps(&stuff->modifiers, n); 368 return((* ProcVector[X_UngrabButton])(client)); 369} 370 371int 372SProcChangeActivePointerGrab(ClientPtr client) 373{ 374 char n; 375 REQUEST(xChangeActivePointerGrabReq); 376 swaps(&stuff->length, n); 377 REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq); 378 swapl(&stuff->cursor, n); 379 swapl(&stuff->time, n); 380 swaps(&stuff->eventMask, n); 381 return((* ProcVector[X_ChangeActivePointerGrab])(client)); 382} 383 384int 385SProcGrabKeyboard(ClientPtr client) 386{ 387 char n; 388 REQUEST(xGrabKeyboardReq); 389 swaps(&stuff->length, n); 390 REQUEST_SIZE_MATCH(xGrabKeyboardReq); 391 swapl(&stuff->grabWindow, n); 392 swapl(&stuff->time, n); 393 return((* ProcVector[X_GrabKeyboard])(client)); 394} 395 396int 397SProcGrabKey(ClientPtr client) 398{ 399 char n; 400 REQUEST(xGrabKeyReq); 401 swaps(&stuff->length, n); 402 REQUEST_SIZE_MATCH(xGrabKeyReq); 403 swapl(&stuff->grabWindow, n); 404 swaps(&stuff->modifiers, n); 405 return((* ProcVector[X_GrabKey])(client)); 406} 407 408int 409SProcUngrabKey(ClientPtr client) 410{ 411 char n; 412 REQUEST(xUngrabKeyReq); 413 swaps(&stuff->length, n); 414 REQUEST_SIZE_MATCH(xUngrabKeyReq); 415 swapl(&stuff->grabWindow, n); 416 swaps(&stuff->modifiers, n); 417 return((* ProcVector[X_UngrabKey])(client)); 418} 419 420int 421SProcGetMotionEvents(ClientPtr client) 422{ 423 char n; 424 REQUEST(xGetMotionEventsReq); 425 swaps(&stuff->length, n); 426 REQUEST_SIZE_MATCH(xGetMotionEventsReq); 427 swapl(&stuff->window, n); 428 swapl(&stuff->start, n); 429 swapl(&stuff->stop, n); 430 return((* ProcVector[X_GetMotionEvents])(client)); 431} 432 433int 434SProcTranslateCoords(ClientPtr client) 435{ 436 char n; 437 REQUEST(xTranslateCoordsReq); 438 swaps(&stuff->length, n); 439 REQUEST_SIZE_MATCH(xTranslateCoordsReq); 440 swapl(&stuff->srcWid, n); 441 swapl(&stuff->dstWid, n); 442 swaps(&stuff->srcX, n); 443 swaps(&stuff->srcY, n); 444 return((* ProcVector[X_TranslateCoords])(client)); 445} 446 447int 448SProcWarpPointer(ClientPtr client) 449{ 450 char n; 451 REQUEST(xWarpPointerReq); 452 swaps(&stuff->length, n); 453 REQUEST_SIZE_MATCH(xWarpPointerReq); 454 swapl(&stuff->srcWid, n); 455 swapl(&stuff->dstWid, n); 456 swaps(&stuff->srcX, n); 457 swaps(&stuff->srcY, n); 458 swaps(&stuff->srcWidth, n); 459 swaps(&stuff->srcHeight, n); 460 swaps(&stuff->dstX, n); 461 swaps(&stuff->dstY, n); 462 return((* ProcVector[X_WarpPointer])(client)); 463} 464 465int 466SProcSetInputFocus(ClientPtr client) 467{ 468 char n; 469 REQUEST(xSetInputFocusReq); 470 swaps(&stuff->length, n); 471 REQUEST_SIZE_MATCH(xSetInputFocusReq); 472 swapl(&stuff->focus, n); 473 swapl(&stuff->time, n); 474 return((* ProcVector[X_SetInputFocus])(client)); 475} 476 477int 478SProcOpenFont(ClientPtr client) 479{ 480 char n; 481 REQUEST(xOpenFontReq); 482 swaps(&stuff->length, n); 483 REQUEST_AT_LEAST_SIZE(xOpenFontReq); 484 swapl(&stuff->fid, n); 485 swaps(&stuff->nbytes, n); 486 return((* ProcVector[X_OpenFont])(client)); 487} 488 489int 490SProcListFonts(ClientPtr client) 491{ 492 char n; 493 REQUEST(xListFontsReq); 494 swaps(&stuff->length, n); 495 REQUEST_AT_LEAST_SIZE(xListFontsReq); 496 swaps(&stuff->maxNames, n); 497 swaps(&stuff->nbytes, n); 498 return((* ProcVector[X_ListFonts])(client)); 499} 500 501int 502SProcListFontsWithInfo(ClientPtr client) 503{ 504 char n; 505 REQUEST(xListFontsWithInfoReq); 506 swaps(&stuff->length, n); 507 REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq); 508 swaps(&stuff->maxNames, n); 509 swaps(&stuff->nbytes, n); 510 return((* ProcVector[X_ListFontsWithInfo])(client)); 511} 512 513int 514SProcSetFontPath(ClientPtr client) 515{ 516 char n; 517 REQUEST(xSetFontPathReq); 518 swaps(&stuff->length, n); 519 REQUEST_AT_LEAST_SIZE(xSetFontPathReq); 520 swaps(&stuff->nFonts, n); 521 return((* ProcVector[X_SetFontPath])(client)); 522} 523 524int 525SProcCreatePixmap(ClientPtr client) 526{ 527 char n; 528 REQUEST(xCreatePixmapReq); 529 530 swaps(&stuff->length, n); 531 REQUEST_SIZE_MATCH(xCreatePixmapReq); 532 swapl(&stuff->pid, n); 533 swapl(&stuff->drawable, n); 534 swaps(&stuff->width, n); 535 swaps(&stuff->height, n); 536 return((* ProcVector[X_CreatePixmap])(client)); 537} 538 539int 540SProcCreateGC(ClientPtr client) 541{ 542 char n; 543 REQUEST(xCreateGCReq); 544 swaps(&stuff->length, n); 545 REQUEST_AT_LEAST_SIZE(xCreateGCReq); 546 swapl(&stuff->gc, n); 547 swapl(&stuff->drawable, n); 548 swapl(&stuff->mask, n); 549 SwapRestL(stuff); 550 return((* ProcVector[X_CreateGC])(client)); 551} 552 553int 554SProcChangeGC(ClientPtr client) 555{ 556 char n; 557 REQUEST(xChangeGCReq); 558 swaps(&stuff->length, n); 559 REQUEST_AT_LEAST_SIZE(xChangeGCReq); 560 swapl(&stuff->gc, n); 561 swapl(&stuff->mask, n); 562 SwapRestL(stuff); 563 return((* ProcVector[X_ChangeGC])(client)); 564} 565 566int 567SProcCopyGC(ClientPtr client) 568{ 569 char n; 570 REQUEST(xCopyGCReq); 571 swaps(&stuff->length, n); 572 REQUEST_SIZE_MATCH(xCopyGCReq); 573 swapl(&stuff->srcGC, n); 574 swapl(&stuff->dstGC, n); 575 swapl(&stuff->mask, n); 576 return((* ProcVector[X_CopyGC])(client)); 577} 578 579int 580SProcSetDashes(ClientPtr client) 581{ 582 char n; 583 REQUEST(xSetDashesReq); 584 swaps(&stuff->length, n); 585 REQUEST_AT_LEAST_SIZE(xSetDashesReq); 586 swapl(&stuff->gc, n); 587 swaps(&stuff->dashOffset, n); 588 swaps(&stuff->nDashes, n); 589 return((* ProcVector[X_SetDashes])(client)); 590 591} 592 593int 594SProcSetClipRectangles(ClientPtr client) 595{ 596 char n; 597 REQUEST(xSetClipRectanglesReq); 598 swaps(&stuff->length, n); 599 REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); 600 swapl(&stuff->gc, n); 601 swaps(&stuff->xOrigin, n); 602 swaps(&stuff->yOrigin, n); 603 SwapRestS(stuff); 604 return((* ProcVector[X_SetClipRectangles])(client)); 605} 606 607int 608SProcClearToBackground(ClientPtr client) 609{ 610 char n; 611 REQUEST(xClearAreaReq); 612 swaps(&stuff->length, n); 613 REQUEST_SIZE_MATCH(xClearAreaReq); 614 swapl(&stuff->window, n); 615 swaps(&stuff->x, n); 616 swaps(&stuff->y, n); 617 swaps(&stuff->width, n); 618 swaps(&stuff->height, n); 619 return((* ProcVector[X_ClearArea])(client)); 620} 621 622int 623SProcCopyArea(ClientPtr client) 624{ 625 char n; 626 REQUEST(xCopyAreaReq); 627 swaps(&stuff->length, n); 628 REQUEST_SIZE_MATCH(xCopyAreaReq); 629 swapl(&stuff->srcDrawable, n); 630 swapl(&stuff->dstDrawable, n); 631 swapl(&stuff->gc, n); 632 swaps(&stuff->srcX, n); 633 swaps(&stuff->srcY, n); 634 swaps(&stuff->dstX, n); 635 swaps(&stuff->dstY, n); 636 swaps(&stuff->width, n); 637 swaps(&stuff->height, n); 638 return((* ProcVector[X_CopyArea])(client)); 639} 640 641int 642SProcCopyPlane(ClientPtr client) 643{ 644 char n; 645 REQUEST(xCopyPlaneReq); 646 swaps(&stuff->length, n); 647 REQUEST_SIZE_MATCH(xCopyPlaneReq); 648 swapl(&stuff->srcDrawable, n); 649 swapl(&stuff->dstDrawable, n); 650 swapl(&stuff->gc, n); 651 swaps(&stuff->srcX, n); 652 swaps(&stuff->srcY, n); 653 swaps(&stuff->dstX, n); 654 swaps(&stuff->dstY, n); 655 swaps(&stuff->width, n); 656 swaps(&stuff->height, n); 657 swapl(&stuff->bitPlane, n); 658 return((* ProcVector[X_CopyPlane])(client)); 659} 660 661/* The following routine is used for all Poly drawing requests 662 (except FillPoly, which uses a different request format) */ 663int 664SProcPoly(ClientPtr client) 665{ 666 char n; 667 668 REQUEST(xPolyPointReq); 669 swaps(&stuff->length, n); 670 REQUEST_AT_LEAST_SIZE(xPolyPointReq); 671 swapl(&stuff->drawable, n); 672 swapl(&stuff->gc, n); 673 SwapRestS(stuff); 674 return((* ProcVector[stuff->reqType])(client)); 675} 676 677/* cannot use SProcPoly for this one, because xFillPolyReq 678 is longer than xPolyPointReq, and we don't want to swap 679 the difference as shorts! */ 680int 681SProcFillPoly(ClientPtr client) 682{ 683 char n; 684 685 REQUEST(xFillPolyReq); 686 swaps(&stuff->length, n); 687 REQUEST_AT_LEAST_SIZE(xFillPolyReq); 688 swapl(&stuff->drawable, n); 689 swapl(&stuff->gc, n); 690 SwapRestS(stuff); 691 return((* ProcVector[X_FillPoly])(client)); 692} 693 694int 695SProcPutImage(ClientPtr client) 696{ 697 char n; 698 REQUEST(xPutImageReq); 699 swaps(&stuff->length, n); 700 REQUEST_AT_LEAST_SIZE(xPutImageReq); 701 swapl(&stuff->drawable, n); 702 swapl(&stuff->gc, n); 703 swaps(&stuff->width, n); 704 swaps(&stuff->height, n); 705 swaps(&stuff->dstX, n); 706 swaps(&stuff->dstY, n); 707 /* Image should already be swapped */ 708 return((* ProcVector[X_PutImage])(client)); 709 710} 711 712int 713SProcGetImage(ClientPtr client) 714{ 715 char n; 716 REQUEST(xGetImageReq); 717 swaps(&stuff->length, n); 718 REQUEST_SIZE_MATCH(xGetImageReq); 719 swapl(&stuff->drawable, n); 720 swaps(&stuff->x, n); 721 swaps(&stuff->y, n); 722 swaps(&stuff->width, n); 723 swaps(&stuff->height, n); 724 swapl(&stuff->planeMask, n); 725 return((* ProcVector[X_GetImage])(client)); 726} 727 728/* ProcPolyText used for both PolyText8 and PolyText16 */ 729 730int 731SProcPolyText(ClientPtr client) 732{ 733 char n; 734 REQUEST(xPolyTextReq); 735 swaps(&stuff->length, n); 736 REQUEST_AT_LEAST_SIZE(xPolyTextReq); 737 swapl(&stuff->drawable, n); 738 swapl(&stuff->gc, n); 739 swaps(&stuff->x, n); 740 swaps(&stuff->y, n); 741 return((* ProcVector[stuff->reqType])(client)); 742} 743 744/* ProcImageText used for both ImageText8 and ImageText16 */ 745 746int 747SProcImageText(ClientPtr client) 748{ 749 char n; 750 REQUEST(xImageTextReq); 751 swaps(&stuff->length, n); 752 REQUEST_AT_LEAST_SIZE(xImageTextReq); 753 swapl(&stuff->drawable, n); 754 swapl(&stuff->gc, n); 755 swaps(&stuff->x, n); 756 swaps(&stuff->y, n); 757 return((* ProcVector[stuff->reqType])(client)); 758} 759 760int 761SProcCreateColormap(ClientPtr client) 762{ 763 char n; 764 REQUEST(xCreateColormapReq); 765 swaps(&stuff->length, n); 766 REQUEST_SIZE_MATCH(xCreateColormapReq); 767 swapl(&stuff->mid, n); 768 swapl(&stuff->window, n); 769 swapl(&stuff->visual, n); 770 return((* ProcVector[X_CreateColormap])(client)); 771} 772 773 774int 775SProcCopyColormapAndFree(ClientPtr client) 776{ 777 char n; 778 REQUEST(xCopyColormapAndFreeReq); 779 swaps(&stuff->length, n); 780 REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); 781 swapl(&stuff->mid, n); 782 swapl(&stuff->srcCmap, n); 783 return((* ProcVector[X_CopyColormapAndFree])(client)); 784 785} 786 787int 788SProcAllocColor(ClientPtr client) 789{ 790 char n; 791 REQUEST(xAllocColorReq); 792 swaps(&stuff->length, n); 793 REQUEST_SIZE_MATCH(xAllocColorReq); 794 swapl(&stuff->cmap, n); 795 swaps(&stuff->red, n); 796 swaps(&stuff->green, n); 797 swaps(&stuff->blue, n); 798 return((* ProcVector[X_AllocColor])(client)); 799} 800 801int 802SProcAllocNamedColor(ClientPtr client) 803{ 804 char n; 805 806 REQUEST(xAllocNamedColorReq); 807 swaps(&stuff->length, n); 808 REQUEST_AT_LEAST_SIZE(xAllocNamedColorReq); 809 swapl(&stuff->cmap, n); 810 swaps(&stuff->nbytes, n); 811 return((* ProcVector[X_AllocNamedColor])(client)); 812} 813 814int 815SProcAllocColorCells(ClientPtr client) 816{ 817 char n; 818 REQUEST(xAllocColorCellsReq); 819 swaps(&stuff->length, n); 820 REQUEST_SIZE_MATCH(xAllocColorCellsReq); 821 swapl(&stuff->cmap, n); 822 swaps(&stuff->colors, n); 823 swaps(&stuff->planes, n); 824 return((* ProcVector[X_AllocColorCells])(client)); 825} 826 827int 828SProcAllocColorPlanes(ClientPtr client) 829{ 830 char n; 831 REQUEST(xAllocColorPlanesReq); 832 swaps(&stuff->length, n); 833 REQUEST_SIZE_MATCH(xAllocColorPlanesReq); 834 swapl(&stuff->cmap, n); 835 swaps(&stuff->colors, n); 836 swaps(&stuff->red, n); 837 swaps(&stuff->green, n); 838 swaps(&stuff->blue, n); 839 return((* ProcVector[X_AllocColorPlanes])(client)); 840} 841 842int 843SProcFreeColors(ClientPtr client) 844{ 845 char n; 846 REQUEST(xFreeColorsReq); 847 swaps(&stuff->length, n); 848 REQUEST_AT_LEAST_SIZE(xFreeColorsReq); 849 swapl(&stuff->cmap, n); 850 swapl(&stuff->planeMask, n); 851 SwapRestL(stuff); 852 return((* ProcVector[X_FreeColors])(client)); 853 854} 855 856_X_EXPORT void 857SwapColorItem(xColorItem *pItem) 858{ 859 char n; 860 861 swapl(&pItem->pixel, n); 862 swaps(&pItem->red, n); 863 swaps(&pItem->green, n); 864 swaps(&pItem->blue, n); 865} 866 867int 868SProcStoreColors(ClientPtr client) 869{ 870 char n; 871 long count; 872 xColorItem *pItem; 873 874 REQUEST(xStoreColorsReq); 875 swaps(&stuff->length, n); 876 REQUEST_AT_LEAST_SIZE(xStoreColorsReq); 877 swapl(&stuff->cmap, n); 878 pItem = (xColorItem *) &stuff[1]; 879 for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; ) 880 SwapColorItem(pItem++); 881 return((* ProcVector[X_StoreColors])(client)); 882} 883 884int 885SProcStoreNamedColor (ClientPtr client) 886{ 887 char n; 888 REQUEST(xStoreNamedColorReq); 889 swaps(&stuff->length, n); 890 REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq); 891 swapl(&stuff->cmap, n); 892 swapl(&stuff->pixel, n); 893 swaps(&stuff->nbytes, n); 894 return((* ProcVector[X_StoreNamedColor])(client)); 895} 896 897int 898SProcQueryColors (ClientPtr client) 899{ 900 char n; 901 REQUEST(xQueryColorsReq); 902 swaps(&stuff->length, n); 903 REQUEST_AT_LEAST_SIZE(xQueryColorsReq); 904 swapl(&stuff->cmap, n); 905 SwapRestL(stuff); 906 return((* ProcVector[X_QueryColors])(client)); 907} 908 909int 910SProcLookupColor (ClientPtr client) 911{ 912 char n; 913 REQUEST(xLookupColorReq); 914 swaps(&stuff->length, n); 915 REQUEST_AT_LEAST_SIZE(xLookupColorReq); 916 swapl(&stuff->cmap, n); 917 swaps(&stuff->nbytes, n); 918 return((* ProcVector[X_LookupColor])(client)); 919} 920 921int 922SProcCreateCursor (ClientPtr client) 923{ 924 char n; 925 REQUEST(xCreateCursorReq); 926 swaps(&stuff->length, n); 927 REQUEST_SIZE_MATCH(xCreateCursorReq); 928 swapl(&stuff->cid, n); 929 swapl(&stuff->source, n); 930 swapl(&stuff->mask, n); 931 swaps(&stuff->foreRed, n); 932 swaps(&stuff->foreGreen, n); 933 swaps(&stuff->foreBlue, n); 934 swaps(&stuff->backRed, n); 935 swaps(&stuff->backGreen, n); 936 swaps(&stuff->backBlue, n); 937 swaps(&stuff->x, n); 938 swaps(&stuff->y, n); 939 return((* ProcVector[X_CreateCursor])(client)); 940} 941 942int 943SProcCreateGlyphCursor (ClientPtr client) 944{ 945 char n; 946 REQUEST(xCreateGlyphCursorReq); 947 swaps(&stuff->length, n); 948 REQUEST_SIZE_MATCH(xCreateGlyphCursorReq); 949 swapl(&stuff->cid, n); 950 swapl(&stuff->source, n); 951 swapl(&stuff->mask, n); 952 swaps(&stuff->sourceChar, n); 953 swaps(&stuff->maskChar, n); 954 swaps(&stuff->foreRed, n); 955 swaps(&stuff->foreGreen, n); 956 swaps(&stuff->foreBlue, n); 957 swaps(&stuff->backRed, n); 958 swaps(&stuff->backGreen, n); 959 swaps(&stuff->backBlue, n); 960 return((* ProcVector[X_CreateGlyphCursor])(client)); 961} 962 963 964int 965SProcRecolorCursor (ClientPtr client) 966{ 967 char n; 968 REQUEST(xRecolorCursorReq); 969 swaps(&stuff->length, n); 970 REQUEST_SIZE_MATCH(xRecolorCursorReq); 971 swapl(&stuff->cursor, n); 972 swaps(&stuff->foreRed, n); 973 swaps(&stuff->foreGreen, n); 974 swaps(&stuff->foreBlue, n); 975 swaps(&stuff->backRed, n); 976 swaps(&stuff->backGreen, n); 977 swaps(&stuff->backBlue, n); 978 return((* ProcVector[X_RecolorCursor])(client)); 979} 980 981int 982SProcQueryBestSize (ClientPtr client) 983{ 984 char n; 985 REQUEST(xQueryBestSizeReq); 986 swaps(&stuff->length, n); 987 REQUEST_SIZE_MATCH(xQueryBestSizeReq); 988 swapl(&stuff->drawable, n); 989 swaps(&stuff->width, n); 990 swaps(&stuff->height, n); 991 return((* ProcVector[X_QueryBestSize])(client)); 992 993} 994 995int 996SProcQueryExtension (ClientPtr client) 997{ 998 char n; 999 REQUEST(xQueryExtensionReq); 1000 swaps(&stuff->length, n); 1001 REQUEST_AT_LEAST_SIZE(xQueryExtensionReq); 1002 swaps(&stuff->nbytes, n); 1003 return((* ProcVector[X_QueryExtension])(client)); 1004} 1005 1006int 1007SProcChangeKeyboardMapping (ClientPtr client) 1008{ 1009 char n; 1010 REQUEST(xChangeKeyboardMappingReq); 1011 swaps(&stuff->length, n); 1012 REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq); 1013 SwapRestL(stuff); 1014 return((* ProcVector[X_ChangeKeyboardMapping])(client)); 1015} 1016 1017 1018int 1019SProcChangeKeyboardControl (ClientPtr client) 1020{ 1021 char n; 1022 REQUEST(xChangeKeyboardControlReq); 1023 swaps(&stuff->length, n); 1024 REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq); 1025 swapl(&stuff->mask, n); 1026 SwapRestL(stuff); 1027 return((* ProcVector[X_ChangeKeyboardControl])(client)); 1028} 1029 1030int 1031SProcChangePointerControl (ClientPtr client) 1032{ 1033 char n; 1034 REQUEST(xChangePointerControlReq); 1035 swaps(&stuff->length, n); 1036 REQUEST_SIZE_MATCH(xChangePointerControlReq); 1037 swaps(&stuff->accelNum, n); 1038 swaps(&stuff->accelDenum, n); 1039 swaps(&stuff->threshold, n); 1040 return((* ProcVector[X_ChangePointerControl])(client)); 1041} 1042 1043 1044int 1045SProcSetScreenSaver (ClientPtr client) 1046{ 1047 char n; 1048 REQUEST(xSetScreenSaverReq); 1049 swaps(&stuff->length, n); 1050 REQUEST_SIZE_MATCH(xSetScreenSaverReq); 1051 swaps(&stuff->timeout, n); 1052 swaps(&stuff->interval, n); 1053 return((* ProcVector[X_SetScreenSaver])(client)); 1054} 1055 1056int 1057SProcChangeHosts (ClientPtr client) 1058{ 1059 char n; 1060 1061 REQUEST(xChangeHostsReq); 1062 swaps(&stuff->length, n); 1063 REQUEST_AT_LEAST_SIZE(xChangeHostsReq); 1064 swaps(&stuff->hostLength, n); 1065 return((* ProcVector[X_ChangeHosts])(client)); 1066 1067} 1068 1069int SProcRotateProperties (ClientPtr client) 1070{ 1071 char n; 1072 REQUEST(xRotatePropertiesReq); 1073 swaps(&stuff->length, n); 1074 REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq); 1075 swapl(&stuff->window, n); 1076 swaps(&stuff->nAtoms, n); 1077 swaps(&stuff->nPositions, n); 1078 SwapRestL(stuff); 1079 return ((* ProcVector[X_RotateProperties])(client)); 1080} 1081 1082int 1083SProcNoOperation(ClientPtr client) 1084{ 1085 char n; 1086 REQUEST(xReq); 1087 swaps(&stuff->length, n); 1088 return ((* ProcVector[X_NoOperation])(client)); 1089} 1090 1091void 1092SwapConnClientPrefix(xConnClientPrefix *pCCP) 1093{ 1094 char n; 1095 1096 swaps(&pCCP->majorVersion, n); 1097 swaps(&pCCP->minorVersion, n); 1098 swaps(&pCCP->nbytesAuthProto, n); 1099 swaps(&pCCP->nbytesAuthString, n); 1100} 1101