note symbol origins
This commit is contained in:
parent
8d77c22d94
commit
1faf2c9b8c
@ -8,6 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sysexits.h> /* EX_USAGE */
|
||||
#include <unistd.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
@ -44,7 +45,6 @@ static int mon = -1, screen;
|
||||
static Atom clip, utf8;
|
||||
static Display *dpy;
|
||||
static Window root, parentwin, win;
|
||||
static XIC xic;
|
||||
|
||||
static Drw *drw;
|
||||
static Clr *scheme[SchemeLast];
|
||||
@ -83,14 +83,13 @@ drawmenu(char *text)
|
||||
drw_map(drw, win, 0, 0, mw, mh);
|
||||
}
|
||||
|
||||
/* I don't know how anyting here works */
|
||||
static void
|
||||
setup(void)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char text[text_s];
|
||||
int x, y, i, j;
|
||||
unsigned int du;
|
||||
XSetWindowAttributes swa;
|
||||
XIM xim;
|
||||
Window w, dw, *dws;
|
||||
XWindowAttributes wa;
|
||||
XClassHint ch = {"dmenubar", "dmenubar"};
|
||||
@ -99,6 +98,54 @@ setup(void)
|
||||
Window pw;
|
||||
int a, di, n, area = 0;
|
||||
#endif
|
||||
|
||||
for(i = 0; i < text_s; ++i) /* initialize text[] */
|
||||
text[i] = '\0';
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
|
||||
topbar = 0;
|
||||
else if (i + 1 == argc){
|
||||
usage: fprintf(stderr, "Usage: %s (-b) (-fn [font]) (-m [monitor]\n"
|
||||
"(-cb [color]) (-cf [color]) (-w [windowid])\n",
|
||||
argv[0]);
|
||||
return EX_USAGE;
|
||||
/* these options take one argument */
|
||||
}else if (!strcmp(argv[i], "-m"))
|
||||
mon = atoi(argv[++i]);
|
||||
else if (!strcmp(argv[i], "-fn")) /* font or font set */
|
||||
fonts[0] = argv[++i];
|
||||
else if (!strcmp(argv[i], "-cb")) /* bg color */
|
||||
colors[Scheme][ColBg] = argv[++i];
|
||||
else if (!strcmp(argv[i], "-cf")) /* fg color */
|
||||
colors[Scheme][ColFg] = argv[++i];
|
||||
else if (!strcmp(argv[i], "-w")) /* embedding window id */
|
||||
embed = argv[++i];
|
||||
else
|
||||
goto usage;
|
||||
|
||||
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);
|
||||
drw = drw_create(dpy, screen, root, wa.width, wa.height);
|
||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h;
|
||||
|
||||
/* ??? */
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath", NULL) == -1)
|
||||
die("pledge");
|
||||
#endif
|
||||
|
||||
/* init appearance */
|
||||
for (j = 0; j < SchemeLast; j++)
|
||||
scheme[j] = drw_scm_create(drw, colors[j], 2);
|
||||
@ -161,13 +208,6 @@ setup(void)
|
||||
XSetClassHint(dpy, win, &ch);
|
||||
|
||||
|
||||
/* input methods */
|
||||
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
|
||||
die("XOpenIM failed: could not open input device");
|
||||
|
||||
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
||||
XNClientWindow, win, XNFocusWindow, win, NULL);
|
||||
|
||||
XMapRaised(dpy, win);
|
||||
if (embed) {
|
||||
XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
|
||||
@ -178,67 +218,6 @@ setup(void)
|
||||
}
|
||||
}
|
||||
drw_resize(drw, mw, mh);
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fputs("usage: dmenubar [-b] [-fn font] [-m monitor]\n"
|
||||
" [-cb color] [-cf color] [-w windowid]\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
XWindowAttributes wa;
|
||||
int i;
|
||||
char text[text_s];
|
||||
for(i = 0; i < text_s; ++i) /* initialize text[] */
|
||||
text[i] = '\0';
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
|
||||
topbar = 0;
|
||||
else if (i + 1 == argc)
|
||||
usage();
|
||||
/* these options take one argument */
|
||||
else if (!strcmp(argv[i], "-m"))
|
||||
mon = atoi(argv[++i]);
|
||||
else if (!strcmp(argv[i], "-fn")) /* font or font set */
|
||||
fonts[0] = argv[++i];
|
||||
else if (!strcmp(argv[i], "-cb")) /* bg color */
|
||||
colors[Scheme][ColBg] = argv[++i];
|
||||
else if (!strcmp(argv[i], "-cf")) /* fg color */
|
||||
colors[Scheme][ColFg] = argv[++i];
|
||||
else if (!strcmp(argv[i], "-w")) /* embedding window id */
|
||||
embed = argv[++i];
|
||||
else
|
||||
usage();
|
||||
|
||||
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);
|
||||
drw = drw_create(dpy, screen, root, wa.width, wa.height);
|
||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h;
|
||||
|
||||
/* ??? */
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath", NULL) == -1)
|
||||
die("pledge");
|
||||
#endif
|
||||
|
||||
setup();
|
||||
|
||||
do {
|
||||
/* fgets adds a newline which will be printable in some fonts */
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h> /* va_start(3), va_end(3), va_list */
|
||||
#include <stdio.h> /* fputc(3), perror(3) */
|
||||
#include <stdlib.h> /* calloc(3), exit(3) */
|
||||
#include <string.h> /* strlen(3) */
|
||||
|
||||
#include "util.h"
|
||||
#include "util.h" /* die(3) */
|
||||
|
||||
void *
|
||||
ecalloc(size_t nmemb, size_t size)
|
||||
|
Loading…
Reference in New Issue
Block a user