[gtk+] wayland: Add system bell support via gtk_shell



commit ed430dc00adf437a4002ad7552912e5094565f2c
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Mar 7 12:41:31 2016 +0800

    wayland: Add system bell support via gtk_shell
    
    Invoke the system bell by calling the request added to the gtk_shell
    protocol.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763001

 gdk/wayland/gdkdisplay-wayland.c   |    9 +++++++++
 gdk/wayland/gdkwindow-wayland.c    |   18 +++++++++++++++++-
 gdk/wayland/protocol/gtk-shell.xml |    4 ++++
 3 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index d80c2ae..8b35fb9 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -519,7 +519,16 @@ gdk_wayland_display_get_default_screen (GdkDisplay *display)
 static void
 gdk_wayland_display_beep (GdkDisplay *display)
 {
+  GdkWaylandDisplay *display_wayland;
+
   g_return_if_fail (GDK_IS_DISPLAY (display));
+
+  display_wayland = GDK_WAYLAND_DISPLAY (display);
+
+  if (!display_wayland->gtk_shell)
+    return;
+
+  gtk_shell1_system_bell (display_wayland->gtk_shell, NULL);
 }
 
 static void
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 78295e5..bf2dcd0 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -858,6 +858,22 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
     }
 }
 
+static gboolean
+gdk_window_impl_wayland_beep (GdkWindow *window)
+{
+  GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+  GdkWaylandDisplay *display_wayland =
+    GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
+
+  if (!display_wayland->gtk_shell)
+    return FALSE;
+
+  gtk_shell1_system_bell (display_wayland->gtk_shell,
+                          impl->display_server.gtk_surface);
+
+  return TRUE;
+}
+
 static void
 gdk_window_impl_wayland_finalize (GObject *object)
 {
@@ -2787,7 +2803,7 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
   impl_class->get_input_shape = gdk_wayland_window_get_input_shape;
   impl_class->begin_paint = gdk_window_impl_wayland_begin_paint;
   impl_class->end_paint = gdk_window_impl_wayland_end_paint;
-  /* impl_class->beep */
+  impl_class->beep = gdk_window_impl_wayland_beep;
 
   impl_class->focus = gdk_wayland_window_focus;
   impl_class->set_type_hint = gdk_wayland_window_set_type_hint;
diff --git a/gdk/wayland/protocol/gtk-shell.xml b/gdk/wayland/protocol/gtk-shell.xml
index 1dc06a0..aa9993d 100644
--- a/gdk/wayland/protocol/gtk-shell.xml
+++ b/gdk/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]