diff --git a/Cargo.lock b/Cargo.lock
index 908d0ab..547c91d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6301,7 +6301,7 @@ dependencies = [
[[package]]
name = "wayvr_ipc"
version = "0.1.0"
-source = "git+https://github.com/olekolek1000/wayvr-ipc.git?rev=a72587d23f3bb8624d9aeb1f13c0a21e65350f51#a72587d23f3bb8624d9aeb1f13c0a21e65350f51"
+source = "git+https://github.com/olekolek1000/wayvr-ipc.git?rev=6d253ef9e36db0f181566030a4990454ecb60395#6d253ef9e36db0f181566030a4990454ecb60395"
dependencies = [
"anyhow",
"bytes",
diff --git a/Cargo.toml b/Cargo.toml
index b1d75a7..2d6f7b8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,4 +34,4 @@ vulkano = { version = "0.35.2", default-features = false, features = [
] }
vulkano-shaders = "0.35.0"
wayland-client = { version = "0.31.11" }
-wayvr_ipc = { git = "https://github.com/olekolek1000/wayvr-ipc.git", rev = "a72587d23f3bb8624d9aeb1f13c0a21e65350f51", default-features = false }
+wayvr_ipc = { git = "https://github.com/olekolek1000/wayvr-ipc.git", rev = "6d253ef9e36db0f181566030a4990454ecb60395", default-features = false }
diff --git a/dash-frontend/assets/gui/dashboard.xml b/dash-frontend/assets/gui/dashboard.xml
index aaab8af..498ef10 100644
--- a/dash-frontend/assets/gui/dashboard.xml
+++ b/dash-frontend/assets/gui/dashboard.xml
@@ -19,7 +19,7 @@
tooltip="${tooltip}"
tooltip_side="${tooltip_side}"
>
-
+
@@ -46,13 +46,13 @@
align_items="center"
gap="4"
>
-
-
-
-
-
+
+
+
+
+
-
+
@@ -130,10 +130,10 @@
-
+
-
+
diff --git a/dash-frontend/assets/gui/t_group_box.xml b/dash-frontend/assets/gui/t_group_box.xml
index d91b25e..799bb12 100644
--- a/dash-frontend/assets/gui/t_group_box.xml
+++ b/dash-frontend/assets/gui/t_group_box.xml
@@ -14,7 +14,7 @@
-
+
diff --git a/dash-frontend/assets/gui/t_menu_button.xml b/dash-frontend/assets/gui/t_menu_button.xml
index 671189e..2aed09a 100644
--- a/dash-frontend/assets/gui/t_menu_button.xml
+++ b/dash-frontend/assets/gui/t_menu_button.xml
@@ -15,7 +15,7 @@
align_items="center"
justify_content="center"
flex_direction="column">
-
+
diff --git a/dash-frontend/assets/gui/tab/apps.xml b/dash-frontend/assets/gui/tab/apps.xml
index fd8bf48..d4ed901 100644
--- a/dash-frontend/assets/gui/tab/apps.xml
+++ b/dash-frontend/assets/gui/tab/apps.xml
@@ -19,12 +19,12 @@
-
+
-
+
-
+
diff --git a/dash-frontend/assets/gui/tab/home.xml b/dash-frontend/assets/gui/tab/home.xml
index 7a9d2ff..eeafbfd 100644
--- a/dash-frontend/assets/gui/tab/home.xml
+++ b/dash-frontend/assets/gui/tab/home.xml
@@ -8,7 +8,7 @@
align_items="center"
flex_grow="1"
gap="24">
-
+
diff --git a/dash-frontend/assets/gui/tab/processes.xml b/dash-frontend/assets/gui/tab/processes.xml
index d823429..147ad71 100644
--- a/dash-frontend/assets/gui/tab/processes.xml
+++ b/dash-frontend/assets/gui/tab/processes.xml
@@ -5,5 +5,6 @@
+
\ No newline at end of file
diff --git a/dash-frontend/assets/gui/tab/settings.xml b/dash-frontend/assets/gui/tab/settings.xml
index 592c2b0..58b1547 100644
--- a/dash-frontend/assets/gui/tab/settings.xml
+++ b/dash-frontend/assets/gui/tab/settings.xml
@@ -5,37 +5,36 @@
-
-
+
-
+
-
+
-
+
-
+
@@ -49,13 +48,7 @@
\ No newline at end of file
diff --git a/dash-frontend/assets/gui/tab/t_tab_title.xml b/dash-frontend/assets/gui/tab/t_tab_title.xml
index fc7e2b0..a7f63e1 100644
--- a/dash-frontend/assets/gui/tab/t_tab_title.xml
+++ b/dash-frontend/assets/gui/tab/t_tab_title.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/dash-frontend/assets/gui/view/audio_settings.xml b/dash-frontend/assets/gui/view/audio_settings.xml
index c792333..e67a73b 100644
--- a/dash-frontend/assets/gui/view/audio_settings.xml
+++ b/dash-frontend/assets/gui/view/audio_settings.xml
@@ -29,7 +29,7 @@
-
+
@@ -54,15 +54,15 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/dash-frontend/assets/gui/view/process_list.xml b/dash-frontend/assets/gui/view/process_list.xml
new file mode 100644
index 0000000..3794906
--- /dev/null
+++ b/dash-frontend/assets/gui/view/process_list.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dash-frontend/assets/lang/de.json b/dash-frontend/assets/lang/de.json
index 0574d78..4e6ea38 100644
--- a/dash-frontend/assets/lang/de.json
+++ b/dash-frontend/assets/lang/de.json
@@ -59,5 +59,9 @@
"HIDE": "Verbergen",
"REMOVE": "Entfernen",
"SHOW": "Anzeigen",
- "DISPLAY_OPTIONS": "Anzeigeeinstellungen"
+ "DISPLAY_OPTIONS": "Anzeigeeinstellungen",
+ "PROCESS_LIST": {
+ "NO_PROCESSES_FOUND": "Keine Prozesse gefunden",
+ "LOCATED_ON": "auf"
+ }
}
\ No newline at end of file
diff --git a/dash-frontend/assets/lang/en.json b/dash-frontend/assets/lang/en.json
index deff9fd..f75917e 100644
--- a/dash-frontend/assets/lang/en.json
+++ b/dash-frontend/assets/lang/en.json
@@ -55,6 +55,11 @@
"POPUP_ADD_DISPLAY": {
"RESOLUTION": "Resolution"
},
+ "PROCESS_LIST": {
+ "LOCATED_ON": "on",
+ "NO_PROCESSES_FOUND": "No processes found",
+ "TERMINATE_PROCESS_NAMED_X": "Terminate process \"{PROCESS_NAME}\""
+ },
"PROCESSES": "Processes",
"REMOVE": "Remove",
"SETTINGS": "Settings",
diff --git a/dash-frontend/assets/lang/es.json b/dash-frontend/assets/lang/es.json
index 090c9ff..cd6837f 100644
--- a/dash-frontend/assets/lang/es.json
+++ b/dash-frontend/assets/lang/es.json
@@ -59,5 +59,9 @@
"HIDE": "Ocultar",
"REMOVE": "Eliminar",
"SHOW": "Mostrar",
- "DISPLAY_OPTIONS": "Opciones de pantalla"
+ "DISPLAY_OPTIONS": "Opciones de pantalla",
+ "PROCESS_LIST": {
+ "NO_PROCESSES_FOUND": "No se encontraron procesos",
+ "LOCATED_ON": "en"
+ }
}
\ No newline at end of file
diff --git a/dash-frontend/assets/lang/ja.json b/dash-frontend/assets/lang/ja.json
index 20ae809..87f9122 100644
--- a/dash-frontend/assets/lang/ja.json
+++ b/dash-frontend/assets/lang/ja.json
@@ -59,5 +59,9 @@
"HIDE": "隠す",
"REMOVE": "削除",
"SHOW": "表示",
- "DISPLAY_OPTIONS": "表示オプション"
+ "DISPLAY_OPTIONS": "表示オプション",
+ "PROCESS_LIST": {
+ "NO_PROCESSES_FOUND": "プロセスが見つかりませんでした",
+ "LOCATED_ON": "に"
+ }
}
\ No newline at end of file
diff --git a/dash-frontend/assets/lang/pl.json b/dash-frontend/assets/lang/pl.json
index 1a05a86..0f99b4a 100644
--- a/dash-frontend/assets/lang/pl.json
+++ b/dash-frontend/assets/lang/pl.json
@@ -59,5 +59,9 @@
"SETTINGS": "Ustawienia",
"SHOW": "Pokaż",
"WIDTH": "Szerokość",
- "PROCESSES": "Procesy"
+ "PROCESSES": "Procesy",
+ "PROCESS_LIST": {
+ "NO_PROCESSES_FOUND": "Nie znaleziono procesów",
+ "LOCATED_ON": "na"
+ }
}
\ No newline at end of file
diff --git a/dash-frontend/src/frontend.rs b/dash-frontend/src/frontend.rs
index 14c762c..e34dbe5 100644
--- a/dash-frontend/src/frontend.rs
+++ b/dash-frontend/src/frontend.rs
@@ -429,7 +429,7 @@ impl Frontend {
}
fn action_recenter_playspace(&mut self) -> anyhow::Result<()> {
- log::info!("todo");
+ self.interface.recenter_playspace()?;
Ok(())
}
}
diff --git a/dash-frontend/src/tab/processes.rs b/dash-frontend/src/tab/processes.rs
index fdda10d..7a57686 100644
--- a/dash-frontend/src/tab/processes.rs
+++ b/dash-frontend/src/tab/processes.rs
@@ -5,7 +5,7 @@ use wgui::{
use crate::{
tab::{Tab, TabParams, TabType, TabUpdateParams},
- views::display_list,
+ views::{display_list, process_list},
};
pub struct TabProcesses {
@@ -13,6 +13,7 @@ pub struct TabProcesses {
pub state: ParserState,
view_display_list: display_list::View,
+ view_process_list: process_list::View,
}
impl Tab for TabProcesses {
@@ -22,6 +23,7 @@ impl Tab for TabProcesses {
fn update(&mut self, params: TabUpdateParams) -> anyhow::Result<()> {
self.view_display_list.update(params.layout, params.interface)?;
+ self.view_process_list.update(params.layout, params.interface)?;
Ok(())
}
}
@@ -45,6 +47,12 @@ impl TabProcesses {
globals: params.globals.clone(),
frontend_tasks: params.frontend_tasks.clone(),
})?,
+ view_process_list: process_list::View::new(process_list::Params {
+ layout: params.layout,
+ parent_id: state.get_widget_id("process_list_parent")?,
+ globals: params.globals.clone(),
+ frontend_tasks: params.frontend_tasks.clone(),
+ })?,
state,
})
}
diff --git a/dash-frontend/src/util/desktop_finder.rs b/dash-frontend/src/util/desktop_finder.rs
index 8f0b6b5..e6e117d 100644
--- a/dash-frontend/src/util/desktop_finder.rs
+++ b/dash-frontend/src/util/desktop_finder.rs
@@ -1,5 +1,16 @@
use gio::prelude::{AppInfoExt, IconExt};
use gtk::traits::IconThemeExt;
+use serde::{Deserialize, Serialize};
+
+// compatibility with wayvr-ipc
+#[derive(Debug, Deserialize, Serialize)]
+pub struct DesktopFile {
+ pub name: String,
+ pub icon: Option,
+ pub exec_path: String,
+ pub exec_args: Vec,
+ pub categories: Vec,
+}
#[derive(Debug, Clone)]
#[allow(dead_code)] // TODO: remove this
diff --git a/dash-frontend/src/util/mod.rs b/dash-frontend/src/util/mod.rs
index 1331ba1..49c84fc 100644
--- a/dash-frontend/src/util/mod.rs
+++ b/dash-frontend/src/util/mod.rs
@@ -2,3 +2,4 @@ pub mod desktop_finder;
pub mod pactl_wrapper;
pub mod popup_manager;
pub mod toast_manager;
+pub mod various;
diff --git a/dash-frontend/src/util/various.rs b/dash-frontend/src/util/various.rs
new file mode 100644
index 0000000..72bd974
--- /dev/null
+++ b/dash-frontend/src/util/various.rs
@@ -0,0 +1,93 @@
+use std::{path::PathBuf, str::FromStr};
+
+use wayvr_ipc::packet_server;
+use wgui::{
+ assets::{AssetPath, AssetPathOwned},
+ globals::WguiGlobals,
+ i18n::Translation,
+ layout::{Layout, WidgetID},
+ renderer_vk::text::custom_glyph::{CustomGlyphContent, CustomGlyphData},
+ taffy::{self, prelude::length},
+ widget::{
+ label::{WidgetLabel, WidgetLabelParams},
+ sprite::{WidgetSprite, WidgetSpriteParams},
+ },
+};
+use wlx_common::dash_interface::BoxDashInterface;
+
+use crate::util::desktop_finder;
+
+pub fn get_desktop_file_icon_path(desktop_file: &desktop_finder::DesktopFile) -> AssetPathOwned {
+ /*
+ FIXME: why is the compiler complaining about trailing irrefutable patterns there?!?!
+ looking at the PathBuf::from_str implementation, it always returns Ok() and it's inline, maybe that's why.
+ */
+ if let Some(icon) = &desktop_file.icon
+ && let Ok(path) = PathBuf::from_str(icon)
+ {
+ return AssetPathOwned::File(path);
+ }
+
+ AssetPathOwned::BuiltIn(PathBuf::from_str("dashboard/terminal.svg").unwrap())
+}
+
+pub fn get_all_windows(interface: &mut BoxDashInterface) -> anyhow::Result> {
+ let mut windows = Vec::::new();
+
+ for display in interface.display_list()? {
+ let Ok(window_list) = interface.display_window_list(display.handle) else {
+ continue;
+ };
+
+ for window in window_list {
+ windows.push(window)
+ }
+ }
+
+ Ok(windows)
+}
+
+pub fn mount_simple_label(
+ globals: &WguiGlobals,
+ layout: &mut Layout,
+ parent_id: WidgetID,
+ translation: Translation,
+) -> anyhow::Result<()> {
+ layout.add_child(
+ parent_id,
+ WidgetLabel::create(
+ &mut globals.get(),
+ WidgetLabelParams {
+ content: translation,
+ ..Default::default()
+ },
+ ),
+ taffy::Style::default(),
+ )?;
+ Ok(())
+}
+
+pub fn mount_simple_sprite_square(
+ globals: &WguiGlobals,
+ layout: &mut Layout,
+ parent_id: WidgetID,
+ size_px: f32,
+ path: AssetPath,
+) -> anyhow::Result<()> {
+ layout.add_child(
+ parent_id,
+ WidgetSprite::create(WidgetSpriteParams {
+ glyph_data: Some(CustomGlyphData::new(CustomGlyphContent::from_assets(globals, path)?)),
+ ..Default::default()
+ }),
+ taffy::Style {
+ size: taffy::Size {
+ width: length(size_px),
+ height: length(size_px),
+ },
+ ..Default::default()
+ },
+ )?;
+
+ Ok(())
+}
diff --git a/dash-frontend/src/views/mod.rs b/dash-frontend/src/views/mod.rs
index 631d1f2..64c3260 100644
--- a/dash-frontend/src/views/mod.rs
+++ b/dash-frontend/src/views/mod.rs
@@ -3,3 +3,4 @@ pub mod app_launcher;
pub mod audio_settings;
pub mod display_list;
pub mod display_options;
+pub mod process_list;
diff --git a/dash-frontend/src/views/process_list.rs b/dash-frontend/src/views/process_list.rs
new file mode 100644
index 0000000..a21c566
--- /dev/null
+++ b/dash-frontend/src/views/process_list.rs
@@ -0,0 +1,310 @@
+use std::rc::Rc;
+
+use wayvr_ipc::packet_server::{self};
+use wgui::{
+ assets::AssetPath,
+ components::{
+ self,
+ button::ComponentButton,
+ tooltip::{TooltipInfo, TooltipSide},
+ },
+ globals::WguiGlobals,
+ i18n::Translation,
+ layout::{Layout, WidgetID},
+ parser::{Fetchable, ParseDocumentParams, ParserState},
+ taffy::{self, prelude::length},
+ widget::{
+ ConstructEssentials,
+ div::WidgetDiv,
+ label::{WidgetLabel, WidgetLabelParams},
+ },
+};
+use wlx_common::dash_interface::BoxDashInterface;
+
+use crate::{
+ frontend::FrontendTasks,
+ task::Tasks,
+ util::{
+ self,
+ desktop_finder::{self},
+ various::get_desktop_file_icon_path,
+ },
+};
+
+#[derive(Clone)]
+enum Task {
+ Refresh,
+ TerminateProcess(packet_server::WvrProcess),
+}
+
+pub struct Params<'a> {
+ pub globals: WguiGlobals,
+ pub frontend_tasks: FrontendTasks,
+ pub layout: &'a mut Layout,
+ pub parent_id: WidgetID,
+}
+
+pub struct View {
+ #[allow(dead_code)]
+ pub parser_state: ParserState,
+ tasks: Tasks,
+ frontend_tasks: FrontendTasks,
+ globals: WguiGlobals,
+ id_list_parent: WidgetID,
+}
+
+impl View {
+ pub fn new(params: Params) -> anyhow::Result {
+ let doc_params = &ParseDocumentParams {
+ globals: params.globals.clone(),
+ path: AssetPath::BuiltIn("gui/view/process_list.xml"),
+ extra: Default::default(),
+ };
+
+ let parser_state = wgui::parser::parse_from_assets(doc_params, params.layout, params.parent_id)?;
+ let list_parent = parser_state.fetch_widget(¶ms.layout.state, "list_parent")?;
+
+ let tasks = Tasks::new();
+
+ tasks.push(Task::Refresh);
+
+ Ok(Self {
+ parser_state,
+ tasks,
+ frontend_tasks: params.frontend_tasks,
+ globals: params.globals,
+ id_list_parent: list_parent.id,
+ })
+ }
+
+ pub fn update(&mut self, layout: &mut Layout, interface: &mut BoxDashInterface) -> anyhow::Result<()> {
+ loop {
+ let tasks = self.tasks.drain();
+ if tasks.is_empty() {
+ break;
+ }
+ for task in tasks {
+ match task {
+ Task::Refresh => self.refresh(layout, interface)?,
+ Task::TerminateProcess(process) => self.terminate_process(interface, process)?,
+ }
+ }
+ }
+
+ Ok(())
+ }
+}
+
+fn get_desktop_file_from_process(
+ windows: &Vec,
+ process: &packet_server::WvrProcess,
+) -> Option {
+ for window in windows {
+ if window.process_handle != process.handle {
+ continue;
+ }
+
+ // TODO: refactor this after we ditch wayvr-ipc completely
+ let Some(dfile_str) = process.userdata.get("desktop_file") else {
+ continue;
+ };
+
+ let Ok(desktop_file) = serde_json::from_str::(dfile_str) else {
+ debug_assert!(false); // invalid json???
+ continue;
+ };
+
+ return Some(desktop_file);
+ }
+
+ None
+}
+
+struct ProcessEntryResult {
+ btn_terminate: Rc,
+}
+
+fn construct_process_entry(
+ ess: &mut ConstructEssentials,
+ globals: &WguiGlobals,
+ process: &packet_server::WvrProcess,
+ display: Option<&packet_server::WvrDisplay>,
+ all_windows: &Vec,
+) -> anyhow::Result {
+ let (cell, _) = ess.layout.add_child(
+ ess.parent,
+ WidgetDiv::create(),
+ taffy::Style {
+ flex_direction: taffy::FlexDirection::Row,
+ align_items: Some(taffy::AlignItems::Center),
+ gap: length(8.0),
+ ..Default::default()
+ },
+ )?;
+
+ let text_terminate_process = Translation::from_raw_text_string(globals.i18n().translate_and_replace(
+ "PROCESS_LIST.TERMINATE_PROCESS_NAMED_X",
+ ("{PROCESS_NAME}", &process.name),
+ ));
+
+ //"Terminate process" button
+ let (_, btn_terminate) = components::button::construct(
+ &mut ConstructEssentials {
+ layout: ess.layout,
+ parent: cell.id,
+ },
+ components::button::Params {
+ sprite_src: Some(AssetPath::BuiltIn("dashboard/remove_circle.svg")),
+ tooltip: Some(TooltipInfo {
+ text: text_terminate_process,
+ side: TooltipSide::Right,
+ }),
+ ..Default::default()
+ },
+ )?;
+
+ if let Some(desktop_file) = get_desktop_file_from_process(all_windows, process) {
+ // desktop file icon and process name
+ util::various::mount_simple_sprite_square(
+ globals,
+ ess.layout,
+ cell.id,
+ 24.0,
+ get_desktop_file_icon_path(&desktop_file).as_ref(),
+ )?;
+
+ util::various::mount_simple_label(
+ globals,
+ ess.layout,
+ cell.id,
+ Translation::from_raw_text_string(desktop_file.name.clone()),
+ )?;
+ } else {
+ // just show a process name
+ util::various::mount_simple_label(
+ globals,
+ ess.layout,
+ cell.id,
+ Translation::from_raw_text_string(process.name.clone()),
+ )?;
+ }
+
+ if let Some(display) = display {
+ // show display icon if available
+
+ // "on" text
+ util::various::mount_simple_label(
+ globals,
+ ess.layout,
+ cell.id,
+ Translation::from_translation_key("PROCESS_LIST.LOCATED_ON"),
+ )?;
+
+ // "display" icon
+ util::various::mount_simple_sprite_square(
+ globals,
+ ess.layout,
+ cell.id,
+ 24.0,
+ AssetPath::BuiltIn("dashboard/display.svg"),
+ )?;
+
+ // display name itself
+ util::various::mount_simple_label(
+ globals,
+ ess.layout,
+ cell.id,
+ Translation::from_raw_text_string(display.name.clone()),
+ )?;
+ }
+
+ Ok(ProcessEntryResult { btn_terminate })
+}
+
+fn fill_process_list(
+ globals: &WguiGlobals,
+ ess: &mut ConstructEssentials,
+ tasks: &Tasks,
+ list: &Vec,
+ displays: &Vec,
+ all_windows: &Vec,
+) -> anyhow::Result<()> {
+ for process_entry in list {
+ let mut matching_display = None;
+ for display in displays {
+ if process_entry.display_handle == display.handle {
+ matching_display = Some(display);
+ }
+ }
+
+ let entry_res = construct_process_entry(ess, globals, process_entry, matching_display, all_windows)?;
+
+ entry_res.btn_terminate.on_click({
+ let tasks = tasks.clone();
+ let entry = process_entry.clone();
+ Box::new(move |_, _| {
+ tasks.push(Task::TerminateProcess(entry.clone()));
+ Ok(())
+ })
+ });
+ }
+
+ Ok(())
+}
+
+impl View {
+ fn refresh(&mut self, layout: &mut Layout, interface: &mut BoxDashInterface) -> anyhow::Result<()> {
+ layout.remove_children(self.id_list_parent);
+
+ let displays = interface.display_list()?;
+ let all_windows = util::various::get_all_windows(interface)?;
+
+ let mut text: Option = None;
+ match interface.process_list() {
+ Ok(list) => {
+ if list.is_empty() {
+ text = Some(Translation::from_translation_key("PROCESS_LIST.NO_PROCESSES_FOUND"))
+ } else {
+ fill_process_list(
+ &self.globals,
+ &mut ConstructEssentials {
+ layout,
+ parent: self.id_list_parent,
+ },
+ &self.tasks,
+ &list,
+ &displays,
+ &all_windows,
+ )?;
+ }
+ }
+ Err(e) => text = Some(Translation::from_raw_text(&format!("Error: {:?}", e))),
+ }
+
+ if let Some(text) = text.take() {
+ layout.add_child(
+ self.id_list_parent,
+ WidgetLabel::create(
+ &mut self.globals.get(),
+ WidgetLabelParams {
+ content: text,
+ ..Default::default()
+ },
+ ),
+ Default::default(),
+ )?;
+ }
+
+ Ok(())
+ }
+
+ fn terminate_process(
+ &mut self,
+ interface: &mut BoxDashInterface,
+ process: packet_server::WvrProcess,
+ ) -> anyhow::Result<()> {
+ interface.process_terminate(process.handle)?;
+ self.tasks.push(Task::Refresh);
+ Ok(())
+ }
+}
diff --git a/wgui/src/components/button.rs b/wgui/src/components/button.rs
index 79a425b..10a947a 100644
--- a/wgui/src/components/button.rs
+++ b/wgui/src/components/button.rs
@@ -443,7 +443,7 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
if let Some(sprite_path) = params.sprite_src {
let sprite = WidgetSprite::create(WidgetSpriteParams {
glyph_data: Some(CustomGlyphData::new(CustomGlyphContent::from_assets(
- &mut globals,
+ &globals,
sprite_path,
)?)),
..Default::default()
@@ -457,7 +457,7 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
width: length(20.0),
height: length(20.0),
},
- margin: default_margin.clone(),
+ margin: default_margin,
..Default::default()
},
)?;
diff --git a/wgui/src/parser/widget_sprite.rs b/wgui/src/parser/widget_sprite.rs
index fc86f16..c961e86 100644
--- a/wgui/src/parser/widget_sprite.rs
+++ b/wgui/src/parser/widget_sprite.rs
@@ -32,7 +32,7 @@ pub fn parse_widget_sprite<'a>(
};
if !value.is_empty() {
- glyph = match CustomGlyphContent::from_assets(&mut ctx.layout.state.globals, asset_path) {
+ glyph = match CustomGlyphContent::from_assets(&ctx.layout.state.globals, asset_path) {
Ok(glyph) => Some(glyph),
Err(e) => {
log::warn!("failed to load {value}: {e}");
diff --git a/wgui/src/renderer_vk/text/custom_glyph.rs b/wgui/src/renderer_vk/text/custom_glyph.rs
index 4f3412c..ed3706d 100644
--- a/wgui/src/renderer_vk/text/custom_glyph.rs
+++ b/wgui/src/renderer_vk/text/custom_glyph.rs
@@ -38,7 +38,7 @@ impl CustomGlyphContent {
}
#[allow(clippy::case_sensitive_file_extension_comparisons)]
- pub fn from_assets(globals: &mut WguiGlobals, path: AssetPath) -> anyhow::Result {
+ pub fn from_assets(globals: &WguiGlobals, path: AssetPath) -> anyhow::Result {
let path_str = path.get_str();
let data = globals.get_asset(path)?;
if path_str.ends_with(".svg") || path_str.ends_with(".svgz") {
diff --git a/wlx-common/src/dash_interface.rs b/wlx-common/src/dash_interface.rs
index e2a0f82..2bd914b 100644
--- a/wlx-common/src/dash_interface.rs
+++ b/wlx-common/src/dash_interface.rs
@@ -22,6 +22,7 @@ pub trait DashInterface {
fn process_list(&mut self) -> anyhow::Result>;
fn process_terminate(&mut self, handle: WvrProcessHandle) -> anyhow::Result<()>;
fn window_set_visible(&mut self, handle: WvrWindowHandle, visible: bool) -> anyhow::Result<()>;
+ fn recenter_playspace(&mut self) -> anyhow::Result<()>;
}
pub type BoxDashInterface = Box;
diff --git a/wlx-common/src/dash_interface_emulated.rs b/wlx-common/src/dash_interface_emulated.rs
index c1106f5..086eee4 100644
--- a/wlx-common/src/dash_interface_emulated.rs
+++ b/wlx-common/src/dash_interface_emulated.rs
@@ -61,10 +61,25 @@ pub struct DashInterfaceEmulated {
impl DashInterfaceEmulated {
pub fn new() -> Self {
- Self {
- displays: EmuDisplayVec::new(),
- processes: EmuProcessVec::new(),
- }
+ let mut displays = EmuDisplayVec::new();
+ let disp_handle = displays.add(EmuDisplay {
+ width: 1280,
+ height: 720,
+ layout: WvrDisplayWindowLayout::Tiling,
+ name: String::from("Emulated display"),
+ visible: true,
+ });
+
+ let mut processes = EmuProcessVec::new();
+ processes.add(EmuProcess {
+ display_handle: WvrDisplayHandle {
+ idx: disp_handle.idx,
+ generation: disp_handle.generation,
+ },
+ name: String::from("Emulated process"),
+ });
+
+ Self { displays, processes }
}
}
@@ -170,4 +185,9 @@ impl DashInterface for DashInterfaceEmulated {
// stub!
Ok(())
}
+
+ fn recenter_playspace(&mut self) -> anyhow::Result<()> {
+ // stub!
+ Ok(())
+ }
}