diff --git a/x11-packages/rnote/build.sh b/x11-packages/rnote/build.sh index 902079072b87956..005d249347c6e10 100644 --- a/x11-packages/rnote/build.sh +++ b/x11-packages/rnote/build.sh @@ -1,5 +1,5 @@ TERMUX_PKG_HOMEPAGE="https://github.com/flxzt/rnote" -TERMUX_PKG_DESCRIPTION="A simple drawing application to create handwritten notes" +TERMUX_PKG_DESCRIPTION="An infinite canvas vector-based drawing application for handwritten notes" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="0.11.0" @@ -7,6 +7,27 @@ TERMUX_PKG_SRCURL="https://github.com/flxzt/rnote/archive/v${TERMUX_PKG_VERSION} TERMUX_PKG_SHA256=b133d4331963d3c09d3a7477f60fc4c5072471dcbf459379a593ca1724164af4 TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_DEPENDS="gdk-pixbuf, gettext, glib, graphene, gtk4, hicolor-icon-theme, libadwaita, libcairo, pipewire, pango, poppler" +TERMUX_PKG_BUILD_DEPENDS="libiconv" + +__fetch_gettext_rs() { + # This version is relative to gettext-sys provided by the gettext-rs crate + local _version="0.21.4" + local _url="https://github.com/gettext-rs/gettext-rs/archive/refs/tags/gettext-sys-$_version.tar.gz" + local _path="$TERMUX_PKG_CACHEDIR/gettext-v$_version.tar.gz" + termux_download "$_url" "$_path" SKIP_CHECKSUM + tar xf "$_path" -C "$TERMUX_PKG_SRCDIR" + mv "gettext-rs-gettext-sys-$_version" "gettext-source" + + + # Fetch latest and greatest gettext from upstream and place it inside gettext-source/gettext-sys + local _upstream_source_version="0.22.5" + wget "https://mirrors.kernel.org/gnu/gettext/gettext-${_upstream_source_version}.tar.xz" -P "$TERMUX_PKG_SRCDIR/gettext-source/gettext-sys" +} + +__patch_gettext_rs() { + # Patch gettext-rs crate to use a newer gettext version because the old one doesn't compile properly with clang + patch -p1 -d "$TERMUX_PKG_SRCDIR/gettext-source" < "$TERMUX_PKG_BUILDER_DIR"/gettext-rs-crate-patch.diff +} termux_step_pre_configure() { termux_setup_cmake @@ -21,20 +42,26 @@ termux_step_pre_configure() { export PKG_CONFIG="${_WRAPPER_BIN}/pkg-config" fi export PATH="${_WRAPPER_BIN}:${PATH}" + + # Fetch and patch the crate to use a newer upstream gettext version + __fetch_gettext_rs + __patch_gettext_rs +} + +termux_step_make() { + termux_setup_rust + + cd "${TERMUX_PKG_SRCDIR}" + + RUSTFLAGS="-C link-arg=-Wl,-rpath=${TERMUX_PREFIX}/lib -C link-arg=-L${TERMUX_PREFIX}/lib -C link-arg=-liconv" \ + cargo build \ + --jobs "${TERMUX_PKG_MAKE_PROCESSES}" \ + --target "${CARGO_TARGET_NAME}" \ + --package rnote \ + --release } termux_step_post_make_install() { - ( - cd "${TERMUX_PKG_SRCDIR}" - - termux_setup_rust - - GETTEXT_SYSTEM=1 \ - GETTEXT_DIR="${TERMUX_PREFIX}" \ - cargo build \ - --jobs "${TERMUX_PKG_MAKE_PROCESSES}" \ - --target "${CARGO_TARGET_NAME}" \ - --package rnote \ - --release - ) + cd "${TERMUX_PKG_SRCDIR}" + install -Dm755 "target/$CARGO_TARGET_NAME/release/rnote" -t "$TERMUX_PREFIX/bin" } diff --git a/x11-packages/rnote/custom-gettext-rs-crate-Cargo.toml.patch b/x11-packages/rnote/custom-gettext-rs-crate-Cargo.toml.patch new file mode 100644 index 000000000000000..96f93aecc53388f --- /dev/null +++ b/x11-packages/rnote/custom-gettext-rs-crate-Cargo.toml.patch @@ -0,0 +1,13 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 6a6aa16..58b576a 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -34,7 +34,7 @@ flate2 = "1.0" + fs_extra = "1.3" + futures = "0.3.30" + geo = "0.28.0" +-gettext-rs = { version = "0.7.0", features = ["gettext-system"] } ++gettext-rs = { path = "./gettext-source/gettext-rs" } + gio = "0.19.5" + glib = "0.19.7" + glib-build-tools = "0.19.0" diff --git a/x11-packages/rnote/meson.build.patch b/x11-packages/rnote/disable-cargo-command-meson.build.patch similarity index 100% rename from x11-packages/rnote/meson.build.patch rename to x11-packages/rnote/disable-cargo-command-meson.build.patch diff --git a/x11-packages/rnote/fix-compile-gresource.patch b/x11-packages/rnote/fix-compile-gresource.patch new file mode 100644 index 000000000000000..925f11f2d44c8cb --- /dev/null +++ b/x11-packages/rnote/fix-compile-gresource.patch @@ -0,0 +1,106 @@ +diff --git a/crates/rnote-ui/build.rs b/crates/rnote-ui/build.rs +index 9e5c07e..cd7baa5 100644 +--- a/crates/rnote-ui/build.rs ++++ b/crates/rnote-ui/build.rs +@@ -1,5 +1,11 @@ + fn main() -> anyhow::Result<()> { +- compile_gresources()?; ++ let is_cross_compiling = detect_cross_compilation(); ++ ++ if !is_cross_compiling { ++ println!("cargo:rustc-cfg=feature=\"use_glib_build_tools\""); ++ } ++ ++ compile_gresources(is_cross_compiling)?; + + #[cfg(windows)] + compile_icon_winres()?; +@@ -18,11 +24,64 @@ fn compile_icon_winres() -> anyhow::Result<()> { + .context("Failed to compile winresource resource") + } + +-fn compile_gresources() -> anyhow::Result<()> { +- glib_build_tools::compile_resources( +- &["data"], +- "data/resources.gresource.xml", +- "compiled.gresource", +- ); +- Ok(()) ++fn detect_cross_compilation() -> bool { ++ let host = std::env::var("HOST").unwrap_or_default(); ++ let target = std::env::var("TARGET").unwrap_or_default(); ++ host != target ++} ++ ++fn compile_gresources(is_cross_compiling: bool) -> anyhow::Result<()> { ++ use std::env; ++ use std::path::PathBuf; ++ use std::process::Command; ++ ++ let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set"); ++ let output_path = PathBuf::from(&out_dir).join("compiled.gresource"); ++ ++ // First, try using the system's glib-compile-resources ++ let system_result = Command::new("glib-compile-resources") ++ .args(&[ ++ "--sourcedir=data", ++ "data/resources.gresource.xml", ++ &format!("--target={}", output_path.display()), ++ ]) ++ .status(); ++ ++ match system_result { ++ Ok(status) if status.success() => return Ok(()), ++ Ok(_) => println!("glib-compile-resources command failed, trying fallback method..."), ++ Err(e) if e.kind() == std::io::ErrorKind::NotFound => { ++ println!("glib-compile-resources not found, trying fallback method...") ++ } ++ Err(e) => println!( ++ "Error executing glib-compile-resources: {}, trying fallback method...", ++ e ++ ), ++ } ++ ++ // If cross-compiling, don't use glib_build_tools ++ if is_cross_compiling { ++ return Err(anyhow::anyhow!( ++ "Failed to compile gresources: system glib-compile-resources failed and we're cross-compiling. \ ++ Please ensure you have glib development tools installed on your target system." ++ )); ++ } ++ ++ // If not cross-compiling and system command fails, fall back to glib_build_tools if available ++ #[cfg(feature = "use_glib_build_tools")] ++ { ++ println!("Attempting to use glib_build_tools::compile_resources..."); ++ glib_build_tools::compile_resources( ++ &["data"], ++ "data/resources.gresource.xml", ++ output_path.to_str().unwrap(), ++ ); ++ Ok(()) ++ } ++ ++ #[cfg(not(feature = "use_glib_build_tools"))] ++ Err(anyhow::anyhow!( ++ "Failed to compile gresources: system glib-compile-resources failed and glib_build_tools is not available. \ ++ Please ensure you have glib development tools installed on your system." ++ )) + } + +diff --git a/crates/rnote-ui/Cargo.toml b/crates/rnote-ui/Cargo.toml +index 426d8e9..55447fc 100644 +--- a/crates/rnote-ui/Cargo.toml ++++ b/crates/rnote-ui/Cargo.toml +@@ -58,7 +58,10 @@ url = { workspace = true } + + [build-dependencies] + anyhow = { workspace = true } +-glib-build-tools = { workspace = true } ++glib-build-tools = { workspace = true, optional = true } ++ ++[features] ++use_glib_build_tools = ["glib-build-tools"] + + [target.'cfg(windows)'.build-dependencies] + winresource = { workspace = true } diff --git a/x11-packages/rnote/gettext-rs-crate-patch.diff b/x11-packages/rnote/gettext-rs-crate-patch.diff new file mode 100644 index 000000000000000..2e6747617fd19e9 --- /dev/null +++ b/x11-packages/rnote/gettext-rs-crate-patch.diff @@ -0,0 +1,180 @@ +Patch gettext-rs crate to use the a custom gettext fetched from upstream instead +Patch systest crate to skip testing gettext binary when cross compiling + +diff --git a/gettext-rs/Cargo.toml b/gettext-rs/Cargo.toml +index f98bba8..b374080 100644 +--- a/gettext-rs/Cargo.toml ++++ b/gettext-rs/Cargo.toml +@@ -18,7 +18,7 @@ name = "gettextrs" + gettext-system = ["gettext-sys/gettext-system"] + + [dependencies.gettext-sys] +-version = "0.21.0" ++version = "0.22.0" + path = "../gettext-sys" + + [dependencies] +diff --git a/gettext-rs/tests/integration.rs b/gettext-rs/tests/integration.rs +index bae3cc1..8d52953 100644 +--- a/gettext-rs/tests/integration.rs ++++ b/gettext-rs/tests/integration.rs +@@ -86,7 +86,7 @@ fn dcgettext_fn() { + ); + + assert_eq!( +- dcgettext("bound_domain", "Hello, World!", LocaleCategory::LcAll), ++ dcgettext("bound_domain", "Hello, World!", LocaleCategory::LcMessages), + "Hello, World!" + ); + } +@@ -156,7 +156,7 @@ fn dcngettext_fn() { + "Hello, World!", + "Hello, Worlds!", + 1, +- LocaleCategory::LcAll ++ LocaleCategory::LcMessages + ), + "Hello, World!" + ); +@@ -166,7 +166,7 @@ fn dcngettext_fn() { + "Hello, World!", + "Hello, Worlds!", + 2, +- LocaleCategory::LcAll ++ LocaleCategory::LcMessages + ), + "Hello, Worlds!" + ); +diff --git a/gettext-sys/Cargo.toml b/gettext-sys/Cargo.toml +index b5f849c..3baf2fd 100644 +--- a/gettext-sys/Cargo.toml ++++ b/gettext-sys/Cargo.toml +@@ -2,7 +2,7 @@ + name = "gettext-sys" + description = "Raw FFI bindings for gettext" + license = "MIT" +-version = "0.21.4" ++version = "0.22.5" + authors = ["Brian Olsen ", "Alexander Batischev "] + build = "build.rs" + links = "gettext" +diff --git a/gettext-sys/build.rs b/gettext-sys/build.rs +index 7772f74..42bc167 100644 +--- a/gettext-sys/build.rs ++++ b/gettext-sys/build.rs +@@ -191,7 +191,7 @@ fn main() { + let mut cmd = Command::new("tar"); + cmd.current_dir(&build_dir.join("gettext")) + .arg("xJf") +- .arg(&src.join("gettext-0.21.tar.xz")) ++ .arg(&src.join("gettext-0.22.5.tar.xz")) + .arg("--strip-components") + .arg("1"); + if host.contains("windows") { +diff --git a/systest/Cargo.toml b/systest/Cargo.toml +index 61895bb..43462d8 100644 +--- a/systest/Cargo.toml ++++ b/systest/Cargo.toml +@@ -10,3 +10,6 @@ gettext-sys = { path = "../gettext-sys" } + + [build-dependencies] + ctest2 = "0.4" ++ ++[features] ++cross_compiling = [] +diff --git a/systest/build.rs b/systest/build.rs +index 42650d9..c8bbca1 100644 +--- a/systest/build.rs ++++ b/systest/build.rs +@@ -5,9 +5,18 @@ use std::path::{Path, PathBuf}; + use std::process::{self, Command}; + + fn main() { ++ let target = env::var("TARGET").unwrap(); ++ let host = env::var("HOST").unwrap(); ++ let is_cross = target != host; ++ ++ // Set the cross_compiling flag before the tests ++ if is_cross { ++ println!("cargo:rustc-cfg=cross_compiling"); ++ println!("cargo::rustc-check-cfg=cfg(cross_compiling)"); ++ } ++ + let mut cfg = ctest2::TestGenerator::new(); + +- let target = env::var("TARGET").unwrap(); + if target.contains("freebsd") { + cfg.include("/usr/local/include"); + } +@@ -22,24 +31,38 @@ fn main() { + // Skip ptr check because the symbol name is different between glibc + // implementation and static lib. + // eg. gettext is libintl_gettext in static lib +- if env::var_os("GETTEXT_SYSTEM").is_none() || env::var("TARGET").unwrap().contains("windows") { ++ if env::var_os("GETTEXT_SYSTEM").is_none() || target.contains("windows") { + println!("Skipping ptr check"); + cfg.skip_fn_ptrcheck(|_| true); + } + + cfg.generate("../gettext-sys/lib.rs", "all.rs"); + +- // Check that we can find and run gettext binary ++ // Check for the existence of the gettext binary + let cmd = if let Some(bin) = env::var_os("DEP_GETTEXT_BIN") { + Path::new(&bin).join("gettext") + } else { + PathBuf::from("gettext") + }; +- let c = Command::new(&cmd).arg("--version").spawn(); +- if let Ok(mut child) = c { +- assert!(child.wait().unwrap().success()); +- } else { +- println!("Could not run {}", cmd.display()); ++ ++ if !cmd.exists() { ++ println!( ++ "cargo:warning=Gettext binary not found at {}", ++ cmd.display() ++ ); + process::exit(1); + } ++ ++ // Only run the binary if not cross-compiling ++ if !is_cross { ++ let c = Command::new(&cmd).arg("--version").spawn(); ++ if let Ok(mut child) = c { ++ assert!(child.wait().unwrap().success()); ++ } else { ++ println!("Could not run {}", cmd.display()); ++ process::exit(1); ++ } ++ } else { ++ println!("cargo:warning=Cross-compiling detected. Gettext binary found but not executed."); ++ } + } +diff --git a/systest/src/main.rs b/systest/src/main.rs +index befa675..522275d 100644 +--- a/systest/src/main.rs ++++ b/systest/src/main.rs +@@ -1,7 +1,20 @@ + #![allow(bad_style)] +- ++#![allow(unused_imports)] + extern crate gettext_sys; + ++#[cfg(not(feature = "cross_compiling"))] + use gettext_sys::*; + ++#[cfg(not(cross_compiling))] + include!(concat!(env!("OUT_DIR"), "/all.rs")); ++ ++#[cfg(feature = "cross_compiling")] ++fn main() { ++ println!("Cross-compilation detected. Skipping system tests."); ++} ++ ++#[cfg(feature = "cross_compiling")] ++#[test] ++fn dummy_cross_compile_test() { ++ println!("Cross-compilation detected. Skipping system tests."); ++} diff --git a/x11-packages/rnote/no-debug-Cargo.toml.patch b/x11-packages/rnote/no-debug-Cargo.toml.patch new file mode 100644 index 000000000000000..233ca84edf334bf --- /dev/null +++ b/x11-packages/rnote/no-debug-Cargo.toml.patch @@ -0,0 +1,18 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 6a6aa16..7043460 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -94,11 +94,11 @@ piet-cairo = { git = "https://github.com/linebender/piet", rev = "02eb5f0152e893 + + [profile.dev] + debug = true +-opt-level = 2 ++opt-level = 0 # We want proper gdb debugging for dev builds + + [profile.release] + codegen-units = 1 + lto = "fat" + opt-level = 3 + # We want to be able to debug in the release build as well +-debug = true ++#debug = true # Performance and size matters for termux's packaging diff --git a/x11-packages/rnote/remove-rodio-audio.patch b/x11-packages/rnote/remove-rodio-audio.patch new file mode 100644 index 000000000000000..5430f879a9a13bc --- /dev/null +++ b/x11-packages/rnote/remove-rodio-audio.patch @@ -0,0 +1,749 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 496eb27..edaf9a8 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -61,9 +61,9 @@ rand_distr = "0.4.3" + rand_pcg = "0.3.1" + rayon = "1.10" + regex = "1.10" +-rodio = { version = "0.19.0", default-features = false, features = [ +- "symphonia-wav", +-] } ++# rodio = { version = "0.19.0", default-features = false, features = [ ++# "symphonia-wav", ++# ] } + rough_piet = "0.6.0" + roughr = "0.6.0" + roxmltree = "0.20.0" + +diff --git a/crates/rnote-engine/Cargo.toml b/crates/rnote-engine/Cargo.toml +index c8add53..cbc551a 100644 +--- a/crates/rnote-engine/Cargo.toml ++++ b/crates/rnote-engine/Cargo.toml +@@ -40,7 +40,7 @@ rand_distr = { workspace = true } + rand_pcg = { workspace = true } + rayon = { workspace = true } + regex = { workspace = true } +-rodio = { workspace = true } ++# rodio = { workspace = true } + rough_piet = { workspace = true } + roughr = { workspace = true } + roxmltree = { workspace = true } + +diff --git a/crates/rnote-engine/src/audioplayer.rs b/crates/rnote-engine/src/audioplayer.rs.bak +similarity index 100% +rename from crates/rnote-engine/src/audioplayer.rs +rename to crates/rnote-engine/src/audioplayer.rs.bak + +diff --git a/crates/rnote-engine/src/meson.build b/crates/rnote-engine/src/meson.build +index eb75fb2..f216f6b 100644 +--- a/crates/rnote-engine/src/meson.build ++++ b/crates/rnote-engine/src/meson.build +@@ -52,7 +52,7 @@ rnote_engine_sources = files( + 'strokes/stroke.rs', + 'strokes/textstroke.rs', + 'strokes/vectorimage.rs', +- 'audioplayer.rs', ++# 'audioplayer.rs', + 'camera.rs', + 'cloneconfig.rs', + 'drawable.rs', + +diff --git a/crates/rnote-engine/src/lib.rs b/crates/rnote-engine/src/lib.rs +index 26e98c9..a840589 100644 +--- a/crates/rnote-engine/src/lib.rs ++++ b/crates/rnote-engine/src/lib.rs +@@ -9,7 +9,7 @@ + //! The main entry point is the [Engine] struct. + + // Modules +-pub mod audioplayer; ++// pub mod audioplayer; + pub mod camera; + pub mod cloneconfig; + pub mod document; +@@ -28,7 +28,7 @@ pub mod utils; + pub mod widgetflags; + + // Re-exports +-pub use audioplayer::AudioPlayer; ++// pub use audioplayer::AudioPlayer; + pub use camera::Camera; + pub use cloneconfig::CloneConfig; + pub use document::Document; + +diff --git a/crates/rnote-engine/src/engine/mod.rs b/crates/rnote-engine/src/engine/mod.rs +index 2e7ad19..abecc5d 100644 +--- a/crates/rnote-engine/src/engine/mod.rs ++++ b/crates/rnote-engine/src/engine/mod.rs +@@ -22,7 +22,7 @@ use crate::store::render_comp::{self, RenderCompState}; + use crate::store::StrokeKey; + use crate::strokes::content::GeneratedContentImages; + use crate::strokes::textstroke::{TextAttribute, TextStyle}; +-use crate::{render, AudioPlayer, CloneConfig, SelectionCollision, WidgetFlags}; ++use crate::{render, CloneConfig, SelectionCollision, WidgetFlags}; + use crate::{Camera, Document, PenHolder, StrokeStore}; + use futures::channel::{mpsc, oneshot}; + use p2d::bounding_volume::{Aabb, BoundingVolume}; +@@ -31,7 +31,7 @@ use rnote_compose::ext::AabbExt; + use rnote_compose::penevent::{PenEvent, ShortcutKey}; + use rnote_compose::{Color, SplitOrder}; + use serde::{Deserialize, Serialize}; +-use std::path::PathBuf; ++// use std::path::PathBuf; + use std::sync::Arc; + use std::time::Instant; + +@@ -44,7 +44,6 @@ pub struct EngineView<'a> { + pub document: &'a Document, + pub store: &'a StrokeStore, + pub camera: &'a Camera, +- pub audioplayer: &'a Option, + } + + /// A mutable view into the engine, excluding the penholder. +@@ -55,7 +54,6 @@ pub struct EngineViewMut<'a> { + pub document: &'a mut Document, + pub store: &'a mut StrokeStore, + pub camera: &'a mut Camera, +- pub audioplayer: &'a mut Option, + } + + impl<'a> EngineViewMut<'a> { +@@ -67,7 +65,6 @@ impl<'a> EngineViewMut<'a> { + document: self.document, + store: self.store, + camera: self.camera, +- audioplayer: self.audioplayer, + } + } + } +@@ -119,8 +116,6 @@ pub struct EngineConfig { + import_prefs: ImportPrefs, + #[serde(rename = "export_prefs")] + export_prefs: ExportPrefs, +- #[serde(rename = "pen_sounds")] +- pen_sounds: bool, + #[serde(rename = "optimize_epd")] + optimize_epd: bool, + } +@@ -167,13 +162,9 @@ pub struct Engine { + pub import_prefs: ImportPrefs, + #[serde(rename = "export_prefs")] + pub export_prefs: ExportPrefs, +- #[serde(rename = "pen_sounds")] +- pen_sounds: bool, + #[serde(rename = "optimize_epd")] + optimize_epd: bool, + +- #[serde(skip)] +- audioplayer: Option, + #[serde(skip)] + visual_debug: bool, + // the task sender. Must not be modified, only cloned. +@@ -207,10 +198,8 @@ impl Default for Engine { + penholder: PenHolder::default(), + import_prefs: ImportPrefs::default(), + export_prefs: ExportPrefs::default(), +- pen_sounds: false, + optimize_epd: false, + +- audioplayer: None, + visual_debug: false, + tasks_tx: EngineTaskSender(tasks_tx), + tasks_rx: Some(EngineTaskReceiver(tasks_rx)), +@@ -243,7 +232,6 @@ impl Engine { + document: &self.document, + store: &self.store, + camera: &self.camera, +- audioplayer: &self.audioplayer, + } + } + +@@ -255,36 +243,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, +- } +- } +- +- /// Whether pen sounds are enabled. +- pub fn pen_sounds(&self) -> bool { +- self.pen_sounds +- } +- +- /// Enables/disables the pen sounds. +- /// +- /// If pen sound should be enabled, the pkg data dir must be provided. +- pub fn set_pen_sounds(&mut self, pen_sounds: bool, pkg_data_dir: Option) { +- self.pen_sounds = pen_sounds; +- +- if pen_sounds { +- if let Some(pkg_data_dir) = pkg_data_dir { +- // Only create and init a new audioplayer if it does not already exists +- if self.audioplayer.is_none() { +- self.audioplayer = match AudioPlayer::new_init(pkg_data_dir) { +- Ok(audioplayer) => Some(audioplayer), +- Err(e) => { +- tracing::error!("Creating a new audioplayer failed while enabling pen sounds, Err: {e:?}"); +- None +- } +- } +- } +- } +- } else { +- self.audioplayer.take(); + } + } + +@@ -486,7 +444,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -506,7 +463,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -521,7 +477,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -539,7 +494,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -554,7 +508,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -568,7 +521,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }) + } + +@@ -767,7 +719,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }) + } + +@@ -782,7 +733,6 @@ impl Engine { + document: &self.document, + store: &self.store, + camera: &self.camera, +- audioplayer: &self.audioplayer, + }) + } + +@@ -797,7 +747,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }) + } + +@@ -906,7 +855,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -923,7 +871,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }) + } + widget_flags +@@ -943,7 +890,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -961,7 +907,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } +@@ -980,7 +925,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } else { +@@ -992,7 +936,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ) + } + + +diff --git a/crates/rnote-engine/src/pens/brush.rs b/crates/rnote-engine/src/pens/brush.rs +index d993bb8..8defca6 100644 +--- a/crates/rnote-engine/src/pens/brush.rs ++++ b/crates/rnote-engine/src/pens/brush.rs +@@ -74,12 +74,6 @@ impl PenBehaviour for Brush { + .bounds() + .loosened(Self::INPUT_OVERSHOOT), + ) { +- if engine_view.pens_config.brush_config.style == BrushStyle::Marker { +- play_marker_sound(engine_view); +- } else { +- trigger_brush_sound(engine_view); +- } +- + engine_view.pens_config.brush_config.new_style_seeds(); + + let brushstroke = Stroke::BrushStroke(BrushStroke::new( +@@ -176,18 +170,8 @@ impl PenBehaviour for Brush { + let propagate = builder_result.propagate; + + let progress = match builder_result.progress { +- BuilderProgress::InProgress => { +- if engine_view.pens_config.brush_config.style != BrushStyle::Marker { +- trigger_brush_sound(engine_view); +- } +- +- PenProgress::InProgress +- } ++ BuilderProgress::InProgress => PenProgress::InProgress, + BuilderProgress::EmitContinue(segments) => { +- if engine_view.pens_config.brush_config.style != BrushStyle::Marker { +- trigger_brush_sound(engine_view); +- } +- + let n_segments = segments.len(); + + if n_segments != 0 { +@@ -313,18 +297,6 @@ impl Brush { + const INPUT_OVERSHOOT: f64 = 30.0; + } + +-fn play_marker_sound(engine_view: &mut EngineViewMut) { +- if let Some(audioplayer) = engine_view.audioplayer { +- audioplayer.play_random_marker_sound(); +- } +-} +- +-fn trigger_brush_sound(engine_view: &mut EngineViewMut) { +- if let Some(audioplayer) = engine_view.audioplayer.as_mut() { +- audioplayer.trigger_random_brush_sound(); +- } +-} +- + fn new_builder( + builder_type: PenPathBuilderType, + element: Element, + +diff --git a/crates/rnote-engine/src/pens/typewriter/mod.rs b/crates/rnote-engine/src/pens/typewriter/mod.rs +index f4bd028..63d1c0a 100644 +--- a/crates/rnote-engine/src/pens/typewriter/mod.rs ++++ b/crates/rnote-engine/src/pens/typewriter/mod.rs +@@ -9,12 +9,12 @@ use crate::engine::{EngineTask, EngineView, EngineViewMut}; + use crate::store::StrokeKey; + use crate::strokes::textstroke::{RangedTextAttribute, TextAttribute, TextStyle}; + use crate::strokes::{Stroke, TextStroke}; +-use crate::{AudioPlayer, Camera, DrawableOnDoc, WidgetFlags}; ++use crate::{Camera, DrawableOnDoc, WidgetFlags}; + use futures::channel::oneshot; + use p2d::bounding_volume::{Aabb, BoundingVolume}; + use piet::RenderContext; + use rnote_compose::ext::{AabbExt, Vector2Ext}; +-use rnote_compose::penevent::{KeyboardKey, PenEvent, PenProgress, PenState}; ++use rnote_compose::penevent::{PenEvent, PenProgress, PenState}; + use rnote_compose::shapes::Shapeable; + use rnote_compose::style::indicators; + use rnote_compose::EventResult; +@@ -916,9 +916,3 @@ impl Typewriter { + self.cursor_visible = true; + } + } +- +-fn play_sound(keyboard_key: Option, audioplayer: &mut Option) { +- if let Some(audioplayer) = audioplayer { +- audioplayer.play_typewriter_key_sound(keyboard_key); +- } +-} + +diff --git a/crates/rnote-engine/src/pens/typewriter/penevents.rs b/crates/rnote-engine/src/pens/typewriter/penevents.rs +index 3fc6de8..8412aa5 100644 +--- a/crates/rnote-engine/src/pens/typewriter/penevents.rs ++++ b/crates/rnote-engine/src/pens/typewriter/penevents.rs +@@ -495,8 +495,6 @@ impl Typewriter { + progress: PenProgress::Idle, + }, + TypewriterState::Start(pos) => { +- super::play_sound(Some(keyboard_key), engine_view.audioplayer); +- + match keyboard_key { + KeyboardKey::Unicode(keychar) => { + text_style.ranged_text_attributes.clear(); +@@ -548,8 +546,6 @@ impl Typewriter { + } => { + match modify_state { + ModifyState::Up | ModifyState::Hover(_) => { +- super::play_sound(Some(keyboard_key), engine_view.audioplayer); +- + if let Some(Stroke::TextStroke(ref mut textstroke)) = + engine_view.store.get_stroke_mut(*stroke_key) + { +@@ -822,8 +818,6 @@ impl Typewriter { + selection_cursor, + finished, + } => { +- super::play_sound(Some(keyboard_key), engine_view.audioplayer); +- + if let Some(Stroke::TextStroke(textstroke)) = + engine_view.store.get_stroke_mut(*stroke_key) + { +@@ -1068,8 +1062,6 @@ impl Typewriter { + progress: PenProgress::Idle, + }, + TypewriterState::Start(pos) => { +- super::play_sound(None, engine_view.audioplayer); +- + text_style.ranged_text_attributes.clear(); + text_style.set_max_width(Some(text_width)); + let text_len = text.len(); +@@ -1110,8 +1102,6 @@ impl Typewriter { + } => { + match modify_state { + ModifyState::Up | ModifyState::Hover(_) => { +- super::play_sound(None, engine_view.audioplayer); +- + if let Some(Stroke::TextStroke(ref mut textstroke)) = + engine_view.store.get_stroke_mut(*stroke_key) + { +@@ -1151,8 +1141,6 @@ impl Typewriter { + selection_cursor, + finished, + } => { +- super::play_sound(None, engine_view.audioplayer); +- + if let Some(Stroke::TextStroke(textstroke)) = + engine_view.store.get_stroke_mut(*stroke_key) + { + +diff --git a/crates/rnote-engine/src/engine/import.rs b/crates/rnote-engine/src/engine/import.rs +index 7ba5359..ec600e3 100644 +--- a/crates/rnote-engine/src/engine/import.rs ++++ b/crates/rnote-engine/src/engine/import.rs +@@ -152,7 +152,7 @@ impl Engine { + pub fn load_engine_config( + &mut self, + engine_config: EngineConfig, +- data_dir: Option, ++ _data_dir: Option, + ) -> WidgetFlags { + let mut widget_flags = WidgetFlags::default(); + +@@ -162,9 +162,6 @@ impl Engine { + self.import_prefs = engine_config.import_prefs; + self.export_prefs = engine_config.export_prefs; + +- // Set the pen sounds to update the audioplayer +- self.set_pen_sounds(engine_config.pen_sounds, data_dir); +- + self.set_optimize_epd(engine_config.optimize_epd); + + widget_flags |= self +@@ -175,7 +172,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }); + widget_flags |= self.doc_resize_to_fit_content(); + widget_flags.redraw = true; +@@ -187,7 +183,7 @@ impl Engine { + pub fn load_engine_config_sync_tab( + &mut self, + engine_config: EngineConfig, +- data_dir: Option, ++ _data_dir: Option, + ) -> WidgetFlags { + let mut widget_flags = WidgetFlags::default(); + +@@ -196,9 +192,6 @@ impl Engine { + self.import_prefs = engine_config.import_prefs; + self.export_prefs = engine_config.export_prefs; + +- // Set the pen sounds to update the audioplayer +- self.set_pen_sounds(engine_config.pen_sounds, data_dir); +- + self.set_optimize_epd(engine_config.optimize_epd); + + widget_flags |= self +@@ -209,7 +202,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }); + widget_flags |= self.doc_resize_to_fit_content(); + widget_flags.redraw = true; +@@ -218,15 +210,13 @@ impl Engine { + } + + /// Import and replaces the engine config. +- /// +- /// If pen sounds should be enabled the rnote data-dir must be provided. + pub fn import_engine_config_from_json( + &mut self, + serialized_config: &str, + data_dir: Option, + ) -> anyhow::Result { + let engine_config = serde_json::from_str::(serialized_config)?; +- Ok(self.load_engine_config(engine_config, data_dir)) ++ Ok(self.load_engine_config(engine_config, data_dir)) + } + + /// Generate a vectorimage from the bytes. +@@ -439,7 +429,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }, + ); + } +@@ -490,7 +479,6 @@ impl Engine { + document: &mut self.document, + store: &mut self.store, + camera: &mut self.camera, +- audioplayer: &mut self.audioplayer, + }); + + widget_flags |= self.store.record(Instant::now()); + +diff --git a/crates/rnote-engine/src/engine/export.rs b/crates/rnote-engine/src/engine/export.rs +index 7c59237..b8c7720 100644 +--- a/crates/rnote-engine/src/engine/export.rs ++++ b/crates/rnote-engine/src/engine/export.rs +@@ -353,7 +353,6 @@ impl Engine { + penholder: self.penholder.clone_config(), + import_prefs: self.import_prefs.clone_config(), + export_prefs: self.export_prefs.clone_config(), +- pen_sounds: self.pen_sounds(), + optimize_epd: self.optimize_epd(), + } + } + +diff --git a/crates/rnote-engine/src/engine/rendering.rs b/crates/rnote-engine/src/engine/rendering.rs +index 30888b5..3f80ce0 100644 +--- a/crates/rnote-engine/src/engine/rendering.rs ++++ b/crates/rnote-engine/src/engine/rendering.rs +@@ -198,7 +198,6 @@ impl Engine { + document: &self.document, + store: &self.store, + camera: &self.camera, +- audioplayer: &self.audioplayer, + }, + )?; + +diff --git a/crates/rnote-engine/src/engine/visual_debug.rs b/crates/rnote-engine/src/engine/visual_debug.rs +index 5b673ff..a469257 100644 +--- a/crates/rnote-engine/src/engine/visual_debug.rs ++++ b/crates/rnote-engine/src/engine/visual_debug.rs +@@ -234,7 +234,6 @@ pub(crate) fn draw_stroke_debug_to_gtk_snapshot( + document: &engine.document, + store: &engine.store, + camera: &engine.camera, +- audioplayer: &engine.audioplayer, + }) { + draw_bounds_to_gtk_snapshot(bounds, COLOR_SELECTOR_BOUNDS, snapshot, border_widths); + } + +diff --git a/crates/rnote-ui/data/ui/canvasmenu.ui b/crates/rnote-ui/data/ui/canvasmenu.ui +index c123305..c6af1ac 100644 +--- a/crates/rnote-ui/data/ui/canvasmenu.ui ++++ b/crates/rnote-ui/data/ui/canvasmenu.ui +@@ -25,11 +25,6 @@ + + win.snap-positions + +- +- _Pen Sounds +- +- win.pen-sounds +- + + _Return to Origin Page + win.return-origin-page + +diff --git a/crates/rnote-ui/src/appwindow/mod.rs b/crates/rnote-ui/src/appwindow/mod.rs +index 935e09a..b512b75 100644 +--- a/crates/rnote-ui/src/appwindow/mod.rs ++++ b/crates/rnote-ui/src/appwindow/mod.rs +@@ -630,7 +630,6 @@ impl RnAppWindow { + + // Avoids already borrowed + let pen_style = canvas.engine_ref().penholder.current_pen_style_w_override(); +- let pen_sounds = canvas.engine_ref().pen_sounds(); + let doc_format = canvas.engine_ref().document.format; + let total_zoom = canvas.engine_ref().camera.total_zoom(); + let snap_positions = canvas.engine_ref().document.snap_positions; +@@ -656,11 +655,6 @@ impl RnAppWindow { + "pen-style", + &pen_style.to_string().to_variant(), + ); +- adw::prelude::ActionGroupExt::change_action_state( +- self, +- "pen-sounds", +- &pen_sounds.to_variant(), +- ); + adw::prelude::ActionGroupExt::change_action_state( + self, + "snap-positions", + +diff --git a/crates/rnote-ui/src/appwindow/actions.rs b/crates/rnote-ui/src/appwindow/actions.rs +index 14676df..2934f65 100644 +--- a/crates/rnote-ui/src/appwindow/actions.rs ++++ b/crates/rnote-ui/src/appwindow/actions.rs +@@ -67,9 +67,6 @@ impl RnAppWindow { + let action_focus_mode = gio::PropertyAction::new("focus-mode", self, "focus-mode"); + self.add_action(&action_focus_mode); + +- let action_pen_sounds = +- gio::SimpleAction::new_stateful("pen-sounds", None, &false.to_variant()); +- self.add_action(&action_pen_sounds); + let action_snap_positions = + gio::SimpleAction::new_stateful("snap-positions", None, &false.to_variant()); + self.add_action(&action_snap_positions); +@@ -278,15 +275,6 @@ impl RnAppWindow { + }), + ); + +- // Pen sounds +- action_pen_sounds.connect_change_state( +- clone!(@weak self as appwindow => move |action, state_request| { +- let pen_sounds = state_request.unwrap().get::().unwrap(); +- appwindow.active_tab_wrapper().canvas().engine_mut().set_pen_sounds(pen_sounds, crate::env::pkg_data_dir().ok()); +- action.set_state(&pen_sounds.to_variant()); +- }), +- ); +- + // Snap positions + action_snap_positions.connect_change_state( + clone!(@weak self as appwindow => move |action, state_request| { + +diff --git a/crates/rnote-engine/data/meson.build b/crates/rnote-engine/data/meson.build +index fe32317..47ee6b1 100644 +--- a/crates/rnote-engine/data/meson.build ++++ b/crates/rnote-engine/data/meson.build +@@ -1,59 +1,10 @@ + # sounds + sounds_files = files( +- 'sounds/brush/brush.wav', +- 'sounds/marker/marker_00.wav', +- 'sounds/marker/marker_01.wav', +- 'sounds/marker/marker_02.wav', +- 'sounds/marker/marker_03.wav', +- 'sounds/marker/marker_04.wav', +- 'sounds/marker/marker_05.wav', +- 'sounds/marker/marker_06.wav', +- 'sounds/marker/marker_07.wav', +- 'sounds/marker/marker_08.wav', +- 'sounds/marker/marker_09.wav', +- 'sounds/marker/marker_10.wav', +- 'sounds/marker/marker_11.wav', +- 'sounds/marker/marker_12.wav', +- 'sounds/marker/marker_13.wav', +- 'sounds/marker/marker_14.wav', +- 'sounds/typewriter/typewriter_00.wav', +- 'sounds/typewriter/typewriter_01.wav', +- 'sounds/typewriter/typewriter_02.wav', +- 'sounds/typewriter/typewriter_03.wav', +- 'sounds/typewriter/typewriter_04.wav', +- 'sounds/typewriter/typewriter_05.wav', +- 'sounds/typewriter/typewriter_06.wav', +- 'sounds/typewriter/typewriter_07.wav', +- 'sounds/typewriter/typewriter_08.wav', +- 'sounds/typewriter/typewriter_09.wav', +- 'sounds/typewriter/typewriter_10.wav', +- 'sounds/typewriter/typewriter_11.wav', +- 'sounds/typewriter/typewriter_12.wav', +- 'sounds/typewriter/typewriter_13.wav', +- 'sounds/typewriter/typewriter_14.wav', +- 'sounds/typewriter/typewriter_15.wav', +- 'sounds/typewriter/typewriter_16.wav', +- 'sounds/typewriter/typewriter_17.wav', +- 'sounds/typewriter/typewriter_18.wav', +- 'sounds/typewriter/typewriter_19.wav', +- 'sounds/typewriter/typewriter_20.wav', +- 'sounds/typewriter/typewriter_21.wav', +- 'sounds/typewriter/typewriter_22.wav', +- 'sounds/typewriter/typewriter_23.wav', +- 'sounds/typewriter/typewriter_24.wav', +- 'sounds/typewriter/typewriter_25.wav', +- 'sounds/typewriter/typewriter_26.wav', +- 'sounds/typewriter/typewriter_27.wav', +- 'sounds/typewriter/typewriter_28.wav', +- 'sounds/typewriter/typewriter_29.wav', +- 'sounds/typewriter/typewriter_bell.wav', +- 'sounds/typewriter/typewriter_insert.wav', +- 'sounds/typewriter/typewriter_linefeed.wav', +- 'sounds/typewriter/typewriter_thump.wav', ++ + ) + + # install sounds flat in one directory +-install_data(sounds_files, install_dir: pkgdatadir / 'sounds') ++# install_data(sounds_files, install_dir: pkgdatadir / 'sounds') + + + # fonts + +diff --git a/build-aux/com.github.flxzt.rnote.Devel.json b/build-aux/com.github.flxzt.rnote.Devel.json +index 198eab6..d587717 100644 +--- a/build-aux/com.github.flxzt.rnote.Devel.json ++++ b/build-aux/com.github.flxzt.rnote.Devel.json +@@ -16,7 +16,6 @@ + "--socket=fallback-x11", + "--device=dri", + "--share=ipc", +- "--socket=pulseaudio", + "--filesystem=xdg-documents", + "--filesystem=xdg-pictures", + "--filesystem=xdg-desktop",