[mutter/wip/carlosg/xwayland-on-demand: 13/32] core: Make MetaBell use MetaSound to play the bell sound



commit 20eea907e4af7ba089cccd83002bd8dbc966e859
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 9 12:58:00 2018 +0100

    core: Make MetaBell use MetaSound to play the bell sound
    
    Instead of poking into libcanberra/gtk+.

 src/core/bell.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)
---
diff --git a/src/core/bell.c b/src/core/bell.c
index a4b049145..a9c53c3b4 100644
--- a/src/core/bell.c
+++ b/src/core/bell.c
@@ -248,31 +248,14 @@ static gboolean
 bell_audible_notify (MetaDisplay *display,
                      MetaWindow  *window)
 {
-#ifdef HAVE_LIBCANBERRA
-  ca_proplist *p;
-  int res;
-
-  ca_proplist_create (&p);
-  ca_proplist_sets (p, CA_PROP_EVENT_ID, "bell-window-system");
-  ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Bell event"));
-  ca_proplist_sets (p, CA_PROP_CANBERRA_CACHE_CONTROL, "permanent");
-
-  if (window)
-    {
-      ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title);
-      ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow);
-      ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name);
-      ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid);
-    }
+  MetaSound *sound;
 
-  res = ca_context_play_full (ca_gtk_context_get (), 1, p, NULL, NULL);
-
-  ca_proplist_destroy (p);
-
-  return res == CA_SUCCESS || res == CA_ERROR_DISABLED;
-#endif /* HAVE_LIBCANBERRA */
-
-  return FALSE;
+  sound = meta_display_get_sound (display);
+  meta_sound_play_from_theme (sound,
+                              "bell-window-system",
+                              _("Bell event"),
+                              NULL);
+  return TRUE;
 }
 
 gboolean


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