1b1297603Smrg/*
2b1297603Smrg * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
3b1297603Smrg *
4b1297603Smrg * Permission to use, copy, modify, distribute, and sell this software and its
5b1297603Smrg * documentation for any purpose is  hereby granted without fee, provided that
6b1297603Smrg * the  above copyright   notice appear  in   all  copies and  that both  that
7b1297603Smrg * copyright  notice   and   this  permission   notice  appear  in  supporting
85b944e2aSmrg * documentation, and that   the  name of  the authors  not  be  used  in
9b1297603Smrg * advertising or publicity pertaining to distribution of the software without
105b944e2aSmrg * specific,  written      prior  permission.     The authors  make  no
11b1297603Smrg * representations about the suitability of this software for any purpose.  It
12b1297603Smrg * is provided "as is" without express or implied warranty.
13b1297603Smrg *
145b944e2aSmrg * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
15b1297603Smrg * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
165b944e2aSmrg * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
17b1297603Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18b1297603Smrg * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
19b1297603Smrg * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
20b1297603Smrg * PERFORMANCE OF THIS SOFTWARE.
21b1297603Smrg *
22b1297603Smrg */
23b1297603Smrg
24b1297603Smrg#include "xinput.h"
25b1297603Smrg
26b1297603Smrgint
27b1297603Smrgset_pointer(Display	*display,
28b1297603Smrg	    int		argc,
29b1297603Smrg	    char	*argv[],
30b1297603Smrg	    char	*name,
31b1297603Smrg	    char	*desc)
32b1297603Smrg{
33b1297603Smrg    XDeviceInfo		*info;
34b1297603Smrg    XDevice		*device;
35b1297603Smrg    int			xaxis = 0;
36b1297603Smrg    int			yaxis = 1;
37b1297603Smrg
38b1297603Smrg    if ((argc != 1) && (argc != 3)) {
39b1297603Smrg	fprintf(stderr, "usage: xinput %s %s\n", name, desc);
40b1297603Smrg	return EXIT_FAILURE;
41b1297603Smrg    }
42b1297603Smrg
43b1297603Smrg    if (argc == 3) {
44b1297603Smrg	xaxis = atoi(argv[1]);
45b1297603Smrg	yaxis = atoi(argv[2]);
46b1297603Smrg    }
47b1297603Smrg
48b1297603Smrg    info = find_device_info(display, argv[0], True);
49b1297603Smrg
50b1297603Smrg    if (!info) {
510309d3b3Smrg	fprintf(stderr, "unable to find device '%s'\n", argv[0]);
52b1297603Smrg	return EXIT_FAILURE;
53b1297603Smrg    }
54b1297603Smrg
55b1297603Smrg    device = XOpenDevice(display, info->id);
56b1297603Smrg
57b1297603Smrg    if (device) {
58b1297603Smrg	XChangePointerDevice(display, device, xaxis, yaxis);
59b1297603Smrg
60b1297603Smrg	return EXIT_SUCCESS;
61b1297603Smrg    } else {
62b1297603Smrg	fprintf(stderr, "Unable to open device\n");
63b1297603Smrg	return EXIT_FAILURE;
64b1297603Smrg    }
65b1297603Smrg}
66b1297603Smrg
67b1297603Smrg/* end of setptr.c */
68