diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-11-06 11:43:46 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-10 14:39:41 +1000 |
commit | 087655d80d8dfb48ea395b6ae41e85a580f3851a (patch) | |
tree | d97d0c98b5d58d0977e0cc6a1775abe116557864 | |
parent | e1cbd668de52ff3f35c8cc1ca362adc019935288 (diff) | |
download | xf86-input-wacom-087655d80d8dfb48ea395b6ae41e85a580f3851a.tar.gz |
Add tools/xsetwacom, currently a stub.
config.h includes xorg-server.h and it's 64 bit magic. xsetwacom can't use
this magic, it needs to use the 64-bit interfaces provided by Xlib and thus
the matching sizes for all structs.
Instead of including xorg-server.h in all driver source files, conditionally
include it depending on whether WACOM_TOOLS is defined or not.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | tools/Makefile.am | 28 | ||||
-rw-r--r-- | tools/xsetwacom.c | 100 |
4 files changed, 134 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index e36ae0f..27ee95d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ AUTOMAKE_OPTIONS = foreign # Ensure headers are installed below $(prefix) for distcheck DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg' -SUBDIRS = fdi src man include +SUBDIRS = fdi src man include tools pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = xorg-wacom.pc diff --git a/configure.ac b/configure.ac index 6e97363..be05ca7 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,10 @@ AC_PROG_LIBTOOL AC_PROG_CC XORG_DEFAULT_OPTIONS -AH_TOP([#include "xorg-server.h"]) +AH_TOP([ +#ifndef WACOM_TOOLS +#include "xorg-server.h" +#endif]) AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debugging (default: disabled)]), @@ -87,4 +90,5 @@ AC_OUTPUT([Makefile src/Makefile man/Makefile include/Makefile + tools/Makefile xorg-wacom.pc]) diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..0ba79ee --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,28 @@ +# Copyright 2009 Red Hat, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +AM_CFLAGS = $(XORG_CFLAGS) + +bin_PROGRAMS = \ + xsetwacom + +INCLUDES=-I$(top_srcdir)/include/ + +xsetwacom_LDFLAGS = $(XI_LIBS) + diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c new file mode 100644 index 0000000..5fb3625 --- /dev/null +++ b/tools/xsetwacom.c @@ -0,0 +1,100 @@ +/* + * Copyright 2009 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#define WACOM_TOOLS +#include "config.h" +#endif + +#include <stdio.h> +#include <getopt.h> + +static void usage(void) +{ + printf( + "Usage: xsetwacom [options] [command [arguments...]]\n" + "Options:\n" + " -h, --help - usage\n" + " -v, --verbose - verbose output\n" + " -V, --version - version info\n" + " -d, --display disp_name - override default display\n" + " -s, --shell - generate shell commands for 'get'\n" + " -x, --xconf - generate X.conf lines for 'get'\n"); + + printf( + "\nCommands:\n" + " list [dev|param] - display known devices, parameters \n" + " list mod - display supported modifier and specific keys for keystokes\n" + " set dev_name param [values...] - set device parameter by name\n" + " get dev_name param [param...] - get current device parameter(s) value by name\n" + " getdefault dev_name param [param...] - get device parameter(s) default value by name\n"); +} + + +static void version(void) +{ + printf("%d.%d.%d\n", PACKAGE_VERSION_MAJOR, PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_PATCHLEVEL); +} + +int main (int argc, char **argv) +{ + char c; + int optidx; + char *display = NULL; + + struct option options[] = { + {"help", 0, NULL, 0}, + {"verbose", 0, NULL, 0}, + {"version", 0, NULL, 0}, + {"display", 1, (int*)display, 0}, + {"shell", 0, NULL, 0}, + {"xconf", 0, NULL, 0} + }; + + if (argc < 2) + { + usage(); + return 1; + } + + while ((c = getopt_long(argc, argv, "hvVd:sxd", options, &optidx)) != -1) { + switch(c) + { + case 0: + switch(optidx) + { + case 0: usage(); break; + case 2: version(); break; + + } + break; + case 'V': + version(); + break; + case 'h': + default: + usage(); + return 0; + } + } + return 0; +} + + +/* vim: set noexpandtab shiftwidth=8: */ |