From owner-dev-commits-ports-all@freebsd.org Tue May 4 23:11:01 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 545DD626F99; Tue, 4 May 2021 23:11:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZbDj1TP0z4cQ9; Tue, 4 May 2021 23:11:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2382A1A1C1; Tue, 4 May 2021 23:11:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 144NB1VP091596; Tue, 4 May 2021 23:11:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 144NB1gG091594; Tue, 4 May 2021 23:11:01 GMT (envelope-from git) Date: Tue, 4 May 2021 23:11:01 GMT Message-Id: <202105042311.144NB1gG091594@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Adriaan de Groot Subject: git: 1c31059e3d12 - main - x11-wm/twm: generate synthetic WM hints when needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adridg X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c31059e3d1233fdbaee9b89ff041365f1710d17 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 23:11:01 -0000 The branch main has been updated by adridg: URL: https://cgit.FreeBSD.org/ports/commit/?id=1c31059e3d1233fdbaee9b89ff041365f1710d17 commit 1c31059e3d1233fdbaee9b89ff041365f1710d17 Author: Adriaan de Groot AuthorDate: 2021-05-04 10:12:41 +0000 Commit: Adriaan de Groot CommitDate: 2021-05-04 23:10:26 +0000 x11-wm/twm: generate synthetic WM hints when needed This is based on a patch from Reddit -- the patch on Reddit is in context-diff form and contains a bunch of cruft, so it's been re-done (in add_window.c ; the util.c part is used unchanged). Tested by running Chrome in previous twm -- no drop-downs at all -- and in this lightly patched one, where it does behave. PR: 252873 Obtained from: Reddit --- x11-wm/twm/Makefile | 1 + x11-wm/twm/files/patch-src_add__window.c | 12 ++++++++ x11-wm/twm/files/patch-src_util.c | 47 ++++++++++++++++++++++++++++++++ x11-wm/twm/files/patch-src_util.h | 11 ++++++++ 4 files changed, 71 insertions(+) diff --git a/x11-wm/twm/Makefile b/x11-wm/twm/Makefile index 25da81fa5ee4..4227998ae901 100644 --- a/x11-wm/twm/Makefile +++ b/x11-wm/twm/Makefile @@ -1,5 +1,6 @@ PORTNAME= twm PORTVERSION= 1.0.11 +PORTREVISION= 1 CATEGORIES= x11-wm MAINTAINER= x11@FreeBSD.org diff --git a/x11-wm/twm/files/patch-src_add__window.c b/x11-wm/twm/files/patch-src_add__window.c new file mode 100644 index 000000000000..c0fc55446d57 --- /dev/null +++ b/x11-wm/twm/files/patch-src_add__window.c @@ -0,0 +1,12 @@ +--- src/add_window.c.orig 2020-06-14 23:58:19 UTC ++++ src/add_window.c +@@ -238,6 +238,9 @@ AddWindow(Window w, int iconm, IconMgr *iconp) + + tmp_win->wmhints = XGetWMHints(dpy, tmp_win->w); + ++ if (!tmp_win->wmhints) { ++ tmp_win->wmhints = gen_synthetic_wmhints(tmp_win); ++ } + if (tmp_win->wmhints) { + if (restore_iconified) { + tmp_win->wmhints->initial_state = IconicState; diff --git a/x11-wm/twm/files/patch-src_util.c b/x11-wm/twm/files/patch-src_util.c new file mode 100644 index 000000000000..27419870b8de --- /dev/null +++ b/x11-wm/twm/files/patch-src_util.c @@ -0,0 +1,47 @@ +--- src/util.c.orig 2020-06-14 23:58:19 UTC ++++ src/util.c +@@ -1033,3 +1033,44 @@ Bell(int type _X_UNUSED, int percent, Window win _X_UN + #endif + return; + } ++ ++/* ++ * Create synthetic WM_HINTS info for windows. When a window specifies ++ * stuff, we should probably pay attention to it (though we don't ++ * always; x-ref comments in AddWindow() especially about focus). ++ * However, when it doesn't tell us anything at all, we should assume ++ * something useful. "Window managers are free to assume convenient ++ * values for all fields of the WM_HINTS property if a window is mapped ++ * without one." (ICCCM Ch. 4, ++ * ). ++ * ++ * Specifically, we assume it wants us to give it focus. It's fairly ++ * bogus for a window not to tell us anything, but e.g current versions ++ * of Chrome do (don't do) just that. So we better make up something ++ * useful. ++ * ++ * Should probably be some configurability for this, so make the func ++ * take the window, even though we don't currently do anything useful ++ * with it... ++ */ ++XWMHints * ++gen_synthetic_wmhints(TwmWindow *win) ++{ ++ XWMHints *hints; ++ ++ hints = XAllocWMHints(); ++ if(!hints) { ++ return NULL; ++ } ++ ++ /* ++ * Reasonable defaults. Takes input, in normal state. ++ * ++ * XXX Make configurable? ++ */ ++ hints->flags = InputHint | StateHint; ++ hints->input = True; ++ hints->initial_state = NormalState; ++ ++ return hints; ++} diff --git a/x11-wm/twm/files/patch-src_util.h b/x11-wm/twm/files/patch-src_util.h new file mode 100644 index 000000000000..143a3f2e695a --- /dev/null +++ b/x11-wm/twm/files/patch-src_util.h @@ -0,0 +1,11 @@ +--- src/util.h.orig 2020-06-14 23:58:19 UTC ++++ src/util.h +@@ -88,6 +88,8 @@ extern Status I18N_GetIconName(Display *dpy, Window wi + extern void SetFocus(TwmWindow *tmp_win, Time time); + extern void Bell(int type, int percent, Window win); + ++extern XWMHints *gen_synthetic_wmhints(TwmWindow *win); ++ + extern int HotX, HotY; + + #define WM_BELL 0