Merge remote-tracking branch 'origin/wlvk' into next-dash-interface
[skip ci]
This commit is contained in:
@@ -492,6 +492,7 @@ pub fn openxr_run(show_by_default: bool, headless: bool) -> Result<(), BackendEr
|
||||
}
|
||||
#[cfg(feature = "openvr")]
|
||||
TaskType::OpenVR(_) => {}
|
||||
#[cfg(feature = "wayvr")]
|
||||
TaskType::WayVR(_action) => { /* TODO */ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ impl compositor::CompositorHandler for Application {
|
||||
}
|
||||
}
|
||||
Some(BufferType::Shm) => {
|
||||
with_buffer_contents(&buffer, |data, size, buf| {
|
||||
let _ = with_buffer_contents(&buffer, |data, size, buf| {
|
||||
if let Ok(image) =
|
||||
self.image_importer.import_shm(data, size, buf)
|
||||
{
|
||||
|
||||
@@ -16,10 +16,10 @@ use smithay::{
|
||||
output::{Mode, Output},
|
||||
reexports::wayland_server::{self, backend::ClientId, protocol::wl_buffer},
|
||||
wayland::{
|
||||
compositor::{self, SurfaceData},
|
||||
compositor::{self, SurfaceData, with_states},
|
||||
dmabuf::{DmabufFeedbackBuilder, DmabufState},
|
||||
selection::data_device::DataDeviceState,
|
||||
shell::xdg::{ToplevelSurface, XdgShellState},
|
||||
shell::xdg::{ToplevelSurface, XdgShellState, XdgToplevelSurfaceData},
|
||||
shm::ShmState,
|
||||
},
|
||||
};
|
||||
@@ -45,6 +45,7 @@ use crate::{
|
||||
},
|
||||
graphics::WGfxExtras,
|
||||
ipc::{event_queue::SyncEventQueue, ipc_server, signal::WayVRSignal},
|
||||
overlays::wayvr::create_wl_window_overlay,
|
||||
state::AppState,
|
||||
subsystem::hid::{MODS_TO_KEYS, WheelDelta},
|
||||
windowing::{OverlayID, OverlaySelector},
|
||||
@@ -312,7 +313,34 @@ impl WayVR {
|
||||
.borrow_mut()
|
||||
.create_window(&toplevel, process_handle);
|
||||
|
||||
//TODO: create overlay
|
||||
let title: Arc<str> = with_states(toplevel.wl_surface(), |states| {
|
||||
states
|
||||
.data_map
|
||||
.get::<XdgToplevelSurfaceData>()
|
||||
.and_then(|t| t.lock().unwrap().title.clone())
|
||||
.map(|t| t.into())
|
||||
.unwrap_or_else(|| format!("P{}", client.pid).into())
|
||||
});
|
||||
|
||||
app.tasks.enqueue(TaskType::Overlay(OverlayTask::Create(
|
||||
OverlaySelector::Nothing,
|
||||
Box::new(move |app: &mut AppState| {
|
||||
Some(
|
||||
create_wl_window_overlay(
|
||||
title,
|
||||
app.xr_backend,
|
||||
app.wayland_server.as_ref().unwrap().clone(),
|
||||
window_handle,
|
||||
)
|
||||
.inspect_err(|e| {
|
||||
log::error!("Could not add wayland client overlay: {e:?}")
|
||||
})
|
||||
.ok()?,
|
||||
)
|
||||
}),
|
||||
)));
|
||||
|
||||
//TODO: populate window_to_overlay
|
||||
|
||||
app.wayvr_signals.send(WayVRSignal::BroadcastStateChanged(
|
||||
packet_server::WvrStateChanged::WindowCreated,
|
||||
@@ -346,6 +374,8 @@ impl WayVR {
|
||||
if let Some(process) = self.state.processes.get_mut(&process_handle) {
|
||||
process.terminate();
|
||||
}
|
||||
|
||||
//TODO: force drop related overlays
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -540,9 +570,11 @@ pub struct SurfaceBufWithImage {
|
||||
}
|
||||
|
||||
impl SurfaceBufWithImage {
|
||||
#[allow(invalid_value)]
|
||||
fn apply_to_surface(self, surface_data: &SurfaceData) {
|
||||
let container = surface_data.data_map.get_or_insert(|| unsafe {
|
||||
SurfaceBufWithImageContainer {
|
||||
// safe because we're replacing right after
|
||||
inner: RefCell::new(MaybeUninit::uninit().assume_init()),
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ pub struct ScreenBackend {
|
||||
}
|
||||
|
||||
impl ScreenBackend {
|
||||
pub fn new_raw(
|
||||
pub(super) fn new_raw(
|
||||
name: Arc<str>,
|
||||
xr_backend: XrBackend,
|
||||
capture: Box<dyn WlxCapture<WlxCaptureIn, WlxCaptureOut>>,
|
||||
|
||||
@@ -3,7 +3,10 @@ use smithay::wayland::compositor::with_states;
|
||||
use std::{cell::RefCell, collections::HashMap, rc::Rc, sync::Arc};
|
||||
use vulkano::image::view::ImageView;
|
||||
use wgui::gfx::WGfx;
|
||||
use wlx_common::overlays::{BackendAttrib, BackendAttribValue, StereoMode};
|
||||
use wlx_common::{
|
||||
overlays::{BackendAttrib, BackendAttribValue, StereoMode},
|
||||
windowing::{OverlayWindowState, Positioning},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
backend::{
|
||||
@@ -15,13 +18,14 @@ use crate::{
|
||||
ipc::{event_queue::SyncEventQueue, signal::WayVRSignal},
|
||||
overlays::screen::capture::ScreenPipeline,
|
||||
state::{self, AppState},
|
||||
subsystem::hid::WheelDelta,
|
||||
subsystem::{hid::WheelDelta, input::KeyboardFocus},
|
||||
windowing::{
|
||||
OverlayID,
|
||||
backend::{
|
||||
FrameMeta, OverlayBackend, OverlayEventData, RenderResources, ShouldRender,
|
||||
ui_transform,
|
||||
},
|
||||
window::{OverlayCategory, OverlayWindowConfig},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -44,6 +48,35 @@ impl WayVRData {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_wl_window_overlay(
|
||||
name: Arc<str>,
|
||||
xr_backend: XrBackend,
|
||||
wayvr: Rc<RefCell<WayVRData>>,
|
||||
window: wayvr::window::WindowHandle,
|
||||
) -> anyhow::Result<OverlayWindowConfig> {
|
||||
Ok(OverlayWindowConfig {
|
||||
name: name.clone(),
|
||||
default_state: OverlayWindowState {
|
||||
grabbable: true,
|
||||
interactable: true,
|
||||
positioning: Positioning::Floating,
|
||||
curvature: Some(0.15),
|
||||
transform: Affine3A::from_scale_rotation_translation(
|
||||
Vec3::ONE,
|
||||
Quat::IDENTITY,
|
||||
vec3(0.0, 0.0, -0.4),
|
||||
),
|
||||
..OverlayWindowState::default()
|
||||
},
|
||||
keyboard_focus: Some(KeyboardFocus::WayVR),
|
||||
category: OverlayCategory::WayVR,
|
||||
show_on_spawn: true,
|
||||
..OverlayWindowConfig::from_backend(Box::new(WayVRBackend::new(
|
||||
name, xr_backend, wayvr, window,
|
||||
)?))
|
||||
})
|
||||
}
|
||||
|
||||
pub struct WayVRBackend {
|
||||
name: Arc<str>,
|
||||
pipeline: Option<ScreenPipeline>,
|
||||
@@ -59,7 +92,7 @@ pub struct WayVRBackend {
|
||||
}
|
||||
|
||||
impl WayVRBackend {
|
||||
pub fn new(
|
||||
fn new(
|
||||
name: Arc<str>,
|
||||
xr_backend: XrBackend,
|
||||
wayvr: Rc<RefCell<WayVRData>>,
|
||||
|
||||
@@ -532,6 +532,7 @@ impl<T> OverlayWindowManager<T> {
|
||||
match selector {
|
||||
OverlaySelector::Id(id) => Some(*id),
|
||||
OverlaySelector::Name(name) => self.lookup(name),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,6 +552,7 @@ impl<T> OverlayWindowManager<T> {
|
||||
let id = match selector {
|
||||
OverlaySelector::Id(id) => *id,
|
||||
OverlaySelector::Name(name) => self.lookup(name)?,
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
let ret_val = self.overlays.remove(id);
|
||||
|
||||
@@ -15,6 +15,7 @@ new_key_type! {
|
||||
pub enum OverlaySelector {
|
||||
Id(OverlayID),
|
||||
Name(Arc<str>),
|
||||
Nothing,
|
||||
}
|
||||
|
||||
pub const Z_ORDER_TOAST: u32 = 71;
|
||||
|
||||
Reference in New Issue
Block a user