Use local implementation of RegionDuplicate for older xserver

It was only added in xserver 1.15. Fixes build against older xserver.

Reported-by: Pali Rohár <pali.rohar@gmail.com>
(Ported from radeon commit 80cc892ee1ce54fad3cb7dd11bd9df18c359136f)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Michel Dänzer
2017-03-06 18:09:58 +09:00
committed by Michel Dänzer
parent cd73100114
commit 8d2b7d1758
2 changed files with 25 additions and 0 deletions

View File

@@ -152,6 +152,12 @@ else
fi
AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
AC_CHECK_DECL(RegionDuplicate,
[AC_DEFINE(HAVE_REGIONDUPLICATE, 1,
[Have RegionDuplicate API])], [],
[#include <xorg-server.h>
#include <regionstr.h>])
AC_CHECK_DECL(fbGlyphs,
[AC_DEFINE(HAVE_FBGLYPHS, 1, [Have fbGlyphs API])], [],
[#include <X11/Xmd.h>

View File

@@ -89,6 +89,25 @@
struct _SyncFence;
#ifndef HAVE_REGIONDUPLICATE
static inline RegionPtr
RegionDuplicate(RegionPtr pOld)
{
RegionPtr pNew;
pNew = RegionCreate(&pOld->extents, 0);
if (!pNew)
return NULL;
if (!RegionCopy(pNew, pOld)) {
RegionDestroy(pNew);
return NULL;
}
return pNew;
}
#endif
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif