Ecore now checks whether the composite extension is available before trying to open an ARGB window.

SVN revision: 31986
This commit is contained in:
tilman 2007-10-06 08:37:34 +00:00 committed by tilman
parent 4b4d4ca3b9
commit 75bd5e8902
10 changed files with 144 additions and 4 deletions

View File

@ -172,6 +172,11 @@ if test "x$want_ecore_x_xcb" = "xyes" ; then
[ have_ecore_x_xcb="no" ])
if test "x$have_ecore_x_xcb" = "xyes" ; then
PKG_CHECK_MODULES(XCB_COMPOSITE, xcb-composite,
[ have_ecore_x_xcb_composite="yes"
AC_DEFINE(ECORE_XCB_COMPOSITE, 1, [Build support for XCB composite]) ],
[ have_ecore_x_xcb_composite="no" ])
PKG_CHECK_MODULES(XCB_DAMAGE, xcb-damage,
[ have_ecore_x_xcb_damage="yes"
AC_DEFINE(ECORE_XCB_DAMAGE, 1, [Build support for XCB damage]) ],
@ -290,6 +295,7 @@ if test "x$have_ecore_x" = "xyes"; then
AC_SUBST(Xcursor_cflags)
AC_SUBST(Xcursor_libs)
ECORE_CHECK_X_EXTENSION([Xcomposite], [Xcomposite.h], [Xcomposite], [XCompositeQueryExtension])
ECORE_CHECK_X_EXTENSION([Xdamage], [Xdamage.h], [Xdamage], [XDamageSubtract])
ECORE_CHECK_X_EXTENSION([Xdpms], [dpms.h], [Xdpms], [DPMSQueryExtension])
if test "x$use_xdpms" = "xno" ; then
@ -910,9 +916,9 @@ echo " Ecore_Job....................: $have_ecore_job"
echo " Ecore_Con....................: $have_ecore_con (OpenSSL: $use_openssl) (CURL: $use_curl)"
echo " Ecore_Txt....................: $have_ecore_txt"
if test "x$have_ecore_x_xcb" = "xyes" ; then
echo " Ecore_X (XCB backend)........: $have_ecore_x_xcb (Xprint: $have_ecore_x_xcb_xprint) (Xinerama: $have_ecore_x_xcb_xinerama) (Xrandr: $have_ecore_x_xcb_randr) (Xscreensaver: $have_ecore_x_xcb_screensaver) (Xshape: $have_ecore_x_xcb_shape) (Xsync: $have_ecore_x_xcb_sync) (Xrender: $have_ecore_x_xcb_render) (Xfixes: $have_ecore_x_xcb_xfixes) (Xdamage: $have_ecore_x_xcb_damage) (Xdpms: $have_ecore_x_xcb_dpms)"
echo " Ecore_X (XCB backend)........: $have_ecore_x_xcb (Xprint: $have_ecore_x_xcb_xprint) (Xinerama: $have_ecore_x_xcb_xinerama) (Xrandr: $have_ecore_x_xcb_randr) (Xscreensaver: $have_ecore_x_xcb_screensaver) (Xshape: $have_ecore_x_xcb_shape) (Xsync: $have_ecore_x_xcb_sync) (Xrender: $have_ecore_x_xcb_render) (Xfixes: $have_ecore_x_xcb_xfixes) (Xcomposite: $have_ecore_x_xcb_composite) (Xdamage: $have_ecore_x_xcb_damage) (Xdpms: $have_ecore_x_xcb_dpms)"
else
echo " Ecore_X (Xlib backend).......: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_xprint) (Xinerama: $use_xinerama) (Xrandr: $use_xrandr) (Xscreensaver: $use_xss) (Xrender: $use_xrender) (Xfixes: $use_xfixes) (Xdamage: $use_xdamage) (Xdpms: $use_xdpms)"
echo " Ecore_X (Xlib backend).......: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_xprint) (Xinerama: $use_xinerama) (Xrandr: $use_xrandr) (Xscreensaver: $use_xss) (Xrender: $use_xrender) (Xcomposite: $use_xcomposite) (Xfixes: $use_xfixes) (Xdamage: $use_xdamage) (Xdpms: $use_xdpms)"
fi
echo " Ecore_Win32..................: $have_ecore_win32 (DirectDraw: ${have_ddraw}) (Direct3D: ${have_direct3d})"

View File

@ -1858,6 +1858,8 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
if (!einfo) return;
if (!ecore_x_composite_query()) return;
ee->shaped = 0;
ee->alpha = alpha;
ecore_x_window_del(ee->engine.x.win);
@ -1925,6 +1927,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
# endif /* HAVE_ECORE_X_XCB */
if (!einfo) return;
if (!ecore_x_composite_query()) return;
ee->shaped = 0;
ee->alpha = alpha;

View File

@ -1626,6 +1626,9 @@ EAPI void ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC
EAPI void ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window win, Ecore_X_Shape_Type type, int x_offset, int y_offset);
EAPI void ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, int x_origin, int y_origin);
/* XComposite Extension Support */
EAPI int ecore_x_composite_query(void);
/* XDamage Extension Support */
typedef Ecore_X_ID Ecore_X_Damage;

View File

@ -3,6 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in
if BUILD_ECORE_X_XCB
INCLUDES = \
@XCB_DAMAGE_CFLAGS@ \
@XCB_COMPOSITE_CFLAGS@ \
@XCB_DPMS_CFLAGS@ \
@XCB_RANDR_CFLAGS@ \
@XCB_RENDER_CFLAGS@ \
@ -21,6 +22,7 @@ else
INCLUDES = \
@Xcursor_cflags@ \
@XDAMAGE_CFLAGS@ \
@XCOMPOSITE_CFLAGS@ \
@XDPMS_CFLAGS@ \
@XFIXES_CFLAGS@ \
@XINERAMA_CFLAGS@ \
@ -51,6 +53,7 @@ libecore_x_la_SOURCES = \
ecore_xcb_atom.c \
ecore_xcb_cursor.c \
ecore_xcb_damage.c \
ecore_xcb_composite.c \
ecore_xcb_dnd.c \
ecore_xcb_dpms.c \
ecore_xcb_drawable.c \
@ -76,6 +79,7 @@ ecore_xcb_private.h
libecore_x_la_LIBADD = \
@XCB_DAMAGE_LIBS@ \
@XCB_COMPOSITE_LIBS@ \
@XCB_DPMS_LIBS@ \
@XCB_RANDR_LIBS@ \
@XCB_RENDER_LIBS@ \
@ -110,6 +114,7 @@ ecore_x_sync.c \
ecore_x_randr.c \
ecore_x_fixes.c \
ecore_x_damage.c \
ecore_x_composite.c \
ecore_x_error.c \
ecore_x_events.c \
ecore_x_icccm.c \
@ -132,6 +137,7 @@ ecore_x_private.h
libecore_x_la_LIBADD = \
@Xcursor_libs@ \
@XDAMAGE_LIBS@ \
@XCOMPOSITE_LIBS@ \
@XDPMS_LIBS@ \
@XFIXES_LIBS@ \
@XINERAMA_LIBS@ \
@ -159,6 +165,7 @@ ecore_x_sync.c \
ecore_x_randr.c \
ecore_x_fixes.c \
ecore_x_damage.c \
ecore_x_composite.c \
ecore_x_error.c \
ecore_x_events.c \
ecore_x_icccm.c \

View File

@ -438,6 +438,7 @@ ecore_x_init(const char *name)
_ecore_x_dnd_init();
_ecore_x_fixes_init();
_ecore_x_damage_init();
_ecore_x_composite_init();
_ecore_x_dpms_init();
_ecore_x_init_count++;

View File

@ -0,0 +1,27 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_x_private.h"
#include "Ecore_X.h"
static int _composite_available;
void
_ecore_x_composite_init(void)
{
_composite_available = 0;
#ifdef ECORE_XCOMPOSITE
int major, minor;
if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor))
_composite_available = 1;
#endif
}
EAPI int
ecore_x_composite_query(void)
{
return _composite_available;
}

View File

@ -40,6 +40,9 @@
#ifdef ECORE_XFIXES
#include <X11/extensions/Xfixes.h>
#endif
#ifdef ECORE_XCOMPOSITE
#include <X11/extensions/Xcomposite.h>
#endif
#ifdef ECORE_XDAMAGE
#include <X11/extensions/Xdamage.h>
#endif
@ -222,9 +225,10 @@ Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, char *data);
int _ecore_x_netwm_startup_info(Ecore_X_Window win, char *data);
/* Fixes * Damage * DPMS */
/* Fixes * Damage * Composite * DPMS */
void _ecore_x_fixes_init(void);
void _ecore_x_damage_init(void);
void _ecore_x_composite_init(void);
void _ecore_x_dpms_init(void);
/* from sync */

View File

@ -155,6 +155,9 @@ ecore_x_init(const char *name)
#ifdef ECORE_XCB_DAMAGE
const xcb_query_extension_reply_t *reply_damage;
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_COMPOSITE
const xcb_query_extension_reply_t *reply_composite;
#endif /* ECORE_XCB_COMPOSITE */
#ifdef ECORE_XCB_DPMS
const xcb_query_extension_reply_t *reply_dpms;
#endif /* ECORE_XCB_DPMS */
@ -219,6 +222,10 @@ ecore_x_init(const char *name)
xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_damage_id);
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_COMPOSITE
xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_composite_id);
#endif /* ECORE_XCB_COMPOSITE */
#ifdef ECORE_XCB_DPMS
xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_dpms_id);
#endif /* ECORE_XCB_DPMS */
@ -293,9 +300,13 @@ ecore_x_init(const char *name)
_ecore_xcb_event_handlers_num = _ecore_xcb_event_damage_id + 1;
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_COMPOSITE
reply_composite = xcb_get_extension_data(_ecore_xcb_conn, &xcb_composite_id);
#endif /* ECORE_XCB_COMPOSITE */
#ifdef ECORE_XCB_DPMS
reply_dpms = xcb_get_extension_data(_ecore_xcb_conn, &xcb_dpms_id);
#endif /* ECORE_XCB_DAMAGE */
#endif /* ECORE_XCB_DPMS */
#ifdef ECORE_XCB_RANDR
reply_randr = xcb_get_extension_data(_ecore_xcb_conn, &xcb_randr_id);
@ -359,6 +370,7 @@ ecore_x_init(const char *name)
/* We ask for the QueryVersion request of the extensions */
_ecore_x_damage_init(reply_damage);
_ecore_x_composite_init(reply_composite);
_ecore_x_dpms_init(reply_dpms);
_ecore_x_randr_init(reply_randr);
_ecore_x_shape_init(reply_shape);
@ -374,6 +386,7 @@ ecore_x_init(const char *name)
{
/* We get the replies of the QueryVersion request because we leave */
_ecore_x_damage_init_finalize();
_ecore_x_composite_init_finalize();
_ecore_x_dpms_init_finalize();
_ecore_x_randr_init_finalize();
_ecore_x_shape_init_finalize();
@ -553,6 +566,7 @@ ecore_x_init(const char *name)
{
/* We get the replies of the QueryVersion request because we leave */
_ecore_x_damage_init_finalize();
_ecore_x_composite_init_finalize();
_ecore_x_dpms_init_finalize();
_ecore_x_randr_init_finalize();
_ecore_x_shape_init_finalize();
@ -582,6 +596,7 @@ ecore_x_init(const char *name)
/* We finally get the replies of the QueryVersion request */
_ecore_x_damage_init_finalize();
_ecore_x_composite_init_finalize();
_ecore_x_dpms_init_finalize();
_ecore_x_randr_init_finalize();
_ecore_x_shape_init_finalize();

View File

@ -0,0 +1,68 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Composite_Group X Composite Extension Functions
*
* Functions related to the X Composite extension.
*/
#ifdef ECORE_XCB_COMPOSITE
static uint8_t _composite_available = 0;
static xcb_composite_query_version_cookie_t _ecore_xcb_composite_init_cookie;
#endif /* ECORE_XCB_COMPOSITE */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_composite_init and
_ecore_xcb_composite_init_finalize. The first one gets the cookies and
the second one gets the replies. */
void
_ecore_x_composite_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_COMPOSITE
if (reply && reply->present)
_ecore_xcb_composite_init_cookie = xcb_composite_query_version_unchecked(_ecore_xcb_conn, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
#endif /* ECORE_XCB_COMPOSITE */
}
void
_ecore_x_composite_init_finalize(void)
{
#ifdef ECORE_XCB_COMPOSITE
xcb_composite_query_version_reply_t *reply;
reply = xcb_composite_query_version_reply(_ecore_xcb_conn,
_ecore_xcb_composite_init_cookie,
NULL);
if (reply)
{
if (reply->major_version = XCB_COMPOSITE_MAJOR_VERSION &&
reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION)
_composite_available = 1;
free(reply);
}
#endif /* ECORE_XCB_COMPOSITE */
}
/**
* Return whether the Composite Extension is available.
* @return 1 if the Composite Extension is available, 0 if not.
*
* Return 1 if the X server supports the Composite Extension version 0.4
* or greater, 0 otherwise.
* @ingroup Ecore_X_Composite_Group
*/
EAPI int
ecore_x_composite_query(void)
{
#ifdef ECORE_XCB_COMPOSITE
return _composite_available;
#else
return 0;
#endif /* ECORE_XCB_COMPOSITE */
}

View File

@ -23,6 +23,9 @@
#ifdef ECORE_XCB_DAMAGE
# include <xcb/damage.h>
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_COMPOSITE
# include <xcb/composite.h>
#endif /* ECORE_XCB_COMPOSITE */
#ifdef ECORE_XCB_DPMS
# include <xcb/dpms.h>
#endif /* ECORE_XCB_DPMS */
@ -237,6 +240,9 @@ void _ecore_x_atom_init_finalize (xcb_intern_atom_cookie_t *);
void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_damage_init_finalize (void);
/* composite */
void _ecore_x_composite_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_composite_init_finalize (void);
/* from dnd */
void _ecore_x_dnd_init (void);