diff --git a/bin/app/src/android/insets.rs b/bin/app/src/android/insets.rs index adf6fd271..e99be4c04 100644 --- a/bin/app/src/android/insets.rs +++ b/bin/app/src/android/insets.rs @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -use miniquad::native::android::{self, ndk_sys, ndk_utils}; +use miniquad::native::android::ndk_sys; use parking_lot::Mutex as SyncMutex; use std::sync::LazyLock; diff --git a/bin/app/src/android/mod.rs b/bin/app/src/android/mod.rs index d2d1576dd..a8941f7f5 100644 --- a/bin/app/src/android/mod.rs +++ b/bin/app/src/android/mod.rs @@ -16,9 +16,8 @@ * along with this program. If not, see . */ -use miniquad::native::android::{self, ndk_sys, ndk_utils}; -use parking_lot::Mutex as SyncMutex; -use std::{collections::HashMap, path::PathBuf, sync::LazyLock}; +use miniquad::native::android::{self, ndk_utils}; +use std::path::PathBuf; pub mod insets; pub mod textinput; diff --git a/bin/app/src/android/textinput/gametextinput.rs b/bin/app/src/android/textinput/gametextinput.rs index 5e0983f20..cac6b0c3f 100644 --- a/bin/app/src/android/textinput/gametextinput.rs +++ b/bin/app/src/android/textinput/gametextinput.rs @@ -16,12 +16,12 @@ * along with this program. If not, see . */ -use miniquad::native::android::{self, ndk_sys, ndk_utils::*}; -use parking_lot::{Mutex as SyncMutex, RwLock}; -use std::{ - ffi::CString, - sync::{Arc, OnceLock}, +use miniquad::native::android::{ + ndk_sys, + ndk_utils::{call_bool_method, call_void_method, get_utf_str, new_global_ref}, }; +use parking_lot::{Mutex as SyncMutex, RwLock}; +use std::{ffi::CString, sync::OnceLock}; use super::{super::util::get_jni_env, AndroidTextInputState, SharedStatePtr}; @@ -49,7 +49,7 @@ pub struct GameTextInput { input_connection_class: ndk_sys::jclass, state_class: ndk_sys::jclass, set_soft_keyboard_active_method: ndk_sys::jmethodID, - restart_input_method: ndk_sys::jmethodID, + //restart_input_method: ndk_sys::jmethodID, state_constructor: ndk_sys::jmethodID, state_class_info: StateClassInfo, } @@ -88,13 +88,13 @@ impl GameTextInput { set_soft_keyboard_active_sig.as_ptr() as _, ); - let restart_input_sig = b"()V\0"; + /*let restart_input_sig = b"()V\0"; let restart_input_method = get_method_id( env, input_connection_class, b"restartInput\0".as_ptr() as _, restart_input_sig.as_ptr() as _, - ); + );*/ let state_class = new_global_ref!(env, state_java_class) as ndk_sys::jclass; @@ -153,7 +153,7 @@ impl GameTextInput { input_connection_class, state_class, set_soft_keyboard_active_method, - restart_input_method, + //restart_input_method, state_constructor, state_class_info, } @@ -272,7 +272,7 @@ impl GameTextInput { } } - pub fn restart_input(&self) { + /*pub fn restart_input(&self) { let Some(input_connection) = *self.input_connection.read() else { w!("restart_input() - no input_connection set"); return @@ -282,7 +282,7 @@ impl GameTextInput { let call_void_method = (**env).CallVoidMethod.unwrap(); call_void_method(env, input_connection, self.restart_input_method); } - } + }*/ fn state_to_java(&self, state: &AndroidTextInputState) -> ndk_sys::jobject { unsafe { diff --git a/bin/app/src/android/textinput/mod.rs b/bin/app/src/android/textinput/mod.rs index f0738c5c4..4035c98f2 100644 --- a/bin/app/src/android/textinput/mod.rs +++ b/bin/app/src/android/textinput/mod.rs @@ -23,7 +23,7 @@ use std::sync::Arc; mod gametextinput; mod jni; -use gametextinput::{GameTextInput, GAME_TEXT_INPUT}; +use gametextinput::GAME_TEXT_INPUT; macro_rules! t { ($($arg:tt)*) => { trace!(target: "android::textinput", $($arg)*); } } diff --git a/bin/app/src/app/mod.rs b/bin/app/src/app/mod.rs index a421ef47a..7d4b1249d 100644 --- a/bin/app/src/app/mod.rs +++ b/bin/app/src/app/mod.rs @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -use chrono::{NaiveDate, NaiveDateTime}; -use darkfi_serial::Encodable; use sled_overlay::sled; use smol::Task; use std::sync::{Arc, Mutex as SyncMutex}; @@ -29,9 +27,9 @@ use crate::{ error::Error, gfx::{gfxtag, EpochIndex, GraphicsEventPublisherPtr, RenderApi}, plugin::PluginSettings, - prop::{Property, PropertyAtomicGuard, PropertySubType, PropertyType, PropertyValue, Role}, + prop::{PropertyAtomicGuard, PropertyValue, Role}, scene::{Pimpl, SceneNode, SceneNodePtr, SceneNodeType}, - ui::{chatview, Window}, + ui::Window, util::i18n::I18nBabelFish, ExecutorPtr, }; @@ -114,7 +112,7 @@ impl App { let i18n_fish = self.setup_locale(); - let mut window = create_window("window"); + let window = create_window("window"); #[cfg(target_os = "android")] { let insets = android::insets::get_insets(); diff --git a/bin/app/src/app/node.rs b/bin/app/src/app/node.rs index 07516b90f..e29f533ce 100644 --- a/bin/app/src/app/node.rs +++ b/bin/app/src/app/node.rs @@ -21,8 +21,6 @@ use crate::{ scene::{CallArgType, SceneNode, SceneNodeType}, }; -macro_rules! t { ($($arg:tt)*) => { trace!(target: "app::node", $($arg)*); } } - pub fn create_window(name: &str) -> SceneNode { let mut node = SceneNode::new(name, SceneNodeType::Window); diff --git a/bin/app/src/app/schema/mod.rs b/bin/app/src/app/schema/mod.rs index 8c28fca88..aa3b653d5 100644 --- a/bin/app/src/app/schema/mod.rs +++ b/bin/app/src/app/schema/mod.rs @@ -17,14 +17,13 @@ */ use darkfi::system::msleep; -use darkfi_serial::Encodable; use indoc::indoc; use sled_overlay::sled; use std::fs::File; use crate::{ app::{ - node::{create_button, create_layer, create_shortcut, create_vector_art, create_video}, + node::{create_button, create_layer, create_vector_art, create_video}, App, }, expr::{self, Compiler}, @@ -32,8 +31,8 @@ use crate::{ prop::{PropertyAtomicGuard, Role}, scene::{SceneNodePtr, Slot}, shape, - ui::{emoji_picker, Button, Layer, ShapeVertex, Shortcut, VectorArt, VectorShape, Video}, - util::{i18n::I18nBabelFish, spawn_thread}, + ui::{emoji_picker, Button, Layer, VectorArt, VectorShape, Video}, + util::i18n::I18nBabelFish, }; mod chat; @@ -72,10 +71,6 @@ mod ui_consts { get_appdata_path().join("first_time") } - pub fn get_window_scale_filename() -> PathBuf { - get_appdata_path().join("window_scale") - } - pub fn get_settingsdb_path() -> PathBuf { get_appdata_path().join("settings") } @@ -96,10 +91,6 @@ mod desktop_paths { dirs::cache_dir().unwrap().join("darkfi/app/first_time") } - pub fn get_window_scale_filename() -> PathBuf { - dirs::cache_dir().unwrap().join("darkfi/app/window_scale") - } - pub fn get_settingsdb_path() -> PathBuf { dirs::cache_dir().unwrap().join("darkfi/app/settings") } @@ -591,10 +582,10 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) { emoji_picker::EmojiMeshes::new(app.render_api.clone(), EMOJI_PICKER_ICON_SIZE); let emoji_meshes2 = emoji_meshes.clone(); - app.ex.spawn(async move { + let _ = std::thread::spawn(move || { for i in (0..500).step_by(20) { for j in i..(i + 20) { - emoji_meshes2.lock().await.get(j).await; + emoji_meshes2.lock().get(j); } } }); diff --git a/bin/app/src/app/schema/test.rs b/bin/app/src/app/schema/test.rs index c9cfde086..3f35f9044 100644 --- a/bin/app/src/app/schema/test.rs +++ b/bin/app/src/app/schema/test.rs @@ -21,17 +21,14 @@ use sled_overlay::sled; use super::chat::populate_tree; use crate::{ app::{ - node::{ - create_chatview, create_layer, create_singleline_edit, create_text, create_vector_art, - create_video, - }, + node::{create_chatview, create_layer, create_text, create_vector_art}, App, }, expr::{self, Compiler}, mesh::COLOR_PURPLE, prop::{PropertyAtomicGuard, PropertyFloat32, Role}, scene::SceneNodePtr, - ui::{BaseEdit, BaseEditType, ChatView, Layer, Text, VectorArt, VectorShape, Video}, + ui::{ChatView, Layer, Text, VectorArt, VectorShape}, util::i18n::I18nBabelFish, }; @@ -46,7 +43,7 @@ mod ui_consts { get_appdata_path().join("chatdb") } //pub const KING_PATH: &str = "king.png"; - pub const VID_PATH: &str = "forest_720x1280.mp4"; + //pub const VID_PATH: &str = "forest_720x1280.mp4"; } #[cfg(not(target_os = "android"))] @@ -57,7 +54,7 @@ mod ui_consts { "chatdb".into() } //pub const KING_PATH: &str = "assets/king.png"; - pub const VID_PATH: &str = "assets/forest_1920x1080.ivf"; + //pub const VID_PATH: &str = "assets/forest_1920x1080.ivf"; } use ui_consts::*; @@ -74,7 +71,7 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) { ) .unwrap(); - let mut cc = Compiler::new(); + let cc = Compiler::new(); // Create a layer called view let layer_node = create_layer("view"); diff --git a/bin/app/src/expr/mod.rs b/bin/app/src/expr/mod.rs index 1edf3cb4f..9bc11dd4f 100644 --- a/bin/app/src/expr/mod.rs +++ b/bin/app/src/expr/mod.rs @@ -29,7 +29,14 @@ mod compile; pub use compile::Compiler; pub type MachineGlobals = Vec<(String, SExprVal)>; -pub type NativeFnCallback = fn(&mut MachineGlobals) -> Result; +#[derive(Debug, Clone)] +pub struct NativeFnCallback(fn(&mut MachineGlobals) -> Result); + +impl PartialEq for NativeFnCallback { + fn eq(&self, _: &Self) -> bool { + false + } +} pub fn const_f32(x: f32) -> SExprCode { vec![Op::ConstFloat32(x)] @@ -187,7 +194,7 @@ impl<'a> SExprMachine<'a> { Op::LessThan((lhs, rhs)) => self.less_than(lhs, rhs), Op::Float32ToUint32(val) => self.float32_to_uint32(val), Op::IfElse((cond, if_val, else_val)) => self.if_else(cond, if_val, else_val), - Op::NativeFn(f) => (*f)(&mut self.globals), + Op::NativeFn(f) => (f.0)(&mut self.globals), } } @@ -451,7 +458,7 @@ impl Decodable for Op { Decodable::decode(d)?, Decodable::decode(d)?, )), - 17 => Self::NativeFn(|_| Ok(SExprVal::Null)), + 17 => Self::NativeFn(NativeFnCallback(|_| Ok(SExprVal::Null))), _ => return Err(std::io::Error::new(std::io::ErrorKind::Other, "Invalid Op type")), }; Ok(self_) diff --git a/bin/app/src/gfx/mod.rs b/bin/app/src/gfx/mod.rs index 27651ee1d..9e212fd77 100644 --- a/bin/app/src/gfx/mod.rs +++ b/bin/app/src/gfx/mod.rs @@ -23,13 +23,10 @@ use darkfi_serial::{ #[cfg(target_os = "android")] use miniquad::native::egl; use miniquad::{ - conf, window, Backend, Bindings, BlendFactor, BlendState, BlendValue, BufferLayout, - BufferSource, BufferType, BufferUsage, Equation, EventHandler, KeyCode, KeyMods, MouseButton, - PassAction, Pipeline, PipelineParams, RenderingBackend, ShaderMeta, ShaderSource, - TextureFormat, TextureKind, TextureParams, TextureWrap, TouchPhase, UniformDesc, UniformType, - VertexAttribute, VertexFormat, + conf, window, Bindings, BufferSource, BufferType, BufferUsage, EventHandler, KeyCode, KeyMods, + MouseButton, PassAction, Pipeline, RenderingBackend, TextureFormat, TextureKind, TextureParams, + TextureWrap, TouchPhase, UniformType, }; -use parking_lot::Mutex as SyncMutex; use std::{ collections::{HashMap, HashSet}, fs::File, @@ -50,8 +47,6 @@ mod shader; mod trax; use trax::get_trax; -#[cfg(target_os = "android")] -use crate::ExecutorPtr; use crate::{ prop::{BatchGuardId, PropertyAtomicGuard}, util::unixtime, diff --git a/bin/app/src/logger.rs b/bin/app/src/logger.rs index d233a90c2..016045990 100644 --- a/bin/app/src/logger.rs +++ b/bin/app/src/logger.rs @@ -29,7 +29,7 @@ use tracing_subscriber::filter::{LevelFilter, Targets}; #[cfg(any(not(target_os = "android"), feature = "enable-filelog"))] use { darkfi::util::logger::{EventFormatter, Level, TargetFilter}, - tracing_subscriber::fmt::format::FmtSpan, + //tracing_subscriber::fmt::format::FmtSpan, }; // Measured in bytes diff --git a/bin/app/src/main.rs b/bin/app/src/main.rs index 7ae5186ff..6f72a7f64 100644 --- a/bin/app/src/main.rs +++ b/bin/app/src/main.rs @@ -91,7 +91,7 @@ struct God { _bg_ex: ExecutorPtr, pub fg_runtime: AsyncRuntime, - pub fg_ex: ExecutorPtr, + _fg_ex: ExecutorPtr, /// App must fully finish setup() before start() is allowed to begin. cv_app_is_setup: Arc, @@ -191,7 +191,7 @@ impl God { _bg_ex: bg_ex, fg_runtime, - fg_ex, + _fg_ex: fg_ex, cv_app_is_setup, app, diff --git a/bin/app/src/mesh.rs b/bin/app/src/mesh.rs index a69e238e1..02fd7dcb6 100644 --- a/bin/app/src/mesh.rs +++ b/bin/app/src/mesh.rs @@ -30,7 +30,9 @@ pub const COLOR_DARKGREY: Color = [0.2, 0.2, 0.2, 1.]; pub const COLOR_LIGHTGREY: Color = [0.7, 0.7, 0.7, 1.]; #[allow(dead_code)] pub const COLOR_GREEN: Color = [0., 1., 0., 1.]; +#[allow(dead_code)] pub const COLOR_BLUE: Color = [0., 0., 1., 1.]; +#[allow(dead_code)] pub const COLOR_PINK: Color = [0.8, 0.3, 0.8, 1.]; pub const COLOR_CYAN: Color = [0., 1., 1., 1.]; #[allow(dead_code)] diff --git a/bin/app/src/prop/wrap.rs b/bin/app/src/prop/wrap.rs index 803fc81bc..71b0e3a27 100644 --- a/bin/app/src/prop/wrap.rs +++ b/bin/app/src/prop/wrap.rs @@ -367,6 +367,7 @@ impl PropertyRect { } */ + #[cfg(target_os = "android")] pub fn set(&self, atom: &mut PropertyAtomicGuard, rect: &Rectangle) { self.prop().set_f32(atom, self.role, 0, rect.x).unwrap(); self.prop().set_f32(atom, self.role, 1, rect.y).unwrap(); diff --git a/bin/app/src/text/editor/android.rs b/bin/app/src/text/editor/android.rs index 9d2fd503d..8c0290a8b 100644 --- a/bin/app/src/text/editor/android.rs +++ b/bin/app/src/text/editor/android.rs @@ -20,10 +20,7 @@ use std::cmp::{max, min}; use super::driver::ParleyDriverWrapper; use crate::{ - android::{ - self, - textinput::{AndroidTextInput, AndroidTextInputState}, - }, + android::textinput::{AndroidTextInput, AndroidTextInputState}, gfx::Point, mesh::Color, prop::{PropertyAtomicGuard, PropertyColor, PropertyFloat32, PropertyStr}, @@ -174,7 +171,7 @@ impl Editor { self.on_buffer_changed(atom); } - pub fn driver(&mut self) -> ParleyDriverWrapper { + pub fn driver(&mut self) -> ParleyDriverWrapper<'_> { ParleyDriverWrapper::new(&mut self.layout) } diff --git a/bin/app/src/text/editor/driver.rs b/bin/app/src/text/editor/driver.rs index fa4f686a1..251ddd50c 100644 --- a/bin/app/src/text/editor/driver.rs +++ b/bin/app/src/text/editor/driver.rs @@ -161,6 +161,7 @@ impl<'a> ParleyDriverWrapper<'a> { unimplemented!() } + #[allow(unused_variables)] pub fn insert_or_replace_selection(&mut self, text: &str) { #[cfg(not(target_os = "android"))] self.with_driver(|drv| drv.insert_or_replace_selection(text)); @@ -265,6 +266,7 @@ impl<'a> ParleyDriverWrapper<'a> { unimplemented!() } + #[allow(unused_variables)] pub fn move_to_point(&mut self, x: f32, y: f32) { #[cfg(not(target_os = "android"))] self.with_driver(|drv| drv.move_to_point(x, y)); @@ -273,14 +275,8 @@ impl<'a> ParleyDriverWrapper<'a> { unimplemented!() } - pub fn extend_selection_to_point(&mut self, x: f32, y: f32) { - #[cfg(not(target_os = "android"))] - self.with_driver(|drv| drv.extend_selection_to_point(x, y)); - - #[cfg(target_os = "android")] - unimplemented!() - } - + #[allow(unused_variables)] + #[allow(dead_code)] pub fn select_byte_range(&mut self, start: usize, end: usize) { #[cfg(not(target_os = "android"))] self.with_driver(|drv| drv.select_byte_range(start, end)); diff --git a/bin/app/src/text/editor/mod.rs b/bin/app/src/text/editor/mod.rs index 8d569e916..4618d6bc2 100644 --- a/bin/app/src/text/editor/mod.rs +++ b/bin/app/src/text/editor/mod.rs @@ -21,7 +21,6 @@ mod android; mod driver; #[cfg(target_os = "android")] pub use android::Editor; -pub use driver::ParleyDriverWrapper; #[cfg(not(target_os = "android"))] mod parley; diff --git a/bin/app/src/text/editor/parley.rs b/bin/app/src/text/editor/parley.rs index 69ec32efa..655329fc2 100644 --- a/bin/app/src/text/editor/parley.rs +++ b/bin/app/src/text/editor/parley.rs @@ -114,7 +114,7 @@ impl Editor { self.on_buffer_changed(atom); } - pub fn driver(&mut self) -> ParleyDriverWrapper { + pub fn driver(&mut self) -> ParleyDriverWrapper<'_> { ParleyDriverWrapper::new(&mut self.editor) } diff --git a/bin/app/src/text/mod.rs b/bin/app/src/text/mod.rs index 303fc87f7..826118f99 100644 --- a/bin/app/src/text/mod.rs +++ b/bin/app/src/text/mod.rs @@ -23,11 +23,11 @@ use std::{ sync::{Arc, LazyLock}, }; -use crate::{mesh::Color, util::spawn_thread}; +use crate::mesh::Color; pub mod atlas; mod editor; -pub use editor::{Editor, ParleyDriverWrapper}; +pub use editor::Editor; mod render; pub use render::{render_layout, render_layout_with_opts, DebugRenderOptions}; diff --git a/bin/app/src/text/render.rs b/bin/app/src/text/render.rs index f04b0699a..3ac52428d 100644 --- a/bin/app/src/text/render.rs +++ b/bin/app/src/text/render.rs @@ -71,7 +71,7 @@ pub fn render_layout_with_opts( for item in line.items() { match item { parley::PositionedLayoutItem::GlyphRun(glyph_run) => { - push_glyphs(&mut atlas, &glyph_run, run_idx, &mut scale_ctx, render_api, tag); + push_glyphs(&mut atlas, &glyph_run, run_idx, &mut scale_ctx); run_idx += 1; } parley::PositionedLayoutItem::InlineBox(_) => {} @@ -89,15 +89,7 @@ pub fn render_layout_with_opts( for item in line.items() { match item { parley::PositionedLayoutItem::GlyphRun(glyph_run) => { - let mesh = render_glyph_run( - &mut scale_ctx, - &glyph_run, - run_idx, - opts, - &atlas, - render_api, - tag, - ); + let mesh = render_glyph_run(&glyph_run, run_idx, opts, &atlas, render_api, tag); instrs.push(DrawInstruction::Draw(mesh)); run_idx += 1; } @@ -113,8 +105,6 @@ fn push_glyphs( glyph_run: &parley::GlyphRun<'_, Color>, run_idx: RunIdx, scale_ctx: &mut swash::scale::ScaleContext, - render_api: &RenderApi, - tag: DebugTag, ) { let run = glyph_run.run(); let font = run.font(); @@ -135,7 +125,6 @@ fn push_glyphs( } fn render_glyph_run( - scale_ctx: &mut swash::scale::ScaleContext, glyph_run: &parley::GlyphRun<'_, Color>, run_idx: usize, opts: DebugRenderOptions, @@ -217,31 +206,3 @@ fn render_underline( mesh.draw_line(start, end, color, width); } - -fn create_atlas( - scale_ctx: &mut swash::scale::ScaleContext, - glyph_run: &parley::GlyphRun<'_, Color>, - run_idx: usize, - render_api: &RenderApi, - tag: DebugTag, -) -> RenderedAtlas { - let run = glyph_run.run(); - let font = run.font(); - let font_size = run.font_size(); - let normalized_coords = run.normalized_coords(); - let font_ref = swash::FontRef::from_index(font.data.as_ref(), font.index as usize).unwrap(); - - let mut scaler = scale_ctx - .builder(font_ref) - .size(font_size) - .hint(true) - .normalized_coords(normalized_coords) - .build(); - - let mut atlas = Atlas::new(render_api, tag); - for glyph in glyph_run.glyphs() { - atlas.push_glyph(glyph.id as u16, run_idx, &mut scaler); - } - //atlas.dump(&format!("/tmp/atlas_{run_idx}.png")); - atlas.make() -} diff --git a/bin/app/src/ui/chatview/mod.rs b/bin/app/src/ui/chatview/mod.rs index c28069690..1ddee7e25 100644 --- a/bin/app/src/ui/chatview/mod.rs +++ b/bin/app/src/ui/chatview/mod.rs @@ -43,8 +43,8 @@ use page::{FileMessageStatus, MessageBuffer}; use crate::{ gfx::{gfxtag, DrawCall, DrawInstruction, Point, Rectangle, RenderApi}, prop::{ - BatchGuardId, BatchGuardPtr, PropertyAtomicGuard, PropertyBool, PropertyColor, - PropertyFloat32, PropertyRect, PropertyUint32, Role, + BatchGuardId, BatchGuardPtr, PropertyAtomicGuard, PropertyColor, PropertyFloat32, + PropertyRect, PropertyUint32, Role, }, scene::{MethodCallSub, Pimpl, SceneNodePtr, SceneNodeWeak}, ExecutorPtr, @@ -66,6 +66,7 @@ fn is_zero(x: f32) -> bool { } /// std::cmp::max() doesn't work on f32 +#[allow(dead_code)] fn max(a: f32, b: f32) -> f32 { if a > b { a @@ -217,7 +218,8 @@ impl ChatView { let hi_bg_color = PropertyColor::wrap(node_ref, Role::Internal, "hi_bg_color").unwrap(); let z_index = PropertyUint32::wrap(node_ref, Role::Internal, "z_index", 0).unwrap(); let priority = PropertyUint32::wrap(node_ref, Role::Internal, "priority", 0).unwrap(); - let debug = PropertyBool::wrap(node_ref, Role::Internal, "debug", 0).unwrap(); + // Unused currently + //let debug = PropertyBool::wrap(node_ref, Role::Internal, "debug", 0).unwrap(); let scroll_start_accel = PropertyFloat32::wrap(node_ref, Role::Internal, "scroll_start_accel", 0).unwrap(); @@ -249,7 +251,6 @@ impl ChatView { text_color, nick_colors, hi_bg_color, - debug, window_scale, render_api, )), diff --git a/bin/app/src/ui/chatview/page.rs b/bin/app/src/ui/chatview/page.rs index 2d3c16191..bd8d3f613 100644 --- a/bin/app/src/ui/chatview/page.rs +++ b/bin/app/src/ui/chatview/page.rs @@ -37,7 +37,7 @@ use super::{MessageId, Timestamp}; use crate::{ gfx::{gfxtag, DrawInstruction, ManagedTexturePtr, Point, Rectangle, RenderApi}, mesh::{Color, MeshBuilder, COLOR_CYAN, COLOR_GREEN, COLOR_RED, COLOR_WHITE}, - prop::{PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr}, + prop::{PropertyColor, PropertyFloat32, PropertyPtr}, text, util::enumerate_mut, }; @@ -305,7 +305,7 @@ impl DateMessage { &[], ); - let mut instrs = text::render_layout(&layout, render_api, gfxtag!("chatview_datemsg")); + let instrs = text::render_layout(&layout, render_api, gfxtag!("chatview_datemsg")); // Cache the instructions self.mesh_cache = Some(instrs.clone()); instrs @@ -730,7 +730,6 @@ pub struct MessageBuffer { /// From most recent to older msgs: Vec, date_msgs: HashMap, - pub line_width: f32, font_size: PropertyFloat32, timestamp_font_size: PropertyFloat32, @@ -742,7 +741,6 @@ pub struct MessageBuffer { text_color: PropertyColor, nick_colors: PropertyPtr, hi_bg_color: PropertyColor, - debug: PropertyBool, window_scale: PropertyFloat32, /// Used to detect if the window scale was changed when drawing. @@ -764,7 +762,6 @@ impl MessageBuffer { text_color: PropertyColor, nick_colors: PropertyPtr, hi_bg_color: PropertyColor, - debug: PropertyBool, window_scale: PropertyFloat32, render_api: RenderApi, ) -> Self { @@ -772,7 +769,6 @@ impl MessageBuffer { Self { msgs: vec![], date_msgs: HashMap::new(), - line_width: 0., font_size, timestamp_font_size, @@ -784,7 +780,6 @@ impl MessageBuffer { text_color, nick_colors, hi_bg_color, - debug, window_scale, old_window_scale, @@ -812,7 +807,6 @@ impl MessageBuffer { let window_scale = self.window_scale.get(); let font_size = self.font_size.get(); let timestamp_font_size = self.timestamp_font_size.get(); - let timestamp_width = self.timestamp_width.get(); for msg in &mut self.msgs { msg.adjust_params(font_size, timestamp_font_size, window_scale); @@ -985,9 +979,7 @@ impl MessageBuffer { ) -> Vec<(f32, Vec)> { let line_height = self.line_height.get(); let msg_spacing = self.msg_spacing.get(); - let baseline = self.baseline.get(); let timestamp_width = self.timestamp_width.get(); - let debug_render = self.debug.get(); let timest_color = self.timestamp_color.get(); let text_color = self.text_color.get(); diff --git a/bin/app/src/ui/edit/behave.rs b/bin/app/src/ui/edit/behave.rs index a5e321b6f..4c8a8c4e0 100644 --- a/bin/app/src/ui/edit/behave.rs +++ b/bin/app/src/ui/edit/behave.rs @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -use async_trait::async_trait; use atomic_float::AtomicF32; use parking_lot::Mutex as SyncMutex; use std::sync::{atomic::Ordering, Arc}; diff --git a/bin/app/src/ui/edit/mod.rs b/bin/app/src/ui/edit/mod.rs index d88e79168..d5220cf39 100644 --- a/bin/app/src/ui/edit/mod.rs +++ b/bin/app/src/ui/edit/mod.rs @@ -27,7 +27,6 @@ use rand::{rngs::OsRng, Rng}; use std::{ io::Cursor, mem::swap, - ops::{Deref, DerefMut}, sync::{ atomic::{AtomicBool, Ordering}, Arc, Weak, @@ -39,7 +38,7 @@ use tracing::instrument; use crate::android::textinput::AndroidTextInputState; use crate::{ gfx::{gfxtag, DrawCall, DrawInstruction, DrawMesh, Point, Rectangle, RenderApi, Vertex}, - mesh::{Color, MeshBuilder}, + mesh::MeshBuilder, prop::{ BatchGuardId, BatchGuardPtr, PropertyAtomicGuard, PropertyBool, PropertyColor, PropertyFloat32, PropertyPtr, PropertyRect, PropertyStr, PropertyUint32, Role, @@ -236,6 +235,7 @@ pub struct BaseEdit { touch_info: SyncMutex, is_phone_select: AtomicBool, + // TODO: we should make use of this! window_scale: PropertyFloat32, parent_rect: Arc>>, is_mouse_hover: AtomicBool, diff --git a/bin/app/src/ui/emoji_picker/emoji.rs b/bin/app/src/ui/emoji_picker/emoji.rs index e28f0b855..46e65ec61 100644 --- a/bin/app/src/ui/emoji_picker/emoji.rs +++ b/bin/app/src/ui/emoji_picker/emoji.rs @@ -16,23 +16,18 @@ * along with this program. If not, see . */ -use async_lock::Mutex as AsyncMutex; -use std::{ - fs::File, - io::{BufRead, BufReader}, - path::{Path, PathBuf}, - sync::Arc, -}; +use parking_lot::Mutex as SyncMutex; +use std::sync::Arc; use crate::{ - gfx::{gfxtag, DrawInstruction, DrawMesh, Rectangle, RenderApi}, - mesh::{MeshBuilder, COLOR_WHITE}, + gfx::{gfxtag, DrawInstruction, DrawMesh, RenderApi}, + mesh::COLOR_WHITE, text, }; use super::default::DEFAULT_EMOJI_LIST; -pub type EmojiMeshesPtr = Arc>; +pub type EmojiMeshesPtr = Arc>; pub struct EmojiMeshes { render_api: RenderApi, @@ -42,14 +37,14 @@ pub struct EmojiMeshes { impl EmojiMeshes { pub fn new(render_api: RenderApi, emoji_size: f32) -> EmojiMeshesPtr { - Arc::new(AsyncMutex::new(Self { render_api, emoji_size, meshes: vec![] })) + Arc::new(SyncMutex::new(Self { render_api, emoji_size, meshes: vec![] })) } pub fn clear(&mut self) { self.meshes.clear(); } - pub async fn get(&mut self, i: usize) -> DrawMesh { + pub fn get(&mut self, i: usize) -> DrawMesh { assert!(i < DEFAULT_EMOJI_LIST.len()); self.meshes.reserve_exact(DEFAULT_EMOJI_LIST.len()); @@ -57,7 +52,7 @@ impl EmojiMeshes { //d!("EmojiMeshes loading new glyphs"); for j in self.meshes.len()..=i { let emoji = DEFAULT_EMOJI_LIST[j]; - let mesh = self.gen_emoji_mesh(emoji).await; + let mesh = self.gen_emoji_mesh(emoji); self.meshes.push(mesh); } } @@ -66,7 +61,7 @@ impl EmojiMeshes { } /// Make mesh for this emoji centered at (0, 0) - async fn gen_emoji_mesh(&self, emoji: &str) -> DrawMesh { + fn gen_emoji_mesh(&self, emoji: &str) -> DrawMesh { //d!("rendering emoji: '{emoji}'"); // The params here don't actually matter since we're talking about BMP fixed sizes let layout = text::make_layout(emoji, COLOR_WHITE, self.emoji_size, 1., 1., None, &[]); diff --git a/bin/app/src/ui/emoji_picker/mod.rs b/bin/app/src/ui/emoji_picker/mod.rs index 24cebbc1f..8052e99d5 100644 --- a/bin/app/src/ui/emoji_picker/mod.rs +++ b/bin/app/src/ui/emoji_picker/mod.rs @@ -161,7 +161,6 @@ impl EmojiPicker { //d!(" = {idx}, emoji_len = {}", emoji::EMOJI_LIST.len()); let emoji_selected = { - let emoji_meshes = self.emoji_meshes.lock().await; if idx < DEFAULT_EMOJI_LIST.len() { let emoji = DEFAULT_EMOJI_LIST[idx].to_string(); Some(emoji) @@ -218,7 +217,7 @@ impl EmojiPicker { let mut y = -self.scroll.get(); for i in 0..DEFAULT_EMOJI_LIST.len() { let pos = Point::new(x, y); - let mesh = self.emoji_meshes.lock().await.get(i).await; + let mesh = self.emoji_meshes.lock().get(i); instrs.extend_from_slice(&[DrawInstruction::SetPos(pos), DrawInstruction::Draw(mesh)]); x += off_x; diff --git a/bin/app/src/ui/gesture.rs b/bin/app/src/ui/gesture.rs index 5c2ae3551..e658fc17d 100644 --- a/bin/app/src/ui/gesture.rs +++ b/bin/app/src/ui/gesture.rs @@ -30,7 +30,6 @@ use crate::{ use super::UIObject; macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::gesture", $($arg)*); } } -macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::gesture", $($arg)*); } } /// Maximum number of simultaneous touch events. /// Put 3 here because any more is ridiculous. diff --git a/bin/app/src/ui/image.rs b/bin/app/src/ui/image.rs index 3c2ef23de..4a99952bf 100644 --- a/bin/app/src/ui/image.rs +++ b/bin/app/src/ui/image.rs @@ -34,8 +34,6 @@ use crate::{ use super::{DrawUpdate, OnModify, UIObject}; -macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::image", $($arg)*); } } - pub type ImagePtr = Arc; pub struct Image { diff --git a/bin/app/src/ui/mod.rs b/bin/app/src/ui/mod.rs index 882bd2247..be94cba52 100644 --- a/bin/app/src/ui/mod.rs +++ b/bin/app/src/ui/mod.rs @@ -43,6 +43,7 @@ mod image; #[allow(unused_imports)] pub use image::{Image, ImagePtr}; mod vid; +#[allow(unused_imports)] pub use vid::{Video, VideoPtr}; mod vector_art; pub use vector_art::{ diff --git a/bin/app/src/ui/text.rs b/bin/app/src/ui/text.rs index f4388d52e..22567f6c5 100644 --- a/bin/app/src/ui/text.rs +++ b/bin/app/src/ui/text.rs @@ -37,8 +37,6 @@ use crate::{ use super::{DrawUpdate, OnModify, UIObject}; -macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::text", $($arg)*); } } - pub type TextPtr = Arc; pub struct Text { diff --git a/bin/app/src/ui/vector_art/mod.rs b/bin/app/src/ui/vector_art/mod.rs index b90809fc2..3fcd20b3d 100644 --- a/bin/app/src/ui/vector_art/mod.rs +++ b/bin/app/src/ui/vector_art/mod.rs @@ -34,8 +34,6 @@ use super::{DrawUpdate, OnModify, UIObject}; pub mod shape; use shape::VectorShape; -macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui:vector_art", $($arg)*); } } - pub type VectorArtPtr = Arc; pub struct VectorArt { diff --git a/bin/app/src/ui/vid/decode/android.rs b/bin/app/src/ui/vid/decode/android.rs index 65613292b..398474653 100644 --- a/bin/app/src/ui/vid/decode/android.rs +++ b/bin/app/src/ui/vid/decode/android.rs @@ -56,7 +56,7 @@ pub fn spawn_decoder_thread( vid::videodecoder_set_id(decoder_handle.obj, decoder_id); - let decoded_count = vid::videodecoder_decode_all(decoder_handle.obj); + let _decoded_count = vid::videodecoder_decode_all(decoder_handle.obj); drop(decoder_handle); diff --git a/bin/app/src/ui/vid/ivf.rs b/bin/app/src/ui/vid/ivf.rs index b9a2ea9b1..cdc2217f0 100644 --- a/bin/app/src/ui/vid/ivf.rs +++ b/bin/app/src/ui/vid/ivf.rs @@ -66,8 +66,8 @@ pub struct IvfHeader { version: u16, header_len: u16, codec_fourcc: [u8; 4], - pub width: u16, - pub height: u16, + width: u16, + height: u16, timebase_den: u32, timebase_num: u32, pub num_frames: u32, diff --git a/bin/app/src/ui/vid/mod.rs b/bin/app/src/ui/vid/mod.rs index da69c4808..3bc9fd899 100644 --- a/bin/app/src/ui/vid/mod.rs +++ b/bin/app/src/ui/vid/mod.rs @@ -36,12 +36,11 @@ use crate::{ use super::{DrawUpdate, OnModify, UIObject}; mod decode; +#[allow(dead_code)] mod ivf; use decode::spawn_decoder_thread; -macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui:video", $($arg)*); } } - pub type VideoPtr = Arc