From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: Closing popup causes mouse event Date: Tue, 18 Oct 2005 11:35:37 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <7072A90D-5D49-4D76-97B8-0E2A66EA54D0@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1129603051 5138 80.91.229.2 (18 Oct 2005 02:37:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Oct 2005 02:37:31 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 18 04:37:29 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ERhKw-0000te-IS for ged-emacs-devel@m.gmane.org; Tue, 18 Oct 2005 04:36:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ERhKv-00050r-UY for ged-emacs-devel@m.gmane.org; Mon, 17 Oct 2005 22:36:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ERhKH-0004gZ-85 for emacs-devel@gnu.org; Mon, 17 Oct 2005 22:35:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ERhKF-0004fO-T5 for emacs-devel@gnu.org; Mon, 17 Oct 2005 22:35:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ERhKF-0004f5-Fd for emacs-devel@gnu.org; Mon, 17 Oct 2005 22:35:39 -0400 Original-Received: from [133.82.132.2] (helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ERhKF-0000ME-06 for emacs-devel@gnu.org; Mon, 17 Oct 2005 22:35:39 -0400 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 85BE42CB0 for ; Tue, 18 Oct 2005 11:35:37 +0900 (JST) Original-To: emacs-devel@gnu.org In-Reply-To: User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) 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:44229 Archived-At: [The original report was posted to emacs-pretest-bug] >>>>> On Tue, 18 Oct 2005 11:03:35 +0900, YAMAMOTO Mitsuharu said: >>>>> On Sat, 15 Oct 2005 22:34:29 +0200, storm@cua.dk (Kim F. Storm) said: >> David Reitter writes: >>> When a popup menu is opened (for example with C-mouse-1 or >>> S-mouse-1) and closed by clicking somewhere else, it seems like an >>> extra mouse event is sent. >>> >>> This can cause the point to be set, the region to be removed or >>> extended and what not - all of which is undesirable and >>> unexpected. >> It does not happen for me (GNU/Linux X11 non-GTK build). > The problem is Mac-specific. The following small patch seems to > work for this particular case, but the general case is not so easy. > (Repeated clicks of C-mouse-1 at non-menu position will show the > message ` is undefined' on the Carbon port.) I'll write > something about this to emacs-devel. A fix for "the general case" may require some changes to the platform-independent part. Let me explain the situation first. Suppose we have a mouse-down event followed by a mouse-up event in the main event queue of the window system, and the mouse-down event will activate a pop-up menu. The mouse-down event should be processed by the read_socket_hook function to generate a Lisp-level event, but the mouse-up event should be processed by another event loop for the pop-up menu (e.g., PopUpMenuSelect for the Carbon port) and it should not be read by the read_socket_hook function. It is easy to quit the loop inside the read_socket_hook function once a mouse-down event has been read. But there's another loop in the caller side, i.e., read_avail_input in keyboard.c: while (nr = (*read_socket_hook) (input_fd, expected, &hold_quit), nr > 0) { nread += nr; expected = 0; } I'm not sure why it should loop. Is it OK to replace these lines with the following one? nread = (*read_socket_hook) (input_fd, expected, &hold_quit); Unfortunately, the above change is not sufficient. The mouse-up event might be read by the read_socket_hook function through the asynchronous input processing before the pop-up menu is activated. I think the situation is not so different also on other window systems. Are other ports doing something special to avoid such a situation? YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp