summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2021-08-25 10:28:56 -0500
committerzachir <zachir@librem.one>2021-08-25 10:28:56 -0500
commitbedcf8c2fb2237e08da4136f3c0a9ee69c461c73 (patch)
treeb40222cf64d76e401921dd011fa45a1c499fd36d
parent9c3fcafb9ca40b8aaa4688858c466ee668443757 (diff)
dmenu: update to version 5.0
-rw-r--r--LICENSE4
-rw-r--r--config.def.h4
-rw-r--r--config.h4
-rw-r--r--config.mk2
-rw-r--r--dmenu.c20
-rw-r--r--drw.c1
6 files changed, 20 insertions, 15 deletions
diff --git a/LICENSE b/LICENSE
index 6ed8ad3..3afd28e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -8,8 +8,8 @@ MIT/X Consortium License
© 2009 Markus Schnalke <meillo@marmaro.de>
© 2009 Evan Gates <evan.gates@gmail.com>
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
-© 2014-2019 Hiltjo Posthuma <hiltjo@codemadness.org>
-© 2015-2018 Quentin Rameau <quinq@fifth.space>
+© 2014-2020 Hiltjo Posthuma <hiltjo@codemadness.org>
+© 2015-2019 Quentin Rameau <quinq@fifth.space>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/config.def.h b/config.def.h
index 6db32a1..2140b85 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,11 +3,11 @@
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
/* -fn option overrides fonts[0]; default X11 font or font set */
-static const char *fonts[] = {
+static char *fonts[] = {
"monospace:size=10"
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
-static const char *colors[SchemeLast][2] = {
+static char *colors[SchemeLast][2] = {
/* fg bg */
[SchemeNorm] = { "#bbbbbb", "#222222" },
[SchemeSel] = { "#eeeeee", "#005577" },
diff --git a/config.h b/config.h
index 3a31785..8bd9346 100644
--- a/config.h
+++ b/config.h
@@ -3,12 +3,12 @@
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
/* -fn option overrides fonts[0]; default X11 font or font set */
-static const char *fonts[] = {
+static char *fonts[] = {
"mononoki Nerd Font Mono:size=10",
"JoyPixels:size=10"
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
-static const char *colors[SchemeLast][2] = {
+static char *colors[SchemeLast][2] = {
/* fg bg */
[SchemeNorm] = { "#bbbbbb", "#222222" },
[SchemeSel] = { "#eeeeee", "#005577" },
diff --git a/config.mk b/config.mk
index 0929b4a..05d5a3e 100644
--- a/config.mk
+++ b/config.mk
@@ -1,5 +1,5 @@
# dmenu version
-VERSION = 4.9
+VERSION = 5.0
# paths
PREFIX = /usr/local
diff --git a/dmenu.c b/dmenu.c
index 53b35da..9a1f14b 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -22,7 +22,7 @@
/* 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)))
+ && MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
@@ -596,9 +596,14 @@ run(void)
XEvent ev;
while (!XNextEvent(dpy, &ev)) {
- if (XFilterEvent(&ev, None))
+ if (XFilterEvent(&ev, win))
continue;
switch(ev.type) {
+ case DestroyNotify:
+ if (ev.xdestroywindow.window != win)
+ break;
+ cleanup();
+ exit(1);
case Expose:
if (ev.xexpose.count == 0)
drw_map(drw, win, 0, 0, mw, mh);
@@ -708,15 +713,16 @@ setup(void)
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
XSetClassHint(dpy, win, &ch);
- /* open input methods */
- xim = XOpenIM(dpy, NULL, NULL, NULL);
+ /* 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);
- XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
if (embed) {
- XSelectInput(dpy, parentwin, FocusChangeMask);
+ XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
for (i = 0; i < du && dws[i] != win; ++i)
XSelectInput(dpy, dws[i], FocusChangeMask);
@@ -820,8 +826,6 @@ main(int argc, char *argv[])
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr);
- if (!XSetLocaleModifiers(""))
- fputs("warning: no locale modifiers support\n", stderr);
if (!(dpy = XOpenDisplay(NULL)))
die("cannot open display");
screen = DefaultScreen(dpy);
diff --git a/drw.c b/drw.c
index 8fd1ca4..6927c41 100644
--- a/drw.c
+++ b/drw.c
@@ -95,6 +95,7 @@ drw_free(Drw *drw)
{
XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc);
+ drw_fontset_free(drw->fonts);
free(drw);
}