From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [drew.adams@oracle.com: mouse-2 on menu item yanks into current buffer] Date: Sat, 11 Mar 2006 15:55:20 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1142109620 9077 80.91.229.2 (11 Mar 2006 20:40:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Mar 2006 20:40:20 +0000 (UTC) Cc: jasonr@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 11 21:40:18 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FIAsm-0003K2-8S for ged-emacs-devel@m.gmane.org; Sat, 11 Mar 2006 21:40:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FIAsl-0004Rg-PM for ged-emacs-devel@m.gmane.org; Sat, 11 Mar 2006 15:40:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FI4ZE-00061s-Nt for emacs-devel@gnu.org; Sat, 11 Mar 2006 08:55:36 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FI4ZD-0005zG-95 for emacs-devel@gnu.org; Sat, 11 Mar 2006 08:55:36 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FI4ZC-0005yu-V4 for emacs-devel@gnu.org; Sat, 11 Mar 2006 08:55:34 -0500 Original-Received: from [192.114.186.17] (helo=gandalf.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FI4cZ-0004ow-Ba; Sat, 11 Mar 2006 08:59:03 -0500 Original-Received: from nitzan.inter.net.il (nitzan.inter.net.il [192.114.186.20]) by gandalf.inter.net.il (MOS 3.7.1-GA) with ESMTP id ICU03380; Sat, 11 Mar 2006 15:55:21 +0200 (IST) Original-Received: from HOME-C4E4A596F7 (IGLD-83-130-214-30.inter.net.il [83.130.214.30]) by nitzan.inter.net.il (MOS 3.7.3-GA) with ESMTP id CWG57566 (AUTH halo1); Sat, 11 Mar 2006 15:55:19 +0200 (IST) Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Sun, 05 Mar 2006 19:51:18 -0500) 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:51481 Archived-At: > From: Richard Stallman > Date: Sun, 05 Mar 2006 19:51:18 -0500 > > This does not happen on GNU/Linux, so I think it is a Windows-only bug. > > ------- Start of forwarded message ------- > From: "Drew Adams" > To: "Emacs-Pretest-Bug" > Date: Fri, 3 Mar 2006 20:56:47 -0800 > MIME-Version: 1.0 > Content-Type: text/plain; > charset="iso-8859-1" > Subject: mouse-2 on menu item yanks into current buffer > > emacs -q > > select some text, so it can be yanked > > open a menu-bar menu, and click mouse-2, instead of mouse-1, on any menu > item > > The mouse-2 command is executed in the current buffer. In a text > buffer, the copied text is yanked. In dired, the file on the curren > line is opened. > > This is a pernicious bug because: > > 1. It is easy to fall into, especially for newbies. > > 2. It is easy not to recognize that it has occurred - you must either > watch the buffer-modified flag in the mode line or the region > yanked must be big enough to be obvious. > > This bug is apparently old - it occurs in Emacs 20 also. Would Windows GUI gurus please look at the patch below and tell if it's the right one? It does seem to fix the problem for me (on Windows XP): Index: src/w32fns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/w32fns.c,v retrieving revision 1.262 diff -u -p -r1.262 w32fns.c --- src/w32fns.c 6 Feb 2006 15:23:22 -0000 1.262 +++ src/w32fns.c 11 Mar 2006 13:52:50 -0000 @@ -3127,8 +3127,13 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) /* Simulate middle mouse button events when left and right buttons are used together, but only if user has two button mouse. */ - case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: + /* Ignore right button as long as the menu is active. */ + f = x_window_to_frame (dpyinfo, hwnd); + if (f && f->output_data.w32->menubar_active) + return 0; + /* FALLTHROUGH */ + case WM_LBUTTONDOWN: if (w32_num_mouse_buttons > 2) goto handle_plain_button; @@ -3190,8 +3195,13 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) } return 0; - case WM_LBUTTONUP: case WM_RBUTTONUP: + /* Ignore right button as long as the menu is active. */ + f = x_window_to_frame (dpyinfo, hwnd); + if (f && f->output_data.w32->menubar_active) + return 0; + /* FALLTHROUGH */ + case WM_LBUTTONUP: if (w32_num_mouse_buttons > 2) goto handle_plain_button; @@ -3250,6 +3260,11 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) BOOL up; int button; + /* Ignore middle and extra buttons as long as the menu is active. */ + f = x_window_to_frame (dpyinfo, hwnd); + if (f && f->output_data.w32->menubar_active) + return 0; + if (parse_button (msg, HIWORD (wParam), &button, &up)) { if (up) ReleaseCapture ();