If a bad behaving application tries to make the window/display beep too
often, throttle the beep requests so that we don't end up filling the
Wayland socket queue.
The throttle is set to 50 beeps per second, which far more beeps than
will ever make any sense from a user experience point of view, but will
avoid terminating due to an excessive amount of requests.
https://bugzilla.gnome.org/show_bug.cgi?id=778188
* ]|
*/
+#define MIN_SYSTEM_BELL_DELAY_MS 20
+
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
{
GdkWaylandDisplay *display_wayland;
struct gtk_surface1 *gtk_surface;
+ gint64 now_ms;
g_return_if_fail (GDK_IS_DISPLAY (display));
else
gtk_surface = NULL;
+ now_ms = g_get_monotonic_time () / 1000;
+ if (now_ms - display_wayland->last_bell_time_ms < MIN_SYSTEM_BELL_DELAY_MS)
+ return;
+
+ display_wayland->last_bell_time_ms = now_ms;
+
gtk_shell1_system_bell (display_wayland->gtk_shell, gtk_surface);
}
GPtrArray *monitors;
+ gint64 last_bell_time_ms;
+
/* egl info */
EGLDisplay egl_display;
int egl_major_version;