aboutsummaryrefslogtreecommitdiff
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)
downloadst-patched-dbc2a3ea0fe083cccea6f58cbace82d18a51b05b.tar.bz2
st-patched-dbc2a3ea0fe083cccea6f58cbace82d18a51b05b.tar.xz
st-patched-dbc2a3ea0fe083cccea6f58cbace82d18a51b05b.zip
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 @@
32 32
33#define USAGE \ 33#define USAGE \
34 "st-" VERSION ", (c) 2010 st engineers\n" \ 34 "st-" VERSION ", (c) 2010 st engineers\n" \
35 "usage: st [-t title] [-c class] [-e cmd] [-v]\n" 35 "usage: st [-t title] [-c class] [-v] [-e cmd]\n"
36 36
37/* Arbitrary sizes */ 37/* Arbitrary sizes */
38#define ESC_TITLE_SIZ 256 38#define ESC_TITLE_SIZ 256
@@ -152,6 +152,7 @@ typedef struct {
152 int ex, ey; 152 int ex, ey;
153 struct {int x, y;} b, e; 153 struct {int x, y;} b, e;
154 char *clip; 154 char *clip;
155 Atom xtarget;
155} Selection; 156} Selection;
156 157
157#include "config.h" 158#include "config.h"
@@ -370,6 +371,9 @@ selinit(void) {
370 sel.mode = 0; 371 sel.mode = 0;
371 sel.bx = -1; 372 sel.bx = -1;
372 sel.clip = NULL; 373 sel.clip = NULL;
374 sel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0);
375 if(sel.xtarget == None)
376 sel.xtarget = XA_STRING;
373} 377}
374 378
375static inline int 379static inline int
@@ -453,7 +457,7 @@ selnotify(XEvent *e) {
453 457
454void 458void
455selpaste() { 459selpaste() {
456 XConvertSelection(xw.dpy, XA_PRIMARY, XA_STRING, XA_PRIMARY, xw.win, CurrentTime); 460 XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY, xw.win, CurrentTime);
457} 461}
458 462
459void 463void
@@ -474,7 +478,7 @@ selrequest(XEvent *e) {
474 xa_targets = XInternAtom(xw.dpy, "TARGETS", 0); 478 xa_targets = XInternAtom(xw.dpy, "TARGETS", 0);
475 if(xsre->target == xa_targets) { 479 if(xsre->target == xa_targets) {
476 /* respond with the supported type */ 480 /* respond with the supported type */
477 Atom string = XA_STRING; 481 Atom string = sel.xtarget;
478 XChangeProperty(xsre->display, xsre->requestor, xsre->property, 482 XChangeProperty(xsre->display, xsre->requestor, xsre->property,
479 XA_ATOM, 32, PropModeReplace, 483 XA_ATOM, 32, PropModeReplace,
480 (unsigned char *) &string, 1); 484 (unsigned char *) &string, 1);