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).
|
|
|
|
//
|
2010-11-29 00:06:39 +03:00
|
|
|
// Copyright 1998-2010 by Bill Spitzak and others.
|
1998-10-20 00:46:58 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
|
|
|
// http://www.fltk.org/COPYING.php
|
1998-10-20 00:46:58 +04:00
|
|
|
//
|
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.
|
|
|
|
|
2009-02-15 21:58:03 +03:00
|
|
|
// Unfortunately most X window managers ignore changes to the border
|
1998-10-06 22:21:25 +04:00
|
|
|
// 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>
|
|
|
|
|
2012-11-07 00:46:14 +04:00
|
|
|
#if FLTK_ABI_VERSION < 10301
|
2012-03-23 20:47:53 +04:00
|
|
|
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
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
void Fl_Window::border(int b) {
|
|
|
|
if (b) {
|
|
|
|
if (border()) return;
|
2009-09-27 16:06:35 +04:00
|
|
|
clear_flag(NOBORDER);
|
1998-10-06 22:21:25 +04:00
|
|
|
} else {
|
|
|
|
if (!border()) return;
|
2009-09-27 16:06:35 +04:00
|
|
|
set_flag(NOBORDER);
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
2012-03-23 20:47:53 +04:00
|
|
|
/* 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*.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void Fl_Window::fullscreen() {
|
2012-03-23 20:47:53 +04:00
|
|
|
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);
|
2005-11-28 18:54:48 +03:00
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void Fl_Window::fullscreen_off(int X,int Y,int W,int H) {
|
2012-03-23 20:47:53 +04:00
|
|
|
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;
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
|
|
|
|
2012-03-23 20:47:53 +04:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
//
|