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
This commit is contained in:
Jonas Ådahl 2017-03-13 14:33:06 +08:00
parent 59857e8f20
commit f78585b7c3
3 changed files with 30 additions and 12 deletions

View File

@ -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

View File

@ -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);

View File

@ -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: