Christopher Zimmermann <[email protected]> writes:
> Hi,
>
> this is a patch to dzen2 to do proper hiding.
> I also submitted upstream, but the project hat its last commit 9 years
> ago, so I'm not sure whether it will get merged.
> See https://github.com/robm/dzen/pull/57
> OK?
>
> Christopher
I haven't used dzen2 in a long time but the diff reads fine: XMapWindow
and XUnmapWindow are the correct functions to call to show and hide a
window on xorg. It would be interesting to know what the author thought
tho; it's unlikely that they didn't know how mapping and unmapping
windows works.
Here's a proper diff for the port, I'm currently testing it but seems to
work fine
Index: Makefile
===================================================================
RCS file: /home/cvs/ports/x11/dzen2/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile 12 Jul 2019 20:51:09 -0000 1.9
+++ Makefile 9 Feb 2022 16:53:52 -0000
@@ -7,7 +7,7 @@ GH_COMMIT= 488ab66019f475e35e0676466218
GH_ACCOUNT= robm
GH_PROJECT= dzen
V= 0.9.5
-REVISION= 2
+REVISION= 3
DISTNAME= dzen2-$V
PKGNAME-main= ${DISTNAME}
Index: patches/patch-action_c
===================================================================
RCS file: patches/patch-action_c
diff -N patches/patch-action_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-action_c 9 Feb 2022 16:53:30 -0000
@@ -0,0 +1,32 @@
+$OpenBSD$
+
+map/unmap instead of resizing to a 1px tall window
+cf. https://github.com/robm/dzen/pull/57
+
+Index: action.c
+--- action.c.orig
++++ action.c
+@@ -390,9 +390,9 @@ a_hide(char * opt[]) {
+ printf("n:%d\n", n);
+ if(!dzen.title_win.ishidden) {
+ if(!dzen.slave_win.ishmenu)
+- XResizeWindow(dzen.dpy, dzen.title_win.win,
dzen.title_win.width, 1);
++ XUnmapWindow(dzen.dpy, dzen.title_win.win);
+ else
+- XResizeWindow(dzen.dpy, dzen.slave_win.win,
dzen.title_win.width, 1);
++ XUnmapWindow(dzen.dpy, dzen.slave_win.win);
+
+ dzen.title_win.ishidden = True;
+ }
+@@ -404,9 +404,9 @@ a_unhide(char * opt[]) {
+ (void)opt;
+ if(dzen.title_win.ishidden) {
+ if(!dzen.slave_win.ishmenu)
+- XResizeWindow(dzen.dpy, dzen.title_win.win,
dzen.title_win.width, dzen.line_height);
++ XMapWindow(dzen.dpy, dzen.title_win.win);
+ else
+- XResizeWindow(dzen.dpy, dzen.slave_win.win,
dzen.title_win.width, dzen.line_height);
++ XMapWindow(dzen.dpy, dzen.slave_win.win);
+
+ dzen.title_win.ishidden = False;
+ }