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} @vindex title@r{, a frame parameter}
@item title @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 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 of windows in that frame if @code{mode-line-frame-identification} uses
@samp{%F} (@pxref{%-Constructs}). This is normally the case when @samp{%F} (@pxref{%-Constructs}). This is normally the case when
Emacs is not using a window system, and can only display one frame at 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} @vindex name@r{, a frame parameter}
@item name @item name
The name of the frame. The frame name serves as a default for the frame The name of the frame. If you don't specify a name via this
title, if the @code{title} parameter is unspecified or @code{nil}. If parameter, Emacs sets the frame name automatically, as specified by
you don't specify a name, Emacs sets the frame name automatically @code{frame-title-format} and @code{icon-title-format}, and that is
(@pxref{Frame Titles}). 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 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 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. frame is redisplayed.
@defvar frame-title-format @defvar frame-title-format
This variable specifies how to compute a name for a frame when you have This variable specifies how to compute a name for a frame when you
not explicitly specified one. The variable's value is actually a mode 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 line construct, just like @code{mode-line-format}, except that the
@samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored. @xref{Mode Line @samp{%c}, @samp{%C}, and @samp{%l} constructs are ignored.
Data}. @xref{Mode Line Data}.
@end defvar @end defvar
@defvar icon-title-format @defvar icon-title-format
This variable specifies how to compute the name for an iconified frame, This variable specifies how to compute the name for an iconified frame
when you have not explicitly specified the frame title. This title when you have not explicitly specified the frame's name via the
appears in the icon itself. 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 @end defvar
@defvar multiple-frames @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 between 1 and 16, where 1 is the most recently deleted frame, undelete
the corresponding deleted frame. 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 ** Tab Bars and Tab Lines
--- ---

View file

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