From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Bug in incremental undrawing of mouseover highlighting Date: Fri, 19 Jan 2007 10:33:14 -0500 Message-ID: <87zm8fqbet.fsf@stupidchicken.com> References: <17760.56196.739515.442009@rgrjr.dyndns.org> <17809.61256.755032.818918@rgrjr.dyndns.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1169220836 23359 80.91.229.12 (19 Jan 2007 15:33:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Jan 2007 15:33:56 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 19 16:33:53 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H7vkQ-0002d3-V7 for ged-emacs-devel@m.gmane.org; Fri, 19 Jan 2007 16:33:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7vkQ-0006Ar-Gk for ged-emacs-devel@m.gmane.org; Fri, 19 Jan 2007 10:33:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H7vkF-0006Ad-PT for emacs-devel@gnu.org; Fri, 19 Jan 2007 10:33:35 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7vkF-0006AT-Aq for emacs-devel@gnu.org; Fri, 19 Jan 2007 10:33:35 -0500 Original-Received: from [18.72.1.2] (helo=south-station-annex.mit.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H7vkE-0001U7-9Z for emacs-devel@gnu.org; Fri, 19 Jan 2007 10:33:34 -0500 Original-Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by south-station-annex.mit.edu (8.13.6/8.9.2) with ESMTP id l0JFXScl028941; Fri, 19 Jan 2007 10:33:29 -0500 (EST) Original-Received: from outgoing-legacy.mit.edu (OUTGOING-LEGACY.MIT.EDU [18.7.22.104]) by central-city-carrier-station.mit.edu (8.13.6/8.9.2) with ESMTP id l0JFXFdR029548; Fri, 19 Jan 2007 10:33:16 -0500 (EST) Original-Received: from localhost (SYDNEYPACIFIC-FIVE-FIFTY-SIX.MIT.EDU [18.95.7.45]) ) by outgoing-legacy.mit.edu (8.13.6/8.12.4) with ESMTP id l0JFXEb1001571; Fri, 19 Jan 2007 10:33:15 -0500 (EST) Original-Received: from cyd by localhost with local (Exim 3.36 #1 (Debian)) id 1H7vju-00039y-00; Fri, 19 Jan 2007 10:33:14 -0500 Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Tue\, 02 Jan 2007 16\:46\:37 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) X-Scanned-By: MIMEDefang 2.42 X-Spam-Score: 2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:65302 Archived-At: 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,