WayVR: Initial GUI integration

The format of the wayvr.yaml configuration file is subject to change at any time.
This commit is contained in:
Aleksander
2024-10-19 20:39:54 +02:00
committed by galister
parent edfa77e07c
commit d9dddbad11
17 changed files with 453 additions and 89 deletions
+11
View File
@@ -42,6 +42,9 @@ use crate::{
state::AppState,
};
#[cfg(feature = "wayvr")]
use crate::overlays::wayvr::action_wayvr;
pub mod helpers;
pub mod input;
pub mod lines;
@@ -262,6 +265,14 @@ pub fn openvr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
overlays.show_hide(&mut state);
}
},
#[cfg(feature = "wayvr")]
TaskType::WayVR(task) => {
if let Some(overlay) =
action_wayvr(&task.catalog_name, &task.app_name, &mut state)
{
overlays.add(overlay);
}
}
}
}
+11
View File
@@ -31,6 +31,9 @@ use crate::{
state::AppState,
};
#[cfg(feature = "wayvr")]
use crate::overlays::wayvr::action_wayvr;
mod helpers;
mod input;
mod lines;
@@ -487,6 +490,14 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
}
_ => {}
},
#[cfg(feature = "wayvr")]
TaskType::WayVR(task) => {
if let Some(overlay) =
action_wayvr(&task.catalog_name, &task.app_name, &mut app_state)
{
overlays.add(overlay);
}
}
}
}
+11
View File
@@ -5,6 +5,9 @@ use std::{
time::Instant,
};
#[cfg(feature = "wayvr")]
use std::sync::Arc;
use serde::Deserialize;
use crate::state::AppState;
@@ -49,6 +52,12 @@ pub enum SystemTask {
ShowHide,
}
#[cfg(feature = "wayvr")]
pub struct WayVRTask {
pub catalog_name: Arc<str>,
pub app_name: Arc<str>,
}
pub type OverlayTask = dyn FnOnce(&mut AppState, &mut OverlayState) + Send;
pub type CreateOverlayTask =
dyn FnOnce(&mut AppState) -> Option<(OverlayState, Box<dyn OverlayBackend>)> + Send;
@@ -59,6 +68,8 @@ pub enum TaskType {
CreateOverlay(OverlaySelector, Box<CreateOverlayTask>),
DropOverlay(OverlaySelector),
System(SystemTask),
#[cfg(feature = "wayvr")]
WayVR(WayVRTask),
}
#[derive(Deserialize, Clone, Copy)]
+1 -1
View File
@@ -30,7 +30,7 @@
- Due to unknown circumstances, dma-buf textures may display various graphical glitches due to invalid dma-buf tiling modifier. Please report your GPU model when filing an issue. Alternatively, you can run wlx-overlay-s with `LIBGL_ALWAYS_SOFTWARE=1` to mitigate that (only the Smithay compositor will run in software renderer mode, wlx will still be accelerated).
- Potential data race in the rendering pipeline - A texture could be displayed during the clear-and-blit process in the compositor, causing minor artifacts (no fence sync support yet).
- ~~Potential data race in the rendering pipeline - A texture could be displayed during the clear-and-blit process in the compositor, causing minor artifacts (no fence sync support yet).~~ happens on all overlays on a simulated Monado driver
- Even though some applications support Wayland, some still check for the `DISPLAY` environment variable and an available X11 server, throwing an error. This can be fixed by running `cage`.
+3
View File
@@ -46,6 +46,7 @@ pub struct Display {
// Display info stuff
pub width: u32,
pub height: u32,
pub name: String,
wm: Rc<RefCell<window::WindowManager>>,
displayed_windows: Vec<DisplayWindow>,
wayland_env: super::WaylandEnv,
@@ -76,6 +77,7 @@ impl Display {
wayland_env: super::WaylandEnv,
width: u32,
height: u32,
name: &str,
) -> anyhow::Result<Self> {
let tex_format = ffi::RGBA;
let internal_format = ffi::RGBA8;
@@ -102,6 +104,7 @@ impl Display {
wm,
width,
height,
name: String::from(name),
displayed_windows: Vec::new(),
egl_data,
dmabuf_data,
+20
View File
@@ -178,10 +178,29 @@ impl WayVR {
.map(|display| display.dmabuf_data.clone())
}
pub fn get_display_by_name(&self, name: &str) -> Option<display::DisplayHandle> {
for (idx, cell) in self.displays.vec.iter().enumerate() {
if let Some(cell) = cell {
if cell.obj.name == name {
return Some(DisplayVec::get_handle(cell, idx));
}
}
}
None
}
pub fn get_display_by_handle(
&self,
display: display::DisplayHandle,
) -> Option<&display::Display> {
self.displays.get(&display)
}
pub fn create_display(
&mut self,
width: u32,
height: u32,
name: &str,
) -> anyhow::Result<display::DisplayHandle> {
let display = display::Display::new(
self.wm.clone(),
@@ -190,6 +209,7 @@ impl WayVR {
self.manager.wayland_env.clone(),
width,
height,
name,
)?;
Ok(self.displays.add(display))
}