[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Wed, 8 Dec 2010 09:29:24 +0000 (UTC)

changeset: 653:36cb34af62ba
parent: 651:e7af13b57348
user: "Christophe-Marie Duquesne <chm.duquesne_AT_gmail.com>"
date: Tue Dec 07 18:05:39 2010 +0100
files: tools.suckless.org/dmenu/patches/dmenu-tip-non-blocking-stdin.diff tools.suckless.org/dmenu/patches/non_blocking_stdin.md
description:
Added my patch for reading stdin and X with select()


diff -r e7af13b57348 -r 36cb34af62ba tools.suckless.org/dmenu/patches/dmenu-tip-non-blocking-stdin.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/dmenu/patches/dmenu-tip-non-blocking-stdin.diff Tue Dec 07 18:05:39 2010 +0100
_AT_@ -0,0 +1,110 @@
+diff -r 2b9683c50723 dmenu.c
+--- a/dmenu.c Wed Dec 01 20:25:10 2010 +0000
++++ b/dmenu.c Tue Dec 07 17:32:54 2010 +0100
+_AT_@ -4,6 +4,8 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <fcntl.h>
++#include <sys/select.h>
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+ #include <X11/Xutil.h>
+_AT_@ -34,6 +36,7 @@
+ static size_t nextrune(int incr);
+ static void paste(void);
+ static void readstdin(void);
++static void readXEvent(void);
+ static void run(void);
+ static void setup(void);
+ static void usage(void);
+_AT_@ -59,6 +62,7 @@
+ static Item *items = NULL;
+ static Item *matches, *sel;
+ static Item *prev, *curr, *next;
++static Item **end = &items;
+ static Window root, win;
+
+ static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
+_AT_@ -102,7 +106,6 @@
+
+ dc = initdc();
+ initfont(dc, font);
+- readstdin();
+ setup();
+ run();
+
+_AT_@ -433,9 +436,9 @@
+ void
+ readstdin(void) {
+ char buf[sizeof text], *p;
+- Item *item, **end;
++ Item *item;
+
+- for(end = &items; fgets(buf, sizeof buf, stdin); *end = item, end = &item->next) {
++ while (fgets(buf, sizeof buf, stdin)) {
+ if((p = strchr(buf, '\n')))
+ *p = '\0';
+ if(!(item = malloc(sizeof *item)))
+_AT_@ -444,14 +447,17 @@
+ eprintf("cannot strdup %u bytes\n", strlen(buf)+1);
+ item->next = item->left = item->right = NULL;
+ inputw = MAX(inputw, textw(dc, item->text));
++ *end = item;
++ end = &item->next;
+ }
++ match();
+ }
+
+ void
+-run(void) {
++readXEvent(void) {
+ XEvent ev;
+
+- while(!XNextEvent(dc->dpy, &ev))
++ while(XPending(dc->dpy) && !XNextEvent(dc->dpy, &ev))
+ switch(ev.type) {
+ case Expose:
+ if(ev.xexpose.count == 0)
+_AT_@ -472,6 +478,32 @@
+ }
+
+ void
++run(void) {
++ fd_set fds;
++ int x11_fd, n, nfds, flags;
++
++ flags = fcntl(STDIN_FILENO, F_GETFL);
++ flags |= O_NONBLOCK;
++ fcntl(STDIN_FILENO, F_SETFL, flags);
++
++ x11_fd = XConnectionNumber(dc->dpy);
++ nfds = MAX(STDIN_FILENO, x11_fd) + 1;
++ while(1) {
++ FD_ZERO(&fds);
++ if (!feof(stdin))
++ FD_SET(STDIN_FILENO, &fds);
++ FD_SET(x11_fd, &fds);
++ n = select(nfds, &fds, NULL, NULL, NULL);
++ if(n < 0)
++ eprintf("cannot select\n");
++ if (FD_ISSET(STDIN_FILENO, &fds))
++ readstdin();
++ if (FD_ISSET(x11_fd, &fds))
++ readXEvent();
++ }
++}
++
++void
+ setup(void) {
+ int x, y, screen;
+ XSetWindowAttributes wa;
+_AT_@ -531,7 +563,7 @@
+ promptw = prompt ? textw(dc, prompt) : 0;
+ XMapRaised(dc->dpy, win);
+ text[0] = '\0';
+- match();
++ drawmenu();
+ }
+
+ void
diff -r e7af13b57348 -r 36cb34af62ba tools.suckless.org/dmenu/patches/non_blocking_stdin.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/dmenu/patches/non_blocking_stdin.md Tue Dec 07 18:05:39 2010 +0100
_AT_@ -0,0 +1,20 @@
+NON BLOCKING STDIN
+==================
+
+Description
+-----------
+
+A patch to have dmenu read stdin in a non blocking way, making it wait for
+input both from stdin and from X. This way, you can continue feeding dmenu
+while you type. This patch is meant to be used along with the incremental
+patch, so that you can use stdout to feed stdin.
+
+Download
+--------
+
+* [dmenu-tip-non-blocking-stdin.diff](dmenu-tip-non-blocking-stdin.diff)
+
+Author
+------
+
+* Christophe-Marie Duquesne

changeset: 654:f5bc6f13b53b
user: "Christophe-Marie Duquesne <chm.duquesne_AT_gmail.com>"
date: Wed Dec 08 10:27:51 2010 +0100
files: tools.suckless.org/dmenu/patches/non_blocking_stdin.md
description:
Added version on which applies the patch


diff -r 36cb34af62ba -r f5bc6f13b53b tools.suckless.org/dmenu/patches/non_blocking_stdin.md
--- a/tools.suckless.org/dmenu/patches/non_blocking_stdin.md Tue Dec 07 18:05:39 2010 +0100
+++ b/tools.suckless.org/dmenu/patches/non_blocking_stdin.md Wed Dec 08 10:27:51 2010 +0100
_AT_@ -12,9 +12,12 @@
 Download
 --------
 
+This patch should apply on mercurial version 2b9683c50723 (the latest -
+2010-12-08)
+
 * [dmenu-tip-non-blocking-stdin.diff](dmenu-tip-non-blocking-stdin.diff)
 
 Author
 ------
 
-* Christophe-Marie Duquesne
+* Christophe-Marie Duquesne <chm.duquesne_AT_gmail.com>

changeset: 655:410b9370de0e
tag: tip
parent: 654:f5bc6f13b53b
parent: 652:4cfa4e57dfab
user: "Christophe-Marie Duquesne <chm.duquesne_AT_gmail.com>"
date: Wed Dec 08 10:29:17 2010 +0100
description:
merged with last version


diff -r f5bc6f13b53b -r 410b9370de0e dwm.suckless.org/patches/dwm-5.8.2-focusonclick.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/dwm-5.8.2-focusonclick.diff Wed Dec 08 10:29:17 2010 +0100
_AT_@ -0,0 +1,38 @@
+diff -r 72e52c5333ef config.def.h
+--- a/config.def.h Wed Nov 25 13:56:17 2009 +0000
++++ b/config.def.h Sun Mar 21 00:38:45 2010 +0100
+_AT_@ -12,6 +12,7 @@
+ static const unsigned int snap = 32; /* snap pixel */
+ static const Bool showbar = True; /* False means no bar */
+ static const Bool topbar = True; /* False means bottom bar */
++static const Bool focusonclick = True; /* Change focus only on click */
+
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+diff -r 72e52c5333ef dwm.c
+--- a/dwm.c Wed Nov 25 13:56:17 2009 +0000
++++ b/dwm.c Sun Mar 21 00:38:45 2010 +0100
+_AT_@ -791,14 +791,16 @@
+
+ if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
+ return;
+- if((m = wintomon(ev->window)) && m != selmon) {
+- unfocus(selmon->sel);
+- selmon = m;
++ if (!focusonclick) {
++ if((m = wintomon(ev->window)) && m != selmon) {
++ unfocus(selmon->sel, False);
++ selmon = m;
++ }
++ if((c = wintoclient(ev->window)))
++ focus(c);
++ else
++ focus(NULL);
+ }
+- if((c = wintoclient(ev->window)))
+- focus(c);
+- else
+- focus(NULL);
+ }
+
+ void
diff -r f5bc6f13b53b -r 410b9370de0e dwm.suckless.org/patches/focusonclick.md
--- a/dwm.suckless.org/patches/focusonclick.md Wed Dec 08 10:27:51 2010 +0100
+++ b/dwm.suckless.org/patches/focusonclick.md Wed Dec 08 10:29:17 2010 +0100
_AT_@ -7,8 +7,9 @@
 ## Download
 
  * [dwm-r1508-focusonclick.diff](dwm-r1508-focusonclick.diff) (dwm r1508) (20100321)
+ * [dwm-5.8.2-focusonclick.diff](dwm-5.8.2-focusonclick.diff) (dwm 2010604)
 
 ## Author
 
  * Markus P. - peters_mops at arcor . de
-
+ * Wolfgang S. - ezzieyguywuf at gmail period com
Received on Wed Dec 08 2010 - 10:29:24 CET

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:33 CEST