all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
Cc: jasonr@gnu.org, emacs-devel@gnu.org
Subject: Re: [drew.adams@oracle.com: mouse-2 on menu item yanks into current buffer]
Date: Sat, 11 Mar 2006 15:55:20 +0200	[thread overview]
Message-ID: <uveululvb.fsf@gnu.org> (raw)
In-Reply-To: <E1FG3wU-0000ga-I6@fencepost.gnu.org> (message from Richard Stallman on Sun, 05 Mar 2006 19:51:18 -0500)

> From: Richard Stallman <rms@gnu.org>
> 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" <drew.adams@oracle.com>
> To: "Emacs-Pretest-Bug" <emacs-pretest-bug@gnu.org>
> 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 ();

  parent reply	other threads:[~2006-03-11 13:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-06  0:51 [drew.adams@oracle.com: mouse-2 on menu item yanks into current buffer] Richard Stallman
2006-03-06  9:16 ` Kim F. Storm
2006-03-06 16:21   ` Drew Adams
2006-03-11 13:55 ` Eli Zaretskii [this message]
2006-03-11 14:43   ` Jason Rumney
2006-03-11 16:32     ` Eli Zaretskii
2006-03-11 17:28       ` [drew.adams@oracle.com: mouse-2 on menu item yanks into currentbuffer] Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uveululvb.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.