wayvrctl + panel-modify ipc
This commit is contained in:
@@ -20,11 +20,16 @@ categories = ["games"]
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
anyhow.workspace = true
|
||||
clap.workspace = true
|
||||
log.workspace = true
|
||||
slotmap.workspace = true
|
||||
serde = { workspace = true, features = ["rc"] }
|
||||
serde_json.workspace = true
|
||||
|
||||
ash = "^0.38.0" # must match vulkano
|
||||
chrono = "0.4.42"
|
||||
chrono-tz = "0.10.4"
|
||||
clap = { version = "4.5.53", features = ["derive"] }
|
||||
config = "0.15.19"
|
||||
dbus = { version = "0.9.9" }
|
||||
futures = "0.3.31"
|
||||
@@ -35,7 +40,6 @@ input-linux = "0.7.1"
|
||||
json = { version = "0.12.4", optional = true }
|
||||
json5 = "1.3.0"
|
||||
libc = "0.2.178"
|
||||
log = { workspace = true }
|
||||
openxr = { git = "https://github.com/Ralith/openxrs", rev = "d0afdd3365bc1e14de28f6a3a21f457e788a702e", features = [
|
||||
"linked",
|
||||
"mint",
|
||||
@@ -51,10 +55,7 @@ rodio = { version = "0.21.1", default-features = false, features = [
|
||||
"hound",
|
||||
] }
|
||||
rosc = { version = "0.11.4", optional = true }
|
||||
serde = { version = "1.0.228", features = ["derive", "rc"] }
|
||||
serde_json = "1.0.145"
|
||||
serde_yaml = "0.9.34"
|
||||
slotmap = { workspace = true }
|
||||
smallvec = "1.15.1"
|
||||
strum = { version = "0.27.2", features = ["derive"] }
|
||||
sysinfo = { version = "0.37" }
|
||||
|
||||
@@ -55,7 +55,7 @@ pub enum PlayspaceTask {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum OverlayCustomCommand {
|
||||
pub enum ModifyPanelCommand {
|
||||
SetText(String),
|
||||
SetColor(String),
|
||||
SetSprite(String),
|
||||
@@ -64,10 +64,10 @@ pub enum OverlayCustomCommand {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct OverlayCustomTask {
|
||||
pub struct ModifyPanelTask {
|
||||
pub overlay: String,
|
||||
pub element: String,
|
||||
pub command: OverlayCustomCommand,
|
||||
pub command: ModifyPanelCommand,
|
||||
}
|
||||
|
||||
pub type ModifyOverlayTask = dyn FnOnce(&mut AppState, &mut OverlayWindowConfig) + Send;
|
||||
@@ -82,7 +82,7 @@ pub enum OverlayTask {
|
||||
CleanupMirrors,
|
||||
Modify(OverlaySelector, Box<ModifyOverlayTask>),
|
||||
Create(OverlaySelector, Box<CreateOverlayTask>),
|
||||
Custom(OverlayCustomTask),
|
||||
ModifyPanel(ModifyPanelTask),
|
||||
Drop(OverlaySelector),
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ pub enum WayVRSignal {
|
||||
BroadcastStateChanged(packet_server::WvrStateChanged),
|
||||
DropOverlay(crate::windowing::OverlayID),
|
||||
Haptics(super::input::Haptics),
|
||||
CustomTask(crate::backend::task::OverlayCustomTask),
|
||||
CustomTask(crate::backend::task::ModifyPanelTask),
|
||||
}
|
||||
|
||||
pub enum BlitMethod {
|
||||
|
||||
@@ -479,30 +479,33 @@ impl Connection {
|
||||
));
|
||||
}
|
||||
|
||||
fn handle_wlx_custom(params: &mut TickParams, custom_params: packet_client::WlxCustomParams) {
|
||||
use crate::backend::task::{OverlayCustomCommand, OverlayCustomTask};
|
||||
fn handle_wlx_panel(
|
||||
params: &mut TickParams,
|
||||
custom_params: packet_client::WlxModifyPanelParams,
|
||||
) {
|
||||
use crate::backend::task::{ModifyPanelCommand, ModifyPanelTask};
|
||||
|
||||
params
|
||||
.state
|
||||
.signals
|
||||
.send(super::WayVRSignal::CustomTask(OverlayCustomTask {
|
||||
.send(super::WayVRSignal::CustomTask(ModifyPanelTask {
|
||||
overlay: custom_params.overlay,
|
||||
element: custom_params.element,
|
||||
command: match custom_params.command {
|
||||
packet_client::WlxCustomCommand::SetText(text) => {
|
||||
OverlayCustomCommand::SetText(text)
|
||||
packet_client::WlxModifyPanelCommand::SetText(text) => {
|
||||
ModifyPanelCommand::SetText(text)
|
||||
}
|
||||
packet_client::WlxCustomCommand::SetSprite(sprite) => {
|
||||
OverlayCustomCommand::SetSprite(sprite)
|
||||
packet_client::WlxModifyPanelCommand::SetSprite(sprite) => {
|
||||
ModifyPanelCommand::SetSprite(sprite)
|
||||
}
|
||||
packet_client::WlxCustomCommand::SetStickyState(sticky) => {
|
||||
OverlayCustomCommand::SetStickyState(sticky)
|
||||
packet_client::WlxModifyPanelCommand::SetStickyState(sticky) => {
|
||||
ModifyPanelCommand::SetStickyState(sticky)
|
||||
}
|
||||
packet_client::WlxCustomCommand::SetVisible(visible) => {
|
||||
OverlayCustomCommand::SetVisible(visible)
|
||||
packet_client::WlxModifyPanelCommand::SetVisible(visible) => {
|
||||
ModifyPanelCommand::SetVisible(visible)
|
||||
}
|
||||
packet_client::WlxCustomCommand::SetColor(color) => {
|
||||
OverlayCustomCommand::SetColor(color)
|
||||
packet_client::WlxModifyPanelCommand::SetColor(color) => {
|
||||
ModifyPanelCommand::SetColor(color)
|
||||
}
|
||||
},
|
||||
}));
|
||||
@@ -560,8 +563,8 @@ impl Connection {
|
||||
PacketClient::WlxHaptics(haptics_params) => {
|
||||
Self::handle_wlx_haptics(params, haptics_params);
|
||||
}
|
||||
PacketClient::WlxCustom(custom_params) => {
|
||||
Self::handle_wlx_custom(params, custom_params);
|
||||
PacketClient::WlxModifyPanel(custom_params) => {
|
||||
Self::handle_wlx_panel(params, custom_params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ use wgui::{
|
||||
use wlx_common::windowing::OverlayWindowState;
|
||||
|
||||
use crate::{
|
||||
backend::task::OverlayCustomCommand,
|
||||
backend::task::ModifyPanelCommand,
|
||||
gui::{
|
||||
panel::{GuiPanel, NewGuiPanelParams},
|
||||
timer::GuiTimer,
|
||||
@@ -86,7 +86,7 @@ fn apply_custom_command(
|
||||
panel: &mut GuiPanel<CustomPanelState>,
|
||||
app: &mut AppState,
|
||||
element: &str,
|
||||
command: &OverlayCustomCommand,
|
||||
command: &ModifyPanelCommand,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut alterables = EventAlterables::default();
|
||||
let mut com = CallbackDataCommon {
|
||||
@@ -95,7 +95,7 @@ fn apply_custom_command(
|
||||
};
|
||||
|
||||
match command {
|
||||
OverlayCustomCommand::SetText(text) => {
|
||||
ModifyPanelCommand::SetText(text) => {
|
||||
if let Ok(mut label) = panel
|
||||
.parser_state
|
||||
.fetch_widget_as::<WidgetLabel>(&panel.layout.state, element)
|
||||
@@ -110,7 +110,7 @@ fn apply_custom_command(
|
||||
anyhow::bail!("No <label> or <Button> with such id.");
|
||||
}
|
||||
}
|
||||
OverlayCustomCommand::SetSprite(path) => {
|
||||
ModifyPanelCommand::SetSprite(path) => {
|
||||
let mut widget = panel
|
||||
.parser_state
|
||||
.fetch_widget_as::<WidgetSprite>(&panel.layout.state, element)
|
||||
@@ -130,7 +130,7 @@ fn apply_custom_command(
|
||||
widget.set_content(&mut com, Some(data));
|
||||
}
|
||||
}
|
||||
OverlayCustomCommand::SetColor(color) => {
|
||||
ModifyPanelCommand::SetColor(color) => {
|
||||
let color = parse_color_hex(&color)
|
||||
.context("Invalid color format, must be a html hex color!")?;
|
||||
|
||||
@@ -151,7 +151,7 @@ fn apply_custom_command(
|
||||
anyhow::bail!("No <rectangle> or <label> or <sprite> with such id.");
|
||||
}
|
||||
}
|
||||
OverlayCustomCommand::SetVisible(visible) => {
|
||||
ModifyPanelCommand::SetVisible(visible) => {
|
||||
let wid = panel
|
||||
.parser_state
|
||||
.get_widget_id(&element)
|
||||
@@ -166,7 +166,7 @@ fn apply_custom_command(
|
||||
com.alterables
|
||||
.set_style(wid, wgui::event::StyleSetRequest::Display(display));
|
||||
}
|
||||
OverlayCustomCommand::SetStickyState(sticky_down) => {
|
||||
ModifyPanelCommand::SetStickyState(sticky_down) => {
|
||||
let button = panel
|
||||
.parser_state
|
||||
.fetch_component_as::<ComponentButton>(element)
|
||||
|
||||
@@ -463,7 +463,7 @@ where
|
||||
}
|
||||
wayvr::WayVRSignal::CustomTask(custom_task) => {
|
||||
app.tasks
|
||||
.enqueue(TaskType::Overlay(OverlayTask::Custom(custom_task)));
|
||||
.enqueue(TaskType::Overlay(OverlayTask::ModifyPanel(custom_task)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use wlx_common::{
|
||||
use crate::{
|
||||
backend::{
|
||||
input::{HoverResult, PointerHit},
|
||||
task::OverlayCustomCommand,
|
||||
task::ModifyPanelCommand,
|
||||
},
|
||||
graphics::{ExtentExt, RenderResult},
|
||||
state::AppState,
|
||||
@@ -128,7 +128,7 @@ pub enum OverlayEventData {
|
||||
},
|
||||
CustomCommand {
|
||||
element: String,
|
||||
command: OverlayCustomCommand,
|
||||
command: ModifyPanelCommand,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ where
|
||||
self.dropped_overlays.push_back(o);
|
||||
}
|
||||
}
|
||||
OverlayTask::Custom(task) => {
|
||||
OverlayTask::ModifyPanel(task) => {
|
||||
if let Some(oid) = self.lookup(&task.overlay)
|
||||
&& let Some(o) = self.mut_by_id(oid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user