From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: On the pains of using child-frames / posframes Date: Sun, 18 Jul 2021 10:30:37 +0200 Message-ID: <904649fe-d67b-9eed-5e87-9083d256b945@gmx.at> References: <20210715105707.10057.54746@vcs0.savannah.gnu.org> <20210715105709.4F14820D13@vcs0.savannah.gnu.org> <871r7wskbl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25279"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , emacs-devel@gnu.org To: Tassilo Horn , Daniel Mendler Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 18 10:31:55 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m52DK-0006To-PY for ged-emacs-devel@m.gmane-mx.org; Sun, 18 Jul 2021 10:31:54 +0200 Original-Received: from localhost ([::1]:44034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m52DJ-0006rt-QZ for ged-emacs-devel@m.gmane-mx.org; Sun, 18 Jul 2021 04:31:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m52CV-0006AV-SI for emacs-devel@gnu.org; Sun, 18 Jul 2021 04:31:03 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:36999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m52CT-0006e7-Ru; Sun, 18 Jul 2021 04:31:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1626597038; bh=uUHgAQSLX2TpMtcK2/8OZvTNUdePaZwJ1m4WKEiqd8k=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=BcMgLM6ionSJiCom1YaHxbWql8hsvyhbQLbDOrVz2QitFxeG10wP/BDYfkryywW9c 5J1ryRAVSQTXYWKpImFjFeUgbiZQ4HlN9sz5xDtRj+n+IaeU3CMd+qp0pynX43Wqno 1sIB3kBW9gECFQWyePKZE3Pg4U7oC8vnPJhxcn3E= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([213.142.97.181]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M42jQ-1m52C61b60-0005Hg; Sun, 18 Jul 2021 10:30:38 +0200 In-Reply-To: <871r7wskbl.fsf@gnu.org> Content-Language: en-US X-Provags-ID: V03:K1:eiZdYtVRc4bLuJxHBir5GIfIUp1qvnvJ8MoIjGHP7kDU3/NlkOW F/AXiY+BFYP2QQzNpULxHe14IBDGPUzeiqCMYgrGgFTD+M/S8vn2mOqO+g3uRS0YkNjSiEc oS32nUxJDNP7YGSk+0/NELIBFCM0iti86355MdWg/mv+zKJaCgbkM/1FKu9QP7wou568gjB rFeBDxCWaJg09qSoBJ7Ig== X-UI-Out-Filterresults: notjunk:1;V03:K0:AszvwPhX/4E=:I7HTyK/VK49YM4a4xDUVa6 admb2xWYykRL4C3er1FJdpFmz9Cuyv6dCs5jIhif6o6eGpPHi3fCIp9VgBdx9WfPQSzfTgZbC 9/gCqkspnu/ThPwxxKoQCvwGQJvCCi+2bgUD+Nd3yLwliX02sxS+s6dcOhLYMwkceSHW6zz74 ZDdI1NqC6GFJpvcqHSkdOfkyOmVISqRN/DCGqTau1zZsbYTWmTeLztPOayZOgglD7ThffIzWn NB7RvCZmDw2YP7NZEsKxxMGlYlnaOPMO2f/O3aoICr3Bm6Xk48qhjfEVOWIgsKSqMilt01/cB +BFCCrf7Cg/T+Q6JFzuC5PRhbYEN9m+zXKDgxQavQnjkO7i7hgNDOUVJPAnp5BmLnvb1sfKc/ Fejo6g5bFA6q5GUYYv68Duyx2p0sTRO1i8GtcAdi2r1uM31QiR27Wol747vBXa1Asg8W8cjJ4 fSOwV8z5vD+/L6WHh0YAivadvTToCAPhbTBzSChsOkckUfjbI6am0HghAPgyAW1v448DOx0Ft v6JUSBknLxOmajongU61rgQmFn9WXcts4g3of/KSzE3SwG01BLMFWgPzhF26YLBTWmkSSS8Va pgvpsR2flB0MNg152Kync7DbgwdpKC7KVFkr+94t185mmse0UmkdHncKiHFnpYcfqboHFq/m8 S83GrkyxMn7qgBeJVG/zWn4SHXNuqkjpkjsbVyUsqVMKcnFxQxBoxNUetFKRJkvKFcPJtvQS4 hzGvCGM4JCsB5Uj0kwJavlYJmzVHI4tHCFBx1baDMaEeFFSymUP3rpI0MBAJf7Xo+Uo5z2YW Received-SPF: pass client-ip=212.227.17.22; envelope-from=rudalics@gmx.at; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271356 Archived-At: >> Not yet, for now I am only collecting and marking hacks and >> workarounds in the code. There are already many workarounds for bugs >> in child frames. Please don't call the below "bugs in child frames". Most of them are bugs in window managers in the sense that these are either not IICC or Freedesktop compliant. It's a sad fact that the only window manager correctly implementing child windows in that sense is that of Microsoft Windows. > The `no-accept-focus' frame parameter doesn't work reliably, e.g., it > doesn't work for me in Sway (a wayland window manager). I've reported > that as a sway bug, and a sway dev told me that this is probably a bug > in their Xwayland implementation. But he also said that the GTK > function gtk_window_set_accept_focus used by emacs to indicate that a > frame shouldn't receive focus in gtk builds is a no-op for wayland, and > that wayland doesn't really have a concept of non-focusable windows. So > no-accept-focus will never work when emacs is built as a native wayland > application, i.e., with the pgtk branch. I suspect that with Wayland the 'no-focus-on-map' parameter doesn't work either as intended and a workaround for that would be needed too. Could you provide a simple option to hook into x_set_no_accept_focus and x_set_no_focus_on_map and implement a functionality similar to that of `corfu--popup-redirect-focus' so that we can avoid hooking into `pre-command-hook'? Maybe we should also separate the focus redirection from the mouse click ignore functionality. Also, please keep in mind that with Wayland the only frames we may be able to reliably position on screen ourselves are child frames. So any functionality we implement here, may eventually become a functionality for our normal (non-parented) frames there. > With GTK builds and Gnome / Cinnamon, one needs the following hack to > make the child-frame resize properly: `x-gtk-resize-child-frames' is an awful hack so I would really prefer to not enable it out of the box on the indicated systems but rather provide an optional value for `x-gtk-resize-child-frames' that does implement that. > Some workarounds against flicker, and a case in which the order of > setting a face attribute and setting the frame parameters makes a > difference for no obvious reason. Are these flicker problems ... > ;; Without the check, the frame flickers on Mac. ... typical for Macs or have people seen them elsewhere too? > More flicker avoidance. Don't we get something similar with `x-gtk-resize-child-frames'? So maybe we should provide a more general option that simply makes a child frame invisible whenever people resize or move it? > It seems like some overlays can make `posn-at-point' return wrong > y-values. Is this `posn-at-point' behavior child frame endemic or has it been seen with normal frames too? > Also, the number of frame parameters one needs to apply for a typical > child-frame whose intent is to display completions, tooltips, or inline > help is quite large and nothing which one can write from the top of > one's head. If you can provide a good name for this ... > (defvar corfu--frame-parameters ... like ...-child-frame-alist, I see no problems. I never tried with 'width' or 'height' 0, though ... > Ditto for the buffer one's going to display in the child-frame. Who would apply a generalized version of ... > (defvar corfu--buffer-parameters ... - set_window_buffer? > This all looks to me as if child-frames should probably have some > dedicated API in vanilla emacs so that using them becomes a bit easier > and less verbose. Also, that packages like corfu and posframe have to > duplicate each other's workarounds for several issues like the > unreliability of `no-accept-focus' doesn't seem right. If there are > issues on certain supported platforms, those are better addressed in > emacs itself. Please try to set up the above as you and Daniel see fit. I hardly can implement anything in this area - setting up a Gnome environment for testing `x-gtk-resize-child-frames' was enough of a nightmare back then. Thanks in advance, martin