|
fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) ![]() |
00001 // 00002 // "$Id: Fl_Window_fullscreen.cxx 7903 2010-11-28 21:06:39Z matt $" 00003 // 00004 // Fullscreen window support for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 // Turning the border on/off by changing the motif_wm_hints property 00029 // works on Irix 4DWM. Does not appear to work for any other window 00030 // manager. Fullscreen still works on some window managers (fvwm is one) 00031 // because they allow the border to be placed off-screen. 00032 00033 // Unfortunately most X window managers ignore changes to the border 00034 // and refuse to position the border off-screen, so attempting to make 00035 // the window full screen will lose the size of the border off the 00036 // bottom and right. 00037 00038 #include <FL/Fl.H> 00039 #include <FL/x.H> 00040 00041 #include <config.h> 00042 00043 void Fl_Window::border(int b) { 00044 if (b) { 00045 if (border()) return; 00046 clear_flag(NOBORDER); 00047 } else { 00048 if (!border()) return; 00049 set_flag(NOBORDER); 00050 } 00051 #if defined(USE_X11) 00052 if (shown()) Fl_X::i(this)->sendxjunk(); 00053 #elif defined(WIN32) 00054 // not yet implemented, but it's possible 00055 // for full fullscreen we have to make the window topmost as well 00056 #elif defined(__APPLE_QUARTZ__) 00057 // warning: not implemented in Quartz/Carbon 00058 #else 00059 # error unsupported platform 00060 #endif 00061 } 00062 00063 void Fl_Window::fullscreen() { 00064 #ifndef WIN32 00065 //this would clobber the fake wm, since it relies on the border flags to 00066 //determine its thickness 00067 border(0); 00068 #endif 00069 #if defined(__APPLE__) || defined(WIN32) 00070 int sx, sy, sw, sh; 00071 Fl::screen_xywh(sx, sy, sw, sh, x()+w()/2, y()+h()/2); 00072 // if we are on the main screen, we will leave the system menu bar unobstructed 00073 if (Fl::x()>=sx && Fl::y()>=sy && Fl::x()+Fl::w()<=sx+sw && Fl::y()+Fl::h()<=sy+sh) { 00074 sx = Fl::x(); sy = Fl::y(); 00075 sw = Fl::w(); sh = Fl::h(); 00076 } 00077 if (x()==sx) x(sx+1); // make sure that we actually execute the resize 00078 resize(sx, sy, sw, sh); 00079 #else 00080 if (!x()) x(1); // force it to call XResizeWindow() 00081 resize(0,0,Fl::w(),Fl::h()); 00082 #endif 00083 } 00084 00085 void Fl_Window::fullscreen_off(int X,int Y,int W,int H) { 00086 // this order produces less blinking on IRIX: 00087 resize(X,Y,W,H); 00088 #ifndef WIN32 00089 border(1); 00090 #endif 00091 } 00092 00093 // 00094 // End of "$Id: Fl_Window_fullscreen.cxx 7903 2010-11-28 21:06:39Z matt $". 00095 //