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