[hackers] [dmenu] replaced promptw || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Mon, 2 Aug 2010 13:49:19 +0000 (UTC)

changeset: 345:48f4db043a10
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Mon Aug 02 14:49:14 2010 +0100
files: Makefile dmenu.c
description:
replaced promptw

diff -r a527f3516a8d -r 48f4db043a10 Makefile
--- a/Makefile Mon Aug 02 14:22:54 2010 +0100
+++ b/Makefile Mon Aug 02 14:49:14 2010 +0100
@@ -26,7 +26,7 @@
 dist: clean
         @echo creating dist tarball
         @mkdir -p dmenu-${VERSION}
- @cp -R LICENSE Makefile README config.mk dmenu.1 dmenu.c dmenu_path dmenu_run dmenu-${VERSION}
+ @cp LICENSE Makefile README config.mk dmenu.1 dmenu.c dmenu_path dmenu_run dmenu-${VERSION}
         @tar -cf dmenu-${VERSION}.tar dmenu-${VERSION}
         @gzip dmenu-${VERSION}.tar
         @rm -rf dmenu-${VERSION}
diff -r a527f3516a8d -r 48f4db043a10 dmenu.c
--- a/dmenu.c Mon Aug 02 14:22:54 2010 +0100
+++ b/dmenu.c Mon Aug 02 14:49:14 2010 +0100
@@ -42,6 +42,7 @@
 static void usage(void);
 
 static char text[4096];
+static int promptw;
 static size_t cursor = 0;
 static const char *prompt = NULL;
 static const char *normbgcolor = "#cccccc";
@@ -79,7 +80,7 @@
 calcoffsetsh(void) {
         unsigned int w, x;
 
- w = (prompt ? textw(dc, prompt) : 0) + inputw + textw(dc, "<") + textw(dc, ">");
+ w = promptw + inputw + textw(dc, "<") + textw(dc, ">");
         for(x = w, next = curr; next; next = next->right)
                 if((x += MIN(textw(dc, next->text), mw / 3)) > mw)
                         break;
@@ -118,7 +119,7 @@
         dc->y = topbar ? 0 : mh - dc->h;
         /* print prompt? */
         if(prompt) {
- dc->w = textw(dc, prompt);
+ dc->w = promptw;
                 drawtext(dc, prompt, selcol);
                 dc->x = dc->w;
         }
@@ -506,7 +507,9 @@
         grabkeyboard();
         setcanvas(dc, win, mw, mh);
         inputw = MIN(inputw, mw/3);
+ promptw = prompt ? MIN(textw(dc, prompt), mw/5) : 0;
         XMapRaised(dc->dpy, win);
+ text[0] = '\0';
         match();
 }
 
Received on Mon Aug 02 2010 - 15:49:19 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 02 2010 - 16:00:07 CEST