summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2011-04-03 00:35:02 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2011-04-03 00:35:02 +0200
commitdbc2a3ea0fe083cccea6f58cbace82d18a51b05b (patch)
treee411a8784f99b2064ea632f79a69b30d967480bc
parentff97be88d59fb4a5c00b9f1db2e64fb15396d77d (diff)
add support for utf8 clipboard. fix usage message.0.1
-rw-r--r--st.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/st.c b/st.c
index 561d5b0..ed750e6 100644
--- a/st.c
+++ b/st.c
@@ -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
@@ -152,6 +152,7 @@ typedef struct {
int ex, ey;
struct {int x, y;} b, e;
char *clip;
+ Atom xtarget;
} Selection;
#include "config.h"
@@ -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
@@ -453,7 +457,7 @@ selnotify(XEvent *e) {
void
selpaste() {
- XConvertSelection(xw.dpy, XA_PRIMARY, XA_STRING, XA_PRIMARY, xw.win, CurrentTime);
+ XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY, xw.win, CurrentTime);
}
void
@@ -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);