[mutter] Make libcanberra support optional
- From: Owen Taylor <otaylor src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [mutter] Make libcanberra support optional
- Date: Thu, 11 Feb 2010 17:05:21 +0000 (UTC)
commit 857c8aaaa2a59568595a538a084ca3a2dc99f9a4
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Feb 11 10:28:20 2010 -0500
Make libcanberra support optional
Add a configure switch:
--with-libcanberra=[yes/no/auto]
(defaulting to auto); if libcanberra is not found or explicitly
disabled, then the default system bell will be used for the bell
sound and no switch workspace sound is played.
https://bugzilla.gnome.org/show_bug.cgi?id=609585
configure.in | 26 +++++++++++++++++++++++++-
src/core/bell.c | 23 +++++++++++++++++++----
src/core/workspace.c | 4 ++++
3 files changed, 48 insertions(+), 5 deletions(-)
---
diff --git a/configure.in b/configure.in
index 18a9a81..57d69af 100644
--- a/configure.in
+++ b/configure.in
@@ -124,7 +124,7 @@ if test "x$GCC" = "xyes"; then
fi
changequote([,])dnl
-MUTTER_PC_MODULES='gtk+-2.0 >= 2.10.0 pango >= 1.2.0 libcanberra-gtk'
+MUTTER_PC_MODULES='gtk+-2.0 >= 2.10.0 pango >= 1.2.0'
AC_ARG_ENABLE(gconf,
AC_HELP_STRING([--disable-gconf],
@@ -160,6 +160,11 @@ AC_ARG_WITH(introspection,
[disable the use of GObject introspection]),,
with_introspection=auto)
+AC_ARG_WITH(libcanberra,
+ AC_HELP_STRING([--without-libcanberra],
+ [disable the use of libcanberra for playing sounds]),,
+ with_libcanberra=auto)
+
AC_ARG_ENABLE(xsync,
AC_HELP_STRING([--disable-xsync],
[disable mutter's use of the XSync extension]),,
@@ -212,6 +217,24 @@ else
echo "Building without libstartup-notification"
fi
+have_libcanberra=no
+AC_MSG_CHECKING([libcanberra-gtk])
+if test x$with_libcanberra = xno ; then
+ AC_MSG_RESULT([disabled])
+else
+ if $PKG_CONFIG --exists libcanberra-gtk; then
+ have_libcanberra=yes
+ AC_MSG_RESULT(yes)
+ MUTTER_PC_MODULES="$MUTTER_PC_MODULES libcanberra-gtk"
+ AC_DEFINE([HAVE_LIBCANBERRA], 1, [Building with libcanberra for playing sounds])
+ else
+ AC_MSG_RESULT(no)
+ if test x$with_libcanberra = xyes ; then
+ AC_MSG_ERROR([libcanberra forced and libcanberra-gtk was not found])
+ fi
+ fi
+fi
+
XCOMPOSITE_VERSION=0.2
AC_MSG_CHECKING([Xcomposite >= $XCOMPOSITE_VERSION])
@@ -532,6 +555,7 @@ mutter-$VERSION:
XFree86 Xinerama: ${use_xfree_xinerama}
Solaris Xinerama: ${use_solaris_xinerama}
Startup notification: ${have_startup_notification}
+ libcanberra: ${have_libcanberra}
Introspection: ${have_introspection}
Session management: ${found_sm}
Shape extension: ${found_shape}
diff --git a/src/core/bell.c b/src/core/bell.c
index d32ad48..ef6eb16 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -52,7 +52,9 @@
#include "bell.h"
#include "screen-private.h"
#include "prefs.h"
+#ifdef HAVE_LIBCANBERRA
#include <canberra-gtk.h>
+#endif
/**
* Flashes one entire screen. This is done by making a window the size of the
@@ -287,6 +289,7 @@ meta_bell_notify (MetaDisplay *display,
if (meta_prefs_get_visual_bell ())
bell_visual_notify (display, xkb_ev);
+#ifdef HAVE_LIBCANBERRA
if (meta_prefs_bell_is_audible ())
{
ca_proplist *p;
@@ -326,12 +329,27 @@ meta_bell_notify (MetaDisplay *display,
xkb_bell_event->percent);
}
}
+#endif /* HAVE_LIBCANBERRA */
}
#endif /* HAVE_XKB */
void
meta_bell_set_audible (MetaDisplay *display, gboolean audible)
{
+#ifdef HAVE_XKB
+#ifdef HAVE_LIBCANBERRA
+ /* When we are playing sounds using libcanberra support, we handle the
+ * bell whether its an audible bell or a visible bell */
+ gboolean enable_system_bell = FALSE;
+#else
+ gboolean enable_system_bell = audible;
+#endif /* HAVE_LIBCANBERRA */
+
+ XkbChangeEnabledControls (display->xdisplay,
+ XkbUseCoreKbd,
+ XkbAudibleBellMask,
+ enable_system_bell ? XkbAudibleBellMask : 0);
+#endif /* HAVE_XKB */
}
gboolean
@@ -358,10 +376,7 @@ meta_bell_init (MetaDisplay *display)
XkbUseCoreKbd,
XkbBellNotifyMask,
XkbBellNotifyMask);
- XkbChangeEnabledControls (display->xdisplay,
- XkbUseCoreKbd,
- XkbAudibleBellMask,
- 0);
+ meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
if (visual_bell_auto_reset) {
XkbSetAutoResetControls (display->xdisplay,
XkbAudibleBellMask,
diff --git a/src/core/workspace.c b/src/core/workspace.c
index b3f43ce..d68cde8 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -33,7 +33,9 @@
#include <X11/Xatom.h>
#include <string.h>
+#ifdef HAVE_LIBCANBERRA
#include <canberra-gtk.h>
+#endif
enum {
PROP_0,
@@ -444,6 +446,7 @@ static void
workspace_switch_sound(MetaWorkspace *from,
MetaWorkspace *to)
{
+#ifdef HAVE_LIBCANBERRA
MetaWorkspaceLayout layout;
int i, nw, x, y, fi, ti;
const char *e;
@@ -499,6 +502,7 @@ workspace_switch_sound(MetaWorkspace *from,
finish:
meta_screen_free_workspace_layout (&layout);
+#endif /* HAVE_LIBCANBERRA */
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]