do_simple.c revision 533545b5
1/*****************************************************************************
2Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
3
4                        All Rights Reserved
5
6Permission to use, copy, modify, and distribute this software and its
7documentation for any purpose and without fee is hereby granted,
8provided that the above copyright notice appear in all copies and that
9both that copyright notice and this permission notice appear in
10supporting documentation, and that the name of Digital not be
11used in advertising or publicity pertaining to distribution of the
12software without specific, written prior permission.
13
14DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20SOFTWARE.
21
22******************************************************************************/
23
24#ifndef VMS
25#include <X11/Xatom.h>
26#else
27#include <decw$include/Xatom.h>
28#endif
29
30#include "x11perf.h"
31
32static Atom XA_PK_TEMP;
33
34void
35DoNoOp(XParms xp, Parms p, int64_t reps)
36{
37    int     i;
38
39    for (i = 0; i != reps; i++) {
40	XNoOp(xp->d);
41	CheckAbort ();
42    }
43}
44
45
46void
47DoGetAtom(XParms xp, Parms p, int64_t reps)
48{
49    char    *atom;
50    int     i;
51
52    for (i = 0; i != reps; i++) {
53	atom = XGetAtomName (xp->d, 1);
54 	XFree(atom); /* fix XBUG 6480 */
55	CheckAbort ();
56    }
57}
58
59void
60DoQueryPointer(XParms xp, Parms p, int64_t reps)
61{
62    int     i;
63    Window  w;
64    int     x;
65    unsigned int m;
66
67    for (i = 0; i != reps; i++) {
68	XQueryPointer (xp->d, xp->w, &w, &w, &x, &x, &x, &x, &m);
69	CheckAbort ();
70    }
71}
72
73int
74InitGetProperty(XParms xp, Parms p, int64_t reps)
75{
76    long foo[4];
77
78    foo[0] = 41;
79    foo[1] = 14;
80    foo[2] = 37;
81    foo[3] = 73;
82    XA_PK_TEMP = XInternAtom (xp->d, "_PK_TEMP", False);
83    XChangeProperty (
84	    xp->d, xp->w, XA_PK_TEMP, XA_INTEGER, 32,
85	    PropModeReplace, (unsigned char *)foo, 4);
86    return reps;
87}
88
89void
90DoGetProperty(XParms xp, Parms p, int64_t reps)
91{
92    int     i;
93    int     actual_format;
94    unsigned long actual_length, bytes_remaining;
95    unsigned char *prop;
96
97    Atom actual_type;
98
99    for (i = 0; i != reps; i++) {
100	XGetWindowProperty (
101		xp->d, xp->w, XA_PK_TEMP, 0, 4,
102		False, AnyPropertyType, &actual_type, &actual_format,
103		&actual_length, &bytes_remaining, &prop);
104	CheckAbort ();
105	XFree(prop);
106    }
107}
108