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
|
|
|
//
|
|
|
|
// Display function for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2009-01-02 00:28:26 +03:00
|
|
|
// Copyright 1998-2009 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
|
|
|
|
|
|
|
// Startup method to set what display to use.
|
|
|
|
// Using setenv makes programs that are exec'd use the same display.
|
|
|
|
|
|
|
|
#include <FL/Fl.H>
|
|
|
|
#include <stdlib.h>
|
2002-04-11 15:52:43 +04:00
|
|
|
#include "flstring.h"
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2008-09-14 02:33:03 +04:00
|
|
|
/**
|
|
|
|
Sets the X display to use for all windows. Actually this just sets
|
|
|
|
the environment variable $DISPLAY to the passed string, so this only
|
|
|
|
works before you show() the first window or otherwise open the display,
|
|
|
|
and does nothing useful under WIN32.
|
|
|
|
*/
|
1998-10-06 22:21:25 +04:00
|
|
|
void Fl::display(const char *d) {
|
2001-12-20 17:41:44 +03:00
|
|
|
#if defined(__APPLE__) || defined(WIN32)
|
2001-11-27 20:44:08 +03:00
|
|
|
(void)d;
|
|
|
|
#else
|
2001-12-20 17:41:44 +03:00
|
|
|
static char e[1024];
|
1998-10-06 22:21:25 +04:00
|
|
|
strcpy(e,"DISPLAY=");
|
2002-05-16 16:47:44 +04:00
|
|
|
strlcat(e,d,sizeof(e));
|
2001-12-20 17:41:44 +03:00
|
|
|
for (char *c = e+8; *c!=':'; c++) {
|
|
|
|
if (!*c) {
|
2002-05-16 16:47:44 +04:00
|
|
|
strlcat(e,":0.0",sizeof(e));
|
2001-12-20 17:41:44 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1998-10-06 22:21:25 +04:00
|
|
|
putenv(e);
|
2001-11-27 20:44:08 +03:00
|
|
|
#endif // __APPLE__
|
1998-10-06 22:21:25 +04:00
|
|
|
}
|
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
|
|
|
//
|