From e29d98336b90729b1923725f8b9cfe9878b49587 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 21 Feb 2013 16:20:12 +0400 Subject: [PATCH] Ticket #2971: mouse click below non-droppeddown menubar activates menu box. How to reproduce: 1. Switch the "Drop down menus" option off. 2. Press F9 to activate menubar. Menu is not dropped. 3. Click somewhere below menubar, on one of the files in the directory listing. Buggy behavior: the corresponding "Left" or "File" etc. dropdown is opened, and the mouse button is released, menu item under the mouse cursor is activated. Correct behavior: clicking with the mouse somewhere other than the active menubar doesn't open dropdown menu, instead removes the focus from menubar and acts on the actual item under the mouse pointer (such as a filename in the panel). Signed-off-by: Andrew Borodin --- lib/widget/menu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/widget/menu.c b/lib/widget/menu.c index 0aa9445f6..10f6e0d06 100644 --- a/lib/widget/menu.c +++ b/lib/widget/menu.c @@ -2,11 +2,11 @@ Pulldown menu code Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2007, 2009, 2011, 2012 + 2007, 2009, 2011, 2012, 2013 The Free Software Foundation, Inc. Written by: - Andrew Borodin , 2012 + Andrew Borodin , 2012, 2013 This file is part of the Midnight Commander. @@ -652,6 +652,13 @@ menubar_event (Gpm_Event * event, void *data) if (!menubar->is_dropped) { + if (local.y > 1) + { + /* mouse click below menubar -- close menu and send focus to widget under mouse */ + menubar_finish (menubar); + return MOU_UNHANDLED; + } + menubar->previous_widget = dlg_get_current_widget_id (w->owner); menubar->is_active = TRUE; menubar->is_dropped = TRUE; -- 2.11.4.GIT