all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Bug in incremental undrawing of mouseover highlighting
Date: Fri, 19 Jan 2007 10:33:14 -0500	[thread overview]
Message-ID: <87zm8fqbet.fsf@stupidchicken.com> (raw)
In-Reply-To: <m3fyat4ejm.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Tue\, 02 Jan 2007 16\:46\:37 +0100")

I have an idea about the origin of the various mouse-highlighting bugs
recently discussed on this list.

When redisplay_window is called, we call try_window, try_window_id,
and/or try_window_reusing_current_matrix depending on some complicated
logic that I haven't fully digested.  The latter two functions take
care to call clear_mouse_face_window before changing the current
matrix, but try_window does not, which I think causes the
mouse-highlighting information to be clobbered.

I am not sure what the best fix is.  One possibility is to
call clear_window_mouse_face at various places before calling
try_window, if that step is necessary.  The following patch implements
the latter approach, and seems to fix both bugs I'm aware of (the M-x
shell bug and the M-x calendar bug).

Another possibility is to call clear_window_mouse_face at the start of
try_window.  This may be cleaner, but one the other hand it may not be
necessary to do this for all calls to try_window.

I don't know the code well enough to ensure that all possible
scenarios are handled, so could someone could look over this and
comment?

*** emacs/src/xdisp.c.~1.1136.~	2007-01-17 22:03:21.000000000 -0500
--- emacs/src/xdisp.c	2007-01-19 10:22:02.000000000 -0500
***************
*** 13003,13008 ****
--- 13003,13013 ----
        else if (CHARPOS (startp) > ZV)
  	SET_TEXT_POS (startp, ZV, ZV_BYTE);
  
+       /* Clear any existing mouse face before redisplay.  */
+       update_begin (f);
+       rif->clear_window_mouse_face (w);
+       update_end (f);
+ 
        /* Redisplay, then check if cursor has been set during the
  	 redisplay.  Give up if new fonts were loaded.  */
        val = try_window (window, startp, 1);
***************
*** 13177,13182 ****
--- 13182,13192 ----
  	       = try_window_reusing_current_matrix (w)))
  	{
  	  IF_DEBUG (debug_method_add (w, "1"));
+ 
+ 	  update_begin (f);
+ 	  rif->clear_window_mouse_face (w);
+ 	  update_end (f);
+ 
  	  if (try_window (window, startp, 1) < 0)
  	    /* -1 means we need to scroll.
  	       0 means we need new matrices, but fonts_changed_p
***************
*** 13230,13235 ****
--- 13240,13250 ----
        && CHARPOS (startp) >= BEGV
        && CHARPOS (startp) <= ZV)
      {
+       /* Clear any existing mouse face before scrolling.  */
+       update_begin (f);
+       rif->clear_window_mouse_face (w);
+       update_end (f);
+ 
        /* The function returns -1 if new fonts were loaded, 1 if
  	 successful, 0 if not successful.  */
        int rc = try_scrolling (window, just_this_one_p,

  parent reply	other threads:[~2007-01-19 15:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-19 22:32 Bug in incremental undrawing of mouseover highlighting Bob Rogers
2006-11-19 22:50 ` David Kastrup
2006-11-19 23:45   ` Bob Rogers
2006-12-13 14:45     ` Stephen Berman
2006-12-13 16:04       ` Chong Yidong
2006-12-14  9:22         ` Stephen Berman
2006-12-16 12:31           ` Stephen Berman
2006-11-20  4:20   ` Eli Zaretskii
2006-11-20 19:22 ` Chong Yidong
2006-11-20 20:24   ` misleading install instruction in emacs/mac/INSTALL Gilbert Harman
2006-11-21  7:47     ` Richard Stallman
2006-11-22  8:23       ` YAMAMOTO Mitsuharu
2006-11-22 17:07         ` Gilbert Harman
2006-11-20 20:36   ` Bug in incremental undrawing of mouseover highlighting Eli Zaretskii
2006-11-22  4:06     ` Bob Rogers
2006-11-22 18:35       ` Eli Zaretskii
2006-11-22 15:07     ` Chong Yidong
2006-11-22 22:20       ` Eli Zaretskii
2006-11-22 23:57         ` Nick Roberts
2006-11-23  4:12           ` Eli Zaretskii
2006-11-23  4:50             ` Nick Roberts
2006-11-24 18:18               ` Eli Zaretskii
2006-11-25  1:53   ` YAMAMOTO Mitsuharu
2006-11-25  4:18     ` Chong Yidong
2006-11-25  7:28       ` YAMAMOTO Mitsuharu
2006-11-25 10:53         ` Eli Zaretskii
2006-11-25 16:18           ` Chong Yidong
2006-11-25 21:10             ` Eli Zaretskii
2006-11-26 19:05               ` Kim F. Storm
2006-12-26  2:26 ` Richard Stallman
2006-12-27  3:58   ` Bob Rogers
2006-12-27 21:16     ` Richard Stallman
2007-01-02 15:46       ` Kim F. Storm
2007-01-05  0:38         ` Michael Mauger
2007-01-19 15:33         ` Chong Yidong [this message]
2007-01-20 21:40           ` Stephen Berman
2007-01-21 14:36             ` Stephen Berman
2007-11-07 22:18               ` Stephen Berman
2007-01-23 16:28           ` John Paul Wallington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zm8fqbet.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.