From e3edd704fb85474bc35478b23ffab048bc1564a7 Mon Sep 17 00:00:00 2001 From: davidpkj Date: Thu, 16 Mar 2023 13:20:48 +0100 Subject: Revert: xresources-20210827-138b405 --- config.h | 43 ++++++++++---------------------------- drw.c | 2 +- drw.h | 2 +- dwm.c | 72 ---------------------------------------------------------------- 4 files changed, 13 insertions(+), 106 deletions(-) diff --git a/config.h b/config.h index 7125787..d1d67f9 100644 --- a/config.h +++ b/config.h @@ -22,19 +22,19 @@ static const int vertpadbar = gapsize; /* vertical padding for statusba /* monocle mode in presence of several windows. */ /* Modes after showtab_nmodes are disabled */ enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always}; -static const int showtab = showtab_auto; /* Default tab bar show mode */ -static const Bool toptab = False; /* False means bottom tab bar */ +static const int showtab = showtab_auto; /* Default tab bar show mode */ +static const Bool toptab = False; /* False means bottom tab bar */ static char font[] = "JetBrainsMono Nerd Font:size=19:pixelsize=24"; static char dmenufont[] = "JetBrainsMono Nerd Font:size=19:pixelsize=24"; static const char *fonts[] = { font, "Material Icons:size=24" }; -static char normbgcolor[] = "#000000"; -static char normbordercolor[] = "#ffffff"; -static char normfgcolor[] = "#ffffff"; -static char selfgcolor[] = "#000000"; -static char selbordercolor[] = "#ffffff"; -static char selbgcolor[] = "#ffffff"; +static char normbgcolor[] = "#000000"; +static char normbordercolor[] = "#ffffff"; +static char normfgcolor[] = "#ffffff"; +static char selfgcolor[] = "#000000"; +static char selbordercolor[] = "#ffffff"; +static char selbgcolor[] = "#ffffff"; static char *colors[][3] = { /* fg bg border */ @@ -60,9 +60,9 @@ static const Rule rules[] = { }; /* layout(s) */ -static float mfact = 0.55; /* factor of master area size [0.05..0.95] */ -static int nmaster = 1; /* number of clients in master area */ -static int resizehints = 1; /* 1 means respect size hints in tiled resizals */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const Layout layouts[] = { @@ -88,27 +88,6 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", normbgcolor, "-x", "10", "-y", "10", "-z", "2860", "-h", "44", NULL }; static const char *termcmd[] = { "st", NULL }; -/* - * Xresources preferences to load at startup - */ -ResourcePref resources[] = { - { "font", STRING, &font }, - { "dmenufont", STRING, &dmenufont }, - { "normbgcolor", STRING, &normbgcolor }, - { "normbordercolor", STRING, &normbordercolor }, - { "normfgcolor", STRING, &normfgcolor }, - { "selbgcolor", STRING, &selbgcolor }, - { "selbordercolor", STRING, &selbordercolor }, - { "selfgcolor", STRING, &selfgcolor }, - { "borderpx", INTEGER, &borderpx }, - { "snap", INTEGER, &snap }, - { "showbar", INTEGER, &showbar }, - { "topbar", INTEGER, &topbar }, - { "nmaster", INTEGER, &nmaster }, - { "resizehints", INTEGER, &resizehints }, - { "mfact", FLOAT, &mfact }, -}; - static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_space, spawn, {.v = dmenucmd } }, diff --git a/drw.c b/drw.c index f8a82f5..a58a2b4 100644 --- a/drw.c +++ b/drw.c @@ -195,7 +195,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname) /* Wrapper to create color schemes. The caller has to call free(3) on the * returned color scheme when done using it. */ Clr * -drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount) +drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) { size_t i; Clr *ret; diff --git a/drw.h b/drw.h index bdbf950..6471431 100644 --- a/drw.h +++ b/drw.h @@ -40,7 +40,7 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in /* Colorscheme abstraction */ void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); -Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount); +Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); /* Cursor abstraction */ Cur *drw_cur_create(Drw *drw, int shape); diff --git a/dwm.c b/dwm.c index 8e3584d..9bfd150 100644 --- a/dwm.c +++ b/dwm.c @@ -36,7 +36,6 @@ #include #include #include -#include #ifdef XINERAMA #include #endif /* XINERAMA */ @@ -172,19 +171,6 @@ typedef struct { int monitor; } Rule; -/* Xresources preferences */ -enum resource_type { - STRING = 0, - INTEGER = 1, - FLOAT = 2 -}; - -typedef struct { - char *name; - enum resource_type type; - void *dst; -} ResourcePref; - /* function declarations */ static void applyrules(Client *c); static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); @@ -289,8 +275,6 @@ static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); -static void load_xresources(void); -static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst); static pid_t getparentprocess(pid_t p); static int isdescprocess(pid_t p, pid_t c); @@ -2810,60 +2794,6 @@ zoom(const Arg *arg) pop(c); } -void -resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) -{ - char *sdst = NULL; - int *idst = NULL; - float *fdst = NULL; - - sdst = dst; - idst = dst; - fdst = dst; - - char fullname[256]; - char *type; - XrmValue ret; - - snprintf(fullname, sizeof(fullname), "%s.%s", "dwm", name); - fullname[sizeof(fullname) - 1] = '\0'; - - XrmGetResource(db, fullname, "*", &type, &ret); - if (!(ret.addr == NULL || strncmp("String", type, 64))) - { - switch (rtype) { - case STRING: - strcpy(sdst, ret.addr); - break; - case INTEGER: - *idst = strtoul(ret.addr, NULL, 10); - break; - case FLOAT: - *fdst = strtof(ret.addr, NULL); - break; - } - } -} - -void -load_xresources(void) -{ - Display *display; - char *resm; - XrmDatabase db; - ResourcePref *p; - - display = XOpenDisplay(NULL); - resm = XResourceManagerString(display); - if (!resm) - return; - - db = XrmGetStringDatabase(resm); - for (p = resources; p < resources + LENGTH(resources); p++) - resource_load(db, p->name, p->type, p->dst); - XCloseDisplay(display); -} - int main(int argc, char *argv[]) { @@ -2878,8 +2808,6 @@ main(int argc, char *argv[]) if (!(xcon = XGetXCBConnection(dpy))) die("dwm: cannot get xcb connection\n"); checkotherwm(); - XrmInitialize(); - load_xresources(); setup(); #ifdef __OpenBSD__ if (pledge("stdio rpath proc exec ps", NULL) == -1) -- cgit v1.2.3