changeset 101139:3ffd03438eeb

(read_char): Fix case where last_nonmenu_event returned a bad value with submenus. (Bug#447)
author Martin Rudalics <rudalics@gmx.at>
date Mon, 12 Jan 2009 09:21:15 +0000
parents 0138ae02cb0d
children d4a656ae8ace
files src/ChangeLog src/keyboard.c
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Jan 12 06:35:57 2009 +0000
+++ b/src/ChangeLog	Mon Jan 12 09:21:15 2009 +0000
@@ -1,3 +1,8 @@
+2009-01-12  Martin Rudalics  <rudalics@gmx.at>
+
+	* keyboard.c (read_char): Fix case where last_nonmenu_event
+	returned a bad value with submenus.  (Bug#447)
+
 2009-01-12  Chong Yidong  <cyd@stupidchicken.com>
 
 	* xfaces.c (Finternal_set_lisp_face_attribute): If setting the
--- a/src/keyboard.c	Mon Jan 12 06:35:57 2009 +0000
+++ b/src/keyboard.c	Mon Jan 12 09:21:15 2009 +0000
@@ -2547,6 +2547,8 @@
 
   if (CONSP (Vunread_command_events))
     {
+      int was_disabled = 0;
+
       c = XCAR (Vunread_command_events);
       Vunread_command_events = XCDR (Vunread_command_events);
 
@@ -2567,12 +2569,17 @@
       if (CONSP (c)
 	  && EQ (XCDR (c), Qdisabled)
 	  && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
-	c = 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)))
+	  /* Also check was_disabled so last-nonmenu-event won't return
+	     a bad value when submenus are involved.  (Bug#447)  */
+	  && (EQ (c, Qtool_bar) || EQ (c, Qmenu_bar) || was_disabled))
 	*used_mouse_menu = 1;
 
       goto reread_for_input_method;