From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: "Final" version of tty child frames Date: Thu, 19 Dec 2024 08:44:39 +0100 Message-ID: References: <86wmi0g0x6.fsf@gnu.org> <11a86987cce9fe0a257c3fa58703dc33@finder.org> <86wmgl6jzv.fsf@gnu.org> <092cb755eee3a9b5e06d15c0b07e90b1@finder.org> <276414b03c24964aaeb9e43e8dba5e77@finder.org> <5fedec86bce470555814acbdf999f99d@finder.org> <86h6791khk.fsf@gnu.org> <09b0904da92efad899865b2ece5f3116@finder.org> <86ikrhm6zk.fsf@gnu.org> <868qsdlzt5.fsf@gnu.org> <8634ikncv8.fsf@gnu.org> <2aeb4a5f1e76879b874c88618beff37f@finder.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8915"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , stefankangas@gmail.com, acorallo@gnu.org, emacs-devel@gnu.org, rudalics@gmx.at To: Jared Finder Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 19 08:45:44 2024 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 1tOBE7-0002AF-Ir for ged-emacs-devel@m.gmane-mx.org; Thu, 19 Dec 2024 08:45:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOBDE-00026s-Ry; Thu, 19 Dec 2024 02:44:48 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOBDB-00026X-Lx for emacs-devel@gnu.org; Thu, 19 Dec 2024 02:44:45 -0500 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOBD9-0001kL-Do; Thu, 19 Dec 2024 02:44:45 -0500 Original-Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5d3f65844deso678384a12.0; Wed, 18 Dec 2024 23:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734594281; x=1735199081; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=1zgIxLh5rNoB5WIgwI2b6+tcNd4peqolBY0gB9nMMe0=; b=KDiYWdcnhWdthRkLjkrTimTHyUXNVQU4Dwsn1giBvgBhYOTDRyl++ReQlx+wRkEtEO 3k9pCsQ74PPEZK4MpX7qNWwfxvvPhCaai+UKbaztMVZzcr4QrhpCPgcTsh8GdlNSDzaF wNKe2JXH7QYI7RT14n6rM89GQBq9nyodhvlCFgw3FwqurPMPCUt6QASGsFM6qNLgAxAX /MIs1CN6Pbxu0SBUPpGY/c7lUZJFPauU3j2dQDbp+D517Hgx81UByRFQXWG2DSjo5iNr 0UpM6a/b/gExEkz1Do9V+MPz50uojI9JwNDfULMpJiSVl8J1LHD5RDhFBPNyDujKMP+F 5JMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734594281; x=1735199081; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1zgIxLh5rNoB5WIgwI2b6+tc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AGHT+IGW3mr3gT5GvMVS3oEjZDCfrE1q+GPympNSdB7EZnQpsI2D5qxBoPrvncMYQrFvyVleyKAn4w== X-Received: by 2002:a17:906:e212:b0:aa6:8a1b:8b84 with SMTP id a640c23a62f3a-aabf4956e96mr525944966b.57.1734594280628; Wed, 18 Dec 2024 23:44:40 -0800 (PST) Original-Received: from pro2 (p200300e0b73f530035e1461ed45ebc64.dip0.t-ipconnect.de. [2003:e0:b73f:5300:35e1:461e:d45e:bc64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0f00ea44sm35512266b.135.2024.12.18.23.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 23:44:40 -0800 (PST) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?= =?utf-8?Q?s?= message of "Thu, 19 Dec 2024 06:30:23 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:326701 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Gerd M=C3=B6llmann writes: > Jared Finder writes: > >> On 2024-12-18 09:22, Gerd M=C3=B6llmann wrote: >>> Eli Zaretskii writes: >>>=20 >>>>> From: Gerd M=C3=B6llmann >>>>> 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=changelog.txt Content-Transfer-Encoding: quoted-printable Content-Description: whole change log 2024-12-19 Gerd M=C3=B6llmann * 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-curs= or. 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). --=-=-=--