Added --with-clutter option; initialize Clutter from meta_ui_init().

Fixed up the build files so we do not build xrender compositor when building
clutter backend; moved clutter initialization to meta_ui_init() so commandline
arguments can be passed into clutter_init().
This commit is contained in:
Tomas Frydrych 2008-08-20 10:31:10 +01:00
parent b48f9ca907
commit a3f56bb289
5 changed files with 53 additions and 10 deletions

View File

@ -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

View File

@ -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 =

View File

@ -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;

View File

@ -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

View File

@ -22,6 +22,7 @@
* 02111-1307, USA.
*/
#include <config.h>
#include "prefs.h"
#include "ui.h"
#include "frames.h"
@ -35,6 +36,11 @@
#include <string.h>
#include <stdlib.h>
#ifdef WITH_CLUTTER
#include <clutter/clutter.h>
#include <clutter/x11/clutter-x11.h>
#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 ();
}