aewl

diff util.c @ 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
line diff
     1.1 --- a/util.c	Tue Jul 11 18:15:11 2006 +0200
     1.2 +++ b/util.c	Tue Jul 11 18:19:01 2006 +0200
     1.3 @@ -10,7 +10,6 @@
     1.4  #include <sys/types.h>
     1.5  #include <sys/wait.h>
     1.6  #include <unistd.h>
     1.7 -#include <X11/Xatom.h>
     1.8  
     1.9  #include "util.h"
    1.10  
    1.11 @@ -139,40 +138,3 @@
    1.12  	}
    1.13  	wait(0);
    1.14  }
    1.15 -
    1.16 -
    1.17 -unsigned char *
    1.18 -getselection(unsigned long offset, unsigned long *len, unsigned long *remain)
    1.19 -{
    1.20 -	Display *dpy;
    1.21 -	Atom xa_clip_string;
    1.22 -	Window w;
    1.23 -	XEvent ev;
    1.24 -	Atom typeret;
    1.25 -	int format;
    1.26 -	unsigned char *data;
    1.27 -	unsigned char *result = NULL;
    1.28 -
    1.29 -	dpy = XOpenDisplay(0);
    1.30 -	if(!dpy)
    1.31 -		return NULL;
    1.32 -	xa_clip_string = XInternAtom(dpy, "_SEL_STRING", False);
    1.33 -	w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 200, 200,
    1.34 -			1, CopyFromParent, CopyFromParent);
    1.35 -	XConvertSelection(dpy, XA_PRIMARY, XA_STRING, xa_clip_string,
    1.36 -			w, CurrentTime);
    1.37 -	XFlush(dpy);
    1.38 -	XNextEvent(dpy, &ev);
    1.39 -	if(ev.type == SelectionNotify && ev.xselection.property != None) {
    1.40 -		XGetWindowProperty(dpy, w, ev.xselection.property, offset, 4096L, False,
    1.41 -				AnyPropertyType, &typeret, &format, len, remain, &data);
    1.42 -		if(*len) {
    1.43 -			result = emalloc(sizeof(unsigned char) * *len);
    1.44 -			memcpy(result, data, *len);
    1.45 -		}
    1.46 -		XDeleteProperty(dpy, w, ev.xselection.property);
    1.47 -	}
    1.48 -	XDestroyWindow(dpy, w);
    1.49 -	XCloseDisplay(dpy);
    1.50 -	return result;
    1.51 -}