[mutter] wayland: Add system bell support via gtk_shell



commit 4af908a9705c28df2625500ef73a0009ce4620ea
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Mar 7 12:47:48 2016 +0800

    wayland: Add system bell support via gtk_shell
    
    Add a system_bell request to gtk_shell. A client can use this to invoke
    the system bell, be it aural, visual or none at all. Currently per
    window visual bell support is not implemented.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763284

 src/wayland/meta-wayland-surface.c |   25 +++++++++++++++++++++++++
 src/wayland/protocol/gtk-shell.xml |    4 ++++
 2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 91ee76f..1a59484 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -48,6 +48,7 @@
 #include "display-private.h"
 #include "window-private.h"
 #include "meta-window-wayland.h"
+#include "bell.h"
 
 #include "compositor/region-utils.h"
 
@@ -2057,9 +2058,33 @@ gtk_shell_set_startup_id (struct wl_client   *client,
                                              startup_id);
 }
 
+static void
+gtk_shell_system_bell (struct wl_client   *client,
+                       struct wl_resource *resource,
+                       struct wl_resource *gtk_surface_resource)
+{
+  MetaDisplay *display = meta_get_display ();
+
+  if (gtk_surface_resource)
+    {
+      MetaWaylandSurface *surface =
+        wl_resource_get_user_data (gtk_surface_resource);
+
+      if (!surface->window)
+        return;
+
+      meta_bell_notify (display, surface->window);
+    }
+  else
+    {
+      meta_bell_notify (display, NULL);
+    }
+}
+
 static const struct gtk_shell1_interface meta_wayland_gtk_shell_interface = {
   gtk_shell_get_gtk_surface,
   gtk_shell_set_startup_id,
+  gtk_shell_system_bell,
 };
 
 static void
diff --git a/src/wayland/protocol/gtk-shell.xml b/src/wayland/protocol/gtk-shell.xml
index 1dc06a0..aa9993d 100644
--- a/src/wayland/protocol/gtk-shell.xml
+++ b/src/wayland/protocol/gtk-shell.xml
@@ -24,6 +24,10 @@
     <request name="set_startup_id">
       <arg name="startup_id" type="string" allow-null="true"/>
     </request>
+
+    <request name="system_bell">
+      <arg name="surface" type="object" interface="gtk_surface1" allow-null="true"/>
+    </request>
   </interface>
 
   <interface name="gtk_surface1" version="1">


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