removed unnecessary sel stuff
authorAnselm R. Garbe <garbeam@wmii.de>
Tue, 11 Jul 2006 18:19:01 +0200
changeset 15 00d4d52b231f
parent 14 5c078b66347b
child 16 359b6e563b95
removed unnecessary sel stuff
Makefile
util.c
util.h
--- a/Makefile	Tue Jul 11 18:15:11 2006 +0200
+++ b/Makefile	Tue Jul 11 18:19:01 2006 +0200
@@ -7,12 +7,10 @@
 WMOBJ = ${WMSRC:.c=.o}
 MENSRC = menu.c draw.c util.c
 MENOBJ = ${MENSRC:.c=.o}
-SELSRC = gridsel.c util.c
-SELOBJ = ${SELSRC:.c=.o}
 MAN1 = gridwm.1 gridmenu.1
-BIN = gridwm gridmenu gridsel 
+BIN = gridwm gridmenu
 
-all: config gridwm gridmenu gridsel
+all: config gridwm gridmenu
 	@echo finished
 
 config:
@@ -36,10 +34,6 @@
 	@echo LD $@
 	@${CC} -o $@ ${WMOBJ} ${LDFLAGS}
 
-gridsel: ${SELOBJ}
-	@echo LD $@
-	@${CC} -o $@ ${SELOBJ} ${LDFLAGS}
-
 clean:
 	rm -f gridwm gridmenu *.o core
 
--- a/gridsel.c	Tue Jul 11 18:15:11 2006 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
- * See LICENSE file for license details.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <util.h>
-
-static char version[] = "gridsel - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
-
-static void
-usage()
-{
-	fprintf(stderr, "%s\n", "usage: gridsel [-v]\n");
-	exit(1);
-}
-
-int
-main(int argc, char **argv)
-{
-	unsigned char *data;
-	unsigned long i, offset, len, remain;
-
-	/* command line args */
-	if(argc > 1) {
-		if(!strncmp(argv[1], "-v", 3)) {
-			fprintf(stdout, "%s", version);
-			exit(0);
-		} else
-			usage();
-	}
-	len = offset = remain = 0;
-	do {
-		data = getselection(offset, &len, &remain);
-		for(i = 0; i < len; i++)
-			putchar(data[i]);
-		offset += len;
-		free(data);
-	}
-	while(remain);
-	if(offset)
-		putchar('\n');
-	return 0;
-}
--- a/util.c	Tue Jul 11 18:15:11 2006 +0200
+++ b/util.c	Tue Jul 11 18:19:01 2006 +0200
@@ -10,7 +10,6 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <X11/Xatom.h>
 
 #include "util.h"
 
@@ -139,40 +138,3 @@
 	}
 	wait(0);
 }
-
-
-unsigned char *
-getselection(unsigned long offset, unsigned long *len, unsigned long *remain)
-{
-	Display *dpy;
-	Atom xa_clip_string;
-	Window w;
-	XEvent ev;
-	Atom typeret;
-	int format;
-	unsigned char *data;
-	unsigned char *result = NULL;
-
-	dpy = XOpenDisplay(0);
-	if(!dpy)
-		return NULL;
-	xa_clip_string = XInternAtom(dpy, "_SEL_STRING", False);
-	w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 200, 200,
-			1, CopyFromParent, CopyFromParent);
-	XConvertSelection(dpy, XA_PRIMARY, XA_STRING, xa_clip_string,
-			w, CurrentTime);
-	XFlush(dpy);
-	XNextEvent(dpy, &ev);
-	if(ev.type == SelectionNotify && ev.xselection.property != None) {
-		XGetWindowProperty(dpy, w, ev.xselection.property, offset, 4096L, False,
-				AnyPropertyType, &typeret, &format, len, remain, &data);
-		if(*len) {
-			result = emalloc(sizeof(unsigned char) * *len);
-			memcpy(result, data, *len);
-		}
-		XDeleteProperty(dpy, w, ev.xselection.property);
-	}
-	XDestroyWindow(dpy, w);
-	XCloseDisplay(dpy);
-	return result;
-}
--- a/util.h	Tue Jul 11 18:15:11 2006 +0200
+++ b/util.h	Tue Jul 11 18:19:01 2006 +0200
@@ -18,7 +18,5 @@
 extern void pipe_spawn(char *buf, unsigned int len, Display *dpy, char *argv[]);
 extern void spawn(Display *dpy, char *argv[]);
 extern void swap(void **p1, void **p2);
-extern unsigned char *getselection(unsigned long offset, unsigned long *len,
-		unsigned long *remain);
 extern unsigned int tokenize(char **result, unsigned int reslen,
 		char *str, char delim);