diff --git a/configure.in b/configure.in index a8d913c24..a752c4718 100644 --- a/configure.in +++ b/configure.in @@ -143,6 +143,11 @@ AC_ARG_ENABLE(compositor, [disable metacity's compositing manager]),, enable_compositor=auto) +AC_ARG_WITH(clutter, + AC_HELP_STRING([--with-clutter], + [Use clutter for compositing]),, + with_clutter=auto) + AC_ARG_ENABLE(xsync, AC_HELP_STRING([--disable-xsync], [disable metacity's use of the XSync extension]),, @@ -229,6 +234,18 @@ else have_xcomposite=no fi +if test x$with_clutter = xyes; then + have_xcomposite=yes + have_clutter=yes + echo "CompositeExt support and Clutter forced on" +elif test x$with_clutter = xauto; then + have_clutter=no +else + have_clutter=no +fi + +AM_CONDITIONAL(WITH_CLUTTER, test "$have_clutter" = "yes") + if test x$have_xcomposite = xyes; then echo "Building with CompositeExt" METACITY_PC_MODULES="$METACITY_PC_MODULES xcomposite >= $XCOMPOSITE_VERSION xfixes xrender xdamage" @@ -270,6 +287,12 @@ if test x$have_xrender = xyes; then AC_DEFINE(HAVE_RENDER, , [Building with Render extension support]) fi +if test x$have_clutter = xyes; then + CLUTTER_PACKAGE=clutter-0.8 + METACITY_PC_MODULES="$METACITY_PC_MODULES $CLUTTER_PACKAGE " + AC_DEFINE(WITH_CLUTTER, , [Building with Clutter compositor]) +fi + AC_MSG_CHECKING([Xcursor]) if $PKG_CONFIG xcursor; then have_xcursor=yes @@ -284,8 +307,6 @@ if test x$have_xcursor = xyes; then AC_DEFINE(HAVE_XCURSOR, , [Building with Xcursor support]) fi -METACITY_PC_MODULES="$METACITY_PC_MODULES clutter-0.8" - PKG_CHECK_MODULES(METACITY, $METACITY_PC_MODULES) AC_PATH_XTRA @@ -527,6 +548,7 @@ metacity-$VERSION: Xsync: ${found_xsync} Render: ${have_xrender} Xcursor: ${have_xcursor} + Clutter: ${have_clutter} " METACITY_MINOR_VERSION=metacity_minor_version diff --git a/src/Makefile.am b/src/Makefile.am index 8428fc7b6..ce1e561ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,10 +14,6 @@ metacity_SOURCES= \ include/boxes.h \ compositor/compositor.c \ compositor/compositor-private.h \ - compositor/compositor-xrender.c \ - compositor/compositor-xrender.h \ - compositor/compositor-clutter.c \ - compositor/compositor-clutter.h \ include/compositor.h \ core/constraints.c \ core/constraints.h \ @@ -100,6 +96,14 @@ metacity_SOURCES= \ ui/themewidget.h \ ui/ui.c +if WITH_CLUTTER +metacity_SOURCES += compositor/compositor-clutter.c \ + compositor/compositor-clutter.h +else +metacity_SOURCES += compositor/compositor-xrender.c \ + compositor/compositor-xrender.h +endif + # by setting libmetacity_private_la_CFLAGS, the files shared with # metacity proper will be compiled with different names. libmetacity_private_la_CFLAGS = diff --git a/src/compositor/compositor-clutter.c b/src/compositor/compositor-clutter.c index 980896848..2adcb5fd3 100644 --- a/src/compositor/compositor-clutter.c +++ b/src/compositor/compositor-clutter.c @@ -1599,10 +1599,6 @@ meta_compositor_clutter_new (MetaDisplay *display) clc = g_new (MetaCompositorClutter, 1); clc->compositor = comp_info; - clutter_x11_set_display (xdisplay); - clutter_x11_disable_event_retrieval (); - clutter_init (NULL, NULL); - compositor = (MetaCompositor *) clc; clc->display = display; diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 86dd6325b..efb3086f4 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -28,9 +28,13 @@ MetaCompositor * meta_compositor_new (MetaDisplay *display) { #ifdef HAVE_COMPOSITE_EXTENSIONS +#ifdef WITH_CLUTTER /* At some point we would have a way to select between backends */ /* return meta_compositor_xrender_new (display); */ return meta_compositor_clutter_new (display); +#else + return meta_compositor_xrender_new (display); +#endif #else return NULL; #endif diff --git a/src/ui/ui.c b/src/ui/ui.c index 37901184c..9c4c12b94 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -22,6 +22,7 @@ * 02111-1307, USA. */ +#include #include "prefs.h" #include "ui.h" #include "frames.h" @@ -35,6 +36,11 @@ #include #include +#ifdef WITH_CLUTTER +#include +#include +#endif + static void meta_stock_icons_init (void); static void meta_ui_accelerator_parse (const char *accel, guint *keysym, @@ -54,6 +60,17 @@ meta_ui_init (int *argc, char ***argv) if (!gtk_init_check (argc, argv)) meta_fatal ("Unable to open X display %s\n", XDisplayName (NULL)); +#ifdef WITH_CLUTTER + /* + * NB: clutter must be initialized *after* the display connection is opened + * and *before* we enable the compositor. + */ + clutter_x11_set_display (gdk_display); + clutter_x11_disable_event_retrieval (); + clutter_init (argc, argv); +#endif + + meta_stock_icons_init (); }