Skip to content

Commit

Permalink
Add configure and CMake checks for X11/Xregion.h.
Browse files Browse the repository at this point in the history
Configure and CMake now both check if X11/Xregion.h exists on the
build system and set HAVE_X11_XREGION_H in config.h accordingly.

src/Fl_Pixmap.cxx: modified to use the configure test as proposed by Manolo
in fltk.coredev on Dec 13 2015 in thread "Using X11 backend on OS X".


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10983 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Albrecht Schlosser committed Dec 30, 2015
1 parent bb4f485 commit 17c4817
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CMake/resources.cmake
Expand Up @@ -4,7 +4,7 @@
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
# Written by Michael Surette
#
# Copyright 1998-2010 by Bill Spitzak and others.
# Copyright 1998-2015 by Bill Spitzak and others.
#
# 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
Expand Down Expand Up @@ -39,6 +39,7 @@ find_file(HAVE_SYS_DIR_H sys/dir.h)
find_file(HAVE_SYS_NDIR_H sys/ndir.h)
find_file(HAVE_SYS_SELECT_H sys/select.h)
find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h)
find_file(HAVE_X11_XREGION_H X11/Xregion.h)
find_path(HAVE_XDBE_H Xdbe.h PATH_SUFFIXES X11/extensions extensions)

mark_as_advanced(HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H)
Expand Down
10 changes: 9 additions & 1 deletion configh.cmake.in
Expand Up @@ -4,7 +4,7 @@
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
*
* Copyright 1998-2010 by Bill Spitzak and others.
* Copyright 1998-2015 by Bill Spitzak and others.
*
* 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
Expand Down Expand Up @@ -123,6 +123,14 @@

#cmakedefine01 HAVE_XCURSOR

/*
* HAVE_X11_XREGION_H:
*
* Do we have the X11 Xregion.h header file ?
*/

#cmakedefine01 HAVE_X11_XREGION_H

/*
* __APPLE_QUARTZ__:
*
Expand Down
10 changes: 9 additions & 1 deletion configh.in
Expand Up @@ -4,7 +4,7 @@
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
*
* Copyright 1998-2010 by Bill Spitzak and others.
* Copyright 1998-2015 by Bill Spitzak and others.
*
* 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
Expand Down Expand Up @@ -131,6 +131,14 @@

#define HAVE_XRENDER 0

/*
* HAVE_X11_XREGION_H:
*
* Do we have the X11 Xregion.h header file ?
*/

#define HAVE_X11_XREGION_H 0

/*
* __APPLE_QUARTZ__:
*
Expand Down
4 changes: 4 additions & 0 deletions configure.in
Expand Up @@ -1046,6 +1046,10 @@ case $host_os_gui in
LIBS="-lXrender $LIBS")
fi

dnl Check for the X11/Xregion.h header file...
AC_CHECK_HEADER(X11/Xregion.h, AC_DEFINE(HAVE_X11_XREGION_H),,
[#include <X11/Xlib.h>])

dnl Check for overlay visuals...
AC_PATH_PROG(XPROP, xprop)
AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
Expand Down
10 changes: 5 additions & 5 deletions src/Fl_Pixmap.cxx
Expand Up @@ -33,7 +33,9 @@
#include <FL/Fl_Printer.H>

#if defined(USE_X11)
# ifdef __APPLE_CC__ // allows using on Darwin + X11 even if X11/Xregion.h is absent
# if HAVE_X11_XREGION_H
# include <X11/Xregion.h>
# else // if the X11/Xregion.h header is not available, we assume this is the layout of an X11 Region:
typedef struct {
short x1, x2, y1, y2;
} BOX;
Expand All @@ -43,10 +45,8 @@ struct _XRegion {
BOX *rects;
BOX extents;
};
# else
# include <X11/Xregion.h>
# endif
#endif
# endif // HAVE_X11_XREGION_H
#endif // USE_X11

#include <stdio.h>
#include "flstring.h"
Expand Down

0 comments on commit 17c4817

Please sign in to comment.