diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-03-31 20:31:39 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2005-03-31 20:31:39 +0000 |
| commit | 782abe6de6c801f48f98fe55a6a9b8626d7bd4ec (patch) | |
| tree | 42631bcd85eccc4b6e7eff2f9f06c6cbf6dd77c0 /src/Fl_Menu.cxx | |
| parent | 3ec9646eeadbfa63c5fdd975f36791852b1e2c37 (diff) | |
Added MacOS X monitor support.
Now use new screen_xywh() API for keeping things on the current screen.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4227 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Menu.cxx')
| -rw-r--r-- | src/Fl_Menu.cxx | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index a5b993db8..a88707f14 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -239,27 +239,10 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp, int menubar, int menubar_title, int right_edge) : Fl_Menu_Window(X, Y, Wp, Hp, 0) { - int scr_right = Fl::x() + Fl::w(); - int scr_x = Fl::x(); -#ifdef __APPLE__ - GDHandle gd = 0L; - for ( gd = GetDeviceList(); gd; gd = GetNextDevice(gd) ) { - GDPtr gp = *gd; - if ( X >= gp->gdRect.left && X <= gp->gdRect.right - && Y >= gp->gdRect.top && Y <= gp->gdRect.bottom) - break; - } - if ( !gd ) gd = GetMainDevice(); - if ( gd ) { - // since the menu pops over everything, we use the screen - // bounds, right across the dock and menu bar - GDPtr gp = *gd; - scr_right = gp->gdRect.right; - scr_x = gp->gdRect.left; - } -#endif + int scr_x, scr_y, scr_w, scr_h; - if (!right_edge) right_edge = scr_right; + Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h); + if (!right_edge || right_edge > scr_x+scr_w) right_edge = scr_x+scr_w; end(); set_modal(); @@ -315,7 +298,7 @@ menuwindow::menuwindow(const Fl_Menu_Item* m, int X, int Y, int Wp, int Hp, if (Wp > W) W = Wp; if (Wtitle > W) W = Wtitle; - if (!Wp) {if (X < scr_x) X = scr_x; if (X > scr_right-W) X= right_edge-W;} + if (X < scr_x) X = scr_x; if (X > scr_x+scr_w-W) X= scr_x+scr_w-W; x(X); w(W); h((numitems ? itemheight*numitems-LEADING : 0)+2*BW+3); if (selected >= 0) @@ -344,24 +327,10 @@ void menuwindow::position(int X, int Y) { // scroll so item i is visible on screen void menuwindow::autoscroll(int n) { - int scr_y = Fl::y(), scr_h = Fl::h(); + int scr_x, scr_y, scr_w, scr_h; int Y = y()+Fl::box_dx(box())+2+n*itemheight; -#ifdef __APPLE__ - GDHandle gd = 0L; - for ( gd = GetDeviceList(); gd; gd = GetNextDevice(gd) ) { - GDPtr gp = *gd; - if ( x() >= gp->gdRect.left && x() <= gp->gdRect.right - && Y >= gp->gdRect.top && Y <= gp->gdRect.bottom) - break; - } - if ( !gd ) gd = GetMainDevice(); - if ( gd ) { - // since the menu pops over everything, we use the screen - // bounds, right across the dock and menu bar - GDPtr gp = *gd; - scr_y = gp->gdRect.top; scr_h = gp->gdRect.bottom - gp->gdRect.top + 1; - } -#endif + + Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h); if (Y <= scr_y) Y = scr_y-Y+10; else { Y = Y+itemheight-scr_h-scr_y; |
