Fixes menu scrolling for secondary screens (#1060)
- huge menus would scroll down when the mouse pointer hit position 0, but for some secondary screens, the top edge is not at y==0, so now we check for a range a the top border of the working space of the screen showing the menu.
This commit is contained in:
parent
2b1f15084d
commit
d8eb45531e
@ -493,8 +493,11 @@ void menuwindow::autoscroll(int n) {
|
|||||||
|
|
||||||
int xx, ww;
|
int xx, ww;
|
||||||
Fl_Window_Driver::driver(this)->menu_window_area(xx, scr_y, ww, scr_h);
|
Fl_Window_Driver::driver(this)->menu_window_area(xx, scr_y, ww, scr_h);
|
||||||
if (Y <= scr_y) Y = scr_y-Y+10;
|
if (n==0 && Y <= scr_y + itemheight) {
|
||||||
else {
|
Y = scr_y - Y + 10;
|
||||||
|
} else if (Y <= scr_y + itemheight) {
|
||||||
|
Y = scr_y - Y + 10 + itemheight;
|
||||||
|
} else {
|
||||||
Y = Y+itemheight-scr_h-scr_y;
|
Y = Y+itemheight-scr_h-scr_y;
|
||||||
if (Y < 0) return;
|
if (Y < 0) return;
|
||||||
Y = -Y-10;
|
Y = -Y-10;
|
||||||
@ -896,14 +899,7 @@ int menuwindow::handle_part1(int e) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( (!pp.menubar) && (my == 0) && (item > 0) ) {
|
setitem(mymenu, item);
|
||||||
// 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 (e == FL_PUSH) {
|
||||||
if (pp.current_item && pp.current_item->submenu() // this is a menu title
|
if (pp.current_item && pp.current_item->submenu() // this is a menu title
|
||||||
&& item != pp.p[mymenu]->selected // and it is not already on
|
&& item != pp.p[mymenu]->selected // and it is not already on
|
||||||
|
Loading…
Reference in New Issue
Block a user