[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Thu, 16 Dec 2010 20:51:10 +0000 (UTC)

changeset: 663:09e156549351
tag: tip
user: Alexey Khudyakov <alexey.skladnoy_AT_gmail.com>
date: Thu Dec 16 23:51:23 2010 +0300
files: tools.suckless.org/dmenu/patches/xrdb.diff tools.suckless.org/dmenu/patches/xrdb.md
description:
Patch for readgin settings from X resource database


diff -r 075947ceaaca -r 09e156549351 tools.suckless.org/dmenu/patches/xrdb.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/dmenu/patches/xrdb.diff Thu Dec 16 23:51:23 2010 +0300
_AT_@ -0,0 +1,85 @@
+diff -r 2b9683c50723 -r ebcc0d8213e0 dmenu.c
+--- a/dmenu.c Wed Dec 01 20:25:10 2010 +0000
++++ b/dmenu.c Tue Dec 14 15:53:44 2010 +0300
+_AT_@ -7,6 +7,7 @@
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+ #include <X11/Xutil.h>
++#include <X11/Xresource.h>
+ #ifdef XINERAMA
+ #include <X11/extensions/Xinerama.h>
+ #endif
+_AT_@ -37,6 +38,7 @@
+ static void run(void);
+ static void setup(void);
+ static void usage(void);
++static void read_resourses(void);
+
+ static char text[BUFSIZ];
+ static int bh, mw, mh;
+_AT_@ -47,10 +49,10 @@
+ static size_t cursor = 0;
+ static const char *font = NULL;
+ static const char *prompt = NULL;
+-static const char *normbgcolor = "#cccccc";
+-static const char *normfgcolor = "#000000";
+-static const char *selbgcolor = "#0066ff";
+-static const char *selfgcolor = "#ffffff";
++static const char *normbgcolor = NULL;
++static const char *normfgcolor = NULL;
++static const char *selbgcolor = NULL;
++static const char *selfgcolor = NULL;
+ static unsigned long normcol[ColLast];
+ static unsigned long selcol[ColLast];
+ static Atom utf8;
+_AT_@ -101,6 +103,7 @@
+ usage();
+
+ dc = initdc();
++ read_resourses();
+ initfont(dc, font);
+ readstdin();
+ setup();
+_AT_@ -109,6 +112,42 @@
+ return EXIT_FAILURE; /* should not reach */
+ }
+
++/* Set font and colors from X resources database if they are not set
++ * from command line */
++void
++read_resourses(void) {
++ XrmDatabase xdb;
++ char* xrm;
++ char* datatype[20];
++ XrmValue xvalue;
++
++ XrmInitialize();
++ xrm = XResourceManagerString(dc->dpy);
++ if( xrm != NULL ) {
++ xdb = XrmGetStringDatabase(xrm);
++ if( font == NULL && XrmGetResource(xdb, "dmenu.font", "*", datatype, &xvalue) == True )
++ font = strdup(xvalue.addr);
++ if( normfgcolor == NULL && XrmGetResource(xdb, "dmenu.foreground", "*", datatype, &xvalue) == True )
++ normfgcolor = strdup(xvalue.addr);
++ if( normbgcolor == NULL && XrmGetResource(xdb, "dmenu.background", "*", datatype, &xvalue) == True )
++ normbgcolor = strdup(xvalue.addr);
++ if( selfgcolor == NULL && XrmGetResource(xdb, "dmenu.selforeground", "*", datatype, &xvalue) == True )
++ selfgcolor = strdup(xvalue.addr);
++ if( selbgcolor == NULL && XrmGetResource(xdb, "dmenu.selbackground", "*", datatype, &xvalue) == True )
++ selbgcolor = strdup(xvalue.addr);
++ XrmDestroyDatabase(xdb);
++ }
++ /* Set default colors if they are not set */
++ if( normbgcolor == NULL )
++ normbgcolor = "#cccccc";
++ if( normfgcolor == NULL )
++ normfgcolor = "#000000";
++ if( selbgcolor == NULL )
++ selbgcolor = "#0066ff";
++ if( selfgcolor == NULL )
++ selfgcolor = "#ffffff";
++}
++
+ void
+ appenditem(Item *item, Item **list, Item **last) {
+ if(!*last)
diff -r 075947ceaaca -r 09e156549351 tools.suckless.org/dmenu/patches/xrdb.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools.suckless.org/dmenu/patches/xrdb.md Thu Dec 16 23:51:23 2010 +0300
_AT_@ -0,0 +1,16 @@
+INCREMENTAL OUTPUT
+==================
+
+This patch allows to confgure font and colors using X resource database.
+Following resources are supported:
+
+ * dmenu.font - font
+ * dmenu.foreground - foreground color
+ * dmenu.background - background color
+ * dmenu.selforeground - foreground color for selected area
+ * dmenu.selbackground - background color for selected area
+
+Download
+--------
+
+* [xrdb.diff](xrdb.diff)
Received on Thu Dec 16 2010 - 21:51:10 CET

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