Subject: bug#19721: 25.0.50; Mode-line not redrawn with expose events

From: Eli Zaretskii <[email-masked]>
Date: Sat, 31 Jan 2015 12:53:37 +0200

> Date: Thu, 29 Jan 2015 19:51:24 +0900
> From: YAMAMOTO Mitsuharu <[email-masked]>
> 
> This bug is related to the mode-line erasure problem I mentioned in
> http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg01040.html .
> 
> To reproduce the problem by the instruction below, you would need to
> make sure that your X11 compositing manager is turned off.  I tested
> on Cent OS 5.11, default setting.  See also
> http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00600.html .
> 
> Steps to reproduce:
> 
> 1. Create a file (say, ~/test.el) containing the following contents:
> 
>   (custom-set-faces
>    '(mode-line ((((class color) (min-colors 88)) (:background
>      "grey75" :foreground "black" :box (:line-width 2 :color
>      "grey75" :style released-button)))))
>    )
> 
> 2. $ emacs -Q -D -l ~/test.el
> 3. C-x 2 C-x 2 C-x 2
> 4. C-x o C-x o C-x o
> 5. Move another window (e.g., the terminal window from which Emacs is
>    invoked) so that it hovers over the Emacs frame.
> 
> Result:
> 
> The upper two mode-lines among four are not redrawn after their hidden
> part is revealed (see the attachment).  They are not redrawn in
> response to expose events because the flag `enabled_p' for these
> mode-line glyph rows have been set to false.

Does the patch below fix the problem?

I cannot reproduce your recipe on the systems to which I have access,
so I used a slightly modified procedure and the dump-glyph-matrix
function to show what I think is the same issue: namely, in a frame
with 3 vertically-arranged windows, the window "after the selected
one" (in the next-window sense) has its mode-line row disabled in the
current glyph matrix.  That problem is solved by the patch below, but
I'm not sure it solves yours.

Thanks.

diff --git a/src/dispnew.c b/src/dispnew.c
index f73ea58..0b375dc 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -562,7 +562,8 @@ struct redisplay_history
 	      if (w->window_end_vpos >= i)
 		w->window_end_valid = 0;
 
-	      while (i < matrix->nrows)
+	      int nrows = matrix->nrows - WINDOW_WANTS_MODELINE_P (w);
+	      while (i < nrows)
 		matrix->rows[i++].enabled_p = false;
 	    }
 	  else