[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#447: last-nonmenu-event and sub-menus
From: |
martin rudalics |
Subject: |
bug#447: last-nonmenu-event and sub-menus |
Date: |
Sun, 04 Jan 2009 14:07:58 +0100 |
User-agent: |
Thunderbird 2.0.0.16 (Windows/20080708) |
> emacs -Q
>
> ;; Evaluate this code:
>
> (defun bar ()
> (interactive)
> (message "%s :: %s" last-nonmenu-event
> (posn-window (event-start last-nonmenu-event)))
> (sit-for 5))
>
> (global-set-key
> [down-mouse-2]
> '(menu-item "foo"
> (keymap "foo"
> (bar menu-item "bar" bar)
> (submenu menu-item "submenu"
> (keymap "submenu" (bar menu-item "bar" bar))))))
>
> C-x 2
> Put "scratch" in one window, "messages" in the other.
> Select "messages" window.
> Move mouse over "scratch", but do not select it.
> Press mouse-2, and select the "bar" menu-item.
>
>
> When called from the top-level menu, `bar' correctly returns:
>
> (down-mouse-2 (#<window 3 on *scratch*> 534 (251 . 101) 2649593899 nil
> 534 (27 . 6) nil (8 . 11) (9 . 15))) :: #<window 3 on *scratch*>
>
>
> When called from the submenu, `bar' returns a bad result:
>
> bar :: #<window 7 on *Messages*>
>
> The window is wrong, etc.
Glenn, just for fun please try the attached patch. It seems to solve
your problem here but I have no idea whether it has any detrimental
side-effects.
martin
*** keyboard.c.~1.986.~ 2009-01-03 17:35:34.328125000 +0100
--- keyboard.c 2009-01-04 13:59:34.328125000 +0100
***************
*** 2548,2553 ****
--- 2548,2555 ----
if (CONSP (Vunread_command_events))
{
+ int was_disabled = 0;
+
c = XCAR (Vunread_command_events);
Vunread_command_events = XCDR (Vunread_command_events);
***************
*** 2568,2579 ****
if (CONSP (c)
&& EQ (XCDR (c), Qdisabled)
&& (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
! c = XCAR (c);
/* If the queued event is something that used the mouse,
set used_mouse_menu accordingly. */
if (used_mouse_menu
! && (EQ (c, Qtool_bar) || EQ (c, Qmenu_bar)))
*used_mouse_menu = 1;
goto reread_for_input_method;
--- 2570,2584 ----
if (CONSP (c)
&& EQ (XCDR (c), Qdisabled)
&& (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
! {
! was_disabled = 1;
! c = XCAR (c);
! }
/* If the queued event is something that used the mouse,
set used_mouse_menu accordingly. */
if (used_mouse_menu
! && (EQ (c, Qtool_bar) || EQ (c, Qmenu_bar) || was_disabled))
*used_mouse_menu = 1;
goto reread_for_input_method;
- bug#447: last-nonmenu-event and sub-menus,
martin rudalics <=