From e99f41f03a97641ee05ba4a27f8b91c190f55df1 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 9 Jun 2022 21:48:19 +0800 Subject: [PATCH] Fix recalculation of `icon-title-format' after a frame is iconified Previously it would only happen upon the next mode line redisplay, meaning that just pressing C-z would not update the implicit title, since C-z doesn't cause a redisplay. * src/dispextern.h: Update prototypes. * src/frame.h (SET_FRAME_ICONIFIED): De-slugify. Call `gui_consider_frame_title', since `icon-title-format' might be different from the current frame title. * src/xdisp.c (gui_consider_frame_title): Export (also in dispextern.h). (bug#55850) --- src/dispextern.h | 1 + src/frame.h | 24 ++++++++++++++++++++++-- src/xdisp.c | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 910f630a50c..c7399ca2998 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3470,6 +3470,7 @@ extern void expose_frame (struct frame *, int, int, int, int); extern bool gui_intersect_rectangles (const Emacs_Rectangle *, const Emacs_Rectangle *, Emacs_Rectangle *); +extern void gui_consider_frame_title (Lisp_Object); #endif /* HAVE_WINDOW_SYSTEM */ extern void note_mouse_highlight (struct frame *, int, int); diff --git a/src/frame.h b/src/frame.h index a164853e09d..458b6257e49 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1293,8 +1293,28 @@ SET_FRAME_VISIBLE (struct frame *f, int v) } /* Set iconified status of frame F. */ -#define SET_FRAME_ICONIFIED(f, i) \ - (f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i)) +INLINE void +SET_FRAME_ICONIFIED (struct frame *f, int i) +{ +#ifdef HAVE_WINDOW_SYSTEM + Lisp_Object frame; +#endif + + eassert (0 <= (i) && (i) <= 1); + + f->iconified = i; + +#ifdef HAVE_WINDOW_SYSTEM + /* Iconifying a frame might cause the frame title to change if no + title was explicitly specified. Force the frame title to be + recomputed. */ + + XSETFRAME (frame, f); + + if (FRAME_WINDOW_P (f)) + gui_consider_frame_title (frame); +#endif +} extern Lisp_Object selected_frame; extern Lisp_Object old_selected_frame; diff --git a/src/xdisp.c b/src/xdisp.c index 07324815d90..2245326b0d8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13148,7 +13148,7 @@ store_mode_line_noprop (const char *string, int field_width, int precision) Vicon_title_format if FRAME is iconified, otherwise it is frame_title_format. */ -static void +void gui_consider_frame_title (Lisp_Object frame) { struct frame *f = XFRAME (frame); -- 2.39.2