Fall back on XRender if initializing clutter fails.

This commit is contained in:
Tomas Frydrych 2008-09-17 16:39:32 +01:00
parent 438ac55cb1
commit b7bdc5ec69
4 changed files with 23 additions and 7 deletions

View File

@ -14,6 +14,8 @@ metacity_SOURCES= \
include/boxes.h \
compositor/compositor.c \
compositor/compositor-private.h \
compositor/compositor-xrender.c \
compositor/compositor-xrender.h \
include/compositor.h \
core/constraints.c \
core/constraints.h \
@ -99,9 +101,6 @@ metacity_SOURCES= \
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

View File

@ -24,6 +24,10 @@
#include "compositor-xrender.h"
#include "compositor-clutter.h"
#ifdef WITH_CLUTTER
int meta_compositor_can_use_clutter__ = 0;
#endif
MetaCompositor *
meta_compositor_new (MetaDisplay *display)
{
@ -31,10 +35,11 @@ meta_compositor_new (MetaDisplay *display)
#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);
if (meta_compositor_can_use_clutter__)
return meta_compositor_clutter_new (display);
else
#endif
return meta_compositor_xrender_new (display);
#else
return NULL;
#endif

View File

@ -28,6 +28,9 @@
#include "types.h"
#include "boxes.h"
#ifdef WITH_CLUTTER
extern int meta_compositor_can_use_clutter__;
#endif
MetaCompositor *meta_compositor_new (MetaDisplay *display);
void meta_compositor_destroy (MetaCompositor *compositor);

View File

@ -39,6 +39,7 @@
#ifdef WITH_CLUTTER
#include <clutter/clutter.h>
#include <clutter/x11/clutter-x11.h>
#include "compositor.h"
#endif
static void meta_stock_icons_init (void);
@ -67,7 +68,15 @@ meta_ui_init (int *argc, char ***argv)
*/
clutter_x11_set_display (gdk_display);
clutter_x11_disable_event_retrieval ();
clutter_init (argc, argv);
if (clutter_init (argc, argv) != CLUTTER_INIT_SUCCESS)
{
g_message ("Unable to initialize Clutter; falling back on Xrender\n");
meta_compositor_can_use_clutter__ = 0;
}
else
{
meta_compositor_can_use_clutter__ = 1;
}
#endif