[gtk+/gtk-3-22] wayland: Make beep requests go through the GdkDisplay
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] wayland: Make beep requests go through the GdkDisplay
- Date: Thu, 20 Jul 2017 02:11:24 +0000 (UTC)
commit f78585b7c35cbe07b5cf921a871d59299dcfa355
Author: Jonas Ådahl <jadahl gmail com>
Date: Mon Mar 13 14:33:06 2017 +0800
wayland: Make beep requests go through the GdkDisplay
This way we can add things like throttling.
https://bugzilla.gnome.org/show_bug.cgi?id=778188
gdk/wayland/gdkdisplay-wayland.c | 19 ++++++++++++++++---
gdk/wayland/gdkprivate-wayland.h | 5 +++++
gdk/wayland/gdkwindow-wayland.c | 18 +++++++++---------
3 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 784cfbe..d7fb684 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -656,10 +656,12 @@ gdk_wayland_display_get_default_screen (GdkDisplay *display)
return GDK_WAYLAND_DISPLAY (display)->screen;
}
-static void
-gdk_wayland_display_beep (GdkDisplay *display)
+void
+gdk_wayland_display_system_bell (GdkDisplay *display,
+ GdkWindow *window)
{
GdkWaylandDisplay *display_wayland;
+ struct gtk_surface1 *gtk_surface;
g_return_if_fail (GDK_IS_DISPLAY (display));
@@ -668,7 +670,18 @@ gdk_wayland_display_beep (GdkDisplay *display)
if (!display_wayland->gtk_shell)
return;
- gtk_shell1_system_bell (display_wayland->gtk_shell, NULL);
+ if (window)
+ gtk_surface = gdk_wayland_window_get_gtk_surface (window);
+ else
+ gtk_surface = NULL;
+
+ gtk_shell1_system_bell (display_wayland->gtk_shell, gtk_surface);
+}
+
+static void
+gdk_wayland_display_beep (GdkDisplay *display)
+{
+ gdk_wayland_display_system_bell (display, NULL);
}
static void
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index a95c925..fde7632 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -83,6 +83,9 @@ void _gdk_wayland_display_get_maximal_cursor_size (GdkDisplay *display,
gboolean _gdk_wayland_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_wayland_display_supports_cursor_color (GdkDisplay *display);
+void gdk_wayland_display_system_bell (GdkDisplay *display,
+ GdkWindow *window);
+
struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
guint image_index,
int *hotspot_x,
@@ -271,6 +274,8 @@ EGLSurface gdk_wayland_window_get_egl_surface (GdkWindow *window,
EGLSurface gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
EGLConfig config);
+struct gtk_surface1 * gdk_wayland_window_get_gtk_surface (GdkWindow *window);
+
void gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
GdkCursor *cursor);
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index ffc9f94..1f93f6c 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -958,15 +958,8 @@ 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);
+ gdk_wayland_display_system_bell (gdk_window_get_display (window),
+ window);
return TRUE;
}
@@ -3891,6 +3884,13 @@ gdk_wayland_window_get_dummy_egl_surface (GdkWindow *window,
return impl->dummy_egl_surface;
}
+struct gtk_surface1 *
+gdk_wayland_window_get_gtk_surface (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
+
+ return GDK_WINDOW_IMPL_WAYLAND (window->impl)->display_server.gtk_surface;
+}
/**
* gdk_wayland_window_set_use_custom_surface:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]