winex11.drv: Load the XComposite extension when available.

This commit is contained in:
Chris Robinson 2007-09-22 18:19:08 -07:00 committed by Alexandre Julliard
parent ffe54a884c
commit 4258465868
5 changed files with 220 additions and 0 deletions

89
configure vendored
View File

@ -9239,6 +9239,7 @@ fi
for ac_header in X11/Xlib.h \ for ac_header in X11/Xlib.h \
X11/XKBlib.h \ X11/XKBlib.h \
X11/Xutil.h \ X11/Xutil.h \
@ -9246,6 +9247,7 @@ for ac_header in X11/Xlib.h \
X11/extensions/shape.h \ X11/extensions/shape.h \
X11/extensions/XInput.h \ X11/extensions/XInput.h \
X11/extensions/XShm.h \ X11/extensions/XShm.h \
X11/extensions/Xcomposite.h \
X11/extensions/Xinerama.h \ X11/extensions/Xinerama.h \
X11/extensions/Xrandr.h \ X11/extensions/Xrandr.h \
X11/extensions/Xrender.h \ X11/extensions/Xrender.h \
@ -10197,6 +10199,93 @@ Wine will be built without Xinerama support. (winex11.drv)"
fi fi
if test "$ac_cv_header_X11_extensions_Xcomposite_h" = "yes"
then
{ echo "$as_me:$LINENO: checking for -lXcomposite" >&5
echo $ECHO_N "checking for -lXcomposite... $ECHO_C" >&6; }
if test "${ac_cv_lib_soname_Xcomposite+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-lXcomposite $X_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char XCompositeRedirectWindow ();
int
main ()
{
return XCompositeRedirectWindow ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
case "$LIBEXT" in
dll) ;;
dylib) ac_cv_lib_soname_Xcomposite=`otool -L conftest$ac_exeext | grep "libXcomposite\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libXcomposite\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_Xcomposite=`$ac_cv_path_LDD conftest$ac_exeext | grep "libXcomposite\\.$LIBEXT" | sed -e "s/^.*\(libXcomposite\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;;
esac
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_soname_save_LIBS
fi
if test "x$ac_cv_lib_soname_Xcomposite" = "x"; then
{ echo "$as_me:$LINENO: result: not found" >&5
echo "${ECHO_T}not found" >&6; }
else
{ echo "$as_me:$LINENO: result: $ac_cv_lib_soname_Xcomposite" >&5
echo "${ECHO_T}$ac_cv_lib_soname_Xcomposite" >&6; }
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBXCOMPOSITE "$ac_cv_lib_soname_Xcomposite"
_ACEOF
fi
fi
if test "x$ac_cv_lib_soname_Xcomposite" = "x"; then
wine_notices="$wine_notices|XComposite development files not found.
Wine will be built without XComposite support. (winex11.drv)"
fi
if test "x$with_opengl" != "xno" if test "x$with_opengl" != "xno"
then then

View File

@ -518,6 +518,7 @@ then
X11/extensions/shape.h \ X11/extensions/shape.h \
X11/extensions/XInput.h \ X11/extensions/XInput.h \
X11/extensions/XShm.h \ X11/extensions/XShm.h \
X11/extensions/Xcomposite.h \
X11/extensions/Xinerama.h \ X11/extensions/Xinerama.h \
X11/extensions/Xrandr.h \ X11/extensions/Xrandr.h \
X11/extensions/Xrender.h \ X11/extensions/Xrender.h \
@ -614,6 +615,14 @@ Wine will be built without XRandr support. (winex11.drv)])
WINE_NOTICE_IF([test "x$ac_cv_lib_soname_Xinerama" = "x"],[Xinerama development files not found. WINE_NOTICE_IF([test "x$ac_cv_lib_soname_Xinerama" = "x"],[Xinerama development files not found.
Wine will be built without Xinerama support. (winex11.drv)]) Wine will be built without Xinerama support. (winex11.drv)])
dnl *** Check for X Composite extension
if test "$ac_cv_header_X11_extensions_Xcomposite_h" = "yes"
then
WINE_CHECK_SONAME(Xcomposite,XCompositeRedirectWindow,,,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
fi
WINE_NOTICE_IF([test "x$ac_cv_lib_soname_Xcomposite" = "x"],[XComposite development files not found.
Wine will be built without XComposite support. (winex11.drv)])
dnl *** End of X11/Xlib.h check dnl *** End of X11/Xlib.h check
dnl Check for the presence of OpenGL dnl Check for the presence of OpenGL

View File

@ -20,6 +20,7 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h"
#include <fcntl.h> #include <fcntl.h>
#include <stdarg.h> #include <stdarg.h>
@ -48,8 +49,10 @@
#include "x11drv.h" #include "x11drv.h"
#include "xvidmode.h" #include "xvidmode.h"
#include "xrandr.h" #include "xrandr.h"
#include "xcomposite.h"
#include "wine/server.h" #include "wine/server.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/library.h"
WINE_DEFAULT_DEBUG_CHANNEL(x11drv); WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
WINE_DECLARE_DEBUG_CHANNEL(synchronous); WINE_DECLARE_DEBUG_CHANNEL(synchronous);
@ -73,6 +76,7 @@ Window root_window;
int dxgrab = 0; int dxgrab = 0;
int usexvidmode = 1; int usexvidmode = 1;
int usexrandr = 1; int usexrandr = 1;
int usexcomposite = 1;
int use_xkb = 1; int use_xkb = 1;
int use_take_focus = 1; int use_take_focus = 1;
int use_primary_selection = 0; int use_primary_selection = 0;
@ -370,6 +374,70 @@ static void setup_options(void)
if (hkey) RegCloseKey( hkey ); if (hkey) RegCloseKey( hkey );
} }
#ifdef SONAME_LIBXCOMPOSITE
#define MAKE_FUNCPTR(f) typeof(f) * p##f;
MAKE_FUNCPTR(XCompositeQueryExtension)
MAKE_FUNCPTR(XCompositeQueryVersion)
MAKE_FUNCPTR(XCompositeVersion)
MAKE_FUNCPTR(XCompositeRedirectWindow)
MAKE_FUNCPTR(XCompositeRedirectSubwindows)
MAKE_FUNCPTR(XCompositeUnredirectWindow)
MAKE_FUNCPTR(XCompositeUnredirectSubwindows)
MAKE_FUNCPTR(XCompositeCreateRegionFromBorderClip)
MAKE_FUNCPTR(XCompositeNameWindowPixmap)
MAKE_FUNCPTR(XCompositeGetOverlayWindow)
MAKE_FUNCPTR(XCompositeReleaseOverlayWindow)
#undef MAKE_FUNCPTR
static int xcomp_event_base;
static int xcomp_error_base;
static void X11DRV_XComposite_Init(void)
{
void *xcomposite_handle = wine_dlopen(SONAME_LIBXCOMPOSITE, RTLD_NOW, NULL, 0);
if (!xcomposite_handle)
{
TRACE("Unable to open %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE);
usexcomposite = 0;
return;
}
#define LOAD_FUNCPTR(f) \
if((p##f = wine_dlsym(xcomposite_handle, #f, NULL, 0)) == NULL) \
goto sym_not_found;
LOAD_FUNCPTR(XCompositeQueryExtension)
LOAD_FUNCPTR(XCompositeQueryVersion)
LOAD_FUNCPTR(XCompositeVersion)
LOAD_FUNCPTR(XCompositeRedirectWindow)
LOAD_FUNCPTR(XCompositeRedirectSubwindows)
LOAD_FUNCPTR(XCompositeUnredirectWindow)
LOAD_FUNCPTR(XCompositeUnredirectSubwindows)
LOAD_FUNCPTR(XCompositeCreateRegionFromBorderClip)
LOAD_FUNCPTR(XCompositeNameWindowPixmap)
LOAD_FUNCPTR(XCompositeGetOverlayWindow)
LOAD_FUNCPTR(XCompositeReleaseOverlayWindow)
#undef LOAD_FUNCPTR
if(!pXCompositeQueryExtension(gdi_display, &xcomp_event_base,
&xcomp_error_base)) {
TRACE("XComposite extension could not be queried; disabled\n");
wine_dlclose(xcomposite_handle, NULL, 0);
xcomposite_handle = NULL;
usexcomposite = 0;
return;
}
TRACE("XComposite is up and running error_base = %d\n", xcomp_error_base);
return;
sym_not_found:
TRACE("Unable to load function pointers from %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE);
wine_dlclose(xcomposite_handle, NULL, 0);
xcomposite_handle = NULL;
usexcomposite = 0;
}
#endif /* defined(SONAME_LIBXCOMPOSITE) */
/*********************************************************************** /***********************************************************************
* X11DRV process initialisation routine * X11DRV process initialisation routine
@ -442,6 +510,9 @@ static BOOL process_attach(void)
/* initialize XRandR */ /* initialize XRandR */
X11DRV_XRandR_Init(); X11DRV_XRandR_Init();
#endif #endif
#ifdef SONAME_LIBXCOMPOSITE
X11DRV_XComposite_Init();
#endif
X11DRV_ClipCursor( NULL ); X11DRV_ClipCursor( NULL );
X11DRV_InitKeyboard(); X11DRV_InitKeyboard();

View File

@ -0,0 +1,45 @@
/*
* Wine X11DRV XComposite interface
*
* Copyright 2007 Chris Robinson
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_XCOMPOSITE_H
#define __WINE_XCOMPOSITE_H
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif
#ifdef SONAME_LIBXCOMPOSITE
#include <X11/extensions/Xcomposite.h>
#define MAKE_FUNCPTR(f) extern typeof(f) * p##f;
MAKE_FUNCPTR(XCompositeQueryExtension)
MAKE_FUNCPTR(XCompositeQueryVersion)
MAKE_FUNCPTR(XCompositeVersion)
MAKE_FUNCPTR(XCompositeRedirectWindow)
MAKE_FUNCPTR(XCompositeRedirectSubwindows)
MAKE_FUNCPTR(XCompositeUnredirectWindow)
MAKE_FUNCPTR(XCompositeUnredirectSubwindows)
MAKE_FUNCPTR(XCompositeCreateRegionFromBorderClip)
MAKE_FUNCPTR(XCompositeNameWindowPixmap)
MAKE_FUNCPTR(XCompositeGetOverlayWindow)
MAKE_FUNCPTR(XCompositeReleaseOverlayWindow)
#undef MAKE_FUNCPTR
#endif /* defined(SONAME_LIBXCOMPOSITE) */
#endif /* __WINE_XCOMPOSITE_H */

View File

@ -888,6 +888,9 @@
/* Define to 1 if you have the <X11/extensions/shape.h> header file. */ /* Define to 1 if you have the <X11/extensions/shape.h> header file. */
#undef HAVE_X11_EXTENSIONS_SHAPE_H #undef HAVE_X11_EXTENSIONS_SHAPE_H
/* Define to 1 if you have the <X11/extensions/Xcomposite.h> header file. */
#undef HAVE_X11_EXTENSIONS_XCOMPOSITE_H
/* Define to 1 if you have the <X11/extensions/xf86vmode.h> header file. */ /* Define to 1 if you have the <X11/extensions/xf86vmode.h> header file. */
#undef HAVE_X11_EXTENSIONS_XF86VMODE_H #undef HAVE_X11_EXTENSIONS_XF86VMODE_H
@ -1014,6 +1017,9 @@
/* Define to the soname of the libX11 library. */ /* Define to the soname of the libX11 library. */
#undef SONAME_LIBX11 #undef SONAME_LIBX11
/* Define to the soname of the libXcomposite library. */
#undef SONAME_LIBXCOMPOSITE
/* Define to the soname of the libXcursor library. */ /* Define to the soname of the libXcursor library. */
#undef SONAME_LIBXCURSOR #undef SONAME_LIBXCURSOR