dwm-meillo

changeset 15:00d4d52b231f

removed unnecessary sel stuff
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 18:19:01 +0200
parents 5c078b66347b
children 359b6e563b95
files Makefile util.c util.h
diffstat 4 files changed, 2 insertions(+), 95 deletions(-) [+]
line diff
     1.1 --- a/Makefile	Tue Jul 11 18:15:11 2006 +0200
     1.2 +++ b/Makefile	Tue Jul 11 18:19:01 2006 +0200
     1.3 @@ -7,12 +7,10 @@
     1.4  WMOBJ = ${WMSRC:.c=.o}
     1.5  MENSRC = menu.c draw.c util.c
     1.6  MENOBJ = ${MENSRC:.c=.o}
     1.7 -SELSRC = gridsel.c util.c
     1.8 -SELOBJ = ${SELSRC:.c=.o}
     1.9  MAN1 = gridwm.1 gridmenu.1
    1.10 -BIN = gridwm gridmenu gridsel 
    1.11 +BIN = gridwm gridmenu
    1.12  
    1.13 -all: config gridwm gridmenu gridsel
    1.14 +all: config gridwm gridmenu
    1.15  	@echo finished
    1.16  
    1.17  config:
    1.18 @@ -36,10 +34,6 @@
    1.19  	@echo LD $@
    1.20  	@${CC} -o $@ ${WMOBJ} ${LDFLAGS}
    1.21  
    1.22 -gridsel: ${SELOBJ}
    1.23 -	@echo LD $@
    1.24 -	@${CC} -o $@ ${SELOBJ} ${LDFLAGS}
    1.25 -
    1.26  clean:
    1.27  	rm -f gridwm gridmenu *.o core
    1.28  
     2.1 --- a/gridsel.c	Tue Jul 11 18:15:11 2006 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,47 +0,0 @@
     2.4 -/*
     2.5 - * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
     2.6 - * See LICENSE file for license details.
     2.7 - */
     2.8 -
     2.9 -#include <stdlib.h>
    2.10 -#include <stdio.h>
    2.11 -#include <string.h>
    2.12 -
    2.13 -#include <util.h>
    2.14 -
    2.15 -static char version[] = "gridsel - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
    2.16 -
    2.17 -static void
    2.18 -usage()
    2.19 -{
    2.20 -	fprintf(stderr, "%s\n", "usage: gridsel [-v]\n");
    2.21 -	exit(1);
    2.22 -}
    2.23 -
    2.24 -int
    2.25 -main(int argc, char **argv)
    2.26 -{
    2.27 -	unsigned char *data;
    2.28 -	unsigned long i, offset, len, remain;
    2.29 -
    2.30 -	/* command line args */
    2.31 -	if(argc > 1) {
    2.32 -		if(!strncmp(argv[1], "-v", 3)) {
    2.33 -			fprintf(stdout, "%s", version);
    2.34 -			exit(0);
    2.35 -		} else
    2.36 -			usage();
    2.37 -	}
    2.38 -	len = offset = remain = 0;
    2.39 -	do {
    2.40 -		data = getselection(offset, &len, &remain);
    2.41 -		for(i = 0; i < len; i++)
    2.42 -			putchar(data[i]);
    2.43 -		offset += len;
    2.44 -		free(data);
    2.45 -	}
    2.46 -	while(remain);
    2.47 -	if(offset)
    2.48 -		putchar('\n');
    2.49 -	return 0;
    2.50 -}
     3.1 --- a/util.c	Tue Jul 11 18:15:11 2006 +0200
     3.2 +++ b/util.c	Tue Jul 11 18:19:01 2006 +0200
     3.3 @@ -10,7 +10,6 @@
     3.4  #include <sys/types.h>
     3.5  #include <sys/wait.h>
     3.6  #include <unistd.h>
     3.7 -#include <X11/Xatom.h>
     3.8  
     3.9  #include "util.h"
    3.10  
    3.11 @@ -139,40 +138,3 @@
    3.12  	}
    3.13  	wait(0);
    3.14  }
    3.15 -
    3.16 -
    3.17 -unsigned char *
    3.18 -getselection(unsigned long offset, unsigned long *len, unsigned long *remain)
    3.19 -{
    3.20 -	Display *dpy;
    3.21 -	Atom xa_clip_string;
    3.22 -	Window w;
    3.23 -	XEvent ev;
    3.24 -	Atom typeret;
    3.25 -	int format;
    3.26 -	unsigned char *data;
    3.27 -	unsigned char *result = NULL;
    3.28 -
    3.29 -	dpy = XOpenDisplay(0);
    3.30 -	if(!dpy)
    3.31 -		return NULL;
    3.32 -	xa_clip_string = XInternAtom(dpy, "_SEL_STRING", False);
    3.33 -	w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 200, 200,
    3.34 -			1, CopyFromParent, CopyFromParent);
    3.35 -	XConvertSelection(dpy, XA_PRIMARY, XA_STRING, xa_clip_string,
    3.36 -			w, CurrentTime);
    3.37 -	XFlush(dpy);
    3.38 -	XNextEvent(dpy, &ev);
    3.39 -	if(ev.type == SelectionNotify && ev.xselection.property != None) {
    3.40 -		XGetWindowProperty(dpy, w, ev.xselection.property, offset, 4096L, False,
    3.41 -				AnyPropertyType, &typeret, &format, len, remain, &data);
    3.42 -		if(*len) {
    3.43 -			result = emalloc(sizeof(unsigned char) * *len);
    3.44 -			memcpy(result, data, *len);
    3.45 -		}
    3.46 -		XDeleteProperty(dpy, w, ev.xselection.property);
    3.47 -	}
    3.48 -	XDestroyWindow(dpy, w);
    3.49 -	XCloseDisplay(dpy);
    3.50 -	return result;
    3.51 -}
     4.1 --- a/util.h	Tue Jul 11 18:15:11 2006 +0200
     4.2 +++ b/util.h	Tue Jul 11 18:19:01 2006 +0200
     4.3 @@ -18,7 +18,5 @@
     4.4  extern void pipe_spawn(char *buf, unsigned int len, Display *dpy, char *argv[]);
     4.5  extern void spawn(Display *dpy, char *argv[]);
     4.6  extern void swap(void **p1, void **p2);
     4.7 -extern unsigned char *getselection(unsigned long offset, unsigned long *len,
     4.8 -		unsigned long *remain);
     4.9  extern unsigned int tokenize(char **result, unsigned int reslen,
    4.10  		char *str, char delim);