Skip to content

Commit

Permalink
Detect XRender support
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10622 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
clbr committed Mar 16, 2015
1 parent fdab34b commit a6c4b29
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions FL/x.H
Expand Up @@ -161,6 +161,7 @@ public:
static void x(Fl_Window* wi, int X) {wi->x(X);}
static void y(Fl_Window* wi, int Y) {wi->y(Y);}
static int ewmh_supported();
static int xrender_supported();
static void activate_window(Window w);
};

Expand Down
8 changes: 8 additions & 0 deletions configh.in
Expand Up @@ -123,6 +123,14 @@

#define HAVE_XCURSOR 0

/*
* HAVE_XRENDER:
*
* Do we have the X render library?
*/

#define HAVE_XRENDER 0

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

dnl Check for the Xrender library unless disabled...
AC_ARG_ENABLE(xrender, [ --enable-xrender turn on Xrender support [[default=yes]]])

if test x$enable_xrender != xno; then
AC_CHECK_HEADER(X11/extensions/Xrender.h, AC_DEFINE(HAVE_XRENDER),,
[#include <X11/Xlib.h>])
AC_CHECK_LIB(Xrender, XRenderQueryVersion,
LIBS="-lXrender $LIBS")
fi

dnl Check for overlay visuals...
AC_PATH_PROG(XPROP, xprop)
AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
Expand Down
16 changes: 16 additions & 0 deletions src/Fl_x.cxx
Expand Up @@ -69,6 +69,9 @@ static bool have_xfixes = false;
# if HAVE_XCURSOR
# include <X11/Xcursor/Xcursor.h>
# endif
# if HAVE_XRENDER
# include <X11/extensions/Xrender.h>
# endif
static Fl_Xlib_Graphics_Driver fl_xlib_driver;
static Fl_Display_Device fl_xlib_display(&fl_xlib_driver);
Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display
Expand Down Expand Up @@ -2230,6 +2233,19 @@ int Fl_X::ewmh_supported() {
return result;
}

int Fl_X::xrender_supported() {
static int result = -1;

if (result == -1) {
fl_open_display();

int nop1, nop2;
result = XRenderQueryExtension(fl_display, &nop1, &nop2);
}

return result;
}

extern Fl_Window *fl_xfocus;

void Fl_X::activate_window(Window w) {
Expand Down

0 comments on commit a6c4b29

Please sign in to comment.