changeset: 122:de86ffc4e88f
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Tue Aug 31 16:53:34 2010 +0200
files: st.c
description:
add selinit() and renamed clipboard_* to sel*.
diff -r 637e885dd068 -r de86ffc4e88f st.c
--- a/st.c Tue Aug 31 16:30:11 2010 +0200
+++ b/st.c Tue Aug 31 16:53:34 2010 +0200
@@ -185,9 +185,9 @@
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 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 @@
}
/* 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 @@
tnew(80, 24);
ttynew();
xinit();
+ selinit();
run();
return 0;
}
Received on Tue Aug 31 2010 - 16:53:40 CEST
This archive was generated by hypermail 2.2.0 : Tue Aug 31 2010 - 17:00:07 CEST