add support for utf8 clipboard. fix usage message.
This commit is contained in:
parent
a047431d34
commit
674434ef6f
10
st.c
10
st.c
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#define USAGE \
|
#define USAGE \
|
||||||
"st-" VERSION ", (c) 2010 st engineers\n" \
|
"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 */
|
/* Arbitrary sizes */
|
||||||
#define ESC_TITLE_SIZ 256
|
#define ESC_TITLE_SIZ 256
|
||||||
|
@ -152,6 +152,7 @@ typedef struct {
|
||||||
int ex, ey;
|
int ex, ey;
|
||||||
struct {int x, y;} b, e;
|
struct {int x, y;} b, e;
|
||||||
char *clip;
|
char *clip;
|
||||||
|
Atom xtarget;
|
||||||
} Selection;
|
} Selection;
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -370,6 +371,9 @@ selinit(void) {
|
||||||
sel.mode = 0;
|
sel.mode = 0;
|
||||||
sel.bx = -1;
|
sel.bx = -1;
|
||||||
sel.clip = NULL;
|
sel.clip = NULL;
|
||||||
|
sel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0);
|
||||||
|
if(sel.xtarget == None)
|
||||||
|
sel.xtarget = XA_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -453,7 +457,7 @@ selnotify(XEvent *e) {
|
||||||
|
|
||||||
void
|
void
|
||||||
selpaste() {
|
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
|
void
|
||||||
|
@ -474,7 +478,7 @@ selrequest(XEvent *e) {
|
||||||
xa_targets = XInternAtom(xw.dpy, "TARGETS", 0);
|
xa_targets = XInternAtom(xw.dpy, "TARGETS", 0);
|
||||||
if(xsre->target == xa_targets) {
|
if(xsre->target == xa_targets) {
|
||||||
/* respond with the supported type */
|
/* respond with the supported type */
|
||||||
Atom string = XA_STRING;
|
Atom string = sel.xtarget;
|
||||||
XChangeProperty(xsre->display, xsre->requestor, xsre->property,
|
XChangeProperty(xsre->display, xsre->requestor, xsre->property,
|
||||||
XA_ATOM, 32, PropModeReplace,
|
XA_ATOM, 32, PropModeReplace,
|
||||||
(unsigned char *) &string, 1);
|
(unsigned char *) &string, 1);
|
||||||
|
|
Loading…
Reference in New Issue