summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2005-11-28 15:54:48 +0000
committerMatthias Melcher <fltk@matthiasm.com>2005-11-28 15:54:48 +0000
commit3cae272e1fd8e267053ad906a6cde737e1e031e9 (patch)
tree69f1e1199d97ff7f671ffe23ad2aed0c03d8c77f /src
parent8cd25c4ecb436fc271d6ef06d0f4e105451d123f (diff)
Even better fullscreen code on OS X that resize a window to fit a single screen in multi screen setups. It still will not position over the main menu bar.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4668 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Window_fullscreen.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Fl_Window_fullscreen.cxx b/src/Fl_Window_fullscreen.cxx
index 698e806a5..de5cd0f5b 100644
--- a/src/Fl_Window_fullscreen.cxx
+++ b/src/Fl_Window_fullscreen.cxx
@@ -69,8 +69,15 @@ void Fl_Window::fullscreen() {
border(0);
#endif
#ifdef __APPLE__
- if (x()==Fl::x()) x(x()+1); // force it to call ResizeWindow()
- resize(Fl::x(),Fl::y(),Fl::w(),Fl::h());
+ int sx, sy, sw, sh;
+ Fl::screen_xywh(sx, sy, sw, sh, x()+w()/2, y()+h()/2);
+ // if we are on the main screen, we will leave the system menu bar unobstructed
+ if (Fl::x()>=sx && Fl::y()>=sy && Fl::x()+Fl::w()<=sx+sw && Fl::y()+Fl::h()<=sy+sh) {
+ sx = Fl::x(); sy = Fl::y();
+ sw = Fl::w(); sh = Fl::h();
+ }
+ if (x()==sx) x(sx+1); // make sure that we actually execute the resize
+ resize(sx, sy, sw, sh);
#else
if (!x()) x(1); // force it to call XResizeWindow()
resize(0,0,Fl::w(),Fl::h());