home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / fj / sources / 834 < prev    next >
Encoding:
Text File  |  1992-11-17  |  37.8 KB  |  1,355 lines

  1. Newsgroups: fj.sources
  2. Path: sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-kyo!omrongw!yoki
  3. From: yoki@ari.ncl.omron.co.jp (OKI Yukihiro)
  4. Subject: X11 Release 5 Public Patch #18
  5. Message-ID: <YOKI.92Nov17185255@ultraman.ari.ncl.omron.co.jp>
  6. Sender: news@omrongw.wg.omron.co.jp (News Manager)
  7. Nntp-Posting-Host: ultraman.ari.ncl.omron.co.jp
  8. Organization: Advanced Systems Research Center, OMRON Corporation, Kyoto, Japan
  9. Distribution: fj
  10. Date: Tue, 17 Nov 1992 09:52:55 GMT
  11. Lines: 1342
  12.  
  13.  
  14. *****************************************************************************
  15.  
  16.               Release 5 Public Patch #18
  17.                MIT X Consortium
  18.  
  19. WARNING:
  20. This patch was previously released as an optional patch, in support of the
  21. X Test Suite, and was labeled "Release 5 XTEST Public Patch" (the file on
  22. expo was "/pub/XTEST/R5fix-xtest-1").  If you have already applied that patch,
  23. do not try to apply this one!  Proceed instead to apply public patch #19.
  24.  
  25. To apply this patch:
  26.  
  27. cd to the top of the source tree (to the directory containing the "mit"
  28. and "contrib" subdirectories) and do:
  29.     patch -p -s < ThisFile
  30. Patch will work silently unless an error occurs.  You will likely get
  31. the following warning messages, which can be ignored:
  32.     mkdir: mit: File exists
  33.     mkdir: mit/extensions: File exists
  34.     mkdir: mit/extensions/include: File exists
  35.     mkdir: mit: File exists
  36.     mkdir: mit/extensions: File exists
  37.     mkdir: mit/extensions/include: File exists
  38.     mkdir: mit: File exists
  39.     mkdir: mit/extensions: File exists
  40.     mkdir: mit/extensions/lib: File exists
  41.     mkdir: mit: File exists
  42.     mkdir: mit/extensions: File exists
  43.     mkdir: mit/extensions/lib: File exists
  44.     mkdir: mit/extensions/lib/xtest: File exists
  45.     mkdir: mit: File exists
  46.     mkdir: mit/extensions: File exists
  47.     mkdir: mit/extensions/server: File exists
  48.     mkdir: mit: File exists
  49.     mkdir: mit/extensions: File exists
  50.     mkdir: mit/extensions/server: File exists
  51. If you want to watch patch do its thing, leave out the "-s" argument to patch.
  52.  
  53. This patch creates the following new files:
  54.     mit/extensions/include/XTest.h
  55.     mit/extensions/include/xteststr.h
  56.     mit/extensions/lib/xtest/Imakefile
  57.     mit/extensions/lib/xtest/XTest.c
  58.     mit/extensions/server/sleepuntil.c
  59.     mit/extensions/server/xtest.c
  60. If you are using a symbolic link tree, you will need to create new links.
  61.  
  62. To build a server with the XTEST extension enabled, you will need to edit
  63. your vendor.cf or site.def file in mit/config/.  For most servers, you can
  64. insert the following line into the "AfterVendorCF" part of your site.def:
  65.  
  66. #define ExtensionOSDefines -DXTEST
  67.  
  68. If your vendor.cf already contains a #define for ExtensionOSDefines (e.g.,
  69. x386.cf does), then you can edit the .cf file and add -DXTEST to
  70. ExtensionOSDefines there.
  71.  
  72. Finally, to rebuild after applying this patch, cd to the "mit" subdirectory
  73. and do:
  74.     make Everything >& every.log
  75. Note: this will *not* "clean" your tree.
  76.  
  77. Brief notes on what this patch provides:
  78.  
  79. xtest: add implementation of XTEST extension
  80.  
  81. Prereq: 91/07/16
  82.  
  83. *** /tmp/,RCSt1016565    Wed Sep  9 15:41:50 1992
  84. --- mit/extensions/include/Imakefile    Wed Sep  9 15:41:51 1992
  85. ***************
  86. *** 1,4 ****
  87. ! XCOMM $XConsortium: Imakefile,v 1.24 91/07/16 23:08:47 gildea Exp $
  88.   #if BuildPexClients || BuildPexExt
  89.   #define IHaveSubdirs
  90.   #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  91. --- 1,4 ----
  92. ! XCOMM $XConsortium: Imakefile,v 1.24.1.1 92/09/09 15:25:53 rws Exp $
  93.   #if BuildPexClients || BuildPexExt
  94.   #define IHaveSubdirs
  95.   #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  96. ***************
  97. *** 6,12 ****
  98.   #endif
  99.   
  100.   HEADERS = Xext.h multibuf.h shape.h XShm.h MITMisc.h XI.h XInput.h XIproto.h \
  101. !     xtestext1.h
  102.   INSTALLFLAGS = $(INSTINCFLAGS)
  103.   
  104.   all::
  105. --- 6,12 ----
  106.   #endif
  107.   
  108.   HEADERS = Xext.h multibuf.h shape.h XShm.h MITMisc.h XI.h XInput.h XIproto.h \
  109. !     XTest.h xtestext1.h
  110.   INSTALLFLAGS = $(INSTINCFLAGS)
  111.   
  112.   all::
  113. *** /dev/null    Wed Sep  9 15:40:33 1992
  114. --- mit/extensions/include/XTest.h    Mon Apr 20 13:15:18 1992
  115. ***************
  116. *** 0 ****
  117. --- 1,126 ----
  118. + /* $XConsortium: XTest.h,v 1.4 92/04/20 13:13:54 rws Exp $ */
  119. + /*
  120. + Copyright 1992 by the Massachusetts Institute of Technology
  121. + Permission to use, copy, modify, distribute, and sell this software and its
  122. + documentation for any purpose is hereby granted without fee, provided that
  123. + the above copyright notice appear in all copies and that both that
  124. + copyright notice and this permission notice appear in supporting
  125. + documentation, and that the name of M.I.T. not be used in advertising or
  126. + publicity pertaining to distribution of the software without specific,
  127. + written prior permission.  M.I.T. makes no representations about the
  128. + suitability of this software for any purpose.  It is provided "as is"
  129. + without express or implied warranty.
  130. + */
  131. + #ifndef _XTEST_H_
  132. + #define _XTEST_H_
  133. + #include <X11/Xfuncproto.h>
  134. + #define X_XTestGetVersion    0
  135. + #define X_XTestCompareCursor    1
  136. + #define X_XTestFakeInput    2
  137. + #define XTestNumberEvents    0
  138. + #define XTestNumberErrors    0
  139. + #define XTestMajorVersion    2
  140. + #define XTestMinorVersion    1
  141. + #define XTestExtensionName    "XTEST"
  142. + #ifndef _XTEST_SERVER_
  143. + _XFUNCPROTOBEGIN
  144. + Bool XTestQueryExtension(
  145. + #if NeedFunctionPrototypes
  146. +     Display*        /* dpy */,
  147. +     int*        /* event_basep */,
  148. +     int*        /* error_basep */,
  149. +     int*        /* majorp */,
  150. +     int*        /* minorp */
  151. + #endif
  152. + );
  153. + Bool XTestCompareCursorWithWindow(
  154. + #if NeedFunctionPrototypes
  155. +     Display*        /* dpy */,
  156. +     Window        /* window */,
  157. +     Cursor        /* cursor */
  158. + #endif
  159. + );
  160. + Bool XTestCompareCurrentCursorWithWindow(
  161. + #if NeedFunctionPrototypes
  162. +     Display*        /* dpy */,
  163. +     Window        /* window */
  164. + #endif
  165. + );
  166. + extern XTestFakeKeyEvent(
  167. + #if NeedFunctionPrototypes
  168. +     Display*        /* dpy */,
  169. +     unsigned int    /* keycode */,
  170. +     Bool        /* is_press */,
  171. +     unsigned long    /* delay */
  172. + #endif
  173. + );
  174. + extern XTestFakeButtonEvent(
  175. + #if NeedFunctionPrototypes
  176. +     Display*        /* dpy */,
  177. +     unsigned int    /* button */,
  178. +     Bool        /* is_press */,
  179. +     unsigned long    /* delay */
  180. + #endif
  181. + );
  182. + extern XTestFakeMotionEvent(
  183. + #if NeedFunctionPrototypes
  184. +     Display*        /* dpy */,
  185. +     int            /* screen */,
  186. +     int            /* x */,
  187. +     int            /* y */,
  188. +     unsigned long    /* delay */
  189. + #endif
  190. + );
  191. + extern XTestFakeRelativeMotionEvent(
  192. + #if NeedFunctionPrototypes
  193. +     Display*        /* dpy */,
  194. +     int            /* x */,
  195. +     int            /* y */,
  196. +     unsigned long    /* delay */
  197. + #endif
  198. + );
  199. + void XTestSetGContextOfGC(
  200. + #if NeedFunctionPrototypes
  201. +     GC            /* gc */,
  202. +     GContext        /* gid */
  203. + #endif
  204. + );
  205. + void XTestSetVisualIDOfVisual(
  206. + #if NeedFunctionPrototypes
  207. +     Visual*        /* visual */,
  208. +     VisualID        /* visualid */
  209. + #endif
  210. + );
  211. + Status XTestDiscard(
  212. + #if NeedFunctionPrototypes
  213. +     Display*        /* dpy */
  214. + #endif
  215. + );
  216. + _XFUNCPROTOEND
  217. + #endif /* _XTEST_SERVER_ */
  218. + #endif
  219. *** /dev/null    Wed Sep  9 15:40:33 1992
  220. --- mit/extensions/include/xteststr.h    Mon Apr 20 13:15:45 1992
  221. ***************
  222. *** 0 ****
  223. --- 1,84 ----
  224. + /* $XConsortium: xteststr.h,v 1.5 92/04/20 13:14:15 rws Exp $ */
  225. + /*
  226. + Copyright 1992 by the Massachusetts Institute of Technology
  227. + Permission to use, copy, modify, distribute, and sell this software and its
  228. + documentation for any purpose is hereby granted without fee, provided that
  229. + the above copyright notice appear in all copies and that both that
  230. + copyright notice and this permission notice appear in supporting
  231. + documentation, and that the name of M.I.T. not be used in advertising or
  232. + publicity pertaining to distribution of the software without specific,
  233. + written prior permission.  M.I.T. makes no representations about the
  234. + suitability of this software for any purpose.  It is provided "as is"
  235. + without express or implied warranty.
  236. + */
  237. + #define XTestCurrentCursor ((Cursor)1)
  238. + typedef struct {
  239. +     CARD8    reqType;    /* always XTestReqCode */
  240. +     CARD8    xtReqType;    /* always X_XTestGetVersion */
  241. +     CARD16    length B16;
  242. +     CARD8    majorVersion;
  243. +     CARD8    pad;
  244. +     CARD16    minorVersion B16;
  245. + } xXTestGetVersionReq;
  246. + #define sz_xXTestGetVersionReq 8
  247. + typedef struct {
  248. +     BYTE    type;            /* X_Reply */
  249. +     CARD8    majorVersion;
  250. +     CARD16    sequenceNumber B16;
  251. +     CARD32    length B32;
  252. +     CARD16    minorVersion B16;
  253. +     CARD16    pad0 B16;
  254. +     CARD32    pad1 B32;
  255. +     CARD32    pad2 B32;
  256. +     CARD32    pad3 B32;
  257. +     CARD32    pad4 B32;
  258. +     CARD32    pad5 B32;
  259. + } xXTestGetVersionReply;
  260. + #define sz_xXTestGetVersionReply 32
  261. + typedef struct {
  262. +     CARD8    reqType;    /* always XTestReqCode */
  263. +     CARD8    xtReqType;    /* always X_XTestCompareCursor */
  264. +     CARD16    length B16;
  265. +     Window    window B32;
  266. +     Cursor    cursor B32;
  267. + } xXTestCompareCursorReq;
  268. + #define sz_xXTestCompareCursorReq 12
  269. + typedef struct {
  270. +     BYTE    type;            /* X_Reply */
  271. +     BOOL    same;
  272. +     CARD16    sequenceNumber B16;
  273. +     CARD32    length B32;
  274. +     CARD32    pad0 B32;
  275. +     CARD32    pad1 B32;
  276. +     CARD32    pad2 B32;
  277. +     CARD32    pad3 B32;
  278. +     CARD32    pad4 B32;
  279. +     CARD32    pad5 B32;
  280. + } xXTestCompareCursorReply;
  281. + #define sz_xXTestCompareCursorReply 32
  282. + /* used only on the client side */
  283. + typedef struct {
  284. +     CARD8    reqType;    /* always XTestReqCode */
  285. +     CARD8    xtReqType;    /* always X_XTestFakeInput */
  286. +     CARD16    length B16;
  287. +     BYTE    type;
  288. +     BYTE    detail;
  289. +     CARD16    pad0 B16;
  290. +     Time    time B32;
  291. +     Window    root B32;
  292. +     CARD32    pad1 B32;
  293. +     CARD32    pad2 B32;
  294. +     INT16    rootX B16, rootY B16;
  295. +     CARD32    pad3 B32;
  296. +     CARD32    pad4 B32;
  297. + } xXTestFakeInputReq;
  298. + #define sz_xXTestFakeInputReq 36
  299. *** /tmp/,RCSt1016576    Wed Sep  9 15:43:55 1992
  300. --- mit/extensions/lib/Imakefile    Wed Sep  9 15:43:56 1992
  301. ***************
  302. *** 1,4 ****
  303. ! XCOMM $XConsortium: Imakefile,v 1.33 91/07/22 22:56:37 rws Exp $
  304.   #define DoNormalLib NormalLibXext
  305.   #define DoSharedLib SharedLibXext
  306.   #define DoDebugLib DebugLibXext
  307. --- 1,4 ----
  308. ! XCOMM $XConsortium: Imakefile,v 1.33.1.1 92/09/09 15:29:32 rws Exp $
  309.   #define DoNormalLib NormalLibXext
  310.   #define DoSharedLib SharedLibXext
  311.   #define DoDebugLib DebugLibXext
  312. ***************
  313. *** 9,15 ****
  314.   REQUIREDLIBS = $(XLIBSRC)/libX11.a
  315.   #endif
  316.   
  317. - #if BuildXInputLib || BuildPexClients
  318.   #define IHaveSubdirs
  319.   #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  320.   #if BuildXInputLib
  321. --- 9,14 ----
  322. ***************
  323. *** 18,25 ****
  324.   #if BuildPexClients
  325.         PEXDIRS = PEX
  326.   #endif
  327. !       SUBDIRS = $(XINPUTDIRS) $(PEXDIRS)
  328. ! #endif
  329.   
  330.   #if HasShm
  331.         SHMSRCS = XShm.c
  332. --- 17,23 ----
  333.   #if BuildPexClients
  334.         PEXDIRS = PEX
  335.   #endif
  336. !       SUBDIRS = $(XINPUTDIRS) $(PEXDIRS) xtest
  337.   
  338.   #if HasShm
  339.         SHMSRCS = XShm.c
  340. *** /dev/null    Wed Sep  9 15:40:33 1992
  341. --- mit/extensions/lib/xtest/Imakefile    Wed Sep  9 15:44:55 1992
  342. ***************
  343. *** 0 ****
  344. --- 1,49 ----
  345. + XCOMM $XConsortium: Imakefile,v 1.2.1.1 92/09/09 15:38:45 rws Exp $
  346. + #ifndef NormalLibXTest
  347. + #define NormalLibXTest YES
  348. + #endif
  349. + #define DoNormalLib NormalLibXTest
  350. + #define DoSharedLib SharedLibXTest
  351. + #define DoDebugLib DebugLibXTest
  352. + #define DoProfileLib ProfileLibXTest
  353. + #include <Library.tmpl>
  354. + #ifdef RsArchitecture
  355. + REQUIREDLIBS = $(EXTENSIONSRC)/lib/libXext.a $(XLIBSRC)/libX11.a
  356. + #endif
  357. + INCLUDES = -I$(TOP) -I$(XLIBSRC) -I../../include
  358. + SRCS = XTest.c
  359. + OBJS = XTest.o
  360. + LINTLIBS = $(LINTXLIB)
  361. + LibraryObjectRule()
  362. + #if DoSharedLib
  363. + #if DoNormalLib
  364. + SharedLibraryTarget(Xtst,$(SOXTESTREV),$(OBJS),shared,..)
  365. + #else
  366. + SharedLibraryTarget(Xtst,$(SOXTESTREV),$(OBJS),.,.)
  367. + #endif
  368. + InstallSharedLibrary(Xtst,$(SOXTESTREV),$(USRLIBDIR))
  369. + #endif
  370. + #if DoNormalLib
  371. + NormalLibraryTarget(Xtst,$(OBJS))
  372. + InstallLibrary(Xtst,$(USRLIBDIR))
  373. + #endif
  374. + #if DoProfileLib
  375. + ProfiledLibraryTarget(Xtst,$(OBJS))
  376. + InstallLibrary(Xtst_p,$(USRLIBDIR))
  377. + #endif
  378. + #if DoDebugLib
  379. + DebuggedLibraryTarget(Xtst,$(OBJS))
  380. + #endif
  381. + LintLibraryTarget(Xtst,$(SRCS))
  382. + InstallLintLibrary(Xtst,$(LINTLIBDIR))
  383. + DependTarget()
  384. + NormalLintTarget($(SRCS))
  385. *** /dev/null    Wed Sep  9 15:40:33 1992
  386. --- mit/extensions/lib/xtest/XTest.c    Mon Apr 20 13:16:12 1992
  387. ***************
  388. *** 0 ****
  389. --- 1,272 ----
  390. + /* $XConsortium: XTest.c,v 1.7 92/04/20 13:14:52 rws Exp $ */
  391. + /*
  392. + Copyright 1990, 1991 by UniSoft Group Limited
  393. + Copyright 1992 by the Massachusetts Institute of Technology
  394. + Permission to use, copy, modify, distribute, and sell this software and its
  395. + documentation for any purpose is hereby granted without fee, provided that
  396. + the above copyright notice appear in all copies and that both that
  397. + copyright notice and this permission notice appear in supporting
  398. + documentation, and that the name of M.I.T. not be used in advertising or
  399. + publicity pertaining to distribution of the software without specific,
  400. + written prior permission.  M.I.T. makes no representations about the
  401. + suitability of this software for any purpose.  It is provided "as is"
  402. + without express or implied warranty.
  403. + */
  404. + #define NEED_REPLIES
  405. + #include "Xlibint.h"
  406. + #include "XTest.h"
  407. + #include "xteststr.h"
  408. + #include "Xext.h"
  409. + #include "extutil.h"
  410. + static XExtensionInfo _xtest_info_data;
  411. + static XExtensionInfo *xtest_info = &_xtest_info_data;
  412. + static /* const */ char *xtest_extension_name = XTestExtensionName;
  413. + #define XTestCheckExtension(dpy,i,val) \
  414. +   XextCheckExtension (dpy, i, xtest_extension_name, val)
  415. + /*****************************************************************************
  416. +  *                                                                           *
  417. +  *               private utility routines                          *
  418. +  *                                                                           *
  419. +  *****************************************************************************/
  420. + static int close_display();
  421. + static /* const */ XExtensionHooks xtest_extension_hooks = {
  422. +     NULL,                /* create_gc */
  423. +     NULL,                /* copy_gc */
  424. +     NULL,                /* flush_gc */
  425. +     NULL,                /* free_gc */
  426. +     NULL,                /* create_font */
  427. +     NULL,                /* free_font */
  428. +     close_display,            /* close_display */
  429. +     NULL,                /* wire_to_event */
  430. +     NULL,                /* event_to_wire */
  431. +     NULL,                /* error */
  432. +     NULL                /* error_string */
  433. + };
  434. + static XEXT_GENERATE_FIND_DISPLAY (find_display, xtest_info,
  435. +                    xtest_extension_name, 
  436. +                    &xtest_extension_hooks, XTestNumberEvents,
  437. +                    NULL)
  438. + static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtest_info)
  439. + /*****************************************************************************
  440. +  *                                                                           *
  441. +  *            public routines                                *
  442. +  *                                                                           *
  443. +  *****************************************************************************/
  444. + Bool
  445. + XTestQueryExtension (dpy, event_basep, error_basep, majorp, minorp)
  446. +     Display *dpy;
  447. +     int *event_basep, *error_basep;
  448. +     int *majorp, *minorp;
  449. + {
  450. +     XExtDisplayInfo *info = find_display (dpy);
  451. +     register xXTestGetVersionReq *req;
  452. +     xXTestGetVersionReply rep;
  453. +     if (XextHasExtension(info)) {
  454. +     LockDisplay(dpy);
  455. +     GetReq(XTestGetVersion, req);
  456. +     req->reqType = info->codes->major_opcode;
  457. +     req->xtReqType = X_XTestGetVersion;
  458. +     req->majorVersion = XTestMajorVersion;
  459. +     req->minorVersion = XTestMinorVersion;
  460. +     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  461. +         UnlockDisplay(dpy);
  462. +         SyncHandle();
  463. +         return False;
  464. +     }
  465. +     UnlockDisplay(dpy);
  466. +     SyncHandle();
  467. +     *event_basep = info->codes->first_event;
  468. +     *error_basep = info->codes->first_error;
  469. +     *majorp = rep.majorVersion;
  470. +     *minorp = rep.minorVersion;
  471. +     return True;
  472. +     } else {
  473. +     return False;
  474. +     }
  475. + }
  476. + Bool
  477. + XTestCompareCursorWithWindow(dpy, window, cursor)
  478. +     Display *dpy;
  479. +     Window window;
  480. +     Cursor cursor;
  481. + {
  482. +     XExtDisplayInfo *info = find_display (dpy);
  483. +     register xXTestCompareCursorReq *req;
  484. +     xXTestCompareCursorReply rep;
  485. +     XTestCheckExtension (dpy, info, 0);
  486. +     LockDisplay(dpy);
  487. +     GetReq(XTestCompareCursor, req);
  488. +     req->reqType = info->codes->major_opcode;
  489. +     req->xtReqType = X_XTestCompareCursor;
  490. +     req->window = window;
  491. +     req->cursor = cursor;
  492. +     if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
  493. +     UnlockDisplay(dpy);
  494. +     SyncHandle();
  495. +     return False;
  496. +     }
  497. +     UnlockDisplay(dpy);
  498. +     SyncHandle();
  499. +     return rep.same;
  500. + }
  501. + Bool
  502. + XTestCompareCurrentCursorWithWindow(dpy, window)
  503. +     Display *dpy;
  504. +     Window window;
  505. + {
  506. +     return XTestCompareCursorWithWindow(dpy, window, XTestCurrentCursor);
  507. + }
  508. + XTestFakeKeyEvent(dpy, keycode, is_press, delay)
  509. +     Display *dpy;
  510. +     unsigned int keycode;
  511. +     Bool is_press;
  512. +     unsigned long delay;
  513. + {
  514. +     XExtDisplayInfo *info = find_display (dpy);
  515. +     register xXTestFakeInputReq *req;
  516. +     XTestCheckExtension (dpy, info, 0);
  517. +     LockDisplay(dpy);
  518. +     GetReq(XTestFakeInput, req);
  519. +     req->reqType = info->codes->major_opcode;
  520. +     req->xtReqType = X_XTestFakeInput;
  521. +     req->type = is_press ? KeyPress : KeyRelease;
  522. +     req->detail = keycode;
  523. +     req->time = delay;
  524. +     UnlockDisplay(dpy);
  525. +     SyncHandle();
  526. + }
  527. + XTestFakeButtonEvent(dpy, button, is_press, delay)
  528. +     Display *dpy;
  529. +     unsigned int button;
  530. +     Bool is_press;
  531. +     unsigned long delay;
  532. + {
  533. +     XExtDisplayInfo *info = find_display (dpy);
  534. +     register xXTestFakeInputReq *req;
  535. +     XTestCheckExtension (dpy, info, 0);
  536. +     LockDisplay(dpy);
  537. +     GetReq(XTestFakeInput, req);
  538. +     req->reqType = info->codes->major_opcode;
  539. +     req->xtReqType = X_XTestFakeInput;
  540. +     req->type = is_press ? ButtonPress : ButtonRelease;
  541. +     req->detail = button;
  542. +     req->time = delay;
  543. +     UnlockDisplay(dpy);
  544. +     SyncHandle();
  545. + }
  546. + XTestFakeMotionEvent(dpy, screen, x, y, delay)
  547. +     Display *dpy;
  548. +     int screen;
  549. +     int x, y;
  550. +     unsigned long delay;
  551. + {
  552. +     XExtDisplayInfo *info = find_display (dpy);
  553. +     register xXTestFakeInputReq *req;
  554. +     XTestCheckExtension (dpy, info, 0);
  555. +     LockDisplay(dpy);
  556. +     GetReq(XTestFakeInput, req);
  557. +     req->reqType = info->codes->major_opcode;
  558. +     req->xtReqType = X_XTestFakeInput;
  559. +     req->type = MotionNotify;
  560. +     req->detail = False;
  561. +     if (screen == -1)
  562. +     req->root = None;
  563. +     else
  564. +     req->root = RootWindow(dpy, screen);
  565. +     req->rootX = x;
  566. +     req->rootY = y;
  567. +     req->time = delay;
  568. +     UnlockDisplay(dpy);
  569. +     SyncHandle();
  570. + }
  571. + XTestFakeRelativeMotionEvent(dpy, dx, dy, delay)
  572. +     Display *dpy;
  573. +     int dx, dy;
  574. +     unsigned long delay;
  575. + {
  576. +     XExtDisplayInfo *info = find_display (dpy);
  577. +     register xXTestFakeInputReq *req;
  578. +     XTestCheckExtension (dpy, info, 0);
  579. +     LockDisplay(dpy);
  580. +     GetReq(XTestFakeInput, req);
  581. +     req->reqType = info->codes->major_opcode;
  582. +     req->xtReqType = X_XTestFakeInput;
  583. +     req->type = MotionNotify;
  584. +     req->detail = True;
  585. +     req->root = None;
  586. +     req->rootX = dx;
  587. +     req->rootY = dy;
  588. +     req->time = delay;
  589. +     UnlockDisplay(dpy);
  590. +     SyncHandle();
  591. + }
  592. + void
  593. + XTestSetGContextOfGC(gc, gid)
  594. +     GC gc;
  595. +     GContext gid;
  596. + {
  597. +     gc->gid = gid;
  598. + }
  599. + void
  600. + XTestSetVisualIDOfVisual(visual, visualid)
  601. +     Visual *visual;
  602. +     VisualID visualid;
  603. + {
  604. +     visual->visualid = visualid;
  605. + }
  606. + static xReq _dummy_request = {
  607. +     0, 0, 0
  608. + };
  609. + Status
  610. + XTestDiscard(dpy)
  611. +     Display *dpy;
  612. + {
  613. +     Bool something;
  614. +     register char *ptr;
  615. +     LockDisplay(dpy);
  616. +     if (something = (dpy->bufptr != dpy->buffer)) {
  617. +     for (ptr = dpy->buffer;
  618. +          ptr < dpy->bufptr;
  619. +          ptr += (((xReq *)ptr)->length << 2))
  620. +         dpy->request--;
  621. +     dpy->bufptr = dpy->buffer;
  622. +     dpy->last_req = (char *)&_dummy_request;
  623. +     }
  624. +     UnlockDisplay(dpy);
  625. +     SyncHandle();
  626. +     return something;
  627. + }
  628. *** /tmp/,RCSt1016593    Wed Sep  9 15:46:33 1992
  629. --- mit/extensions/server/Imakefile    Wed Sep  9 15:46:35 1992
  630. ***************
  631. *** 1,4 ****
  632. ! XCOMM $XConsortium: Imakefile,v 5.15 91/07/16 23:09:51 gildea Exp $
  633.   #include <Server.tmpl>
  634.   
  635.   #if BuildXInputExt || BuildPexExt || BuildPexClients
  636. --- 1,4 ----
  637. ! XCOMM $XConsortium: Imakefile,v 5.15.1.1 92/09/09 15:32:22 rws Exp $
  638.   #include <Server.tmpl>
  639.   
  640.   #if BuildXInputExt || BuildPexExt || BuildPexClients
  641. ***************
  642. *** 19,26 ****
  643.     SHMSRCS = shm.c
  644.     SHMOBJS = shm.o
  645.   #endif
  646. !        SRCS = shape.c $(SHMSRCS) multibuf.c mitmisc.c xtest1di.c xtest1dd.c
  647. !        OBJS = shape.o $(SHMOBJS) multibuf.o mitmisc.o xtest1di.o xtest1dd.o
  648.      INCLUDES = -I../include -I$(INCLUDESRC) -I$(SERVERSRC)/include
  649.      LINTLIBS = ../../server/dix/llib-ldix.ln ../../server/os/4.2bsd/llib-los.ln
  650.           SUBDIRS = $(XINPUTDIRS) $(PEXDIRS)
  651. --- 19,26 ----
  652.     SHMSRCS = shm.c
  653.     SHMOBJS = shm.o
  654.   #endif
  655. !        SRCS = shape.c $(SHMSRCS) multibuf.c mitmisc.c sleepuntil.c xtest.c xtest1di.c xtest1dd.c
  656. !        OBJS = shape.o $(SHMOBJS) multibuf.o mitmisc.o sleepuntil.o xtest.o xtest1di.o xtest1dd.o
  657.      INCLUDES = -I../include -I$(INCLUDESRC) -I$(SERVERSRC)/include
  658.      LINTLIBS = ../../server/dix/llib-ldix.ln ../../server/os/4.2bsd/llib-los.ln
  659.           SUBDIRS = $(XINPUTDIRS) $(PEXDIRS)
  660. *** /dev/null    Wed Sep  9 15:40:33 1992
  661. --- mit/extensions/server/sleepuntil.c    Mon Feb 24 19:02:47 1992
  662. ***************
  663. *** 0 ****
  664. --- 1,199 ----
  665. + /*
  666. +  * $XConsortium: sleepuntil.c,v 1.1 92/02/24 19:02:27 keith Exp $
  667. +  *
  668. +  * Copyright 1992 Massachusetts Institute of Technology
  669. +  *
  670. +  * Permission to use, copy, modify, distribute, and sell this software and its
  671. +  * documentation for any purpose is hereby granted without fee, provided that
  672. +  * the above copyright notice appear in all copies and that both that
  673. +  * copyright notice and this permission notice appear in supporting
  674. +  * documentation, and that the name of M.I.T. not be used in advertising or
  675. +  * publicity pertaining to distribution of the software without specific,
  676. +  * written prior permission.  M.I.T. makes no representations about the
  677. +  * suitability of this software for any purpose.  It is provided "as is"
  678. +  * without express or implied warranty.
  679. +  *
  680. +  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  681. +  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  682. +  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  683. +  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  684. +  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  685. +  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  686. +  *
  687. +  * Author:  Keith Packard, MIT X Consortium
  688. +  */
  689. + /* dixsleep.c - implement millisecond timeouts for X clients */
  690. + #include "X.h"
  691. + #include "Xmd.h"
  692. + #include "misc.h"
  693. + #include "windowstr.h"
  694. + #include "dixstruct.h"
  695. + #include "pixmapstr.h"
  696. + #include "scrnintstr.h"
  697. + typedef struct _Sertafied {
  698. +     struct _Sertafied    *next;
  699. +     TimeStamp        revive;
  700. +     ClientPtr        pClient;
  701. +     XID            id;
  702. +     void        (*notifyFunc)();
  703. +     pointer        closure;
  704. + } SertafiedRec, *SertafiedPtr;
  705. + static SertafiedPtr pPending;
  706. + static RESTYPE        SertafiedResType;
  707. + static Bool        BlockHandlerRegistered;
  708. + static int        SertafiedGeneration;
  709. + static void        WachetAuf();
  710. + static void        SertafiedDelete();
  711. + static void        SertafiedBlockHandler();
  712. + static void        SertafiedWakeupHandler();
  713. + ClientSleepUntil (client, revive, notifyFunc, closure)
  714. +     ClientPtr    client;
  715. +     TimeStamp    *revive;
  716. +     void    (*notifyFunc)();
  717. +     pointer    closure;
  718. + {
  719. +     SertafiedPtr    pRequest, pReq, pPrev;
  720. +     if (SertafiedGeneration != serverGeneration)
  721. +     {
  722. +     SertafiedResType = CreateNewResourceType (SertafiedDelete);
  723. +     if (!SertafiedResType)
  724. +         return FALSE;
  725. +     SertafiedGeneration = serverGeneration;
  726. +     BlockHandlerRegistered = FALSE;
  727. +     }
  728. +     pRequest = (SertafiedPtr) xalloc (sizeof (SertafiedRec));
  729. +     if (!pRequest)
  730. +     return FALSE;
  731. +     pRequest->pClient = client;
  732. +     pRequest->revive = *revive;
  733. +     pRequest->id = FakeClientID (client->index);
  734. +     pRequest->closure = closure;
  735. +     if (!BlockHandlerRegistered)
  736. +     {
  737. +     if (!RegisterBlockAndWakeupHandlers (SertafiedBlockHandler,
  738. +                          SertafiedWakeupHandler,
  739. +                          (pointer) 0))
  740. +     {
  741. +         xfree (pRequest);
  742. +         return FALSE;
  743. +     }
  744. +     BlockHandlerRegistered = TRUE;
  745. +     }
  746. +     pRequest->notifyFunc = 0;
  747. +     if (!AddResource (pRequest->id, SertafiedResType, (pointer) pRequest))
  748. +     return FALSE;
  749. +     if (!notifyFunc)
  750. +     notifyFunc = WachetAuf;
  751. +     pRequest->notifyFunc = notifyFunc;
  752. +     /* Insert into time-ordered queue, with earliest activation time coming first. */
  753. +     pPrev = 0;
  754. +     for (pReq = pPending; pReq; pReq = pReq->next)
  755. +     {
  756. +     if (CompareTimeStamps (pReq->revive, *revive) == LATER)
  757. +         break;
  758. +     pPrev = pReq;
  759. +     }
  760. +     if (pPrev)
  761. +     pPrev->next = pRequest;
  762. +     else
  763. +     pPending = pRequest;
  764. +     pRequest->next = pReq;
  765. +     IgnoreClient (client);
  766. +     return TRUE;
  767. + }
  768. + static void
  769. + WachetAuf (client, closure)
  770. +     ClientPtr    client;
  771. +     pointer    closure;
  772. + {
  773. +     if (!client->clientGone)
  774. +     AttendClient (client);
  775. + }
  776. + static void
  777. + SertafiedDelete (pRequest)
  778. +     SertafiedPtr    pRequest;
  779. + {
  780. +     SertafiedPtr    pReq, pPrev;
  781. +     pPrev = 0;
  782. +     for (pReq = pPending; pReq; pReq = pReq->next)
  783. +     if (pReq == pRequest)
  784. +     {
  785. +         if (pPrev)
  786. +         pPrev->next = pReq->next;
  787. +         else
  788. +         pPending = pReq->next;
  789. +         break;
  790. +     }
  791. +     if (pRequest->notifyFunc)
  792. +     (*pRequest->notifyFunc) (pRequest->pClient, pRequest->closure);
  793. +     xfree (pRequest);
  794. + }
  795. + static void
  796. + SertafiedBlockHandler (data, wt, LastSelectMask)
  797. +     pointer        data;        /* unused */
  798. +     pointer        wt;            /* wait time */
  799. +     long        *LastSelectMask;
  800. + {
  801. +     SertafiedPtr        pReq, pNext;
  802. +     unsigned long        newdelay, olddelay;
  803. +     TimeStamp            now;
  804. +     if (!pPending)
  805. +     return;
  806. +     now.milliseconds = GetTimeInMillis ();
  807. +     now.months = currentTime.months;
  808. +     if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
  809. +     now.months++;
  810. +     for (pReq = pPending; pReq; pReq = pNext)
  811. +     {
  812. +     pNext = pReq->next;
  813. +     if (CompareTimeStamps (pReq->revive, now) == LATER)
  814. +         break;
  815. +     FreeResource (pReq->id, RT_NONE);
  816. +     }
  817. +     pReq = pPending;
  818. +     if (!pReq)
  819. +     return;
  820. +     newdelay = pReq->revive.milliseconds - now.milliseconds;
  821. +     AdjustWaitForDelay (wt, newdelay);
  822. + }
  823. + static void
  824. + SertafiedWakeupHandler (data, i, LastSelectMask)
  825. +     pointer        data;
  826. +     int            i;
  827. +     long        *LastSelectMask;
  828. + {
  829. +     SertafiedPtr    pReq, pNext;
  830. +     TimeStamp        now;
  831. +     now.milliseconds = GetTimeInMillis ();
  832. +     now.months = currentTime.months;
  833. +     if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
  834. +     now.months++;
  835. +     for (pReq = pPending; pReq; pReq = pNext)
  836. +     {
  837. +     pNext = pReq->next;
  838. +     if (CompareTimeStamps (pReq->revive, now) == LATER)
  839. +         break;
  840. +     FreeResource (pReq->id, RT_NONE);
  841. +     }
  842. +     if (!pPending)
  843. +     {
  844. +     RemoveBlockAndWakeupHandlers (SertafiedBlockHandler,
  845. +                       SertafiedWakeupHandler,
  846. +                       (pointer) 0);
  847. +     BlockHandlerRegistered = FALSE;
  848. +     }
  849. + }
  850. *** /dev/null    Wed Sep  9 17:02:52 1992
  851. --- mit/extensions/server/xtest.c    Wed Sep  9 17:09:49 1992
  852. ***************
  853. *** 0 ****
  854. --- 1,358 ----
  855. + /* $XConsortium: xtest.c,v 1.12.1.1 92/09/09 17:08:16 rws Exp $ */
  856. + /*
  857. + Copyright 1992 by the Massachusetts Institute of Technology
  858. + Permission to use, copy, modify, distribute, and sell this software and its
  859. + documentation for any purpose is hereby granted without fee, provided that
  860. + the above copyright notice appear in all copies and that both that
  861. + copyright notice and this permission notice appear in supporting
  862. + documentation, and that the name of M.I.T. not be used in advertising or
  863. + publicity pertaining to distribution of the software without specific,
  864. + written prior permission.  M.I.T. makes no representations about the
  865. + suitability of this software for any purpose.  It is provided "as is"
  866. + without express or implied warranty.
  867. + */
  868. + #include "X.h"
  869. + #define NEED_EVENTS
  870. + #include "Xproto.h"
  871. + #include "misc.h"
  872. + #include "os.h"
  873. + #include "dixstruct.h"
  874. + #include "extnsionst.h"
  875. + #include "windowstr.h"
  876. + #include "inputstr.h"
  877. + #include "scrnintstr.h"
  878. + #define _XTEST_SERVER_
  879. + #include "XTest.h"
  880. + #include "xteststr.h"
  881. + static unsigned char XTestReqCode;
  882. + static int ProcXTestDispatch(), SProcXTestDispatch();
  883. + static void XTestResetProc();
  884. + static int XTestSwapFakeInput();
  885. + CursorPtr GetSpriteCursor();
  886. + WindowPtr GetCurrentRootWindow();
  887. + extern int screenIsSaved;
  888. + void
  889. + XTestExtensionInit()
  890. + {
  891. +     ExtensionEntry *extEntry, *AddExtension();
  892. +     if (extEntry = AddExtension(XTestExtensionName, 0, 0,
  893. +                  ProcXTestDispatch, SProcXTestDispatch,
  894. +                  XTestResetProc, StandardMinorOpcode))
  895. +     XTestReqCode = (unsigned char)extEntry->base;
  896. + }
  897. + /*ARGSUSED*/
  898. + static void
  899. + XTestResetProc (extEntry)
  900. + ExtensionEntry    *extEntry;
  901. + {
  902. + }
  903. + static int
  904. + ProcXTestGetVersion(client)
  905. +     register ClientPtr client;
  906. + {
  907. +     REQUEST(xXTestGetVersionReq);
  908. +     xXTestGetVersionReply rep;
  909. +     register int n;
  910. +     REQUEST_SIZE_MATCH(xXTestGetVersionReq);
  911. +     rep.type = X_Reply;
  912. +     rep.length = 0;
  913. +     rep.sequenceNumber = client->sequence;
  914. +     rep.majorVersion = XTestMajorVersion;
  915. +     rep.minorVersion = XTestMinorVersion;
  916. +     if (client->swapped) {
  917. +         swaps(&rep.sequenceNumber, n);
  918. +     swaps(&rep.minorVersion, n);
  919. +     }
  920. +     WriteToClient(client, sizeof(xXTestGetVersionReply), (char *)&rep);
  921. +     return(client->noClientException);
  922. + }
  923. + static int
  924. + ProcXTestCompareCursor(client)
  925. +     register ClientPtr client;
  926. + {
  927. +     REQUEST(xXTestCompareCursorReq);
  928. +     xXTestCompareCursorReply rep;
  929. +     WindowPtr pWin;
  930. +     CursorPtr pCursor;
  931. +     register int n;
  932. +     REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
  933. +     pWin = (WindowPtr)LookupWindow(stuff->window, client);
  934. +     if (!pWin)
  935. +         return(BadWindow);
  936. +     if (stuff->cursor == None)
  937. +     pCursor = NullCursor;
  938. +     else if (stuff->cursor == XTestCurrentCursor)
  939. +     pCursor = GetSpriteCursor();
  940. +     else {
  941. +     pCursor = (CursorPtr)LookupIDByType(stuff->cursor, RT_CURSOR);
  942. +     if (!pCursor) 
  943. +     {
  944. +         client->errorValue = stuff->cursor;
  945. +         return (BadCursor);
  946. +     }
  947. +     }
  948. +     rep.type = X_Reply;
  949. +     rep.length = 0;
  950. +     rep.sequenceNumber = client->sequence;
  951. +     rep.same = (wCursor(pWin) == pCursor);
  952. +     if (client->swapped) {
  953. +         swaps(&rep.sequenceNumber, n);
  954. +     }
  955. +     WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *)&rep);
  956. +     return(client->noClientException);
  957. + }
  958. + static int
  959. + ProcXTestFakeInput(client)
  960. +     register ClientPtr client;
  961. + {
  962. +     REQUEST(xReq);
  963. +     int nev;
  964. +     int    n;
  965. +     xEvent *ev;
  966. +     DeviceIntPtr dev;
  967. +     WindowPtr root;
  968. +     nev = (stuff->length << 2) - sizeof(xReq);
  969. +     if (nev % sizeof(xEvent))
  970. +     return BadLength;
  971. +     nev /= sizeof(xEvent);
  972. +     if (nev != 1)
  973. +     return BadLength; /* for now */
  974. +     UpdateCurrentTime();
  975. +     ev = (xEvent *)&stuff[1];
  976. +     switch (ev->u.u.type & 0177)
  977. +     {
  978. +     case KeyPress:
  979. +     case KeyRelease:
  980. +     case MotionNotify:
  981. +     case ButtonPress:
  982. +     case ButtonRelease:
  983. +     break;
  984. +     default:
  985. +     client->errorValue = ev->u.u.type;
  986. +     return BadValue;
  987. +     }
  988. +     if (ev->u.keyButtonPointer.time)
  989. +     {
  990. +     TimeStamp activateTime;
  991. +     CARD32 ms;
  992. +     activateTime = currentTime;
  993. +     ms = activateTime.milliseconds + ev->u.keyButtonPointer.time;
  994. +     if (ms < activateTime.milliseconds)
  995. +         activateTime.months++;
  996. +     activateTime.milliseconds = ms;
  997. +     ev->u.keyButtonPointer.time = 0;
  998. +     /* swap the request back so we can simply re-execute it */
  999. +     if (client->swapped)
  1000. +     {
  1001. +             (void) XTestSwapFakeInput(client, stuff);
  1002. +         swaps(&stuff->length, n);
  1003. +     }
  1004. +     ResetCurrentRequest (client);
  1005. +     client->sequence--;
  1006. +     if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
  1007. +     {
  1008. +         /* 
  1009. +          * flush this request - must be in this order because
  1010. +          * ResetCurrentRequest adds the client back to 
  1011. +          * clientsWithInput which will cause the client to
  1012. +          * keep going, instead of waiting for the timeout.
  1013. +          */
  1014. +         (void) ReadRequestFromClient (client);
  1015. +         client->sequence++;
  1016. +         return BadAlloc;
  1017. +     }
  1018. +     return Success;
  1019. +     }
  1020. +     switch (ev->u.u.type & 0177)
  1021. +     {
  1022. +     case KeyPress:
  1023. +     case KeyRelease:
  1024. +     dev = (DeviceIntPtr)LookupKeyboardDevice();
  1025. +     if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
  1026. +         ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
  1027. +     {
  1028. +         client->errorValue = ev->u.u.detail;
  1029. +         return BadValue;
  1030. +     }
  1031. +     break;
  1032. +     case MotionNotify:
  1033. +     dev = (DeviceIntPtr)LookupPointerDevice();
  1034. +     if (ev->u.keyButtonPointer.root == None)
  1035. +         root = GetCurrentRootWindow();
  1036. +     else
  1037. +     {
  1038. +         root = LookupWindow(ev->u.keyButtonPointer.root, client);
  1039. +         if (!root)
  1040. +         return BadWindow;
  1041. +         if (root->parent)
  1042. +         {
  1043. +         client->errorValue = ev->u.keyButtonPointer.root;
  1044. +         return BadValue;
  1045. +         }
  1046. +     }
  1047. +     if (ev->u.u.detail == xTrue)
  1048. +     {
  1049. +         int x, y;
  1050. +         GetSpritePosition(&x, &y);
  1051. +         ev->u.keyButtonPointer.rootX += x;
  1052. +         ev->u.keyButtonPointer.rootY += y;
  1053. +     }
  1054. +     else if (ev->u.u.detail != xFalse)
  1055. +     {
  1056. +         client->errorValue = ev->u.u.detail;
  1057. +         return BadValue;
  1058. +     }
  1059. +     if (ev->u.keyButtonPointer.rootX < 0)
  1060. +         ev->u.keyButtonPointer.rootX = 0;
  1061. +     else if (ev->u.keyButtonPointer.rootX >= root->drawable.width)
  1062. +         ev->u.keyButtonPointer.rootX = root->drawable.width - 1;
  1063. +     if (ev->u.keyButtonPointer.rootY < 0)
  1064. +         ev->u.keyButtonPointer.rootY = 0;
  1065. +     else if (ev->u.keyButtonPointer.rootY >= root->drawable.height)
  1066. +         ev->u.keyButtonPointer.rootY = root->drawable.height - 1;
  1067. +     if (root != GetCurrentRootWindow())
  1068. +     {
  1069. +         NewCurrentScreen(root->drawable.pScreen,
  1070. +                  ev->u.keyButtonPointer.rootX,
  1071. +                  ev->u.keyButtonPointer.rootY);
  1072. +         return client->noClientException;
  1073. +     }
  1074. +     (*root->drawable.pScreen->SetCursorPosition)
  1075. +         (root->drawable.pScreen,
  1076. +          ev->u.keyButtonPointer.rootX,
  1077. +          ev->u.keyButtonPointer.rootY, FALSE);
  1078. +     break;
  1079. +     case ButtonPress:
  1080. +     case ButtonRelease:
  1081. +     dev = (DeviceIntPtr)LookupPointerDevice();
  1082. +     if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
  1083. +     {
  1084. +         client->errorValue = ev->u.u.detail;
  1085. +         return BadValue;
  1086. +     }
  1087. +     break;
  1088. +     }
  1089. +     if (screenIsSaved == SCREEN_SAVER_ON)
  1090. +     SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
  1091. +     ev->u.keyButtonPointer.time = currentTime.milliseconds;
  1092. +     (*dev->public.processInputProc)(ev, (DevicePtr)dev, 1); 
  1093. +     return client->noClientException;
  1094. + }
  1095. + static int
  1096. + ProcXTestDispatch (client)
  1097. +     register ClientPtr    client;
  1098. + {
  1099. +     REQUEST(xReq);
  1100. +     switch (stuff->data)
  1101. +     {
  1102. +     case X_XTestGetVersion:
  1103. +     return ProcXTestGetVersion(client);
  1104. +     case X_XTestCompareCursor:
  1105. +     return ProcXTestCompareCursor(client);
  1106. +     case X_XTestFakeInput:
  1107. +     return ProcXTestFakeInput(client);
  1108. +     default:
  1109. +     return BadRequest;
  1110. +     }
  1111. + }
  1112. + static int
  1113. + SProcXTestGetVersion(client)
  1114. +     register ClientPtr    client;
  1115. + {
  1116. +     register int n;
  1117. +     REQUEST(xXTestGetVersionReq);
  1118. +     swaps(&stuff->length, n);
  1119. +     REQUEST_SIZE_MATCH(xXTestGetVersionReq);
  1120. +     swaps(&stuff->minorVersion, n);
  1121. +     return ProcXTestGetVersion(client);
  1122. + }
  1123. + static int
  1124. + SProcXTestCompareCursor(client)
  1125. +     register ClientPtr    client;
  1126. + {
  1127. +     register int n;
  1128. +     REQUEST(xXTestCompareCursorReq);
  1129. +     swaps(&stuff->length, n);
  1130. +     REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
  1131. +     swapl(&stuff->window, n);
  1132. +     swapl(&stuff->cursor, n);
  1133. +     return ProcXTestCompareCursor(client);
  1134. + }
  1135. + static int
  1136. + XTestSwapFakeInput(client, req)
  1137. +     register ClientPtr    client;
  1138. +     xReq *req;
  1139. + {
  1140. +     register int nev;
  1141. +     register xEvent *ev;
  1142. +     xEvent sev;
  1143. +     void (*proc)(), NotImplemented();
  1144. +     nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
  1145. +     for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
  1146. +     {
  1147. +         /* Swap event */
  1148. +         proc = EventSwapVector[ev->u.u.type & 0177];
  1149. +     /* no swapping proc; invalid event type? */
  1150. +         if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) {
  1151. +         client->errorValue = ev->u.u.type;
  1152. +         return BadValue;
  1153. +     }
  1154. +         (*proc)(ev, &sev);
  1155. +     *ev = sev;
  1156. +     }
  1157. +     return Success;
  1158. + }
  1159. + static int
  1160. + SProcXTestFakeInput(client)
  1161. +     register ClientPtr    client;
  1162. + {
  1163. +     register int n;
  1164. +     REQUEST(xReq);
  1165. +     swaps(&stuff->length, n);
  1166. +     n = XTestSwapFakeInput(client, stuff);
  1167. +     if (n != Success)
  1168. +     return n;
  1169. +     return ProcXTestFakeInput(client);
  1170. + }
  1171. + static int
  1172. + SProcXTestDispatch (client)
  1173. +     register ClientPtr    client;
  1174. + {
  1175. +     REQUEST(xReq);
  1176. +     switch (stuff->data)
  1177. +     {
  1178. +     case X_XTestGetVersion:
  1179. +     return SProcXTestGetVersion(client);
  1180. +     case X_XTestCompareCursor:
  1181. +     return SProcXTestCompareCursor(client);
  1182. +     case X_XTestFakeInput:
  1183. +     return SProcXTestFakeInput(client);
  1184. +     default:
  1185. +     return BadRequest;
  1186. +     }
  1187. + }
  1188. *** /tmp/,RCSt1016604    Wed Sep  9 15:47:54 1992
  1189. --- mit/server/ddx/mi/miinitext.c    Wed Sep  9 15:47:56 1992
  1190. ***************
  1191. *** 21,27 ****
  1192.   SOFTWARE.
  1193.   
  1194.   ******************************************************************/
  1195. ! /* $XConsortium: miinitext.c,v 1.15 90/08/15 08:42:23 rws Exp $ */
  1196.   
  1197.   #ifdef BEZIER
  1198.   extern void BezierExtensionInit();
  1199. --- 21,27 ----
  1200.   SOFTWARE.
  1201.   
  1202.   ******************************************************************/
  1203. ! /* $XConsortium: miinitext.c,v 1.15.1.1 92/09/09 15:34:45 rws Exp $ */
  1204.   
  1205.   #ifdef BEZIER
  1206.   extern void BezierExtensionInit();
  1207. ***************
  1208. *** 44,49 ****
  1209. --- 44,52 ----
  1210.   #ifdef XINPUT
  1211.   extern void XInputExtensionInit();
  1212.   #endif
  1213. + #ifdef XTEST
  1214. + extern void XTestExtensionInit();
  1215. + #endif
  1216.   #ifdef MITMISC
  1217.   extern void MITMiscExtensionInit();
  1218.   #endif
  1219. ***************
  1220. *** 77,82 ****
  1221. --- 80,88 ----
  1222.   #endif
  1223.   #ifdef XINPUT
  1224.       XInputExtensionInit();
  1225. + #endif
  1226. + #ifdef XTEST
  1227. +     XTestExtensionInit();
  1228.   #endif
  1229.   #ifdef MITMISC
  1230.       MITMiscExtensionInit();
  1231.  
  1232. *****************************************************************************
  1233.  
  1234. --
  1235. ;       $B2-(J  $B9,90(J                Email: yoki@ari.ncl.omron.co.jp
  1236. ;    $B8=:_(JKYSA$B8&=$Cf(J        Email:  oki@course.kysa.co.jp
  1237. ;       $B%*%`%m%s3t<02q<R(J        $B%7%9%F%`Am9g8&5f=j(J(RZB)        
  1238. ;       Phone: 075-951-5111 Ext.(3634) Fax:   075-956-7403
  1239.