1998-10-20 00:46:58 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// "$Id$"
|
1998-10-20 00:46:58 +04:00
|
|
|
//
|
|
|
|
// Fullscreen window support for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2008-09-16 11:26:22 +04:00
|
|
|
// Copyright 1998-2008 by Bill Spitzak and others.
|
1998-10-20 00:46:58 +04:00
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Library General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Library General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Library General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
// USA.
|
|
|
|
//
|
2005-04-16 04:13:17 +04:00
|
|
|
// Please report all bugs and problems on the following page:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/str.php
|
1998-10-20 00:46:58 +04:00
|
|
|
//
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// Turning the border on/off by changing the motif_wm_hints property
|
|
|
|
// works on Irix 4DWM. Does not appear to work for any other window
|
|
|
|
// manager. Fullscreen still works on some window managers (fvwm is one)
|
|
|
|
// because they allow the border to be placed off-screen.
|
|
|
|
|
|
|
|
// Unfortunatly most X window managers ignore changes to the border
|
|
|
|
// and refuse to position the border off-screen, so attempting to make
|
|
|
|
// the window full screen will lose the size of the border off the
|
|
|
|
// bottom and right.
|
|
|
|
|
|
|
|
#include <FL/Fl.H>
|
|
|
|
#include <FL/x.H>
|
|
|
|
|
2004-08-25 04:20:27 +04:00
|
|
|
#include <config.h>
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
void Fl_Window::border(int b) {
|
|
|
|
if (b) {
|
|
|
|
if (border()) return;
|
|
|
|
clear_flag(FL_NOBORDER);
|
|
|
|
} else {
|
|
|
|
if (!border()) return;
|
|
|
|
set_flag(FL_NOBORDER);
|
|
|
|
}
|
2008-10-14 03:10:43 +04:00
|
|
|
#if defined(USE_X11)
|
|
|
|
if (shown()) Fl_X::i(this)->sendxjunk();
|
|
|
|
#elif defined(WIN32)
|
1998-10-06 22:21:25 +04:00
|
|
|
// not yet implemented, but it's possible
|
|
|
|
// for full fullscreen we have to make the window topmost as well
|
2004-08-25 04:20:27 +04:00
|
|
|
#elif defined(__APPLE_QUARTZ__)
|
2004-09-01 02:00:49 +04:00
|
|
|
// warning: not implemented in Quartz/Carbon
|
1998-10-06 22:21:25 +04:00
|
|
|
#else
|
2008-10-14 03:10:43 +04:00
|
|
|
# error unsupported platform
|
1998-10-06 22:21:25 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void Fl_Window::fullscreen() {
|
1998-11-08 17:36:56 +03:00
|
|
|
#ifndef WIN32
|
|
|
|
//this would clobber the fake wm, since it relies on the border flags to
|
|
|
|
//determine its thickness
|
1998-10-06 22:21:25 +04:00
|
|
|
border(0);
|
1998-11-08 17:36:56 +03:00
|
|
|
#endif
|
2005-12-01 11:56:24 +03:00
|
|
|
#if defined(__APPLE__) || defined(WIN32)
|
2005-11-28 18:54:48 +03:00
|
|
|
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);
|
2005-11-28 18:41:39 +03:00
|
|
|
#else
|
1998-10-06 22:21:25 +04:00
|
|
|
if (!x()) x(1); // force it to call XResizeWindow()
|
|
|
|
resize(0,0,Fl::w(),Fl::h());
|
2005-11-28 18:41:39 +03:00
|
|
|
#endif
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
1998-11-08 17:36:56 +03:00
|
|
|
#ifndef WIN32
|
1998-10-06 22:21:25 +04:00
|
|
|
border(1);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
1998-10-20 00:46:58 +04:00
|
|
|
//
|
2005-02-25 00:55:12 +03:00
|
|
|
// End of "$Id$".
|
1998-10-20 00:46:58 +04:00
|
|
|
//
|