Re: [dwm] off the topic, let sselp support multibyte charactors?

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Thu, 17 Apr 2008 14:10:03 +0200

I consider this going upstream.

Kind regards,
     Anselm

On Thu, Apr 17, 2008 at 09:17:12AM +0400, Alexander Polakov wrote:
> * anhnmncb <anhnmncb_AT_sina.com> [080417 08:05]:
> > Refer to http://www.suckless.org/wiki/tools/xlib, sselp is a xclip
> > like app, it's more simple and less dependencies, I like it very
> > much, but I find it doesn't support multibyte charactors, can
> > developers let sselp support it?
>
> try the attached patch, works fine for me.
> --
> Alexander Polakov

> diff -ur sselp-0.1/sselp.c sselp-0.1h/sselp.c
> --- sselp-0.1/sselp.c 2006-10-13 13:11:28.000000000 +0400
> +++ sselp-0.1h/sselp.c 2008-04-17 09:14:02.000000000 +0400
> @@ -23,7 +23,8 @@
>
> static unsigned char *
> getselection(unsigned long offset, unsigned long *len, unsigned long *remain) {
> - Display *dpy;
> + Display *dpy;
> + Atom utf8_string;
> Atom xa_clip_string;
> Window w;
> XEvent ev;
> @@ -36,9 +37,10 @@
> if(!dpy)
> return NULL;
> xa_clip_string = XInternAtom(dpy, "BLITZ_SEL_STRING", False);
> + utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
> w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 10, 10, 200, 200,
> 1, CopyFromParent, CopyFromParent);
> - XConvertSelection(dpy, XA_PRIMARY, XA_STRING, xa_clip_string,
> + XConvertSelection(dpy, XA_PRIMARY, utf8_string, xa_clip_string,
> w, CurrentTime);
> XFlush(dpy);
> XNextEvent(dpy, &ev);

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Thu Apr 17 2008 - 14:10:03 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:34:02 UTC