unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Jared Finder <jared@finder.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	 stefankangas@gmail.com, acorallo@gnu.org,  emacs-devel@gnu.org,
	 rudalics@gmx.at
Subject: Re: "Final" version of tty child frames
Date: Thu, 19 Dec 2024 08:44:39 +0100	[thread overview]
Message-ID: <m2wmfwqfq0.fsf@gmail.com> (raw)
In-Reply-To: <m21py4s0i8.fsf@gmail.com> ("Gerd Möllmann"'s message of "Thu, 19 Dec 2024 06:30:23 +0100")

[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> Jared Finder <jared@finder.org> writes:
>
>> On 2024-12-18 09:22, Gerd Möllmann wrote:
>>> Eli Zaretskii <eliz@gnu.org> writes:
>>> 
>>>>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>>>>> Cc: jared@finder.org,  stefankangas@gmail.com,  acorallo@gnu.org,
>>>>>   emacs-devel@gnu.org,  rudalics@gmx.at
>>>>> Date: Wed, 18 Dec 2024 17:39:07 +0100
>>>>>  > What I usually do is produce diffs for the merge, then use "C-x
>>>>> 4 a"
>>>>> > to generate the file/function names, and add a description.
>>>>> The diff I have, so I guess I'll give it a try, when the others
>>>>> agree.
>>>>> Will take a bit, probably. Should I post the result when I have it?
>>>> Feel free, it will probably flash out a few more issues.  I
>>>> actually
>>>> suggest to post some small portion first, to avoid the situation where
>>>> you do all of the job, only to discover that something's amiss or you
>>>> labored more than you had to.
>>> Thanks, will do that.
>>
>> I'll also spend a bit of time to get GPM's mouse input to make the
>> same transformations that Gerd added to xt-mouse.el.  It looks likely
>> very straightforward to do.
>>
>>   -- MJF
>
> Thanks!
>
> And attached is what I came up today, with the help of a lot of coffee.
> The changelog is a page worth of changelog entries, the diff is from
> what I created these. As introductory text I'd use
>
>   This changeset adds support for child frames on ttys.
>
>   The redisplay part is complete.  The frame-handling part supports
>   use-cases like Posframe, Corfu, and child frames acting like tooltips.
>   Other use-cases of child frames are not currently supported.  In
>   particular, trying to create minibuffer-only child frames on ttys will
>   signal an error.

Here's actually a change log for the whole diff


[-- Attachment #2: whole change log --]
[-- Type: text/plain, Size: 7432 bytes --]

2024-12-19  Gerd Möllmann  <gerd.moellmann@gmail.com>

	* src/xfaces.c (free_frame_faces): Change formatting slightly.

	* src/xdisp.c (redisplay_trace, move_tracxe): Print to stderr because
	stdout screws up terminal display.
	(init_iterator): Remove a #ifdef HAVE_WINDOW_SYSTEM.
	(clear_garbaged_frames): Return a bool telling if we cleared matrix.
	(echo_area_display): Use combine_updates on tty frames.
	(redisplay_internal): Changes for redisplay of tty child windows.
	(deep_copy_glyph_row): Take a frame parameter.
	(display_tty_menu_item): Changes because of function signature changes.

	* src/w32term.c (w32_read_socket): Don't use FRAME_OBSCRURED_P,
	which has been removed.

	* src/w32inevt.c (do_mouse_event): Workaround for mouse events on
	child frafmes.

	* src/w32console.c (w32con_write_glyphs, w32con_update_end):
	Use glyphs' frame for faces.

	* src/treesit.c (treesit_load_language): Pacify a warning.

	* src/w32console.c (w32con_clear_end_of_line): Set glyph's frame.

	* src/terminal.c (cursor_to, raw_cursor_to): Handle case that
	frame is a child frame.

	* src/termhooks.h: Declare formerly static functions.

	* src/term.c (tty_hide_cursor, tty_show_cursor): Make externally
	visible.
	(tty_write_glyphs): Determine faces based on a glyph's frame.
	(tty_write_glyphs_with_face): Take a struct face argument instead
	of a face id. Callers changed.
	(tty_insert_glyphs): Use faces, not face ids.
	(append_glyph, append_composite_glyph, append_glyphless_glyph):
	Set glyph's frame.
	(turn_on_face, turn_off_face): Take face argument instead of face
	id. Callers adapted.
	(Fresume_tty): Act on root frame.
	(tty_draw_row_with_mouse_face): Handle child frames.
	(restore_desired_matrix): Make sure glyphs' is live.
	(set_tty_hooks): Set terminal's frame_raise_lower_hook.
	(tty_frame_geometry, Ftty_frame_geometry, Ftty_frame_edges)
	(Ftty_frame_list_z_order, Ftty_frame_restack)
	(tty_display_dimension, Ftty_display_pixel_width)
	(Ftty_display_pixel_height): New functions.
	(syms_of_term): Defsubr new Lisp functions.

	* src/minibuf.c (read_minibuf): Use combine_updates for tty
	frames.

	* src/frame.h (struct frame): Always define parent_frame.  Change
	'visible' to be a boolean. Always define 'undecorated' and
	'no_accept_focus'. Add 'z_order'.
	(FRAME_OBSCURED_P): Removed.
	(FRAME_PARENT_FRAME): Make it a function.
	(SET_FRAME_VISIBLE): Take a bool parameter, not an int.
	(FRAME_INTERNAL_BORDER_WIDTH): Don't special-base HAVE_WINDOW_SYSTEM.

	* src/frame.c (decode_tty_frame): New function.
	(set_menu_bar_lines): Set menu bar lines and height to 0 for tty
	child frames. Compute min height differently.
	(adjust_frame_size): Set FrameCols/Rows only for root tty frames.
	Mark tty root frame garbaged if child frame is adjusted. Run some
	code even if not HAVE_WINDOW_SYSTEM.
	(make_frame): Run some code even if not HAVE_WINDOW_SYSTEM.
	(make_terminal_frame): Implement child frame creation.
	(tty_child_pos_param, tty_child_size_param)
	(tty_child_frame_rect): New functions.
	(Fmake_terminal_frame): Parts rewritten for child frames.
	(do_switch_frame): Add child frame support.
	(Fframe_ancestor_p): Define if not HAVE_WINDOW_SYSTEM.
	(Fmake_frame_visible, Fmake_frame_invisible)
	(Fframe_visible_p, Fraise_frame):
	Handle tty frames differently.
	(store_frame_param): Signal error if trying to re-parent a tty
	child frame.
	(Fframe_parameters): Report some additional tty frame parameters.
	(Fmodify_frame_parameters): Handle tty child frames.
	(Fset_frame_position): Ditto.
	(frame_parms): Define index for additional frame parameters.
	(handle_frame_param): New function.
	(gui_set_frame_parameters_1): Use handle_frame_param.

	* src/disptab.h (DISP_TABLE_EXTRA_SLOTS): Change to 12.
	(enum box): New enumeration.

	* src/dispnew.c (check_rows): New function, #if 0.
	(frame_matrix_frame): Variable removed.
	(line_hash_code): Take glyph's frame into account.
	(build_frame_matrix_from_leaf_window): Do not copy glyphs from
	rows that aren't enabled.
	(fill_up_glyph_row_with_spaces): Add frame parameter, uses
	changed.
	(fill_up_glyph_row_area_with_spaces): Add frame parameter. Set
	glyph's frame to it.
	(fill_up_frame_row_with_spaces): Ditto.
	(set_frame_matrix_frame): Function removed.
	(make_current): Change signature. Callers changed.
	(mirrored_line_dance): Take a frame argument, not a matrix.
	(redraw_frame): Don't clear_frame a child frame.
	(struct rect): New.
	(rect_intersect, frame_pos_abs, frame_rect_abs, root_frame)
	(max_child_z_order, is_frame_ancestor, frames_with_root)
	(frames_with_parent, frame_z_order_cmp, Fframe__z_order_lessp)
	(frames_in_reverse_z_order, tty_raise_lower_frame, is_tty_frame)
	(is_tty_child_frame, is_tty_root_frame, first_enabled_row)
	(make_matrix_current, prepare_desired_root_row)
	(make_glyph_space, neutralize_wide_char, produce_box_glyphs)
	(produce_box_sides, produce_box_line, copy_child_glyphs)
	(update_window_frame, update_initial_frame, flush_terminal)
	(abs_cursor_pos, is_in_matrix, is_cursor_obscured)
	(terminal_cursor_magic, combine_updates_for_frame)
	(combine_updates): New functions.
	(update_frame): Rewritten.
	(Fdisplay__update_for_mouse_movement): Take a MOUSE_FRAME param.
	(syms_of_display): New symbol frame--z-order--lessp, tty-non-selected-cursor.
	New subr Sframe__z_order_lessp. Provide tty-child-frames.

	* src/dispextern.h (struct glyph): Add member 'frame'.
	(CHAR_GLYPH_SPACE_P): Add FRAME parameter. All uses changed.
	(GLYPH_EQUAL_P): Compare glyphs' frame.
	(SET_CHAR_GLYPH): Add parameter FRAME.
	(SET_CHAR_GLYPH_FROM_GLYPH): Ditto.

	* src/chartab.c (Fmake_char_table): Allow more than 10 display
	table slots.

	* lisp/xt-mouse.el (xterm-mouse--handle-mouse-movement): Use new
	terminal parameter xterm-mouse-frame.
	(xterm-mouse-position-function): Ditto.
	(xterm-mouse-event): Determine frame under mouse and compute
	frame-relative coordinates. Set terminal parameter
	xterm-mouse-frame.

	* lisp/tty-tip.el: New file implementing tooltip for ttys.

	* lisp/paren.el (show-paren-function): Don't check if
	display-graphics-p when using child frames.

	* lisp/frame.el (frame-at): New function.
	(tty-frame-geometry): Declare C function.
	(frame-geometry): Use tty-frame-geometry.
	(tty-frame-edges): Declare C function.
	(frame-edges): Use tty-frame-edges.
	(tty-frame-list-z-order): Declare C function.
	(frame-list-z-order): Use tty-frame-list-z-order.
	(tty-frame-restack): Declare C function.
	(frame-restack): Use tty-frame-restack.
	(tty-display-pixel-height): Declare C function.
	(display-pixel-height): Use tty-display-pixel-height.
	(tty-display-pixel-width): Declare C function.
	(display-pixel-width): Use tty-display-pixel-width.

	* lisp/disp-table.el (display-table): Increase size to 12.
	(box-horizontal, box-vertical, box-down-right, box-down-left)
	(box-up-right, box-up-left): New display table slot names for
	box-drawing characters.
	(display-table-slot, set-display-table-slot): Extend doc string.
	(describe-display-table): Display new display table slots.
	(standard-display-unicode-special-glyphs): New function setting
	up Unicode characters for display table entries.

	* .gitignore: Don't ignore patch files, they are useful to see in
	Magit status buffer when applying patches (git am).

  reply	other threads:[~2024-12-19  7:44 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  4:46 "Final" version of tty child frames Gerd Möllmann
2024-10-22  5:29 ` Eli Zaretskii
2024-10-22  9:58   ` martin rudalics
2024-10-22 10:20     ` Eli Zaretskii
2024-10-22 14:01       ` martin rudalics
2024-10-22 14:23         ` Eli Zaretskii
2024-10-22 10:40     ` Gerd Möllmann
2024-10-22 11:43       ` Po Lu
2024-10-22 13:44       ` Eli Zaretskii
2024-10-22 14:01         ` Gerd Möllmann
2024-10-22 14:02       ` martin rudalics
2024-10-28  4:35   ` Jared Finder
2024-10-28  5:57     ` Gerd Möllmann
2024-11-30 11:25     ` Eli Zaretskii
2024-12-05  3:49       ` Jared Finder
2024-12-11  7:31         ` Jared Finder
2024-12-11  7:59           ` Gerd Möllmann
2024-12-12  5:11             ` Jared Finder
2024-12-12  6:20               ` Gerd Möllmann
2024-12-12  6:48                 ` Gerd Möllmann
2024-12-12  6:30               ` Eli Zaretskii
2024-12-12  7:04                 ` Gerd Möllmann
2024-12-18  5:35                   ` Jared Finder
2024-12-18  6:25                     ` Gerd Möllmann
2024-12-18 13:54                     ` Eli Zaretskii
2024-12-18 16:01                       ` Gerd Möllmann
2024-12-18 16:29                         ` Eli Zaretskii
2024-12-18 16:39                           ` Gerd Möllmann
2024-12-18 17:02                             ` Eli Zaretskii
2024-12-18 17:22                               ` Gerd Möllmann
2024-12-19  5:17                                 ` Jared Finder
2024-12-19  5:30                                   ` Gerd Möllmann
2024-12-19  7:44                                     ` Gerd Möllmann [this message]
2024-12-19  8:36                                     ` Eli Zaretskii
2024-12-19  9:04                                       ` Gerd Möllmann
2024-12-19  9:17                                         ` Gerd Möllmann
2024-12-19 10:34                                           ` Robert Pluim
2024-12-19 10:40                                             ` Gerd Möllmann
2024-12-18 21:06                       ` Stefan Kangas
2024-12-19  8:00                       ` Andrea Corallo
2024-12-11  9:39           ` martin rudalics
2024-10-22  7:34 ` Dr. Arne Babenhauserheide
2024-10-22  7:49   ` Gerd Möllmann
2024-10-22  7:49   ` Eli Zaretskii
2024-10-22  8:01 ` Eli Zaretskii
2024-10-22  8:21   ` Gerd Möllmann
2024-10-22  8:57     ` Eli Zaretskii
2024-10-22  9:42     ` Eli Zaretskii
2024-10-22 10:23       ` Gerd Möllmann
2024-10-22 13:35         ` Eli Zaretskii
2024-10-22 13:43           ` Gerd Möllmann
2024-10-22 13:55             ` Eli Zaretskii
2024-10-22 14:02               ` Gerd Möllmann
2024-10-22 14:40                 ` Eli Zaretskii
2024-10-22 19:19                   ` Paul Eggert
2024-10-23  3:18                     ` Gerd Möllmann
2024-10-22 10:43       ` Gerd Möllmann
2024-10-23  3:05 ` Feng Shu
2024-10-23  3:13   ` Gerd Möllmann
2024-10-23  3:25     ` Feng Shu
2024-10-23  3:36       ` Gerd Möllmann
2024-10-23  3:44         ` Feng Shu
2024-10-23  4:09           ` Gerd Möllmann
2024-10-23  4:40             ` Gerd Möllmann
2024-10-23  5:00               ` Gerd Möllmann
2024-10-23  7:49                 ` Eli Zaretskii
2024-10-23  8:12                   ` Gerd Möllmann
2024-10-23 11:04                   ` Gerd Möllmann
2024-10-23 17:23                     ` Eli Zaretskii
2024-10-23 17:52                       ` Gerd Möllmann
2024-10-23  6:54               ` Feng Shu
2024-10-23  7:25                 ` Gerd Möllmann
2024-10-23  7:28               ` Eli Zaretskii
2024-10-23  7:37                 ` Gerd Möllmann
2024-10-23  7:52                   ` Feng Shu
2024-10-23  8:07                     ` Gerd Möllmann
2024-10-23  9:07                       ` Feng Shu
2024-10-23  9:58                         ` Gerd Möllmann
2024-10-23  7:11   ` Eli Zaretskii
2024-10-26  8:15 ` Gerd Möllmann

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=m2wmfwqfq0.fsf@gmail.com \
    --to=gerd.moellmann@gmail.com \
    --cc=acorallo@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jared@finder.org \
    --cc=rudalics@gmx.at \
    --cc=stefankangas@gmail.com \
    /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).