mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
xresources: Questionable solution to allowing command line arguments to take precedence over xresources
This commit is contained in:
parent
328a60e0d3
commit
7fd7f72d5d
45
dmenu.c
45
dmenu.c
@ -1825,6 +1825,28 @@ main(int argc, char *argv[])
|
||||
int fast = 0;
|
||||
#endif // NON_BLOCKING_STDIN_PATCH
|
||||
|
||||
#if XRESOURCES_PATCH
|
||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||
fputs("warning: no locale support\n", stderr);
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("cannot open display");
|
||||
screen = DefaultScreen(dpy);
|
||||
root = RootWindow(dpy, screen);
|
||||
if (!embed || !(parentwin = strtol(embed, NULL, 0)))
|
||||
parentwin = root;
|
||||
if (!XGetWindowAttributes(dpy, parentwin, &wa))
|
||||
die("could not get embedding window attributes: 0x%lx",
|
||||
parentwin);
|
||||
|
||||
#if ALPHA_PATCH
|
||||
xinitvisual();
|
||||
drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap);
|
||||
#else
|
||||
drw = drw_create(dpy, screen, root, wa.width, wa.height);
|
||||
#endif // ALPHA_PATCH
|
||||
readxresources();
|
||||
#endif // XRESOURCES_PATCH
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
/* these options take no arguments */
|
||||
if (!strcmp(argv[i], "-v")) { /* prints version information */
|
||||
@ -1990,6 +2012,15 @@ main(int argc, char *argv[])
|
||||
else
|
||||
usage();
|
||||
|
||||
#if XRESOURCES_PATCH
|
||||
#if PANGO_PATCH
|
||||
if (!drw_font_create(drw, font))
|
||||
die("no fonts could be loaded.");
|
||||
#else
|
||||
if (!drw_fontset_create(drw, (const char**)fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
#endif // PANGO_PATCH
|
||||
#else // !XRESOURCES_PATCH
|
||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||
fputs("warning: no locale support\n", stderr);
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
@ -2008,22 +2039,16 @@ main(int argc, char *argv[])
|
||||
#else
|
||||
drw = drw_create(dpy, screen, root, wa.width, wa.height);
|
||||
#endif // ALPHA_PATCH
|
||||
#if XRESOURCES_PATCH
|
||||
readxresources();
|
||||
|
||||
#if PANGO_PATCH
|
||||
if (!drw_font_create(drw, font))
|
||||
die("no fonts could be loaded.");
|
||||
#else
|
||||
if (!drw_fontset_create(drw, (const char**)fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
#endif // PANGO_PATCH
|
||||
#elif PANGO_PATCH
|
||||
if (!drw_font_create(drw, font))
|
||||
die("no fonts could be loaded.");
|
||||
#else
|
||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
#endif // XRESOURCES_PATCH | PANGO_PATCH
|
||||
#endif // PANGO_PATCH
|
||||
#endif // XRESOURCES_PATCH
|
||||
|
||||
#if PANGO_PATCH
|
||||
lrpad = drw->font->h;
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user