[hackers] [st] add support for utf8 clipboard. fix usage message. || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Sat, 2 Apr 2011 22:35:07 +0000 (UTC)

changeset: 183:cbc18c988236
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Sun Apr 03 00:35:02 2011 +0200
files: st.c
description:
add support for utf8 clipboard. fix usage message.

diff -r 054fe4c29819 -r cbc18c988236 st.c
--- a/st.c Fri Apr 01 09:35:38 2011 +0200
+++ b/st.c Sun Apr 03 00:35:02 2011 +0200
@@ -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 @@
         int ex, ey;
         struct {int x, y;} b, e;
         char *clip;
+ Atom xtarget;
 } Selection;
 
 #include "config.h"
@@ -370,6 +371,9 @@
         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 @@
 
 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 @@
         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);
Received on Sun Apr 03 2011 - 00:35:07 CEST

This archive was generated by hypermail 2.2.0 : Sun Apr 03 2011 - 00:36:04 CEST