summaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-11 18:19:01 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-11 18:19:01 +0200
commitb1669b5c48f71c9a7a919dbf09a1af527c62f69a (patch)
treef94f1018357afe5abef9cde46a80d16a9676010f /util.c
parentadded bar event timer (diff)
downloaddwm-b1669b5c48f71c9a7a919dbf09a1af527c62f69a.tar.gz
dwm-b1669b5c48f71c9a7a919dbf09a1af527c62f69a.zip
removed unnecessary sel stuff
Diffstat (limited to '')
-rw-r--r--util.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/util.c b/util.c
index 2cc2d4d..76ba5ab 100644
--- a/util.c
+++ b/util.c
@@ -10,7 +10,6 @@
10#include <sys/types.h> 10#include <sys/types.h>
11#include <sys/wait.h> 11#include <sys/wait.h>
12#include <unistd.h> 12#include <unistd.h>
13#include <X11/Xatom.h>
14 13
15#include "util.h" 14#include "util.h"
16 15
@@ -139,40 +138,3 @@ pipe_spawn(char *buf, unsigned int len, Display *dpy, char *argv[])
139 } 138 }
140 wait(0); 139 wait(0);
141} 140}
142
143
144unsigned char *
145getselection(unsigned long offset, unsigned long *len, unsigned long *remain)
146{
147 Display *dpy;
148 Atom xa_clip_string;
149 Window w;
150 XEvent ev;
151 Atom typeret;
152 int format;
153 unsigned char *data;
154 unsigned char *result = NULL;
155
156 dpy = XOpenDisplay(0);
157 if(!dpy)
158 return NULL;
159 xa_clip_string = XInternAtom(dpy, "_SEL_STRING", False);
160 w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 200, 200,
161 1, CopyFromParent, CopyFromParent);
162 XConvertSelection(dpy, XA_PRIMARY, XA_STRING, xa_clip_string,
163 w, CurrentTime);
164 XFlush(dpy);
165 XNextEvent(dpy, &ev);
166 if(ev.type == SelectionNotify && ev.xselection.property != None) {
167 XGetWindowProperty(dpy, w, ev.xselection.property, offset, 4096L, False,
168 AnyPropertyType, &typeret, &format, len, remain, &data);
169 if(*len) {
170 result = emalloc(sizeof(unsigned char) * *len);
171 memcpy(result, data, *len);
172 }
173 XDeleteProperty(dpy, w, ev.xselection.property);
174 }
175 XDestroyWindow(dpy, w);
176 XCloseDisplay(dpy);
177 return result;
178}