aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2010-08-31 16:53:34 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2010-08-31 16:53:34 +0200
commitc4225bdcc9da2eb87e49608cc1821757cbd69dee (patch)
tree9659d25849248cba5b760d6a9a81f49edce1e840
parentf211bc2eedaa8ea86dc66ad04ccd08938c73a93c (diff)
downloadst-c4225bdcc9da2eb87e49608cc1821757cbd69dee.tar.gz
add selinit() and renamed clipboard_* to sel*.
-rw-r--r--st.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/st.c b/st.c
index 1497dd2..67ba8d5 100644
--- a/st.c
+++ b/st.c
@@ -185,9 +185,9 @@ static char* kmap(KeySym);
static void kpress(XEvent *);
static void resize(XEvent *);
static void focus(XEvent *);
-static void brelease(XEvent *e);
-static void bpress(XEvent *e);
-static void bmotion(XEvent *e);
+static void brelease(XEvent *);
+static void bpress(XEvent *);
+static void bmotion(XEvent *);
static void (*handler[LASTEvent])(XEvent *) = {
@@ -210,6 +210,13 @@ static int cmdfd;
static pid_t pid;
static Selection sel;
+void
+selinit(void) {
+ sel.mode = 0;
+ sel.bx = -1;
+ sel.clip = NULL;
+}
+
static inline int selected(int x, int y) {
if ((sel.ey==y && sel.by==y)) {
int bx = MIN(sel.bx, sel.ex);
@@ -261,12 +268,12 @@ static char *getseltext() {
}
/* TODO: use X11 clipboard */
-static void clipboard_copy(char *str) {
+static void selcopy(char *str) {
free(sel.clip);
sel.clip = str;
}
-static void clipboard_paste() {
+static void selpaste() {
if(sel.clip)
ttywrite(sel.clip, strlen(sel.clip));
}
@@ -1471,6 +1478,7 @@ main(int argc, char *argv[]) {
tnew(80, 24);
ttynew();
xinit();
+ selinit();
run();
return 0;
}