diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-04-19 14:07:21 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-04-19 14:07:37 +0200 |
| commit | d01aab2ecec3c437300c292536ffa0e91e494d0f (patch) | |
| tree | e98050a51bb89b7fa897cb05d0d59859a88dea05 /test/list_visuals.cxx | |
| parent | 72901a626c47502b3ab660b8a67ec82698ebe56d (diff) | |
Replace list of excluded platforms by name of chosen platform.
Since FL/platform.H defines USE_X11 for the X11 platform, it's better to target
the X11 platform by
#include <FL/platform.H>
#if USE_X11
rather than by
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__)
that would have to grow with future platforms.
Diffstat (limited to 'test/list_visuals.cxx')
| -rw-r--r-- | test/list_visuals.cxx | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/test/list_visuals.cxx b/test/list_visuals.cxx index a21e80ede..8d66c3012 100644 --- a/test/list_visuals.cxx +++ b/test/list_visuals.cxx @@ -4,7 +4,7 @@ // List all the visuals on the screen, and dumps anything interesting // about them to stdout. // -// Does not use FLTK. +// Does not use FLTK under X11. // // This file may be #included in another program to make a function to // call to list the visuals. Fl.H must be included first to indicate this. @@ -22,22 +22,19 @@ // https://www.fltk.org/bugs.php // -#if defined(_WIN32) || defined(__APPLE__) -#include <FL/Fl.H> -#include <FL/fl_message.H> +#ifndef Fl_H +# define NEED_MAIN 1 // when not included by another FLTK program +#endif -int main(int, char**) { - fl_alert("Currently, this program works only under X."); - return 1; -} +#include <FL/platform.H> // for USE_X11 -#else +#if USE_X11 #include <config.h> #define HAVE_MULTIBUF 0 -#ifndef Fl_H +#ifdef NEED_MAIN #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -57,7 +54,7 @@ void fl_open_display() { fl_screen = DefaultScreen(fl_display); } -#endif +#endif // NEED_MAIN const char *ClassNames[] = { "StaticGray ", @@ -216,14 +213,25 @@ void list_visuals() { if ( overlayInfo ) { XFree(overlayInfo); overlayInfo = 0; } } -#endif +#endif // USE_X11 -#ifndef Fl_H -int main(int argc, char **argv) { +#ifdef NEED_MAIN + +# if ! USE_X11 +# include <FL/fl_ask.H> +# endif + +int main(int argc, char** argv) { +# if USE_X11 if (argc == 1); else if (argc == 2 && argv[1][0]!='-') dname = argv[1]; else {fprintf(stderr,"usage: %s <display>\n",argv[0]); exit(1);} list_visuals(); return 0; +# else + fl_alert("Currently, this program works only under X."); + return 1; +# endif // USE_X11 } -#endif + +#endif // NEED_MAIN |
