unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rudalics@gmx.at,  emacs-devel@gnu.org
Subject: Re: Q: child frames on ttys
Date: Mon, 02 Sep 2024 14:46:11 +0200	[thread overview]
Message-ID: <m2jzfu8bqk.fsf@pro2.fritz.box> (raw)
In-Reply-To: <86y14a8eut.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 02 Sep 2024 14:38:50 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: rudalics@gmx.at,  emacs-devel@gnu.org
>> Date: Mon, 02 Sep 2024 10:37:37 +0200
>> 
>> Just wanted to mention that I had an idea yesterday how to solve that
>> problem without making broad changes outside of the tty code. The idea
>> is to write a function that maps an (x, y) position in a
>> matrix the frame holding the realized face at that position.
>
> Sorry, I don't understand: a function mapping a position to what?
> 'struct face'?  If so, and unless the function is cheap enough,
> wouldn't that make redisplay slower?

Yes, in th4 end it's a struct face, that's right. And it's pretty cheap.
Of course famous last words and so on. I haven't implemented it yet.
And it affects tty frames only which I find nice.

The thing is intended to work like this:

Suppose we have only one root frame and a number of overlapping child
frames on top of it. All these frames are considered independent of each
other like on a GUI. Each frame has its own frame matrices.

For each frame we build window matrices as usual, and for each frame we
build the corresponding frame matrix.

New is building the frame matrix and writing to the terminal are
separated from each other. Writing to the terminal happens only for the
root frame, after first combining all the frame matrices we deal with by
copying glyphs from the child matrices, in reverse z-order.

The combination step computes z-order and the intersection rectangles of
child frames with the root frame to know what to copy where. That's how
I do it now.

The new plan is to record these rectangles as a list of (child-frame
rectangle). Probably not Lisp lists, don't know.

Now, when writing glyphs at some cursor position (x y), we call
turn_on_face (frame, face_id), where face_id comes from some glyph. We
consult the list above, and determine the topmost in z-order child-frame
from which this glyph was copied, if it was. That frame contans the face
cache for the face_id of the glyph. 

When there are no child frames, the list is empty, and it boils down to
a function call instead of simply using FACE_FROM_ID. I'd say that's
cheap.

If there are N child frames, we have to test N times in the worst case
if (x y) in inside a given rectangle, which is 4 integer comparisions
each. And N will be small, typically N = 1.

Seems workable to me, but one has to wait and see of course.



  reply	other threads:[~2024-09-02 12:46 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-17  7:24 Q: child frames on ttys Gerd Möllmann
2024-08-17 10:39 ` Eli Zaretskii
2024-08-17 11:02   ` Gerd Möllmann
2024-08-17 17:18   ` martin rudalics
2024-08-17 18:41     ` Gerd Möllmann
2024-08-21  7:10       ` Gerd Möllmann
2024-08-21  7:55         ` martin rudalics
2024-08-21  8:03           ` Gerd Möllmann
2024-08-21  8:11             ` Robert Pluim
2024-08-21  8:38               ` Gerd Möllmann
2024-08-21 12:00         ` Gerd Möllmann
2024-08-30  6:42           ` Gerd Möllmann
2024-08-30  9:17             ` martin rudalics
2024-08-30 11:03               ` Eli Zaretskii
2024-08-30 11:23                 ` Gerd Möllmann
2024-08-30 14:53                   ` Eli Zaretskii
2024-08-31  8:26                 ` Gerd Möllmann
2024-08-31 11:54                   ` Eli Zaretskii
2024-08-31 14:00                     ` Gerd Möllmann
2024-08-31 14:40                       ` Eli Zaretskii
2024-09-02  8:37                         ` Gerd Möllmann
2024-09-02 11:38                           ` Eli Zaretskii
2024-09-02 12:46                             ` Gerd Möllmann [this message]
2024-09-02 13:13                               ` Eli Zaretskii
2024-09-02 13:54                                 ` Gerd Möllmann
2024-08-30 11:09               ` Gerd Möllmann
2024-08-30  9:29             ` Robert Pluim
2024-08-30 11:19               ` Gerd Möllmann
2024-08-30 12:00                 ` Robert Pluim
2024-08-30 12:37                   ` Gerd Möllmann
2024-08-30 21:11 ` Dmitry Gutov
2024-08-31  6:45   ` Eli Zaretskii
2024-08-31  8:46     ` Po Lu
2024-09-01  0:27       ` Dmitry Gutov
2024-09-16  1:35         ` Dmitry Gutov
2024-09-01  0:27     ` Dmitry Gutov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2jzfu8bqk.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).