From 2421555e26542c9178d1bb7a583e4a3bbdc48afb Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:22:07 +0100 Subject: [PATCH] Fix building with the accesskit feature on Linux (#121) --- .github/workflows/ci.yml | 1 - src/backend/linux/window.rs | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84518f53..f36b67d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,6 @@ jobs: - name: cargo build accesskit example run: cargo build --features accesskit --example accesskit - if: contains(matrix.os, 'macos') || contains(matrix.os, 'windows') # we test the wayland backend as a separate job test-stable-wayland: diff --git a/src/backend/linux/window.rs b/src/backend/linux/window.rs index 4bf6fa40..a85c5d26 100644 --- a/src/backend/linux/window.rs +++ b/src/backend/linux/window.rs @@ -677,6 +677,20 @@ impl WindowHandle { WindowHandle::None => panic!("Used an uninitialised WindowHandle"), } } + + #[cfg(feature = "accesskit")] + pub fn update_accesskit_if_active( + &self, + update_factory: impl FnOnce() -> accesskit::TreeUpdate, + ) { + match self { + #[cfg(feature = "x11")] + WindowHandle::X11(handle) => handle.update_accesskit_if_active(update_factory), + #[cfg(feature = "wayland")] + WindowHandle::Wayland(handle) => handle.update_accesskit_if_active(update_factory), + WindowHandle::None => panic!("Used an uninitialised WindowHandle"), + } + } } unsafe impl HasRawWindowHandle for WindowHandle {