unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Jared Finder <jared@finder.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	gerd.moellmann@gmail.com, emacs-devel@gnu.org
Subject: Re: "Final" version of tty child frames
Date: Wed, 8 Jan 2025 10:56:31 +0100	[thread overview]
Message-ID: <19ca4d76-cd63-4abe-8c8d-ca85c4d15ef2@gmx.at> (raw)
In-Reply-To: <ad6e4bb60dc9d81d9f49c6ed28fb92df@finder.org>

 >> If you have the time, please also try to look into two issues I raised
 >> earlier:
 >>
 >>   Two further things I noticed: When point in the parent frame is
 >>   effectively hidden by the child frame, its cursor sometimes appears at
 >>   the right of the child frame and sometimes it's not shown.  I have not
 >>   understood the underlying principle for this behavior.  Also when the
 >>   selected region in the parent frame is active, its overlay covers the
 >>   child frame.  That's ugly.
 >
 > TTY child frame cursors behave even worse under GPM and a TERM=linux
 > terminal.  In this case, the cursor ends up on some lines always
 > appearing at the end of lines (ignoring separate frames or windows)
 > and sometimes in the right place.  The point position is correct
 > though and the cursor does appear correctly once I start pressing
 > simple keys like 'A'.

Both issues I raised above seem to be gone with master I pulled today.
Thanks for fixing them.

One thing I noticed is that with code like the following

(defvar tty-child-frame nil)
(defvar tty-child-buffer (get-buffer-create "*tty-child-buffer*"))
(defvar tty-child-window nil)

(defun tty-make-child-frame ()
   (interactive)
   (setq tty-child-frame
	(make-frame
	 `((parent-frame . ,(selected-frame))
	   (left . 20)
	   (top . 10)
	   (width . 0.3)
	   (height . 0.8)
	   (border-width . 0)
	   (background-color . "yellow")
	   (tool-bar-lines . 0)
	   (menu-bar-lines . 0)
	   (minibuffer . nil)
	   (no-special-glyphs . t)
	   )))
   (setq tty-child-window (frame-root-window tty-child-frame))
   (set-window-buffer tty-child-window tty-child-buffer)
   (set-face-background 'internal-border "blue" tty-child-frame)
   (set-face-background 'child-frame-border "blue" tty-child-frame))

(defun tty-toggle-child-frame ()
   (interactive)
   (if (frame-live-p tty-child-frame)
       (if (frame-visible-p tty-child-frame)
	  (make-frame-invisible tty-child-frame)
	(make-frame-visible tty-child-frame))
     (tty-make-child-frame)))

(defun tty-switch-to-child-frame ()
   (interactive)
   (if (frame-live-p tty-child-frame)
       (if (frame-visible-p tty-child-frame)
	  (if (eq tty-child-frame (selected-frame))
	      (select-frame-set-input-focus (frame-parent tty-child-frame))
	    (select-frame-set-input-focus tty-child-frame))
	(make-frame-visible tty-child-frame)
	(select-frame-set-input-focus tty-child-frame))
     (tty-make-child-frame)
     (select-frame-set-input-focus tty-child-frame)))

then when I first evaluate 'tty-toggle-child-frame' followed by
'tty-switch-to-child-frame' and I start typing I get an assertion
failure with a backtrace like the below

#0  terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at ../../src/emacs.c:432
#1  0x0000000000699b76 in die (msg=0x7dfc63 "FRAME_VISIBLE_P (root)", file=0x7df29f "../../src/dispnew.c", line=3962) at ../../src/alloc.c:8059
#2  0x0000000000427575 in combine_updates_for_frame (f=0x18662e0, inhibit_scrolling=false) at ../../src/dispnew.c:3962
#3  0x00000000004832fc in redisplay_internal () at ../../src/xdisp.c:17699
#4  0x0000000000483719 in redisplay_preserve_echo_area (from_where=8) at ../../src/xdisp.c:17835
#5  0x000000000060b715 in detect_input_pending_run_timers (do_display=true) at ../../src/keyboard.c:11579
#6  0x00000000007465d9 in wait_reading_process_output (time_limit=30, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0, just_wait_proc=0) at ../../src/process.c:5856
#7  0x0000000000430243 in sit_for (timeout=make_fixnum(30), reading=true, display_option=1) at ../../src/dispnew.c:6889
#8  0x00000000005f6383 in read_char (commandflag=1, map=XIL(0x7ff1fcdf4053), prev_event=XIL(0), used_mouse_menu=0x7ffc85a5703f, end_time=0x0) at ../../src/keyboard.c:2925
#9  0x00000000006097f3 in read_key_sequence (keybuf=0x7ffc85a571f0, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false, disable_text_conversion_p=false) at ../../src/keyboard.c:10746
#10 0x00000000005f1c46 in command_loop_1 () at ../../src/keyboard.c:1424
#11 0x00000000006d06e3 in internal_condition_case (bfun=0x5f1817 <command_loop_1>, handlers=XIL(0x90), hfun=0x5f0c99 <cmd_error>) at ../../src/eval.c:1607
#12 0x00000000005f13de in command_loop_2 (handlers=XIL(0x90)) at ../../src/keyboard.c:1163
#13 0x00000000006cfb39 in internal_catch (tag=XIL(0x122d0), func=0x5f13b4 <command_loop_2>, arg=XIL(0x90)) at ../../src/eval.c:1286
#14 0x00000000005f1370 in command_loop () at ../../src/keyboard.c:1141
#15 0x00000000005f073b in recursive_edit_1 () at ../../src/keyboard.c:749
#16 0x00000000005f0967 in Frecursive_edit () at ../../src/keyboard.c:832
#17 0x00000000005ec1cd in main (argc=5, argv=0x7ffc85a57828) at ../../src/emacs.c:2636

Lisp Backtrace:
"redisplay_internal (C function)" (0x0)

The cause is that my 'tty-make-child-frame' has

	 `((parent-frame . ,(selected-frame))
...
	   (minibuffer . nil)

but the consequences are completely unclear to me.  What happens is that
make_terminal_frame has this

	  if (EQ (mini, Qnone) || NILP (mini))
	    f = make_frame_without_minibuffer (Qnil, kb, Qnil);

which reenters make_terminal_frame and does

       if (FRAME_LIVE_P (root))
	SET_FRAME_VISIBLE (root, false);

for the old selected "root" frame.

What's the purpose of creating a new top frame without minibuffer here?
We end up with three frames - the initial one, the child frame and the
new root frame without minibuffer.  redisplay_internal eventually
detects here

       Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
       struct frame *mini_frame = XFRAME (WINDOW_FRAME (XWINDOW (mini_window)));

       if (mini_frame != sf)

that the mini_frame is not the selected frame

	{
	  XWINDOW (mini_window)->must_be_updated_p = true;
	  update_frame (mini_frame, false);
	  if (is_tty_frame (mini_frame))
	    combine_updates_for_frame (mini_frame, false);

and the call here crashes because mini_frame is the old root frame but
that frame's visibility has been set to false by the code above.

martin



  parent reply	other threads:[~2025-01-08  9:56 UTC|newest]

Thread overview: 194+ 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
2025-01-04 22:12                       ` Jared Finder
2025-01-05  4:03                         ` Gerd Möllmann
2025-01-05  7:07                         ` Eli Zaretskii
2025-01-06  0:05                           ` Jared Finder
2025-01-06  4:27                             ` Gerd Möllmann
2025-01-06 13:30                             ` Eli Zaretskii
2025-01-07  5:40                               ` Jared Finder
2025-01-07  7:36                                 ` 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
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
2025-01-04 22:09             ` Jared Finder
2025-01-05  3:48               ` Gerd Möllmann
2025-01-13  6:32                 ` Jared Finder
2025-01-13  7:13                   ` Gerd Möllmann
2025-01-13 13:13                   ` Eli Zaretskii
2025-01-14  9:11                   ` martin rudalics
2025-01-14  9:37                     ` Gerd Möllmann
2025-01-14  9:55                       ` martin rudalics
2025-01-14 10:12                         ` Gerd Möllmann
2025-01-14 13:58                         ` Eli Zaretskii
2025-01-14 17:33                           ` martin rudalics
2025-01-14 19:25                             ` Gerd Möllmann
2025-01-15  4:29                               ` Gerd Möllmann
2025-01-15  8:41                                 ` martin rudalics
2025-01-15  8:58                                   ` Gerd Möllmann
2025-01-15 15:29                                     ` Eli Zaretskii
2025-01-15 15:38                                       ` Gerd Möllmann
2025-01-15 15:27                                   ` Eli Zaretskii
2025-01-15 17:01                                     ` martin rudalics
2025-01-15 17:29                                       ` Gerd Möllmann
2025-01-15 17:35                                         ` Gerd Möllmann
2025-01-15 19:43                                       ` Eli Zaretskii
2025-01-16  4:35                                         ` Gerd Möllmann
2025-01-16  8:16                                           ` Eli Zaretskii
2025-01-16  8:42                                             ` Gerd Möllmann
2025-01-16  9:47                                               ` Eli Zaretskii
2025-01-16 10:22                                                 ` Gerd Möllmann
2025-01-16 11:24                                                   ` Eli Zaretskii
2025-01-16 10:02                                               ` martin rudalics
2025-01-16 10:23                                                 ` Gerd Möllmann
2025-01-16 10:50                                                   ` martin rudalics
2025-01-16 10:55                                                     ` Gerd Möllmann
2025-01-16 11:42                                                     ` Eli Zaretskii
2025-01-16 12:15                                                       ` Gerd Möllmann
2025-01-16 12:50                                                         ` Eli Zaretskii
2025-01-16 13:41                                                           ` Gerd Möllmann
2025-01-16 15:22                                                             ` Eli Zaretskii
2025-01-16 15:46                                                               ` Gerd Möllmann
2025-01-16 16:50                                                                 ` Eli Zaretskii
2025-01-16 18:00                                                                   ` martin rudalics
2025-01-16 19:05                                                                     ` Gerd Möllmann
2025-01-17  9:08                                                                       ` martin rudalics
2025-01-17  9:35                                                                         ` Gerd Möllmann
2025-01-17 12:29                                                                         ` Eli Zaretskii
2025-01-17 15:08                                                                           ` martin rudalics
2025-01-17 19:58                                                                             ` Eli Zaretskii
2025-01-18  9:04                                                                               ` martin rudalics
2025-01-18 11:40                                                                                 ` Eli Zaretskii
2025-01-16 19:22                                                                     ` Eli Zaretskii
2025-01-16 19:32                                                                       ` Gerd Möllmann
2025-01-16 19:55                                                                         ` Eli Zaretskii
2025-01-16 21:03                                                                           ` Gerd Möllmann
2025-01-17  6:48                                                                             ` Eli Zaretskii
2025-01-17  7:50                                                                               ` Gerd Möllmann
2025-01-17  8:34                                                                                 ` Eli Zaretskii
2025-01-17  8:50                                                                                   ` Gerd Möllmann
2025-01-17 12:14                                                                                     ` Eli Zaretskii
2025-01-17 13:21                                                                                       ` Eli Zaretskii
2025-01-17 15:14                                                                                         ` Gerd Möllmann
2025-01-17  9:09                                                                               ` martin rudalics
2025-01-17 12:44                                                                                 ` Eli Zaretskii
2025-01-17 15:09                                                                                   ` martin rudalics
2025-01-17 16:51                                                                                     ` Eli Zaretskii
2025-01-17 18:25                                                                                       ` martin rudalics
2025-01-17  9:09                                                                           ` martin rudalics
2025-01-17 12:40                                                                             ` Eli Zaretskii
2025-01-17 15:09                                                                               ` martin rudalics
2025-01-17 20:02                                                                                 ` Eli Zaretskii
2025-01-18  9:04                                                                                   ` martin rudalics
2025-01-18 11:53                                                                                     ` Eli Zaretskii
2025-01-17  9:08                                                                       ` martin rudalics
2025-01-17 12:26                                                                         ` Eli Zaretskii
2025-01-17 15:08                                                                           ` martin rudalics
2025-01-17 19:56                                                                             ` Eli Zaretskii
2025-01-18  9:03                                                                               ` martin rudalics
2025-01-16 11:19                                                 ` Eli Zaretskii
2025-01-14 20:29                             ` Eli Zaretskii
2025-01-14 13:38                       ` Eli Zaretskii
2025-01-05  6:46               ` Eli Zaretskii
2025-01-06  0:18                 ` Jared Finder
2025-01-06 13:35                   ` Eli Zaretskii
2025-01-08  9:56               ` martin rudalics [this message]
2025-01-08 10:29                 ` Gerd Möllmann
2025-01-09 10:24                   ` martin rudalics
2025-01-09 10:45                     ` Gerd Möllmann
2025-01-11 10:13                       ` martin rudalics
2025-01-11 12:52                         ` Gerd Möllmann
2025-01-11 17:23                           ` martin rudalics
2025-01-11 17:57                             ` Gerd Möllmann
2025-01-12  5:26                               ` Gerd Möllmann
2025-01-12  6:49                                 ` Gerd Möllmann
2025-01-12  7:36                                   ` Gerd Möllmann
2025-01-12  8:14                                     ` Eli Zaretskii
2025-01-12  8:27                                       ` martin rudalics
2025-01-12  8:59                                         ` Gerd Möllmann
2025-01-12  8:57                                       ` Gerd Möllmann
2025-01-12  8:22                                     ` martin rudalics
2025-01-12  9:03                                       ` Gerd Möllmann
2025-01-12  9:45                                         ` martin rudalics
2025-01-12 10:31                                           ` Gerd Möllmann
2025-01-14  9:11                                             ` martin rudalics
2025-01-14  9:25                                               ` Gerd Möllmann
2025-01-14  9:10                                         ` martin rudalics
2025-01-14  9:24                                           ` Gerd Möllmann
2025-01-11 10:51                       ` Eli Zaretskii
2025-01-11 15:55                         ` 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=19ca4d76-cd63-4abe-8c8d-ca85c4d15ef2@gmx.at \
    --to=rudalics@gmx.at \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=jared@finder.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 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).