diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-03-02 12:45:02 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-03-02 12:50:48 -0500 |
commit | 24361d288f5b067ec7b946ef2be58cba8e8eb80c (patch) | |
tree | 08a7cc3dda77dc3f4ab41b3f8d322d68a7deb5ff | |
parent | 886f521fb57c466e1a0db71dbd83bbf6ad95c92b (diff) | |
download | gtk+-matthiasc/wayland/beep.tar.gz |
wayland: Use libcanberra to implement beepingmatthiasc/wayland/beep
The ability to beep in certain situations is a requirement
for some accessibility features. Since there is no Wayland
protocol for this (and it is not sure if there should be),
use libcanberra for this.
https://bugzilla.gnome.org/show_bug.cgi?id=763001
-rw-r--r-- | gdk/wayland/gdkdisplay-wayland.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index c811f19d67..5b49d176df 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -27,7 +27,9 @@ #include <sys/syscall.h> #include <glib.h> +#include "gdkintl.h" #include "gdkwayland.h" +#include "gdkprivate-wayland.h" #include "gdkdisplay.h" #include "gdkdisplay-wayland.h" #include "gdkscreen.h" @@ -39,6 +41,8 @@ #include "gdkglcontext-wayland.h" #include "pointer-gestures-unstable-v1-client-protocol.h" +#include <canberra.h> + /** * SECTION:wayland_interaction * @Short_description: Wayland backend-specific functions @@ -522,7 +526,25 @@ gdk_wayland_display_get_default_screen (GdkDisplay *display) static void gdk_wayland_display_beep (GdkDisplay *display) { + ca_context *c; + ca_proplist *p; + g_return_if_fail (GDK_IS_DISPLAY (display)); + + c = gdk_wayland_screen_get_ca_context (gdk_display_get_default_screen (display)); + if (!c) + return; + + 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"); + + ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", getpid ()); + + ca_context_play_full (c, 1, p, NULL, NULL); + + ca_proplist_destroy (p); } static void |