aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2010-08-31 16:30:11 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2010-08-31 16:30:11 +0200
commitf211bc2eedaa8ea86dc66ad04ccd08938c73a93c (patch)
treecdcd54ff608220c4690d4f8fbd8326b3eb9eafbf /st.c
parentee858b4805aec3e12bff48cf27433ebcd3f6ac34 (diff)
downloadst-f211bc2eedaa8ea86dc66ad04ccd08938c73a93c.tar.gz
st-f211bc2eedaa8ea86dc66ad04ccd08938c73a93c.zip
move event configuration in xinit().
Diffstat (limited to 'st.c')
-rw-r--r--st.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/st.c b/st.c
index 4a89876..1497dd2 100644
--- a/st.c
+++ b/st.c
@@ -210,8 +210,6 @@ static int cmdfd;
210static pid_t pid; 210static pid_t pid;
211static Selection sel; 211static Selection sel;
212 212
213/* TODO: use X11 clipboard */
214
215static inline int selected(int x, int y) { 213static inline int selected(int x, int y) {
216 if ((sel.ey==y && sel.by==y)) { 214 if ((sel.ey==y && sel.by==y)) {
217 int bx = MIN(sel.bx, sel.ex); 215 int bx = MIN(sel.bx, sel.ex);
@@ -262,6 +260,7 @@ static char *getseltext() {
262 return str; 260 return str;
263} 261}
264 262
263/* TODO: use X11 clipboard */
265static void clipboard_copy(char *str) { 264static void clipboard_copy(char *str) {
266 free(sel.clip); 265 free(sel.clip);
267 sel.clip = str; 266 sel.clip = str;
@@ -272,7 +271,7 @@ static void clipboard_paste() {
272 ttywrite(sel.clip, strlen(sel.clip)); 271 ttywrite(sel.clip, strlen(sel.clip));
273} 272}
274 273
275// TODO: doubleclick to select word 274/* TODO: doubleclick to select word */
276static void brelease(XEvent *e) { 275static void brelease(XEvent *e) {
277 int b; 276 int b;
278 sel.mode = 0; 277 sel.mode = 0;
@@ -1214,9 +1213,14 @@ xinit(void) {
1214 xw.bufw = xw.w - 2*BORDER; 1213 xw.bufw = xw.w - 2*BORDER;
1215 xw.bufh = xw.h - 2*BORDER; 1214 xw.bufh = xw.h - 2*BORDER;
1216 xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); 1215 xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
1217 xw.hasfocus = 1;
1218 /* gc */ 1216 /* gc */
1219 dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); 1217 dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
1218
1219 /* event mask */
1220 XSelectInput(xw.dis, xw.win, ExposureMask | KeyPressMask
1221 | StructureNotifyMask | FocusChangeMask | PointerMotionMask
1222 | ButtonPressMask | ButtonReleaseMask);
1223
1220 XMapWindow(xw.dis, xw.win); 1224 XMapWindow(xw.dis, xw.win);
1221 xhints(); 1225 xhints();
1222 XStoreName(xw.dis, xw.win, "st"); 1226 XStoreName(xw.dis, xw.win, "st");
@@ -1435,12 +1439,6 @@ run(void) {
1435 XEvent ev; 1439 XEvent ev;
1436 fd_set rfd; 1440 fd_set rfd;
1437 int xfd = XConnectionNumber(xw.dis); 1441 int xfd = XConnectionNumber(xw.dis);
1438 long mask = ExposureMask | KeyPressMask | StructureNotifyMask
1439 | FocusChangeMask | PointerMotionMask | ButtonPressMask
1440 | ButtonReleaseMask;
1441
1442 XSelectInput(xw.dis, xw.win, mask);
1443 XResizeWindow(xw.dis, xw.win, xw.w, xw.h); /* XXX: fix resize bug in wmii (?) */
1444 1442
1445 for(;;) { 1443 for(;;) {
1446 FD_ZERO(&rfd); 1444 FD_ZERO(&rfd);