From 78e39bfb1c4ee8df75f8f459e2572d6d328ae4cd Mon Sep 17 00:00:00 2001 From: TingPing Date: Sat, 27 Apr 2013 18:05:05 -0400 Subject: use libcanberra for beeps --- configure.ac | 23 +++++++++++++++++++++++ src/fe-gtk/fe-gtk.c | 10 ++++++++++ 2 files changed, 33 insertions(+) diff --git a/configure.ac b/configure.ac index 2715398c..401c3a50 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,7 @@ AH_VERBATIM([USE_GTKSPELL],[#undef USE_GTKSPELL]) AH_VERBATIM([USE_LIBSEXY],[#undef USE_LIBSEXY]) AH_VERBATIM([HAVE_ISO_CODES],[#undef HAVE_ISO_CODES]) AH_VERBATIM([USE_LIBNOTIFY],[#undef USE_LIBNOTIFY]) +AH_VERBATIM([USE_LIBCANBERRA],[#undef USE_LIBCANBERRA]) AH_VERBATIM([USE_IPV6],[#undef USE_IPV6]) AH_VERBATIM([USE_MMX],[#undef USE_MMX]) AH_VERBATIM([USE_OPENSSL],[#undef USE_OPENSSL]) @@ -153,6 +154,11 @@ AC_ARG_ENABLE(libnotify, [AS_HELP_STRING([--disable-libnotify],[disable libnotify support])], libnotify=$enableval, libnotify=yes) +AC_ARG_ENABLE(libcanberra, + [AS_HELP_STRING([--disable-libcanberra],[disable libcanberra support])], + libcanberra=$enableval, libcanberra=yes) + + AC_ARG_ENABLE(mmx, [AS_HELP_STRING([--disable-mmx],[disable MMX assembly routines])], mmx=$enableval, mmx=yes) @@ -605,6 +611,21 @@ if test "x$libnotify" = "xyes" ; then fi fi +dnl ********************************************************************* +dnl ** LIBCANBERRA ****************************************************** +dnl ********************************************************************* + +if test "x$libcanberra" = "xyes" ; then + PKG_CHECK_MODULES(LIBCANBERRAGTK, libcanberra-gtk >= 0.22, [], [ + libcanberra=no + ]) + if test "$libcanberra" != "no" ; then + GUI_LIBS="$GUI_LIBS $LIBCANBERRAGTK_LIBS" + GUI_CFLAGS="$GUI_CFLAGS $LIBCANBERRAGTK_CFLAGS" + AC_DEFINE(USE_LIBCANBERRA) + fi +fi + dnl ********************************************************************* dnl ** SPELL ************************************************************ dnl ********************************************************************* @@ -650,6 +671,7 @@ dnl ********************************************************************* AM_CONDITIONAL(USE_OPENSSL, test "x$openssl" = "xyes") AM_CONDITIONAL(USE_LIBSEXY, test "x$spell" = "xstatic") AM_CONDITIONAL(USE_LIBNOTIFY, test "x$libnotify" = "xyes") +AM_CONDITIONAL(USE_LIBCANBERRA, test "x$libcanberra" = "xyes") AM_CONDITIONAL(DO_TEXT, test "x$textfe" = "xyes") AM_CONDITIONAL(DO_GTK, test "x$gtkfe" = "xyes") AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes") @@ -969,6 +991,7 @@ fi echo OpenSSL support ....... : $openssl echo D-Bus support ......... : $dbus echo libnotify support ..... : $libnotify +echo libcanberra support ... : $libcanberra echo Spelling .............. : $spell echo Plugin interface ...... : $plugin echo NLS/gettext ........... : $USE_NLS diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index e26fb6d0..1ec5debd 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -56,6 +56,10 @@ #include #endif +#ifdef USE_LIBCANBERRA +#include +#endif + GdkPixmap *channelwin_pix; @@ -671,6 +675,12 @@ fe_beep (session *sess) Beep (1000, 50); } #else +#ifdef USE_LIBCANBERRA + if (ca_context_play (ca_gtk_context_get (), 0, + CA_PROP_APPLICATION_NAME, DISPLAY_NAME, + CA_PROP_EVENT_ID, "message-new-instant", NULL) == 0) + return; +#endif gdk_beep (); #endif } -- cgit 1.4.1