From aefbab5a9de340f235eb7cd4281caee28f77e0d7 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 26 Sep 2021 13:36:43 -0700 Subject: [PATCH] enable audible bell for X11 refs: #3 --- window/src/os/x11/connection.rs | 4 ++++ window/src/os/x_and_wayland.rs | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/window/src/os/x11/connection.rs b/window/src/os/x11/connection.rs index 2bab0d69e..422a0ebc0 100644 --- a/window/src/os/x11/connection.rs +++ b/window/src/os/x11/connection.rs @@ -228,6 +228,10 @@ impl ConnectionOps for XConnection { Ok(()) } + + fn beep(&self) { + xcb::xproto::bell(&self.conn, 0); + } } fn compute_default_dpi(xrm: &HashMap, xsettings: &XSettingsMap) -> f64 { diff --git a/window/src/os/x_and_wayland.rs b/window/src/os/x_and_wayland.rs index 48b4f47c6..d75156e25 100644 --- a/window/src/os/x_and_wayland.rs +++ b/window/src/os/x_and_wayland.rs @@ -137,6 +137,14 @@ impl ConnectionOps for Connection { Self::Wayland(w) => w.get_appearance(), } } + + fn beep(&self) { + match self { + Self::X11(x) => x.beep(), + #[cfg(feature = "wayland")] + Self::Wayland(w) => w.beep(), + } + } } impl Window {