swapreq.c 25 KB

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