summaryrefslogtreecommitdiff
path: root/src/Fl_Menu.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-09-29 16:04:24 +0000
committerManolo Gouy <Manolo>2011-09-29 16:04:24 +0000
commitd9cda5c3aa48da9ef3238d993b34cde7047175d8 (patch)
tree751d1c5daa9c837444e53a2ed955dcfb2c6c302f /src/Fl_Menu.cxx
parentbc1b17056a44af5890cb2b5ec56cf9fbb72ccea4 (diff)
Fix STR#2695 & 2697: correct computation of work areas with multiple screens.
This introduces 3 new functions static void Fl::screen_work_area(X,Y,W,H) static void Fl::screen_work_area(X,Y,W,H,mx,my) static void Fl::screen_work_area(X,Y,W,H,screen_no) that compute screen work areas and are used by FLTK to position menu windows. The Fl::x(),y(),w(),h() functions are made consistent across platforms: they return the origin/size of the work area of the main screen (as far as possible, see below). On the Mac OS platform, all screen functions reflect changes in screen number and positions without requiring the application to restart. On the X11 platform, I did not find an API to compute the main screen work area in all conditions. What's used does compute the correct work area when there's a single screen, but not when there are several, because it returns an area that encompasses all screens. The implemented workaround is that Fl::x(),y(),w(),h() and Fl::screen_work_area(X,Y,W,H,0) return the exact work area when there's a single screen, and return the full screen area when there are several. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9084 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Menu.cxx')
-rw-r--r--src/Fl_Menu.cxx12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx
index 1162c0238..224645b95 100644
--- a/src/Fl_Menu.cxx
+++ b/src/Fl_Menu.cxx
@@ -276,13 +276,7 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp,
int scr_x, scr_y, scr_w, scr_h;
int tx = X, ty = Y;
- Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h);
-#ifdef __APPLE__
- scr_x = Fl::x();
- scr_w = Fl::w();
-#endif
- scr_y = Fl::y();
- scr_h = Fl::h();
+ Fl::screen_work_area(scr_x, scr_y, scr_w, scr_h);
if (!right_edge || right_edge > scr_x+scr_w) right_edge = scr_x+scr_w;
end();
@@ -417,8 +411,8 @@ void menuwindow::autoscroll(int n) {
int scr_y, scr_h;
int Y = y()+Fl::box_dx(box())+2+n*itemheight;
- scr_y = Fl::y();
- scr_h = Fl::h();
+ int xx, ww;
+ Fl::screen_work_area(xx, scr_y, ww, scr_h);
if (Y <= scr_y) Y = scr_y-Y+10;
else {
Y = Y+itemheight-scr_h-scr_y;