Subject: Re: bug#20677: tooltips generate garbage

From: Eli Zaretskii <[email-masked]>
Date: Tue, 02 Jun 2015 19:02:23 +0300

> From: Michael Heerdegen <[email-masked]>
> Cc: Angelo Graziosi <[email-masked]>,  [email-masked]
> Date: Tue, 02 Jun 2015 17:31:55 +0200
> 
> I see this problem, too.  Quickly tested your questions with my
> configuration.

Thanks.

> > Does Emacs clean up the display if you type "M-x redraw-display RET"
> > after the tip pops down?
> 
> Yes.
> 
> >  What about covering the frame with the tip artifacts with another
> > frame, then uncovering it -- does the frame get redrawn automatically,
> > and does that remove the artifacts?
> 
> Yes, it does.  Switching to another frame also removes the artifacts.
> 
> > Finally, can you try setting x-gtk-use-system-tooltips to nil, and see
> > if that makes the problem go away?
> 
> Yes, that helps.

OK, so it seems my guess was correct: we don't redraw the portions of
display that were obscured by the tooltip.

> Reverting 7927a4 as suggested somewhere else in this thread also fixes
> the problem for me.

I don't understand this.  After reverting it, what does "git diff" say
about the differences between what you have and current master HEAD?
If it's just the diffs below (which is the reverse of what I see if I
type "git show 7927a4"), then how can the result work, when
x_clear_area now has this signature:

  void x_clear_area (struct frame *f, int x, int y, int width, int height);

IOW, reverting 7927a4 seems to cause us call x_clear_area with a wrong
argument list.  How does this even compile?  What am I missing?

diff --git a/src/xfns.c b/src/xfns.c
index 5ac58e9..16a568e 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1084,7 +1084,8 @@ struct x_display_info *
 	  y = FRAME_TOP_MARGIN_HEIGHT (f);
 
 	  block_input ();
-	  x_clear_area (f, 0, y, width, height);
+	  x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+			0, y, width, height);
 	  unblock_input ();
 	}
 
@@ -1095,8 +1094,7 @@ struct x_display_info *
 	  height = nlines * FRAME_LINE_HEIGHT (f) - y;
 
 	  block_input ();
-	  x_clear_area (f, 0, y, width, height);
+	  x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+			0, y, width, height);
 	  unblock_input ();
 	}