Allow 'icon-title-format' to have the value t

* src/xdisp.c (gui_consider_frame_title, syms_of_xdisp): If the
value of 'icon-title-format' is t, use 'frame-title-format'
instead.  (Bug#61496)

* etc/NEWS:
* doc/lispref/frames.texi (Frame Titles): Document the new
handling of the value t.
(Basic Parameters): Fix the documentation of the 'title' and
'name' frame parameters.
This commit is contained in:
Eli Zaretskii 2023-02-17 09:40:32 +02:00
parent f1f571e72a
commit b44a7ff85d
3 changed files with 41 additions and 17 deletions

View file

@ -1474,19 +1474,24 @@ in this frame. Its value is @code{color}, @code{grayscale} or
@vindex title@r{, a frame parameter}
@item title
If a frame has a non-@code{nil} title, it appears in the window
If a frame has a non-@code{nil} title, that title appears in the window
system's title bar at the top of the frame, and also in the mode line
of windows in that frame if @code{mode-line-frame-identification} uses
@samp{%F} (@pxref{%-Constructs}). This is normally the case when
Emacs is not using a window system, and can only display one frame at
a time. @xref{Frame Titles}.
a time. When Emacs is using a window system, this parameter, if
non-@code{nil}, overrides the title determined by the @code{name}
parameter and the implicit title calculated according to
@code{frame-title-format}. It also overrides the title determined by
@code{icon-title-format} for iconified frames. @xref{Frame Titles}.
@vindex name@r{, a frame parameter}
@item name
The name of the frame. The frame name serves as a default for the frame
title, if the @code{title} parameter is unspecified or @code{nil}. If
you don't specify a name, Emacs sets the frame name automatically
(@pxref{Frame Titles}).
The name of the frame. If you don't specify a name via this
parameter, Emacs sets the frame name automatically, as specified by
@code{frame-title-format} and @code{icon-title-format}, and that is
the frame's title that will appear on display when Emacs uses a window
system (unless the @code{title} parameter overrides it).
If you specify the frame name explicitly when you create the frame, the
name is also used (instead of the name of the Emacs executable) when
@ -2630,17 +2635,26 @@ frame name automatically based on a template stored in the variable
frame is redisplayed.
@defvar frame-title-format
This variable specifies how to compute a name for a frame when you have
not explicitly specified one. The variable's value is actually a mode
This variable specifies how to compute a name for a frame when you
have not explicitly specified one (via the frame's parameters;
@pxref{Basic Parameters}). The variable's value is actually a mode
line construct, just like @code{mode-line-format}, except that the
@samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored. @xref{Mode Line
Data}.
@samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored.
@xref{Mode Line Data}.
@end defvar
@defvar icon-title-format
This variable specifies how to compute the name for an iconified frame,
when you have not explicitly specified the frame title. This title
appears in the icon itself.
This variable specifies how to compute the name for an iconified frame
when you have not explicitly specified the frame's name via the
frame's parameters. The resulting title appears in the frame's icon
itself. If the value is a string, is should be a mode line construct
like that of @code{frame-title-format}. The value can also be
@code{t}, which means to use @code{frame-title-format} instead; this
avoids problems with some window managers and desktop environments,
where a change in a frame's title (when a frame is iconified) is
interpreted as a request to raise the frame and/or give it input
focus. The default is a string identical to the default value of
@code{frame-title-format}.
@end defvar
@defvar multiple-frames

View file

@ -1202,6 +1202,13 @@ the most recently deleted frame. With a numerical prefix argument
between 1 and 16, where 1 is the most recently deleted frame, undelete
the corresponding deleted frame.
+++
*** The variable 'icon-title-format' can now have the value t.
That value means to use 'frame-title-format' for iconified frames.
This is useful with some window managers and desktop environments
which treat changes in frame's title as requests to raise the frame
and/or give it input focus.
** Tab Bars and Tab Lines
---

View file

@ -13424,7 +13424,8 @@ gui_consider_frame_title (Lisp_Object frame)
Fselect_window (f->selected_window, Qt);
set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->contents));
fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;
fmt = (FRAME_ICONIFIED_P (f) && !EQ (Vicon_title_format, Qt)
? Vicon_title_format : Vframe_title_format);
mode_line_target = MODE_LINE_TITLE;
title_start = MODE_LINE_NOPROP_LEN (0);
@ -36608,9 +36609,11 @@ which no explicit name has been set (see `modify-frame-parameters'). */);
DEFVAR_LISP ("icon-title-format", Vicon_title_format,
doc: /* Template for displaying the title bar of an iconified frame.
\(Assuming the window manager supports this feature.)
This variable has the same structure as `mode-line-format' (which see),
and is used only on frames for which no explicit name has been set
\(see `modify-frame-parameters'). */);
If the value is a string, it should have the same structure
as `mode-line-format' (which see), and is used only on frames
for which no explicit name has been set \(see `modify-frame-parameters').
If the value is t, that means use `frame-title-format' for
iconified frames. */);
/* Do not nest calls to pure_list. This works around a bug in
Oracle Developer Studio 12.6. */
Lisp_Object icon_title_name_format