From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#447: last-nonmenu-event and sub-menus Date: Sun, 04 Jan 2009 14:07:58 +0100 Message-ID: <4960B4AE.9070706@gmx.at> Reply-To: martin rudalics , 447@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060903040001000501010605" X-Trace: ger.gmane.org 1231075443 3056 80.91.229.12 (4 Jan 2009 13:24:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 4 Jan 2009 13:24:03 +0000 (UTC) To: 447@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 04 14:25:13 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LJSye-0003Q7-VZ for geb-bug-gnu-emacs@m.gmane.org; Sun, 04 Jan 2009 14:25:13 +0100 Original-Received: from localhost ([127.0.0.1]:57222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJSxO-0002V6-Fg for geb-bug-gnu-emacs@m.gmane.org; Sun, 04 Jan 2009 08:23:54 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LJSwz-0002Sf-Uy for bug-gnu-emacs@gnu.org; Sun, 04 Jan 2009 08:23:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LJSww-0002R8-Oj for bug-gnu-emacs@gnu.org; Sun, 04 Jan 2009 08:23:28 -0500 Original-Received: from [199.232.76.173] (port=55375 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJSww-0002Qb-23 for bug-gnu-emacs@gnu.org; Sun, 04 Jan 2009 08:23:26 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:45420) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LJSwv-0003nu-GU for bug-gnu-emacs@gnu.org; Sun, 04 Jan 2009 08:23:25 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n04DNNhp005213; Sun, 4 Jan 2009 05:23:23 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n04DK5Uj004213; Sun, 4 Jan 2009 05:20:05 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: martin rudalics Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 04 Jan 2009 13:20:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 447 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 447-submit@emacsbugs.donarmstrong.com id=B447.12310746712762 (code B ref 447); Sun, 04 Jan 2009 13:20:05 +0000 Original-Received: (at 447) by emacsbugs.donarmstrong.com; 4 Jan 2009 13:11:11 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id n04DB6q5002748 for <447@emacsbugs.donarmstrong.com>; Sun, 4 Jan 2009 05:11:08 -0800 Original-Received: (qmail invoked by alias); 04 Jan 2009 13:11:00 -0000 Original-Received: from 62-47-48-25.adsl.highway.telekom.at (EHLO [62.47.48.25]) [62.47.48.25] by mail.gmx.net (mp008) with SMTP; 04 Jan 2009 14:11:00 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19ts5tMk9dtH8ZZwqnjPimsnx87Bvoek4JCrbboRj gao315mf1oMMZ1 User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6,0.55 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Sun, 04 Jan 2009 08:23:28 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:23752 Archived-At: This is a multi-part message in MIME format. --------------060903040001000501010605 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > 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 (# 534 (251 . 101) 2649593899 nil > 534 (27 . 6) nil (8 . 11) (9 . 15))) :: # > > > When called from the submenu, `bar' returns a bad result: > > bar :: # > > 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 --------------060903040001000501010605 Content-Type: text/plain; name="keyboard.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="keyboard.c.diff" *** 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; --------------060903040001000501010605--