unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#447: last-nonmenu-event and sub-menus
@ 2008-06-18 23:06 ` Glenn Morris
  2009-01-12 10:05   ` bug#447: marked as done (last-nonmenu-event and sub-menus) Emacs bug Tracking System
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2008-06-18 23:06 UTC (permalink / raw)
  To: bug-gnu-emacs


last-nonmenu-event returns a bad value when submenus are involved.
This applies to 22.2 and the current CVS. As an example:

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.







^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#447: last-nonmenu-event and sub-menus
@ 2008-10-08 22:41 Chong Yidong
  2008-10-09 16:55 ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2008-10-08 22:41 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 447

> last-nonmenu-event returns a bad value when submenus are involved.
> This applies to 22.2 and the current CVS. As an example:
>
> 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 submenu, `bar' returns a bad result:
>
> bar :: #<window 7 on *Messages*>
>
> The window is wrong, etc.

Hi Glenn,

I can't seem to reproduce this now, using the latest Emacs CVS.  Maybe
it's been fixed in the meantime.  Do you still see this behavior?






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#447: last-nonmenu-event and sub-menus
  2008-10-08 22:41 bug#447: last-nonmenu-event and sub-menus Chong Yidong
@ 2008-10-09 16:55 ` Glenn Morris
  0 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2008-10-09 16:55 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 447

Chong Yidong wrote:

> I can't seem to reproduce this now, using the latest Emacs CVS.  Maybe
> it's been fixed in the meantime.  Do you still see this behavior?

I still see it. Do you see it with Emacs 22 even?






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#447: last-nonmenu-event and sub-menus
@ 2009-01-04 13:07 martin rudalics
  2009-01-09 20:01 ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2009-01-04 13:07 UTC (permalink / raw)
  To: 447

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

 > 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

[-- Attachment #2: keyboard.c.diff --]
[-- Type: text/plain, Size: 1234 bytes --]

*** 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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#447: last-nonmenu-event and sub-menus
  2009-01-04 13:07 martin rudalics
@ 2009-01-09 20:01 ` Glenn Morris
  0 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2009-01-09 20:01 UTC (permalink / raw)
  To: martin rudalics; +Cc: 447

martin rudalics wrote:

> 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.

Yes, it seems to fix the problem, thank you.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#447: marked as done (last-nonmenu-event and sub-menus)
  2008-06-18 23:06 ` bug#447: last-nonmenu-event and sub-menus Glenn Morris
@ 2009-01-12 10:05   ` Emacs bug Tracking System
  0 siblings, 0 replies; 6+ messages in thread
From: Emacs bug Tracking System @ 2009-01-12 10:05 UTC (permalink / raw)
  To: martin rudalics

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]


Your message dated Mon, 12 Jan 2009 10:58:44 +0100
with message-id <496B1454.4020409@gmx.at>
and subject line Re: last-nonmenu-event and sub-menus
has caused the Emacs bug report #447,
regarding last-nonmenu-event and sub-menus
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
447: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=447
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 3070 bytes --]

From: Glenn Morris <rgm@gnu.org>
To: bug-gnu-emacs@gnu.org
Subject: last-nonmenu-event and sub-menus
Date: Wed, 18 Jun 2008 19:06:54 -0400
Message-ID: <i9wskme41d.fsf@fencepost.gnu.org>


last-nonmenu-event returns a bad value when submenus are involved.
This applies to 22.2 and the current CVS. As an example:

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.




[-- Attachment #3: Type: message/rfc822, Size: 1625 bytes --]

From: martin rudalics <rudalics@gmx.at>
To: 447-done@emacsbugs.donarmstrong.com
Cc: Glenn Morris <rgm@gnu.org>
Subject: Re: last-nonmenu-event and sub-menus
Date: Mon, 12 Jan 2009 10:58:44 +0100
Message-ID: <496B1454.4020409@gmx.at>

Fixed as

	* keyboard.c (read_char): Fix case where last_nonmenu_event
	returned a bad value with submenus.  (Bug#447)

martin


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-12 10:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <496B1454.4020409@gmx.at>
2008-06-18 23:06 ` bug#447: last-nonmenu-event and sub-menus Glenn Morris
2009-01-12 10:05   ` bug#447: marked as done (last-nonmenu-event and sub-menus) Emacs bug Tracking System
2008-10-08 22:41 bug#447: last-nonmenu-event and sub-menus Chong Yidong
2008-10-09 16:55 ` Glenn Morris
  -- strict thread matches above, loose matches on Subject: below --
2009-01-04 13:07 martin rudalics
2009-01-09 20:01 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).