diff options
| author | Manolo Gouy <Manolo> | 2012-03-23 16:47:53 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2012-03-23 16:47:53 +0000 |
| commit | 08ce2e07d379d6b9925208b5da9323f948b634db (patch) | |
| tree | cff1ab07cf0952cec8c1cf874ba9bcc7b241a041 /src/Fl_Window_fullscreen.cxx | |
| parent | 8cd98f5236618f8ab9d576e709308b43246bc7ac (diff) | |
Fix STR#2641: true fullscreen windows that cover all their screen including menu bar, task bar, dock.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9299 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Window_fullscreen.cxx')
| -rw-r--r-- | src/Fl_Window_fullscreen.cxx | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/src/Fl_Window_fullscreen.cxx b/src/Fl_Window_fullscreen.cxx index b40986347..2cbf59788 100644 --- a/src/Fl_Window_fullscreen.cxx +++ b/src/Fl_Window_fullscreen.cxx @@ -31,6 +31,13 @@ #include <config.h> +#if FLTK_ABI_VERSION < 10302 +int Fl_Window::no_fullscreen_x = 0; +int Fl_Window::no_fullscreen_y = 0; +int Fl_Window::no_fullscreen_w = 0; +int Fl_Window::no_fullscreen_h = 0; +#endif + void Fl_Window::border(int b) { if (b) { if (border()) return; @@ -51,39 +58,44 @@ void Fl_Window::border(int b) { #endif } +/* Note: The previous implementation toggled border(). With this new + implementation this is not necessary. Additionally, if we do that, + the application may lose focus when switching out of fullscreen + mode with some window managers. Besides, the API does not say that + the FLTK border state should be toggled; it only says that the + borders should not be *visible*. +*/ void Fl_Window::fullscreen() { -#ifndef WIN32 - //this would clobber the fake wm, since it relies on the border flags to - //determine its thickness - border(0); -#endif -#if defined(__APPLE__) || defined(WIN32) || defined(USE_X11) - int sx, sy, sw, sh; - Fl::screen_xywh(sx, sy, sw, sh, x(), y(), w(), h()); - // 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(); + no_fullscreen_x = x(); + no_fullscreen_y = y(); + no_fullscreen_w = w(); + no_fullscreen_h = h(); + if (shown() && !(flags() & Fl_Widget::FULLSCREEN)) { + fullscreen_x(); + } else { + set_flag(FULLSCREEN); } - if (x()==sx) x(sx+1); // make sure that we actually execute the resize -#if defined(USE_X11) - resize(0, 0, w(), h()); // work around some quirks in X11 -#endif - resize(sx, sy, sw, sh); -#else - if (!x()) x(1); // make sure that we actually execute the resize - resize(0,0,Fl::w(),Fl::h()); -#endif } void Fl_Window::fullscreen_off(int X,int Y,int W,int H) { - // this order produces less blinking on IRIX: - resize(X,Y,W,H); -#ifndef WIN32 - border(1); -#endif + if (shown() && (flags() & Fl_Widget::FULLSCREEN)) { + fullscreen_off_x(X, Y, W, H); + } else { + clear_flag(FULLSCREEN); + } + no_fullscreen_x = no_fullscreen_y = no_fullscreen_w = no_fullscreen_h = 0; } +void Fl_Window::fullscreen_off() { + if (!no_fullscreen_x && !no_fullscreen_y) { + // Window was initially created fullscreen - default to current monitor + no_fullscreen_x = x(); + no_fullscreen_y = y(); + } + fullscreen_off(no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h); +} + + // // End of "$Id$". // |
