[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in incremental undrawing of mouseover highlighting

From: Chong Yidong
Subject: Re: Bug in incremental undrawing of mouseover highlighting
Date: Fri, 19 Jan 2007 10:33:14 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

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

*** 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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]