From ec2a5e3a1908f42e41a3bdafd3eb77f1f5f51370 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 24 Jan 1999 15:27:35 +0000 Subject: [PATCH] Patch from Bill to allow users to click outside a menu to hide it without making a selection. git-svn-id: file:///fltk/svn/fltk/trunk@238 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Menu.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index 0f874a0db..b96cd57a7 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Menu.cxx,v 1.13 1999/01/19 19:12:51 mike Exp $" +// "$Id: Fl_Menu.cxx,v 1.14 1999/01/24 15:27:35 mike Exp $" // // Menu code for the Fast Light Tool Kit (FLTK). // @@ -362,10 +362,9 @@ int menuwindow::find_selected(int mx, int my) { } return i; } - if (mx < 0 || mx >= w()) return -1; + if (mx < Fl::box_dx(box()) || mx >= w()) return -1; int i = (my-Fl::box_dx(box())-1)/itemheight; - if (i>=numitems) i = numitems-1; - else if (i < 0) i = 0; + if (i < 0 || i>=numitems) return -1; return i; } @@ -709,5 +708,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const { } // -// End of "$Id: Fl_Menu.cxx,v 1.13 1999/01/19 19:12:51 mike Exp $". +// End of "$Id: Fl_Menu.cxx,v 1.14 1999/01/24 15:27:35 mike Exp $". //