initial commit - swarp - simple pointer warp for X
 (HTM) git clone git://git.suckless.org/swarp
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit f2f86a484a0e2dfa5a33ff83ba55bb0c7dd55a72
 (HTM) Author: arg@suckless.org <unknown>
       Date:   Tue, 10 Oct 2006 09:08:48 +0200
       
       initial commit
       
       Diffstat:
         A LICENSE                             |      22 ++++++++++++++++++++++
         A Makefile                            |      51 +++++++++++++++++++++++++++++++
         A README                              |      24 ++++++++++++++++++++++++
         A config.mk                           |      25 +++++++++++++++++++++++++
         A swarp.c                             |      35 +++++++++++++++++++++++++++++++
       
       5 files changed, 157 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/LICENSE b/LICENSE
       @@ -0,0 +1,22 @@
       +MIT/X Consortium License
       +
       +(C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
       +(C)opyright MMVI Sander van Dijk <a dot h dot vandijk at gmail dot com>
       +
       +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
       +the rights to use, copy, modify, merge, publish, distribute, sublicense,
       +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 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 NONINFRINGEMENT.  IN NO EVENT SHALL 
       +THE AUTHORS OR COPYRIGHT HOLDERS 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.
 (DIR) diff --git a/Makefile b/Makefile
       @@ -0,0 +1,51 @@
       +# swarp - simple pointer warp
       +#   (C)opyright MMVI Anselm R. Garbe
       +
       +include config.mk
       +
       +SRC = swarp.c
       +OBJ = ${SRC:.c=.o}
       +
       +all: options swarp
       +
       +options:
       +        @echo swarp build options:
       +        @echo "CFLAGS   = ${CFLAGS}"
       +        @echo "LDFLAGS  = ${LDFLAGS}"
       +        @echo "CC       = ${CC}"
       +        @echo "LD       = ${LD}"
       +
       +.c.o:
       +        @echo CC $<
       +        @${CC} -c ${CFLAGS} $<
       +
       +${OBJ}: config.mk
       +
       +swarp: ${OBJ}
       +        @echo LD $@
       +        @${LD} -o $@ ${OBJ} ${LDFLAGS}
       +        @strip $@
       +
       +clean:
       +        @echo cleaning
       +        @rm -f swarp ${OBJ} swarp-${VERSION}.tar.gz
       +
       +dist: clean
       +        @echo creating dist tarball
       +        @mkdir -p swarp-${VERSION}
       +        @cp -R LICENSE Makefile README config.mk ${SRC} swarp-${VERSION}
       +        @tar -cf swarp-${VERSION}.tar swarp-${VERSION}
       +        @gzip swarp-${VERSION}.tar
       +        @rm -rf swarp-${VERSION}
       +
       +install: all
       +        @echo installing executable file to ${DESTDIR}${PREFIX}/bin
       +        @mkdir -p ${DESTDIR}${PREFIX}/bin
       +        @cp -f swarp ${DESTDIR}${PREFIX}/bin
       +        @chmod 755 ${DESTDIR}${PREFIX}/bin/swarp
       +
       +uninstall:
       +        @echo removing executable file from ${DESTDIR}${PREFIX}/bin
       +        @rm -f ${DESTDIR}${PREFIX}/bin/swarp
       +
       +.PHONY: all options clean dist install uninstall
 (DIR) diff --git a/README b/README
       @@ -0,0 +1,24 @@
       +swarp - simple pointer warp
       +===========================
       +simple pointer warp is a generic pointer warping utility for X. 
       +
       +
       +Requirements
       +------------
       +In order to build swarp you need the Xlib header files.
       +
       +
       +Installation
       +------------
       +Edit config.mk to match your local setup (swarp is installed into
       +the /usr/local namespace by default).
       +
       +Afterwards enter the following command to build and install swarp (if
       +necessary as root):
       +
       +    make clean install
       +
       +
       +Running swarp
       +-------------
       +Simply invoke the 'swarp' command with the required arguments.
 (DIR) diff --git a/config.mk b/config.mk
       @@ -0,0 +1,25 @@
       +# swarp version
       +VERSION = 0.1
       +
       +# Customize below to fit your system
       +
       +# paths
       +PREFIX = /usr/local
       +MANPREFIX = ${PREFIX}/share/man
       +
       +X11INC = /usr/X11R6/include
       +X11LIB = /usr/X11R6/lib
       +
       +# includes and libs
       +INCS = -I. -I/usr/include -I${X11INC}
       +LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
       +
       +# flags
       +CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
       +LDFLAGS = ${LIBS}
       +#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
       +#LDFLAGS = -g ${LIBS}
       +
       +# compiler and linker
       +CC = cc
       +LD = ${CC}
 (DIR) diff --git a/swarp.c b/swarp.c
       @@ -0,0 +1,35 @@
       +/* (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com>
       + * See LICENSE file for license details.
       + */
       +
       +#include <stdlib.h>
       +#include <stdio.h>
       +#include <string.h>
       +#include <errno.h>
       +#include <X11/Xlib.h>
       +
       +int
       +main(int argc, char **argv) {
       +        int x, y;
       +        Display *dpy;
       +
       +        if((argc == 2) && !strncmp(argv[1], "-v", 3)) {
       +                fputs("swarp-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
       +                exit(EXIT_SUCCESS);
       +        }
       +        if(argc != 3)
       +                goto Usage;
       +        if(!(dpy = XOpenDisplay(0))) {
       +                fputs("swarp: cannot open display\n", stderr);
       +                exit(1);
       +        }
       +        if((sscanf(argv[1], "%d", &x) != 1) || (sscanf(argv[2], "%d", &y) != 1)) {
       +Usage:
       +                fputs("usage: swarp <x> <y> [-v]\n", stderr);
       +                exit(EXIT_FAILURE);
       +        }
       +        XWarpPointer(dpy, None, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, 0, 0, x, y);
       +        XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
       +        XCloseDisplay(dpy);
       +        return 0;
       +}