From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#6372: 24.0.50; C-mouse-1 activates region Date: Wed, 8 Aug 2012 11:39:17 -0700 Message-ID: References: <87liiujrpd.fsf@gnu.org> <8F41724E359B445C81DDA030FDFC18C6@us.oracle.com> <83hatiktul.fsf@gnu.org> <87r4sltury.fsf@gnu.org> <83mx2t733l.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1344451204 2195 80.91.229.3 (8 Aug 2012 18:40:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Aug 2012 18:40:04 +0000 (UTC) Cc: 6372@debbugs.gnu.org To: "'Eli Zaretskii'" , "'Chong Yidong'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 08 20:40:04 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SzBAm-0000zT-QH for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Aug 2012 20:40:01 +0200 Original-Received: from localhost ([::1]:48907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzBAm-00047x-0b for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Aug 2012 14:40:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzBAk-00047s-BU for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2012 14:39:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzBAj-0004O4-9P for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2012 14:39:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33271) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzBAj-0004Nz-5v for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2012 14:39:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SzBIY-0006oY-9u for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2012 14:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Aug 2012 18:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6372 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6372-submit@debbugs.gnu.org id=B6372.134445165226154 (code B ref 6372); Wed, 08 Aug 2012 18:48:02 +0000 Original-Received: (at 6372) by debbugs.gnu.org; 8 Aug 2012 18:47:32 +0000 Original-Received: from localhost ([127.0.0.1]:42817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SzBI3-0006nn-Mf for submit@debbugs.gnu.org; Wed, 08 Aug 2012 14:47:32 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:32930) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SzBI0-0006ne-Bj for 6372@debbugs.gnu.org; Wed, 08 Aug 2012 14:47:29 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q78IdJ5J025147 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 8 Aug 2012 18:39:20 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q78IdJQq007186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Aug 2012 18:39:19 GMT Original-Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q78IdItc026201; Wed, 8 Aug 2012 13:39:18 -0500 Original-Received: from dradamslap1 (/130.35.178.248) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 Aug 2012 11:39:18 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ac1nNdzcOEqfq24vQyuwFIIRFa/6lQOXyVow X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 In-Reply-To: <83mx2t733l.fsf@gnu.org> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62955 Archived-At: ping. > From: Eli Zaretskii Sent: Saturday, July 21, 2012 4:42 AM > I'm sorry, but it will take someone who knows more than I do about > MS-Windows messages and their processing to fix this one. I describe > my findings below in the hope that someone will pick up where I left > off. > > We track mouse events during pop-up menu by sending the > WM_EMACS_TRACKPOPUPMENU message to the Emacs message pump. This > message is handled by w32_wnd_proc around line 3770 of w32fns.c. > There, we call TrackPopupMenu, a Windows API that displays the menu > and returns the user selection of menu items. After TrackPopupMenu > returns, we remove any mouse events still in the message queue, by > calling PeekMessage with appropriate arguments, and return the user > selection to our caller, which is w32_menu_show. The user selection > returned is zero when the user closes the menu without selecting any > item, by clicking outside the menu. w32_menu_show then removes any > mouse events in the Emacs event queue by calling discard_mouse_events. > > What happens in this case, and is the reason for the bug, is that > somehow the mouse click event that pops down the menu is not delivered > to Emacs until _after_ w32_menu_show returns. That click is not > removed by PeekMessage mentioned above, and is not discarded by > discard_mouse_events. It is read by w32_wnd_proc only after all of > the above processing is complete, and any memory of the menu that was > popped down is gone. So Emacs processes that mouse click as a normal > event, oblivious to the fact that it actually happened as part of the > menu. > > What I don't understand here is why that mouse click is not delivered > when we call PeekMessage, so that it could be discarded. It's as if > Windows withholds that message from being put into the Emacs message > queue. Why is that, and what can we do to be able to peek at that > click message as part of menu processing and discard it, is beyond me.