aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-06-08 14:58:18 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-06-08 14:58:18 -0700
commitac78d59c80b627a5332ac64a7d4359389c4251fa (patch)
treeeb7a1c77a688a703442d4bcf604e97aba1566105
parent75eece6dd52aa49705bf59a6f5b6197b7a14f5db (diff)
small fixes
-rw-r--r--share/paths.mk8
-rw-r--r--sys/cmd/cat/rules.mk2
-rw-r--r--sys/cmd/dwm/client.c31
-rw-r--r--sys/cmd/dwm/drw.c2
-rw-r--r--sys/cmd/dwm/dwm.c42
-rw-r--r--sys/cmd/dwm/dwm.h1
-rw-r--r--sys/cmd/menu/drw.c18
-rw-r--r--sys/cmd/menu/menu.c160
-rw-r--r--sys/cmd/menu/util.c11
-rw-r--r--sys/cmd/menu/util.h6
-rw-r--r--sys/cmd/rules.mk3
-rw-r--r--sys/rules.mk8
12 files changed, 141 insertions, 151 deletions
diff --git a/share/paths.mk b/share/paths.mk
index 2998014..12c8c3d 100644
--- a/share/paths.mk
+++ b/share/paths.mk
@@ -7,13 +7,13 @@ TOBJS_$(d) := $(TSTS_$(d):.c=.o)
TOBJS_$(d) := $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(TOBJS_$(d)))
OBJS := $(OBJS) $(OBJS_$(d)) $(TOBJS_$(d))
-DEPS := $(DEPS) $(DEPS_$(d))
+DEPS += $(DEPS_$(d))
LIBS_$(d) := $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(LIBS_$(d)))
-LIBS := $(LIBS) $(LIBS_$(d))
+LIBS += $(LIBS_$(d))
BINS_$(d) := $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(BINS_$(d)))
-BINS := $(BINS) $(BINS_$(d))
+BINS += $(BINS_$(d))
UNTS_$(d) := $(patsubst $(SRC_DIR)/%, $(TST_DIR)/%, $(TSTS_$(d):.c=))
-UNTS := $(UNTS) $(UNTS_$(d))
+UNTS += $(UNTS_$(d))
diff --git a/sys/cmd/cat/rules.mk b/sys/cmd/cat/rules.mk
index 406d1da..27eac26 100644
--- a/sys/cmd/cat/rules.mk
+++ b/sys/cmd/cat/rules.mk
@@ -1,7 +1,5 @@
include share/push.mk
-# Iterate through subdirectory tree
-
# Local sources
SRCS_$(d) := $(d)/cat.c
BINS_$(d) := $(d)/cat
diff --git a/sys/cmd/dwm/client.c b/sys/cmd/dwm/client.c
index 106082c..783190a 100644
--- a/sys/cmd/dwm/client.c
+++ b/sys/cmd/dwm/client.c
@@ -362,26 +362,37 @@ setfocus(Client *c)
void
setfullscreen(Client *c, int fullscreen)
{
+
if (fullscreen && !c->isfullscreen) {
+ // ulong rect[4] = { 0, 0, c->w, c->h };
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (uchar*)&netatom[NetWMFullscreen], 1);
+
+ static ulong opacity = 0xFFFFFFFFul;
+ XChangeProperty(dpy, c->win, netatom[NetWMWindowOpacity], XA_CARDINAL, 32, PropModeReplace, (uchar *)&opacity, 1L);
+ // XChangeProperty(dpy, c->win, netatom[NetWMOpaqueRegion], XA_CARDINAL, 32,
+ // PropModeReplace, (uchar*)&rect, arrlen(rect));
+
c->isfullscreen = 1;
- c->oldstate = c->isfloating;
- c->oldbw = c->bw;
- c->bw = 0;
- c->isfloating = 1;
+ c->oldstate = c->isfloating;
+ c->oldbw = c->bw;
+ c->bw = 0;
+ c->isfloating = 1;
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
+
XRaiseWindow(dpy, c->win);
} else if (!fullscreen && c->isfullscreen){
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
- PropModeReplace, (uchar*)0, 0);
+ PropModeReplace, (uchar*)nil, 0);
+ XDeleteProperty(dpy, c->win, netatom[NetWMWindowOpacity]);
+
c->isfullscreen = 0;
- c->isfloating = c->oldstate;
+ c->isfloating = c->oldstate;
c->bw = c->oldbw;
- c->x = c->oldx;
- c->y = c->oldy;
- c->w = c->oldw;
- c->h = c->oldh;
+ c->x = c->oldx;
+ c->y = c->oldy;
+ c->w = c->oldw;
+ c->h = c->oldh;
resizeclient(c, c->x, c->y, c->w, c->h);
arrange(c->mon);
}
diff --git a/sys/cmd/dwm/drw.c b/sys/cmd/dwm/drw.c
index b4c993a..825e2f4 100644
--- a/sys/cmd/dwm/drw.c
+++ b/sys/cmd/dwm/drw.c
@@ -12,7 +12,7 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->w = w;
drw->h = h;
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
- drw->gc = XCreateGC(dpy, root, 0, NULL);
+ drw->gc = XCreateGC(dpy, root, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
diff --git a/sys/cmd/dwm/dwm.c b/sys/cmd/dwm/dwm.c
index a943ed7..7033d65 100644
--- a/sys/cmd/dwm/dwm.c
+++ b/sys/cmd/dwm/dwm.c
@@ -763,46 +763,54 @@ setup(void)
drw = drw_create(dpy, screen, root, sw, sh);
if (!drw_fontset_create(drw, fonts, arrlen(fonts)))
fatal("no fonts could be loaded.");
+
lrpad = drw->fonts->h;
- bh = drw->fonts->h + 2;
+ bh = drw->fonts->h + 2;
updategeom();
+
/* init atoms */
- utf8string = XInternAtom(dpy, "UTF8_STRING", False);
+ utf8string = XInternAtom(dpy, "UTF8_STRING", False);
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
- wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
- wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
+ wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
+ wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
- netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
- netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
- netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
- netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
- netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
- netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
- netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
+
+ netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+ netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
+ netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
+ netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
+ netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
+ netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
+ netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
+ netatom[NetWMWindowOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
- netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
+ netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
+
/* init cursors */
cursor[MouseNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[MouseResize] = drw_cur_create(drw, XC_sizing);
- cursor[MouseMove] = drw_cur_create(drw, XC_fleur);
+ cursor[MouseMove] = drw_cur_create(drw, XC_fleur);
+
/* init appearance */
scheme = ecalloc(arrlen(colors), sizeof(Clr *));
for (i = 0; i < arrlen(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
+
/* init bars */
updatebars();
updatestatus();
+
/* supporting window for NetWMCheck */
wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
- PropModeReplace, (unsigned char *) &wmcheckwin, 1);
+ PropModeReplace, (uchar *) &wmcheckwin, 1);
XChangeProperty(dpy, wmcheckwin, netatom[NetWMName], utf8string, 8,
- PropModeReplace, (unsigned char *) "dwm", 3);
+ PropModeReplace, (uchar *) "dwm", 3);
XChangeProperty(dpy, root, netatom[NetWMCheck], XA_WINDOW, 32,
- PropModeReplace, (unsigned char *) &wmcheckwin, 1);
+ PropModeReplace, (uchar *) &wmcheckwin, 1);
/* EWMH support per view */
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
- PropModeReplace, (unsigned char *) netatom, NetLast);
+ PropModeReplace, (uchar *) netatom, NetLast);
XDeleteProperty(dpy, root, netatom[NetClientList]);
/* select events */
wa.cursor = cursor[MouseNormal]->cursor;
diff --git a/sys/cmd/dwm/dwm.h b/sys/cmd/dwm/dwm.h
index 0061e74..3449ff8 100644
--- a/sys/cmd/dwm/dwm.h
+++ b/sys/cmd/dwm/dwm.h
@@ -64,6 +64,7 @@ enum
NetActiveWindow,
NetWMWindowType,
NetWMWindowTypeDialog,
+ NetWMWindowOpacity,
NetClientList,
NetLast
}; /* EWMH atoms */
diff --git a/sys/cmd/menu/drw.c b/sys/cmd/menu/drw.c
index 40dae08..162fe40 100644
--- a/sys/cmd/menu/drw.c
+++ b/sys/cmd/menu/drw.c
@@ -1,11 +1,5 @@
/* See LICENSE file for copyright and license details. */
-#include <u.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xft/Xft.h>
-
-#include "drw.h"
-#include "util.h"
+#include "menu.h"
#define UTF_INVALID 0xFFFD
#define UTF_SIZ 4
@@ -28,7 +22,7 @@ static size_t
utf8validate(long *u, size_t i)
{
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
- *u = UTF_INVALID;
+ *u = RuneErr;
for (i = 1; *u > utfmax[i]; ++i)
;
return i;
@@ -40,7 +34,7 @@ utf8decode(const char *c, long *u, size_t clen)
size_t i, j, len, type;
long udecoded;
- *u = UTF_INVALID;
+ *u = RuneErr;
if (!clen)
return 0;
udecoded = utf8decodebyte(c[0], &len);
@@ -128,7 +122,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
return NULL;
}
} else {
- die("no font specified.");
+ fatal("no font specified.");
}
/* Do not allow using color fonts. This is a workaround for a BadLength
@@ -200,7 +194,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
- die("error, cannot allocate color '%s'", clrname);
+ fatal("error, cannot allocate color '%s'", clrname);
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
@@ -343,7 +337,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
if (!drw->fonts->pattern) {
/* Refer to the comment in xfont_create for more information. */
- die("the first font in the cache must be loaded from a font string.");
+ fatal("the first font in the cache must be loaded from a font string.");
}
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
diff --git a/sys/cmd/menu/menu.c b/sys/cmd/menu/menu.c
index 666e531..f0d1276 100644
--- a/sys/cmd/menu/menu.c
+++ b/sys/cmd/menu/menu.c
@@ -1,36 +1,4 @@
-/* See LICENSE file for copyright and license details. */
-#include <u.h>
-#include <libn.h>
-#include <time.h>
-#include <locale.h>
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/Xinerama.h>
-#include <X11/Xft/Xft.h>
-
-#include "drw.h"
-#include "util.h"
-
-/* macros */
-#define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \
- * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
-#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
-
-/* enums */
-enum {
- SchemeNorm,
- SchemeSel,
- SchemeOut,
- SchemeLast
-}; /* color schemes */
-
-struct item {
- char *text;
- struct item *left, *right;
- int out;
-};
+#include "menu.h"
static char text[BUFSIZ] = "";
static char *embed;
@@ -38,7 +6,7 @@ static int bh, mw, mh;
static int inputw = 0, promptw;
static int lrpad; /* sum of left and right padding */
static size_t cursor;
-static struct item *items = NULL;
+static struct item *items = nil;
static struct item *matches, *matchend;
static struct item *prev, *curr, *next, *sel;
static int mon = -1, screen;
@@ -56,7 +24,8 @@ static Clr *scheme[SchemeLast];
static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
static char *(*fstrstr)(const char *, const char *) = strstr;
-static void
+static
+void
appenditem(struct item *item, struct item **list, struct item **last)
{
if (*last)
@@ -65,11 +34,12 @@ appenditem(struct item *item, struct item **list, struct item **last)
*list = item;
item->left = *last;
- item->right = NULL;
+ item->right = nil;
*last = item;
}
-static void
+static
+void
calcoffsets(void)
{
int i, n;
@@ -87,7 +57,8 @@ calcoffsets(void)
break;
}
-static void
+static
+void
cleanup(void)
{
size_t i;
@@ -100,7 +71,8 @@ cleanup(void)
XCloseDisplay(dpy);
}
-static char *
+static
+char *
cistrstr(const char *s, const char *sub)
{
size_t len;
@@ -108,10 +80,11 @@ cistrstr(const char *s, const char *sub)
for (len = strlen(sub); *s; s++)
if (!strncasecmp(s, sub, len))
return (char *)s;
- return NULL;
+ return nil;
}
-static int
+static
+int
drawitem(struct item *item, int x, int y, int w)
{
if (item == sel)
@@ -124,10 +97,11 @@ drawitem(struct item *item, int x, int y, int w)
return drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0);
}
-static void
+static
+void
drawmenu(void)
{
- unsigned int curpos;
+ uint curpos;
struct item *item;
int x = 0, y = 0, w;
@@ -173,7 +147,8 @@ drawmenu(void)
drw_map(drw, win, 0, 0, mw, mh);
}
-static void
+static
+void
grabfocus(void)
{
struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 };
@@ -185,12 +160,13 @@ grabfocus(void)
if (focuswin == win)
return;
XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
- nanosleep(&ts, NULL);
+ nanosleep(&ts, nil);
}
- die("cannot grab focus");
+ fatal("cannot grab focus");
}
-static void
+static
+void
grabkeyboard(void)
{
struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000 };
@@ -203,15 +179,16 @@ grabkeyboard(void)
if (XGrabKeyboard(dpy, DefaultRootWindow(dpy), True, GrabModeAsync,
GrabModeAsync, CurrentTime) == GrabSuccess)
return;
- nanosleep(&ts, NULL);
+ nanosleep(&ts, nil);
}
- die("cannot grab keyboard");
+ fatal("cannot grab keyboard");
}
-static void
+static
+void
match(void)
{
- static char **tokv = NULL;
+ static char **tokv = nil;
static int tokn = 0;
char buf[sizeof text], *s;
@@ -221,12 +198,12 @@ match(void)
strcpy(buf, text);
/* separate input text into tokens to be matched individually */
- for (s = strtok(buf, " "); s; tokv[tokc - 1] = s, s = strtok(NULL, " "))
+ for (s = strtok(buf, " "); s; tokv[tokc - 1] = s, s = strtok(nil, " "))
if (++tokc > tokn && !(tokv = realloc(tokv, ++tokn * sizeof *tokv)))
- die("cannot realloc %u bytes:", tokn * sizeof *tokv);
+ fatal("cannot realloc %u bytes:", tokn * sizeof *tokv);
len = tokc ? strlen(tokv[0]) : 0;
- matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL;
+ matches = lprefix = lsubstr = matchend = prefixend = substrend = nil;
textsize = strlen(text) + 1;
for (item = items; item && item->text; item++) {
for (i = 0; i < tokc; i++)
@@ -262,7 +239,8 @@ match(void)
calcoffsets();
}
-static void
+static
+void
insert(const char *str, ssize_t n)
{
if (strlen(text) + n > sizeof text - 1)
@@ -275,7 +253,8 @@ insert(const char *str, ssize_t n)
match();
}
-static size_t
+static
+size_t
nextrune(int inc)
{
ssize_t n;
@@ -286,7 +265,8 @@ nextrune(int inc)
return n;
}
-static void
+static
+void
movewordedge(int dir)
{
if (dir < 0) { /* move cursor to the start of the word*/
@@ -302,7 +282,8 @@ movewordedge(int dir)
}
}
-static void
+static
+void
keypress(XKeyEvent *ev)
{
char buf[32];
@@ -344,13 +325,13 @@ keypress(XKeyEvent *ev)
match();
break;
case XK_u: /* delete left */
- insert(NULL, 0 - cursor);
+ insert(nil, 0 - cursor);
break;
case XK_w: /* delete word */
while (cursor > 0 && strchr(worddelimiters, text[nextrune(-1)]))
- insert(NULL, nextrune(-1) - cursor);
+ insert(nil, nextrune(-1) - cursor);
while (cursor > 0 && !strchr(worddelimiters, text[nextrune(-1)]))
- insert(NULL, nextrune(-1) - cursor);
+ insert(nil, nextrune(-1) - cursor);
break;
case XK_y: /* paste selection */
case XK_Y:
@@ -405,7 +386,7 @@ insert:
case XK_BackSpace:
if (cursor == 0)
return;
- insert(NULL, nextrune(-1) - cursor);
+ insert(nil, nextrune(-1) - cursor);
break;
case XK_End:
if (text[cursor] != '\0') {
@@ -498,7 +479,8 @@ draw:
drawmenu();
}
-static void
+static
+void
paste(void)
{
char *p, *q;
@@ -516,36 +498,38 @@ paste(void)
drawmenu();
}
-static void
+static
+void
readstdin(void)
{
char buf[sizeof text], *p;
size_t i, imax = 0, size = 0;
- unsigned int tmpmax = 0;
+ uint tmpmax = 0;
/* read each line from stdin and add it to the item list */
for (i = 0; fgets(buf, sizeof buf, stdin); i++) {
if (i + 1 >= size / sizeof *items)
if (!(items = realloc(items, (size += BUFSIZ))))
- die("cannot realloc %u bytes:", size);
+ fatal("cannot realloc %u bytes:", size);
if ((p = strchr(buf, '\n')))
*p = '\0';
if (!(items[i].text = strdup(buf)))
- die("cannot strdup %u bytes:", strlen(buf) + 1);
+ fatal("cannot strdup %u bytes:", strlen(buf) + 1);
items[i].out = 0;
- drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL);
+ drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, nil);
if (tmpmax > inputw) {
inputw = tmpmax;
imax = i;
}
}
if (items)
- items[i].text = NULL;
+ items[i].text = nil;
inputw = items ? TEXTW(items[imax].text) : 0;
lines = MIN(lines, i);
}
-static void
+static
+void
run(void)
{
XEvent ev;
@@ -583,16 +567,17 @@ run(void)
}
}
-static void
+static
+void
setup(void)
{
int x, y, i, j;
- unsigned int du;
+ uint du;
XSetWindowAttributes swa;
XIM xim;
Window w, dw, *dws;
XWindowAttributes wa;
- XClassHint ch = {"dmenu", "dmenu"};
+ XClassHint ch = {"menu", "menu"};
XineramaScreenInfo *info;
Window pw;
int a, di, n, area = 0;
@@ -640,7 +625,7 @@ setup(void)
} else
{
if (!XGetWindowAttributes(dpy, parentwin, &wa))
- die("could not get embedding window attributes: 0x%lx",
+ fatal("could not get embedding window attributes: 0x%lx",
parentwin);
x = 0;
y = topbar ? 0 : wa.height - mh;
@@ -661,11 +646,11 @@ setup(void)
/* input methods */
- if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
- die("XOpenIM failed: could not open input device");
+ if ((xim = XOpenIM(dpy, nil, nil, nil)) == nil)
+ fatal("XOpenIM failed: could not open input device");
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
- XNClientWindow, win, XNFocusWindow, win, NULL);
+ XNClientWindow, win, XNFocusWindow, win, nil);
XMapRaised(dpy, win);
if (embed) {
@@ -681,10 +666,11 @@ setup(void)
drawmenu();
}
-static void
+static
+void
usage(void)
{
- fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
+ fputs("usage: menu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
exit(1);
}
@@ -698,7 +684,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++)
/* these options take no arguments */
if (!strcmp(argv[i], "-v")) { /* prints version information */
- puts("dmenu-"VERSION);
+ puts("menu-"VERSION);
exit(0);
} else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
topbar = 0;
@@ -733,23 +719,23 @@ main(int argc, char *argv[])
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
- if (!(dpy = XOpenDisplay(NULL)))
- die("cannot open display");
+ if (!(dpy = XOpenDisplay(nil)))
+ fatal("cannot open display");
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
- if (!embed || !(parentwin = strtol(embed, NULL, 0)))
+ if (!embed || !(parentwin = strtol(embed, nil, 0)))
parentwin = root;
if (!XGetWindowAttributes(dpy, parentwin, &wa))
- die("could not get embedding window attributes: 0x%lx",
+ fatal("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, arrlen(fonts)))
- die("no fonts could be loaded.");
+ fatal("no fonts could be loaded.");
lrpad = drw->fonts->h;
#ifdef __OpenBSD__
- if (pledge("stdio rpath", NULL) == -1)
- die("pledge");
+ if (pledge("stdio rpath", nil) == -1)
+ fatal("pledge");
#endif
if (fast && !isatty(0)) {
diff --git a/sys/cmd/menu/util.c b/sys/cmd/menu/util.c
index fe044fc..14bfe1c 100644
--- a/sys/cmd/menu/util.c
+++ b/sys/cmd/menu/util.c
@@ -1,10 +1,5 @@
/* See LICENSE file for copyright and license details. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "util.h"
+#include "menu.h"
void *
ecalloc(size_t nmemb, size_t size)
@@ -12,12 +7,12 @@ ecalloc(size_t nmemb, size_t size)
void *p;
if (!(p = calloc(nmemb, size)))
- die("calloc:");
+ fatal("calloc:");
return p;
}
void
-die(const char *fmt, ...) {
+fatal(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
diff --git a/sys/cmd/menu/util.h b/sys/cmd/menu/util.h
deleted file mode 100644
index 289720a..0000000
--- a/sys/cmd/menu/util.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-
-#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
-
-void die(const char *fmt, ...);
-void *ecalloc(size_t nmemb, size_t size);
diff --git a/sys/cmd/rules.mk b/sys/cmd/rules.mk
index 08afa50..a68231b 100644
--- a/sys/cmd/rules.mk
+++ b/sys/cmd/rules.mk
@@ -23,4 +23,7 @@ include $(DIR)/rules.mk
DIR := $(d)/term
include $(DIR)/rules.mk
+DIR := $(d)/dvtm
+include $(DIR)/rules.mk
+
include share/pop.mk
diff --git a/sys/rules.mk b/sys/rules.mk
index 12fa021..fa33346 100644
--- a/sys/rules.mk
+++ b/sys/rules.mk
@@ -5,6 +5,9 @@ include share/push.mk
# DIR := $(d)/libc
# include $(DIR)/rules.mk
+DIR := $(d)/cmd
+include $(DIR)/rules.mk
+
DIR := $(d)/libn
include $(DIR)/rules.mk
@@ -14,10 +17,7 @@ include $(DIR)/rules.mk
DIR := $(d)/libbio
include $(DIR)/rules.mk
-# DIR := $(d)/libfont
-# include $(DIR)/rules.mk
-
-DIR := $(d)/cmd
+DIR := $(d)/libgpu
include $(DIR)/rules.mk
include share/pop.mk