From d6351cf625dc8286f7c8717edc8803237810ad45 Mon Sep 17 00:00:00 2001 From: Quentin Rameau Date: Mon, 4 Feb 2019 00:29:26 +0100 Subject: [PATCH 1/7] Close when the embedding window is destroyed --- LICENSE | 2 +- dmenu.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 6ed8ad3..9762166 100644 --- a/LICENSE +++ b/LICENSE @@ -9,7 +9,7 @@ MIT/X Consortium License © 2009 Evan Gates © 2010-2012 Connor Lane Smith © 2014-2019 Hiltjo Posthuma -© 2015-2018 Quentin Rameau +© 2015-2019 Quentin Rameau 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/dmenu.c b/dmenu.c index 7174098..08623da 100644 --- a/dmenu.c +++ b/dmenu.c @@ -746,6 +746,11 @@ run(void) case ButtonPress: buttonpress(&ev); break; + 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); @@ -860,7 +865,7 @@ setup(void) 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); From c10954a12ad8abdae6471d6770f91db34c34152e Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 12 Feb 2019 19:10:43 +0100 Subject: [PATCH 2/7] fix crash when XOpenIM returns NULL for example when IME variables are set, but the program is not started (yet). --- dmenu.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dmenu.c b/dmenu.c index 08623da..b8399e7 100644 --- a/dmenu.c +++ b/dmenu.c @@ -857,8 +857,17 @@ setup(void) CWOverrideRedirect | CWBackPixel | CWColormap | CWEventMask | CWBorderPixel, &swa); XSetClassHint(dpy, win, &ch); - /* open input methods */ - xim = XOpenIM(dpy, NULL, NULL, NULL); + + /* input methods */ + if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) { + XSetLocaleModifiers("@im=local"); + if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) { + XSetLocaleModifiers("@im="); + if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) + die("XOpenIM failed. Could not open input device.\n"); + } + } + xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing, XNClientWindow, win, XNFocusWindow, win, NULL); From a30dbb750ccba80bc9ad130d2f05b2cfd0acbb8b Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 12 Feb 2019 22:13:58 +0100 Subject: [PATCH 3/7] make dmenu_path script executable (as dmenu_run is) --- dmenu_path | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 dmenu_path diff --git a/dmenu_path b/dmenu_path old mode 100644 new mode 100755 From f3e5ba3a97326653beca855bcb0ff7fd3b47b532 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Tue, 12 Feb 2019 22:58:35 +0100 Subject: [PATCH 4/7] improve xopenim error message die() already prints a newline. --- dmenu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmenu.c b/dmenu.c index b8399e7..ead3c41 100644 --- a/dmenu.c +++ b/dmenu.c @@ -864,7 +864,7 @@ setup(void) if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) { XSetLocaleModifiers("@im="); if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) - die("XOpenIM failed. Could not open input device.\n"); + die("XOpenIM failed: could not open input device"); } } From b23431233d2d5dd3f35a28f0c63ece2e065163ac Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 3 Mar 2019 13:08:54 +0100 Subject: [PATCH 5/7] revert IME support dmenu will not handle IME support (st will, atleast for now). revert parts of commit 377bd37e212b1ec4c03a481245603c6560d0be22 this commit also broke input focus. --- dmenu.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/dmenu.c b/dmenu.c index ead3c41..bde0869 100644 --- a/dmenu.c +++ b/dmenu.c @@ -740,7 +740,7 @@ run(void) XEvent ev; while (!XNextEvent(dpy, &ev)) { - if (XFilterEvent(&ev, None)) + if (XFilterEvent(&ev, win)) continue; switch(ev.type) { case ButtonPress: @@ -859,20 +859,13 @@ setup(void) /* input methods */ - if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) { - XSetLocaleModifiers("@im=local"); - if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) { - XSetLocaleModifiers("@im="); - if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) - die("XOpenIM failed: could not open input device"); - } - } + 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 | SubstructureNotifyMask); if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) { @@ -967,8 +960,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); From 360e74f0a071dfb15bdf8ec93fd703babc6482e9 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Thu, 11 Jun 2020 18:45:33 +0200 Subject: [PATCH 6/7] Fix memory leaks in drw Synced from dwm. Patch by Alex Flierl , thanks. --- drw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drw.c b/drw.c index 9880f38..7694955 100644 --- a/drw.c +++ b/drw.c @@ -98,6 +98,7 @@ drw_free(Drw *drw) { XFreePixmap(drw->dpy, drw->drawable); XFreeGC(drw->dpy, drw->gc); + drw_fontset_free(drw->fonts); free(drw); } From fdb4cea2039c9fce5fd8bc5a74f657db02a8be83 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 2 Sep 2020 18:30:56 +0200 Subject: [PATCH 7/7] bump version to 5.0 ... and bump LICENSE year. --- LICENSE | 2 +- config.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 9762166..3afd28e 100644 --- a/LICENSE +++ b/LICENSE @@ -8,7 +8,7 @@ MIT/X Consortium License © 2009 Markus Schnalke © 2009 Evan Gates © 2010-2012 Connor Lane Smith -© 2014-2019 Hiltjo Posthuma +© 2014-2020 Hiltjo Posthuma © 2015-2019 Quentin Rameau Permission is hereby granted, free of charge, to any person obtaining a diff --git a/config.mk b/config.mk index 260eeae..8531fb9 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # dmenu version -VERSION = 4.9 +VERSION = 5.0 # paths PREFIX = /usr/local