tadd support for utf8 clipboard. fix usage message. - st - [fork] customized bu… | |
git clone git://src.adamsgaard.dk/st | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 674434ef6f75247fb25d8e5b39786bca9a0cabec | |
parent a047431d34aa77ac7a8fab08151fb569bbe2148e | |
Author: Aurélien Aptel <[email protected]> | |
Date: Sun, 3 Apr 2011 00:35:02 +0200 | |
add support for utf8 clipboard. fix usage message. | |
Diffstat: | |
M st.c | 10 +++++++--- | |
1 file changed, 7 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/st.c b/st.c | |
t@@ -32,7 +32,7 @@ | |
#define USAGE \ | |
"st-" VERSION ", (c) 2010 st engineers\n" \ | |
- "usage: st [-t title] [-c class] [-e cmd] [-v]\n" | |
+ "usage: st [-t title] [-c class] [-v] [-e cmd]\n" | |
/* Arbitrary sizes */ | |
#define ESC_TITLE_SIZ 256 | |
t@@ -152,6 +152,7 @@ typedef struct { | |
int ex, ey; | |
struct {int x, y;} b, e; | |
char *clip; | |
+ Atom xtarget; | |
} Selection; | |
#include "config.h" | |
t@@ -370,6 +371,9 @@ selinit(void) { | |
sel.mode = 0; | |
sel.bx = -1; | |
sel.clip = NULL; | |
+ sel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0); | |
+ if(sel.xtarget == None) | |
+ sel.xtarget = XA_STRING; | |
} | |
static inline int | |
t@@ -453,7 +457,7 @@ selnotify(XEvent *e) { | |
void | |
selpaste() { | |
- XConvertSelection(xw.dpy, XA_PRIMARY, XA_STRING, XA_PRIMARY, xw.win, C… | |
+ XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY, xw.win,… | |
} | |
void | |
t@@ -474,7 +478,7 @@ selrequest(XEvent *e) { | |
xa_targets = XInternAtom(xw.dpy, "TARGETS", 0); | |
if(xsre->target == xa_targets) { | |
/* respond with the supported type */ | |
- Atom string = XA_STRING; | |
+ Atom string = sel.xtarget; | |
XChangeProperty(xsre->display, xsre->requestor, xsre->property, | |
XA_ATOM, 32, PropModeReplace, | |
(unsigned char *) &string, 1); |