emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about dubious code for terminal frames


From: Gerd Möllmann
Subject: Re: Question about dubious code for terminal frames
Date: Mon, 02 Sep 2024 14:59:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: martin rudalics <rudalics@gmx.at>
>> Date: Mon, 02 Sep 2024 11:04:02 +0200
>> 
>> In 3 places, among them adjust_frame_size, which is why I CC'd
>> Martin, Emacs sets the values of FrameRows/FrameCols.
>> 
>> AFAIU, these two values give the physical size of a terminal (screen,
>> window), as returned from the co and li escape sequences on termcap
>> frames. And I can't find code that tries to change the physical size of
>> the terminal, if that would even make sense in the first place :-). So
>> this doesn't make any sense to me.
>
> Did you consider SIGWINCH?  Its handler also calls adjust_frame_size.

Thanks, that would be this one, right?

static void
handle_window_change_signal (int sig)
{
  int width, height;
  struct tty_display_info *tty;

  /* The frame size change obviously applies to a single
     termcap-controlled terminal, but we can't decide which.
     Therefore, we resize the frames corresponding to each tty.
  */
  for (tty = tty_list; tty; tty = tty->next)
    {
      if (! tty->term_initted)
        continue;

      /* Suspended tty frames have tty->input == NULL avoid trying to
         use it.  */
      if (!tty->input)
        continue;

      get_tty_size (fileno (tty->input), &width, &height);

      if (width > 5 && height > 2)
        {
          Lisp_Object tail, frame;

          FOR_EACH_FRAME (tail, frame)
            {
              struct frame *f = XFRAME (frame);

              if (FRAME_TERMCAP_P (f) && FRAME_TTY (f) == tty)
                /* Record the new sizes, but don't reallocate the data
                   structures now.  Let that be done later outside of the
                   signal handler.  */
                change_frame_size (f, width, height, false, true, false);
            }
        }
    }
}

It also could know and set the terminal size, if get_tty_size can.

How complicated. I guess I rather work around this for now :-).

And I wonder if one could brew a make-frame with some suitable frame
parameters that lead to setting the terminal size to something that
leads to a later emacs_abort in cmcheckmagic during redisplay of another
frame on the same terminal :-).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]