summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-09-04 15:23:16 +0200
committerMatthias Melcher <github@matthiasm.com>2024-09-04 15:23:22 +0200
commit2b1f15084d32fd94b8acf964b141ab882c6c5867 (patch)
tree38282dc2579125bd8b397332e2b86de2252fc381
parentb595db30d46f9ace877540c073a7a3e7e423aaa7 (diff)
Fixes menubar glitch when mouse is at y==0 (#1060)
-rw-r--r--src/Fl_Menu.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index a3a1c82e6..b63f7d417 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -896,8 +896,14 @@ int menuwindow::handle_part1(int e) {
return 0;
}
}
- if (my == 0 && item > 0) setitem(mymenu, item - 1);
- else setitem(mymenu, item);
+ if ( (!pp.menubar) && (my == 0) && (item > 0) ) {
+ // Allow vertical scrolling when the mouse reaches the top of the screen.
+ // TODO: the top of many screens is not 0 (see Fl::screen_work_area
+ // and Fl::screen_xywh)
+ setitem(mymenu, item - 1);
+ } else {
+ setitem(mymenu, item);
+ }
if (e == FL_PUSH) {
if (pp.current_item && pp.current_item->submenu() // this is a menu title
&& item != pp.p[mymenu]->selected // and it is not already on