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_Window_hotspot.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_Window_hotspot.cxx')
| -rw-r--r-- | src/Fl_Window_hotspot.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Fl_Window_hotspot.cxx b/src/Fl_Window_hotspot.cxx index f9006df65..3a010174a 100644 --- a/src/Fl_Window_hotspot.cxx +++ b/src/Fl_Window_hotspot.cxx @@ -46,6 +46,9 @@ void Fl_Window::hotspot(int X, int Y, int offscreen) { //force FL_FORCE_POSITION to be set in Fl_Window::resize() if (X==x()) x(X-1); #else + int scr_x, scr_y, scr_w, scr_h; + Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h); + if (border()) { // Ensure border is on screen; these values are generic enough // to work with many window managers, and are based on KDE defaults. @@ -53,16 +56,16 @@ void Fl_Window::hotspot(int X, int Y, int offscreen) { const int left = 4; const int right = 4; const int bottom = 8; - if (X+w()+right > Fl::w()-Fl::x()) X = Fl::w()-Fl::x()-right-w(); - if (X-left < Fl::x()) X = left; - if (Y+h()+bottom > Fl::h()-Fl::y()) Y = Fl::h()-Fl::y()-bottom-h(); - if (Y-top < Fl::y()) Y = top; + if (X+w()+right > scr_w-scr_x) X = scr_w-scr_x-right-w(); + if (X-left < scr_x) X = left; + if (Y+h()+bottom > scr_h-scr_y) Y = scr_h-scr_y-bottom-h(); + if (Y-top < scr_y) Y = top; } // now insure contents are on-screen (more important than border): - if (X+w() > Fl::w()-Fl::x()) X = Fl::w()-Fl::x()-w(); - if (X < Fl::x()) X = Fl::x(); - if (Y+h() > Fl::h()-Fl::y()) Y = Fl::h()-Fl::y()-h(); - if (Y < Fl::y()) Y = Fl::y(); + if (X+w() > scr_w-scr_x) X = scr_w-scr_x-w(); + if (X < scr_x) X = scr_x; + if (Y+h() > scr_h-scr_y) Y = scr_h-scr_y-h(); + if (Y < scr_y) Y = scr_y; #endif } |
