emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: mouse-2 on menu item yanks into current buffer]


From: Eli Zaretskii
Subject: Re: address@hidden: mouse-2 on menu item yanks into current buffer]
Date: Sat, 11 Mar 2006 15:55:20 +0200

> From: Richard Stallman <address@hidden>
> 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" <address@hidden>
> To: "Emacs-Pretest-Bug" <address@hidden>
> 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 ();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]