[hackers] [st] move event configuration in xinit(). || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Tue, 31 Aug 2010 14:30:16 +0000 (UTC)

changeset: 121:637e885dd068
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Tue Aug 31 16:30:11 2010 +0200
files: st.c
description:
move event configuration in xinit().

diff -r 6267c4e7f30b -r 637e885dd068 st.c
--- a/st.c Tue Aug 31 15:36:13 2010 +0200
+++ b/st.c Tue Aug 31 16:30:11 2010 +0200
@@ -210,8 +210,6 @@
 static pid_t pid;
 static Selection sel;
 
-/* TODO: use X11 clipboard */
-
 static inline int selected(int x, int y) {
         if ((sel.ey==y && sel.by==y)) {
                 int bx = MIN(sel.bx, sel.ex);
@@ -262,6 +260,7 @@
         return str;
 }
 
+/* TODO: use X11 clipboard */
 static void clipboard_copy(char *str) {
         free(sel.clip);
         sel.clip = str;
@@ -272,7 +271,7 @@
                 ttywrite(sel.clip, strlen(sel.clip));
 }
 
-// TODO: doubleclick to select word
+/* TODO: doubleclick to select word */
 static void brelease(XEvent *e) {
         int b;
         sel.mode = 0;
@@ -1214,9 +1213,14 @@
         xw.bufw = xw.w - 2*BORDER;
         xw.bufh = xw.h - 2*BORDER;
         xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
- xw.hasfocus = 1;
         /* gc */
         dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
+
+ /* event mask */
+ XSelectInput(xw.dis, xw.win, ExposureMask | KeyPressMask
+ | StructureNotifyMask | FocusChangeMask | PointerMotionMask
+ | ButtonPressMask | ButtonReleaseMask);
+
         XMapWindow(xw.dis, xw.win);
         xhints();
         XStoreName(xw.dis, xw.win, "st");
@@ -1435,12 +1439,6 @@
         XEvent ev;
         fd_set rfd;
         int xfd = XConnectionNumber(xw.dis);
- long mask = ExposureMask | KeyPressMask | StructureNotifyMask
- | FocusChangeMask | PointerMotionMask | ButtonPressMask
- | ButtonReleaseMask;
-
- XSelectInput(xw.dis, xw.win, mask);
- XResizeWindow(xw.dis, xw.win, xw.w, xw.h); /* XXX: fix resize bug in wmii (?) */
 
         for(;;) {
                 FD_ZERO(&rfd);
Received on Tue Aug 31 2010 - 16:30:16 CEST

This archive was generated by hypermail 2.2.0 : Tue Aug 31 2010 - 16:36:04 CEST