[metacity] configure.in: add flag to disable canberra. Fixes #634360.



commit fbb61a9db6b1806043a4522f7fa3843508113ea3
Author: Michael Smith <msmith cbnco com>
Date:   Sat Jan 15 18:30:47 2011 -0500

    configure.in: add flag to disable canberra.  Fixes #634360.
    
    For embedded builds, it'd be nice to be able to disable canberra.
    Canberra is still enabled by default.

 configure.in         |   13 ++++++++++++-
 src/core/bell.c      |   10 +++++++++-
 src/core/workspace.c |    5 +++++
 3 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index 1b971f7..4138ede 100644
--- a/configure.in
+++ b/configure.in
@@ -129,7 +129,7 @@ case "$with_gtk" in
        ;;
 esac
 
-METACITY_PC_MODULES="gtk+-$GTK_API_VERSION >= $GTK_MIN_VERSION pango >= 1.2.0 $CANBERRA_GTK"
+METACITY_PC_MODULES="gtk+-$GTK_API_VERSION >= $GTK_MIN_VERSION pango >= 1.2.0"
 AC_SUBST(GTK_API_VERSION)
 
 AC_ARG_ENABLE(gconf,
@@ -142,6 +142,16 @@ if test x$enable_gconf = xyes; then
     METACITY_PC_MODULES="$METACITY_PC_MODULES gconf-2.0 >= 1.2.0"
 fi
 
+AC_ARG_ENABLE(canberra,
+  AC_HELP_STRING([--disable-canberra],
+                 [disable use of canberra for event sounds, for embedded non-GNOME builds]),,
+  enable_canberra=yes)
+
+if test x$enable_canberra = xyes; then
+    AC_DEFINE(HAVE_CANBERRA,1,[Build with canberra support])
+    METACITY_PC_MODULES="$METACITY_PC_MODULES $CANBERRA_GTK"
+fi
+
 AC_ARG_ENABLE(verbose-mode,
   AC_HELP_STRING([--disable-verbose-mode],
                  [disable metacity's ability to do verbose logging, for embedded/size-sensitive custom builds]),,
@@ -570,6 +580,7 @@ metacity-$VERSION (using gtk+-${GTK_API_VERSION}):
 	compiler:		  ${CC}
 
 	GConf:                    ${enable_gconf}
+	Canberra:                 ${enable_canberra}
 	XFree86 Xinerama:         ${use_xfree_xinerama}
 	Solaris Xinerama:         ${use_solaris_xinerama}
 	Startup notification:     ${have_startup_notification}
diff --git a/src/core/bell.c b/src/core/bell.c
index 87d8fa0..e54de74 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -52,7 +52,10 @@
 #include "bell.h"
 #include "screen-private.h"
 #include "prefs.h"
+
+#ifdef HAVE_CANBERRA
 #include <canberra-gtk.h>
+#endif
 
 /**
  * Flashes one entire screen.  This is done by making a window the size of the
@@ -284,8 +287,10 @@ meta_bell_notify (MetaDisplay *display,
 
   if (meta_prefs_bell_is_audible ()) 
     {
-      ca_proplist *p;
       XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
+
+#ifdef HAVE_CANBERRA
+      ca_proplist *p;
       MetaWindow *window;
       int res;
 
@@ -312,6 +317,9 @@ meta_bell_notify (MetaDisplay *display,
       ca_proplist_destroy (p);
 
       if (res != CA_SUCCESS && res != CA_ERROR_DISABLED)
+#else
+      if (1)
+#endif /* HAVE_CANBERRA */
         {      
           /* ...and in case that failed we use the classic X11 bell. */
           XkbForceDeviceBell (display->xdisplay, 
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 063f867..12798a5 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -29,7 +29,10 @@
 #include "prefs.h"
 #include <X11/Xatom.h>
 #include <string.h>
+
+#ifdef HAVE_CANBERRA
 #include <canberra-gtk.h>
+#endif
 
 void meta_workspace_queue_calc_showing   (MetaWorkspace *workspace);
 static void set_active_space_hint        (MetaScreen *screen);
@@ -355,11 +358,13 @@ static void workspace_switch_sound(MetaWorkspace *from,
     goto finish;
   }
 
+#ifdef HAVE_CANBERRA
   ca_context_play(ca_gtk_context_get(), 1,
                   CA_PROP_EVENT_ID, e,
                   CA_PROP_EVENT_DESCRIPTION, "Desktop switched",
                   CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
                   NULL);
+#endif
 
  finish:
   meta_screen_free_workspace_layout (&layout);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]