Subject: Re: bug#75056: 31.0.50; tty-child-frames with server / multiple clients possible hangs

From: Gerd Möllmann <[email-masked]>
Date: Fri, 31 Jan 2025 11:28:19 +0100

martin rudalics <[email-masked]> writes:

>> Just came to my mind that one could re-implemented tty menus in Lisp
>> using child frames.
>
> I have never looked into the menu bar drawing code.  Does it use a
> painter's algorithm?

The menu bar itself, the stripe at the top of a frame is pretty special.
On GUIs without external, i.e. toolkit, menu bar, a window is used to
display it, on ttys not IIRC. Let's ignore that for a moment.

The menus themselves are drawn, simplifying, in these steps

1. Save away the frame's whole current matrix

2. Produce a desired matrix that contains the menu

3. Update the display. Maybe loop for highlighting item.

4. In the end, restore the display from the current matrix saved in the
   first step.

That's save_and_enable_current_matrix, tty_menu_display,
restore_desired_matrix and alike. The event loop is somewhere in
tty_menu_activate IIRC.

I think we could save a lot of complexity with an implementation in
Lisp: Prepare a buffer displaying a menu keymap in a suitable form, with
help-echo, local-map properties and so on, show the buffer in a child
frame, enter an event loop or something and so on.

But it's just an idea I had when thinking of how easy tooltips were to
add in pure Lisp using child frames.