From 844b8949a71f180d395a237c768b22d91cf91ded Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 13 Apr 2021 23:55:47 -0400 Subject: [PATCH] * src/xdisp.c (wset_update_mode_line): Move from `src/window.c` Move that function next to its siblings. Also simplify it, since after careful analysis it is now clear that the frame's title's update is already handled elsewhere (in `prepare_menu_bars` and `redisplay_window`) so we just need to make sure the `redisplay` bit is set. * src/window.c (wset_update_mode_line): Move to `src/xdisp.c`. * src/window.h (wset_update_mode_line): Declare. --- src/window.c | 14 -------------- src/window.h | 1 + src/xdisp.c | 12 ++++++++++++ 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/window.c b/src/window.c index 4d5c7e763ec..caf9df6c138 100644 --- a/src/window.c +++ b/src/window.c @@ -215,20 +215,6 @@ wset_combination (struct window *w, bool horflag, Lisp_Object val) w->horizontal = horflag; } -static void -wset_update_mode_line (struct window *w) -{ - /* If this window is the selected window on its frame, set the - global variable update_mode_lines, so that gui_consider_frame_title - will consider this frame's title for redisplay. */ - Lisp_Object fselected_window = XFRAME (WINDOW_FRAME (w))->selected_window; - - if (WINDOWP (fselected_window) && XWINDOW (fselected_window) == w) - update_mode_lines = 42; - else - w->update_mode_line = true; -} - /* True if leaf window W doesn't reflect the actual state of displayed buffer due to its text or overlays change. */ diff --git a/src/window.h b/src/window.h index b6f88e8f55f..2400c422c15 100644 --- a/src/window.h +++ b/src/window.h @@ -1141,6 +1141,7 @@ extern void wset_redisplay (struct window *w); extern void fset_redisplay (struct frame *f); extern void bset_redisplay (struct buffer *b); extern void bset_update_mode_line (struct buffer *b); +extern void wset_update_mode_line (struct window *w); /* Call this to tell redisplay to look for other windows than selected-window that need to be redisplayed. Calling one of the *set_redisplay functions above already does it, so it's only needed in unusual cases. */ diff --git a/src/xdisp.c b/src/xdisp.c index 8f7180381b4..9e5516602b4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -869,6 +869,18 @@ bset_update_mode_line (struct buffer *b) b->text->redisplay = true; } +void +wset_update_mode_line (struct window *w) +{ + w->update_mode_line = true; + /* When a window's mode line needs to be updated, the window's frame's + title may also need to be updated, but we don't need to worry about it + here. Instead, `gui_consider_frame_title` is automatically called + whenever w->update_mode_line is set for that frame's selected window. + But for this to work reliably, we have to make sure the window + is considered, so we have to mark it for redisplay. */ + wset_redisplay (w); } + DEFUN ("set-buffer-redisplay", Fset_buffer_redisplay, Sset_buffer_redisplay, 4, 4, 0, doc: /* Mark the current buffer for redisplay. -- 2.39.2