do_simple.c revision 264fa531
1264fa531Smrg/* $Xorg: do_simple.c,v 1.4 2000/08/17 19:54:09 cpqbld Exp $ */
2264fa531Smrg/*****************************************************************************
3264fa531SmrgCopyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
4264fa531Smrg
5264fa531Smrg                        All Rights Reserved
6264fa531Smrg
7264fa531SmrgPermission to use, copy, modify, and distribute this software and its
8264fa531Smrgdocumentation for any purpose and without fee is hereby granted,
9264fa531Smrgprovided that the above copyright notice appear in all copies and that
10264fa531Smrgboth that copyright notice and this permission notice appear in
11264fa531Smrgsupporting documentation, and that the name of Digital not be
12264fa531Smrgused in advertising or publicity pertaining to distribution of the
13264fa531Smrgsoftware without specific, written prior permission.
14264fa531Smrg
15264fa531SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
16264fa531SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
17264fa531SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
18264fa531SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
19264fa531SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
20264fa531SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
21264fa531SmrgSOFTWARE.
22264fa531Smrg
23264fa531Smrg******************************************************************************/
24264fa531Smrg/* $XFree86: xc/programs/x11perf/do_simple.c,v 1.6tsi Exp $ */
25264fa531Smrg
26264fa531Smrg#ifndef VMS
27264fa531Smrg#include <X11/Xatom.h>
28264fa531Smrg#else
29264fa531Smrg#include <decw$include/Xatom.h>
30264fa531Smrg#endif
31264fa531Smrg
32264fa531Smrg#include "x11perf.h"
33264fa531Smrg
34264fa531Smrgstatic Atom XA_PK_TEMP;
35264fa531Smrg
36264fa531Smrgvoid
37264fa531SmrgDoNoOp(XParms xp, Parms p, int reps)
38264fa531Smrg{
39264fa531Smrg    int     i;
40264fa531Smrg
41264fa531Smrg    for (i = 0; i != reps; i++) {
42264fa531Smrg	XNoOp(xp->d);
43264fa531Smrg	CheckAbort ();
44264fa531Smrg    }
45264fa531Smrg}
46264fa531Smrg
47264fa531Smrg
48264fa531Smrgvoid
49264fa531SmrgDoGetAtom(XParms xp, Parms p, int reps)
50264fa531Smrg{
51264fa531Smrg    char    *atom;
52264fa531Smrg    int     i;
53264fa531Smrg
54264fa531Smrg    for (i = 0; i != reps; i++) {
55264fa531Smrg	atom = XGetAtomName (xp->d, 1);
56264fa531Smrg 	XFree(atom); /* fix XBUG 6480 */
57264fa531Smrg	CheckAbort ();
58264fa531Smrg    }
59264fa531Smrg}
60264fa531Smrg
61264fa531Smrgvoid
62264fa531SmrgDoQueryPointer(XParms xp, Parms p, int reps)
63264fa531Smrg{
64264fa531Smrg    int     i;
65264fa531Smrg    Window  w;
66264fa531Smrg    int     x;
67264fa531Smrg    unsigned int m;
68264fa531Smrg
69264fa531Smrg    for (i = 0; i != reps; i++) {
70264fa531Smrg	XQueryPointer (xp->d, xp->w, &w, &w, &x, &x, &x, &x, &m);
71264fa531Smrg	CheckAbort ();
72264fa531Smrg    }
73264fa531Smrg}
74264fa531Smrg
75264fa531Smrgint
76264fa531SmrgInitGetProperty(XParms xp, Parms p, int reps)
77264fa531Smrg{
78264fa531Smrg    long foo[4];
79264fa531Smrg
80264fa531Smrg    foo[0] = 41;
81264fa531Smrg    foo[1] = 14;
82264fa531Smrg    foo[2] = 37;
83264fa531Smrg    foo[3] = 73;
84264fa531Smrg    XA_PK_TEMP = XInternAtom (xp->d, "_PK_TEMP", False);
85264fa531Smrg    XChangeProperty (
86264fa531Smrg	    xp->d, xp->w, XA_PK_TEMP, XA_INTEGER, 32,
87264fa531Smrg	    PropModeReplace, (unsigned char *)foo, 4);
88264fa531Smrg    return reps;
89264fa531Smrg}
90264fa531Smrg
91264fa531Smrgvoid
92264fa531SmrgDoGetProperty(XParms xp, Parms p, int reps)
93264fa531Smrg{
94264fa531Smrg    int     i;
95264fa531Smrg    int     actual_format;
96264fa531Smrg    unsigned long actual_length, bytes_remaining;
97264fa531Smrg    unsigned char *prop;
98264fa531Smrg
99264fa531Smrg    Atom actual_type;
100264fa531Smrg
101264fa531Smrg    for (i = 0; i != reps; i++) {
102264fa531Smrg	XGetWindowProperty (
103264fa531Smrg		xp->d, xp->w, XA_PK_TEMP, 0, 4,
104264fa531Smrg		False, AnyPropertyType, &actual_type, &actual_format,
105264fa531Smrg		&actual_length, &bytes_remaining, &prop);
106264fa531Smrg	CheckAbort ();
107264fa531Smrg	XFree(prop);
108264fa531Smrg    }
109264fa531Smrg}
110