all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Tassilo Horn <tsdh@gnu.org>, Daniel Mendler <mail@daniel-mendler.de>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: On the pains of using child-frames / posframes
Date: Sun, 18 Jul 2021 10:30:37 +0200	[thread overview]
Message-ID: <904649fe-d67b-9eed-5e87-9083d256b945@gmx.at> (raw)
In-Reply-To: <871r7wskbl.fsf@gnu.org>

 >> 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



  reply	other threads:[~2021-07-18  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210715105707.10057.54746@vcs0.savannah.gnu.org>
     [not found] ` <20210715105709.4F14820D13@vcs0.savannah.gnu.org>
2021-07-15 14:07   ` [elpa] externals/corfu a44c778 1/2: Yet another hack: posn-at-point computation returns wrong y-coordinate on Emacs 28 Stefan Monnier
2021-07-16  0:46     ` Daniel Mendler
2021-07-17 20:18       ` On the pains of using child-frames / posframes Tassilo Horn
2021-07-18  8:30         ` martin rudalics [this message]
2021-07-19 19:07           ` Tassilo Horn
2021-07-20  7:21             ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=904649fe-d67b-9eed-5e87-9083d256b945@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=mail@daniel-mendler.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.